@wordpress/components 34.0.0 → 35.0.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 +25 -1
- package/build/alignment-matrix-control/cell.cjs +1 -1
- package/build/alignment-matrix-control/cell.cjs.map +2 -2
- package/build/alignment-matrix-control/index.cjs +1 -1
- package/build/alignment-matrix-control/index.cjs.map +2 -2
- package/build/border-control/border-control-dropdown/component.cjs +33 -33
- package/build/border-control/border-control-dropdown/component.cjs.map +3 -3
- package/build/color-palette/index.cjs +3 -0
- package/build/color-palette/index.cjs.map +2 -2
- package/build/custom-gradient-picker/gradient-bar/index.cjs.map +2 -2
- package/build/disabled/index.cjs +1 -1
- package/build/disabled/index.cjs.map +2 -2
- package/build/draggable/index.cjs +1 -1
- package/build/draggable/index.cjs.map +2 -2
- package/build/higher-order/with-notices/index.cjs +15 -3
- package/build/higher-order/with-notices/index.cjs.map +2 -2
- package/build/input-control/input-base.cjs +34 -31
- package/build/input-control/input-base.cjs.map +2 -2
- package/build/navigable-container/container.cjs +15 -21
- package/build/navigable-container/container.cjs.map +2 -2
- package/build/responsive-wrapper/index.cjs +3 -4
- package/build/responsive-wrapper/index.cjs.map +2 -2
- package/build/tooltip/index.cjs +1 -2
- package/build/tooltip/index.cjs.map +2 -2
- package/build/unit-control/utils.cjs +33 -35
- package/build/unit-control/utils.cjs.map +2 -2
- package/build-module/alignment-matrix-control/cell.mjs +1 -1
- package/build-module/alignment-matrix-control/cell.mjs.map +2 -2
- package/build-module/alignment-matrix-control/index.mjs +1 -1
- package/build-module/alignment-matrix-control/index.mjs.map +2 -2
- package/build-module/border-control/border-control-dropdown/component.mjs +34 -34
- package/build-module/border-control/border-control-dropdown/component.mjs.map +2 -2
- package/build-module/color-palette/index.mjs +3 -0
- package/build-module/color-palette/index.mjs.map +2 -2
- package/build-module/custom-gradient-picker/gradient-bar/index.mjs.map +2 -2
- package/build-module/disabled/index.mjs +1 -1
- package/build-module/disabled/index.mjs.map +2 -2
- package/build-module/draggable/index.mjs +1 -1
- package/build-module/draggable/index.mjs.map +2 -2
- package/build-module/higher-order/with-notices/index.mjs +16 -4
- package/build-module/higher-order/with-notices/index.mjs.map +2 -2
- package/build-module/input-control/input-base.mjs +34 -31
- package/build-module/input-control/input-base.mjs.map +2 -2
- package/build-module/navigable-container/container.mjs +16 -22
- package/build-module/navigable-container/container.mjs.map +2 -2
- package/build-module/responsive-wrapper/index.mjs +3 -4
- package/build-module/responsive-wrapper/index.mjs.map +2 -2
- package/build-module/tooltip/index.mjs +1 -2
- package/build-module/tooltip/index.mjs.map +2 -2
- package/build-module/unit-control/utils.mjs +33 -35
- package/build-module/unit-control/utils.mjs.map +2 -2
- package/build-style/style-rtl.css +41 -10
- package/build-style/style.css +41 -10
- package/build-types/border-box-control/border-box-control/hook.d.ts +10 -24
- package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +12 -26
- package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +10 -24
- package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +11 -25
- package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts.map +1 -1
- package/build-types/border-control/border-control/hook.d.ts +10 -24
- package/build-types/border-control/border-control/hook.d.ts.map +1 -1
- package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
- package/build-types/border-control/border-control-dropdown/hook.d.ts +9 -23
- package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
- package/build-types/box-control/styles/box-control-styles.d.ts +2 -2
- package/build-types/card/card/hook.d.ts +11 -25
- package/build-types/card/card/hook.d.ts.map +1 -1
- package/build-types/card/card-body/hook.d.ts +11 -25
- package/build-types/card/card-body/hook.d.ts.map +1 -1
- package/build-types/card/card-divider/hook.d.ts +12 -26
- package/build-types/card/card-divider/hook.d.ts.map +1 -1
- package/build-types/card/card-footer/hook.d.ts +11 -25
- package/build-types/card/card-footer/hook.d.ts.map +1 -1
- package/build-types/card/card-header/hook.d.ts +11 -25
- package/build-types/card/card-header/hook.d.ts.map +1 -1
- package/build-types/card/card-media/hook.d.ts +11 -25
- package/build-types/card/card-media/hook.d.ts.map +1 -1
- package/build-types/card/context.d.ts +3 -0
- package/build-types/card/context.d.ts.map +1 -0
- package/build-types/color-palette/index.d.ts.map +1 -1
- package/build-types/color-picker/styles.d.ts +2 -2
- package/build-types/composite/stories/index.story.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/gradient-bar/index.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/styles.d.ts +12 -4
- package/build-types/custom-select-control-v2/styles.d.ts.map +1 -1
- package/build-types/date-time/date/index.d.ts +23 -0
- package/build-types/date-time/date/index.d.ts.map +1 -0
- package/build-types/date-time/date/styles.d.ts +45 -0
- package/build-types/date-time/date/styles.d.ts.map +1 -0
- package/build-types/date-time/date/test/index.d.ts +2 -0
- package/build-types/date-time/date/test/index.d.ts.map +1 -0
- package/build-types/date-time/date/test/use-lilius.d.ts +2 -0
- package/build-types/date-time/date/test/use-lilius.d.ts.map +1 -0
- package/build-types/date-time/date/use-lilius/index.d.ts +169 -0
- package/build-types/date-time/date/use-lilius/index.d.ts.map +1 -0
- package/build-types/date-time/time/index.d.ts +27 -0
- package/build-types/date-time/time/index.d.ts.map +1 -0
- package/build-types/date-time/time/styles.d.ts +93 -0
- package/build-types/date-time/time/styles.d.ts.map +1 -0
- package/build-types/date-time/time/test/index.d.ts +2 -0
- package/build-types/date-time/time/test/index.d.ts.map +1 -0
- package/build-types/date-time/time/time-input/index.d.ts +4 -0
- package/build-types/date-time/time/time-input/index.d.ts.map +1 -0
- package/build-types/date-time/time/time-input/test/index.d.ts +2 -0
- package/build-types/date-time/time/time-input/test/index.d.ts.map +1 -0
- package/build-types/date-time/time/timezone.d.ts +7 -0
- package/build-types/date-time/time/timezone.d.ts.map +1 -0
- package/build-types/date-time/time-picker/styles.d.ts +4 -4
- package/build-types/elevation/hook.d.ts +11 -25
- package/build-types/elevation/hook.d.ts.map +1 -1
- package/build-types/flex/flex/hook.d.ts +11 -25
- package/build-types/flex/flex/hook.d.ts.map +1 -1
- package/build-types/flex/flex-block/hook.d.ts +11 -25
- package/build-types/flex/flex-block/hook.d.ts.map +1 -1
- package/build-types/flex/flex-item/hook.d.ts +11 -25
- package/build-types/flex/flex-item/hook.d.ts.map +1 -1
- package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +1 -1
- package/build-types/grid/hook.d.ts +11 -25
- package/build-types/grid/hook.d.ts.map +1 -1
- package/build-types/h-stack/hook.d.ts +11 -25
- package/build-types/h-stack/hook.d.ts.map +1 -1
- package/build-types/heading/hook.d.ts +11 -25
- package/build-types/heading/hook.d.ts.map +1 -1
- package/build-types/higher-order/with-fallback-styles/index.d.ts +3 -1
- package/build-types/higher-order/with-filters/index.d.ts +6 -1
- package/build-types/higher-order/with-filters/index.d.ts.map +1 -1
- package/build-types/higher-order/with-notices/index.d.ts +4 -2
- package/build-types/higher-order/with-notices/index.d.ts.map +1 -1
- package/build-types/input-control/reducer/reducer.d.ts +1 -1
- package/build-types/item-group/item/hook.d.ts +11 -25
- package/build-types/item-group/item/hook.d.ts.map +1 -1
- package/build-types/item-group/item-group/hook.d.ts +11 -25
- package/build-types/item-group/item-group/hook.d.ts.map +1 -1
- package/build-types/menu/stories/index.story.d.ts.map +1 -1
- package/build-types/menu/styles.d.ts +21 -7
- package/build-types/menu/styles.d.ts.map +1 -1
- package/build-types/modal/use-modal-exit-animation.d.ts +1 -1
- package/build-types/navigable-container/container.d.ts.map +1 -1
- package/build-types/navigation/back-button/index.d.ts +7 -0
- package/build-types/navigation/back-button/index.d.ts.map +1 -0
- package/build-types/navigation/constants.d.ts +3 -0
- package/build-types/navigation/constants.d.ts.map +1 -0
- package/build-types/navigation/context.d.ts +4 -0
- package/build-types/navigation/context.d.ts.map +1 -0
- package/build-types/navigation/group/context.d.ts +7 -0
- package/build-types/navigation/group/context.d.ts.map +1 -0
- package/build-types/navigation/group/index.d.ts +7 -0
- package/build-types/navigation/group/index.d.ts.map +1 -0
- package/build-types/navigation/index.d.ts +46 -0
- package/build-types/navigation/index.d.ts.map +1 -0
- package/build-types/navigation/item/base-content.d.ts +3 -0
- package/build-types/navigation/item/base-content.d.ts.map +1 -0
- package/build-types/navigation/item/base.d.ts +3 -0
- package/build-types/navigation/item/base.d.ts.map +1 -0
- package/build-types/navigation/item/index.d.ts +7 -0
- package/build-types/navigation/item/index.d.ts.map +1 -0
- package/build-types/navigation/item/use-navigation-tree-item.d.ts +3 -0
- package/build-types/navigation/item/use-navigation-tree-item.d.ts.map +1 -0
- package/build-types/navigation/menu/context.d.ts +7 -0
- package/build-types/navigation/menu/context.d.ts.map +1 -0
- package/build-types/navigation/menu/index.d.ts +7 -0
- package/build-types/navigation/menu/index.d.ts.map +1 -0
- package/build-types/navigation/menu/menu-title-search.d.ts +3 -0
- package/build-types/navigation/menu/menu-title-search.d.ts.map +1 -0
- package/build-types/navigation/menu/menu-title.d.ts +3 -0
- package/build-types/navigation/menu/menu-title.d.ts.map +1 -0
- package/build-types/navigation/menu/search-no-results-found.d.ts +3 -0
- package/build-types/navigation/menu/search-no-results-found.d.ts.map +1 -0
- package/build-types/navigation/menu/use-navigation-tree-menu.d.ts +3 -0
- package/build-types/navigation/menu/use-navigation-tree-menu.d.ts.map +1 -0
- package/build-types/navigation/stories/index.story.d.ts +23 -0
- package/build-types/navigation/stories/index.story.d.ts.map +1 -0
- package/build-types/navigation/stories/utils/controlled-state.d.ts +7 -0
- package/build-types/navigation/stories/utils/controlled-state.d.ts.map +1 -0
- package/build-types/navigation/stories/utils/default.d.ts +10 -0
- package/build-types/navigation/stories/utils/default.d.ts.map +1 -0
- package/build-types/navigation/stories/utils/group.d.ts +10 -0
- package/build-types/navigation/stories/utils/group.d.ts.map +1 -0
- package/build-types/navigation/stories/utils/hide-if-empty.d.ts +10 -0
- package/build-types/navigation/stories/utils/hide-if-empty.d.ts.map +1 -0
- package/build-types/navigation/stories/utils/more-examples.d.ts +10 -0
- package/build-types/navigation/stories/utils/more-examples.d.ts.map +1 -0
- package/build-types/navigation/stories/utils/search.d.ts +10 -0
- package/build-types/navigation/stories/utils/search.d.ts.map +1 -0
- package/build-types/navigation/styles/navigation-styles.d.ts +55 -0
- package/build-types/navigation/styles/navigation-styles.d.ts.map +1 -0
- package/build-types/navigation/test/index.d.ts +2 -0
- package/build-types/navigation/test/index.d.ts.map +1 -0
- package/build-types/navigation/types.d.ts +266 -0
- package/build-types/navigation/types.d.ts.map +1 -0
- package/build-types/navigation/use-create-navigation-tree.d.ts +15 -0
- package/build-types/navigation/use-create-navigation-tree.d.ts.map +1 -0
- package/build-types/navigation/use-navigation-tree-nodes.d.ts +10 -0
- package/build-types/navigation/use-navigation-tree-nodes.d.ts.map +1 -0
- package/build-types/navigation/utils.d.ts +3 -0
- package/build-types/navigation/utils.d.ts.map +1 -0
- package/build-types/navigator/navigator-back-button/hook.d.ts +12 -26
- package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
- package/build-types/navigator/navigator-button/hook.d.ts +12 -26
- package/build-types/navigator/navigator-button/hook.d.ts.map +1 -1
- package/build-types/number-control/index.d.ts +1 -1
- package/build-types/number-control/index.d.ts.map +1 -1
- package/build-types/number-control/stories/index.story.d.ts +1 -1
- package/build-types/number-control/stories/index.story.d.ts.map +1 -1
- package/build-types/popover/types.d.ts +2 -2
- package/build-types/popover/types.d.ts.map +1 -1
- package/build-types/range-control/index.d.ts +1 -1
- package/build-types/range-control/styles/range-control-styles.d.ts +1 -1
- package/build-types/range-control/types.d.ts +1 -1
- package/build-types/range-control/types.d.ts.map +1 -1
- package/build-types/responsive-wrapper/index.d.ts.map +1 -1
- package/build-types/scrollable/hook.d.ts +11 -25
- package/build-types/scrollable/hook.d.ts.map +1 -1
- package/build-types/snackbar/index.d.ts +2 -2
- package/build-types/snackbar/types.d.ts +2 -2
- package/build-types/snackbar/types.d.ts.map +1 -1
- package/build-types/spacer/hook.d.ts +11 -25
- package/build-types/spacer/hook.d.ts.map +1 -1
- package/build-types/surface/hook.d.ts +11 -25
- package/build-types/surface/hook.d.ts.map +1 -1
- package/build-types/tabs/stories/index.story.d.ts.map +1 -1
- package/build-types/tabs/styles.d.ts +9 -3
- package/build-types/tabs/styles.d.ts.map +1 -1
- package/build-types/text/hook.d.ts +11 -25
- package/build-types/text/hook.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel/hook.d.ts +11 -25
- package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-header/hook.d.ts +11 -25
- package/build-types/tools-panel/tools-panel-header/hook.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-item/hook.d.ts +11 -25
- package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
- package/build-types/tooltip/index.d.ts.map +1 -1
- package/build-types/truncate/hook.d.ts +11 -25
- package/build-types/truncate/hook.d.ts.map +1 -1
- package/build-types/unit-control/index.d.ts +1 -1
- package/build-types/unit-control/index.d.ts.map +1 -1
- package/build-types/unit-control/styles/unit-control-styles.d.ts +1 -1
- package/build-types/unit-control/utils.d.ts.map +1 -1
- package/build-types/utils/get-node-text.d.ts.map +1 -1
- package/build-types/v-stack/hook.d.ts +11 -25
- package/build-types/v-stack/hook.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/combobox-control.d.ts +2 -2
- package/build-types/validated-form-controls/components/number-control.d.ts +1 -1
- package/build-types/validated-form-controls/components/number-control.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/range-control.d.ts +1 -1
- package/build-types/validated-form-controls/control-with-error.d.ts +1 -4
- package/build-types/validated-form-controls/control-with-error.d.ts.map +1 -1
- package/build-types/visually-hidden/test/index.d.ts +2 -0
- package/build-types/visually-hidden/test/index.d.ts.map +1 -0
- package/package.json +37 -35
- package/src/autocomplete/README.md +1 -1
- package/src/border-control/border-control-dropdown/component.tsx +37 -36
- package/src/card/card/README.md +4 -4
- package/src/checkbox-control/README.md +1 -1
- package/src/clipboard-button/README.md +4 -4
- package/src/color-palette/index.tsx +5 -0
- package/src/color-palette/test/index.tsx +30 -0
- package/src/combobox-control/README.md +1 -1
- package/src/composite/stories/index.story.tsx +1 -0
- package/src/confirm-dialog/README.md +1 -1
- package/src/custom-gradient-picker/gradient-bar/index.tsx +1 -1
- package/src/disabled/index.tsx +1 -1
- package/src/flex/flex/README.md +1 -1
- package/src/form-file-upload/README.md +1 -1
- package/src/h-stack/hook.tsx +1 -1
- package/src/higher-order/with-notices/index.tsx +21 -4
- package/src/higher-order/with-notices/test/index.tsx +18 -0
- package/src/input-control/input-base.tsx +2 -2
- package/src/menu/README.md +7 -7
- package/src/menu/stories/index.story.tsx +1 -0
- package/src/navigable-container/container.tsx +22 -30
- package/src/popover/README.md +1 -1
- package/src/popover/index.tsx +1 -1
- package/src/popover/types.ts +4 -2
- package/src/range-control/types.ts +1 -1
- package/src/responsive-wrapper/index.tsx +3 -7
- package/src/scrollable/README.md +1 -1
- package/src/snackbar/README.md +1 -1
- package/src/snackbar/types.ts +2 -2
- package/src/tabs/README.md +1 -1
- package/src/tabs/stories/index.story.tsx +1 -0
- package/src/tabs/tablist.tsx +1 -1
- package/src/tooltip/index.tsx +1 -7
- package/src/tooltip/style.scss +1 -1
- package/src/tree-grid/test/cell.tsx +1 -0
- package/src/tree-grid/test/roving-tab-index-item.tsx +1 -0
- package/src/tree-select/README.md +1 -1
- package/src/unit-control/utils.ts +33 -52
- package/src/utils/get-node-text.ts +1 -7
- package/src/validated-form-controls/control-with-error.tsx +1 -6
- package/build/mobile/image/constants.cjs +0 -34
- package/build/mobile/image/constants.cjs.map +0 -7
- package/build-module/mobile/image/constants.mjs +0 -9
- package/build-module/mobile/image/constants.mjs.map +0 -7
- package/src/autocomplete/autocompleter-ui.native.js +0 -211
- package/src/autocomplete/background-view.android.js +0 -25
- package/src/autocomplete/background-view.ios.js +0 -23
- package/src/autocomplete/style.android.scss +0 -7
- package/src/autocomplete/style.native.scss +0 -74
- package/src/base-control/index.native.js +0 -14
- package/src/button/index.native.js +0 -236
- package/src/button/style.native.scss +0 -9
- package/src/color-control/index.native.js +0 -24
- package/src/color-indicator/index.native.js +0 -80
- package/src/color-indicator/style.native.scss +0 -51
- package/src/color-palette/index.native.js +0 -360
- package/src/color-palette/style.native.scss +0 -49
- package/src/color-picker/hsv-color-picker.native.js +0 -88
- package/src/color-picker/hue-picker.native.js +0 -198
- package/src/color-picker/index.native.js +0 -215
- package/src/color-picker/saturation-picker.native.js +0 -167
- package/src/color-picker/style.native.scss +0 -87
- package/src/custom-gradient-picker/index.native.js +0 -110
- package/src/custom-gradient-picker/style.native.scss +0 -3
- package/src/dashicon/index.native.js +0 -18
- package/src/disabled/index.native.js +0 -10
- package/src/draggable/index.native.js +0 -234
- package/src/draggable/style.native.scss +0 -3
- package/src/draggable/test/index.native.js +0 -138
- package/src/dropdown/index.native.js +0 -59
- package/src/dropdown-menu/index.native.js +0 -152
- package/src/external-link/index.native.js +0 -25
- package/src/focal-point-picker/focal-point.native.js +0 -30
- package/src/focal-point-picker/index.native.js +0 -281
- package/src/focal-point-picker/tooltip/index.native.js +0 -144
- package/src/focal-point-picker/tooltip/style.native.scss +0 -42
- package/src/font-size-picker/index.native.js +0 -190
- package/src/font-size-picker/style.native.scss +0 -6
- package/src/footer-message-control/index.native.js +0 -14
- package/src/higher-order/with-focus-outside/index.native.js +0 -38
- package/src/index.native.js +0 -134
- package/src/keyboard-shortcuts/index.native.js +0 -2
- package/src/mobile/README.md +0 -3
- package/src/mobile/autocompletion-items.native.js +0 -11
- package/src/mobile/badge/README.md +0 -31
- package/src/mobile/badge/index.native.js +0 -27
- package/src/mobile/badge/style.scss +0 -18
- package/src/mobile/bottom-sheet/borderStyles.android.scss +0 -8
- package/src/mobile/bottom-sheet/borderStyles.ios.scss +0 -9
- package/src/mobile/bottom-sheet/bottom-sheet-context.native.js +0 -40
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/README.md +0 -101
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/bottom-sheet-navigation-context.native.js +0 -16
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +0 -193
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +0 -146
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/styles.native.scss +0 -11
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/test/navigation-container.native.js +0 -197
- package/src/mobile/bottom-sheet/button.native.js +0 -19
- package/src/mobile/bottom-sheet/cell.native.js +0 -464
- package/src/mobile/bottom-sheet/cellStyles.android.scss +0 -15
- package/src/mobile/bottom-sheet/cellStyles.ios.scss +0 -19
- package/src/mobile/bottom-sheet/chevron-back.native.js +0 -18
- package/src/mobile/bottom-sheet/color-cell.native.js +0 -35
- package/src/mobile/bottom-sheet/cycle-picker-cell.native.js +0 -31
- package/src/mobile/bottom-sheet/footer-message-cell.native.js +0 -23
- package/src/mobile/bottom-sheet/footer-message-link/README.md +0 -37
- package/src/mobile/bottom-sheet/footer-message-link/footer-message-link.native.js +0 -26
- package/src/mobile/bottom-sheet/footer-message-link/styles.native.scss +0 -7
- package/src/mobile/bottom-sheet/index.native.js +0 -646
- package/src/mobile/bottom-sheet/keyboard-avoiding-view.native.js +0 -125
- package/src/mobile/bottom-sheet/link-cell.native.js +0 -35
- package/src/mobile/bottom-sheet/link-suggestion-item-cell.native.js +0 -92
- package/src/mobile/bottom-sheet/link-suggestion-styles.native.scss +0 -27
- package/src/mobile/bottom-sheet/lock-icon/index.native.js +0 -19
- package/src/mobile/bottom-sheet/lock-icon/styles.native.scss +0 -8
- package/src/mobile/bottom-sheet/nav-bar/README.md +0 -63
- package/src/mobile/bottom-sheet/nav-bar/action-button.native.js +0 -30
- package/src/mobile/bottom-sheet/nav-bar/apply-button.native.js +0 -53
- package/src/mobile/bottom-sheet/nav-bar/back-button.native.js +0 -94
- package/src/mobile/bottom-sheet/nav-bar/heading.native.js +0 -33
- package/src/mobile/bottom-sheet/nav-bar/index.native.js +0 -23
- package/src/mobile/bottom-sheet/nav-bar/styles.native.scss +0 -69
- package/src/mobile/bottom-sheet/picker-cell.native.js +0 -40
- package/src/mobile/bottom-sheet/radio-cell.native.js +0 -39
- package/src/mobile/bottom-sheet/range-cell.native.js +0 -274
- package/src/mobile/bottom-sheet/range-cell.native.scss +0 -40
- package/src/mobile/bottom-sheet/range-text-input.native.js +0 -248
- package/src/mobile/bottom-sheet/ripple.native.js +0 -83
- package/src/mobile/bottom-sheet/ripple.native.scss +0 -11
- package/src/mobile/bottom-sheet/stepper-cell/index.native.js +0 -264
- package/src/mobile/bottom-sheet/stepper-cell/stepper.android.js +0 -78
- package/src/mobile/bottom-sheet/stepper-cell/stepper.ios.js +0 -64
- package/src/mobile/bottom-sheet/stepper-cell/style.native.scss +0 -89
- package/src/mobile/bottom-sheet/styles.native.scss +0 -333
- package/src/mobile/bottom-sheet/sub-sheet/README.md +0 -90
- package/src/mobile/bottom-sheet/sub-sheet/index.native.js +0 -49
- package/src/mobile/bottom-sheet/switch-cell.native.js +0 -75
- package/src/mobile/bottom-sheet/test/index.native.js +0 -24
- package/src/mobile/bottom-sheet/test/range-cell.native.js +0 -73
- package/src/mobile/bottom-sheet-select-control/README.md +0 -97
- package/src/mobile/bottom-sheet-select-control/index.native.js +0 -124
- package/src/mobile/bottom-sheet-select-control/style.native.scss +0 -3
- package/src/mobile/bottom-sheet-text-control/README.md +0 -98
- package/src/mobile/bottom-sheet-text-control/index.native.js +0 -104
- package/src/mobile/bottom-sheet-text-control/styles.scss +0 -25
- package/src/mobile/clipboard/index.native.js +0 -18
- package/src/mobile/color-settings/gradient-picker-screen.native.js +0 -37
- package/src/mobile/color-settings/index.native.js +0 -88
- package/src/mobile/color-settings/palette.screen.native.js +0 -232
- package/src/mobile/color-settings/picker-screen.native.js +0 -60
- package/src/mobile/color-settings/style.native.scss +0 -62
- package/src/mobile/color-settings/utils.native.js +0 -36
- package/src/mobile/cycle-select-control/README.md +0 -3
- package/src/mobile/cycle-select-control/index.native.js +0 -39
- package/src/mobile/dashicons/index.native.js +0 -22
- package/src/mobile/focal-point-settings-panel/index.native.js +0 -84
- package/src/mobile/focal-point-settings-panel/styles.native.scss +0 -3
- package/src/mobile/gradient/index.native.js +0 -188
- package/src/mobile/gradient/style.native.scss +0 -8
- package/src/mobile/gradient/test/index.native.js +0 -114
- package/src/mobile/gridicons/index.native.js +0 -39
- package/src/mobile/html-text-input/index.native.js +0 -169
- package/src/mobile/html-text-input/style.android.scss +0 -8
- package/src/mobile/html-text-input/style.ios.scss +0 -10
- package/src/mobile/html-text-input/style.scss +0 -45
- package/src/mobile/html-text-input/test/__snapshots__/index.native.js.snap +0 -48
- package/src/mobile/html-text-input/test/index.native.js +0 -118
- package/src/mobile/image/constants.js +0 -1
- package/src/mobile/image/icon-customize.native.js +0 -10
- package/src/mobile/image/icon-retry.native.js +0 -11
- package/src/mobile/image/image-editing-button.native.js +0 -63
- package/src/mobile/image/index.native.js +0 -401
- package/src/mobile/image/style.native.scss +0 -179
- package/src/mobile/image/utils/index.native.js +0 -58
- package/src/mobile/keyboard-avoiding-view/index.android.js +0 -8
- package/src/mobile/keyboard-avoiding-view/index.ios.js +0 -143
- package/src/mobile/keyboard-avoiding-view/styles.native.scss +0 -9
- package/src/mobile/keyboard-aware-flat-list/index.android.js +0 -81
- package/src/mobile/keyboard-aware-flat-list/index.ios.js +0 -147
- package/src/mobile/keyboard-aware-flat-list/shared.native.js +0 -26
- package/src/mobile/keyboard-aware-flat-list/styles.native.scss +0 -8
- package/src/mobile/keyboard-aware-flat-list/test/use-keyboard-offset.native.js +0 -203
- package/src/mobile/keyboard-aware-flat-list/test/use-scroll-to-section.native.js +0 -142
- package/src/mobile/keyboard-aware-flat-list/test/use-scroll.native.js +0 -71
- package/src/mobile/keyboard-aware-flat-list/test/use-text-input-caret-position.native.js +0 -82
- package/src/mobile/keyboard-aware-flat-list/test/use-text-input-offset.native.js +0 -147
- package/src/mobile/keyboard-aware-flat-list/use-keyboard-offset.native.js +0 -87
- package/src/mobile/keyboard-aware-flat-list/use-scroll-to-element.native.js +0 -41
- package/src/mobile/keyboard-aware-flat-list/use-scroll-to-section.native.js +0 -100
- package/src/mobile/keyboard-aware-flat-list/use-scroll.native.js +0 -100
- package/src/mobile/keyboard-aware-flat-list/use-text-input-caret-position.native.js +0 -36
- package/src/mobile/keyboard-aware-flat-list/use-text-input-offset.native.js +0 -54
- package/src/mobile/layout-animation/index.native.js +0 -16
- package/src/mobile/link-picker/index.native.js +0 -160
- package/src/mobile/link-picker/link-picker-results.native.js +0 -129
- package/src/mobile/link-picker/link-picker-screen.native.js +0 -60
- package/src/mobile/link-picker/styles.native.scss +0 -45
- package/src/mobile/link-picker/test/performance/index.native.js +0 -35
- package/src/mobile/link-settings/index.native.js +0 -332
- package/src/mobile/link-settings/link-rel.native.js +0 -10
- package/src/mobile/link-settings/link-settings-navigation.native.js +0 -50
- package/src/mobile/link-settings/link-settings-screen.native.js +0 -44
- package/src/mobile/link-settings/style.native.scss +0 -4
- package/src/mobile/link-settings/test/edit.native.js +0 -325
- package/src/mobile/link-settings/test/link-settings-navigation.native.js +0 -94
- package/src/mobile/media-edit/index.native.js +0 -125
- package/src/mobile/picker/index.android.js +0 -104
- package/src/mobile/picker/index.ios.js +0 -96
- package/src/mobile/picker/styles.native.scss +0 -29
- package/src/mobile/segmented-control/index.native.js +0 -186
- package/src/mobile/segmented-control/style.native.scss +0 -99
- package/src/mobile/utils/alignments.native.js +0 -78
- package/src/mobile/utils/get-px-from-css-unit.native.js +0 -329
- package/src/mobile/utils/index.native.js +0 -12
- package/src/mobile/utils/test/get-px-from-css-unit.native.js +0 -172
- package/src/mobile/utils/test/index.native.js +0 -134
- package/src/mobile/utils/use-is-floating-keyboard.native.js +0 -31
- package/src/mobile/utils/use-unit-converter-to-mobile.native.js +0 -90
- package/src/notice/index.native.js +0 -123
- package/src/notice/list.native.js +0 -55
- package/src/notice/style.native.scss +0 -60
- package/src/panel/actions.native.js +0 -46
- package/src/panel/actions.native.scss +0 -12
- package/src/panel/body.native.js +0 -29
- package/src/panel/body.native.scss +0 -11
- package/src/panel/bottom-separator-cover.native.js +0 -27
- package/src/panel/bottom-separator-cover.native.scss +0 -9
- package/src/private-apis.native.js +0 -13
- package/src/query-controls/index.native.js +0 -103
- package/src/radio-control/index.native.js +0 -24
- package/src/range-control/index.native.js +0 -73
- package/src/resizable-box/index.native.js +0 -32
- package/src/resizable-box/style.native.scss +0 -14
- package/src/sandbox/index.native.js +0 -392
- package/src/sandbox/style.native.scss +0 -7
- package/src/search-control/index.native.js +0 -274
- package/src/search-control/platform-style.android.scss +0 -57
- package/src/search-control/platform-style.ios.scss +0 -43
- package/src/search-control/style.native.scss +0 -63
- package/src/select-control/index.native.js +0 -41
- package/src/slot-fill/index.native.js +0 -25
- package/src/spinner/index.native.js +0 -22
- package/src/spinner/style.native.scss +0 -4
- package/src/style-provider/index.native.js +0 -3
- package/src/text/index.native.js +0 -13
- package/src/text/styles/emotion-css.native.js +0 -6
- package/src/text/styles/font-family.native.js +0 -1
- package/src/text/styles/text-mixins.native.js +0 -163
- package/src/text-control/index.native.js +0 -41
- package/src/textarea-control/index.native.js +0 -26
- package/src/toggle-control/index.native.js +0 -31
- package/src/toolbar/toolbar/style.native.scss +0 -11
- package/src/toolbar/toolbar/toolbar-container.native.js +0 -8
- package/src/toolbar/toolbar-button/toolbar-button-container.native.js +0 -8
- package/src/toolbar/toolbar-group/style.native.scss +0 -10
- package/src/toolbar/toolbar-group/toolbar-group-collapsed.native.js +0 -36
- package/src/toolbar/toolbar-group/toolbar-group-container.native.js +0 -26
- package/src/toolbar/toolbar-item/index.native.js +0 -17
- package/src/tooltip/index.native.js +0 -292
- package/src/tooltip/style.native.scss +0 -39
- package/src/tooltip/test/index.native.js +0 -98
- package/src/unit-control/index.native.js +0 -202
- package/src/unit-control/style.native.scss +0 -19
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/navigable-container/container.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useRef, useEffect
|
|
5
|
-
"mappings": ";AAOA,SAAS,YAAY,QAAQ,
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useRef, useEffect } from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { focus } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst noop = () => {};\nconst MENU_ITEM_ROLES = ['menuitem', 'menuitemradio', 'menuitemcheckbox'];\nfunction cycleValue(value, total, offset) {\n const nextValue = value + offset;\n if (nextValue < 0) {\n return total + nextValue;\n } else if (nextValue >= total) {\n return nextValue - total;\n }\n return nextValue;\n}\nfunction getFocusableContext(container, target, tabbableOnly) {\n const finder = tabbableOnly ? focus.tabbable : focus.focusable;\n const focusables = finder.find(container);\n const index = focusables.indexOf(target);\n if (index > -1) {\n return {\n index,\n target,\n focusables\n };\n }\n return null;\n}\nfunction UnforwardedNavigableContainer({\n children,\n stopNavigationEvents,\n eventToOffset,\n onNavigate = noop,\n onKeyDown,\n cycle = true,\n onlyBrowserTabstops,\n ...restProps\n}, ref) {\n const containerRef = useRef(null);\n useEffect(() => {\n const container = containerRef.current;\n if (!container) {\n return;\n }\n function handleKeyDown(event) {\n if (onKeyDown) {\n onKeyDown(event);\n }\n const offset = eventToOffset(event);\n\n // eventToOffset returns undefined if the event is not handled by the component.\n if (offset !== undefined && stopNavigationEvents) {\n // Prevents arrow key handlers bound to the document directly interfering.\n event.stopImmediatePropagation();\n\n // When navigating a collection of items, prevent scroll containers\n // from scrolling. The preventDefault also prevents Voiceover from\n // 'handling' the event, as voiceover will try to use arrow keys\n // for highlighting text.\n const targetRole = event.target?.getAttribute('role');\n const targetHasMenuItemRole = !!targetRole && MENU_ITEM_ROLES.includes(targetRole);\n if (targetHasMenuItemRole) {\n event.preventDefault();\n }\n }\n if (!offset) {\n return;\n }\n const activeElement = event.target?.ownerDocument?.activeElement;\n if (!activeElement) {\n return;\n }\n const context = getFocusableContext(container, activeElement, !!onlyBrowserTabstops);\n if (!context) {\n return;\n }\n const {\n index,\n focusables\n } = context;\n const nextIndex = cycle ? cycleValue(index, focusables.length, offset) : index + offset;\n if (nextIndex >= 0 && nextIndex < focusables.length) {\n focusables[nextIndex].focus();\n onNavigate(nextIndex, focusables[nextIndex]);\n\n // `preventDefault()` on tab to avoid having the browser move the focus\n // after this component has already moved it.\n if (event.code === 'Tab') {\n event.preventDefault();\n }\n }\n }\n\n // We use DOM event listeners instead of React event listeners\n // because we want to catch events from the underlying DOM tree.\n // The React Tree can be different from the DOM tree when using\n // portals. Block Toolbars for instance are rendered in a separate\n // React Trees.\n container.addEventListener('keydown', handleKeyDown);\n return () => {\n container.removeEventListener('keydown', handleKeyDown);\n };\n }, [onKeyDown, eventToOffset, stopNavigationEvents, cycle, onNavigate, onlyBrowserTabstops]);\n const mergedRef = useMergeRefs([containerRef, ref]);\n return /*#__PURE__*/_jsx(\"div\", {\n ref: mergedRef,\n ...restProps,\n children: children\n });\n}\nconst NavigableContainer = forwardRef(UnforwardedNavigableContainer);\nNavigableContainer.displayName = 'NavigableContainer';\nexport default NavigableContainer;"],
|
|
5
|
+
"mappings": ";AAOA,SAAS,YAAY,QAAQ,iBAAiB;AAC9C,SAAS,oBAAoB;AAC7B,SAAS,aAAa;AAKtB,SAAS,OAAO,YAAY;AAC5B,IAAM,OAAO,MAAM;AAAC;AACpB,IAAM,kBAAkB,CAAC,YAAY,iBAAiB,kBAAkB;AACxE,SAAS,WAAW,OAAO,OAAO,QAAQ;AACxC,QAAM,YAAY,QAAQ;AAC1B,MAAI,YAAY,GAAG;AACjB,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O,WAAW,QAAQ,MAAM,IAAI,QAAQ;AACjF,UAAI,aAAa,KAAK,YAAY,WAAW,QAAQ;AACnD,mBAAW,SAAS,EAAE,MAAM;AAC5B,mBAAW,WAAW,WAAW,SAAS,CAAC;AAI3C,YAAI,MAAM,SAAS,OAAO;AACxB,gBAAM,eAAe;AAAA,QACvB;AAAA,MACF;AAAA,IACF;AAOA,cAAU,iBAAiB,WAAW,aAAa;AACnD,WAAO,MAAM;AACX,gBAAU,oBAAoB,WAAW,aAAa;AAAA,IACxD;AAAA,EACF,GAAG,CAAC,WAAW,eAAe,sBAAsB,OAAO,YAAY,mBAAmB,CAAC;AAC3F,QAAM,YAAY,aAAa,CAAC,cAAc,GAAG,CAAC;AAClD,SAAoB,qBAAK,OAAO;AAAA,IAC9B,KAAK;AAAA,IACL,GAAG;AAAA,IACH;AAAA,EACF,CAAC;AACH;AACA,IAAM,qBAAqB,WAAW,6BAA6B;AACnE,mBAAmB,cAAc;AACjC,IAAO,oBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -16,14 +16,13 @@ function ResponsiveWrapper({
|
|
|
16
16
|
if (naturalWidth && naturalHeight) {
|
|
17
17
|
aspectRatio = `${naturalWidth} / ${naturalHeight}`;
|
|
18
18
|
}
|
|
19
|
-
const ch = children;
|
|
20
19
|
return /* @__PURE__ */ _jsx(TagName, {
|
|
21
20
|
className: "components-responsive-wrapper",
|
|
22
21
|
children: /* @__PURE__ */ _jsx("div", {
|
|
23
|
-
children: cloneElement(
|
|
24
|
-
className: clsx("components-responsive-wrapper__content",
|
|
22
|
+
children: cloneElement(children, {
|
|
23
|
+
className: clsx("components-responsive-wrapper__content", children.props.className),
|
|
25
24
|
style: {
|
|
26
|
-
...
|
|
25
|
+
...children.props.style,
|
|
27
26
|
aspectRatio
|
|
28
27
|
}
|
|
29
28
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/responsive-wrapper/index.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { cloneElement, Children } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n/**\n * A wrapper component that maintains its aspect ratio when resized.\n *\n * ```jsx\n * import { ResponsiveWrapper } from '@wordpress/components';\n *\n * const MyResponsiveWrapper = () => (\n * \t<ResponsiveWrapper naturalWidth={ 2000 } naturalHeight={ 680 }>\n * \t\t<img\n * \t\t\tsrc=\"https://s.w.org/style/images/about/WordPress-logotype-standard.png\"\n * \t\t\talt=\"WordPress\"\n * \t\t/>\n * \t</ResponsiveWrapper>\n * );\n * ```\n */\nfunction ResponsiveWrapper({\n naturalWidth,\n naturalHeight,\n children,\n isInline = false\n}) {\n if (Children.count(children) !== 1) {\n return null;\n }\n const TagName = isInline ? 'span' : 'div';\n let aspectRatio;\n if (naturalWidth && naturalHeight) {\n aspectRatio = `${naturalWidth} / ${naturalHeight}`;\n }\n
|
|
5
|
-
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,cAAc,gBAAgB;AAKvC,SAAS,OAAO,YAAY;AAiB5B,SAAS,kBAAkB;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AACb,GAAG;AACD,MAAI,SAAS,MAAM,QAAQ,MAAM,GAAG;AAClC,WAAO;AAAA,EACT;AACA,QAAM,UAAU,WAAW,SAAS;AACpC,MAAI;AACJ,MAAI,gBAAgB,eAAe;AACjC,kBAAc,GAAG,YAAY,MAAM,aAAa;AAAA,EAClD;AACA,
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { cloneElement, Children } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n/**\n * A wrapper component that maintains its aspect ratio when resized.\n *\n * ```jsx\n * import { ResponsiveWrapper } from '@wordpress/components';\n *\n * const MyResponsiveWrapper = () => (\n * \t<ResponsiveWrapper naturalWidth={ 2000 } naturalHeight={ 680 }>\n * \t\t<img\n * \t\t\tsrc=\"https://s.w.org/style/images/about/WordPress-logotype-standard.png\"\n * \t\t\talt=\"WordPress\"\n * \t\t/>\n * \t</ResponsiveWrapper>\n * );\n * ```\n */\nfunction ResponsiveWrapper({\n naturalWidth,\n naturalHeight,\n children,\n isInline = false\n}) {\n if (Children.count(children) !== 1) {\n return null;\n }\n const TagName = isInline ? 'span' : 'div';\n let aspectRatio;\n if (naturalWidth && naturalHeight) {\n aspectRatio = `${naturalWidth} / ${naturalHeight}`;\n }\n return /*#__PURE__*/_jsx(TagName, {\n className: \"components-responsive-wrapper\",\n children: /*#__PURE__*/_jsx(\"div\", {\n children: cloneElement(children, {\n className: clsx('components-responsive-wrapper__content', children.props.className),\n style: {\n ...children.props.style,\n aspectRatio\n }\n })\n })\n });\n}\nexport default ResponsiveWrapper;"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,cAAc,gBAAgB;AAKvC,SAAS,OAAO,YAAY;AAiB5B,SAAS,kBAAkB;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AACb,GAAG;AACD,MAAI,SAAS,MAAM,QAAQ,MAAM,GAAG;AAClC,WAAO;AAAA,EACT;AACA,QAAM,UAAU,WAAW,SAAS;AACpC,MAAI;AACJ,MAAI,gBAAgB,eAAe;AACjC,kBAAc,GAAG,YAAY,MAAM,aAAa;AAAA,EAClD;AACA,SAAoB,qBAAK,SAAS;AAAA,IAChC,WAAW;AAAA,IACX,UAAuB,qBAAK,OAAO;AAAA,MACjC,UAAU,aAAa,UAAU;AAAA,QAC/B,WAAW,KAAK,0CAA0C,SAAS,MAAM,SAAS;AAAA,QAClF,OAAO;AAAA,UACL,GAAG,SAAS,MAAM;AAAA,UAClB;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH,CAAC;AAAA,EACH,CAAC;AACH;AACA,IAAO,6BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -57,8 +57,7 @@ function UnforwardedTooltip(props, ref) {
|
|
|
57
57
|
render: children
|
|
58
58
|
}) : children;
|
|
59
59
|
}
|
|
60
|
-
function addDescribedById(
|
|
61
|
-
const element = el;
|
|
60
|
+
function addDescribedById(element) {
|
|
62
61
|
return describedById && mounted && element.props["aria-describedby"] === void 0 && element.props["aria-label"] !== text ? cloneElement(element, {
|
|
63
62
|
"aria-describedby": describedById
|
|
64
63
|
}) : element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/tooltip/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as Ariakit from '@ariakit/react';\nimport clsx from 'clsx';\nimport { useInstanceId } from '@wordpress/compose';\nimport { Children, useContext, forwardRef, cloneElement } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\nimport Shortcut from '../shortcut';\nimport { positionToPlacement } from '../popover/utils';\nimport { TooltipInternalContext } from './context';\n\n/**\n * Time over anchor to wait before showing tooltip\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport const TOOLTIP_DELAY = 700;\nconst CONTEXT_VALUE = {\n isNestedInTooltip: true\n};\nfunction UnforwardedTooltip(props, ref) {\n const {\n children,\n className,\n delay = TOOLTIP_DELAY,\n hideOnClick = true,\n placement,\n position,\n shortcut,\n text,\n ...restProps\n } = props;\n const {\n isNestedInTooltip\n } = useContext(TooltipInternalContext);\n const baseId = useInstanceId(Tooltip, 'tooltip');\n const describedById = text || shortcut ? baseId : undefined;\n const isOnlyChild = Children.count(children) === 1;\n // console error if more than one child element is added\n if (!isOnlyChild) {\n if ('development' === process.env.NODE_ENV) {\n // eslint-disable-next-line no-console\n console.error('wp-components.Tooltip should be called with only a single child element.');\n }\n }\n\n // Compute tooltip's placement:\n // - give priority to `placement` prop, if defined\n // - otherwise, compute it from the legacy `position` prop (if defined)\n // - finally, fallback to the default placement: 'top'\n let computedPlacement;\n if (placement !== undefined) {\n computedPlacement = placement;\n } else if (position !== undefined) {\n computedPlacement = positionToPlacement(position);\n deprecated('`position` prop in wp.components.tooltip', {\n since: '6.4',\n alternative: '`placement` prop'\n });\n }\n computedPlacement = computedPlacement || 'top';\n const tooltipStore = Ariakit.useTooltipStore({\n placement: computedPlacement,\n showTimeout: delay\n });\n const mounted = Ariakit.useStoreState(tooltipStore, 'mounted');\n if (isNestedInTooltip) {\n return isOnlyChild ? /*#__PURE__*/_jsx(Ariakit.Role, {\n ...restProps,\n render: children\n }) : children;\n }\n\n // TODO: this is a temporary workaround to minimize the effects of the\n // Ariakit upgrade. Ariakit doesn't pass the `aria-describedby` prop to\n // the tooltip anchor anymore since 0.4.0, so we need to add it manually.\n // The `aria-describedby` attribute is added only if the anchor doesn't have\n // one already, and if the tooltip text is not the same as the anchor's\n // `aria-label`\n // See: https://github.com/WordPress/gutenberg/pull/64066\n // See: https://github.com/WordPress/gutenberg/pull/65989\n function addDescribedById(
|
|
5
|
-
"mappings": ";AAAA,YAAY,aAAa;AACzB,OAAO,UAAU;AACjB,SAAS,qBAAqB;AAC9B,SAAS,UAAU,YAAY,YAAY,oBAAoB;AAC/D,OAAO,gBAAgB;AACvB,OAAO,cAAc;AACrB,SAAS,2BAA2B;AACpC,SAAS,8BAA8B;AAKvC,SAAS,OAAO,MAAM,QAAQ,aAAa;AACpC,IAAM,gBAAgB;AAC7B,IAAM,gBAAgB;AAAA,EACpB,mBAAmB;AACrB;AACA,SAAS,mBAAmB,OAAO,KAAK;AACtC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AACJ,QAAM;AAAA,IACJ;AAAA,EACF,IAAI,WAAW,sBAAsB;AACrC,QAAM,SAAS,cAAcA,UAAS,SAAS;AAC/C,QAAM,gBAAgB,QAAQ,WAAW,SAAS;AAClD,QAAM,cAAc,SAAS,MAAM,QAAQ,MAAM;AAEjD,MAAI,CAAC,aAAa;AAChB,QAAI,kBAAkB,QAAQ,IAAI,UAAU;AAE1C,cAAQ,MAAM,0EAA0E;AAAA,IAC1F;AAAA,EACF;AAMA,MAAI;AACJ,MAAI,cAAc,QAAW;AAC3B,wBAAoB;AAAA,EACtB,WAAW,aAAa,QAAW;AACjC,wBAAoB,oBAAoB,QAAQ;AAChD,eAAW,4CAA4C;AAAA,MACrD,OAAO;AAAA,MACP,aAAa;AAAA,IACf,CAAC;AAAA,EACH;AACA,sBAAoB,qBAAqB;AACzC,QAAM,eAAuB,wBAAgB;AAAA,IAC3C,WAAW;AAAA,IACX,aAAa;AAAA,EACf,CAAC;AACD,QAAM,UAAkB,sBAAc,cAAc,SAAS;AAC7D,MAAI,mBAAmB;AACrB,WAAO,cAA2B,qBAAa,cAAM;AAAA,MACnD,GAAG;AAAA,MACH,QAAQ;AAAA,IACV,CAAC,IAAI;AAAA,EACP;AAUA,WAAS,iBAAiB,
|
|
4
|
+
"sourcesContent": ["import * as Ariakit from '@ariakit/react';\nimport clsx from 'clsx';\nimport { useInstanceId } from '@wordpress/compose';\nimport { Children, useContext, forwardRef, cloneElement } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\nimport Shortcut from '../shortcut';\nimport { positionToPlacement } from '../popover/utils';\nimport { TooltipInternalContext } from './context';\n\n/**\n * Time over anchor to wait before showing tooltip\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport const TOOLTIP_DELAY = 700;\nconst CONTEXT_VALUE = {\n isNestedInTooltip: true\n};\nfunction UnforwardedTooltip(props, ref) {\n const {\n children,\n className,\n delay = TOOLTIP_DELAY,\n hideOnClick = true,\n placement,\n position,\n shortcut,\n text,\n ...restProps\n } = props;\n const {\n isNestedInTooltip\n } = useContext(TooltipInternalContext);\n const baseId = useInstanceId(Tooltip, 'tooltip');\n const describedById = text || shortcut ? baseId : undefined;\n const isOnlyChild = Children.count(children) === 1;\n // console error if more than one child element is added\n if (!isOnlyChild) {\n if ('development' === process.env.NODE_ENV) {\n // eslint-disable-next-line no-console\n console.error('wp-components.Tooltip should be called with only a single child element.');\n }\n }\n\n // Compute tooltip's placement:\n // - give priority to `placement` prop, if defined\n // - otherwise, compute it from the legacy `position` prop (if defined)\n // - finally, fallback to the default placement: 'top'\n let computedPlacement;\n if (placement !== undefined) {\n computedPlacement = placement;\n } else if (position !== undefined) {\n computedPlacement = positionToPlacement(position);\n deprecated('`position` prop in wp.components.tooltip', {\n since: '6.4',\n alternative: '`placement` prop'\n });\n }\n computedPlacement = computedPlacement || 'top';\n const tooltipStore = Ariakit.useTooltipStore({\n placement: computedPlacement,\n showTimeout: delay\n });\n const mounted = Ariakit.useStoreState(tooltipStore, 'mounted');\n if (isNestedInTooltip) {\n return isOnlyChild ? /*#__PURE__*/_jsx(Ariakit.Role, {\n ...restProps,\n render: children\n }) : children;\n }\n\n // TODO: this is a temporary workaround to minimize the effects of the\n // Ariakit upgrade. Ariakit doesn't pass the `aria-describedby` prop to\n // the tooltip anchor anymore since 0.4.0, so we need to add it manually.\n // The `aria-describedby` attribute is added only if the anchor doesn't have\n // one already, and if the tooltip text is not the same as the anchor's\n // `aria-label`\n // See: https://github.com/WordPress/gutenberg/pull/64066\n // See: https://github.com/WordPress/gutenberg/pull/65989\n function addDescribedById(element) {\n return describedById && mounted && element.props['aria-describedby'] === undefined && element.props['aria-label'] !== text ? cloneElement(element, {\n 'aria-describedby': describedById\n }) : element;\n }\n return /*#__PURE__*/_jsxs(TooltipInternalContext.Provider, {\n value: CONTEXT_VALUE,\n children: [/*#__PURE__*/_jsx(Ariakit.TooltipAnchor, {\n onClick: hideOnClick ? tooltipStore.hide : undefined,\n store: tooltipStore,\n render: isOnlyChild ? addDescribedById(children) : undefined,\n ref: ref,\n children: isOnlyChild ? undefined : children\n }), isOnlyChild && (text || shortcut) && /*#__PURE__*/_jsxs(Ariakit.Tooltip, {\n ...restProps,\n className: clsx('components-tooltip', className),\n unmountOnHide: true,\n gutter: 4,\n id: describedById,\n overflowPadding: 0.5,\n store: tooltipStore,\n children: [text, shortcut && /*#__PURE__*/_jsx(Shortcut, {\n className: text ? 'components-tooltip__shortcut' : '',\n shortcut: shortcut\n })]\n })]\n });\n}\nexport const Tooltip = forwardRef(UnforwardedTooltip);\nexport default Tooltip;"],
|
|
5
|
+
"mappings": ";AAAA,YAAY,aAAa;AACzB,OAAO,UAAU;AACjB,SAAS,qBAAqB;AAC9B,SAAS,UAAU,YAAY,YAAY,oBAAoB;AAC/D,OAAO,gBAAgB;AACvB,OAAO,cAAc;AACrB,SAAS,2BAA2B;AACpC,SAAS,8BAA8B;AAKvC,SAAS,OAAO,MAAM,QAAQ,aAAa;AACpC,IAAM,gBAAgB;AAC7B,IAAM,gBAAgB;AAAA,EACpB,mBAAmB;AACrB;AACA,SAAS,mBAAmB,OAAO,KAAK;AACtC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AACJ,QAAM;AAAA,IACJ;AAAA,EACF,IAAI,WAAW,sBAAsB;AACrC,QAAM,SAAS,cAAcA,UAAS,SAAS;AAC/C,QAAM,gBAAgB,QAAQ,WAAW,SAAS;AAClD,QAAM,cAAc,SAAS,MAAM,QAAQ,MAAM;AAEjD,MAAI,CAAC,aAAa;AAChB,QAAI,kBAAkB,QAAQ,IAAI,UAAU;AAE1C,cAAQ,MAAM,0EAA0E;AAAA,IAC1F;AAAA,EACF;AAMA,MAAI;AACJ,MAAI,cAAc,QAAW;AAC3B,wBAAoB;AAAA,EACtB,WAAW,aAAa,QAAW;AACjC,wBAAoB,oBAAoB,QAAQ;AAChD,eAA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@ -1,203 +1,201 @@
|
|
|
1
1
|
// packages/components/src/unit-control/utils.ts
|
|
2
2
|
import { __, _x } from "@wordpress/i18n";
|
|
3
|
-
import { Platform } from "@wordpress/element";
|
|
4
|
-
var isWeb = Platform.OS === "web";
|
|
5
3
|
var allUnits = {
|
|
6
4
|
px: {
|
|
7
5
|
value: "px",
|
|
8
|
-
label:
|
|
6
|
+
label: "px",
|
|
9
7
|
a11yLabel: __("Pixels (px)"),
|
|
10
8
|
step: 1
|
|
11
9
|
},
|
|
12
10
|
"%": {
|
|
13
11
|
value: "%",
|
|
14
|
-
label:
|
|
12
|
+
label: "%",
|
|
15
13
|
a11yLabel: __("Percent (%)"),
|
|
16
14
|
step: 0.1
|
|
17
15
|
},
|
|
18
16
|
em: {
|
|
19
17
|
value: "em",
|
|
20
|
-
label:
|
|
18
|
+
label: "em",
|
|
21
19
|
a11yLabel: _x("ems", "Relative to parent font size (em)"),
|
|
22
20
|
step: 0.01
|
|
23
21
|
},
|
|
24
22
|
rem: {
|
|
25
23
|
value: "rem",
|
|
26
|
-
label:
|
|
24
|
+
label: "rem",
|
|
27
25
|
a11yLabel: _x("rems", "Relative to root font size (rem)"),
|
|
28
26
|
step: 0.01
|
|
29
27
|
},
|
|
30
28
|
vw: {
|
|
31
29
|
value: "vw",
|
|
32
|
-
label:
|
|
30
|
+
label: "vw",
|
|
33
31
|
a11yLabel: __("Viewport width (vw)"),
|
|
34
32
|
step: 0.1
|
|
35
33
|
},
|
|
36
34
|
vh: {
|
|
37
35
|
value: "vh",
|
|
38
|
-
label:
|
|
36
|
+
label: "vh",
|
|
39
37
|
a11yLabel: __("Viewport height (vh)"),
|
|
40
38
|
step: 0.1
|
|
41
39
|
},
|
|
42
40
|
vmin: {
|
|
43
41
|
value: "vmin",
|
|
44
|
-
label:
|
|
42
|
+
label: "vmin",
|
|
45
43
|
a11yLabel: __("Viewport smallest dimension (vmin)"),
|
|
46
44
|
step: 0.1
|
|
47
45
|
},
|
|
48
46
|
vmax: {
|
|
49
47
|
value: "vmax",
|
|
50
|
-
label:
|
|
48
|
+
label: "vmax",
|
|
51
49
|
a11yLabel: __("Viewport largest dimension (vmax)"),
|
|
52
50
|
step: 0.1
|
|
53
51
|
},
|
|
54
52
|
ch: {
|
|
55
53
|
value: "ch",
|
|
56
|
-
label:
|
|
54
|
+
label: "ch",
|
|
57
55
|
a11yLabel: __("Width of the zero (0) character (ch)"),
|
|
58
56
|
step: 0.01
|
|
59
57
|
},
|
|
60
58
|
ex: {
|
|
61
59
|
value: "ex",
|
|
62
|
-
label:
|
|
60
|
+
label: "ex",
|
|
63
61
|
a11yLabel: __("x-height of the font (ex)"),
|
|
64
62
|
step: 0.01
|
|
65
63
|
},
|
|
66
64
|
cm: {
|
|
67
65
|
value: "cm",
|
|
68
|
-
label:
|
|
66
|
+
label: "cm",
|
|
69
67
|
a11yLabel: __("Centimeters (cm)"),
|
|
70
68
|
step: 1e-3
|
|
71
69
|
},
|
|
72
70
|
mm: {
|
|
73
71
|
value: "mm",
|
|
74
|
-
label:
|
|
72
|
+
label: "mm",
|
|
75
73
|
a11yLabel: __("Millimeters (mm)"),
|
|
76
74
|
step: 0.1
|
|
77
75
|
},
|
|
78
76
|
in: {
|
|
79
77
|
value: "in",
|
|
80
|
-
label:
|
|
78
|
+
label: "in",
|
|
81
79
|
a11yLabel: __("Inches (in)"),
|
|
82
80
|
step: 1e-3
|
|
83
81
|
},
|
|
84
82
|
pc: {
|
|
85
83
|
value: "pc",
|
|
86
|
-
label:
|
|
84
|
+
label: "pc",
|
|
87
85
|
a11yLabel: __("Picas (pc)"),
|
|
88
86
|
step: 1
|
|
89
87
|
},
|
|
90
88
|
pt: {
|
|
91
89
|
value: "pt",
|
|
92
|
-
label:
|
|
90
|
+
label: "pt",
|
|
93
91
|
a11yLabel: __("Points (pt)"),
|
|
94
92
|
step: 1
|
|
95
93
|
},
|
|
96
94
|
svw: {
|
|
97
95
|
value: "svw",
|
|
98
|
-
label:
|
|
96
|
+
label: "svw",
|
|
99
97
|
a11yLabel: __("Small viewport width (svw)"),
|
|
100
98
|
step: 0.1
|
|
101
99
|
},
|
|
102
100
|
svh: {
|
|
103
101
|
value: "svh",
|
|
104
|
-
label:
|
|
102
|
+
label: "svh",
|
|
105
103
|
a11yLabel: __("Small viewport height (svh)"),
|
|
106
104
|
step: 0.1
|
|
107
105
|
},
|
|
108
106
|
svi: {
|
|
109
107
|
value: "svi",
|
|
110
|
-
label:
|
|
108
|
+
label: "svi",
|
|
111
109
|
a11yLabel: __("Small viewport width or height (svi)"),
|
|
112
110
|
step: 0.1
|
|
113
111
|
},
|
|
114
112
|
svb: {
|
|
115
113
|
value: "svb",
|
|
116
|
-
label:
|
|
114
|
+
label: "svb",
|
|
117
115
|
a11yLabel: __("Small viewport width or height (svb)"),
|
|
118
116
|
step: 0.1
|
|
119
117
|
},
|
|
120
118
|
svmin: {
|
|
121
119
|
value: "svmin",
|
|
122
|
-
label:
|
|
120
|
+
label: "svmin",
|
|
123
121
|
a11yLabel: __("Small viewport smallest dimension (svmin)"),
|
|
124
122
|
step: 0.1
|
|
125
123
|
},
|
|
126
124
|
lvw: {
|
|
127
125
|
value: "lvw",
|
|
128
|
-
label:
|
|
126
|
+
label: "lvw",
|
|
129
127
|
a11yLabel: __("Large viewport width (lvw)"),
|
|
130
128
|
step: 0.1
|
|
131
129
|
},
|
|
132
130
|
lvh: {
|
|
133
131
|
value: "lvh",
|
|
134
|
-
label:
|
|
132
|
+
label: "lvh",
|
|
135
133
|
a11yLabel: __("Large viewport height (lvh)"),
|
|
136
134
|
step: 0.1
|
|
137
135
|
},
|
|
138
136
|
lvi: {
|
|
139
137
|
value: "lvi",
|
|
140
|
-
label:
|
|
138
|
+
label: "lvi",
|
|
141
139
|
a11yLabel: __("Large viewport width or height (lvi)"),
|
|
142
140
|
step: 0.1
|
|
143
141
|
},
|
|
144
142
|
lvb: {
|
|
145
143
|
value: "lvb",
|
|
146
|
-
label:
|
|
144
|
+
label: "lvb",
|
|
147
145
|
a11yLabel: __("Large viewport width or height (lvb)"),
|
|
148
146
|
step: 0.1
|
|
149
147
|
},
|
|
150
148
|
lvmin: {
|
|
151
149
|
value: "lvmin",
|
|
152
|
-
label:
|
|
150
|
+
label: "lvmin",
|
|
153
151
|
a11yLabel: __("Large viewport smallest dimension (lvmin)"),
|
|
154
152
|
step: 0.1
|
|
155
153
|
},
|
|
156
154
|
dvw: {
|
|
157
155
|
value: "dvw",
|
|
158
|
-
label:
|
|
156
|
+
label: "dvw",
|
|
159
157
|
a11yLabel: __("Dynamic viewport width (dvw)"),
|
|
160
158
|
step: 0.1
|
|
161
159
|
},
|
|
162
160
|
dvh: {
|
|
163
161
|
value: "dvh",
|
|
164
|
-
label:
|
|
162
|
+
label: "dvh",
|
|
165
163
|
a11yLabel: __("Dynamic viewport height (dvh)"),
|
|
166
164
|
step: 0.1
|
|
167
165
|
},
|
|
168
166
|
dvi: {
|
|
169
167
|
value: "dvi",
|
|
170
|
-
label:
|
|
168
|
+
label: "dvi",
|
|
171
169
|
a11yLabel: __("Dynamic viewport width or height (dvi)"),
|
|
172
170
|
step: 0.1
|
|
173
171
|
},
|
|
174
172
|
dvb: {
|
|
175
173
|
value: "dvb",
|
|
176
|
-
label:
|
|
174
|
+
label: "dvb",
|
|
177
175
|
a11yLabel: __("Dynamic viewport width or height (dvb)"),
|
|
178
176
|
step: 0.1
|
|
179
177
|
},
|
|
180
178
|
dvmin: {
|
|
181
179
|
value: "dvmin",
|
|
182
|
-
label:
|
|
180
|
+
label: "dvmin",
|
|
183
181
|
a11yLabel: __("Dynamic viewport smallest dimension (dvmin)"),
|
|
184
182
|
step: 0.1
|
|
185
183
|
},
|
|
186
184
|
dvmax: {
|
|
187
185
|
value: "dvmax",
|
|
188
|
-
label:
|
|
186
|
+
label: "dvmax",
|
|
189
187
|
a11yLabel: __("Dynamic viewport largest dimension (dvmax)"),
|
|
190
188
|
step: 0.1
|
|
191
189
|
},
|
|
192
190
|
svmax: {
|
|
193
191
|
value: "svmax",
|
|
194
|
-
label:
|
|
192
|
+
label: "svmax",
|
|
195
193
|
a11yLabel: __("Small viewport largest dimension (svmax)"),
|
|
196
194
|
step: 0.1
|
|
197
195
|
},
|
|
198
196
|
lvmax: {
|
|
199
197
|
value: "lvmax",
|
|
200
|
-
label:
|
|
198
|
+
label: "lvmax",
|
|
201
199
|
a11yLabel: __("Large viewport largest dimension (lvmax)"),
|
|
202
200
|
step: 0.1
|
|
203
201
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/unit-control/utils.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\n\nconst isWeb = Platform.OS === 'web';\nconst allUnits = {\n px: {\n value: 'px',\n label: isWeb ? 'px' : __('Pixels (px)'),\n a11yLabel: __('Pixels (px)'),\n step: 1\n },\n '%': {\n value: '%',\n label: isWeb ? '%' : __('Percentage (%)'),\n a11yLabel: __('Percent (%)'),\n step: 0.1\n },\n em: {\n value: 'em',\n label: isWeb ? 'em' : __('Relative to parent font size (em)'),\n a11yLabel: _x('ems', 'Relative to parent font size (em)'),\n step: 0.01\n },\n rem: {\n value: 'rem',\n label: isWeb ? 'rem' : __('Relative to root font size (rem)'),\n a11yLabel: _x('rems', 'Relative to root font size (rem)'),\n step: 0.01\n },\n vw: {\n value: 'vw',\n label: isWeb ? 'vw' : __('Viewport width (vw)'),\n a11yLabel: __('Viewport width (vw)'),\n step: 0.1\n },\n vh: {\n value: 'vh',\n label: isWeb ? 'vh' : __('Viewport height (vh)'),\n a11yLabel: __('Viewport height (vh)'),\n step: 0.1\n },\n vmin: {\n value: 'vmin',\n label: isWeb ? 'vmin' : __('Viewport smallest dimension (vmin)'),\n a11yLabel: __('Viewport smallest dimension (vmin)'),\n step: 0.1\n },\n vmax: {\n value: 'vmax',\n label: isWeb ? 'vmax' : __('Viewport largest dimension (vmax)'),\n a11yLabel: __('Viewport largest dimension (vmax)'),\n step: 0.1\n },\n ch: {\n value: 'ch',\n label: isWeb ? 'ch' : __('Width of the zero (0) character (ch)'),\n a11yLabel: __('Width of the zero (0) character (ch)'),\n step: 0.01\n },\n ex: {\n value: 'ex',\n label: isWeb ? 'ex' : __('x-height of the font (ex)'),\n a11yLabel: __('x-height of the font (ex)'),\n step: 0.01\n },\n cm: {\n value: 'cm',\n label: isWeb ? 'cm' : __('Centimeters (cm)'),\n a11yLabel: __('Centimeters (cm)'),\n step: 0.001\n },\n mm: {\n value: 'mm',\n label: isWeb ? 'mm' : __('Millimeters (mm)'),\n a11yLabel: __('Millimeters (mm)'),\n step: 0.1\n },\n in: {\n value: 'in',\n label: isWeb ? 'in' : __('Inches (in)'),\n a11yLabel: __('Inches (in)'),\n step: 0.001\n },\n pc: {\n value: 'pc',\n label: isWeb ? 'pc' : __('Picas (pc)'),\n a11yLabel: __('Picas (pc)'),\n step: 1\n },\n pt: {\n value: 'pt',\n label: isWeb ? 'pt' : __('Points (pt)'),\n a11yLabel: __('Points (pt)'),\n step: 1\n },\n svw: {\n value: 'svw',\n label: isWeb ? 'svw' : __('Small viewport width (svw)'),\n a11yLabel: __('Small viewport width (svw)'),\n step: 0.1\n },\n svh: {\n value: 'svh',\n label: isWeb ? 'svh' : __('Small viewport height (svh)'),\n a11yLabel: __('Small viewport height (svh)'),\n step: 0.1\n },\n svi: {\n value: 'svi',\n label: isWeb ? 'svi' : __('Viewport smallest size in the inline direction (svi)'),\n a11yLabel: __('Small viewport width or height (svi)'),\n step: 0.1\n },\n svb: {\n value: 'svb',\n label: isWeb ? 'svb' : __('Viewport smallest size in the block direction (svb)'),\n a11yLabel: __('Small viewport width or height (svb)'),\n step: 0.1\n },\n svmin: {\n value: 'svmin',\n label: isWeb ? 'svmin' : __('Small viewport smallest dimension (svmin)'),\n a11yLabel: __('Small viewport smallest dimension (svmin)'),\n step: 0.1\n },\n lvw: {\n value: 'lvw',\n label: isWeb ? 'lvw' : __('Large viewport width (lvw)'),\n a11yLabel: __('Large viewport width (lvw)'),\n step: 0.1\n },\n lvh: {\n value: 'lvh',\n label: isWeb ? 'lvh' : __('Large viewport height (lvh)'),\n a11yLabel: __('Large viewport height (lvh)'),\n step: 0.1\n },\n lvi: {\n value: 'lvi',\n label: isWeb ? 'lvi' : __('Large viewport width or height (lvi)'),\n a11yLabel: __('Large viewport width or height (lvi)'),\n step: 0.1\n },\n lvb: {\n value: 'lvb',\n label: isWeb ? 'lvb' : __('Large viewport width or height (lvb)'),\n a11yLabel: __('Large viewport width or height (lvb)'),\n step: 0.1\n },\n lvmin: {\n value: 'lvmin',\n label: isWeb ? 'lvmin' : __('Large viewport smallest dimension (lvmin)'),\n a11yLabel: __('Large viewport smallest dimension (lvmin)'),\n step: 0.1\n },\n dvw: {\n value: 'dvw',\n label: isWeb ? 'dvw' : __('Dynamic viewport width (dvw)'),\n a11yLabel: __('Dynamic viewport width (dvw)'),\n step: 0.1\n },\n dvh: {\n value: 'dvh',\n label: isWeb ? 'dvh' : __('Dynamic viewport height (dvh)'),\n a11yLabel: __('Dynamic viewport height (dvh)'),\n step: 0.1\n },\n dvi: {\n value: 'dvi',\n label: isWeb ? 'dvi' : __('Dynamic viewport width or height (dvi)'),\n a11yLabel: __('Dynamic viewport width or height (dvi)'),\n step: 0.1\n },\n dvb: {\n value: 'dvb',\n label: isWeb ? 'dvb' : __('Dynamic viewport width or height (dvb)'),\n a11yLabel: __('Dynamic viewport width or height (dvb)'),\n step: 0.1\n },\n dvmin: {\n value: 'dvmin',\n label: isWeb ? 'dvmin' : __('Dynamic viewport smallest dimension (dvmin)'),\n a11yLabel: __('Dynamic viewport smallest dimension (dvmin)'),\n step: 0.1\n },\n dvmax: {\n value: 'dvmax',\n label: isWeb ? 'dvmax' : __('Dynamic viewport largest dimension (dvmax)'),\n a11yLabel: __('Dynamic viewport largest dimension (dvmax)'),\n step: 0.1\n },\n svmax: {\n value: 'svmax',\n label: isWeb ? 'svmax' : __('Small viewport largest dimension (svmax)'),\n a11yLabel: __('Small viewport largest dimension (svmax)'),\n step: 0.1\n },\n lvmax: {\n value: 'lvmax',\n label: isWeb ? 'lvmax' : __('Large viewport largest dimension (lvmax)'),\n a11yLabel: __('Large viewport largest dimension (lvmax)'),\n step: 0.1\n }\n};\n\n/**\n * An array of all available CSS length units.\n */\nexport const ALL_CSS_UNITS = Object.values(allUnits);\n\n/**\n * Units of measurements. `a11yLabel` is used by screenreaders.\n */\nexport const CSS_UNITS = [allUnits.px, allUnits['%'], allUnits.em, allUnits.rem, allUnits.vw, allUnits.vh];\nexport const DEFAULT_UNIT = allUnits.px;\n\n/**\n * Handles legacy value + unit handling.\n * This component use to manage both incoming value and units separately.\n *\n * Moving forward, ideally the value should be a string that contains both\n * the value and unit, example: '10px'\n *\n * @param rawValue The raw value as a string (may or may not contain the unit)\n * @param fallbackUnit The unit used as a fallback, if not unit is detected in the `value`\n * @param allowedUnits Units to derive from.\n * @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value\n * could not be parsed to a number correctly. The unit can be `undefined` in case the unit parse\n * from the raw value could not be matched against the list of allowed units.\n */\nexport function getParsedQuantityAndUnit(rawValue, fallbackUnit, allowedUnits) {\n const initialValue = fallbackUnit ? `${rawValue ?? ''}${fallbackUnit}` : rawValue;\n return parseQuantityAndUnitFromRawValue(initialValue, allowedUnits);\n}\n\n/**\n * Checks if units are defined.\n *\n * @param units List of units.\n * @return Whether the list actually contains any units.\n */\nexport function hasUnits(units) {\n // Although the `isArray` check shouldn't be necessary (given the signature of\n // this typed function), it's better to stay on the side of caution, since\n // this function may be called from un-typed environments.\n return Array.isArray(units) && !!units.length;\n}\n\n/**\n * Parses a quantity and unit from a raw string value, given a list of allowed\n * units and otherwise falling back to the default unit.\n *\n * @param rawValue The raw value as a string (may or may not contain the unit)\n * @param allowedUnits Units to derive from.\n * @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value\n * could not be parsed to a number correctly. The unit can be `undefined` in case the unit parsed\n * from the raw value could not be matched against the list of allowed units.\n */\nexport function parseQuantityAndUnitFromRawValue(rawValue, allowedUnits = ALL_CSS_UNITS) {\n let trimmedValue;\n let quantityToReturn;\n if (typeof rawValue !== 'undefined' || rawValue === null) {\n trimmedValue = `${rawValue}`.trim();\n const parsedQuantity = parseFloat(trimmedValue);\n quantityToReturn = !isFinite(parsedQuantity) ? undefined : parsedQuantity;\n }\n const unitMatch = trimmedValue?.match(/[\\d.\\-\\+]*\\s*(.*)/);\n const matchedUnit = unitMatch?.[1]?.toLowerCase();\n let unitToReturn;\n if (hasUnits(allowedUnits)) {\n const match = allowedUnits.find(item => item.value === matchedUnit);\n unitToReturn = match?.value;\n } else {\n unitToReturn = DEFAULT_UNIT.value;\n }\n return [quantityToReturn, unitToReturn];\n}\n\n/**\n * Parses quantity and unit from a raw value. Validates parsed value, using fallback\n * value if invalid.\n *\n * @param rawValue The next value.\n * @param allowedUnits Units to derive from.\n * @param fallbackQuantity The fallback quantity, used in case it's not possible to parse a valid quantity from the raw value.\n * @param fallbackUnit The fallback unit, used in case it's not possible to parse a valid unit from the raw value.\n * @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value\n * could not be parsed to a number correctly, and the `fallbackQuantity` was also `undefined`. The\n * unit can be `undefined` only if the unit parsed from the raw value could not be matched against\n * the list of allowed units, the `fallbackQuantity` is also `undefined` and the list of\n * `allowedUnits` is passed empty.\n */\nexport function getValidParsedQuantityAndUnit(rawValue, allowedUnits, fallbackQuantity, fallbackUnit) {\n const [parsedQuantity, parsedUnit] = parseQuantityAndUnitFromRawValue(rawValue, allowedUnits);\n\n // The parsed value from `parseQuantityAndUnitFromRawValue` should now be\n // either a real number or undefined. If undefined, use the fallback value.\n const quantityToReturn = parsedQuantity ?? fallbackQuantity;\n\n // If no unit is parsed from the raw value, or if the fallback unit is not\n // defined, use the first value from the list of allowed units as fallback.\n let unitToReturn = parsedUnit || fallbackUnit;\n if (!unitToReturn && hasUnits(allowedUnits)) {\n unitToReturn = allowedUnits[0].value;\n }\n return [quantityToReturn, unitToReturn];\n}\n\n/**\n * Takes a unit value and finds the matching accessibility label for the\n * unit abbreviation.\n *\n * @param unit Unit value (example: `px`)\n * @return a11y label for the unit abbreviation\n */\nexport function getAccessibleLabelForUnit(unit) {\n const match = ALL_CSS_UNITS.find(item => item.value === unit);\n return match?.a11yLabel ? match?.a11yLabel : match?.value;\n}\n\n/**\n * Filters available units based on values defined a list of allowed unit values.\n *\n * @param allowedUnitValues Collection of allowed unit value strings.\n * @param availableUnits Collection of available unit objects.\n * @return Filtered units.\n */\nexport function filterUnitsWithSettings(allowedUnitValues = [], availableUnits) {\n // Although the `isArray` check shouldn't be necessary (given the signature of\n // this typed function), it's better to stay on the side of caution, since\n // this function may be called from un-typed environments.\n return Array.isArray(availableUnits) ? availableUnits.filter(unit => allowedUnitValues.includes(unit.value)) : [];\n}\n\n/**\n * Custom hook to retrieve and consolidate units setting from add_theme_support().\n * TODO: ideally this hook shouldn't be needed\n * https://github.com/WordPress/gutenberg/pull/31822#discussion_r633280823\n *\n * @param args An object containing units, settingPath & defaultUnits.\n * @param args.units Collection of all potentially available units.\n * @param args.availableUnits Collection of unit value strings for filtering available units.\n * @param args.defaultValues Collection of default values for defined units. Example: `{ px: 350, em: 15 }`.\n *\n * @return Filtered list of units, with their default values updated following the `defaultValues`\n * argument's property.\n */\nexport const useCustomUnits = ({\n units = ALL_CSS_UNITS,\n availableUnits = [],\n defaultValues\n}) => {\n const customUnitsToReturn = filterUnitsWithSettings(availableUnits, units);\n if (!defaultValues) {\n return customUnitsToReturn;\n }\n return customUnitsToReturn.map(unit => {\n const [defaultValue] = defaultValues[unit.value] ? parseQuantityAndUnitFromRawValue(defaultValues[unit.value]) : [];\n return {\n ...unit,\n default: defaultValue\n };\n });\n};\n\n/**\n * Get available units with the unit for the currently selected value\n * prepended if it is not available in the list of units.\n *\n * This is useful to ensure that the current value's unit is always\n * accurately displayed in the UI, even if the intention is to hide\n * the availability of that unit.\n *\n * @param rawValue Selected value to parse.\n * @param legacyUnit Legacy unit value, if rawValue needs it appended.\n * @param units List of available units.\n *\n * @return A collection of units containing the unit for the current value.\n */\nexport function getUnitsWithCurrentUnit(rawValue, legacyUnit, units = ALL_CSS_UNITS) {\n const unitsToReturn = Array.isArray(units) ? [...units] : [];\n const [, currentUnit] = getParsedQuantityAndUnit(rawValue, legacyUnit, ALL_CSS_UNITS);\n if (currentUnit && !unitsToReturn.some(unit => unit.value === currentUnit)) {\n if (allUnits[currentUnit]) {\n unitsToReturn.unshift(allUnits[currentUnit]);\n }\n }\n return unitsToReturn;\n}"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,IAAI,UAAU;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\n\nconst allUnits = {\n px: {\n value: 'px',\n label: 'px',\n a11yLabel: __('Pixels (px)'),\n step: 1\n },\n '%': {\n value: '%',\n label: '%',\n a11yLabel: __('Percent (%)'),\n step: 0.1\n },\n em: {\n value: 'em',\n label: 'em',\n a11yLabel: _x('ems', 'Relative to parent font size (em)'),\n step: 0.01\n },\n rem: {\n value: 'rem',\n label: 'rem',\n a11yLabel: _x('rems', 'Relative to root font size (rem)'),\n step: 0.01\n },\n vw: {\n value: 'vw',\n label: 'vw',\n a11yLabel: __('Viewport width (vw)'),\n step: 0.1\n },\n vh: {\n value: 'vh',\n label: 'vh',\n a11yLabel: __('Viewport height (vh)'),\n step: 0.1\n },\n vmin: {\n value: 'vmin',\n label: 'vmin',\n a11yLabel: __('Viewport smallest dimension (vmin)'),\n step: 0.1\n },\n vmax: {\n value: 'vmax',\n label: 'vmax',\n a11yLabel: __('Viewport largest dimension (vmax)'),\n step: 0.1\n },\n ch: {\n value: 'ch',\n label: 'ch',\n a11yLabel: __('Width of the zero (0) character (ch)'),\n step: 0.01\n },\n ex: {\n value: 'ex',\n label: 'ex',\n a11yLabel: __('x-height of the font (ex)'),\n step: 0.01\n },\n cm: {\n value: 'cm',\n label: 'cm',\n a11yLabel: __('Centimeters (cm)'),\n step: 0.001\n },\n mm: {\n value: 'mm',\n label: 'mm',\n a11yLabel: __('Millimeters (mm)'),\n step: 0.1\n },\n in: {\n value: 'in',\n label: 'in',\n a11yLabel: __('Inches (in)'),\n step: 0.001\n },\n pc: {\n value: 'pc',\n label: 'pc',\n a11yLabel: __('Picas (pc)'),\n step: 1\n },\n pt: {\n value: 'pt',\n label: 'pt',\n a11yLabel: __('Points (pt)'),\n step: 1\n },\n svw: {\n value: 'svw',\n label: 'svw',\n a11yLabel: __('Small viewport width (svw)'),\n step: 0.1\n },\n svh: {\n value: 'svh',\n label: 'svh',\n a11yLabel: __('Small viewport height (svh)'),\n step: 0.1\n },\n svi: {\n value: 'svi',\n label: 'svi',\n a11yLabel: __('Small viewport width or height (svi)'),\n step: 0.1\n },\n svb: {\n value: 'svb',\n label: 'svb',\n a11yLabel: __('Small viewport width or height (svb)'),\n step: 0.1\n },\n svmin: {\n value: 'svmin',\n label: 'svmin',\n a11yLabel: __('Small viewport smallest dimension (svmin)'),\n step: 0.1\n },\n lvw: {\n value: 'lvw',\n label: 'lvw',\n a11yLabel: __('Large viewport width (lvw)'),\n step: 0.1\n },\n lvh: {\n value: 'lvh',\n label: 'lvh',\n a11yLabel: __('Large viewport height (lvh)'),\n step: 0.1\n },\n lvi: {\n value: 'lvi',\n label: 'lvi',\n a11yLabel: __('Large viewport width or height (lvi)'),\n step: 0.1\n },\n lvb: {\n value: 'lvb',\n label: 'lvb',\n a11yLabel: __('Large viewport width or height (lvb)'),\n step: 0.1\n },\n lvmin: {\n value: 'lvmin',\n label: 'lvmin',\n a11yLabel: __('Large viewport smallest dimension (lvmin)'),\n step: 0.1\n },\n dvw: {\n value: 'dvw',\n label: 'dvw',\n a11yLabel: __('Dynamic viewport width (dvw)'),\n step: 0.1\n },\n dvh: {\n value: 'dvh',\n label: 'dvh',\n a11yLabel: __('Dynamic viewport height (dvh)'),\n step: 0.1\n },\n dvi: {\n value: 'dvi',\n label: 'dvi',\n a11yLabel: __('Dynamic viewport width or height (dvi)'),\n step: 0.1\n },\n dvb: {\n value: 'dvb',\n label: 'dvb',\n a11yLabel: __('Dynamic viewport width or height (dvb)'),\n step: 0.1\n },\n dvmin: {\n value: 'dvmin',\n label: 'dvmin',\n a11yLabel: __('Dynamic viewport smallest dimension (dvmin)'),\n step: 0.1\n },\n dvmax: {\n value: 'dvmax',\n label: 'dvmax',\n a11yLabel: __('Dynamic viewport largest dimension (dvmax)'),\n step: 0.1\n },\n svmax: {\n value: 'svmax',\n label: 'svmax',\n a11yLabel: __('Small viewport largest dimension (svmax)'),\n step: 0.1\n },\n lvmax: {\n value: 'lvmax',\n label: 'lvmax',\n a11yLabel: __('Large viewport largest dimension (lvmax)'),\n step: 0.1\n }\n};\n\n/**\n * An array of all available CSS length units.\n */\nexport const ALL_CSS_UNITS = Object.values(allUnits);\n\n/**\n * Units of measurements. `a11yLabel` is used by screenreaders.\n */\nexport const CSS_UNITS = [allUnits.px, allUnits['%'], allUnits.em, allUnits.rem, allUnits.vw, allUnits.vh];\nexport const DEFAULT_UNIT = allUnits.px;\n\n/**\n * Handles legacy value + unit handling.\n * This component use to manage both incoming value and units separately.\n *\n * Moving forward, ideally the value should be a string that contains both\n * the value and unit, example: '10px'\n *\n * @param rawValue The raw value as a string (may or may not contain the unit)\n * @param fallbackUnit The unit used as a fallback, if not unit is detected in the `value`\n * @param allowedUnits Units to derive from.\n * @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value\n * could not be parsed to a number correctly. The unit can be `undefined` in case the unit parse\n * from the raw value could not be matched against the list of allowed units.\n */\nexport function getParsedQuantityAndUnit(rawValue, fallbackUnit, allowedUnits) {\n const initialValue = fallbackUnit ? `${rawValue ?? ''}${fallbackUnit}` : rawValue;\n return parseQuantityAndUnitFromRawValue(initialValue, allowedUnits);\n}\n\n/**\n * Checks if units are defined.\n *\n * @param units List of units.\n * @return Whether the list actually contains any units.\n */\nexport function hasUnits(units) {\n // Although the `isArray` check shouldn't be necessary (given the signature of\n // this typed function), it's better to stay on the side of caution, since\n // this function may be called from un-typed environments.\n return Array.isArray(units) && !!units.length;\n}\n\n/**\n * Parses a quantity and unit from a raw string value, given a list of allowed\n * units and otherwise falling back to the default unit.\n *\n * @param rawValue The raw value as a string (may or may not contain the unit)\n * @param allowedUnits Units to derive from.\n * @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value\n * could not be parsed to a number correctly. The unit can be `undefined` in case the unit parsed\n * from the raw value could not be matched against the list of allowed units.\n */\nexport function parseQuantityAndUnitFromRawValue(rawValue, allowedUnits = ALL_CSS_UNITS) {\n let trimmedValue;\n let quantityToReturn;\n if (typeof rawValue !== 'undefined' || rawValue === null) {\n trimmedValue = `${rawValue}`.trim();\n const parsedQuantity = parseFloat(trimmedValue);\n quantityToReturn = !isFinite(parsedQuantity) ? undefined : parsedQuantity;\n }\n const unitMatch = trimmedValue?.match(/[\\d.\\-\\+]*\\s*(.*)/);\n const matchedUnit = unitMatch?.[1]?.toLowerCase();\n let unitToReturn;\n if (hasUnits(allowedUnits)) {\n const match = allowedUnits.find(item => item.value === matchedUnit);\n unitToReturn = match?.value;\n } else {\n unitToReturn = DEFAULT_UNIT.value;\n }\n return [quantityToReturn, unitToReturn];\n}\n\n/**\n * Parses quantity and unit from a raw value. Validates parsed value, using fallback\n * value if invalid.\n *\n * @param rawValue The next value.\n * @param allowedUnits Units to derive from.\n * @param fallbackQuantity The fallback quantity, used in case it's not possible to parse a valid quantity from the raw value.\n * @param fallbackUnit The fallback unit, used in case it's not possible to parse a valid unit from the raw value.\n * @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value\n * could not be parsed to a number correctly, and the `fallbackQuantity` was also `undefined`. The\n * unit can be `undefined` only if the unit parsed from the raw value could not be matched against\n * the list of allowed units, the `fallbackQuantity` is also `undefined` and the list of\n * `allowedUnits` is passed empty.\n */\nexport function getValidParsedQuantityAndUnit(rawValue, allowedUnits, fallbackQuantity, fallbackUnit) {\n const [parsedQuantity, parsedUnit] = parseQuantityAndUnitFromRawValue(rawValue, allowedUnits);\n\n // The parsed value from `parseQuantityAndUnitFromRawValue` should now be\n // either a real number or undefined. If undefined, use the fallback value.\n const quantityToReturn = parsedQuantity ?? fallbackQuantity;\n\n // If no unit is parsed from the raw value, or if the fallback unit is not\n // defined, use the first value from the list of allowed units as fallback.\n let unitToReturn = parsedUnit || fallbackUnit;\n if (!unitToReturn && hasUnits(allowedUnits)) {\n unitToReturn = allowedUnits[0].value;\n }\n return [quantityToReturn, unitToReturn];\n}\n\n/**\n * Takes a unit value and finds the matching accessibility label for the\n * unit abbreviation.\n *\n * @param unit Unit value (example: `px`)\n * @return a11y label for the unit abbreviation\n */\nexport function getAccessibleLabelForUnit(unit) {\n const match = ALL_CSS_UNITS.find(item => item.value === unit);\n return match?.a11yLabel ? match?.a11yLabel : match?.value;\n}\n\n/**\n * Filters available units based on values defined a list of allowed unit values.\n *\n * @param allowedUnitValues Collection of allowed unit value strings.\n * @param availableUnits Collection of available unit objects.\n * @return Filtered units.\n */\nexport function filterUnitsWithSettings(allowedUnitValues = [], availableUnits) {\n // Although the `isArray` check shouldn't be necessary (given the signature of\n // this typed function), it's better to stay on the side of caution, since\n // this function may be called from un-typed environments.\n return Array.isArray(availableUnits) ? availableUnits.filter(unit => allowedUnitValues.includes(unit.value)) : [];\n}\n\n/**\n * Custom hook to retrieve and consolidate units setting from add_theme_support().\n * TODO: ideally this hook shouldn't be needed\n * https://github.com/WordPress/gutenberg/pull/31822#discussion_r633280823\n *\n * @param args An object containing units, settingPath & defaultUnits.\n * @param args.units Collection of all potentially available units.\n * @param args.availableUnits Collection of unit value strings for filtering available units.\n * @param args.defaultValues Collection of default values for defined units. Example: `{ px: 350, em: 15 }`.\n *\n * @return Filtered list of units, with their default values updated following the `defaultValues`\n * argument's property.\n */\nexport const useCustomUnits = ({\n units = ALL_CSS_UNITS,\n availableUnits = [],\n defaultValues\n}) => {\n const customUnitsToReturn = filterUnitsWithSettings(availableUnits, units);\n if (!defaultValues) {\n return customUnitsToReturn;\n }\n return customUnitsToReturn.map(unit => {\n const [defaultValue] = defaultValues[unit.value] ? parseQuantityAndUnitFromRawValue(defaultValues[unit.value]) : [];\n return {\n ...unit,\n default: defaultValue\n };\n });\n};\n\n/**\n * Get available units with the unit for the currently selected value\n * prepended if it is not available in the list of units.\n *\n * This is useful to ensure that the current value's unit is always\n * accurately displayed in the UI, even if the intention is to hide\n * the availability of that unit.\n *\n * @param rawValue Selected value to parse.\n * @param legacyUnit Legacy unit value, if rawValue needs it appended.\n * @param units List of available units.\n *\n * @return A collection of units containing the unit for the current value.\n */\nexport function getUnitsWithCurrentUnit(rawValue, legacyUnit, units = ALL_CSS_UNITS) {\n const unitsToReturn = Array.isArray(units) ? [...units] : [];\n const [, currentUnit] = getParsedQuantityAndUnit(rawValue, legacyUnit, ALL_CSS_UNITS);\n if (currentUnit && !unitsToReturn.some(unit => unit.value === currentUnit)) {\n if (allUnits[currentUnit]) {\n unitsToReturn.unshift(allUnits[currentUnit]);\n }\n }\n return unitsToReturn;\n}"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,IAAI,UAAU;AAMvB,IAAM,WAAW;AAAA,EACf,IAAI;AAAA,IACF,OAAO;AAAA,IACP,OAAO;AAAA,IACP,WAAW,GAAG,aAAa;AAAA,IAC3B,MAAM;AAAA,EACR;AAAA,EACA,KAAK;AAAA,IACH,OAAO;AAAA,IACP,OAAO;AAAA,IACP,WAAW,GAAG,aAAa;AAAA,IAC3B,MAAM;AAAA,EACR;AAAA,EACA,IAAI;AAAA,IACF,OAAO;AAAA,IACP,OAAO;AAAA,IACP,WAAW,GAAG,OAAO,mCAAmC;AAAA,IACxD,MAAM;AAAA,EACR;AAAA,EACA,KAAK;AAAA,IACH,OAAO;AAAA,IACP,OAAO;AAAA,IACP,WAAW,GAAG,QAAQ,kCAAkC;AAAA,IACxD,MAAM;AAA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