@wordpress/components 29.12.0 → 30.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/build/autocomplete/index.js +4 -0
- package/build/autocomplete/index.js.map +1 -1
- package/build/box-control/input-control.js +2 -2
- package/build/box-control/input-control.js.map +1 -1
- package/build/calendar/date-calendar/index.js +69 -0
- package/build/calendar/date-calendar/index.js.map +1 -0
- package/build/calendar/date-range-calendar/index.js +172 -0
- package/build/calendar/date-range-calendar/index.js.map +1 -0
- package/build/calendar/index.js +27 -0
- package/build/calendar/index.js.map +1 -0
- package/build/calendar/types.js +6 -0
- package/build/calendar/types.js.map +1 -0
- package/build/calendar/utils/constants.js +68 -0
- package/build/calendar/utils/constants.js.map +1 -0
- package/build/calendar/utils/day-cell.js +137 -0
- package/build/calendar/utils/day-cell.js.map +1 -0
- package/build/calendar/utils/misc.js +10 -0
- package/build/calendar/utils/misc.js.map +1 -0
- package/build/calendar/utils/use-localization-props.js +162 -0
- package/build/calendar/utils/use-localization-props.js.map +1 -0
- package/build/custom-gradient-picker/gradient-bar/control-points.js +1 -1
- package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
- package/build/custom-select-control-v2/custom-select.js +3 -3
- package/build/custom-select-control-v2/custom-select.js.map +1 -1
- package/build/date-time/date/index.js +1 -1
- package/build/date-time/date/index.js.map +1 -1
- package/build/form-token-field/index.js +11 -1
- package/build/form-token-field/index.js.map +1 -1
- package/build/form-token-field/token.js +1 -1
- package/build/form-token-field/token.js.map +1 -1
- package/build/icon/index.js +2 -0
- package/build/icon/index.js.map +1 -1
- package/build/mobile/bottom-sheet/cell.native.js +2 -2
- package/build/mobile/bottom-sheet/cell.native.js.map +1 -1
- package/build/mobile/link-picker/index.native.js +1 -1
- package/build/mobile/link-picker/index.native.js.map +1 -1
- package/build/navigation/menu/menu-title-search.js +1 -1
- package/build/navigation/menu/menu-title-search.js.map +1 -1
- package/build/palette-edit/index.js +4 -4
- package/build/palette-edit/index.js.map +1 -1
- package/build/private-apis.js +5 -1
- package/build/private-apis.js.map +1 -1
- package/build/select-control/index.js +1 -1
- package/build/select-control/index.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/as-button-group.js.map +1 -1
- package/build/utils/hooks/use-controlled-value.js +8 -4
- package/build/utils/hooks/use-controlled-value.js.map +1 -1
- package/build/validated-form-controls/components/checkbox-control.js +52 -0
- package/build/validated-form-controls/components/checkbox-control.js.map +1 -0
- package/build/validated-form-controls/components/combobox-control.js +64 -0
- package/build/validated-form-controls/components/combobox-control.js.map +1 -0
- package/build/validated-form-controls/components/custom-select-control.js +71 -0
- package/build/validated-form-controls/components/custom-select-control.js.map +1 -0
- package/build/validated-form-controls/components/index.js +138 -0
- package/build/validated-form-controls/components/index.js.map +1 -0
- package/build/validated-form-controls/components/input-control.js +50 -0
- package/build/validated-form-controls/components/input-control.js.map +1 -0
- package/build/validated-form-controls/components/number-control.js +53 -0
- package/build/validated-form-controls/components/number-control.js.map +1 -0
- package/build/validated-form-controls/components/radio-control.js +51 -0
- package/build/validated-form-controls/components/radio-control.js.map +1 -0
- package/build/validated-form-controls/components/range-control.js +51 -0
- package/build/validated-form-controls/components/range-control.js.map +1 -0
- package/build/validated-form-controls/components/select-control.js +53 -0
- package/build/validated-form-controls/components/select-control.js.map +1 -0
- package/build/validated-form-controls/components/text-control.js +51 -0
- package/build/validated-form-controls/components/text-control.js.map +1 -0
- package/build/validated-form-controls/components/textarea-control.js +50 -0
- package/build/validated-form-controls/components/textarea-control.js.map +1 -0
- package/build/validated-form-controls/components/toggle-control.js +60 -0
- package/build/validated-form-controls/components/toggle-control.js.map +1 -0
- package/build/validated-form-controls/components/toggle-group-control.js +69 -0
- package/build/validated-form-controls/components/toggle-group-control.js.map +1 -0
- package/build/validated-form-controls/components/types.js +6 -0
- package/build/validated-form-controls/components/types.js.map +1 -0
- package/build/validated-form-controls/control-with-error.js +137 -0
- package/build/validated-form-controls/control-with-error.js.map +1 -0
- package/build/validated-form-controls/index.js +28 -0
- package/build/validated-form-controls/index.js.map +1 -0
- package/build-module/autocomplete/index.js +4 -0
- package/build-module/autocomplete/index.js.map +1 -1
- package/build-module/box-control/input-control.js +2 -2
- package/build-module/box-control/input-control.js.map +1 -1
- package/build-module/calendar/date-calendar/index.js +59 -0
- package/build-module/calendar/date-calendar/index.js.map +1 -0
- package/build-module/calendar/date-range-calendar/index.js +161 -0
- package/build-module/calendar/date-range-calendar/index.js.map +1 -0
- package/build-module/calendar/index.js +4 -0
- package/build-module/calendar/index.js.map +1 -0
- package/build-module/calendar/types.js +2 -0
- package/build-module/calendar/types.js.map +1 -0
- package/build-module/calendar/utils/constants.js +61 -0
- package/build-module/calendar/utils/constants.js.map +1 -0
- package/build-module/calendar/utils/day-cell.js +131 -0
- package/build-module/calendar/utils/day-cell.js.map +1 -0
- package/build-module/calendar/utils/misc.js +4 -0
- package/build-module/calendar/utils/misc.js.map +1 -0
- package/build-module/calendar/utils/use-localization-props.js +154 -0
- package/build-module/calendar/utils/use-localization-props.js.map +1 -0
- package/build-module/custom-gradient-picker/gradient-bar/control-points.js +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
- package/build-module/custom-select-control-v2/custom-select.js +4 -4
- package/build-module/custom-select-control-v2/custom-select.js.map +1 -1
- package/build-module/date-time/date/index.js +1 -1
- package/build-module/date-time/date/index.js.map +1 -1
- package/build-module/form-token-field/index.js +11 -1
- package/build-module/form-token-field/index.js.map +1 -1
- package/build-module/form-token-field/token.js +1 -1
- package/build-module/form-token-field/token.js.map +1 -1
- package/build-module/icon/index.js +2 -0
- package/build-module/icon/index.js.map +1 -1
- package/build-module/mobile/bottom-sheet/cell.native.js +2 -2
- package/build-module/mobile/bottom-sheet/cell.native.js.map +1 -1
- package/build-module/mobile/link-picker/index.native.js +1 -1
- package/build-module/mobile/link-picker/index.native.js.map +1 -1
- package/build-module/navigation/menu/menu-title-search.js +1 -1
- package/build-module/navigation/menu/menu-title-search.js.map +1 -1
- package/build-module/palette-edit/index.js +4 -4
- package/build-module/palette-edit/index.js.map +1 -1
- package/build-module/private-apis.js +5 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/select-control/index.js +1 -1
- package/build-module/select-control/index.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/as-button-group.js.map +1 -1
- package/build-module/utils/hooks/use-controlled-value.js +9 -5
- package/build-module/utils/hooks/use-controlled-value.js.map +1 -1
- package/build-module/validated-form-controls/components/checkbox-control.js +44 -0
- package/build-module/validated-form-controls/components/checkbox-control.js.map +1 -0
- package/build-module/validated-form-controls/components/combobox-control.js +56 -0
- package/build-module/validated-form-controls/components/combobox-control.js.map +1 -0
- package/build-module/validated-form-controls/components/custom-select-control.js +63 -0
- package/build-module/validated-form-controls/components/custom-select-control.js.map +1 -0
- package/build-module/validated-form-controls/components/index.js +13 -0
- package/build-module/validated-form-controls/components/index.js.map +1 -0
- package/build-module/validated-form-controls/components/input-control.js +42 -0
- package/build-module/validated-form-controls/components/input-control.js.map +1 -0
- package/build-module/validated-form-controls/components/number-control.js +45 -0
- package/build-module/validated-form-controls/components/number-control.js.map +1 -0
- package/build-module/validated-form-controls/components/radio-control.js +43 -0
- package/build-module/validated-form-controls/components/radio-control.js.map +1 -0
- package/build-module/validated-form-controls/components/range-control.js +43 -0
- package/build-module/validated-form-controls/components/range-control.js.map +1 -0
- package/build-module/validated-form-controls/components/select-control.js +45 -0
- package/build-module/validated-form-controls/components/select-control.js.map +1 -0
- package/build-module/validated-form-controls/components/text-control.js +43 -0
- package/build-module/validated-form-controls/components/text-control.js.map +1 -0
- package/build-module/validated-form-controls/components/textarea-control.js +42 -0
- package/build-module/validated-form-controls/components/textarea-control.js.map +1 -0
- package/build-module/validated-form-controls/components/toggle-control.js +52 -0
- package/build-module/validated-form-controls/components/toggle-control.js.map +1 -0
- package/build-module/validated-form-controls/components/toggle-group-control.js +62 -0
- package/build-module/validated-form-controls/components/toggle-group-control.js.map +1 -0
- package/build-module/validated-form-controls/components/types.js +2 -0
- package/build-module/validated-form-controls/components/types.js.map +1 -0
- package/build-module/validated-form-controls/control-with-error.js +129 -0
- package/build-module/validated-form-controls/control-with-error.js.map +1 -0
- package/build-module/validated-form-controls/index.js +3 -0
- package/build-module/validated-form-controls/index.js.map +1 -0
- package/build-style/style-rtl.css +418 -22
- package/build-style/style.css +418 -22
- package/build-types/autocomplete/index.d.ts.map +1 -1
- package/build-types/box-control/input-control.d.ts.map +1 -1
- package/build-types/box-control/utils.d.ts +7 -7
- package/build-types/calendar/date-calendar/index.d.ts +11 -0
- package/build-types/calendar/date-calendar/index.d.ts.map +1 -0
- package/build-types/calendar/date-range-calendar/index.d.ts +14 -0
- package/build-types/calendar/date-range-calendar/index.d.ts.map +1 -0
- package/build-types/calendar/index.d.ts +4 -0
- package/build-types/calendar/index.d.ts.map +1 -0
- package/build-types/calendar/stories/date-calendar.story.d.ts +16 -0
- package/build-types/calendar/stories/date-calendar.story.d.ts.map +1 -0
- package/build-types/calendar/stories/date-range-calendar.story.d.ts +16 -0
- package/build-types/calendar/stories/date-range-calendar.story.d.ts.map +1 -0
- package/build-types/calendar/test/__utils__/index.d.ts +10 -0
- package/build-types/calendar/test/__utils__/index.d.ts.map +1 -0
- package/build-types/calendar/test/date-calendar.d.ts +2 -0
- package/build-types/calendar/test/date-calendar.d.ts.map +1 -0
- package/build-types/calendar/test/date-range-calendar.d.ts +2 -0
- package/build-types/calendar/test/date-range-calendar.d.ts.map +1 -0
- package/build-types/calendar/types.d.ts +317 -0
- package/build-types/calendar/types.d.ts.map +1 -0
- package/build-types/calendar/utils/constants.d.ts +52 -0
- package/build-types/calendar/utils/constants.d.ts.map +1 -0
- package/build-types/calendar/utils/day-cell.d.ts +21 -0
- package/build-types/calendar/utils/day-cell.d.ts.map +1 -0
- package/build-types/calendar/utils/misc.d.ts +2 -0
- package/build-types/calendar/utils/misc.d.ts.map +1 -0
- package/build-types/calendar/utils/use-localization-props.d.ts +64 -0
- package/build-types/calendar/utils/use-localization-props.d.ts.map +1 -0
- package/build-types/color-picker/styles.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/constants.d.ts +6 -3
- package/build-types/custom-gradient-picker/constants.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/custom-select.d.ts.map +1 -1
- package/build-types/dimension-control/sizes.d.ts +15 -3
- package/build-types/dimension-control/sizes.d.ts.map +1 -1
- package/build-types/font-size-picker/constants.d.ts +2 -2
- package/build-types/font-size-picker/constants.d.ts.map +1 -1
- package/build-types/form-token-field/index.d.ts.map +1 -1
- package/build-types/icon/index.d.ts.map +1 -1
- package/build-types/popover/overlay-middlewares.d.ts +6 -1
- package/build-types/popover/overlay-middlewares.d.ts.map +1 -1
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/select-control/stories/index.story.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control/as-button-group.d.ts.map +1 -1
- package/build-types/utils/hooks/use-controlled-value.d.ts +2 -2
- package/build-types/utils/hooks/use-controlled-value.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/checkbox-control.d.ts +9 -0
- package/build-types/validated-form-controls/components/checkbox-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/components/combobox-control.d.ts +21 -0
- package/build-types/validated-form-controls/components/combobox-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/components/custom-select-control.d.ts +4 -0
- package/build-types/validated-form-controls/components/custom-select-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/components/index.d.ts +13 -0
- package/build-types/validated-form-controls/components/index.d.ts.map +1 -0
- package/build-types/validated-form-controls/components/input-control.d.ts +4 -0
- package/build-types/validated-form-controls/components/input-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/components/number-control.d.ts +17 -0
- package/build-types/validated-form-controls/components/number-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/components/radio-control.d.ts +11 -0
- package/build-types/validated-form-controls/components/radio-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/components/range-control.d.ts +36 -0
- package/build-types/validated-form-controls/components/range-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/components/select-control.d.ts +9 -0
- package/build-types/validated-form-controls/components/select-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/components/stories/checkbox-control.story.d.ts +12 -0
- package/build-types/validated-form-controls/components/stories/checkbox-control.story.d.ts.map +1 -0
- package/build-types/validated-form-controls/components/stories/combobox-control.story.d.ts +12 -0
- package/build-types/validated-form-controls/components/stories/combobox-control.story.d.ts.map +1 -0
- package/build-types/validated-form-controls/components/stories/custom-select-control.story.d.ts +12 -0
- package/build-types/validated-form-controls/components/stories/custom-select-control.story.d.ts.map +1 -0
- package/build-types/validated-form-controls/components/stories/input-control.story.d.ts +18 -0
- package/build-types/validated-form-controls/components/stories/input-control.story.d.ts.map +1 -0
- package/build-types/validated-form-controls/components/stories/number-control.story.d.ts +12 -0
- package/build-types/validated-form-controls/components/stories/number-control.story.d.ts.map +1 -0
- package/build-types/validated-form-controls/components/stories/overview.story.d.ts +19 -0
- package/build-types/validated-form-controls/components/stories/overview.story.d.ts.map +1 -0
- package/build-types/validated-form-controls/components/stories/radio-control.story.d.ts +12 -0
- package/build-types/validated-form-controls/components/stories/radio-control.story.d.ts.map +1 -0
- package/build-types/validated-form-controls/components/stories/range-control.story.d.ts +9 -0
- package/build-types/validated-form-controls/components/stories/range-control.story.d.ts.map +1 -0
- package/build-types/validated-form-controls/components/stories/select-control.story.d.ts +12 -0
- package/build-types/validated-form-controls/components/stories/select-control.story.d.ts.map +1 -0
- package/build-types/validated-form-controls/components/stories/story-utils.d.ts +9 -0
- package/build-types/validated-form-controls/components/stories/story-utils.d.ts.map +1 -0
- package/build-types/validated-form-controls/components/stories/text-control.story.d.ts +9 -0
- package/build-types/validated-form-controls/components/stories/text-control.story.d.ts.map +1 -0
- package/build-types/validated-form-controls/components/stories/textarea-control.story.d.ts +9 -0
- package/build-types/validated-form-controls/components/stories/textarea-control.story.d.ts.map +1 -0
- package/build-types/validated-form-controls/components/stories/toggle-control.story.d.ts +9 -0
- package/build-types/validated-form-controls/components/stories/toggle-control.story.d.ts.map +1 -0
- package/build-types/validated-form-controls/components/stories/toggle-group-control.story.d.ts +9 -0
- package/build-types/validated-form-controls/components/stories/toggle-group-control.story.d.ts.map +1 -0
- package/build-types/validated-form-controls/components/text-control.d.ts +8 -0
- package/build-types/validated-form-controls/components/text-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/components/textarea-control.d.ts +7 -0
- package/build-types/validated-form-controls/components/textarea-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/components/toggle-control.d.ts +7 -0
- package/build-types/validated-form-controls/components/toggle-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/components/toggle-group-control.d.ts +15 -0
- package/build-types/validated-form-controls/components/toggle-group-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/components/types.d.ts +27 -0
- package/build-types/validated-form-controls/components/types.d.ts.map +1 -0
- package/build-types/validated-form-controls/control-with-error.d.ts +36 -0
- package/build-types/validated-form-controls/control-with-error.d.ts.map +1 -0
- package/build-types/validated-form-controls/index.d.ts +3 -0
- package/build-types/validated-form-controls/index.d.ts.map +1 -0
- package/package.json +21 -20
- package/src/autocomplete/index.tsx +4 -0
- package/src/box-control/input-control.tsx +14 -5
- package/src/calendar/date-calendar/README.md +261 -0
- package/src/calendar/date-calendar/index.tsx +69 -0
- package/src/calendar/date-range-calendar/README.md +298 -0
- package/src/calendar/date-range-calendar/index.tsx +215 -0
- package/src/calendar/index.tsx +3 -0
- package/src/calendar/stories/date-calendar.story.tsx +221 -0
- package/src/calendar/stories/date-range-calendar.story.tsx +230 -0
- package/src/calendar/style.scss +431 -0
- package/src/calendar/test/__utils__/index.ts +56 -0
- package/src/calendar/test/date-calendar.tsx +975 -0
- package/src/calendar/test/date-range-calendar.tsx +1701 -0
- package/src/calendar/types.ts +342 -0
- package/src/calendar/utils/constants.ts +62 -0
- package/src/calendar/utils/day-cell.tsx +133 -0
- package/src/calendar/utils/misc.ts +3 -0
- package/src/calendar/utils/use-localization-props.ts +169 -0
- package/src/custom-gradient-picker/gradient-bar/control-points.tsx +1 -1
- package/src/custom-select-control-v2/custom-select.tsx +6 -3
- package/src/date-time/date/index.tsx +1 -1
- package/src/dimension-control/test/__snapshots__/index.test.js.snap +8 -8
- package/src/form-token-field/index.tsx +12 -1
- package/src/form-token-field/token.tsx +1 -1
- package/src/icon/index.tsx +2 -0
- package/src/mobile/bottom-sheet/cell.native.js +2 -2
- package/src/mobile/link-picker/index.native.js +1 -1
- package/src/navigation/menu/menu-title-search.tsx +1 -1
- package/src/palette-edit/index.tsx +4 -4
- package/src/private-apis.ts +5 -0
- package/src/select-control/index.tsx +1 -1
- package/src/select-control/style.scss +0 -6
- package/src/style.scss +3 -2
- package/src/toggle-group-control/toggle-group-control/as-button-group.tsx +3 -1
- package/src/utils/hooks/use-controlled-value.ts +16 -8
- package/src/validated-form-controls/components/checkbox-control.tsx +64 -0
- package/src/validated-form-controls/components/combobox-control.tsx +77 -0
- package/src/validated-form-controls/components/custom-select-control.tsx +86 -0
- package/src/validated-form-controls/components/index.ts +12 -0
- package/src/validated-form-controls/components/input-control.tsx +59 -0
- package/src/validated-form-controls/components/number-control.tsx +61 -0
- package/src/validated-form-controls/components/radio-control.tsx +60 -0
- package/src/validated-form-controls/components/range-control.tsx +60 -0
- package/src/validated-form-controls/components/select-control.tsx +75 -0
- package/src/validated-form-controls/components/stories/checkbox-control.story.tsx +57 -0
- package/src/validated-form-controls/components/stories/combobox-control.story.tsx +64 -0
- package/src/validated-form-controls/components/stories/custom-select-control.story.tsx +64 -0
- package/src/validated-form-controls/components/stories/input-control.story.tsx +132 -0
- package/src/validated-form-controls/components/stories/number-control.story.tsx +62 -0
- package/src/validated-form-controls/components/stories/overview.mdx +52 -0
- package/src/validated-form-controls/components/stories/overview.story.tsx +100 -0
- package/src/validated-form-controls/components/stories/radio-control.story.tsx +64 -0
- package/src/validated-form-controls/components/stories/range-control.story.tsx +60 -0
- package/src/validated-form-controls/components/stories/select-control.story.tsx +60 -0
- package/src/validated-form-controls/components/stories/story-utils.tsx +46 -0
- package/src/validated-form-controls/components/stories/text-control.story.tsx +55 -0
- package/src/validated-form-controls/components/stories/textarea-control.story.tsx +52 -0
- package/src/validated-form-controls/components/stories/toggle-control.story.tsx +55 -0
- package/src/validated-form-controls/components/stories/toggle-group-control.story.tsx +66 -0
- package/src/validated-form-controls/components/text-control.tsx +60 -0
- package/src/validated-form-controls/components/textarea-control.tsx +59 -0
- package/src/validated-form-controls/components/toggle-control.tsx +69 -0
- package/src/validated-form-controls/components/toggle-group-control.tsx +82 -0
- package/src/validated-form-controls/components/types.ts +28 -0
- package/src/validated-form-controls/control-with-error.tsx +198 -0
- package/src/validated-form-controls/index.ts +2 -0
- package/src/validated-form-controls/style.scss +75 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/src/dimension-control/style.scss +0 -22
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { error } from '@wordpress/icons';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* External dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { cloneElement, forwardRef, useEffect, useState } from '@wordpress/element';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Internal dependencies
|
|
14
|
+
*/
|
|
15
|
+
import { withIgnoreIMEEvents } from '../utils/with-ignore-ime-events';
|
|
16
|
+
import Icon from '../icon';
|
|
17
|
+
import { Fragment as _Fragment, jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
18
|
+
function appendRequiredIndicator(label, required, markWhenOptional) {
|
|
19
|
+
if (required && !markWhenOptional) {
|
|
20
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
21
|
+
children: [label, " ", `(${__('Required')})`]
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
if (!required && markWhenOptional) {
|
|
25
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
26
|
+
children: [label, " ", `(${__('Optional')})`]
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return label;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* HTML elements that support the Constraint Validation API.
|
|
34
|
+
*
|
|
35
|
+
* Here, we exclude HTMLButtonElement because although it does technically support the API,
|
|
36
|
+
* normal buttons are actually exempted from any validation.
|
|
37
|
+
* @see https://developer.mozilla.org/en-US/docs/Learn_web_development/Extensions/Forms/Form_validation
|
|
38
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/willValidate
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
function UnforwardedControlWithError({
|
|
42
|
+
required,
|
|
43
|
+
markWhenOptional,
|
|
44
|
+
customValidator,
|
|
45
|
+
getValidityTarget,
|
|
46
|
+
children
|
|
47
|
+
}, forwardedRef) {
|
|
48
|
+
const [errorMessage, setErrorMessage] = useState();
|
|
49
|
+
const [isTouched, setIsTouched] = useState(false);
|
|
50
|
+
|
|
51
|
+
// Ensure that error messages are visible after user attemps to submit a form
|
|
52
|
+
// with multiple invalid fields.
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
const validityTarget = getValidityTarget();
|
|
55
|
+
const showValidationMessage = () => setErrorMessage(validityTarget?.validationMessage);
|
|
56
|
+
validityTarget?.addEventListener('invalid', showValidationMessage);
|
|
57
|
+
return () => {
|
|
58
|
+
validityTarget?.removeEventListener('invalid', showValidationMessage);
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
const validate = () => {
|
|
62
|
+
const message = customValidator?.();
|
|
63
|
+
const validityTarget = getValidityTarget();
|
|
64
|
+
validityTarget?.setCustomValidity(message !== null && message !== void 0 ? message : '');
|
|
65
|
+
setErrorMessage(validityTarget?.validationMessage);
|
|
66
|
+
};
|
|
67
|
+
const onBlur = event => {
|
|
68
|
+
// Only consider "blurred from the component" if focus has fully left the wrapping div.
|
|
69
|
+
// This prevents unnecessary blurs from components with multiple focusable elements.
|
|
70
|
+
if (!event.relatedTarget || !event.currentTarget.contains(event.relatedTarget)) {
|
|
71
|
+
setIsTouched(true);
|
|
72
|
+
const validityTarget = getValidityTarget();
|
|
73
|
+
|
|
74
|
+
// Prevents a double flash of the native error tooltip when the control is already showing one.
|
|
75
|
+
if (!validityTarget?.validity.valid) {
|
|
76
|
+
if (!errorMessage) {
|
|
77
|
+
setErrorMessage(validityTarget?.validationMessage);
|
|
78
|
+
}
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
validate();
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const onChange = (...args) => {
|
|
85
|
+
children.props.onChange?.(...args);
|
|
86
|
+
|
|
87
|
+
// Only validate incrementally if the field has blurred at least once,
|
|
88
|
+
// or currently has an error message.
|
|
89
|
+
if (isTouched || errorMessage) {
|
|
90
|
+
validate();
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
const onKeyDown = event => {
|
|
94
|
+
// Ensures that custom validators are triggered when the user submits by pressing Enter,
|
|
95
|
+
// without ever blurring the control.
|
|
96
|
+
if (event.key === 'Enter') {
|
|
97
|
+
validate();
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
return (
|
|
101
|
+
/*#__PURE__*/
|
|
102
|
+
// Disable reason: Just listening to a bubbled event, not for interaction.
|
|
103
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
104
|
+
_jsxs("div", {
|
|
105
|
+
className: "components-validated-control",
|
|
106
|
+
ref: forwardedRef,
|
|
107
|
+
onBlur: onBlur,
|
|
108
|
+
onKeyDown: withIgnoreIMEEvents(onKeyDown),
|
|
109
|
+
children: [cloneElement(children, {
|
|
110
|
+
label: appendRequiredIndicator(children.props.label, required, markWhenOptional),
|
|
111
|
+
onChange,
|
|
112
|
+
required
|
|
113
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
114
|
+
"aria-live": "polite",
|
|
115
|
+
children: errorMessage && /*#__PURE__*/_jsxs("p", {
|
|
116
|
+
className: "components-validated-control__error",
|
|
117
|
+
children: [/*#__PURE__*/_jsx(Icon, {
|
|
118
|
+
className: "components-validated-control__error-icon",
|
|
119
|
+
icon: error,
|
|
120
|
+
size: 16,
|
|
121
|
+
fill: "currentColor"
|
|
122
|
+
}), errorMessage]
|
|
123
|
+
})
|
|
124
|
+
})]
|
|
125
|
+
})
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
export const ControlWithError = forwardRef(UnforwardedControlWithError);
|
|
129
|
+
//# sourceMappingURL=control-with-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__","error","cloneElement","forwardRef","useEffect","useState","withIgnoreIMEEvents","Icon","Fragment","_Fragment","jsxs","_jsxs","jsx","_jsx","appendRequiredIndicator","label","required","markWhenOptional","children","UnforwardedControlWithError","customValidator","getValidityTarget","forwardedRef","errorMessage","setErrorMessage","isTouched","setIsTouched","validityTarget","showValidationMessage","validationMessage","addEventListener","removeEventListener","validate","message","setCustomValidity","onBlur","event","relatedTarget","currentTarget","contains","validity","valid","onChange","args","props","onKeyDown","key","className","ref","icon","size","fill","ControlWithError"],"sources":["@wordpress/components/src/validated-form-controls/control-with-error.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { error } from '@wordpress/icons';\n\n/**\n * External dependencies\n */\nimport {\n\tcloneElement,\n\tforwardRef,\n\tuseEffect,\n\tuseState,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { withIgnoreIMEEvents } from '../utils/with-ignore-ime-events';\n\nimport Icon from '../icon';\n\nfunction appendRequiredIndicator(\n\tlabel: React.ReactNode,\n\trequired: boolean | undefined,\n\tmarkWhenOptional: boolean | undefined\n) {\n\tif ( required && ! markWhenOptional ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ label } { `(${ __( 'Required' ) })` }\n\t\t\t</>\n\t\t);\n\t}\n\tif ( ! required && markWhenOptional ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ label } { `(${ __( 'Optional' ) })` }\n\t\t\t</>\n\t\t);\n\t}\n\treturn label;\n}\n\n/**\n * HTML elements that support the Constraint Validation API.\n *\n * Here, we exclude HTMLButtonElement because although it does technically support the API,\n * normal buttons are actually exempted from any validation.\n * @see https://developer.mozilla.org/en-US/docs/Learn_web_development/Extensions/Forms/Form_validation\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/willValidate\n */\ntype ValidityTarget =\n\t| HTMLFieldSetElement\n\t| HTMLInputElement\n\t| HTMLSelectElement\n\t| HTMLTextAreaElement;\n\nfunction UnforwardedControlWithError< C extends React.ReactElement >(\n\t{\n\t\trequired,\n\t\tmarkWhenOptional,\n\t\tcustomValidator,\n\t\tgetValidityTarget,\n\t\tchildren,\n\t}: {\n\t\t/**\n\t\t * Whether the control is required.\n\t\t */\n\t\trequired?: boolean;\n\t\t/**\n\t\t * Label the control as \"optional\" when _not_ `required`, instead of the inverse.\n\t\t */\n\t\tmarkWhenOptional?: boolean;\n\t\t/**\n\t\t * A function that returns a custom validity message when applicable.\n\t\t *\n\t\t * This message will be applied to the element returned by `getValidityTarget`.\n\t\t * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/setCustomValidity\n\t\t */\n\t\tcustomValidator?: () => string | void;\n\t\t/**\n\t\t * A function that returns the actual element on which the validity data should be applied.\n\t\t */\n\t\tgetValidityTarget: () => ValidityTarget | null | undefined;\n\t\t/**\n\t\t * The control component to apply validation to.\n\t\t */\n\t\tchildren: C;\n\t},\n\tforwardedRef: React.ForwardedRef< HTMLDivElement >\n) {\n\tconst [ errorMessage, setErrorMessage ] = useState< string | undefined >();\n\tconst [ isTouched, setIsTouched ] = useState( false );\n\n\t// Ensure that error messages are visible after user attemps to submit a form\n\t// with multiple invalid fields.\n\tuseEffect( () => {\n\t\tconst validityTarget = getValidityTarget();\n\t\tconst showValidationMessage = () =>\n\t\t\tsetErrorMessage( validityTarget?.validationMessage );\n\n\t\tvalidityTarget?.addEventListener( 'invalid', showValidationMessage );\n\n\t\treturn () => {\n\t\t\tvalidityTarget?.removeEventListener(\n\t\t\t\t'invalid',\n\t\t\t\tshowValidationMessage\n\t\t\t);\n\t\t};\n\t} );\n\n\tconst validate = () => {\n\t\tconst message = customValidator?.();\n\t\tconst validityTarget = getValidityTarget();\n\n\t\tvalidityTarget?.setCustomValidity( message ?? '' );\n\t\tsetErrorMessage( validityTarget?.validationMessage );\n\t};\n\n\tconst onBlur = ( event: React.FocusEvent< HTMLDivElement > ) => {\n\t\t// Only consider \"blurred from the component\" if focus has fully left the wrapping div.\n\t\t// This prevents unnecessary blurs from components with multiple focusable elements.\n\t\tif (\n\t\t\t! event.relatedTarget ||\n\t\t\t! event.currentTarget.contains( event.relatedTarget )\n\t\t) {\n\t\t\tsetIsTouched( true );\n\n\t\t\tconst validityTarget = getValidityTarget();\n\n\t\t\t// Prevents a double flash of the native error tooltip when the control is already showing one.\n\t\t\tif ( ! validityTarget?.validity.valid ) {\n\t\t\t\tif ( ! errorMessage ) {\n\t\t\t\t\tsetErrorMessage( validityTarget?.validationMessage );\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvalidate();\n\t\t}\n\t};\n\n\tconst onChange = ( ...args: unknown[] ) => {\n\t\tchildren.props.onChange?.( ...args );\n\n\t\t// Only validate incrementally if the field has blurred at least once,\n\t\t// or currently has an error message.\n\t\tif ( isTouched || errorMessage ) {\n\t\t\tvalidate();\n\t\t}\n\t};\n\n\tconst onKeyDown = ( event: React.KeyboardEvent< HTMLDivElement > ) => {\n\t\t// Ensures that custom validators are triggered when the user submits by pressing Enter,\n\t\t// without ever blurring the control.\n\t\tif ( event.key === 'Enter' ) {\n\t\t\tvalidate();\n\t\t}\n\t};\n\n\treturn (\n\t\t// Disable reason: Just listening to a bubbled event, not for interaction.\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\tclassName=\"components-validated-control\"\n\t\t\tref={ forwardedRef }\n\t\t\tonBlur={ onBlur }\n\t\t\tonKeyDown={ withIgnoreIMEEvents( onKeyDown ) }\n\t\t>\n\t\t\t{ cloneElement( children, {\n\t\t\t\tlabel: appendRequiredIndicator(\n\t\t\t\t\tchildren.props.label,\n\t\t\t\t\trequired,\n\t\t\t\t\tmarkWhenOptional\n\t\t\t\t),\n\t\t\t\tonChange,\n\t\t\t\trequired,\n\t\t\t} ) }\n\t\t\t<div aria-live=\"polite\">\n\t\t\t\t{ errorMessage && (\n\t\t\t\t\t<p className=\"components-validated-control__error\">\n\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\tclassName=\"components-validated-control__error-icon\"\n\t\t\t\t\t\t\ticon={ error }\n\t\t\t\t\t\t\tsize={ 16 }\n\t\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ errorMessage }\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport const ControlWithError = forwardRef( UnforwardedControlWithError );\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["@wordpress/components/src/validated-form-controls/index.ts"],"sourcesContent":["export * from './components';\nexport * from './control-with-error';\n"],"mappings":"AAAA,cAAc,cAAc;AAC5B,cAAc,sBAAsB","ignoreList":[]}
|
|
@@ -589,6 +589,364 @@ p + .components-button.is-tertiary {
|
|
|
589
589
|
background-position: right 200px top 0;
|
|
590
590
|
}
|
|
591
591
|
}
|
|
592
|
+
/* Root of the component. */
|
|
593
|
+
.components-calendar {
|
|
594
|
+
position: relative; /* Required to position the navigation toolbar. */
|
|
595
|
+
box-sizing: border-box;
|
|
596
|
+
display: inline flow-root;
|
|
597
|
+
color: #1e1e1e;
|
|
598
|
+
background-color: #fff;
|
|
599
|
+
font-size: 13px;
|
|
600
|
+
font-weight: 400;
|
|
601
|
+
z-index: 0;
|
|
602
|
+
}
|
|
603
|
+
.components-calendar *,
|
|
604
|
+
.components-calendar *::before,
|
|
605
|
+
.components-calendar *::after {
|
|
606
|
+
box-sizing: border-box;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
.components-calendar__day {
|
|
610
|
+
padding: 0;
|
|
611
|
+
position: relative;
|
|
612
|
+
}
|
|
613
|
+
.components-calendar__day:has(.components-calendar__day-button:disabled) {
|
|
614
|
+
color: #949494;
|
|
615
|
+
}
|
|
616
|
+
.components-calendar__day:has(.components-calendar__day-button:hover:not(:disabled)), .components-calendar__day:has(.components-calendar__day-button:focus-visible) {
|
|
617
|
+
color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
.components-calendar__day-button {
|
|
621
|
+
background: none;
|
|
622
|
+
padding: 0;
|
|
623
|
+
margin: 0;
|
|
624
|
+
cursor: pointer;
|
|
625
|
+
justify-content: center;
|
|
626
|
+
align-items: center;
|
|
627
|
+
display: flex;
|
|
628
|
+
position: relative;
|
|
629
|
+
width: 2rem;
|
|
630
|
+
height: 2rem;
|
|
631
|
+
border: none;
|
|
632
|
+
border-radius: 2px;
|
|
633
|
+
font: inherit;
|
|
634
|
+
font-variant-numeric: tabular-nums;
|
|
635
|
+
color: inherit;
|
|
636
|
+
}
|
|
637
|
+
.components-calendar__day-button::before {
|
|
638
|
+
content: "";
|
|
639
|
+
position: absolute;
|
|
640
|
+
z-index: -1;
|
|
641
|
+
inset: 0;
|
|
642
|
+
border: none;
|
|
643
|
+
border-radius: 2px;
|
|
644
|
+
}
|
|
645
|
+
.components-calendar__day-button::after {
|
|
646
|
+
content: "";
|
|
647
|
+
position: absolute;
|
|
648
|
+
z-index: 1;
|
|
649
|
+
inset: 0;
|
|
650
|
+
pointer-events: none;
|
|
651
|
+
}
|
|
652
|
+
.components-calendar__day-button:disabled {
|
|
653
|
+
cursor: revert;
|
|
654
|
+
}
|
|
655
|
+
@media (forced-colors: active) {
|
|
656
|
+
.components-calendar__day-button:disabled {
|
|
657
|
+
text-decoration: line-through;
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
.components-calendar__day-button:focus-visible {
|
|
661
|
+
outline: var(--wp-admin-border-width-focus) solid var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
|
|
662
|
+
outline-offset: 1px;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
.components-calendar__caption-label {
|
|
666
|
+
z-index: 1;
|
|
667
|
+
position: relative;
|
|
668
|
+
display: inline-flex;
|
|
669
|
+
align-items: center;
|
|
670
|
+
white-space: nowrap;
|
|
671
|
+
border: 0;
|
|
672
|
+
text-transform: capitalize;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
.components-calendar__button-next,
|
|
676
|
+
.components-calendar__button-previous {
|
|
677
|
+
border: none;
|
|
678
|
+
border-radius: 2px;
|
|
679
|
+
background: none;
|
|
680
|
+
padding: 0;
|
|
681
|
+
margin: 0;
|
|
682
|
+
cursor: pointer;
|
|
683
|
+
-moz-appearance: none;
|
|
684
|
+
-webkit-appearance: none;
|
|
685
|
+
display: inline-flex;
|
|
686
|
+
align-items: center;
|
|
687
|
+
justify-content: center;
|
|
688
|
+
position: relative;
|
|
689
|
+
appearance: none;
|
|
690
|
+
width: 2rem;
|
|
691
|
+
height: 2rem;
|
|
692
|
+
color: inherit;
|
|
693
|
+
}
|
|
694
|
+
.components-calendar__button-next:disabled, .components-calendar__button-next[aria-disabled=true],
|
|
695
|
+
.components-calendar__button-previous:disabled,
|
|
696
|
+
.components-calendar__button-previous[aria-disabled=true] {
|
|
697
|
+
cursor: revert;
|
|
698
|
+
color: #949494;
|
|
699
|
+
}
|
|
700
|
+
.components-calendar__button-next:focus-visible,
|
|
701
|
+
.components-calendar__button-previous:focus-visible {
|
|
702
|
+
outline: var(--wp-admin-border-width-focus) solid var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
.components-calendar__chevron {
|
|
706
|
+
display: inline-block;
|
|
707
|
+
fill: currentColor;
|
|
708
|
+
width: 16px;
|
|
709
|
+
height: 16px;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
.components-calendar[dir=rtl] .components-calendar__nav .components-calendar__chevron {
|
|
713
|
+
transform: rotate(-180deg);
|
|
714
|
+
transform-origin: 50%;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
.components-calendar__month-caption {
|
|
718
|
+
display: flex;
|
|
719
|
+
justify-content: center;
|
|
720
|
+
align-content: center;
|
|
721
|
+
height: 2rem;
|
|
722
|
+
margin-bottom: 12px;
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
.components-calendar__months {
|
|
726
|
+
position: relative;
|
|
727
|
+
display: flex;
|
|
728
|
+
justify-content: center;
|
|
729
|
+
flex-wrap: wrap;
|
|
730
|
+
gap: 1rem;
|
|
731
|
+
max-width: fit-content;
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
.components-calendar__month-grid {
|
|
735
|
+
border-collapse: separate;
|
|
736
|
+
border-spacing: 0 4px;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
.components-calendar__nav {
|
|
740
|
+
position: absolute;
|
|
741
|
+
inset-block-start: 0;
|
|
742
|
+
inset-inline-start: 0;
|
|
743
|
+
inset-inline-end: 0;
|
|
744
|
+
display: flex;
|
|
745
|
+
align-items: center;
|
|
746
|
+
justify-content: space-between;
|
|
747
|
+
height: 2rem;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
.components-calendar__weekday {
|
|
751
|
+
width: 2rem;
|
|
752
|
+
height: 2rem;
|
|
753
|
+
padding: 0;
|
|
754
|
+
color: #757575;
|
|
755
|
+
text-align: center;
|
|
756
|
+
text-transform: uppercase;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
/* DAY MODIFIERS */
|
|
760
|
+
.components-calendar__day--today::after {
|
|
761
|
+
content: "";
|
|
762
|
+
position: absolute;
|
|
763
|
+
z-index: 1;
|
|
764
|
+
inset-block-start: 2px;
|
|
765
|
+
inset-inline-end: 2px;
|
|
766
|
+
width: 0;
|
|
767
|
+
height: 0;
|
|
768
|
+
border-radius: 50%;
|
|
769
|
+
border: 2px solid currentColor;
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
.components-calendar__day--selected:not(.components-calendar__range-middle):has(.components-calendar__day-button,
|
|
773
|
+
.components-calendar__day-button:hover:not(:disabled)) {
|
|
774
|
+
color: #fff;
|
|
775
|
+
}
|
|
776
|
+
.components-calendar__day--selected:not(.components-calendar__range-middle) .components-calendar__day-button::before {
|
|
777
|
+
background-color: #1e1e1e;
|
|
778
|
+
border: 1px solid transparent;
|
|
779
|
+
}
|
|
780
|
+
.components-calendar__day--selected:not(.components-calendar__range-middle) .components-calendar__day-button:disabled::before {
|
|
781
|
+
background-color: #949494;
|
|
782
|
+
}
|
|
783
|
+
.components-calendar__day--selected:not(.components-calendar__range-middle) .components-calendar__day-button:hover:not(:disabled)::before {
|
|
784
|
+
background-color: #2f2f2f;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
.components-calendar__day--hidden {
|
|
788
|
+
visibility: hidden;
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
.components-calendar__range-start:not(.components-calendar__range-end) .components-calendar__day-button, .components-calendar__range-start:not(.components-calendar__range-end) .components-calendar__day-button::before {
|
|
792
|
+
border-start-end-radius: 0;
|
|
793
|
+
border-end-end-radius: 0;
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
.components-calendar__range-middle .components-calendar__day-button::before {
|
|
797
|
+
background-color: color-mix(in srgb, var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9)) 4%, transparent);
|
|
798
|
+
border-radius: 0;
|
|
799
|
+
border-width: 1px 0;
|
|
800
|
+
border-color: transparent;
|
|
801
|
+
border-style: solid;
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
.components-calendar__range-end:not(.components-calendar__range-start) .components-calendar__day-button, .components-calendar__range-end:not(.components-calendar__range-start) .components-calendar__day-button::before {
|
|
805
|
+
border-start-start-radius: 0;
|
|
806
|
+
border-end-start-radius: 0;
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
/*
|
|
810
|
+
* RANGE PREVIEW (range calendar only)
|
|
811
|
+
*
|
|
812
|
+
* The preview is rendered in the button's ::after pseudo-element, so that it
|
|
813
|
+
* can be rendered over the button's contents.
|
|
814
|
+
* The selection preview is shown with a dashed border. In order to have
|
|
815
|
+
* control over the dash pattern (especially the seams between days), the
|
|
816
|
+
* dashed borders are rendered as SVGs via the url() CSS function.
|
|
817
|
+
* Since SVGs rendered in the url() function don't seem to be able to access
|
|
818
|
+
* CSS variables, we're using the SVGs as masks, and using `background-color`
|
|
819
|
+
* to consume the accent color variable.
|
|
820
|
+
*/
|
|
821
|
+
.components-calendar__day--preview svg {
|
|
822
|
+
position: absolute;
|
|
823
|
+
inset: 0;
|
|
824
|
+
pointer-events: none;
|
|
825
|
+
color: color-mix(in srgb, var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9)) 16%, transparent);
|
|
826
|
+
}
|
|
827
|
+
@media (forced-colors: active) {
|
|
828
|
+
.components-calendar__day--preview svg {
|
|
829
|
+
color: inherit;
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
.components-calendar[dir=rtl] .components-calendar__day--preview svg {
|
|
833
|
+
transform: scaleX(-1);
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
.components-calendar__day--preview.components-calendar__range-middle .components-calendar__day-button::before {
|
|
837
|
+
border: none;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
/* ANIMATIONS */
|
|
841
|
+
@keyframes slide-in-left {
|
|
842
|
+
0% {
|
|
843
|
+
transform: translateX(100%);
|
|
844
|
+
}
|
|
845
|
+
100% {
|
|
846
|
+
transform: translateX(0);
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
@keyframes slide-in-right {
|
|
850
|
+
0% {
|
|
851
|
+
transform: translateX(-100%);
|
|
852
|
+
}
|
|
853
|
+
100% {
|
|
854
|
+
transform: translateX(0);
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
@keyframes slide-out-left {
|
|
858
|
+
0% {
|
|
859
|
+
transform: translateX(0);
|
|
860
|
+
}
|
|
861
|
+
100% {
|
|
862
|
+
transform: translateX(100%);
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
@keyframes slide-out-right {
|
|
866
|
+
0% {
|
|
867
|
+
transform: translateX(0);
|
|
868
|
+
}
|
|
869
|
+
100% {
|
|
870
|
+
transform: translateX(-100%);
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
@keyframes fade-in {
|
|
874
|
+
from {
|
|
875
|
+
opacity: 0;
|
|
876
|
+
}
|
|
877
|
+
to {
|
|
878
|
+
opacity: 1;
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
@keyframes fade-out {
|
|
882
|
+
from {
|
|
883
|
+
opacity: 1;
|
|
884
|
+
}
|
|
885
|
+
to {
|
|
886
|
+
opacity: 0;
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
.components-calendar__weeks-before-enter,
|
|
890
|
+
.components-calendar__weeks-before-exit,
|
|
891
|
+
.components-calendar__weeks-after-enter,
|
|
892
|
+
.components-calendar__weeks-after-exit,
|
|
893
|
+
.components-calendar__caption-after-enter,
|
|
894
|
+
.components-calendar__caption-after-exit,
|
|
895
|
+
.components-calendar__caption-before-enter,
|
|
896
|
+
.components-calendar__caption-before-exit {
|
|
897
|
+
animation-duration: 0s;
|
|
898
|
+
animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
899
|
+
animation-fill-mode: forwards;
|
|
900
|
+
}
|
|
901
|
+
@media not (prefers-reduced-motion) {
|
|
902
|
+
.components-calendar__weeks-before-enter,
|
|
903
|
+
.components-calendar__weeks-before-exit,
|
|
904
|
+
.components-calendar__weeks-after-enter,
|
|
905
|
+
.components-calendar__weeks-after-exit,
|
|
906
|
+
.components-calendar__caption-after-enter,
|
|
907
|
+
.components-calendar__caption-after-exit,
|
|
908
|
+
.components-calendar__caption-before-enter,
|
|
909
|
+
.components-calendar__caption-before-exit {
|
|
910
|
+
animation-duration: 0.3s;
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
.components-calendar__weeks-before-enter,
|
|
915
|
+
.components-calendar[dir=rtl] .components-calendar__weeks-after-enter {
|
|
916
|
+
animation-name: slide-in-left;
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
.components-calendar__weeks-before-exit,
|
|
920
|
+
.components-calendar[dir=rtl] .components-calendar__weeks-after-exit {
|
|
921
|
+
animation-name: slide-out-left;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
.components-calendar__weeks-after-enter,
|
|
925
|
+
.components-calendar[dir=rtl] .components-calendar__weeks-before-enter {
|
|
926
|
+
animation-name: slide-in-right;
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
.components-calendar__weeks-after-exit,
|
|
930
|
+
.components-calendar[dir=rtl] .components-calendar__weeks-before-exit {
|
|
931
|
+
animation-name: slide-out-right;
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
.components-calendar__caption-after-enter {
|
|
935
|
+
animation-name: fade-in;
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
.components-calendar__caption-after-exit {
|
|
939
|
+
animation-name: fade-out;
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
.components-calendar__caption-before-enter {
|
|
943
|
+
animation-name: fade-in;
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
.components-calendar__caption-before-exit {
|
|
947
|
+
animation-name: fade-out;
|
|
948
|
+
}
|
|
949
|
+
|
|
592
950
|
.components-checkbox-control {
|
|
593
951
|
--checkbox-input-size: 24px;
|
|
594
952
|
--checkbox-input-margin: 8px;
|
|
@@ -1126,23 +1484,6 @@ input.components-combobox-control__input[type=text]:focus {
|
|
|
1126
1484
|
z-index: 0;
|
|
1127
1485
|
}
|
|
1128
1486
|
|
|
1129
|
-
.block-editor-dimension-control .components-base-control__field {
|
|
1130
|
-
display: flex;
|
|
1131
|
-
align-items: center;
|
|
1132
|
-
}
|
|
1133
|
-
.block-editor-dimension-control .components-base-control__label {
|
|
1134
|
-
display: flex;
|
|
1135
|
-
align-items: center;
|
|
1136
|
-
margin-left: 1em;
|
|
1137
|
-
margin-bottom: 0;
|
|
1138
|
-
}
|
|
1139
|
-
.block-editor-dimension-control .components-base-control__label .dashicon {
|
|
1140
|
-
margin-left: 0.5em;
|
|
1141
|
-
}
|
|
1142
|
-
.block-editor-dimension-control.is-manual .components-base-control__label {
|
|
1143
|
-
width: 10em;
|
|
1144
|
-
}
|
|
1145
|
-
|
|
1146
1487
|
body.is-dragging-components-draggable {
|
|
1147
1488
|
cursor: move; /* Fallback for IE/Edge < 14 */
|
|
1148
1489
|
cursor: grabbing !important;
|
|
@@ -2976,11 +3317,6 @@ body.lockscroll {
|
|
|
2976
3317
|
-webkit-tap-highlight-color: rgba(0, 0, 0, 0) !important;
|
|
2977
3318
|
}
|
|
2978
3319
|
|
|
2979
|
-
@media (max-width: 782px) {
|
|
2980
|
-
.components-base-control .components-base-control__field .components-select-control__input {
|
|
2981
|
-
font-size: 16px;
|
|
2982
|
-
}
|
|
2983
|
-
}
|
|
2984
3320
|
.components-snackbar {
|
|
2985
3321
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
|
2986
3322
|
font-size: 13px;
|
|
@@ -3513,4 +3849,64 @@ div.components-toolbar > div + div.has-left-divider::before {
|
|
|
3513
3849
|
|
|
3514
3850
|
.components-tooltip__shortcut {
|
|
3515
3851
|
margin-right: 8px;
|
|
3852
|
+
}
|
|
3853
|
+
|
|
3854
|
+
.components-validated-control:has(:is(input, select):user-invalid) .components-input-control__backdrop {
|
|
3855
|
+
--wp-components-color-accent: $alert-red;
|
|
3856
|
+
border-color: #cc1818;
|
|
3857
|
+
}
|
|
3858
|
+
.components-validated-control :is(textarea, input[type=text]):user-invalid {
|
|
3859
|
+
--wp-admin-theme-color: $alert-red;
|
|
3860
|
+
--wp-components-color-accent: $alert-red;
|
|
3861
|
+
border-color: #cc1818;
|
|
3862
|
+
}
|
|
3863
|
+
.components-validated-control .components-combobox-control__suggestions-container:has(input:user-invalid):not(:has([aria-expanded=true])) {
|
|
3864
|
+
border-color: #cc1818;
|
|
3865
|
+
}
|
|
3866
|
+
|
|
3867
|
+
.components-validated-control__wrapper-with-error-delegate {
|
|
3868
|
+
position: relative;
|
|
3869
|
+
}
|
|
3870
|
+
.components-validated-control__wrapper-with-error-delegate:has(select:user-invalid) .components-input-control__backdrop {
|
|
3871
|
+
--wp-components-color-accent: $alert-red;
|
|
3872
|
+
border-color: #cc1818;
|
|
3873
|
+
}
|
|
3874
|
+
.components-validated-control__wrapper-with-error-delegate:has(input[type=radio]:invalid) {
|
|
3875
|
+
--wp-components-color-accent: $alert-red;
|
|
3876
|
+
}
|
|
3877
|
+
|
|
3878
|
+
.components-validated-control__error-delegate {
|
|
3879
|
+
position: absolute;
|
|
3880
|
+
top: 0;
|
|
3881
|
+
height: 100%;
|
|
3882
|
+
width: 100%;
|
|
3883
|
+
opacity: 0;
|
|
3884
|
+
pointer-events: none;
|
|
3885
|
+
}
|
|
3886
|
+
|
|
3887
|
+
.components-validated-control__error {
|
|
3888
|
+
display: flex;
|
|
3889
|
+
align-items: flex-start;
|
|
3890
|
+
gap: 4px;
|
|
3891
|
+
margin: 8px 0 0;
|
|
3892
|
+
font-family: -apple-system, "system-ui", "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
|
3893
|
+
font-size: 0.75rem;
|
|
3894
|
+
line-height: 16px;
|
|
3895
|
+
color: #cc1818;
|
|
3896
|
+
animation: components-validated-control__error-jump 0.2s cubic-bezier(0.68, -0.55, 0.27, 1.55);
|
|
3897
|
+
}
|
|
3898
|
+
|
|
3899
|
+
.components-validated-control__error-icon {
|
|
3900
|
+
flex-shrink: 0;
|
|
3901
|
+
}
|
|
3902
|
+
|
|
3903
|
+
@keyframes components-validated-control__error-jump {
|
|
3904
|
+
0% {
|
|
3905
|
+
transform: translateY(-4px);
|
|
3906
|
+
opacity: 0;
|
|
3907
|
+
}
|
|
3908
|
+
100% {
|
|
3909
|
+
transform: translateY(0);
|
|
3910
|
+
opacity: 1;
|
|
3911
|
+
}
|
|
3516
3912
|
}
|