@wordpress/components 32.2.1-next.v.202602191100.0 → 32.2.1
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 +35 -0
- package/build/alignment-matrix-control/cell.cjs +2 -2
- package/build/alignment-matrix-control/cell.cjs.map +1 -1
- package/build/alignment-matrix-control/index.cjs +2 -2
- package/build/alignment-matrix-control/index.cjs.map +1 -1
- package/build/angle-picker-control/angle-circle.cjs +2 -2
- package/build/angle-picker-control/angle-circle.cjs.map +1 -1
- package/build/autocomplete/index.cjs +15 -7
- package/build/autocomplete/index.cjs.map +2 -2
- package/build/date-time/time/index.cjs +1 -1
- package/build/date-time/time/index.cjs.map +2 -2
- package/build/date-time/utils.cjs +9 -0
- package/build/date-time/utils.cjs.map +2 -2
- package/build/private-apis.cjs +0 -4
- package/build/private-apis.cjs.map +3 -3
- package/build/sandbox/index.cjs +125 -1
- package/build/sandbox/index.cjs.map +2 -2
- package/build/select-control/styles/select-control-styles.cjs +8 -8
- package/build/select-control/styles/select-control-styles.cjs.map +2 -2
- package/build/snackbar/list.cjs +4 -1
- package/build/snackbar/list.cjs.map +2 -2
- package/build/toggle-group-control/toggle-group-control-option-base/styles.cjs +8 -8
- package/build/toggle-group-control/toggle-group-control-option-base/styles.cjs.map +2 -2
- package/build/validated-form-controls/control-with-error.cjs +26 -3
- package/build/validated-form-controls/control-with-error.cjs.map +2 -2
- package/build/validated-form-controls/validity-indicator.cjs +2 -0
- package/build/validated-form-controls/validity-indicator.cjs.map +2 -2
- package/build-module/alignment-matrix-control/cell.mjs +2 -2
- package/build-module/alignment-matrix-control/cell.mjs.map +1 -1
- package/build-module/alignment-matrix-control/index.mjs +2 -2
- package/build-module/alignment-matrix-control/index.mjs.map +1 -1
- package/build-module/angle-picker-control/angle-circle.mjs +2 -2
- package/build-module/angle-picker-control/angle-circle.mjs.map +1 -1
- package/build-module/autocomplete/index.mjs +13 -6
- package/build-module/autocomplete/index.mjs.map +2 -2
- package/build-module/date-time/time/index.mjs +2 -2
- package/build-module/date-time/time/index.mjs.map +2 -2
- package/build-module/date-time/utils.mjs +8 -0
- package/build-module/date-time/utils.mjs.map +2 -2
- package/build-module/private-apis.mjs +0 -4
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/sandbox/index.mjs +126 -2
- package/build-module/sandbox/index.mjs.map +2 -2
- package/build-module/select-control/styles/select-control-styles.mjs +8 -8
- package/build-module/select-control/styles/select-control-styles.mjs.map +2 -2
- package/build-module/snackbar/list.mjs +4 -1
- package/build-module/snackbar/list.mjs.map +2 -2
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.mjs +8 -8
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.mjs.map +2 -2
- package/build-module/validated-form-controls/control-with-error.mjs +27 -4
- package/build-module/validated-form-controls/control-with-error.mjs.map +2 -2
- package/build-module/validated-form-controls/validity-indicator.mjs +2 -0
- package/build-module/validated-form-controls/validity-indicator.mjs.map +2 -2
- package/build-style/style-rtl.css +7 -183
- package/build-style/style.css +7 -183
- package/build-types/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.d.ts +19 -0
- package/build-types/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.d.ts.map +1 -0
- package/build-types/alignment-matrix-control/styles/alignment-matrix-control-styles.d.ts +23 -0
- package/build-types/alignment-matrix-control/styles/alignment-matrix-control-styles.d.ts.map +1 -0
- package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts +25 -0
- package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts.map +1 -0
- package/build-types/autocomplete/get-autocomplete-match.d.ts +20 -0
- package/build-types/autocomplete/get-autocomplete-match.d.ts.map +1 -0
- package/build-types/autocomplete/index.d.ts +8 -0
- package/build-types/autocomplete/index.d.ts.map +1 -1
- package/build-types/autocomplete/test/get-autocomplete-match.d.ts +2 -0
- package/build-types/autocomplete/test/get-autocomplete-match.d.ts.map +1 -0
- package/build-types/badge/stories/e2e/index.story.d.ts +7 -0
- package/build-types/badge/stories/e2e/index.story.d.ts.map +1 -0
- package/build-types/border-control/border-control-style-picker/hook.d.ts +267 -0
- package/build-types/border-control/border-control-style-picker/hook.d.ts.map +1 -0
- package/build-types/box-control/all-input-control.d.ts +4 -0
- package/build-types/box-control/all-input-control.d.ts.map +1 -0
- package/build-types/box-control/axial-input-controls.d.ts +4 -0
- package/build-types/box-control/axial-input-controls.d.ts.map +1 -0
- package/build-types/box-control/input-controls.d.ts +4 -0
- package/build-types/box-control/input-controls.d.ts.map +1 -0
- package/build-types/box-control/styles/box-control-visualizer-styles.d.ts +46 -0
- package/build-types/box-control/styles/box-control-visualizer-styles.d.ts.map +1 -0
- package/build-types/box-control/unit-control.d.ts +4 -0
- package/build-types/box-control/unit-control.d.ts.map +1 -0
- package/build-types/custom-gradient-picker/test/index.d.ts +2 -0
- package/build-types/custom-gradient-picker/test/index.d.ts.map +1 -0
- package/build-types/custom-select-control/styles.d.ts +11 -0
- package/build-types/custom-select-control/styles.d.ts.map +1 -0
- package/build-types/date-time/date-picker/index.d.ts +23 -0
- package/build-types/date-time/date-picker/index.d.ts.map +1 -0
- package/build-types/date-time/date-picker/styles.d.ts +45 -0
- package/build-types/date-time/date-picker/styles.d.ts.map +1 -0
- package/build-types/date-time/date-picker/test/index.d.ts +2 -0
- package/build-types/date-time/date-picker/test/index.d.ts.map +1 -0
- package/build-types/date-time/date-picker/test/use-lilius.d.ts +2 -0
- package/build-types/date-time/date-picker/test/use-lilius.d.ts.map +1 -0
- package/build-types/date-time/date-picker/use-lilius/index.d.ts +169 -0
- package/build-types/date-time/date-picker/use-lilius/index.d.ts.map +1 -0
- package/build-types/date-time/time/index.d.ts.map +1 -1
- package/build-types/date-time/time-picker/index.d.ts +27 -0
- package/build-types/date-time/time-picker/index.d.ts.map +1 -0
- package/build-types/date-time/time-picker/styles.d.ts +93 -0
- package/build-types/date-time/time-picker/styles.d.ts.map +1 -0
- package/build-types/date-time/time-picker/test/index.d.ts +2 -0
- package/build-types/date-time/time-picker/test/index.d.ts.map +1 -0
- package/build-types/date-time/time-picker/time-input/index.d.ts +4 -0
- package/build-types/date-time/time-picker/time-input/index.d.ts.map +1 -0
- package/build-types/date-time/time-picker/time-input/test/index.d.ts +2 -0
- package/build-types/date-time/time-picker/time-input/test/index.d.ts.map +1 -0
- package/build-types/date-time/time-picker/timezone.d.ts +7 -0
- package/build-types/date-time/time-picker/timezone.d.ts.map +1 -0
- package/build-types/date-time/utils.d.ts +9 -0
- package/build-types/date-time/utils.d.ts.map +1 -1
- package/build-types/dimension-control/index.d.ts +28 -0
- package/build-types/dimension-control/index.d.ts.map +1 -0
- package/build-types/dimension-control/sizes.d.ts +26 -0
- package/build-types/dimension-control/sizes.d.ts.map +1 -0
- package/build-types/dimension-control/stories/index.story.d.ts +4 -0
- package/build-types/dimension-control/stories/index.story.d.ts.map +1 -0
- package/build-types/dimension-control/types.d.ts +47 -0
- package/build-types/dimension-control/types.d.ts.map +1 -0
- package/build-types/dropdown-menu-v2/index.d.ts +17 -0
- package/build-types/dropdown-menu-v2/index.d.ts.map +1 -0
- package/build-types/dropdown-menu-v2/stories/index.story.d.ts +11 -0
- package/build-types/dropdown-menu-v2/stories/index.story.d.ts.map +1 -0
- package/build-types/dropdown-menu-v2/styles.d.ts +42 -0
- package/build-types/dropdown-menu-v2/styles.d.ts.map +1 -0
- package/build-types/dropdown-menu-v2/test/index.d.ts +2 -0
- package/build-types/dropdown-menu-v2/test/index.d.ts.map +1 -0
- package/build-types/dropdown-menu-v2/types.d.ts +252 -0
- package/build-types/dropdown-menu-v2/types.d.ts.map +1 -0
- package/build-types/external-link/styles/external-link-styles.d.ts +10 -0
- package/build-types/external-link/styles/external-link-styles.d.ts.map +1 -0
- package/build-types/mobile/inserter-button/sparkles.d.ts +3 -0
- package/build-types/mobile/inserter-button/sparkles.d.ts.map +1 -0
- package/build-types/navigator/navigator-back-button/index.d.ts +2 -0
- package/build-types/navigator/navigator-back-button/index.d.ts.map +1 -0
- package/build-types/navigator/navigator-button/index.d.ts +2 -0
- package/build-types/navigator/navigator-button/index.d.ts.map +1 -0
- package/build-types/navigator/navigator-provider/component.d.ts +38 -0
- package/build-types/navigator/navigator-provider/component.d.ts.map +1 -0
- package/build-types/navigator/navigator-provider/index.d.ts +2 -0
- package/build-types/navigator/navigator-provider/index.d.ts.map +1 -0
- package/build-types/navigator/navigator-screen/index.d.ts +2 -0
- package/build-types/navigator/navigator-screen/index.d.ts.map +1 -0
- package/build-types/navigator/navigator-to-parent-button/index.d.ts +2 -0
- package/build-types/navigator/navigator-to-parent-button/index.d.ts.map +1 -0
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/radio-group/radio/index.d.ts +7 -0
- package/build-types/radio-group/radio/index.d.ts.map +1 -0
- package/build-types/radio-group/radio-context/index.d.ts +6 -0
- package/build-types/radio-group/radio-context/index.d.ts.map +1 -0
- package/build-types/sandbox/index.d.ts +1 -1
- package/build-types/sandbox/index.d.ts.map +1 -1
- package/build-types/sandbox/types.d.ts +11 -0
- package/build-types/sandbox/types.d.ts.map +1 -1
- package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
- package/build-types/slot-fill/bubbles-virtually/fill.d.ts +5 -0
- package/build-types/slot-fill/bubbles-virtually/fill.d.ts.map +1 -0
- package/build-types/slot-fill/bubbles-virtually/slot-fill-context.d.ts +12 -0
- package/build-types/slot-fill/bubbles-virtually/slot-fill-context.d.ts.map +1 -0
- package/build-types/slot-fill/bubbles-virtually/slot-fill-provider.d.ts +4 -0
- package/build-types/slot-fill/bubbles-virtually/slot-fill-provider.d.ts.map +1 -0
- package/build-types/slot-fill/use-slot.d.ts +9 -0
- package/build-types/slot-fill/use-slot.d.ts.map +1 -0
- package/build-types/snackbar/list.d.ts.map +1 -1
- package/build-types/style-provider/test/index.d.ts +2 -0
- package/build-types/style-provider/test/index.d.ts.map +1 -0
- package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts.map +1 -1
- package/build-types/ui/context/constants.d.ts +8 -0
- package/build-types/ui/context/constants.d.ts.map +1 -0
- package/build-types/ui/context/context-connect.d.ts +40 -0
- package/build-types/ui/context/context-connect.d.ts.map +1 -0
- package/build-types/ui/context/context-system-provider.d.ts +7 -0
- package/build-types/ui/context/context-system-provider.d.ts.map +1 -0
- package/build-types/ui/context/get-styled-class-name-from-key.d.ts +2 -0
- package/build-types/ui/context/get-styled-class-name-from-key.d.ts.map +1 -0
- package/build-types/ui/context/index.d.ts +5 -0
- package/build-types/ui/context/index.d.ts.map +1 -0
- package/build-types/ui/context/test/context-connect.d.ts +2 -0
- package/build-types/ui/context/test/context-connect.d.ts.map +1 -0
- package/build-types/ui/context/test/wordpress-component.d.ts +2 -0
- package/build-types/ui/context/test/wordpress-component.d.ts.map +1 -0
- package/build-types/ui/context/use-context-system.d.ts +20 -0
- package/build-types/ui/context/use-context-system.d.ts.map +1 -0
- package/build-types/ui/context/utils.d.ts +26 -0
- package/build-types/ui/context/utils.d.ts.map +1 -0
- package/build-types/ui/context/wordpress-component.d.ts +32 -0
- package/build-types/ui/context/wordpress-component.d.ts.map +1 -0
- package/build-types/ui/shortcut/component.d.ts +12 -0
- package/build-types/ui/shortcut/component.d.ts.map +1 -0
- package/build-types/ui/shortcut/index.d.ts +3 -0
- package/build-types/ui/shortcut/index.d.ts.map +1 -0
- package/build-types/ui/tooltip/component.d.ts +29 -0
- package/build-types/ui/tooltip/component.d.ts.map +1 -0
- package/build-types/ui/tooltip/content.d.ts +9 -0
- package/build-types/ui/tooltip/content.d.ts.map +1 -0
- package/build-types/ui/tooltip/context.d.ts +10 -0
- package/build-types/ui/tooltip/context.d.ts.map +1 -0
- package/build-types/ui/tooltip/index.d.ts +3 -0
- package/build-types/ui/tooltip/index.d.ts.map +1 -0
- package/build-types/ui/tooltip/styles.d.ts +12 -0
- package/build-types/ui/tooltip/styles.d.ts.map +1 -0
- package/build-types/ui/tooltip/types.d.ts +62 -0
- package/build-types/ui/tooltip/types.d.ts.map +1 -0
- package/build-types/ui/utils/colors.d.ts +17 -0
- package/build-types/ui/utils/colors.d.ts.map +1 -0
- package/build-types/ui/utils/font-size.d.ts +18 -0
- package/build-types/ui/utils/font-size.d.ts.map +1 -0
- package/build-types/ui/utils/get-valid-children.d.ts +13 -0
- package/build-types/ui/utils/get-valid-children.d.ts.map +1 -0
- package/build-types/ui/utils/index.d.ts +2 -0
- package/build-types/ui/utils/index.d.ts.map +1 -0
- package/build-types/ui/utils/space.d.ts +23 -0
- package/build-types/ui/utils/space.d.ts.map +1 -0
- package/build-types/ui/utils/types.d.ts +14 -0
- package/build-types/ui/utils/types.d.ts.map +1 -0
- package/build-types/ui/utils/use-responsive-value.d.ts +5 -0
- package/build-types/ui/utils/use-responsive-value.d.ts.map +1 -0
- package/build-types/utils/hooks/use-latest-ref.d.ts +15 -0
- package/build-types/utils/hooks/use-latest-ref.d.ts.map +1 -0
- package/build-types/utils/input/base.d.ts +3 -0
- package/build-types/utils/input/base.d.ts.map +1 -0
- package/build-types/utils/input/index.d.ts +2 -0
- package/build-types/utils/input/index.d.ts.map +1 -0
- package/build-types/utils/input/input-control.d.ts +2 -0
- package/build-types/utils/input/input-control.d.ts.map +1 -0
- package/build-types/utils/reduce-motion.d.ts +8 -0
- package/build-types/utils/reduce-motion.d.ts.map +1 -0
- package/build-types/utils/z-index.d.ts +3 -0
- package/build-types/utils/z-index.d.ts.map +1 -0
- package/build-types/validated-form-controls/control-with-error.d.ts.map +1 -1
- package/build-types/validated-form-controls/test/checkbox-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/checkbox-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/combobox-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/combobox-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/custom-select-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/custom-select-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/form-token-field.d.ts +2 -0
- package/build-types/validated-form-controls/test/form-token-field.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/input-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/input-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/number-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/number-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/radio-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/radio-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/range-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/range-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/select-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/select-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/text-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/text-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/textarea-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/textarea-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/toggle-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/toggle-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/toggle-group-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/toggle-group-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/validity-indicator.d.ts +2 -1
- package/build-types/validated-form-controls/validity-indicator.d.ts.map +1 -1
- package/build-types/view/types.d.ts +8 -0
- package/build-types/view/types.d.ts.map +1 -0
- package/package.json +21 -21
- package/src/autocomplete/index.tsx +30 -6
- package/src/autocomplete/test/index.tsx +110 -1
- package/src/button/style.scss +8 -5
- package/src/date-time/test/utils.test.ts +8 -11
- package/src/date-time/time/index.tsx +2 -12
- package/src/date-time/time/test/index.tsx +69 -0
- package/src/date-time/utils.ts +18 -0
- package/src/form-token-field/style.scss +1 -0
- package/src/private-apis.ts +0 -4
- package/src/sandbox/index.tsx +189 -9
- package/src/sandbox/test/index.tsx +65 -24
- package/src/sandbox/types.ts +11 -0
- package/src/select-control/styles/select-control-styles.ts +1 -0
- package/src/snackbar/list.tsx +6 -1
- package/src/style.scss +0 -2
- package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +18 -16
- package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +4 -6
- package/src/validated-form-controls/control-with-error.tsx +44 -4
- package/src/validated-form-controls/test/checkbox-control.tsx +49 -0
- package/src/validated-form-controls/test/combobox-control.tsx +61 -0
- package/src/validated-form-controls/test/control-with-error.tsx +182 -1
- package/src/validated-form-controls/test/custom-select-control.tsx +60 -0
- package/src/validated-form-controls/test/form-token-field.tsx +52 -0
- package/src/validated-form-controls/test/input-control.tsx +42 -0
- package/src/validated-form-controls/test/number-control.tsx +44 -0
- package/src/validated-form-controls/test/radio-control.tsx +61 -0
- package/src/validated-form-controls/test/range-control.tsx +73 -0
- package/src/validated-form-controls/test/select-control.tsx +57 -0
- package/src/validated-form-controls/test/text-control.tsx +49 -0
- package/src/validated-form-controls/test/textarea-control.tsx +51 -0
- package/src/validated-form-controls/test/toggle-control.tsx +49 -0
- package/src/validated-form-controls/test/toggle-group-control.tsx +28 -0
- package/src/validated-form-controls/validity-indicator.tsx +3 -0
- package/build/avatar/component.cjs +0 -99
- package/build/avatar/component.cjs.map +0 -7
- package/build/avatar/index.cjs +0 -37
- package/build/avatar/index.cjs.map +0 -7
- package/build/avatar/types.cjs +0 -19
- package/build/avatar/types.cjs.map +0 -7
- package/build/avatar-group/component.cjs +0 -60
- package/build/avatar-group/component.cjs.map +0 -7
- package/build/avatar-group/index.cjs +0 -37
- package/build/avatar-group/index.cjs.map +0 -7
- package/build/avatar-group/types.cjs +0 -19
- package/build/avatar-group/types.cjs.map +0 -7
- package/build-module/avatar/component.mjs +0 -68
- package/build-module/avatar/component.mjs.map +0 -7
- package/build-module/avatar/index.mjs +0 -6
- package/build-module/avatar/index.mjs.map +0 -7
- package/build-module/avatar/types.mjs +0 -1
- package/build-module/avatar/types.mjs.map +0 -7
- package/build-module/avatar-group/component.mjs +0 -29
- package/build-module/avatar-group/component.mjs.map +0 -7
- package/build-module/avatar-group/index.mjs +0 -6
- package/build-module/avatar-group/index.mjs.map +0 -7
- package/build-module/avatar-group/types.mjs +0 -1
- package/build-module/avatar-group/types.mjs.map +0 -7
- package/build-types/avatar/component.d.ts +0 -5
- package/build-types/avatar/component.d.ts.map +0 -1
- package/build-types/avatar/index.d.ts +0 -3
- package/build-types/avatar/index.d.ts.map +0 -1
- package/build-types/avatar/types.d.ts +0 -59
- package/build-types/avatar/types.d.ts.map +0 -1
- package/build-types/avatar-group/component.d.ts +0 -8
- package/build-types/avatar-group/component.d.ts.map +0 -1
- package/build-types/avatar-group/index.d.ts +0 -3
- package/build-types/avatar-group/index.d.ts.map +0 -1
- package/build-types/avatar-group/types.d.ts +0 -14
- package/build-types/avatar-group/types.d.ts.map +0 -1
- package/src/avatar/component.tsx +0 -82
- package/src/avatar/index.ts +0 -2
- package/src/avatar/styles.scss +0 -152
- package/src/avatar/types.ts +0 -59
- package/src/avatar-group/component.tsx +0 -46
- package/src/avatar-group/index.ts +0 -2
- package/src/avatar-group/styles.scss +0 -32
- package/src/avatar-group/types.ts +0 -13
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-control.d.ts","sourceRoot":"","sources":["../../../src/validated-form-controls/test/input-control.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number-control.d.ts","sourceRoot":"","sources":["../../../src/validated-form-controls/test/number-control.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radio-control.d.ts","sourceRoot":"","sources":["../../../src/validated-form-controls/test/radio-control.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"range-control.d.ts","sourceRoot":"","sources":["../../../src/validated-form-controls/test/range-control.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select-control.d.ts","sourceRoot":"","sources":["../../../src/validated-form-controls/test/select-control.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-control.d.ts","sourceRoot":"","sources":["../../../src/validated-form-controls/test/text-control.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textarea-control.d.ts","sourceRoot":"","sources":["../../../src/validated-form-controls/test/textarea-control.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toggle-control.d.ts","sourceRoot":"","sources":["../../../src/validated-form-controls/test/toggle-control.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toggle-group-control.d.ts","sourceRoot":"","sources":["../../../src/validated-form-controls/test/toggle-group-control.tsx"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validity-indicator.d.ts","sourceRoot":"","sources":["../../src/validated-form-controls/validity-indicator.tsx"],"names":[],"mappings":"AAgBA,wBAAgB,iBAAiB,CAAE,EAClC,IAAI,EACJ,OAAO,GACP,EAAE;IACF,IAAI,EAAE,YAAY,GAAG,OAAO,GAAG,SAAS,CAAC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB,+
|
|
1
|
+
{"version":3,"file":"validity-indicator.d.ts","sourceRoot":"","sources":["../../src/validated-form-controls/validity-indicator.tsx"],"names":[],"mappings":"AAgBA,wBAAgB,iBAAiB,CAAE,EAClC,EAAE,EACF,IAAI,EACJ,OAAO,GACP,EAAE;IACF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,YAAY,GAAG,OAAO,GAAG,SAAS,CAAC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB,+BA0BA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/view/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,MAAM,SAAS,GAAG;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/components",
|
|
3
|
-
"version": "32.2.1
|
|
3
|
+
"version": "32.2.1",
|
|
4
4
|
"description": "UI components for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -64,24 +64,24 @@
|
|
|
64
64
|
"@types/highlight-words-core": "1.2.1",
|
|
65
65
|
"@types/react": "^18.3.27",
|
|
66
66
|
"@use-gesture/react": "^10.3.1",
|
|
67
|
-
"@wordpress/a11y": "^4.40.1
|
|
68
|
-
"@wordpress/base-styles": "^6.16.1
|
|
69
|
-
"@wordpress/compose": "^7.40.1
|
|
70
|
-
"@wordpress/date": "^5.40.1
|
|
71
|
-
"@wordpress/deprecated": "^4.40.1
|
|
72
|
-
"@wordpress/dom": "^4.40.1
|
|
73
|
-
"@wordpress/element": "^6.40.1
|
|
74
|
-
"@wordpress/escape-html": "^3.40.1
|
|
75
|
-
"@wordpress/hooks": "^4.40.1
|
|
76
|
-
"@wordpress/html-entities": "^4.40.1
|
|
77
|
-
"@wordpress/i18n": "^6.13.1
|
|
78
|
-
"@wordpress/icons": "^11.7.1
|
|
79
|
-
"@wordpress/is-shallow-equal": "^5.40.1
|
|
80
|
-
"@wordpress/keycodes": "^4.40.1
|
|
81
|
-
"@wordpress/primitives": "^4.40.1
|
|
82
|
-
"@wordpress/private-apis": "^1.40.1
|
|
83
|
-
"@wordpress/rich-text": "^7.40.1
|
|
84
|
-
"@wordpress/warning": "^3.40.1
|
|
67
|
+
"@wordpress/a11y": "^4.40.1",
|
|
68
|
+
"@wordpress/base-styles": "^6.16.1",
|
|
69
|
+
"@wordpress/compose": "^7.40.1",
|
|
70
|
+
"@wordpress/date": "^5.40.1",
|
|
71
|
+
"@wordpress/deprecated": "^4.40.1",
|
|
72
|
+
"@wordpress/dom": "^4.40.1",
|
|
73
|
+
"@wordpress/element": "^6.40.1",
|
|
74
|
+
"@wordpress/escape-html": "^3.40.1",
|
|
75
|
+
"@wordpress/hooks": "^4.40.1",
|
|
76
|
+
"@wordpress/html-entities": "^4.40.1",
|
|
77
|
+
"@wordpress/i18n": "^6.13.1",
|
|
78
|
+
"@wordpress/icons": "^11.7.1",
|
|
79
|
+
"@wordpress/is-shallow-equal": "^5.40.1",
|
|
80
|
+
"@wordpress/keycodes": "^4.40.1",
|
|
81
|
+
"@wordpress/primitives": "^4.40.1",
|
|
82
|
+
"@wordpress/private-apis": "^1.40.1",
|
|
83
|
+
"@wordpress/rich-text": "^7.40.1",
|
|
84
|
+
"@wordpress/warning": "^3.40.1",
|
|
85
85
|
"change-case": "^4.1.2",
|
|
86
86
|
"clsx": "^2.1.1",
|
|
87
87
|
"colord": "^2.7.0",
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"@storybook/react-vite": "^10.1.11",
|
|
108
108
|
"@testing-library/jest-dom": "^6.9.1",
|
|
109
109
|
"@types/jest": "^29.5.14",
|
|
110
|
-
"@wordpress/jest-console": "^8.40.1
|
|
110
|
+
"@wordpress/jest-console": "^8.40.1",
|
|
111
111
|
"snapshot-diff": "^0.10.0",
|
|
112
112
|
"storybook": "^10.1.11",
|
|
113
113
|
"timezone-mock": "^1.3.6"
|
|
@@ -119,5 +119,5 @@
|
|
|
119
119
|
"publishConfig": {
|
|
120
120
|
"access": "public"
|
|
121
121
|
},
|
|
122
|
-
"gitHead": "
|
|
122
|
+
"gitHead": "adb6623c9f32490cfc73c7ac7f122578c1f10c65"
|
|
123
123
|
}
|
|
@@ -393,17 +393,41 @@ export function useAutocomplete( {
|
|
|
393
393
|
};
|
|
394
394
|
}
|
|
395
395
|
|
|
396
|
-
|
|
397
|
-
|
|
396
|
+
/**
|
|
397
|
+
* Checks whether two records represent the same user-visible state
|
|
398
|
+
* (same text content and cursor position).
|
|
399
|
+
*/
|
|
400
|
+
function recordValuesMatch(
|
|
401
|
+
a: UseAutocompleteProps[ 'record' ],
|
|
402
|
+
b: UseAutocompleteProps[ 'record' ]
|
|
403
|
+
) {
|
|
404
|
+
return a.text === b.text && a.start === b.start && a.end === b.end;
|
|
405
|
+
}
|
|
398
406
|
|
|
399
|
-
|
|
407
|
+
/**
|
|
408
|
+
* Tracks the last record whose value differed from the current one.
|
|
409
|
+
* Used to determine whether the user has actually typed something
|
|
410
|
+
*/
|
|
411
|
+
export function useLastDifferentValue(
|
|
412
|
+
value: UseAutocompleteProps[ 'record' ]
|
|
413
|
+
) {
|
|
414
|
+
const history = useRef< Array< typeof value > >( [] );
|
|
415
|
+
|
|
416
|
+
const lastEntry = history.current[ history.current.length - 1 ];
|
|
417
|
+
|
|
418
|
+
// Only add to history if the value is meaningfully different from
|
|
419
|
+
// the most recent entry (analogous to Set.add being a no-op for
|
|
420
|
+
// duplicate references in the original implementation).
|
|
421
|
+
if ( ! lastEntry || ! recordValuesMatch( value, lastEntry ) ) {
|
|
422
|
+
history.current.push( value );
|
|
423
|
+
}
|
|
400
424
|
|
|
401
425
|
// Keep the history size to 2.
|
|
402
|
-
if ( history.current.
|
|
403
|
-
history.current.
|
|
426
|
+
if ( history.current.length > 2 ) {
|
|
427
|
+
history.current.shift();
|
|
404
428
|
}
|
|
405
429
|
|
|
406
|
-
return
|
|
430
|
+
return history.current[ 0 ];
|
|
407
431
|
}
|
|
408
432
|
|
|
409
433
|
export function useAutocompleteProps( options: UseAutocompleteProps ) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import { render, screen, renderHook } from '@testing-library/react';
|
|
5
5
|
import userEvent from '@testing-library/user-event';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -13,9 +13,118 @@ import { useRef } from '@wordpress/element';
|
|
|
13
13
|
* Internal dependencies
|
|
14
14
|
*/
|
|
15
15
|
import { getAutoCompleterUI } from '../autocompleter-ui';
|
|
16
|
+
import { useLastDifferentValue } from '..';
|
|
16
17
|
|
|
17
18
|
type FruitOption = { visual: string; name: string; id: number };
|
|
18
19
|
|
|
20
|
+
function makeRecord( text: string ) {
|
|
21
|
+
return {
|
|
22
|
+
text,
|
|
23
|
+
formats: [],
|
|
24
|
+
replacements: [],
|
|
25
|
+
start: text.length,
|
|
26
|
+
end: text.length,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
describe( 'useLastDifferentValue', () => {
|
|
31
|
+
it( 'should return the current record on first render', () => {
|
|
32
|
+
const record = makeRecord( 'Hello' );
|
|
33
|
+
const { result } = renderHook(
|
|
34
|
+
( { value } ) => useLastDifferentValue( value ),
|
|
35
|
+
{ initialProps: { value: record } }
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
expect( result.current.text ).toBe( 'Hello' );
|
|
39
|
+
} );
|
|
40
|
+
|
|
41
|
+
it( 'should return the previous record when text changes', () => {
|
|
42
|
+
const record1 = makeRecord( 'Hello' );
|
|
43
|
+
const { result, rerender } = renderHook(
|
|
44
|
+
( { value } ) => useLastDifferentValue( value ),
|
|
45
|
+
{ initialProps: { value: record1 } }
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
const record2 = makeRecord( 'Hello/' );
|
|
49
|
+
rerender( { value: record2 } );
|
|
50
|
+
|
|
51
|
+
expect( result.current.text ).toBe( 'Hello' );
|
|
52
|
+
} );
|
|
53
|
+
|
|
54
|
+
it( 'should not update when re-rendered with a new reference but same text', () => {
|
|
55
|
+
const record1 = makeRecord( 'Hello' );
|
|
56
|
+
const { result, rerender } = renderHook(
|
|
57
|
+
( { value } ) => useLastDifferentValue( value ),
|
|
58
|
+
{ initialProps: { value: record1 } }
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
// User types "/"
|
|
62
|
+
const record2 = makeRecord( 'Hello/' );
|
|
63
|
+
rerender( { value: record2 } );
|
|
64
|
+
expect( result.current.text ).toBe( 'Hello' );
|
|
65
|
+
|
|
66
|
+
// RESET_BLOCKS creates a new record object with the same text.
|
|
67
|
+
const record3 = makeRecord( 'Hello/' );
|
|
68
|
+
rerender( { value: record3 } );
|
|
69
|
+
expect( result.current.text ).toBe( 'Hello' );
|
|
70
|
+
} );
|
|
71
|
+
|
|
72
|
+
it( 'should survive multiple same-text re-renders', () => {
|
|
73
|
+
const record1 = makeRecord( 'Hello' );
|
|
74
|
+
const { result, rerender } = renderHook(
|
|
75
|
+
( { value } ) => useLastDifferentValue( value ),
|
|
76
|
+
{ initialProps: { value: record1 } }
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
// User types "/"
|
|
80
|
+
const record2 = makeRecord( 'Hello/' );
|
|
81
|
+
rerender( { value: record2 } );
|
|
82
|
+
|
|
83
|
+
// Multiple syncs, each producing new references with the same text.
|
|
84
|
+
for ( let i = 0; i < 5; i++ ) {
|
|
85
|
+
rerender( { value: makeRecord( 'Hello/' ) } );
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
expect( result.current.text ).toBe( 'Hello' );
|
|
89
|
+
} );
|
|
90
|
+
|
|
91
|
+
it( 'should track consecutive text changes correctly', () => {
|
|
92
|
+
const { result, rerender } = renderHook(
|
|
93
|
+
( { value } ) => useLastDifferentValue( value ),
|
|
94
|
+
{ initialProps: { value: makeRecord( 'A' ) } }
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
rerender( { value: makeRecord( 'AB' ) } );
|
|
98
|
+
expect( result.current.text ).toBe( 'A' );
|
|
99
|
+
|
|
100
|
+
rerender( { value: makeRecord( 'ABC' ) } );
|
|
101
|
+
expect( result.current.text ).toBe( 'AB' );
|
|
102
|
+
|
|
103
|
+
rerender( { value: makeRecord( 'ABCD' ) } );
|
|
104
|
+
expect( result.current.text ).toBe( 'ABC' );
|
|
105
|
+
} );
|
|
106
|
+
|
|
107
|
+
it( 'should update when cursor position changes without text change', () => {
|
|
108
|
+
const { result, rerender } = renderHook(
|
|
109
|
+
( { value } ) => useLastDifferentValue( value ),
|
|
110
|
+
{ initialProps: { value: makeRecord( 'Hello' ) } }
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
// User types "/"
|
|
114
|
+
rerender( { value: makeRecord( 'Hello/' ) } );
|
|
115
|
+
expect( result.current.text ).toBe( 'Hello' );
|
|
116
|
+
|
|
117
|
+
// User moves cursor left (same text, different position).
|
|
118
|
+
rerender( {
|
|
119
|
+
value: { ...makeRecord( 'Hello/' ), start: 0, end: 0 },
|
|
120
|
+
} );
|
|
121
|
+
|
|
122
|
+
// The returned record should now match the current text,
|
|
123
|
+
// so that didUserInput evaluates to false.
|
|
124
|
+
expect( result.current.text ).toBe( 'Hello/' );
|
|
125
|
+
} );
|
|
126
|
+
} );
|
|
127
|
+
|
|
19
128
|
describe( 'AutocompleterUI', () => {
|
|
20
129
|
describe( 'click outside behavior', () => {
|
|
21
130
|
it( 'should call reset function when a click on another element occurs', async () => {
|
package/src/button/style.scss
CHANGED
|
@@ -48,11 +48,6 @@
|
|
|
48
48
|
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) $components-color-accent;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
// Windows High Contrast mode will show this outline, but not the box-shadow.
|
|
52
|
-
&:focus {
|
|
53
|
-
outline: 3px solid transparent;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
51
|
/**
|
|
57
52
|
* Primary button style.
|
|
58
53
|
*/
|
|
@@ -276,6 +271,14 @@
|
|
|
276
271
|
}
|
|
277
272
|
}
|
|
278
273
|
|
|
274
|
+
// Windows High Contrast mode will show this outline, but not the box-shadow.
|
|
275
|
+
// This rule is placed after variant outline declarations (e.g. is-primary,
|
|
276
|
+
// is-secondary, is-tertiary) to ensure it wins by source order at the same
|
|
277
|
+
// specificity, while not using `:not(:active)` to avoid outline flicker.
|
|
278
|
+
&:focus {
|
|
279
|
+
outline: 3px solid transparent;
|
|
280
|
+
}
|
|
281
|
+
|
|
279
282
|
&:not(:disabled, [aria-disabled="true"]):active {
|
|
280
283
|
color: $components-color-foreground;
|
|
281
284
|
}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
1
|
import timezoneMock from 'timezone-mock';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
2
|
import { getSettings, setSettings, type DateSettings } from '@wordpress/date';
|
|
3
|
+
import { inputToDate, getDaysInMonth } from '../utils';
|
|
10
4
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
describe( 'getDaysInMonth', () => {
|
|
6
|
+
it( 'should return the number of days in the month', () => {
|
|
7
|
+
expect( getDaysInMonth( 2026, 0 ) ).toBe( 31 );
|
|
8
|
+
expect( getDaysInMonth( 2026, 1 ) ).toBe( 28 );
|
|
9
|
+
expect( getDaysInMonth( 2028, 1 ) ).toBe( 29 );
|
|
10
|
+
} );
|
|
11
|
+
} );
|
|
15
12
|
|
|
16
13
|
describe( 'inputToDate', () => {
|
|
17
14
|
let originalSettings: DateSettings;
|
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
1
|
import { startOfMinute } from 'date-fns';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
2
|
import { useState, useMemo, useEffect } from '@wordpress/element';
|
|
10
3
|
import { __ } from '@wordpress/i18n';
|
|
11
4
|
import { date as formatDate } from '@wordpress/date';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Internal dependencies
|
|
15
|
-
*/
|
|
16
5
|
import BaseControl from '../../base-control';
|
|
17
6
|
import { VisuallyHidden } from '../../visually-hidden';
|
|
18
7
|
import SelectControl from '../../select-control';
|
|
@@ -33,6 +22,7 @@ import {
|
|
|
33
22
|
buildPadInputStateReducer,
|
|
34
23
|
validateInputElementTarget,
|
|
35
24
|
setInConfiguredTimezone,
|
|
25
|
+
getDaysInMonth,
|
|
36
26
|
} from '../utils';
|
|
37
27
|
import { TIMEZONELESS_FORMAT } from '../constants';
|
|
38
28
|
import { TimeInput } from './time-input';
|
|
@@ -150,7 +140,7 @@ export function TimePicker( {
|
|
|
150
140
|
value={ day }
|
|
151
141
|
step={ 1 }
|
|
152
142
|
min={ 1 }
|
|
153
|
-
max={
|
|
143
|
+
max={ getDaysInMonth( Number( year ), Number( month ) - 1 ) }
|
|
154
144
|
required
|
|
155
145
|
spinControls="none"
|
|
156
146
|
isPressEnterToChange
|
|
@@ -158,6 +158,75 @@ describe( 'TimePicker', () => {
|
|
|
158
158
|
expect( onChangeSpy ).toHaveBeenCalledWith( '1986-10-18T11:59:00' );
|
|
159
159
|
} );
|
|
160
160
|
|
|
161
|
+
it( 'should call onChange with a bounded day if out of bounds', async () => {
|
|
162
|
+
const user = userEvent.setup();
|
|
163
|
+
|
|
164
|
+
const onChangeSpy = jest.fn();
|
|
165
|
+
|
|
166
|
+
render(
|
|
167
|
+
<TimePicker
|
|
168
|
+
currentTime="2026-02-05T00:00:00"
|
|
169
|
+
onChange={ onChangeSpy }
|
|
170
|
+
is12Hour
|
|
171
|
+
/>
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
const dayInput = screen.getByLabelText( 'Day' );
|
|
175
|
+
|
|
176
|
+
await user.clear( dayInput );
|
|
177
|
+
await user.type( dayInput, '30' );
|
|
178
|
+
await user.keyboard( '{Tab}' );
|
|
179
|
+
|
|
180
|
+
expect( onChangeSpy ).toHaveBeenCalledWith( '2026-02-28T00:00:00' );
|
|
181
|
+
expect( dayInput ).toHaveValue( 28 );
|
|
182
|
+
} );
|
|
183
|
+
|
|
184
|
+
it( 'should clamp day when switching months', async () => {
|
|
185
|
+
const user = userEvent.setup();
|
|
186
|
+
|
|
187
|
+
const onChangeSpy = jest.fn();
|
|
188
|
+
|
|
189
|
+
render(
|
|
190
|
+
<TimePicker
|
|
191
|
+
currentTime="2026-03-31T00:00:00"
|
|
192
|
+
onChange={ onChangeSpy }
|
|
193
|
+
is12Hour
|
|
194
|
+
/>
|
|
195
|
+
);
|
|
196
|
+
|
|
197
|
+
const monthSelect = screen.getByLabelText( 'Month' );
|
|
198
|
+
const dayInput = screen.getByLabelText( 'Day' );
|
|
199
|
+
|
|
200
|
+
await user.selectOptions( monthSelect, '02' );
|
|
201
|
+
|
|
202
|
+
expect( onChangeSpy ).toHaveBeenCalledWith( '2026-02-28T00:00:00' );
|
|
203
|
+
expect( dayInput ).toHaveValue( 28 );
|
|
204
|
+
} );
|
|
205
|
+
|
|
206
|
+
it( 'should clamp day when switching year from leap to non-leap', async () => {
|
|
207
|
+
const user = userEvent.setup();
|
|
208
|
+
|
|
209
|
+
const onChangeSpy = jest.fn();
|
|
210
|
+
|
|
211
|
+
render(
|
|
212
|
+
<TimePicker
|
|
213
|
+
currentTime="2028-02-29T00:00:00"
|
|
214
|
+
onChange={ onChangeSpy }
|
|
215
|
+
is12Hour
|
|
216
|
+
/>
|
|
217
|
+
);
|
|
218
|
+
|
|
219
|
+
const dayInput = screen.getByLabelText( 'Day' );
|
|
220
|
+
const yearInput = screen.getByLabelText( 'Year' );
|
|
221
|
+
|
|
222
|
+
await user.clear( yearInput );
|
|
223
|
+
await user.type( yearInput, '2026' );
|
|
224
|
+
await user.keyboard( '{Tab}' );
|
|
225
|
+
|
|
226
|
+
expect( onChangeSpy ).toHaveBeenCalledWith( '2026-02-28T00:00:00' );
|
|
227
|
+
expect( dayInput ).toHaveValue( 28 );
|
|
228
|
+
} );
|
|
229
|
+
|
|
161
230
|
it( 'should switch to PM correctly', async () => {
|
|
162
231
|
const user = userEvent.setup();
|
|
163
232
|
|
package/src/date-time/utils.ts
CHANGED
|
@@ -110,6 +110,19 @@ export function buildPadInputStateReducer( pad: number ) {
|
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
/**
|
|
114
|
+
* Returns the number of days in a month.
|
|
115
|
+
*
|
|
116
|
+
* @param year The year
|
|
117
|
+
* @param month The month, zero-indexed (0-11)
|
|
118
|
+
*
|
|
119
|
+
* @return The number of days in the month
|
|
120
|
+
*/
|
|
121
|
+
export const getDaysInMonth = ( year: number, month: number ) =>
|
|
122
|
+
// Take advantage of JavaScript's built-in date wrapping logic, where day 0
|
|
123
|
+
// of the next month is interpreted as the last day of the preceding month.
|
|
124
|
+
new Date( year, month + 1, 0 ).getDate();
|
|
125
|
+
|
|
113
126
|
/**
|
|
114
127
|
* Updates specific date fields in the configured timezone and returns a new
|
|
115
128
|
* UTC date.
|
|
@@ -139,6 +152,11 @@ export function setInConfiguredTimezone(
|
|
|
139
152
|
...updates,
|
|
140
153
|
};
|
|
141
154
|
|
|
155
|
+
// Clamp the day to the last valid day of the month, to avoid producing
|
|
156
|
+
// invalid date strings (e.g. "2026-02-31").
|
|
157
|
+
const daysInMonth = getDaysInMonth( values.year, values.month );
|
|
158
|
+
values.date = Math.min( values.date, daysInMonth );
|
|
159
|
+
|
|
142
160
|
const year = String( values.year ).padStart( 4, '0' );
|
|
143
161
|
const month = String( values.month + 1 ).padStart( 2, '0' );
|
|
144
162
|
const day = String( values.date ).padStart( 2, '0' );
|
package/src/private-apis.ts
CHANGED
|
@@ -14,8 +14,6 @@ import { Tabs } from './tabs';
|
|
|
14
14
|
import { kebabCase, normalizeTextString } from './utils/strings';
|
|
15
15
|
import { withIgnoreIMEEvents } from './utils/with-ignore-ime-events';
|
|
16
16
|
import { lock } from './lock-unlock';
|
|
17
|
-
import Avatar from './avatar';
|
|
18
|
-
import AvatarGroup from './avatar-group';
|
|
19
17
|
import Badge from './badge';
|
|
20
18
|
|
|
21
19
|
import { DateCalendar, DateRangeCalendar, TZDate } from './calendar';
|
|
@@ -36,8 +34,6 @@ import { ValidatedFormTokenField } from './validated-form-controls/components/fo
|
|
|
36
34
|
export const privateApis = {};
|
|
37
35
|
lock( privateApis, {
|
|
38
36
|
__experimentalPopoverLegacyPositionToPlacement,
|
|
39
|
-
Avatar,
|
|
40
|
-
AvatarGroup,
|
|
41
37
|
ComponentsContext,
|
|
42
38
|
Tabs,
|
|
43
39
|
Theme,
|