@wordpress/components 32.5.2-next.v.202604091042.0 → 33.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 +46 -1
- package/build/alignment-matrix-control/cell.cjs +3 -3
- package/build/alignment-matrix-control/cell.cjs.map +2 -2
- package/build/alignment-matrix-control/index.cjs +3 -3
- package/build/alignment-matrix-control/index.cjs.map +2 -2
- package/build/autocomplete/get-autocomplete-match.cjs +11 -2
- package/build/autocomplete/get-autocomplete-match.cjs.map +2 -2
- package/build/autocomplete/index.cjs +42 -11
- package/build/autocomplete/index.cjs.map +2 -2
- package/build/custom-gradient-picker/index.cjs.map +2 -2
- package/build/date-time/{date → date-picker}/index.cjs +6 -6
- package/build/date-time/{date → date-picker}/index.cjs.map +2 -2
- package/build/date-time/{date → date-picker}/styles.cjs +17 -17
- package/build/date-time/{date → date-picker}/styles.cjs.map +2 -2
- package/build/date-time/{date → date-picker}/use-lilius/index.cjs +1 -1
- package/build/date-time/{date → date-picker}/use-lilius/index.cjs.map +1 -1
- package/build/date-time/date-time/index.cjs +6 -6
- package/build/date-time/date-time/index.cjs.map +2 -2
- package/build/date-time/index.cjs +4 -4
- package/build/date-time/index.cjs.map +2 -2
- package/build/date-time/{time → time-picker}/index.cjs +6 -6
- package/build/date-time/time-picker/index.cjs.map +7 -0
- package/build/date-time/{time → time-picker}/styles.cjs +21 -21
- package/build/date-time/{time → time-picker}/styles.cjs.map +2 -2
- package/build/date-time/{time → time-picker}/time-input/index.cjs +1 -1
- package/build/date-time/{time → time-picker}/time-input/index.cjs.map +1 -1
- package/build/date-time/{time → time-picker}/timezone.cjs +1 -1
- package/build/date-time/{time → time-picker}/timezone.cjs.map +1 -1
- package/build/external-link/index.cjs +1 -1
- package/build/external-link/index.cjs.map +2 -2
- package/build/form-token-field/index.cjs +22 -6
- package/build/form-token-field/index.cjs.map +3 -3
- package/build/form-token-field/token-input.cjs +1 -1
- package/build/form-token-field/token-input.cjs.map +2 -2
- package/build/menu/popover.cjs +7 -3
- package/build/menu/popover.cjs.map +2 -2
- package/build/menu/styles.cjs +39 -16
- package/build/menu/styles.cjs.map +2 -2
- package/build/modal/index.cjs.map +2 -2
- package/build/navigable-container/container.cjs +72 -110
- package/build/navigable-container/container.cjs.map +2 -2
- package/build/palette-edit/index.cjs.map +2 -2
- package/build/radio-control/index.cjs +2 -0
- package/build/radio-control/index.cjs.map +2 -2
- package/build/sandbox/index.cjs +125 -1
- package/build/sandbox/index.cjs.map +2 -2
- package/build/textarea-control/styles/textarea-control-styles.cjs +3 -3
- package/build/textarea-control/styles/textarea-control-styles.cjs.map +2 -2
- package/build/utils/breakpoint.cjs.map +1 -1
- package/build/utils/font.cjs.map +1 -1
- package/build/visually-hidden/component.cjs +1 -0
- package/build/visually-hidden/component.cjs.map +2 -2
- package/build-module/alignment-matrix-control/cell.mjs +3 -3
- package/build-module/alignment-matrix-control/cell.mjs.map +2 -2
- package/build-module/alignment-matrix-control/index.mjs +3 -3
- package/build-module/alignment-matrix-control/index.mjs.map +2 -2
- package/build-module/autocomplete/get-autocomplete-match.mjs +11 -2
- package/build-module/autocomplete/get-autocomplete-match.mjs.map +2 -2
- package/build-module/autocomplete/index.mjs +42 -11
- package/build-module/autocomplete/index.mjs.map +2 -2
- package/build-module/custom-gradient-picker/index.mjs.map +2 -2
- package/build-module/date-time/{date → date-picker}/index.mjs +3 -3
- package/build-module/date-time/{date → date-picker}/index.mjs.map +2 -2
- package/build-module/date-time/{date → date-picker}/styles.mjs +17 -17
- package/build-module/date-time/{date → date-picker}/styles.mjs.map +2 -2
- package/build-module/date-time/{date → date-picker}/use-lilius/index.mjs +1 -1
- package/build-module/date-time/{date → date-picker}/use-lilius/index.mjs.map +1 -1
- package/build-module/date-time/date-time/index.mjs +2 -2
- package/build-module/date-time/date-time/index.mjs.map +1 -1
- package/build-module/date-time/index.mjs +2 -2
- package/build-module/date-time/index.mjs.map +1 -1
- package/build-module/date-time/{time → time-picker}/index.mjs +3 -3
- package/build-module/date-time/time-picker/index.mjs.map +7 -0
- package/build-module/date-time/{time → time-picker}/styles.mjs +21 -21
- package/build-module/date-time/{time → time-picker}/styles.mjs.map +2 -2
- package/build-module/date-time/{time → time-picker}/time-input/index.mjs +1 -1
- package/build-module/date-time/{time → time-picker}/time-input/index.mjs.map +1 -1
- package/build-module/date-time/{time → time-picker}/timezone.mjs +1 -1
- package/build-module/date-time/{time → time-picker}/timezone.mjs.map +1 -1
- package/build-module/external-link/index.mjs +1 -1
- package/build-module/external-link/index.mjs.map +2 -2
- package/build-module/form-token-field/index.mjs +22 -6
- package/build-module/form-token-field/index.mjs.map +2 -2
- package/build-module/form-token-field/token-input.mjs +1 -1
- package/build-module/form-token-field/token-input.mjs.map +2 -2
- package/build-module/menu/popover.mjs +7 -3
- package/build-module/menu/popover.mjs.map +2 -2
- package/build-module/menu/styles.mjs +37 -16
- package/build-module/menu/styles.mjs.map +2 -2
- package/build-module/modal/index.mjs.map +2 -2
- package/build-module/navigable-container/container.mjs +73 -111
- package/build-module/navigable-container/container.mjs.map +2 -2
- package/build-module/palette-edit/index.mjs.map +2 -2
- package/build-module/radio-control/index.mjs +2 -0
- package/build-module/radio-control/index.mjs.map +2 -2
- package/build-module/sandbox/index.mjs +126 -2
- package/build-module/sandbox/index.mjs.map +2 -2
- package/build-module/textarea-control/styles/textarea-control-styles.mjs +3 -3
- package/build-module/textarea-control/styles/textarea-control-styles.mjs.map +2 -2
- package/build-module/utils/breakpoint.mjs.map +1 -1
- package/build-module/utils/font.mjs.map +1 -1
- package/build-module/visually-hidden/component.mjs +1 -0
- package/build-module/visually-hidden/component.mjs.map +2 -2
- package/build-style/style-rtl.css +109 -25
- package/build-style/style.css +109 -25
- package/build-types/autocomplete/get-autocomplete-match.d.ts +10 -1
- package/build-types/autocomplete/get-autocomplete-match.d.ts.map +1 -1
- package/build-types/autocomplete/index.d.ts.map +1 -1
- package/build-types/base-control/stories/index.story.d.ts.map +1 -1
- package/build-types/button/stories/index.story.d.ts.map +1 -1
- package/build-types/card/stories/index.story.d.ts +0 -6
- package/build-types/card/stories/index.story.d.ts.map +1 -1
- package/build-types/checkbox-control/stories/index.story.d.ts.map +1 -1
- package/build-types/checkbox-control/types.d.ts +4 -0
- package/build-types/checkbox-control/types.d.ts.map +1 -1
- package/build-types/color-indicator/stories/index.story.d.ts.map +1 -1
- package/build-types/color-palette/stories/index.story.d.ts.map +1 -1
- package/build-types/color-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/combobox-control/stories/index.story.d.ts.map +1 -1
- package/build-types/composite/stories/index.story.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/index.d.ts.map +1 -1
- package/build-types/custom-select-control/stories/index.story.d.ts.map +1 -1
- package/build-types/date-time/date-picker/index.d.ts.map +1 -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.map +1 -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.map +1 -0
- package/build-types/date-time/date-time/index.d.ts +2 -2
- package/build-types/date-time/date-time/index.d.ts.map +1 -1
- package/build-types/date-time/index.d.ts +2 -2
- package/build-types/date-time/index.d.ts.map +1 -1
- package/build-types/date-time/stories/date.story.d.ts +1 -1
- package/build-types/date-time/stories/date.story.d.ts.map +1 -1
- package/build-types/date-time/stories/time.story.d.ts +1 -1
- package/build-types/date-time/stories/time.story.d.ts.map +1 -1
- package/build-types/date-time/{time → time-picker}/index.d.ts +1 -1
- package/build-types/date-time/time-picker/index.d.ts.map +1 -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.map +1 -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.map +1 -0
- package/build-types/date-time/time-picker/timezone.d.ts.map +1 -0
- package/build-types/date-time/types.d.ts +1 -1
- package/build-types/date-time/types.d.ts.map +1 -1
- package/build-types/disabled/stories/index.story.d.ts.map +1 -1
- package/build-types/drop-zone/stories/index.story.d.ts.map +1 -1
- package/build-types/dropdown/stories/index.story.d.ts.map +1 -1
- package/build-types/external-link/index.d.ts.map +1 -1
- package/build-types/external-link/stories/index.story.d.ts.map +1 -1
- package/build-types/form-file-upload/stories/index.story.d.ts.map +1 -1
- package/build-types/form-toggle/stories/index.story.d.ts.map +1 -1
- package/build-types/form-token-field/index.d.ts.map +1 -1
- package/build-types/form-token-field/stories/index.story.d.ts.map +1 -1
- package/build-types/form-token-field/token-input.d.ts.map +1 -1
- package/build-types/form-token-field/types.d.ts +16 -2
- package/build-types/form-token-field/types.d.ts.map +1 -1
- package/build-types/gradient-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/icon/stories/index.story.d.ts.map +1 -1
- package/build-types/keyboard-shortcuts/stories/index.story.d.ts.map +1 -1
- package/build-types/menu/popover.d.ts.map +1 -1
- package/build-types/menu/styles.d.ts +16 -1
- package/build-types/menu/styles.d.ts.map +1 -1
- package/build-types/menu-group/stories/index.story.d.ts.map +1 -1
- package/build-types/menu-item/stories/index.story.d.ts.map +1 -1
- package/build-types/menu-items-choice/stories/index.story.d.ts.map +1 -1
- package/build-types/modal/index.d.ts.map +1 -1
- package/build-types/modal/stories/index.story.d.ts.map +1 -1
- package/build-types/navigable-container/container.d.ts +3 -8
- package/build-types/navigable-container/container.d.ts.map +1 -1
- package/build-types/navigable-container/types.d.ts +1 -5
- package/build-types/navigable-container/types.d.ts.map +1 -1
- package/build-types/navigation/stories/utils/more-examples.d.ts.map +1 -1
- package/build-types/navigator/stories/index.story.d.ts.map +1 -1
- package/build-types/notice/stories/index.story.d.ts.map +1 -1
- package/build-types/palette-edit/index.d.ts.map +1 -1
- package/build-types/panel/stories/index.story.d.ts.map +1 -1
- package/build-types/popover/stories/index.story.d.ts.map +1 -1
- package/build-types/progress-bar/stories/index.story.d.ts.map +1 -1
- package/build-types/radio-control/index.d.ts.map +1 -1
- package/build-types/radio-control/stories/index.story.d.ts.map +1 -1
- package/build-types/radio-control/types.d.ts +6 -0
- package/build-types/radio-control/types.d.ts.map +1 -1
- package/build-types/range-control/stories/index.story.d.ts.map +1 -1
- package/build-types/resizable-box/stories/index.story.d.ts.map +1 -1
- package/build-types/sandbox/index.d.ts +1 -1
- package/build-types/sandbox/index.d.ts.map +1 -1
- package/build-types/sandbox/stories/index.story.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/scroll-lock/stories/index.story.d.ts.map +1 -1
- package/build-types/search-control/stories/index.story.d.ts.map +1 -1
- package/build-types/select-control/stories/index.story.d.ts.map +1 -1
- package/build-types/shortcut/stories/index.story.d.ts.map +1 -1
- package/build-types/slot-fill/stories/index.story.d.ts.map +1 -1
- package/build-types/snackbar/stories/index.story.d.ts.map +1 -1
- package/build-types/spinner/stories/index.story.d.ts.map +1 -1
- package/build-types/text-control/stories/index.story.d.ts.map +1 -1
- package/build-types/text-highlight/stories/index.story.d.ts.map +1 -1
- package/build-types/textarea-control/stories/index.story.d.ts.map +1 -1
- package/build-types/textarea-control/styles/textarea-control-styles.d.ts.map +1 -1
- package/build-types/toggle-control/stories/index.story.d.ts.map +1 -1
- package/build-types/tooltip/stories/index.story.d.ts.map +1 -1
- package/build-types/tree-select/stories/index.story.d.ts.map +1 -1
- package/build-types/utils/breakpoint.d.ts +2 -1
- package/build-types/utils/breakpoint.d.ts.map +1 -1
- package/build-types/utils/font.d.ts +3 -2
- package/build-types/utils/font.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/checkbox-control.d.ts +2 -1
- package/build-types/validated-form-controls/components/checkbox-control.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/radio-control.d.ts +2 -1
- package/build-types/validated-form-controls/components/radio-control.d.ts.map +1 -1
- package/build-types/visually-hidden/component.d.ts.map +1 -1
- package/build-types/visually-hidden/stories/index.story.d.ts +0 -6
- package/build-types/visually-hidden/stories/index.story.d.ts.map +1 -1
- package/package.json +21 -21
- package/src/alignment-matrix-control/style.module.scss +1 -1
- package/src/autocomplete/get-autocomplete-match.ts +25 -4
- package/src/autocomplete/index.tsx +69 -21
- package/src/autocomplete/test/get-autocomplete-match.ts +97 -75
- package/src/base-control/stories/index.story.tsx +1 -0
- package/src/button/stories/index.story.tsx +1 -0
- package/src/button/style.scss +1 -1
- package/src/button-group/style.scss +1 -2
- package/src/calendar/style.scss +3 -3
- package/src/card/stories/index.story.tsx +2 -9
- package/src/checkbox-control/stories/index.story.tsx +1 -0
- package/src/checkbox-control/style.scss +17 -5
- package/src/checkbox-control/types.ts +4 -0
- package/src/circular-option-picker/style.scss +9 -7
- package/src/color-indicator/stories/index.story.tsx +1 -0
- package/src/color-palette/stories/index.story.tsx +1 -0
- package/src/color-palette/style.scss +1 -1
- package/src/color-picker/stories/index.story.tsx +1 -0
- package/src/combobox-control/stories/index.story.tsx +1 -0
- package/src/composite/stories/index.story.tsx +1 -0
- package/src/confirm-dialog/stories/index.story.tsx +1 -1
- package/src/css.d.ts +1 -0
- package/src/custom-gradient-picker/index.tsx +1 -0
- package/src/custom-select-control/stories/index.story.tsx +1 -0
- package/src/date-time/README.md +3 -3
- package/src/date-time/date-picker/README.md +65 -0
- package/src/date-time/date-time/index.tsx +2 -2
- package/src/date-time/index.ts +2 -2
- package/src/date-time/stories/date.story.tsx +1 -1
- package/src/date-time/stories/time.story.tsx +1 -1
- package/src/date-time/time-picker/README.md +119 -0
- package/src/date-time/{time → time-picker}/index.tsx +1 -1
- package/src/date-time/types.ts +1 -1
- package/src/disabled/stories/index.story.tsx +1 -0
- package/src/drop-zone/stories/index.story.tsx +1 -0
- package/src/dropdown/stories/index.story.tsx +1 -0
- package/src/dropdown-menu/style.scss +1 -1
- package/src/external-link/index.tsx +1 -6
- package/src/external-link/stories/index.story.tsx +2 -1
- package/src/external-link/style.scss +30 -2
- package/src/form-file-upload/stories/index.story.tsx +1 -0
- package/src/form-toggle/stories/index.story.tsx +1 -0
- package/src/form-toggle/style.scss +38 -4
- package/src/form-token-field/README.md +2 -1
- package/src/form-token-field/index.tsx +39 -9
- package/src/form-token-field/stories/index.story.tsx +2 -0
- package/src/form-token-field/style.scss +12 -3
- package/src/form-token-field/test/index.tsx +70 -10
- package/src/form-token-field/token-input.tsx +1 -6
- package/src/form-token-field/types.ts +16 -2
- package/src/gradient-picker/stories/index.story.tsx +1 -0
- package/src/icon/stories/index.story.tsx +1 -0
- package/src/input-control/stories/index.story.tsx +1 -1
- package/src/item-group/stories/index.story.tsx +1 -1
- package/src/keyboard-shortcuts/stories/index.story.tsx +1 -0
- package/src/menu/popover.tsx +15 -8
- package/src/menu/styles.ts +26 -16
- package/src/menu/test/index.tsx +24 -34
- package/src/menu-group/stories/index.story.tsx +1 -0
- package/src/menu-item/stories/index.story.tsx +1 -0
- package/src/menu-items-choice/stories/index.story.tsx +1 -0
- package/src/mobile/link-settings/index.native.js +1 -1
- package/src/modal/index.tsx +1 -0
- package/src/modal/stories/index.story.tsx +1 -0
- package/src/navigable-container/container.tsx +120 -141
- package/src/navigable-container/test/navigable-menu.tsx +24 -0
- package/src/navigable-container/types.ts +1 -5
- package/src/navigation/stories/utils/more-examples.tsx +2 -1
- package/src/navigator/stories/index.story.tsx +1 -0
- package/src/notice/stories/index.story.tsx +1 -0
- package/src/notice/test/__snapshots__/index.tsx.snap +1 -0
- package/src/number-control/stories/index.story.tsx +1 -1
- package/src/palette-edit/index.tsx +1 -0
- package/src/panel/stories/index.story.tsx +1 -0
- package/src/popover/stories/index.story.tsx +1 -0
- package/src/progress-bar/stories/index.story.tsx +1 -0
- package/src/radio-control/index.tsx +2 -0
- package/src/radio-control/stories/index.story.tsx +1 -0
- package/src/radio-control/style.scss +21 -2
- package/src/radio-control/test/index.tsx +10 -0
- package/src/radio-control/types.ts +6 -0
- package/src/range-control/stories/index.story.tsx +1 -0
- package/src/resizable-box/stories/index.story.tsx +1 -0
- package/src/resizable-box/style.scss +4 -5
- package/src/sandbox/index.tsx +189 -9
- package/src/sandbox/stories/index.story.tsx +1 -0
- package/src/sandbox/test/index.tsx +65 -24
- package/src/sandbox/types.ts +11 -0
- package/src/scroll-lock/stories/index.story.tsx +1 -0
- package/src/search-control/stories/index.story.tsx +1 -0
- package/src/select-control/stories/index.story.tsx +1 -0
- package/src/shortcut/stories/index.story.tsx +1 -0
- package/src/slot-fill/stories/index.story.tsx +1 -0
- package/src/snackbar/stories/index.story.tsx +1 -0
- package/src/snackbar/style.scss +2 -2
- package/src/spinner/stories/index.story.tsx +1 -0
- package/src/tab-panel/style.scss +1 -1
- package/src/text-control/stories/index.story.tsx +1 -0
- package/src/text-highlight/stories/index.story.tsx +1 -0
- package/src/textarea-control/stories/index.story.tsx +4 -0
- package/src/textarea-control/styles/textarea-control-styles.ts +6 -0
- package/src/toggle-control/stories/index.story.tsx +1 -0
- package/src/toggle-control/style.scss +1 -1
- package/src/toggle-control/test/index.tsx +8 -2
- package/src/toggle-group-control/stories/index.story.tsx +1 -1
- package/src/toolbar/toolbar-group/index.tsx +2 -2
- package/src/tooltip/stories/index.story.tsx +1 -0
- package/src/tooltip/test/index.tsx +3 -2
- package/src/tree-grid/stories/index.story.tsx +1 -1
- package/src/tree-select/stories/index.story.tsx +1 -0
- package/src/truncate/stories/index.story.tsx +1 -1
- package/src/unit-control/stories/index.story.tsx +1 -1
- package/src/utils/breakpoint.js +1 -1
- package/src/utils/font.js +1 -1
- package/src/visually-hidden/component.tsx +1 -0
- package/src/visually-hidden/stories/index.story.tsx +2 -8
- package/build/card/context.cjs +0 -36
- package/build/card/context.cjs.map +0 -7
- package/build/date-time/time/index.cjs.map +0 -7
- package/build-module/card/context.mjs +0 -10
- package/build-module/card/context.mjs.map +0 -7
- package/build-module/date-time/time/index.mjs.map +0 -7
- package/build-types/card/context.d.ts +0 -3
- package/build-types/card/context.d.ts.map +0 -1
- package/build-types/date-time/date/index.d.ts.map +0 -1
- package/build-types/date-time/date/styles.d.ts.map +0 -1
- package/build-types/date-time/date/test/index.d.ts.map +0 -1
- package/build-types/date-time/date/test/use-lilius.d.ts.map +0 -1
- package/build-types/date-time/date/use-lilius/index.d.ts.map +0 -1
- package/build-types/date-time/time/index.d.ts.map +0 -1
- package/build-types/date-time/time/styles.d.ts.map +0 -1
- package/build-types/date-time/time/test/index.d.ts.map +0 -1
- package/build-types/date-time/time/time-input/index.d.ts.map +0 -1
- package/build-types/date-time/time/time-input/test/index.d.ts.map +0 -1
- package/build-types/date-time/time/timezone.d.ts.map +0 -1
- package/build-types/visually-hidden/test/index.d.ts +0 -2
- package/build-types/visually-hidden/test/index.d.ts.map +0 -1
- package/src/card/context.ts +0 -9
- package/src/visually-hidden/test/__snapshots__/index.tsx.snap +0 -12
- package/src/visually-hidden/test/index.tsx +0 -17
- /package/build-types/date-time/{date → date-picker}/index.d.ts +0 -0
- /package/build-types/date-time/{date → date-picker}/styles.d.ts +0 -0
- /package/build-types/date-time/{date → date-picker}/test/index.d.ts +0 -0
- /package/build-types/date-time/{date → date-picker}/test/use-lilius.d.ts +0 -0
- /package/build-types/date-time/{date → date-picker}/use-lilius/index.d.ts +0 -0
- /package/build-types/date-time/{time → time-picker}/styles.d.ts +0 -0
- /package/build-types/date-time/{time → time-picker}/test/index.d.ts +0 -0
- /package/build-types/date-time/{time → time-picker}/time-input/index.d.ts +0 -0
- /package/build-types/date-time/{time → time-picker}/time-input/test/index.d.ts +0 -0
- /package/build-types/date-time/{time → time-picker}/timezone.d.ts +0 -0
- /package/src/date-time/{date → date-picker}/index.tsx +0 -0
- /package/src/date-time/{date → date-picker}/styles.ts +0 -0
- /package/src/date-time/{date → date-picker}/test/index.tsx +0 -0
- /package/src/date-time/{date → date-picker}/test/use-lilius.ts +0 -0
- /package/src/date-time/{date → date-picker}/use-lilius/index.ts +0 -0
- /package/src/date-time/{time → time-picker}/styles.ts +0 -0
- /package/src/date-time/{time → time-picker}/test/index.tsx +0 -0
- /package/src/date-time/{time → time-picker}/time-input/index.tsx +0 -0
- /package/src/date-time/{time → time-picker}/time-input/test/index.tsx +0 -0
- /package/src/date-time/{time → time-picker}/timezone.tsx +0 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# DatePicker
|
|
2
|
+
|
|
3
|
+
DatePicker is a React component that renders a calendar for date selection. It can be used independently or as part of the `DateTimePicker` component.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
Render a DatePicker.
|
|
8
|
+
|
|
9
|
+
```jsx
|
|
10
|
+
import { useState } from 'react';
|
|
11
|
+
import { DatePicker } from '@wordpress/components';
|
|
12
|
+
|
|
13
|
+
const MyDatePicker = () => {
|
|
14
|
+
const [ date, setDate ] = useState( new Date() );
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<DatePicker
|
|
18
|
+
currentDate={ date }
|
|
19
|
+
onChange={ ( newDate ) => setDate( newDate ) }
|
|
20
|
+
/>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Props
|
|
26
|
+
|
|
27
|
+
The component accepts the following props:
|
|
28
|
+
|
|
29
|
+
### `currentDate`: `Date | string | number | null`
|
|
30
|
+
|
|
31
|
+
The current date at initialization. Optionally pass in a `null` value to specify no date is currently selected.
|
|
32
|
+
|
|
33
|
+
- Required: No
|
|
34
|
+
- Default: today's date
|
|
35
|
+
|
|
36
|
+
### `onChange`: `( date: string ) => void`
|
|
37
|
+
|
|
38
|
+
The function called when a new date has been selected. It is passed the `currentDate` as an argument.
|
|
39
|
+
|
|
40
|
+
- Required: No
|
|
41
|
+
|
|
42
|
+
### `events`: `{ date: Date }[]`
|
|
43
|
+
|
|
44
|
+
List of events to show in the date picker. Each event will appear as a dot on the day of the event.
|
|
45
|
+
|
|
46
|
+
- Required: No
|
|
47
|
+
|
|
48
|
+
### `isInvalidDate`: `( date: Date ) => boolean`
|
|
49
|
+
|
|
50
|
+
A callback function which receives a Date object representing a day as an argument, and should return a Boolean to signify if the day is valid or not.
|
|
51
|
+
|
|
52
|
+
- Required: No
|
|
53
|
+
|
|
54
|
+
### `onMonthPreviewed`: `( date: string ) => void`
|
|
55
|
+
|
|
56
|
+
A callback invoked when selecting the previous/next month in the date picker. The callback receives the new month date in the ISO format as an argument.
|
|
57
|
+
|
|
58
|
+
- Required: No
|
|
59
|
+
|
|
60
|
+
### `startOfWeek`: `0 | 1 | 2 | 3 | 4 | 5 | 6`
|
|
61
|
+
|
|
62
|
+
The day that the week should start on. 0 for Sunday, 1 for Monday, etc.
|
|
63
|
+
|
|
64
|
+
- Required: No
|
|
65
|
+
- Default: 0
|
|
@@ -11,8 +11,8 @@ import { forwardRef } from '@wordpress/element';
|
|
|
11
11
|
/**
|
|
12
12
|
* Internal dependencies
|
|
13
13
|
*/
|
|
14
|
-
import { default as DatePicker } from '../date';
|
|
15
|
-
import { default as TimePicker } from '../time';
|
|
14
|
+
import { default as DatePicker } from '../date-picker';
|
|
15
|
+
import { default as TimePicker } from '../time-picker';
|
|
16
16
|
import type { DateTimePickerProps } from '../types';
|
|
17
17
|
import { Wrapper } from './styles';
|
|
18
18
|
|
package/src/date-time/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { default as DatePicker } from './date';
|
|
5
|
-
import { default as TimePicker } from './time';
|
|
4
|
+
import { default as DatePicker } from './date-picker';
|
|
5
|
+
import { default as TimePicker } from './time-picker';
|
|
6
6
|
import { default as DateTimePicker } from './date-time';
|
|
7
7
|
|
|
8
8
|
export { DatePicker, TimePicker };
|
|
@@ -11,7 +11,7 @@ import { useState, useEffect } from '@wordpress/element';
|
|
|
11
11
|
/**
|
|
12
12
|
* Internal dependencies
|
|
13
13
|
*/
|
|
14
|
-
import DatePicker from '../date';
|
|
14
|
+
import DatePicker from '../date-picker';
|
|
15
15
|
import { daysFromNow, isWeekend } from './utils';
|
|
16
16
|
|
|
17
17
|
const meta: Meta< typeof DatePicker > = {
|
|
@@ -11,7 +11,7 @@ import { useState, useEffect } from '@wordpress/element';
|
|
|
11
11
|
/**
|
|
12
12
|
* Internal dependencies
|
|
13
13
|
*/
|
|
14
|
-
import TimePicker from '../time';
|
|
14
|
+
import TimePicker from '../time-picker';
|
|
15
15
|
|
|
16
16
|
const meta: Meta< typeof TimePicker > = {
|
|
17
17
|
title: 'Components/Selection & Input/Time & Date/TimePicker',
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# TimePicker
|
|
2
|
+
|
|
3
|
+
TimePicker is a React component that renders form inputs for time and date selection. It can be used independently or as part of the `DateTimePicker` component.
|
|
4
|
+
|
|
5
|
+
**Note:** `TimePicker` also exposes a compound sub-component, `TimePicker.TimeInput`, which can be used independently to render a time input field without the full picker UI.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
Render a TimePicker.
|
|
10
|
+
|
|
11
|
+
```jsx
|
|
12
|
+
import { useState } from 'react';
|
|
13
|
+
import { TimePicker } from '@wordpress/components';
|
|
14
|
+
|
|
15
|
+
const MyTimePicker = () => {
|
|
16
|
+
const [ time, setTime ] = useState( new Date() );
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<TimePicker
|
|
20
|
+
currentTime={ time }
|
|
21
|
+
onChange={ ( newTime ) => setTime( newTime ) }
|
|
22
|
+
is12Hour
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Props
|
|
29
|
+
|
|
30
|
+
The component accepts the following props:
|
|
31
|
+
|
|
32
|
+
### `currentTime`: `Date | string | number | null`
|
|
33
|
+
|
|
34
|
+
The current time at initialization. Optionally pass in a `null` value to specify no time is currently selected.
|
|
35
|
+
|
|
36
|
+
- Required: No
|
|
37
|
+
- Default: current time
|
|
38
|
+
|
|
39
|
+
### `onChange`: `( time: string ) => void`
|
|
40
|
+
|
|
41
|
+
The function called when a new time has been selected. It is passed the time as an ISO-formatted string.
|
|
42
|
+
|
|
43
|
+
- Required: No
|
|
44
|
+
|
|
45
|
+
### `is12Hour`: `boolean`
|
|
46
|
+
|
|
47
|
+
Whether we use a 12-hour clock. With a 12-hour clock, an AM/PM widget is displayed.
|
|
48
|
+
|
|
49
|
+
- Required: No
|
|
50
|
+
- Default: false
|
|
51
|
+
|
|
52
|
+
### `dateOrder`: `'dmy' | 'mdy' | 'ymd'`
|
|
53
|
+
|
|
54
|
+
The order of day, month, and year. This prop overrides the time format determined by `is12Hour` prop.
|
|
55
|
+
|
|
56
|
+
- Required: No
|
|
57
|
+
- Default: `'dmy'` (or `'mdy'` when `is12Hour` is `true`)
|
|
58
|
+
|
|
59
|
+
### `hideLabelFromVision`: `boolean`
|
|
60
|
+
|
|
61
|
+
Whether to visually hide field labels while keeping them accessible to screen readers.
|
|
62
|
+
|
|
63
|
+
- Required: No
|
|
64
|
+
- Default: false
|
|
65
|
+
|
|
66
|
+
## TimePicker.TimeInput
|
|
67
|
+
|
|
68
|
+
A standalone time input component. Values are passed as an object in 24-hour format (`{ hours: number, minutes: number }`).
|
|
69
|
+
|
|
70
|
+
### Usage
|
|
71
|
+
|
|
72
|
+
```jsx
|
|
73
|
+
import { useState } from 'react';
|
|
74
|
+
import { TimePicker } from '@wordpress/components';
|
|
75
|
+
|
|
76
|
+
const MyTimeInput = () => {
|
|
77
|
+
const [ time, setTime ] = useState( { hours: 13, minutes: 30 } );
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<TimePicker.TimeInput
|
|
81
|
+
value={ time }
|
|
82
|
+
onChange={ setTime }
|
|
83
|
+
label="Time"
|
|
84
|
+
/>
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Props
|
|
90
|
+
|
|
91
|
+
#### `value`: `{ hours: number, minutes: number }`
|
|
92
|
+
|
|
93
|
+
The time input value in 24-hour format.
|
|
94
|
+
|
|
95
|
+
- Required: No
|
|
96
|
+
|
|
97
|
+
#### `defaultValue`: `{ hours: number, minutes: number }`
|
|
98
|
+
|
|
99
|
+
An optional default value for the control when used in uncontrolled mode. If left `undefined`, the current time will be used.
|
|
100
|
+
|
|
101
|
+
- Required: No
|
|
102
|
+
|
|
103
|
+
#### `onChange`: `( time: { hours: number, minutes: number } ) => void`
|
|
104
|
+
|
|
105
|
+
Called when the time changes. Receives the new value as an object with `hours` and `minutes`.
|
|
106
|
+
|
|
107
|
+
- Required: No
|
|
108
|
+
|
|
109
|
+
#### `is12Hour`: `boolean`
|
|
110
|
+
|
|
111
|
+
Whether to use a 12-hour clock. With a 12-hour clock, an AM/PM widget is displayed.
|
|
112
|
+
|
|
113
|
+
- Required: No
|
|
114
|
+
|
|
115
|
+
#### `label`: `string`
|
|
116
|
+
|
|
117
|
+
The label for the time input.
|
|
118
|
+
|
|
119
|
+
- Required: No
|
|
@@ -30,7 +30,7 @@ import { TimeInput } from './time-input';
|
|
|
30
30
|
const VALID_DATE_ORDERS = [ 'dmy', 'mdy', 'ymd' ];
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* TimePicker is a React component that renders
|
|
33
|
+
* TimePicker is a React component that renders form inputs for time and date selection. It can be used independently or as part of the `DateTimePicker` component.
|
|
34
34
|
*
|
|
35
35
|
* ```jsx
|
|
36
36
|
* import { TimePicker } from '@wordpress/components';
|
package/src/date-time/types.ts
CHANGED
|
@@ -18,6 +18,7 @@ import TextareaControl from '../../textarea-control/';
|
|
|
18
18
|
import { VStack } from '../../v-stack/';
|
|
19
19
|
|
|
20
20
|
const meta: Meta< typeof Disabled > = {
|
|
21
|
+
tags: [ 'manifest' ],
|
|
21
22
|
title: 'Components/Utilities/Disabled',
|
|
22
23
|
id: 'components-disabled',
|
|
23
24
|
component: Disabled,
|
|
@@ -14,6 +14,7 @@ import MenuItem from '../../menu-item';
|
|
|
14
14
|
import { DropdownContentWrapper } from '../dropdown-content-wrapper';
|
|
15
15
|
|
|
16
16
|
const meta: Meta< typeof Dropdown > = {
|
|
17
|
+
tags: [ 'manifest' ],
|
|
17
18
|
title: 'Components/Overlays/Dropdown',
|
|
18
19
|
id: 'components-dropdown',
|
|
19
20
|
component: Dropdown,
|
|
@@ -26,12 +26,7 @@ function UnforwardedExternalLink(
|
|
|
26
26
|
const { href, children, className, rel = '', ...additionalProps } = props;
|
|
27
27
|
const optimizedRel = [
|
|
28
28
|
...new Set(
|
|
29
|
-
[
|
|
30
|
-
...rel.split( ' ' ),
|
|
31
|
-
'external',
|
|
32
|
-
'noreferrer',
|
|
33
|
-
'noopener',
|
|
34
|
-
].filter( Boolean )
|
|
29
|
+
[ ...rel.split( ' ' ), 'external', 'noopener' ].filter( Boolean )
|
|
35
30
|
),
|
|
36
31
|
].join( ' ' );
|
|
37
32
|
const classes = clsx( 'components-external-link', className );
|
|
@@ -21,8 +21,9 @@ const meta: Meta< typeof ExternalLink > = {
|
|
|
21
21
|
},
|
|
22
22
|
docs: { canvas: { sourceState: 'shown' } },
|
|
23
23
|
componentStatus: {
|
|
24
|
-
status: '
|
|
24
|
+
status: 'not-recommended',
|
|
25
25
|
whereUsed: 'global',
|
|
26
|
+
notes: 'Use `Link` from `@wordpress/ui` instead, with the `openInNewTab` prop set.',
|
|
26
27
|
},
|
|
27
28
|
},
|
|
28
29
|
};
|
|
@@ -1,12 +1,40 @@
|
|
|
1
1
|
.components-external-link {
|
|
2
|
+
color: var(--wpds-color-fg-interactive-brand);
|
|
2
3
|
text-decoration: none;
|
|
4
|
+
|
|
5
|
+
// Match the `outset-ring--focus` utility used by `Link` in `@wordpress/ui`.
|
|
6
|
+
@media not ( prefers-reduced-motion ) {
|
|
7
|
+
transition: outline 0.1s ease-out;
|
|
8
|
+
}
|
|
9
|
+
// Outline width must be kept at 0 even with a transparent color,
|
|
10
|
+
// or else the outline will be visible in forced-colors mode.
|
|
11
|
+
outline: 0 solid transparent;
|
|
12
|
+
outline-offset: 1px;
|
|
13
|
+
|
|
14
|
+
&:visited {
|
|
15
|
+
color: var(--wpds-color-fg-interactive-brand);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&:hover,
|
|
19
|
+
&:active {
|
|
20
|
+
color: var(--wpds-color-fg-interactive-brand-active);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&:focus {
|
|
24
|
+
outline:
|
|
25
|
+
var(--wpds-border-width-focus) solid
|
|
26
|
+
var(--wpds-color-stroke-focus-brand);
|
|
27
|
+
}
|
|
3
28
|
}
|
|
4
29
|
|
|
5
30
|
.components-external-link__contents {
|
|
6
31
|
text-decoration: underline;
|
|
32
|
+
text-underline-offset: 0.2em;
|
|
33
|
+
text-decoration-thickness: from-font;
|
|
7
34
|
}
|
|
8
35
|
|
|
9
36
|
.components-external-link__icon {
|
|
10
|
-
|
|
11
|
-
|
|
37
|
+
display: inline-block;
|
|
38
|
+
margin-inline-start: var(--wpds-dimension-padding-xs);
|
|
39
|
+
font-weight: var(--wpds-typography-font-weight-regular);
|
|
12
40
|
}
|
|
@@ -14,6 +14,7 @@ import { upload as uploadIcon } from '@wordpress/icons';
|
|
|
14
14
|
import FormFileUpload from '..';
|
|
15
15
|
|
|
16
16
|
const meta: Meta< typeof FormFileUpload > = {
|
|
17
|
+
tags: [ 'manifest' ],
|
|
17
18
|
title: 'Components/Selection & Input/File Upload/FormFileUpload',
|
|
18
19
|
id: 'components-formfileupload',
|
|
19
20
|
component: FormFileUpload,
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
@use "@wordpress/base-styles/colors" as *;
|
|
3
3
|
@use "@wordpress/base-styles/mixins" as *;
|
|
4
4
|
@use "@wordpress/base-styles/variables" as *;
|
|
5
|
-
@use "@wordpress/base-styles/z-index" as *;
|
|
6
5
|
@use "../utils/theme-variables" as *;
|
|
7
6
|
|
|
8
7
|
$toggle-width: $grid-unit-40;
|
|
@@ -14,6 +13,7 @@ $transition-duration: 0.2s;
|
|
|
14
13
|
|
|
15
14
|
.components-form-toggle {
|
|
16
15
|
position: relative;
|
|
16
|
+
isolation: isolate;
|
|
17
17
|
display: inline-block;
|
|
18
18
|
height: $toggle-height;
|
|
19
19
|
|
|
@@ -104,7 +104,40 @@ $transition-duration: 0.2s;
|
|
|
104
104
|
// Disabled state:
|
|
105
105
|
&.is-disabled,
|
|
106
106
|
.components-disabled & {
|
|
107
|
-
|
|
107
|
+
.components-form-toggle__track {
|
|
108
|
+
background-color: $components-color-gray-100;
|
|
109
|
+
border-color: $components-color-gray-300;
|
|
110
|
+
|
|
111
|
+
@media ( forced-colors: active ) {
|
|
112
|
+
border-color: GrayText;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.components-form-toggle__thumb {
|
|
117
|
+
background-color: $components-color-gray-400;
|
|
118
|
+
box-shadow: none;
|
|
119
|
+
|
|
120
|
+
@media ( forced-colors: active ) {
|
|
121
|
+
border-color: GrayText;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
&.is-checked .components-form-toggle__track {
|
|
126
|
+
background-color: $components-color-gray-400;
|
|
127
|
+
border-color: $components-color-gray-400;
|
|
128
|
+
|
|
129
|
+
@media ( forced-colors: active ) {
|
|
130
|
+
border-color: GrayText;
|
|
131
|
+
|
|
132
|
+
&::after {
|
|
133
|
+
border-top-color: GrayText;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
&.is-checked .components-form-toggle__thumb {
|
|
139
|
+
background-color: $white;
|
|
140
|
+
}
|
|
108
141
|
}
|
|
109
142
|
}
|
|
110
143
|
|
|
@@ -118,7 +151,8 @@ $transition-duration: 0.2s;
|
|
|
118
151
|
opacity: 0;
|
|
119
152
|
margin: 0;
|
|
120
153
|
padding: 0;
|
|
121
|
-
|
|
154
|
+
// Sit above the visual track and thumb so the invisible input receives pointer events.
|
|
155
|
+
z-index: 1;
|
|
122
156
|
|
|
123
157
|
// This overrides a border style that is inherited from parent checkbox styles.
|
|
124
158
|
border: none;
|
|
@@ -132,6 +166,6 @@ $transition-duration: 0.2s;
|
|
|
132
166
|
}
|
|
133
167
|
|
|
134
168
|
&:not(:disabled, [aria-disabled="true"]) {
|
|
135
|
-
cursor:
|
|
169
|
+
cursor: var(--wpds-cursor-control);
|
|
136
170
|
}
|
|
137
171
|
}
|
|
@@ -51,6 +51,7 @@ The `value` property is handled in a manner similar to controlled form component
|
|
|
51
51
|
- `maxLength` - If passed, `TokenField` will disable ability to add new tokens once number of tokens is greater than or equal to `maxLength`.
|
|
52
52
|
- `disabled` - When true, tokens are not able to be added or removed.
|
|
53
53
|
- `placeholder` - If passed, the `TokenField` input will show a placeholder string if no value tokens are present.
|
|
54
|
+
- `help` - Additional description for the control. Only use for meaningful description or instructions for the control. An element containing the description will be programmatically associated to the `FormTokenField` via `aria-describedby`. Defaults to a how-to message (e.g. _Separate with commas or the Enter key._); pass an empty string to hide it.
|
|
54
55
|
- `messages` - Allows customizing the messages presented by screen readers in different occasions:
|
|
55
56
|
- `added` - The user added a new token.
|
|
56
57
|
- `removed` - The user removed an existing token.
|
|
@@ -58,7 +59,7 @@ The `value` property is handled in a manner similar to controlled form component
|
|
|
58
59
|
- `__experimentalInvalid` - The user tried to add a token that didn't pass the validation.
|
|
59
60
|
- `__experimentalRenderItem` - Custom renderer invoked for each option in the suggestion list. The render prop receives as its argument an object containing, under the `item` key, the single option's data (directly from the array of data passed to the `options` prop).
|
|
60
61
|
- `__experimentalExpandOnFocus` - If true, the suggestions list will be always expanded when the input field has the focus.
|
|
61
|
-
- `__experimentalShowHowTo` -
|
|
62
|
+
- `__experimentalShowHowTo` - **Deprecated.** Use the `help` prop instead. The `help` prop now defaults to the previous how-to text; if you were passing `__experimentalShowHowTo={ false }` to hide it, pass an empty string to `help` instead.
|
|
62
63
|
- `__experimentalValidateInput` - If passed, all introduced values will be validated before being added as tokens.
|
|
63
64
|
- `__experimentalAutoSelectFirstMatch` - If true, the select the first matching suggestion when the user presses the Enter key (or space when tokenizeOnSpace is true).
|
|
64
65
|
- `__next40pxDefaultSize` - Start opting into the larger default height that will become the default size in a future version.
|
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import clsx from 'clsx';
|
|
5
|
-
import type {
|
|
5
|
+
import type {
|
|
6
|
+
KeyboardEvent,
|
|
7
|
+
MouseEvent,
|
|
8
|
+
TouchEvent,
|
|
9
|
+
FocusEvent,
|
|
10
|
+
ReactNode,
|
|
11
|
+
} from 'react';
|
|
6
12
|
|
|
7
13
|
/**
|
|
8
14
|
* WordPress dependencies
|
|
@@ -12,6 +18,7 @@ import { __, _n, sprintf } from '@wordpress/i18n';
|
|
|
12
18
|
import { useDebounce, useInstanceId, usePrevious } from '@wordpress/compose';
|
|
13
19
|
import { speak } from '@wordpress/a11y';
|
|
14
20
|
import { isShallowEqual } from '@wordpress/is-shallow-equal';
|
|
21
|
+
import deprecated from '@wordpress/deprecated';
|
|
15
22
|
|
|
16
23
|
/**
|
|
17
24
|
* Internal dependencies
|
|
@@ -70,10 +77,11 @@ export function FormTokenField( props: FormTokenFieldProps ) {
|
|
|
70
77
|
__experimentalRenderItem,
|
|
71
78
|
__experimentalExpandOnFocus = false,
|
|
72
79
|
__experimentalValidateInput = () => true,
|
|
73
|
-
__experimentalShowHowTo
|
|
80
|
+
__experimentalShowHowTo,
|
|
74
81
|
__next40pxDefaultSize = false,
|
|
75
82
|
__experimentalAutoSelectFirstMatch = false,
|
|
76
83
|
tokenizeOnBlur = false,
|
|
84
|
+
help,
|
|
77
85
|
} = useDeprecated36pxDefaultSizeProp< FormTokenFieldProps >( props );
|
|
78
86
|
|
|
79
87
|
maybeWarnDeprecated36pxSize( {
|
|
@@ -82,6 +90,27 @@ export function FormTokenField( props: FormTokenFieldProps ) {
|
|
|
82
90
|
__next40pxDefaultSize,
|
|
83
91
|
} );
|
|
84
92
|
|
|
93
|
+
const defaultHelp = tokenizeOnSpace
|
|
94
|
+
? __( 'Separate with commas, spaces, or the Enter key.' )
|
|
95
|
+
: __( 'Separate with commas or the Enter key.' );
|
|
96
|
+
|
|
97
|
+
let computedHelp: ReactNode = help !== undefined ? help : defaultHelp;
|
|
98
|
+
|
|
99
|
+
if ( typeof __experimentalShowHowTo === 'boolean' ) {
|
|
100
|
+
deprecated(
|
|
101
|
+
'`__experimentalShowHowTo` prop in wp.components.FormTokenField',
|
|
102
|
+
{
|
|
103
|
+
since: '7.1',
|
|
104
|
+
alternative: '`help` prop',
|
|
105
|
+
hint: 'The `help` prop now defaults to the previous how-to text. Pass an empty string to hide it.',
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
if ( __experimentalShowHowTo === false && help === undefined ) {
|
|
110
|
+
computedHelp = '';
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
85
114
|
const instanceId = useInstanceId( FormTokenField );
|
|
86
115
|
|
|
87
116
|
// We reset to these initial values again in the onBlur
|
|
@@ -655,6 +684,10 @@ export function FormTokenField( props: FormTokenFieldProps ) {
|
|
|
655
684
|
}
|
|
656
685
|
|
|
657
686
|
function renderInput() {
|
|
687
|
+
const describedById = computedHelp
|
|
688
|
+
? `components-form-token-input-${ instanceId }__help`
|
|
689
|
+
: undefined;
|
|
690
|
+
|
|
658
691
|
const inputProps = {
|
|
659
692
|
instanceId,
|
|
660
693
|
autoCapitalize,
|
|
@@ -665,6 +698,7 @@ export function FormTokenField( props: FormTokenFieldProps ) {
|
|
|
665
698
|
onBlur,
|
|
666
699
|
isExpanded,
|
|
667
700
|
selectedSuggestionIndex,
|
|
701
|
+
'aria-describedby': describedById,
|
|
668
702
|
};
|
|
669
703
|
|
|
670
704
|
return (
|
|
@@ -749,16 +783,12 @@ export function FormTokenField( props: FormTokenFieldProps ) {
|
|
|
749
783
|
/>
|
|
750
784
|
) }
|
|
751
785
|
</div>
|
|
752
|
-
{
|
|
786
|
+
{ computedHelp && (
|
|
753
787
|
<StyledHelp
|
|
754
|
-
id={ `components-form-token-
|
|
788
|
+
id={ `components-form-token-input-${ instanceId }__help` }
|
|
755
789
|
className="components-form-token-field__help"
|
|
756
790
|
>
|
|
757
|
-
{
|
|
758
|
-
? __(
|
|
759
|
-
'Separate with commas, spaces, or the Enter key.'
|
|
760
|
-
)
|
|
761
|
-
: __( 'Separate with commas or the Enter key.' ) }
|
|
791
|
+
{ computedHelp }
|
|
762
792
|
</StyledHelp>
|
|
763
793
|
) }
|
|
764
794
|
</div>
|
|
@@ -14,6 +14,7 @@ import { useState } from '@wordpress/element';
|
|
|
14
14
|
import FormTokenField from '../';
|
|
15
15
|
|
|
16
16
|
const meta: Meta< typeof FormTokenField > = {
|
|
17
|
+
tags: [ 'manifest' ],
|
|
17
18
|
component: FormTokenField,
|
|
18
19
|
title: 'Components/Selection & Input/Common/FormTokenField',
|
|
19
20
|
id: 'components-formtokenfield',
|
|
@@ -24,6 +25,7 @@ const meta: Meta< typeof FormTokenField > = {
|
|
|
24
25
|
__experimentalValidateInput: {
|
|
25
26
|
control: false,
|
|
26
27
|
},
|
|
28
|
+
help: { control: 'text' },
|
|
27
29
|
},
|
|
28
30
|
parameters: {
|
|
29
31
|
controls: {
|
|
@@ -11,8 +11,9 @@
|
|
|
11
11
|
cursor: text;
|
|
12
12
|
|
|
13
13
|
&.is-disabled {
|
|
14
|
-
background: $gray-
|
|
15
|
-
border-color: $gray-
|
|
14
|
+
background: $components-color-gray-100;
|
|
15
|
+
border-color: $components-color-gray-400;
|
|
16
|
+
cursor: default;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
&.is-active {
|
|
@@ -82,6 +83,14 @@
|
|
|
82
83
|
}
|
|
83
84
|
}
|
|
84
85
|
|
|
86
|
+
&.is-disabled {
|
|
87
|
+
.components-form-token-field__token-text,
|
|
88
|
+
.components-form-token-field__remove-token.components-button {
|
|
89
|
+
background: $components-color-gray-100;
|
|
90
|
+
color: $components-color-gray-600;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
85
94
|
&.is-borderless {
|
|
86
95
|
position: relative;
|
|
87
96
|
padding: 0 24px 0 0;
|
|
@@ -198,6 +207,6 @@
|
|
|
198
207
|
}
|
|
199
208
|
|
|
200
209
|
&:not(.is-empty) {
|
|
201
|
-
cursor:
|
|
210
|
+
cursor: var(--wpds-cursor-control);
|
|
202
211
|
}
|
|
203
212
|
}
|