diff --git a/CHANGELOG.md b/CHANGELOG.md index 8266bb154d..a65206e263 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,22 +2,27 @@ ## UNRELEASED -### Adds - -* When validating an `area` field, warn the developer if `widgets` is not nested in `options`. - ### Fixes * Focus properly Widget Editor modals when opened. Keep the previous active focus on the modal when closing the widget editor. * a11y improvements for context menus. * Fixes broken widget preview URL when the image is overridden (module improve) and external build module is registered. +* Fixes ability to change color hue by clicking the color hue bar rather than dragging the indicator +* Prevents the rich text control bar from closing while using certain UI within the color picker ### Adds +* When validating an `area` field, warn the developer if `widgets` is not nested in `options`. +* Ability to disable the color spectrum UI of a color picker * Adds support for supplying CSS variable names to a color field's `presetColors` array as selectable values. * Adds support for dynamic focus trap in Context menus (prop `dynamicFocus`). When set to `true`, the focusable elements are recalculated on each cycle step. * Adds option to disable `tabindex` on `AposToggle` component. A new prop `disableFocus` can be set to `false` to disable the focus on the toggle button. It's enabled by default. +### Changes + +* The `pickerOptions` sub property of a color field's configuration has been merged with it's parent `options` object. + + ## 4.10.0 (2024-11-20) ### Fixes diff --git a/modules/@apostrophecms/color-field/index.js b/modules/@apostrophecms/color-field/index.js index bee8cbc929..95f149819d 100644 --- a/modules/@apostrophecms/color-field/index.js +++ b/modules/@apostrophecms/color-field/index.js @@ -10,6 +10,17 @@ module.exports = { self.name = self.options.name; self.addFieldType(); self.enableBrowserData(); + self.defaultOptions = { + format: 'hex8', + disableAlpha: false, + disableFields: false, + disableSpectrum: false, + presetColors: [ + '#D0021B', '#F5A623', '#F8E71C', '#8B572A', '#7ED321', + '#417505', '#BD10E0', '#9013FE', '#4A90E2', '#50E3C2', + '#B8E986', '#000000', '#4A4A4A', '#9B9B9B', '#FFFFFF' + ] + }; }, methods(self) { return { @@ -36,7 +47,8 @@ module.exports = { getBrowserData(req) { return { name: self.name, - action: self.action + action: self.action, + defaultOptions: self.defaultOptions }; } }; diff --git a/modules/@apostrophecms/color-field/ui/apos/components/AposColor.vue b/modules/@apostrophecms/color-field/ui/apos/components/AposColor.vue index 4d532bddd2..0ec8f75ccf 100644 --- a/modules/@apostrophecms/color-field/ui/apos/components/AposColor.vue +++ b/modules/@apostrophecms/color-field/ui/apos/components/AposColor.vue @@ -3,14 +3,22 @@ role="application" aria-label="Color picker" class="apos-color" - :class="[disableAlpha ? 'apos-color--disable-alpha' : '']" + :class="[ + disableAlpha ? 'apos-color--disable-alpha' : null, + disableSpectrum ? 'apos-color--disable-spectrum' : null, + disableFields ? 'apos-color--disable-fields' : null, + !presetColors ? 'apos-color--disable-presets' : null + ]" > -