@wordpress/components 19.13.0 → 19.14.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 +38 -1
- package/build/alignment-matrix-control/utils.js +1 -7
- package/build/alignment-matrix-control/utils.js.map +1 -1
- package/build/autocomplete/autocompleter-ui.js +4 -2
- package/build/autocomplete/autocompleter-ui.js.map +1 -1
- package/build/autocomplete/autocompleter-ui.native.js +9 -3
- package/build/autocomplete/autocompleter-ui.native.js.map +1 -1
- package/build/autocomplete/index.js +4 -2
- package/build/autocomplete/index.js.map +1 -1
- package/build/border-box-control/border-box-control/component.js +2 -1
- package/build/border-box-control/border-box-control/component.js.map +1 -1
- package/build/border-box-control/border-box-control-split-controls/component.js +2 -1
- package/build/border-box-control/border-box-control-split-controls/component.js.map +1 -1
- package/build/border-control/border-control/component.js +40 -4
- package/build/border-control/border-control/component.js.map +1 -1
- package/build/box-control/utils.js +3 -3
- package/build/box-control/utils.js.map +1 -1
- package/build/color-indicator/index.js +27 -10
- package/build/color-indicator/index.js.map +1 -1
- package/build/color-indicator/types.js +6 -0
- package/build/color-indicator/types.js.map +1 -0
- package/build/color-palette/index.js +2 -1
- package/build/color-palette/index.js.map +1 -1
- package/build/color-picker/component.js +6 -9
- package/build/color-picker/component.js.map +1 -1
- package/build/color-picker/input-with-slider.js +1 -2
- package/build/color-picker/input-with-slider.js.map +1 -1
- package/build/color-picker/styles.js +34 -16
- package/build/color-picker/styles.js.map +1 -1
- package/build/custom-gradient-picker/index.js +8 -8
- package/build/custom-gradient-picker/index.js.map +1 -1
- package/build/custom-gradient-picker/index.native.js +8 -9
- package/build/custom-gradient-picker/index.native.js.map +1 -1
- package/build/custom-gradient-picker/serializer.js +4 -7
- package/build/custom-gradient-picker/serializer.js.map +1 -1
- package/build/date-time/date/index.js +3 -1
- package/build/date-time/date/index.js.map +1 -1
- package/build/date-time/date-time/index.js +3 -1
- package/build/date-time/date-time/index.js.map +1 -1
- package/build/duotone-picker/duotone-picker.js +42 -29
- package/build/duotone-picker/duotone-picker.js.map +1 -1
- package/build/elevation/hook.js +13 -13
- package/build/elevation/hook.js.map +1 -1
- package/build/focal-point-picker/index.native.js +4 -4
- package/build/focal-point-picker/index.native.js.map +1 -1
- package/build/form-toggle/index.js +28 -5
- package/build/form-toggle/index.js.map +1 -1
- package/build/form-toggle/types.js +6 -0
- package/build/form-toggle/types.js.map +1 -0
- package/build/h-stack/utils.js +3 -3
- package/build/h-stack/utils.js.map +1 -1
- package/build/heading/component.js +0 -1
- package/build/heading/component.js.map +1 -1
- package/build/heading/hook.js.map +1 -1
- package/build/heading/types.js +6 -0
- package/build/heading/types.js.map +1 -0
- package/build/mobile/bottom-sheet/keyboard-avoiding-view.native.js +0 -1
- package/build/mobile/bottom-sheet/keyboard-avoiding-view.native.js.map +1 -1
- package/build/mobile/link-picker/index.native.js +4 -4
- package/build/mobile/link-picker/index.native.js.map +1 -1
- package/build/mobile/segmented-control/index.native.js +2 -4
- package/build/mobile/segmented-control/index.native.js.map +1 -1
- package/build/navigation/group/index.js +4 -7
- package/build/navigation/group/index.js.map +1 -1
- package/build/navigation/item/base.js +3 -3
- package/build/navigation/item/base.js.map +1 -1
- package/build/navigation/item/use-navigation-tree-item.js +2 -1
- package/build/navigation/item/use-navigation-tree-item.js.map +1 -1
- package/build/navigation/menu/menu-title-search.js +1 -7
- package/build/navigation/menu/menu-title-search.js.map +1 -1
- package/build/navigation/menu/search-no-results-found.js +1 -7
- package/build/navigation/menu/search-no-results-found.js.map +1 -1
- package/build/navigation/use-navigation-tree-nodes.js +18 -10
- package/build/navigation/use-navigation-tree-nodes.js.map +1 -1
- package/build/navigation/utils.js +4 -2
- package/build/navigation/utils.js.map +1 -1
- package/build/range-control/index.js +3 -3
- package/build/range-control/index.js.map +1 -1
- package/build/range-control/utils.js +3 -7
- package/build/range-control/utils.js.map +1 -1
- package/build/spacer/component.js +5 -5
- package/build/spacer/component.js.map +1 -1
- package/build/spinner/index.js +26 -13
- package/build/spinner/index.js.map +1 -1
- package/build/spinner/styles.js +10 -10
- package/build/spinner/styles.js.map +1 -1
- package/build/truncate/component.js +7 -8
- package/build/truncate/component.js.map +1 -1
- package/build/truncate/hook.js +3 -10
- package/build/truncate/hook.js.map +1 -1
- package/build/truncate/index.js.map +1 -1
- package/build/truncate/styles.js +1 -1
- package/build/truncate/styles.js.map +1 -1
- package/build/truncate/utils.js +3 -16
- package/build/truncate/utils.js.map +1 -1
- package/build/utils/math.js +17 -7
- package/build/utils/math.js.map +1 -1
- package/build/v-stack/component.js +9 -9
- package/build/v-stack/component.js.map +1 -1
- package/build/v-stack/hook.js +0 -5
- package/build/v-stack/hook.js.map +1 -1
- package/build/v-stack/index.js.map +1 -1
- package/build-module/alignment-matrix-control/utils.js +1 -6
- package/build-module/alignment-matrix-control/utils.js.map +1 -1
- package/build-module/autocomplete/autocompleter-ui.js +4 -2
- package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
- package/build-module/autocomplete/autocompleter-ui.native.js +9 -3
- package/build-module/autocomplete/autocompleter-ui.native.js.map +1 -1
- package/build-module/autocomplete/index.js +4 -2
- package/build-module/autocomplete/index.js.map +1 -1
- package/build-module/border-box-control/border-box-control/component.js +2 -1
- package/build-module/border-box-control/border-box-control/component.js.map +1 -1
- package/build-module/border-box-control/border-box-control-split-controls/component.js +2 -1
- package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
- package/build-module/border-control/border-control/component.js +38 -3
- package/build-module/border-control/border-control/component.js.map +1 -1
- package/build-module/box-control/utils.js +4 -4
- package/build-module/box-control/utils.js.map +1 -1
- package/build-module/color-indicator/index.js +29 -8
- package/build-module/color-indicator/index.js.map +1 -1
- package/build-module/color-indicator/types.js +2 -0
- package/build-module/color-indicator/types.js.map +1 -0
- package/build-module/color-palette/index.js +2 -1
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/color-picker/component.js +7 -8
- package/build-module/color-picker/component.js.map +1 -1
- package/build-module/color-picker/input-with-slider.js +1 -2
- package/build-module/color-picker/input-with-slider.js.map +1 -1
- package/build-module/color-picker/styles.js +28 -14
- package/build-module/color-picker/styles.js.map +1 -1
- package/build-module/custom-gradient-picker/index.js +8 -7
- package/build-module/custom-gradient-picker/index.js.map +1 -1
- package/build-module/custom-gradient-picker/index.native.js +8 -8
- package/build-module/custom-gradient-picker/index.native.js.map +1 -1
- package/build-module/custom-gradient-picker/serializer.js +4 -6
- package/build-module/custom-gradient-picker/serializer.js.map +1 -1
- package/build-module/date-time/date/index.js +3 -1
- package/build-module/date-time/date/index.js.map +1 -1
- package/build-module/date-time/date-time/index.js +3 -1
- package/build-module/date-time/date-time/index.js.map +1 -1
- package/build-module/duotone-picker/duotone-picker.js +42 -29
- package/build-module/duotone-picker/duotone-picker.js.map +1 -1
- package/build-module/elevation/hook.js +12 -12
- package/build-module/elevation/hook.js.map +1 -1
- package/build-module/focal-point-picker/index.native.js +1 -1
- package/build-module/focal-point-picker/index.native.js.map +1 -1
- package/build-module/form-toggle/index.js +30 -6
- package/build-module/form-toggle/index.js.map +1 -1
- package/build-module/form-toggle/types.js +2 -0
- package/build-module/form-toggle/types.js.map +1 -0
- package/build-module/h-stack/utils.js +3 -3
- package/build-module/h-stack/utils.js.map +1 -1
- package/build-module/heading/component.js +0 -1
- package/build-module/heading/component.js.map +1 -1
- package/build-module/heading/hook.js.map +1 -1
- package/build-module/heading/types.js +2 -0
- package/build-module/heading/types.js.map +1 -0
- package/build-module/mobile/bottom-sheet/keyboard-avoiding-view.native.js +0 -1
- package/build-module/mobile/bottom-sheet/keyboard-avoiding-view.native.js.map +1 -1
- package/build-module/mobile/link-picker/index.native.js +4 -3
- package/build-module/mobile/link-picker/index.native.js.map +1 -1
- package/build-module/mobile/segmented-control/index.native.js +2 -3
- package/build-module/mobile/segmented-control/index.native.js.map +1 -1
- package/build-module/navigation/group/index.js +3 -6
- package/build-module/navigation/group/index.js.map +1 -1
- package/build-module/navigation/item/base.js +2 -2
- package/build-module/navigation/item/base.js.map +1 -1
- package/build-module/navigation/item/use-navigation-tree-item.js +2 -1
- package/build-module/navigation/item/use-navigation-tree-item.js.map +1 -1
- package/build-module/navigation/menu/menu-title-search.js +1 -6
- package/build-module/navigation/menu/menu-title-search.js.map +1 -1
- package/build-module/navigation/menu/search-no-results-found.js +1 -6
- package/build-module/navigation/menu/search-no-results-found.js.map +1 -1
- package/build-module/navigation/use-navigation-tree-nodes.js +18 -9
- package/build-module/navigation/use-navigation-tree-nodes.js.map +1 -1
- package/build-module/navigation/utils.js +2 -2
- package/build-module/navigation/utils.js.map +1 -1
- package/build-module/range-control/index.js +1 -1
- package/build-module/range-control/index.js.map +1 -1
- package/build-module/range-control/utils.js +1 -5
- package/build-module/range-control/utils.js.map +1 -1
- package/build-module/spacer/component.js +3 -4
- package/build-module/spacer/component.js.map +1 -1
- package/build-module/spinner/index.js +22 -13
- package/build-module/spinner/index.js.map +1 -1
- package/build-module/spinner/styles.js +10 -10
- package/build-module/spinner/styles.js.map +1 -1
- package/build-module/truncate/component.js +7 -8
- package/build-module/truncate/component.js.map +1 -1
- package/build-module/truncate/hook.js +3 -10
- package/build-module/truncate/hook.js.map +1 -1
- package/build-module/truncate/index.js.map +1 -1
- package/build-module/truncate/styles.js +1 -1
- package/build-module/truncate/styles.js.map +1 -1
- package/build-module/truncate/utils.js +3 -16
- package/build-module/truncate/utils.js.map +1 -1
- package/build-module/utils/math.js +15 -6
- package/build-module/utils/math.js.map +1 -1
- package/build-module/v-stack/component.js +9 -9
- package/build-module/v-stack/component.js.map +1 -1
- package/build-module/v-stack/hook.js +0 -5
- package/build-module/v-stack/hook.js.map +1 -1
- package/build-module/v-stack/index.js.map +1 -1
- package/build-style/style-rtl.css +16 -0
- package/build-style/style.css +16 -0
- package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-split-controls/component.d.ts.map +1 -1
- package/build-types/border-control/border-control/component.d.ts +36 -2
- package/build-types/border-control/border-control/component.d.ts.map +1 -1
- package/build-types/border-control/stories/index.d.ts +33 -0
- package/build-types/border-control/stories/index.d.ts.map +1 -0
- package/build-types/color-indicator/index.d.ts +16 -5
- package/build-types/color-indicator/index.d.ts.map +1 -1
- package/build-types/color-indicator/stories/index.d.ts +12 -0
- package/build-types/color-indicator/stories/index.d.ts.map +1 -0
- package/build-types/color-indicator/test/index.d.ts +2 -0
- package/build-types/color-indicator/test/index.d.ts.map +1 -0
- package/build-types/color-indicator/types.d.ts +12 -0
- package/build-types/color-indicator/types.d.ts.map +1 -0
- package/build-types/color-palette/index.d.ts.map +1 -1
- package/build-types/color-palette/styles.d.ts +4 -2
- package/build-types/color-palette/styles.d.ts.map +1 -1
- package/build-types/color-picker/component.d.ts.map +1 -1
- package/build-types/color-picker/styles.d.ts +17 -0
- package/build-types/color-picker/styles.d.ts.map +1 -1
- package/build-types/date-time/date/index.d.ts +1 -1
- package/build-types/date-time/date/index.d.ts.map +1 -1
- package/build-types/date-time/date-time/index.d.ts.map +1 -1
- package/build-types/date-time/types.d.ts +6 -0
- package/build-types/date-time/types.d.ts.map +1 -1
- package/build-types/form-toggle/index.d.ts +29 -0
- package/build-types/form-toggle/index.d.ts.map +1 -0
- package/build-types/form-toggle/stories/index.d.ts +12 -0
- package/build-types/form-toggle/stories/index.d.ts.map +1 -0
- package/build-types/form-toggle/test/index.d.ts +2 -0
- package/build-types/form-toggle/test/index.d.ts.map +1 -0
- package/build-types/form-toggle/types.d.ts +22 -0
- package/build-types/form-toggle/types.d.ts.map +1 -0
- package/build-types/form-token-field/test/lib/token-field-wrapper.d.ts +3 -0
- package/build-types/form-token-field/test/lib/token-field-wrapper.d.ts.map +1 -1
- package/build-types/heading/component.d.ts +1 -2
- package/build-types/heading/component.d.ts.map +1 -1
- package/build-types/heading/hook.d.ts +1 -28
- package/build-types/heading/hook.d.ts.map +1 -1
- package/build-types/heading/stories/index.d.ts.map +1 -1
- package/build-types/heading/test/index.d.ts +2 -0
- package/build-types/heading/test/index.d.ts.map +1 -0
- package/build-types/heading/types.d.ts +16 -0
- package/build-types/heading/types.d.ts.map +1 -0
- package/build-types/range-control/utils.d.ts.map +1 -1
- package/build-types/spacer/component.d.ts +2 -3
- package/build-types/spacer/component.d.ts.map +1 -1
- package/build-types/spacer/stories/index.d.ts +12 -0
- package/build-types/spacer/stories/index.d.ts.map +1 -0
- package/build-types/spinner/index.d.ts +16 -15
- package/build-types/spinner/index.d.ts.map +1 -1
- package/build-types/spinner/stories/index.d.ts +13 -0
- package/build-types/spinner/stories/index.d.ts.map +1 -0
- package/build-types/spinner/styles.d.ts +4 -3
- package/build-types/spinner/styles.d.ts.map +1 -1
- package/build-types/text/types.d.ts +1 -1
- package/build-types/text/types.d.ts.map +1 -1
- package/build-types/truncate/component.d.ts +3 -3
- package/build-types/truncate/component.d.ts.map +1 -1
- package/build-types/truncate/hook.d.ts +5 -2
- package/build-types/truncate/hook.d.ts.map +1 -1
- package/build-types/truncate/index.d.ts +2 -2
- package/build-types/truncate/index.d.ts.map +1 -1
- package/build-types/truncate/stories/index.d.ts +13 -0
- package/build-types/truncate/stories/index.d.ts.map +1 -0
- package/build-types/truncate/styles.d.ts +1 -1
- package/build-types/truncate/styles.d.ts.map +1 -1
- package/build-types/truncate/test/index.d.ts +2 -0
- package/build-types/truncate/test/index.d.ts.map +1 -0
- package/build-types/truncate/types.d.ts +22 -11
- package/build-types/truncate/types.d.ts.map +1 -1
- package/build-types/truncate/utils.d.ts +17 -28
- package/build-types/truncate/utils.d.ts.map +1 -1
- package/build-types/ui/form-group/use-form-group.d.ts +2 -2
- package/build-types/utils/math.d.ts +10 -0
- package/build-types/utils/math.d.ts.map +1 -1
- package/build-types/v-stack/component.d.ts +5 -4
- package/build-types/v-stack/component.d.ts.map +1 -1
- package/build-types/v-stack/hook.d.ts +5 -3
- package/build-types/v-stack/hook.d.ts.map +1 -1
- package/build-types/v-stack/index.d.ts +2 -2
- package/build-types/v-stack/index.d.ts.map +1 -1
- package/build-types/v-stack/stories/index.d.ts +9 -0
- package/build-types/v-stack/stories/index.d.ts.map +1 -0
- package/build-types/v-stack/test/index.d.ts +2 -0
- package/build-types/v-stack/test/index.d.ts.map +1 -0
- package/build-types/v-stack/types.d.ts +21 -1
- package/build-types/v-stack/types.d.ts.map +1 -1
- package/package.json +18 -17
- package/src/alignment-matrix-control/utils.js +1 -6
- package/src/autocomplete/autocompleter-ui.js +4 -1
- package/src/autocomplete/autocompleter-ui.native.js +8 -2
- package/src/autocomplete/index.js +4 -8
- package/src/border-box-control/border-box-control/component.tsx +1 -0
- package/src/border-box-control/border-box-control-split-controls/component.tsx +1 -0
- package/src/border-control/border-control/component.tsx +41 -4
- package/src/border-control/stories/index.tsx +150 -0
- package/src/box-control/utils.js +4 -4
- package/src/color-indicator/README.md +7 -9
- package/src/color-indicator/index.tsx +47 -0
- package/src/color-indicator/stories/index.tsx +37 -0
- package/src/color-indicator/test/__snapshots__/index.tsx.snap +11 -0
- package/src/color-indicator/test/{index.js → index.tsx} +4 -4
- package/src/color-indicator/types.ts +12 -0
- package/src/color-palette/index.js +5 -1
- package/src/color-picker/component.tsx +12 -11
- package/src/color-picker/input-with-slider.tsx +2 -2
- package/src/color-picker/styles.ts +20 -1
- package/src/custom-gradient-picker/index.js +4 -11
- package/src/custom-gradient-picker/index.native.js +3 -11
- package/src/custom-gradient-picker/serializer.js +5 -11
- package/src/date-time/README.md +7 -0
- package/src/date-time/date/index.tsx +2 -0
- package/src/date-time/date-time/index.tsx +2 -0
- package/src/date-time/types.ts +7 -0
- package/src/dimension-control/README.md +5 -2
- package/src/dimension-control/test/index.test.js +7 -7
- package/src/duotone-picker/duotone-picker.js +58 -37
- package/src/duotone-picker/style.scss +19 -0
- package/src/elevation/hook.js +8 -8
- package/src/flex/flex/README.md +5 -10
- package/src/flex/flex-item/README.md +1 -1
- package/src/focal-point-picker/index.native.js +1 -1
- package/src/form-toggle/README.md +10 -11
- package/src/form-toggle/index.tsx +71 -0
- package/src/form-toggle/stories/index.tsx +52 -0
- package/src/form-toggle/test/__snapshots__/index.tsx.snap +54 -0
- package/src/form-toggle/test/index.tsx +102 -0
- package/src/form-toggle/types.ts +22 -0
- package/src/form-token-field/test/index.js +6 -9
- package/src/form-token-field/test/lib/token-field-wrapper.tsx +2 -2
- package/src/h-stack/utils.js +3 -3
- package/src/heading/README.md +4 -3
- package/src/heading/component.tsx +2 -2
- package/src/heading/hook.ts +1 -42
- package/src/heading/stories/index.tsx +5 -1
- package/src/heading/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
- package/src/heading/test/index.tsx +68 -0
- package/src/heading/types.ts +29 -0
- package/src/input-control/test/index.js +106 -31
- package/src/mobile/bottom-sheet/keyboard-avoiding-view.native.js +2 -7
- package/src/mobile/link-picker/index.native.js +2 -3
- package/src/mobile/segmented-control/index.native.js +6 -5
- package/src/navigation/group/index.js +8 -3
- package/src/navigation/item/base.js +3 -2
- package/src/navigation/item/use-navigation-tree-item.js +2 -0
- package/src/navigation/menu/menu-title-search.js +3 -6
- package/src/navigation/menu/search-no-results-found.js +3 -6
- package/src/navigation/use-navigation-tree-nodes.js +11 -10
- package/src/navigation/utils.js +2 -2
- package/src/number-control/stories/index.js +24 -24
- package/src/range-control/index.js +1 -1
- package/src/range-control/utils.js +1 -4
- package/src/slot-fill/test/slot.js +2 -3
- package/src/spacer/component.tsx +3 -4
- package/src/spacer/stories/index.tsx +70 -0
- package/src/spinner/{index.js → index.tsx} +23 -9
- package/src/spinner/stories/index.tsx +32 -0
- package/src/spinner/{styles.js → styles.ts} +0 -0
- package/src/style.scss +1 -0
- package/src/text/types.ts +1 -1
- package/src/truncate/README.md +16 -12
- package/src/truncate/{component.js → component.tsx} +13 -9
- package/src/truncate/{hook.js → hook.ts} +8 -10
- package/src/truncate/{index.js → index.ts} +0 -0
- package/src/truncate/stories/index.tsx +49 -0
- package/src/truncate/{styles.js → styles.ts} +0 -0
- package/src/truncate/test/{index.js → index.tsx} +4 -4
- package/src/truncate/types.ts +28 -10
- package/src/truncate/{utils.js → utils.ts} +19 -19
- package/src/utils/math.js +14 -5
- package/src/utils/test/math.js +22 -1
- package/src/v-stack/README.md +6 -18
- package/src/v-stack/{component.js → component.tsx} +15 -10
- package/src/v-stack/{hook.js → hook.ts} +5 -6
- package/src/v-stack/{index.js → index.ts} +0 -0
- package/src/v-stack/stories/index.tsx +41 -0
- package/src/v-stack/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
- package/src/v-stack/test/{index.js → index.tsx} +0 -0
- package/src/v-stack/types.ts +21 -1
- package/tsconfig.json +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/src/border-control/stories/index.js +0 -119
- package/src/color-indicator/index.js +0 -16
- package/src/color-indicator/stories/index.js +0 -22
- package/src/color-indicator/test/__snapshots__/index.js.snap +0 -13
- package/src/form-toggle/index.js +0 -38
- package/src/form-toggle/stories/index.js +0 -28
- package/src/form-toggle/test/index.js +0 -74
- package/src/heading/test/index.js +0 -67
- package/src/spacer/stories/index.js +0 -59
- package/src/spinner/stories/index.js +0 -43
- package/src/truncate/stories/index.js +0 -38
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/range-control/utils.js"],"names":["noop","floatClamp","value","min","max","parseFloat","useControlledRangeValue","valueProp","initial","state","setInternalState","fallback","setState","nextValue","useDebouncedHoverInteraction","onHide","onMouseLeave","onMouseMove","onShow","timeout","show","setShow","timeoutRef","setDebouncedTimeout","callback","window","clearTimeout","current","setTimeout","handleOnMouseMove","event","handleOnMouseLeave"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/range-control/utils.js"],"names":["noop","floatClamp","value","min","max","parseFloat","useControlledRangeValue","valueProp","initial","state","setInternalState","fallback","setState","nextValue","useDebouncedHoverInteraction","onHide","onMouseLeave","onMouseMove","onShow","timeout","show","setShow","timeoutRef","setDebouncedTimeout","callback","window","clearTimeout","current","setTimeout","handleOnMouseMove","event","handleOnMouseLeave"],"mappings":";;;;;;;;;AAKA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n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useRef, useEffect, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useControlledState } from '../utils/hooks';\nimport { clamp } from '../utils/math';\n\nconst noop = () => {};\n\n/**\n * A float supported clamp function for a specific value.\n *\n * @param {number|null} value The value to clamp.\n * @param {number} min The minimum value.\n * @param {number} max The maximum value.\n *\n * @return {number} A (float) number\n */\nexport function floatClamp( value, min, max ) {\n\tif ( typeof value !== 'number' ) {\n\t\treturn null;\n\t}\n\n\treturn parseFloat( clamp( value, min, max ) );\n}\n\n/**\n * Hook to store a clamped value, derived from props.\n *\n * @param {Object} settings Hook settings.\n * @param {number} settings.min The minimum value.\n * @param {number} settings.max The maximum value.\n * @param {number} settings.value The current value.\n * @param {any} settings.initial The initial value.\n *\n * @return {[*, Function]} The controlled value and the value setter.\n */\nexport function useControlledRangeValue( {\n\tmin,\n\tmax,\n\tvalue: valueProp,\n\tinitial,\n} ) {\n\tconst [ state, setInternalState ] = useControlledState(\n\t\tfloatClamp( valueProp, min, max ),\n\t\t{ initial, fallback: null }\n\t);\n\n\tconst setState = useCallback(\n\t\t( nextValue ) => {\n\t\t\tif ( nextValue === null ) {\n\t\t\t\tsetInternalState( null );\n\t\t\t} else {\n\t\t\t\tsetInternalState( floatClamp( nextValue, min, max ) );\n\t\t\t}\n\t\t},\n\t\t[ min, max ]\n\t);\n\n\treturn [ state, setState ];\n}\n\n/**\n * Hook to encapsulate the debouncing \"hover\" to better handle the showing\n * and hiding of the Tooltip.\n *\n * @param {Object} settings Hook settings.\n * @param {Function} [settings.onShow=noop] A callback function invoked when the element is shown.\n * @param {Function} [settings.onHide=noop] A callback function invoked when the element is hidden.\n * @param {Function} [settings.onMouseMove=noop] A callback function invoked when the mouse is moved.\n * @param {Function} [settings.onMouseLeave=noop] A callback function invoked when the mouse is moved out of the element.\n * @param {number} [settings.timeout=300] Timeout before the element is shown or hidden.\n *\n * @return {Object} Bound properties for use on a React.Node.\n */\nexport function useDebouncedHoverInteraction( {\n\tonHide = noop,\n\tonMouseLeave = noop,\n\tonMouseMove = noop,\n\tonShow = noop,\n\ttimeout = 300,\n} ) {\n\tconst [ show, setShow ] = useState( false );\n\tconst timeoutRef = useRef();\n\n\tconst setDebouncedTimeout = useCallback(\n\t\t( callback ) => {\n\t\t\twindow.clearTimeout( timeoutRef.current );\n\n\t\t\ttimeoutRef.current = setTimeout( callback, timeout );\n\t\t},\n\t\t[ timeout ]\n\t);\n\n\tconst handleOnMouseMove = useCallback( ( event ) => {\n\t\tonMouseMove( event );\n\n\t\tsetDebouncedTimeout( () => {\n\t\t\tif ( ! show ) {\n\t\t\t\tsetShow( true );\n\t\t\t\tonShow();\n\t\t\t}\n\t\t} );\n\t}, [] );\n\n\tconst handleOnMouseLeave = useCallback( ( event ) => {\n\t\tonMouseLeave( event );\n\n\t\tsetDebouncedTimeout( () => {\n\t\t\tsetShow( false );\n\t\t\tonHide();\n\t\t} );\n\t}, [] );\n\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\twindow.clearTimeout( timeoutRef.current );\n\t\t};\n\t} );\n\n\treturn {\n\t\tonMouseMove: handleOnMouseMove,\n\t\tonMouseLeave: handleOnMouseLeave,\n\t};\n}\n"]}
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default = void 0;
|
|
8
|
+
exports.default = exports.Spacer = void 0;
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
@@ -24,7 +24,7 @@ var _hook = require("./hook");
|
|
|
24
24
|
/**
|
|
25
25
|
* Internal dependencies
|
|
26
26
|
*/
|
|
27
|
-
function
|
|
27
|
+
function UnconnectedSpacer(props, forwardedRef) {
|
|
28
28
|
const spacerProps = (0, _hook.useSpacer)(props);
|
|
29
29
|
return (0, _element.createElement)(_view.View, (0, _extends2.default)({}, spacerProps, {
|
|
30
30
|
ref: forwardedRef
|
|
@@ -35,7 +35,6 @@ function Spacer(props, forwardedRef) {
|
|
|
35
35
|
*
|
|
36
36
|
* `Spacer` comes with a bunch of shorthand props to adjust `margin` and `padding`. The values of these props work as a multiplier to the library's grid system (base of `4px`).
|
|
37
37
|
*
|
|
38
|
-
* @example
|
|
39
38
|
* ```jsx
|
|
40
39
|
* import { Spacer } from `@wordpress/components`
|
|
41
40
|
*
|
|
@@ -55,7 +54,8 @@ function Spacer(props, forwardedRef) {
|
|
|
55
54
|
*/
|
|
56
55
|
|
|
57
56
|
|
|
58
|
-
const
|
|
59
|
-
|
|
57
|
+
const Spacer = (0, _context.contextConnect)(UnconnectedSpacer, 'Spacer');
|
|
58
|
+
exports.Spacer = Spacer;
|
|
59
|
+
var _default = Spacer;
|
|
60
60
|
exports.default = _default;
|
|
61
61
|
//# sourceMappingURL=component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/spacer/component.tsx"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/spacer/component.tsx"],"names":["UnconnectedSpacer","props","forwardedRef","spacerProps","Spacer"],"mappings":";;;;;;;;;;;;;AAQA;;AACA;;AACA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;AAMA,SAASA,iBAAT,CACCC,KADD,EAECC,YAFD,EAGE;AACD,QAAMC,WAAW,GAAG,qBAAWF,KAAX,CAApB;AAEA,SAAO,4BAAC,UAAD,6BAAWE,WAAX;AAAyB,IAAA,GAAG,EAAGD;AAA/B,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAME,MAAM,GAAG,6BAAgBJ,iBAAhB,EAAmC,QAAnC,CAAf;;eAEQI,M","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * Internal dependencies\n */\nimport { contextConnect, WordPressComponentProps } from '../ui/context';\nimport { View } from '../view';\nimport { useSpacer } from './hook';\nimport type { Props } from './types';\n\nfunction UnconnectedSpacer(\n\tprops: WordPressComponentProps< Props, 'div' >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst spacerProps = useSpacer( props );\n\n\treturn <View { ...spacerProps } ref={ forwardedRef } />;\n}\n\n/**\n * `Spacer` is a primitive layout component that providers inner (`padding`) or outer (`margin`) space in-between components. It can also be used to adaptively provide space within an `HStack` or `VStack`.\n *\n * `Spacer` comes with a bunch of shorthand props to adjust `margin` and `padding`. The values of these props work as a multiplier to the library's grid system (base of `4px`).\n *\n * ```jsx\n * import { Spacer } from `@wordpress/components`\n *\n * function Example() {\n * return (\n * <View>\n * <Spacer>\n * <Heading>WordPress.org</Heading>\n * </Spacer>\n * <Text>\n * Code is Poetry\n * </Text>\n * </View>\n * );\n * }\n * ```\n */\nexport const Spacer = contextConnect( UnconnectedSpacer, 'Spacer' );\n\nexport default Spacer;\n"]}
|
package/build/spinner/index.js
CHANGED
|
@@ -5,7 +5,9 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.Spinner = void 0;
|
|
9
|
+
exports.UnforwardedSpinner = UnforwardedSpinner;
|
|
10
|
+
exports.default = void 0;
|
|
9
11
|
|
|
10
12
|
var _element = require("@wordpress/element");
|
|
11
13
|
|
|
@@ -24,18 +26,9 @@ var _styles = require("./styles");
|
|
|
24
26
|
*/
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* @property {string} [className] Class name
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
/** @typedef {import('react').ComponentPropsWithoutRef<'svg'> & OwnProps} Props */
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* @param {Props} props
|
|
36
|
-
* @return {JSX.Element} Element
|
|
29
|
+
* WordPress dependencies
|
|
37
30
|
*/
|
|
38
|
-
function
|
|
31
|
+
function UnforwardedSpinner(_ref, forwardedRef) {
|
|
39
32
|
let {
|
|
40
33
|
className,
|
|
41
34
|
...props
|
|
@@ -46,7 +39,9 @@ function Spinner(_ref) {
|
|
|
46
39
|
xmlns: "http://www.w3.org/2000/svg",
|
|
47
40
|
role: "presentation",
|
|
48
41
|
focusable: "false"
|
|
49
|
-
}, props
|
|
42
|
+
}, props, {
|
|
43
|
+
ref: forwardedRef
|
|
44
|
+
}), (0, _element.createElement)(_styles.SpinnerTrack, {
|
|
50
45
|
cx: "50",
|
|
51
46
|
cy: "50",
|
|
52
47
|
r: "50",
|
|
@@ -56,4 +51,22 @@ function Spinner(_ref) {
|
|
|
56
51
|
vectorEffect: "non-scaling-stroke"
|
|
57
52
|
}));
|
|
58
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* `Spinner` is a component used to notify users that their action is being processed.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```js
|
|
59
|
+
* import { Spinner } from '@wordpress/components';
|
|
60
|
+
*
|
|
61
|
+
* function Example() {
|
|
62
|
+
* return <Spinner />;
|
|
63
|
+
* }
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
const Spinner = (0, _element.forwardRef)(UnforwardedSpinner);
|
|
69
|
+
exports.Spinner = Spinner;
|
|
70
|
+
var _default = Spinner;
|
|
71
|
+
exports.default = _default;
|
|
59
72
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/spinner/index.
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/spinner/index.tsx"],"names":["UnforwardedSpinner","forwardedRef","className","props","Spinner"],"mappings":";;;;;;;;;;;AAeA;;;;AAZA;;AAMA;;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;AAGO,SAASA,kBAAT,OAENC,YAFM,EAGL;AAAA,MAFD;AAAEC,IAAAA,SAAF;AAAa,OAAGC;AAAhB,GAEC;AACD,SACC,4BAAC,qBAAD;AACC,IAAA,SAAS,EAAG,yBAAY,oBAAZ,EAAkCD,SAAlC,CADb;AAEC,IAAA,OAAO,EAAC,aAFT;AAGC,IAAA,KAAK,EAAC,4BAHP;AAIC,IAAA,IAAI,EAAC,cAJN;AAKC,IAAA,SAAS,EAAC;AALX,KAMMC,KANN;AAOC,IAAA,GAAG,EAAGF;AAPP,MAUC,4BAAC,oBAAD;AACC,IAAA,EAAE,EAAC,IADJ;AAEC,IAAA,EAAE,EAAC,IAFJ;AAGC,IAAA,CAAC,EAAC,IAHH;AAIC,IAAA,YAAY,EAAC;AAJd,IAVD,EAkBC,4BAAC,wBAAD;AACC,IAAA,CAAC,EAAC,4BADH;AAEC,IAAA,YAAY,EAAC;AAFd,IAlBD,CADD;AAyBA;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMG,OAAO,GAAG,yBAAYJ,kBAAZ,CAAhB;;eACQI,O","sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\nimport type { ForwardedRef } from 'react';\n\n/**\n * Internal dependencies\n */\nimport { StyledSpinner, SpinnerTrack, SpinnerIndicator } from './styles';\nimport type { WordPressComponentProps } from '../ui/context';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\nexport function UnforwardedSpinner(\n\t{ className, ...props }: WordPressComponentProps< {}, 'svg', false >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\treturn (\n\t\t<StyledSpinner\n\t\t\tclassName={ classNames( 'components-spinner', className ) }\n\t\t\tviewBox=\"0 0 100 100\"\n\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\trole=\"presentation\"\n\t\t\tfocusable=\"false\"\n\t\t\t{ ...props }\n\t\t\tref={ forwardedRef }\n\t\t>\n\t\t\t{ /* Gray circular background */ }\n\t\t\t<SpinnerTrack\n\t\t\t\tcx=\"50\"\n\t\t\t\tcy=\"50\"\n\t\t\t\tr=\"50\"\n\t\t\t\tvectorEffect=\"non-scaling-stroke\"\n\t\t\t/>\n\n\t\t\t{ /* Theme-colored arc */ }\n\t\t\t<SpinnerIndicator\n\t\t\t\td=\"m 50 0 a 50 50 0 0 1 50 50\"\n\t\t\t\tvectorEffect=\"non-scaling-stroke\"\n\t\t\t/>\n\t\t</StyledSpinner>\n\t);\n}\n/**\n * `Spinner` is a component used to notify users that their action is being processed.\n *\n * @example\n * ```js\n * import { Spinner } from '@wordpress/components';\n *\n * function Example() {\n * return <Spinner />;\n * }\n * ```\n */\nexport const Spinner = forwardRef( UnforwardedSpinner );\nexport default Spinner;\n"]}
|
package/build/spinner/styles.js
CHANGED
|
@@ -24,11 +24,11 @@ const spinAnimation = (0, _react.keyframes)`
|
|
|
24
24
|
}
|
|
25
25
|
`;
|
|
26
26
|
const StyledSpinner = (0, _base.default)("svg", process.env.NODE_ENV === "production" ? {
|
|
27
|
-
target: "
|
|
27
|
+
target: "ea4tfvq2"
|
|
28
28
|
} : {
|
|
29
|
-
target: "
|
|
29
|
+
target: "ea4tfvq2",
|
|
30
30
|
label: "StyledSpinner"
|
|
31
|
-
})("width:", _utils.CONFIG.spinnerSize, "px;height:", _utils.CONFIG.spinnerSize, "px;display:inline-block;margin:5px 11px 0;position:relative;color:var( --wp-admin-theme-color );overflow:visible;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
31
|
+
})("width:", _utils.CONFIG.spinnerSize, "px;height:", _utils.CONFIG.spinnerSize, "px;display:inline-block;margin:5px 11px 0;position:relative;color:var( --wp-admin-theme-color );overflow:visible;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJ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lbnQ7XG5cdHN0cm9rZS13aWR0aDogMS41cHg7XG5gO1xuXG5leHBvcnQgY29uc3QgU3Bpbm5lclRyYWNrID0gc3R5bGVkLmNpcmNsZWBcblx0JHsgY29tbW9uUGF0aFByb3BzIH07XG5cdHN0cm9rZTogJHsgQ09MT1JTLmdyYXlbIDMwMCBdIH07XG5gO1xuXG5leHBvcnQgY29uc3QgU3Bpbm5lckluZGljYXRvciA9IHN0eWxlZC5wYXRoYFxuXHQkeyBjb21tb25QYXRoUHJvcHMgfTtcblx0c3Ryb2tlOiBjdXJyZW50Q29sb3I7XG5cdHN0cm9rZS1saW5lY2FwOiByb3VuZDtcblx0dHJhbnNmb3JtLW9yaWdpbjogNTAlIDUwJTtcblx0YW5pbWF0aW9uOiAxLjRzIGxpbmVhciBpbmZpbml0ZSBib3RoICR7IHNwaW5BbmltYXRpb24gfTtcbmA7XG4iXX0= */"));
|
|
32
32
|
exports.StyledSpinner = StyledSpinner;
|
|
33
33
|
const commonPathProps = process.env.NODE_ENV === "production" ? {
|
|
34
34
|
name: "9s4963",
|
|
@@ -36,21 +36,21 @@ const commonPathProps = process.env.NODE_ENV === "production" ? {
|
|
|
36
36
|
} : {
|
|
37
37
|
name: "o2zng0-commonPathProps",
|
|
38
38
|
styles: "fill:transparent;stroke-width:1.5px;label:commonPathProps;",
|
|
39
|
-
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
39
|
+
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvc3Bpbm5lci9zdHlsZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBOEIyQiIsImZpbGUiOiJAd29yZHByZXNzL2NvbXBvbmVudHMvc3JjL3NwaW5uZXIvc3R5bGVzLnRzIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBFeHRlcm5hbCBkZXBlbmRlbmN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oYFxuXHQkeyBjb21tb25QYXRoUHJvcHMgfTtcblx0c3Ryb2tlOiBjdXJyZW50Q29sb3I7XG5cdHN0cm9rZS1saW5lY2FwOiByb3VuZDtcblx0dHJhbnNmb3JtLW9yaWdpbjogNTAlIDUwJTtcblx0YW5pbWF0aW9uOiAxLjRzIGxpbmVhciBpbmZpbml0ZSBib3RoICR7IHNwaW5BbmltYXRpb24gfTtcbmA7XG4iXX0= */",
|
|
40
40
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
41
41
|
};
|
|
42
42
|
const SpinnerTrack = (0, _base.default)("circle", process.env.NODE_ENV === "production" ? {
|
|
43
|
-
target: "
|
|
43
|
+
target: "ea4tfvq1"
|
|
44
44
|
} : {
|
|
45
|
-
target: "
|
|
45
|
+
target: "ea4tfvq1",
|
|
46
46
|
label: "SpinnerTrack"
|
|
47
|
-
})(commonPathProps, ";stroke:", _utils.COLORS.gray[300], ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
47
|
+
})(commonPathProps, ";stroke:", _utils.COLORS.gray[300], ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvc3Bpbm5lci9zdHlsZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBbUN5QyIsImZpbGUiOiJAd29yZHByZXNzL2NvbXBvbmVudHMvc3JjL3NwaW5uZXIvc3R5bGVzLnRzIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBFeHRlcm5hbCBkZXBlbmRlbmNpZXNcbiAqL1xuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xuaW1wb3J0IHsgY3NzLCBrZXlmcmFtZXMgfSBmcm9tICdAZW1vdGlvbi9yZWFjdCc7XG5cbi8qKl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cblx0YW5pbWF0aW9uOiAxLjRzIGxpbmVhciBpbmZpbml0ZSBib3RoICR7IHNwaW5BbmltYXRpb24gfTtcbmA7XG4iXX0= */"));
|
|
48
48
|
exports.SpinnerTrack = SpinnerTrack;
|
|
49
49
|
const SpinnerIndicator = (0, _base.default)("path", process.env.NODE_ENV === "production" ? {
|
|
50
|
-
target: "
|
|
50
|
+
target: "ea4tfvq0"
|
|
51
51
|
} : {
|
|
52
|
-
target: "
|
|
52
|
+
target: "ea4tfvq0",
|
|
53
53
|
label: "SpinnerIndicator"
|
|
54
|
-
})(commonPathProps, ";stroke:currentColor;stroke-linecap:round;transform-origin:50% 50%;animation:1.4s linear infinite both ", spinAnimation, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
54
|
+
})(commonPathProps, ";stroke:currentColor;stroke-linecap:round;transform-origin:50% 50%;animation:1.4s linear infinite both ", spinAnimation, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvc3Bpbm5lci9zdHlsZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBd0MyQyIsImZpbGUiOiJAd29yZHByZXNzL2NvbXBvbmVudHMvc3JjL3NwaW5uZXIvc3R5bGVzLnRzIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBFeHRlcm5hbCBkZXBlbmRlbmNpZXNcbiAqL1xuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xuaW1wb3J0IHsgY3NzLCBrZXlmcmFtZXMgfSBmcm9tICdAZW1vdGlvbi9yZWFjdCc7XG5cbi8qKlxuICogSW50ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB7IENPTE9SUywgQ09ORklHIH0gZnJvbSAnLi4vdX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= */"));
|
|
55
55
|
exports.SpinnerIndicator = SpinnerIndicator;
|
|
56
56
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/spinner/styles.
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/spinner/styles.ts"],"names":["spinAnimation","StyledSpinner","CONFIG","spinnerSize","commonPathProps","SpinnerTrack","COLORS","gray","SpinnerIndicator"],"mappings":";;;;;;;;;;;AAIA;;AAKA;;;;AAEA,MAAMA,aAAa,GAAG,qBAAU;AAChC;AACA;AACA;AACA;AACA;AACA;AACA,EAPA;AASO,MAAMC,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA,aACfC,cAAOC,WADQ,gBAEdD,cAAOC,WAFO,yxDAAnB;;AAUP,MAAMC,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAArB;AAKO,MAAMC,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA,GACrBD,eADqB,cAEbE,cAAOC,IAAP,CAAa,GAAb,CAFa,yqDAAlB;;AAKA,MAAMC,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA,GACzBJ,eADyB,6GAKYJ,aALZ,yqDAAtB","sourcesContent":["/**\n * External dependencies\n */\nimport styled from '@emotion/styled';\nimport { css, keyframes } from '@emotion/react';\n\n/**\n * Internal dependencies\n */\nimport { COLORS, CONFIG } from '../utils';\n\nconst spinAnimation = keyframes`\n\tfrom {\n\t\ttransform: rotate(0deg);\n\t}\n\tto {\n\t\ttransform: rotate(360deg);\n\t}\n `;\n\nexport const StyledSpinner = styled.svg`\n\twidth: ${ CONFIG.spinnerSize }px;\n\theight: ${ CONFIG.spinnerSize }px;\n\tdisplay: inline-block;\n\tmargin: 5px 11px 0;\n\tposition: relative;\n\tcolor: var( --wp-admin-theme-color );\n\toverflow: visible;\n`;\n\nconst commonPathProps = css`\n\tfill: transparent;\n\tstroke-width: 1.5px;\n`;\n\nexport const SpinnerTrack = styled.circle`\n\t${ commonPathProps };\n\tstroke: ${ COLORS.gray[ 300 ] };\n`;\n\nexport const SpinnerIndicator = styled.path`\n\t${ commonPathProps };\n\tstroke: currentColor;\n\tstroke-linecap: round;\n\ttransform-origin: 50% 50%;\n\tanimation: 1.4s linear infinite both ${ spinAnimation };\n`;\n"]}
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default = void 0;
|
|
8
|
+
exports.default = exports.Truncate = void 0;
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
@@ -18,14 +18,13 @@ var _view = require("../view");
|
|
|
18
18
|
var _hook = _interopRequireDefault(require("./hook"));
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* External dependencies
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
26
|
-
* @param {import('react').ForwardedRef<any>} forwardedRef
|
|
25
|
+
* Internal dependencies
|
|
27
26
|
*/
|
|
28
|
-
function
|
|
27
|
+
function UnconnectedTruncate(props, forwardedRef) {
|
|
29
28
|
const truncateProps = (0, _hook.default)(props);
|
|
30
29
|
return (0, _element.createElement)(_view.View, (0, _extends2.default)({
|
|
31
30
|
as: "span"
|
|
@@ -39,7 +38,6 @@ function Truncate(props, forwardedRef) {
|
|
|
39
38
|
* `Subheading` is used to render text content. However,`Truncate` is
|
|
40
39
|
* available for custom implementations.
|
|
41
40
|
*
|
|
42
|
-
* @example
|
|
43
41
|
* ```jsx
|
|
44
42
|
* import { __experimentalTruncate as Truncate } from `@wordpress/components`;
|
|
45
43
|
*
|
|
@@ -56,7 +54,8 @@ function Truncate(props, forwardedRef) {
|
|
|
56
54
|
*/
|
|
57
55
|
|
|
58
56
|
|
|
59
|
-
const
|
|
60
|
-
|
|
57
|
+
const Truncate = (0, _context.contextConnect)(UnconnectedTruncate, 'Truncate');
|
|
58
|
+
exports.Truncate = Truncate;
|
|
59
|
+
var _default = Truncate;
|
|
61
60
|
exports.default = _default;
|
|
62
61
|
//# sourceMappingURL=component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/truncate/component.
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/truncate/component.tsx"],"names":["UnconnectedTruncate","props","forwardedRef","truncateProps","Truncate"],"mappings":";;;;;;;;;;;;;AAQA;;AACA;;AACA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;AAMA,SAASA,mBAAT,CACCC,KADD,EAECC,YAFD,EAGE;AACD,QAAMC,aAAa,GAAG,mBAAaF,KAAb,CAAtB;AAEA,SAAO,4BAAC,UAAD;AAAM,IAAA,EAAE,EAAC;AAAT,KAAqBE,aAArB;AAAqC,IAAA,GAAG,EAAGD;AAA3C,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAME,QAAQ,GAAG,6BAAgBJ,mBAAhB,EAAqC,UAArC,CAAjB;;eAEQI,Q","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * Internal dependencies\n */\nimport { contextConnect, WordPressComponentProps } from '../ui/context';\nimport { View } from '../view';\nimport useTruncate from './hook';\nimport type { TruncateProps } from './types';\n\nfunction UnconnectedTruncate(\n\tprops: WordPressComponentProps< TruncateProps, 'span' >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst truncateProps = useTruncate( props );\n\n\treturn <View as=\"span\" { ...truncateProps } ref={ forwardedRef } />;\n}\n\n/**\n * `Truncate` is a typography primitive that trims text content.\n * For almost all cases, it is recommended that `Text`, `Heading`, or\n * `Subheading` is used to render text content. However,`Truncate` is\n * available for custom implementations.\n *\n * ```jsx\n * import { __experimentalTruncate as Truncate } from `@wordpress/components`;\n *\n * function Example() {\n * \treturn (\n * \t\t<Truncate>\n * \t\t\tLorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc ex\n * \t\t\tneque, vulputate a diam et, luctus convallis lacus. Vestibulum ac\n * \t\t\tmollis mi. Morbi id elementum massa.\n * \t\t</Truncate>\n * \t);\n * }\n * ```\n */\nexport const Truncate = contextConnect( UnconnectedTruncate, 'Truncate' );\n\nexport default Truncate;\n"]}
|
package/build/truncate/hook.js
CHANGED
|
@@ -32,10 +32,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
32
32
|
/**
|
|
33
33
|
* Internal dependencies
|
|
34
34
|
*/
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'span'>} props
|
|
38
|
-
*/
|
|
39
35
|
function useTruncate(props) {
|
|
40
36
|
const {
|
|
41
37
|
className,
|
|
@@ -47,9 +43,7 @@ function useTruncate(props) {
|
|
|
47
43
|
...otherProps
|
|
48
44
|
} = (0, _context.useContextSystem)(props, 'Truncate');
|
|
49
45
|
const cx = (0, _useCx.useCx)();
|
|
50
|
-
const truncatedContent = (0, _utils.truncateContent)(typeof children === 'string' ?
|
|
51
|
-
/** @type {string} */
|
|
52
|
-
children : '', {
|
|
46
|
+
const truncatedContent = (0, _utils.truncateContent)(typeof children === 'string' ? children : '', {
|
|
53
47
|
ellipsis,
|
|
54
48
|
ellipsizeMode,
|
|
55
49
|
limit,
|
|
@@ -57,9 +51,8 @@ function useTruncate(props) {
|
|
|
57
51
|
});
|
|
58
52
|
const shouldTruncate = ellipsizeMode === _utils.TRUNCATE_TYPE.auto;
|
|
59
53
|
const classes = (0, _element.useMemo)(() => {
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
return cx(shouldTruncate && !numberOfLines && styles.Truncate, shouldTruncate && !!numberOfLines && sx.numberOfLines, className);
|
|
54
|
+
const truncateLines = /*#__PURE__*/(0, _react.css)("-webkit-box-orient:vertical;-webkit-line-clamp:", numberOfLines, ";display:-webkit-box;overflow:hidden;" + (process.env.NODE_ENV === "production" ? "" : ";label:truncateLines;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdHJ1bmNhdGUvaG9vay50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUErQzJCIiwiZmlsZSI6IkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdHJ1bmNhdGUvaG9vay50cyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogRXh0ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcblxuLyoqXG4gKiBXb3JkUHJlc3MgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB7IHVzZU1lbW8gfSBmcm9tICdAd29yZHByZXNzL2VsZW1lbnQnO1xuXG4vKipcbiAqIEludGVybmFsIGRlcGVuZGVuY2llc1xuICovXG5pbXBvcnQgeyB1c2VDb250ZXh0U3lzdGVtLCBXb3JkUHJlc3NDb21wb25lbnRQcm9wcyB9IGZyb20gJy4uL3VpL2NvbnRleHQnO1xuaW1wb3J0ICogYXMgc3R5bGVzIGZyb20gJy4vc3R5bGVzJztcbmltcG9ydCB7IFRSVU5DQVRFX0VMTElQU0lTLCBUUlVOQ0FURV9UWVBFLCB0cnVuY2F0ZUNvbnRlbnQgfSBmcm9tICcuL3V0aWxzJztcbmltcG9ydCB7IHVzZUN4IH0gZnJvbSAnLi4vdXRpbHMvaG9va3MvdXNlLWN4JztcbmltcG9ydCB0eXBlIHsgVHJ1bmNhdGVQcm9wcyB9IGZyb20gJy4vdHlwZXMnO1xuXG5leHBvcnQgZGVmYXVsdCBmdW5jdGlv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XHRcdGA7XG5cblx0XHRyZXR1cm4gY3goXG5cdFx0XHRzaG91bGRUcnVuY2F0ZSAmJiAhIG51bWJlck9mTGluZXMgJiYgc3R5bGVzLlRydW5jYXRlLFxuXHRcdFx0c2hvdWxkVHJ1bmNhdGUgJiYgISEgbnVtYmVyT2ZMaW5lcyAmJiB0cnVuY2F0ZUxpbmVzLFxuXHRcdFx0Y2xhc3NOYW1lXG5cdFx0KTtcblx0fSwgWyBjbGFzc05hbWUsIGN4LCBudW1iZXJPZkxpbmVzLCBzaG91bGRUcnVuY2F0ZSBdICk7XG5cblx0cmV0dXJuIHsgLi4ub3RoZXJQcm9wcywgY2xhc3NOYW1lOiBjbGFzc2VzLCBjaGlsZHJlbjogdHJ1bmNhdGVkQ29udGVudCB9O1xufVxuIl19 */");
|
|
55
|
+
return cx(shouldTruncate && !numberOfLines && styles.Truncate, shouldTruncate && !!numberOfLines && truncateLines, className);
|
|
63
56
|
}, [className, cx, numberOfLines, shouldTruncate]);
|
|
64
57
|
return { ...otherProps,
|
|
65
58
|
className: classes,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/truncate/hook.
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/truncate/hook.ts"],"names":["useTruncate","props","className","children","ellipsis","TRUNCATE_ELLIPSIS","ellipsizeMode","TRUNCATE_TYPE","auto","limit","numberOfLines","otherProps","cx","truncatedContent","shouldTruncate","classes","truncateLines","css","styles","Truncate"],"mappings":";;;;;;;AAGA;;AAKA;;AAKA;;AACA;;AACA;;AACA;;;;;;AAhBA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AAOe,SAASA,WAAT,CACdC,KADc,EAEb;AACD,QAAM;AACLC,IAAAA,SADK;AAELC,IAAAA,QAFK;AAGLC,IAAAA,QAAQ,GAAGC,wBAHN;AAILC,IAAAA,aAAa,GAAGC,qBAAcC,IAJzB;AAKLC,IAAAA,KAAK,GAAG,CALH;AAMLC,IAAAA,aAAa,GAAG,CANX;AAOL,OAAGC;AAPE,MAQF,+BAAkBV,KAAlB,EAAyB,UAAzB,CARJ;AAUA,QAAMW,EAAE,GAAG,mBAAX;AAEA,QAAMC,gBAAgB,GAAG,4BACxB,OAAOV,QAAP,KAAoB,QAApB,GAA+BA,QAA/B,GAA0C,EADlB,EAExB;AACCC,IAAAA,QADD;AAECE,IAAAA,aAFD;AAGCG,IAAAA,KAHD;AAICC,IAAAA;AAJD,GAFwB,CAAzB;AAUA,QAAMI,cAAc,GAAGR,aAAa,KAAKC,qBAAcC,IAAvD;AAEA,QAAMO,OAAO,GAAG,sBAAS,MAAM;AAC9B,UAAMC,aAAa,oBAAGC,UAAH,qDAEKP,aAFL,2jFAAnB;AAOA,WAAOE,EAAE,CACRE,cAAc,IAAI,CAAEJ,aAApB,IAAqCQ,MAAM,CAACC,QADpC,EAERL,cAAc,IAAI,CAAC,CAAEJ,aAArB,IAAsCM,aAF9B,EAGRd,SAHQ,CAAT;AAKA,GAbe,EAab,CAAEA,SAAF,EAAaU,EAAb,EAAiBF,aAAjB,EAAgCI,cAAhC,CAba,CAAhB;AAeA,SAAO,EAAE,GAAGH,UAAL;AAAiBT,IAAAA,SAAS,EAAEa,OAA5B;AAAqCZ,IAAAA,QAAQ,EAAEU;AAA/C,GAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { css } from '@emotion/react';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useContextSystem, WordPressComponentProps } from '../ui/context';\nimport * as styles from './styles';\nimport { TRUNCATE_ELLIPSIS, TRUNCATE_TYPE, truncateContent } from './utils';\nimport { useCx } from '../utils/hooks/use-cx';\nimport type { TruncateProps } from './types';\n\nexport default function useTruncate(\n\tprops: WordPressComponentProps< TruncateProps, 'span' >\n) {\n\tconst {\n\t\tclassName,\n\t\tchildren,\n\t\tellipsis = TRUNCATE_ELLIPSIS,\n\t\tellipsizeMode = TRUNCATE_TYPE.auto,\n\t\tlimit = 0,\n\t\tnumberOfLines = 0,\n\t\t...otherProps\n\t} = useContextSystem( props, 'Truncate' );\n\n\tconst cx = useCx();\n\n\tconst truncatedContent = truncateContent(\n\t\ttypeof children === 'string' ? children : '',\n\t\t{\n\t\t\tellipsis,\n\t\t\tellipsizeMode,\n\t\t\tlimit,\n\t\t\tnumberOfLines,\n\t\t}\n\t);\n\n\tconst shouldTruncate = ellipsizeMode === TRUNCATE_TYPE.auto;\n\n\tconst classes = useMemo( () => {\n\t\tconst truncateLines = css`\n\t\t\t-webkit-box-orient: vertical;\n\t\t\t-webkit-line-clamp: ${ numberOfLines };\n\t\t\tdisplay: -webkit-box;\n\t\t\toverflow: hidden;\n\t\t`;\n\n\t\treturn cx(\n\t\t\tshouldTruncate && ! numberOfLines && styles.Truncate,\n\t\t\tshouldTruncate && !! numberOfLines && truncateLines,\n\t\t\tclassName\n\t\t);\n\t}, [ className, cx, numberOfLines, shouldTruncate ] );\n\n\treturn { ...otherProps, className: classes, children: truncatedContent };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/truncate/index.
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/truncate/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;AACA","sourcesContent":["export { default as Truncate } from './component';\nexport { default as useTruncate } from './hook';\n"]}
|
package/build/truncate/styles.js
CHANGED
|
@@ -15,7 +15,7 @@ const Truncate = process.env.NODE_ENV === "production" ? {
|
|
|
15
15
|
} : {
|
|
16
16
|
name: "abxxyf-Truncate",
|
|
17
17
|
styles: "display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;label:Truncate;",
|
|
18
|
-
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
18
|
+
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdHJ1bmNhdGUvc3R5bGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUsyQiIsImZpbGUiOiJAd29yZHByZXNzL2NvbXBvbmVudHMvc3JjL3RydW5jYXRlL3N0eWxlcy50cyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogRXh0ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcblxuZXhwb3J0IGNvbnN0IFRydW5jYXRlID0gY3NzYFxuXHRkaXNwbGF5OiBibG9jaztcblx0b3ZlcmZsb3c6IGhpZGRlbjtcblx0dGV4dC1vdmVyZmxvdzogZWxsaXBzaXM7XG5cdHdoaXRlLXNwYWNlOiBub3dyYXA7XG5gO1xuIl19 */",
|
|
19
19
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
20
20
|
};
|
|
21
21
|
exports.Truncate = Truncate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/truncate/styles.
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/truncate/styles.ts"],"names":["Truncate"],"mappings":";;;;;;;AAGA;;;;AAEO,MAAMA,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAd","sourcesContent":["/**\n * External dependencies\n */\nimport { css } from '@emotion/react';\n\nexport const Truncate = css`\n\tdisplay: block;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n`;\n"]}
|
package/build/truncate/utils.js
CHANGED
|
@@ -7,10 +7,10 @@ exports.TRUNCATE_TYPE = exports.TRUNCATE_ELLIPSIS = exports.TRUNCATE_DEFAULT_PRO
|
|
|
7
7
|
exports.truncateContent = truncateContent;
|
|
8
8
|
exports.truncateMiddle = truncateMiddle;
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _values = require("../utils/values");
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Internal dependencies
|
|
14
14
|
*/
|
|
15
15
|
const TRUNCATE_ELLIPSIS = '…';
|
|
16
16
|
exports.TRUNCATE_ELLIPSIS = TRUNCATE_ELLIPSIS;
|
|
@@ -30,13 +30,6 @@ const TRUNCATE_DEFAULT_PROPS = {
|
|
|
30
30
|
}; // Source
|
|
31
31
|
// https://github.com/kahwee/truncate-middle
|
|
32
32
|
|
|
33
|
-
/**
|
|
34
|
-
* @param {string} word
|
|
35
|
-
* @param {number} headLength
|
|
36
|
-
* @param {number} tailLength
|
|
37
|
-
* @param {string} ellipsis
|
|
38
|
-
*/
|
|
39
|
-
|
|
40
33
|
exports.TRUNCATE_DEFAULT_PROPS = TRUNCATE_DEFAULT_PROPS;
|
|
41
34
|
|
|
42
35
|
function truncateMiddle(word, headLength, tailLength, ellipsis) {
|
|
@@ -53,7 +46,7 @@ function truncateMiddle(word, headLength, tailLength, ellipsis) {
|
|
|
53
46
|
const backLength = ~~tailLength;
|
|
54
47
|
/* istanbul ignore next */
|
|
55
48
|
|
|
56
|
-
const truncateStr =
|
|
49
|
+
const truncateStr = (0, _values.isValueDefined)(ellipsis) ? ellipsis : TRUNCATE_ELLIPSIS;
|
|
57
50
|
|
|
58
51
|
if (frontLength === 0 && backLength === 0 || frontLength >= wordLength || backLength >= wordLength || frontLength + backLength >= wordLength) {
|
|
59
52
|
return word;
|
|
@@ -63,12 +56,6 @@ function truncateMiddle(word, headLength, tailLength, ellipsis) {
|
|
|
63
56
|
|
|
64
57
|
return word.slice(0, frontLength) + truncateStr + word.slice(wordLength - backLength);
|
|
65
58
|
}
|
|
66
|
-
/**
|
|
67
|
-
*
|
|
68
|
-
* @param {string} words
|
|
69
|
-
* @param {typeof TRUNCATE_DEFAULT_PROPS} props
|
|
70
|
-
*/
|
|
71
|
-
|
|
72
59
|
|
|
73
60
|
function truncateContent() {
|
|
74
61
|
let words = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/truncate/utils.
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/truncate/utils.ts"],"names":["TRUNCATE_ELLIPSIS","TRUNCATE_TYPE","auto","head","middle","tail","none","TRUNCATE_DEFAULT_PROPS","ellipsis","ellipsizeMode","limit","numberOfLines","truncateMiddle","word","headLength","tailLength","wordLength","length","frontLength","backLength","truncateStr","slice","truncateContent","words","props","mergedProps","truncateHead","truncateTail","Math","floor","truncatedContent"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAIO,MAAMA,iBAAiB,GAAG,GAA1B;;AACA,MAAMC,aAAa,GAAG;AAC5BC,EAAAA,IAAI,EAAE,MADsB;AAE5BC,EAAAA,IAAI,EAAE,MAFsB;AAG5BC,EAAAA,MAAM,EAAE,QAHoB;AAI5BC,EAAAA,IAAI,EAAE,MAJsB;AAK5BC,EAAAA,IAAI,EAAE;AALsB,CAAtB;;AAQA,MAAMC,sBAAsB,GAAG;AACrCC,EAAAA,QAAQ,EAAER,iBAD2B;AAErCS,EAAAA,aAAa,EAAER,aAAa,CAACC,IAFQ;AAGrCQ,EAAAA,KAAK,EAAE,CAH8B;AAIrCC,EAAAA,aAAa,EAAE;AAJsB,CAA/B,C,CAOP;AACA;;;;AACO,SAASC,cAAT,CACNC,IADM,EAENC,UAFM,EAGNC,UAHM,EAINP,QAJM,EAKL;AACD,MAAK,OAAOK,IAAP,KAAgB,QAArB,EAAgC;AAC/B,WAAO,EAAP;AACA;;AACD,QAAMG,UAAU,GAAGH,IAAI,CAACI,MAAxB,CAJC,CAKD;AACA;;AACA,QAAMC,WAAW,GAAG,CAAC,CAACJ,UAAtB,CAPC,CAOiC;AAClC;;AACA,QAAMK,UAAU,GAAG,CAAC,CAACJ,UAArB;AACA;;AACA,QAAMK,WAAW,GAAG,4BAAgBZ,QAAhB,IACjBA,QADiB,GAEjBR,iBAFH;;AAIA,MACGkB,W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Aa,CAACC,IAAhC,GACGU,cAAc,CAAEW,KAAF,EAASG,YAAT,EAAuBC,YAAvB,EAAqCnB,QAArC,CADjB,GAEGe,KAHJ;AAKA,SAAOO,gBAAP;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { isValueDefined } from '../utils/values';\nimport type { TruncateProps } from './types';\n\nexport const TRUNCATE_ELLIPSIS = '…';\nexport const TRUNCATE_TYPE = {\n\tauto: 'auto',\n\thead: 'head',\n\tmiddle: 'middle',\n\ttail: 'tail',\n\tnone: 'none',\n} as const;\n\nexport const TRUNCATE_DEFAULT_PROPS = {\n\tellipsis: TRUNCATE_ELLIPSIS,\n\tellipsizeMode: TRUNCATE_TYPE.auto,\n\tlimit: 0,\n\tnumberOfLines: 0,\n};\n\n// Source\n// https://github.com/kahwee/truncate-middle\nexport function truncateMiddle(\n\tword: string,\n\theadLength: number,\n\ttailLength: number,\n\tellipsis: string\n) {\n\tif ( typeof word !== 'string' ) {\n\t\treturn '';\n\t}\n\tconst wordLength = word.length;\n\t// Setting default values\n\t// eslint-disable-next-line no-bitwise\n\tconst frontLength = ~~headLength; // Will cast to integer\n\t// eslint-disable-next-line no-bitwise\n\tconst backLength = ~~tailLength;\n\t/* istanbul ignore next */\n\tconst truncateStr = isValueDefined( ellipsis )\n\t\t? ellipsis\n\t\t: TRUNCATE_ELLIPSIS;\n\n\tif (\n\t\t( frontLength === 0 && backLength === 0 ) ||\n\t\tfrontLength >= wordLength ||\n\t\tbackLength >= wordLength ||\n\t\tfrontLength + backLength >= wordLength\n\t) {\n\t\treturn word;\n\t} else if ( backLength === 0 ) {\n\t\treturn word.slice( 0, frontLength ) + truncateStr;\n\t}\n\treturn (\n\t\tword.slice( 0, frontLength ) +\n\t\ttruncateStr +\n\t\tword.slice( wordLength - backLength )\n\t);\n}\n\nexport function truncateContent(\n\twords: string = '',\n\tprops: Omit< TruncateProps, 'children' >\n) {\n\tconst mergedProps = { ...TRUNCATE_DEFAULT_PROPS, ...props };\n\tconst { ellipsis, ellipsizeMode, limit } = mergedProps;\n\n\tif ( ellipsizeMode === TRUNCATE_TYPE.none ) {\n\t\treturn words;\n\t}\n\n\tlet truncateHead: number;\n\tlet truncateTail: number;\n\n\tswitch ( ellipsizeMode ) {\n\t\tcase TRUNCATE_TYPE.head:\n\t\t\ttruncateHead = 0;\n\t\t\ttruncateTail = limit;\n\t\t\tbreak;\n\t\tcase TRUNCATE_TYPE.middle:\n\t\t\ttruncateHead = Math.floor( limit / 2 );\n\t\t\ttruncateTail = Math.floor( limit / 2 );\n\t\t\tbreak;\n\t\tdefault:\n\t\t\ttruncateHead = limit;\n\t\t\ttruncateTail = 0;\n\t}\n\n\tconst truncatedContent =\n\t\tellipsizeMode !== TRUNCATE_TYPE.auto\n\t\t\t? truncateMiddle( words, truncateHead, truncateTail, ellipsis )\n\t\t\t: words;\n\n\treturn truncatedContent;\n}\n"]}
|
package/build/utils/math.js
CHANGED
|
@@ -4,17 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.add = add;
|
|
7
|
+
exports.clamp = clamp;
|
|
7
8
|
exports.getNumber = getNumber;
|
|
8
9
|
exports.roundClamp = roundClamp;
|
|
9
10
|
exports.roundClampString = roundClampString;
|
|
10
11
|
exports.subtract = subtract;
|
|
11
12
|
|
|
12
|
-
var _lodash = require("lodash");
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* External dependencies
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
13
|
/**
|
|
19
14
|
* Parses and retrieves a number value.
|
|
20
15
|
*
|
|
@@ -78,6 +73,21 @@ function getPrecision(value) {
|
|
|
78
73
|
const split = (value + '').split('.');
|
|
79
74
|
return split[1] !== undefined ? split[1].length : 0;
|
|
80
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Clamps a value based on a min/max range.
|
|
78
|
+
*
|
|
79
|
+
* @param {number} value The value.
|
|
80
|
+
* @param {number} min The minimum range.
|
|
81
|
+
* @param {number} max The maximum range.
|
|
82
|
+
*
|
|
83
|
+
* @return {number} The clamped value.
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
function clamp(value, min, max) {
|
|
88
|
+
const baseValue = getNumber(value);
|
|
89
|
+
return Math.max(min, Math.min(baseValue, max));
|
|
90
|
+
}
|
|
81
91
|
/**
|
|
82
92
|
* Clamps a value based on a min/max range with rounding
|
|
83
93
|
*
|
|
@@ -99,7 +109,7 @@ function roundClamp() {
|
|
|
99
109
|
const stepValue = getNumber(step);
|
|
100
110
|
const precision = getPrecision(step);
|
|
101
111
|
const rounded = Math.round(baseValue / stepValue) * stepValue;
|
|
102
|
-
const clampedValue =
|
|
112
|
+
const clampedValue = clamp(rounded, min, max);
|
|
103
113
|
return precision ? getNumber(clampedValue.toFixed(precision)) : clampedValue;
|
|
104
114
|
}
|
|
105
115
|
/**
|
package/build/utils/math.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/utils/math.js"],"names":["getNumber","value","number","Number","isNaN","add","args","reduce","sum","arg","subtract","diff","index","getPrecision","split","undefined","length","
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/utils/math.js"],"names":["getNumber","value","number","Number","isNaN","add","args","reduce","sum","arg","subtract","diff","index","getPrecision","split","undefined","length","clamp","min","max","baseValue","Math","roundClamp","Infinity","step","stepValue","precision","rounded","round","clampedValue","toFixed","roundClampString","toString"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,SAAT,CAAoBC,KAApB,EAA4B;AAClC,QAAMC,MAAM,GAAGC,MAAM,CAAEF,KAAF,CAArB;AAEA,SAAOG,KAAK,CAAEF,MAAF,CAAL,GAAkB,CAAlB,GAAsBA,MAA7B;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASG,GAAT,GAAwB;AAAA,oCAAPC,IAAO;AAAPA,IAAAA,IAA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FKI,QAEL;AAAA,MADDC,IACC,uEADM,CACN;AACD,QAAMJ,SAAS,GAAGpB,SAAS,CAAEC,KAAF,CAA3B;AACA,QAAMwB,SAAS,GAAGzB,SAAS,CAAEwB,IAAF,CAA3B;AACA,QAAME,SAAS,GAAGb,YAAY,CAAEW,IAAF,CAA9B;AACA,QAAMG,OAAO,GAAGN,IAAI,CAACO,KAAL,CAAYR,SAAS,GAAGK,SAAxB,IAAsCA,SAAtD;AACA,QAAMI,YAAY,GAAGZ,KAAK,CAAEU,OAAF,EAAWT,GAAX,EAAgBC,GAAhB,CAA1B;AAEA,SAAOO,SAAS,GACb1B,SAAS,CAAE6B,YAAY,CAACC,OAAb,CAAsBJ,SAAtB,CAAF,CADI,GAEbG,YAFH;AAGA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASE,gBAAT,GAAqC;AAC3C,SAAOT,UAAU,CAAE,YAAF,CAAV,CAAsBU,QAAtB,EAAP;AACA","sourcesContent":["/**\n * Parses and retrieves a number value.\n *\n * @param {unknown} value The incoming value.\n *\n * @return {number} The parsed number value.\n */\nexport function getNumber( value ) {\n\tconst number = Number( value );\n\n\treturn isNaN( number ) ? 0 : number;\n}\n\n/**\n * Safely adds 2 values.\n *\n * @param {Array<number|string>} args Values to add together.\n *\n * @return {number} The sum of values.\n */\nexport function add( ...args ) {\n\treturn args.reduce(\n\t\t/** @type {(sum:number, arg: number|string) => number} */\n\t\t( sum, arg ) => sum + getNumber( arg ),\n\t\t0\n\t);\n}\n\n/**\n * Safely subtracts 2 values.\n *\n * @param {Array<number|string>} args Values to subtract together.\n *\n * @return {number} The difference of the values.\n */\nexport function subtract( ...args ) {\n\treturn args.reduce(\n\t\t/** @type {(diff:number, arg: number|string, index:number) => number} */\n\t\t( diff, arg, index ) => {\n\t\t\tconst value = getNumber( arg );\n\t\t\treturn index === 0 ? value : diff - value;\n\t\t},\n\t\t0\n\t);\n}\n\n/**\n * Determines the decimal position of a number value.\n *\n * @param {number} value The number to evaluate.\n *\n * @return {number} The number of decimal places.\n */\nfunction getPrecision( value ) {\n\tconst split = ( value + '' ).split( '.' );\n\treturn split[ 1 ] !== undefined ? split[ 1 ].length : 0;\n}\n\n/**\n * Clamps a value based on a min/max range.\n *\n * @param {number} value The value.\n * @param {number} min The minimum range.\n * @param {number} max The maximum range.\n *\n * @return {number} The clamped value.\n */\nexport function clamp( value, min, max ) {\n\tconst baseValue = getNumber( value );\n\treturn Math.max( min, Math.min( baseValue, max ) );\n}\n\n/**\n * Clamps a value based on a min/max range with rounding\n *\n * @param {number} value The value.\n * @param {number} min The minimum range.\n * @param {number} max The maximum range.\n * @param {number} step A multiplier for the value.\n *\n * @return {number} The rounded and clamped value.\n */\nexport function roundClamp(\n\tvalue = 0,\n\tmin = Infinity,\n\tmax = Infinity,\n\tstep = 1\n) {\n\tconst baseValue = getNumber( value );\n\tconst stepValue = getNumber( step );\n\tconst precision = getPrecision( step );\n\tconst rounded = Math.round( baseValue / stepValue ) * stepValue;\n\tconst clampedValue = clamp( rounded, min, max );\n\n\treturn precision\n\t\t? getNumber( clampedValue.toFixed( precision ) )\n\t\t: clampedValue;\n}\n\n/**\n * Clamps a value based on a min/max range with rounding.\n * Returns a string.\n *\n * @param {Parameters<typeof roundClamp>} args Arguments for roundClamp().\n * @return {string} The rounded and clamped value.\n */\nexport function roundClampString( ...args ) {\n\treturn roundClamp( ...args ).toString();\n}\n"]}
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default = void 0;
|
|
8
|
+
exports.default = exports.VStack = void 0;
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
@@ -18,25 +18,24 @@ var _view = require("../view");
|
|
|
18
18
|
var _hook = require("./hook");
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* External dependencies
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
26
|
-
* @param {import('react').ForwardedRef<any>} forwardedRef
|
|
25
|
+
* Internal dependencies
|
|
27
26
|
*/
|
|
28
|
-
function
|
|
27
|
+
function UnconnectedVStack(props, forwardedRef) {
|
|
29
28
|
const vStackProps = (0, _hook.useVStack)(props);
|
|
30
29
|
return (0, _element.createElement)(_view.View, (0, _extends2.default)({}, vStackProps, {
|
|
31
30
|
ref: forwardedRef
|
|
32
31
|
}));
|
|
33
32
|
}
|
|
34
33
|
/**
|
|
35
|
-
* `VStack` (or Vertical Stack) is a layout component that arranges child
|
|
34
|
+
* `VStack` (or Vertical Stack) is a layout component that arranges child
|
|
35
|
+
* elements in a vertical line.
|
|
36
36
|
*
|
|
37
37
|
* `VStack` can render anything inside.
|
|
38
38
|
*
|
|
39
|
-
* @example
|
|
40
39
|
* ```jsx
|
|
41
40
|
* import {
|
|
42
41
|
* __experimentalText as Text,
|
|
@@ -56,7 +55,8 @@ function VStack(props, forwardedRef) {
|
|
|
56
55
|
*/
|
|
57
56
|
|
|
58
57
|
|
|
59
|
-
const
|
|
60
|
-
|
|
58
|
+
const VStack = (0, _context.contextConnect)(UnconnectedVStack, 'VStack');
|
|
59
|
+
exports.VStack = VStack;
|
|
60
|
+
var _default = VStack;
|
|
61
61
|
exports.default = _default;
|
|
62
62
|
//# sourceMappingURL=component.js.map
|