@wordpress/components 19.11.0 → 19.12.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 +36 -0
- package/README.md +1 -1
- package/build/alignment-matrix-control/index.js +5 -2
- package/build/alignment-matrix-control/index.js.map +1 -1
- package/build/autocomplete/autocompleter-ui.js +1 -1
- package/build/autocomplete/autocompleter-ui.js.map +1 -1
- package/build/autocomplete/autocompleter-ui.native.js +2 -2
- package/build/autocomplete/autocompleter-ui.native.js.map +1 -1
- package/build/autocomplete/index.js +12 -10
- package/build/autocomplete/index.js.map +1 -1
- package/build/border-box-control/border-box-control/hook.js +2 -2
- package/build/border-box-control/border-box-control/hook.js.map +1 -1
- package/build/border-box-control/border-box-control-split-controls/component.js +2 -0
- package/build/border-box-control/border-box-control-split-controls/component.js.map +1 -1
- package/build/border-box-control/border-box-control-split-controls/hook.js +13 -4
- package/build/border-box-control/border-box-control-split-controls/hook.js.map +1 -1
- package/build/border-box-control/border-box-control-visualizer/hook.js +6 -2
- package/build/border-box-control/border-box-control-visualizer/hook.js.map +1 -1
- package/build/border-box-control/styles.js +21 -11
- package/build/border-box-control/styles.js.map +1 -1
- package/build/border-control/border-control/hook.js +2 -2
- package/build/border-control/border-control/hook.js.map +1 -1
- package/build/color-palette/index.js +9 -2
- package/build/color-palette/index.js.map +1 -1
- package/build/color-palette/index.native.js +4 -1
- package/build/color-palette/index.native.js.map +1 -1
- package/build/color-picker/color-copy-button.js +87 -0
- package/build/color-picker/color-copy-button.js.map +1 -0
- package/build/color-picker/component.js +5 -15
- package/build/color-picker/component.js.map +1 -1
- package/build/color-picker/hex-input.js +18 -1
- package/build/color-picker/hex-input.js.map +1 -1
- package/build/color-picker/styles.js +11 -11
- package/build/color-picker/styles.js.map +1 -1
- package/build/custom-gradient-picker/utils.js +1 -1
- package/build/custom-gradient-picker/utils.js.map +1 -1
- package/build/date-time/{date.js → date/index.js} +51 -12
- package/build/date-time/date/index.js.map +1 -0
- package/build/date-time/date/styles.js +70 -0
- package/build/date-time/date/styles.js.map +1 -0
- package/build/date-time/{utils.js → date/utils.js} +0 -0
- package/build/date-time/date/utils.js.map +1 -0
- package/build/date-time/date-time/index.js +175 -0
- package/build/date-time/date-time/index.js.map +1 -0
- package/build/date-time/date-time/styles.js +32 -0
- package/build/date-time/date-time/styles.js.map +1 -0
- package/build/date-time/index.js +2 -109
- package/build/date-time/index.js.map +1 -1
- package/build/date-time/time/index.js +322 -0
- package/build/date-time/time/index.js.map +1 -0
- package/build/date-time/time/styles.js +139 -0
- package/build/date-time/time/styles.js.map +1 -0
- package/build/date-time/{timezone.js → time/timezone.js} +4 -2
- package/build/date-time/time/timezone.js.map +1 -0
- package/build/draggable/index.native.js +10 -5
- package/build/draggable/index.native.js.map +1 -1
- package/build/dropdown/index.js +4 -1
- package/build/dropdown/index.js.map +1 -1
- package/build/input-control/index.js +9 -4
- package/build/input-control/index.js.map +1 -1
- package/build/input-control/input-field.js +1 -26
- package/build/input-control/input-field.js.map +1 -1
- package/build/input-control/reducer/reducer.js +36 -24
- package/build/input-control/reducer/reducer.js.map +1 -1
- package/build/input-control/reducer/state.js +0 -1
- package/build/input-control/reducer/state.js.map +1 -1
- package/build/input-control/utils.js +45 -0
- package/build/input-control/utils.js.map +1 -1
- package/build/popover/index.js +40 -33
- package/build/popover/index.js.map +1 -1
- package/build/search-control/index.js +4 -6
- package/build/search-control/index.js.map +1 -1
- package/build/select-control/index.js +3 -1
- package/build/select-control/index.js.map +1 -1
- package/build/spacer/hook.js +11 -3
- package/build/spacer/hook.js.map +1 -1
- package/build/surface/component.js +7 -7
- package/build/surface/component.js.map +1 -1
- package/build/surface/hook.js +8 -11
- package/build/surface/hook.js.map +1 -1
- package/build/surface/index.js.map +1 -1
- package/build/surface/styles.js +8 -48
- package/build/surface/styles.js.map +1 -1
- package/build/textarea-control/index.js +40 -6
- package/build/textarea-control/index.js.map +1 -1
- package/build/textarea-control/styles/textarea-control-styles.js +3 -3
- package/build/textarea-control/styles/textarea-control-styles.js.map +1 -1
- package/build/textarea-control/types.js +6 -0
- package/build/textarea-control/types.js.map +1 -0
- package/build/utils/hooks/index.js +0 -8
- package/build/utils/hooks/index.js.map +1 -1
- package/build-module/alignment-matrix-control/index.js +5 -2
- package/build-module/alignment-matrix-control/index.js.map +1 -1
- package/build-module/autocomplete/autocompleter-ui.js +1 -1
- package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
- package/build-module/autocomplete/autocompleter-ui.native.js +2 -2
- package/build-module/autocomplete/autocompleter-ui.native.js.map +1 -1
- package/build-module/autocomplete/index.js +13 -11
- package/build-module/autocomplete/index.js.map +1 -1
- package/build-module/border-box-control/border-box-control/hook.js +2 -2
- package/build-module/border-box-control/border-box-control/hook.js.map +1 -1
- package/build-module/border-box-control/border-box-control-split-controls/component.js +2 -0
- package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
- package/build-module/border-box-control/border-box-control-split-controls/hook.js +11 -4
- package/build-module/border-box-control/border-box-control-split-controls/hook.js.map +1 -1
- package/build-module/border-box-control/border-box-control-visualizer/hook.js +4 -2
- package/build-module/border-box-control/border-box-control-visualizer/hook.js.map +1 -1
- package/build-module/border-box-control/styles.js +13 -8
- package/build-module/border-box-control/styles.js.map +1 -1
- package/build-module/border-control/border-control/hook.js +2 -2
- package/build-module/border-control/border-control/hook.js.map +1 -1
- package/build-module/color-palette/index.js +7 -5
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/color-palette/index.native.js +4 -1
- package/build-module/color-palette/index.native.js.map +1 -1
- package/build-module/color-picker/color-copy-button.js +73 -0
- package/build-module/color-picker/color-copy-button.js.map +1 -0
- package/build-module/color-picker/component.js +6 -15
- package/build-module/color-picker/component.js.map +1 -1
- package/build-module/color-picker/hex-input.js +18 -1
- package/build-module/color-picker/hex-input.js.map +1 -1
- package/build-module/color-picker/styles.js +9 -9
- package/build-module/color-picker/styles.js.map +1 -1
- package/build-module/custom-gradient-picker/utils.js +1 -1
- package/build-module/custom-gradient-picker/utils.js.map +1 -1
- package/build-module/date-time/{date.js → date/index.js} +46 -14
- package/build-module/date-time/date/index.js.map +1 -0
- package/build-module/date-time/date/styles.js +61 -0
- package/build-module/date-time/date/styles.js.map +1 -0
- package/build-module/date-time/{utils.js → date/utils.js} +0 -0
- package/build-module/date-time/date/utils.js.map +1 -0
- package/build-module/date-time/date-time/index.js +144 -0
- package/build-module/date-time/date-time/index.js.map +1 -0
- package/build-module/date-time/date-time/styles.js +22 -0
- package/build-module/date-time/date-time/styles.js.map +1 -0
- package/build-module/date-time/index.js +1 -105
- package/build-module/date-time/index.js.map +1 -1
- package/build-module/date-time/time/index.js +302 -0
- package/build-module/date-time/time/index.js.map +1 -0
- package/build-module/date-time/time/styles.js +118 -0
- package/build-module/date-time/time/styles.js.map +1 -0
- package/build-module/date-time/{timezone.js → time/timezone.js} +3 -2
- package/build-module/date-time/time/timezone.js.map +1 -0
- package/build-module/draggable/index.native.js +10 -5
- package/build-module/draggable/index.native.js.map +1 -1
- package/build-module/dropdown/index.js +4 -1
- package/build-module/dropdown/index.js.map +1 -1
- package/build-module/input-control/index.js +8 -4
- package/build-module/input-control/index.js.map +1 -1
- package/build-module/input-control/input-field.js +1 -25
- package/build-module/input-control/input-field.js.map +1 -1
- package/build-module/input-control/reducer/reducer.js +38 -26
- package/build-module/input-control/reducer/reducer.js.map +1 -1
- package/build-module/input-control/reducer/state.js +0 -1
- package/build-module/input-control/reducer/state.js.map +1 -1
- package/build-module/input-control/utils.js +48 -2
- package/build-module/input-control/utils.js.map +1 -1
- package/build-module/popover/index.js +40 -33
- package/build-module/popover/index.js.map +1 -1
- package/build-module/search-control/index.js +6 -7
- package/build-module/search-control/index.js.map +1 -1
- package/build-module/select-control/index.js +3 -1
- package/build-module/select-control/index.js.map +1 -1
- package/build-module/spacer/hook.js +10 -2
- package/build-module/spacer/hook.js.map +1 -1
- package/build-module/surface/component.js +7 -7
- package/build-module/surface/component.js.map +1 -1
- package/build-module/surface/hook.js +8 -11
- package/build-module/surface/hook.js.map +1 -1
- package/build-module/surface/index.js.map +1 -1
- package/build-module/surface/styles.js +8 -48
- package/build-module/surface/styles.js.map +1 -1
- package/build-module/textarea-control/index.js +36 -5
- package/build-module/textarea-control/index.js.map +1 -1
- package/build-module/textarea-control/styles/textarea-control-styles.js +3 -3
- package/build-module/textarea-control/styles/textarea-control-styles.js.map +1 -1
- package/build-module/textarea-control/types.js +2 -0
- package/build-module/textarea-control/types.js.map +1 -0
- package/build-module/utils/hooks/index.js +0 -1
- package/build-module/utils/hooks/index.js.map +1 -1
- package/build-style/style-rtl.css +13 -188
- package/build-style/style.css +13 -191
- package/build-types/border-box-control/border-box-control-split-controls/component.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +1 -0
- 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.map +1 -1
- package/build-types/border-box-control/styles.d.ts +3 -2
- package/build-types/border-box-control/styles.d.ts.map +1 -1
- package/build-types/border-control/border-control/hook.d.ts.map +1 -1
- package/build-types/card/types.d.ts +1 -1
- package/build-types/card/types.d.ts.map +1 -1
- package/build-types/checkbox-control/test/index.d.ts +2 -0
- package/build-types/checkbox-control/test/index.d.ts.map +1 -0
- package/build-types/color-palette/index.d.ts +1 -0
- package/build-types/color-palette/index.d.ts.map +1 -1
- package/build-types/{date-time → color-palette}/test/utils.d.ts +0 -0
- package/build-types/color-palette/test/utils.d.ts.map +1 -0
- package/build-types/color-picker/color-copy-button.d.ts +4 -0
- package/build-types/color-picker/color-copy-button.d.ts.map +1 -0
- package/build-types/color-picker/component.d.ts.map +1 -1
- package/build-types/color-picker/hex-input.d.ts.map +1 -1
- package/build-types/color-picker/styles.d.ts +1 -1
- package/build-types/color-picker/styles.d.ts.map +1 -1
- package/build-types/color-picker/types.d.ts +8 -0
- package/build-types/color-picker/types.d.ts.map +1 -1
- package/build-types/date-time/{date.d.ts → date/index.d.ts} +3 -2
- package/build-types/date-time/date/index.d.ts.map +1 -0
- package/build-types/date-time/date/styles.d.ts +23 -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/utils.d.ts +2 -0
- package/build-types/date-time/date/test/utils.d.ts.map +1 -0
- package/build-types/date-time/{utils.d.ts → date/utils.d.ts} +0 -0
- package/build-types/date-time/date/utils.d.ts.map +1 -0
- package/build-types/date-time/date-time/index.d.ts +33 -0
- package/build-types/date-time/date-time/index.d.ts.map +1 -0
- package/build-types/date-time/date-time/styles.d.ts +6 -0
- package/build-types/date-time/date-time/styles.d.ts.map +1 -0
- package/build-types/date-time/index.d.ts +2 -28
- package/build-types/date-time/index.d.ts.map +1 -1
- package/build-types/date-time/stories/{index.d.ts → date-time.d.ts} +2 -2
- package/build-types/date-time/stories/date-time.d.ts.map +1 -0
- package/build-types/date-time/{time.d.ts → time/index.d.ts} +2 -2
- package/build-types/date-time/time/index.d.ts.map +1 -0
- package/build-types/date-time/time/styles.d.ts +111 -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/{timezone.d.ts → time/timezone.d.ts} +0 -0
- package/build-types/date-time/time/timezone.d.ts.map +1 -0
- package/build-types/date-time/types.d.ts +14 -15
- package/build-types/date-time/types.d.ts.map +1 -1
- package/build-types/dropdown/index.d.ts.map +1 -1
- package/build-types/input-control/index.d.ts.map +1 -1
- package/build-types/input-control/input-field.d.ts.map +1 -1
- package/build-types/input-control/reducer/reducer.d.ts +5 -3
- package/build-types/input-control/reducer/reducer.d.ts.map +1 -1
- package/build-types/input-control/reducer/state.d.ts +2 -2
- package/build-types/input-control/reducer/state.d.ts.map +1 -1
- package/build-types/input-control/utils.d.ts +17 -0
- package/build-types/input-control/utils.d.ts.map +1 -1
- package/build-types/popover/index.d.ts +1 -0
- package/build-types/popover/index.d.ts.map +1 -1
- package/build-types/select-control/index.d.ts.map +1 -1
- package/build-types/select-control/types.d.ts +1 -1
- package/build-types/select-control/types.d.ts.map +1 -1
- package/build-types/surface/component.d.ts +3 -2
- package/build-types/surface/component.d.ts.map +1 -1
- package/build-types/surface/hook.d.ts +4 -4
- package/build-types/surface/hook.d.ts.map +1 -1
- package/build-types/surface/index.d.ts +2 -2
- package/build-types/surface/index.d.ts.map +1 -1
- package/build-types/surface/stories/index.d.ts +12 -0
- package/build-types/surface/stories/index.d.ts.map +1 -0
- package/build-types/surface/styles.d.ts +10 -21
- package/build-types/surface/styles.d.ts.map +1 -1
- package/build-types/surface/test/index.d.ts +2 -0
- package/build-types/surface/test/index.d.ts.map +1 -0
- package/build-types/surface/types.d.ts +1 -1
- package/build-types/surface/types.d.ts.map +1 -1
- package/build-types/textarea-control/index.d.ts +29 -0
- package/build-types/textarea-control/index.d.ts.map +1 -0
- package/build-types/textarea-control/stories/index.d.ts +12 -0
- package/build-types/textarea-control/stories/index.d.ts.map +1 -0
- package/build-types/textarea-control/styles/textarea-control-styles.d.ts +6 -0
- package/build-types/textarea-control/styles/textarea-control-styles.d.ts.map +1 -0
- package/build-types/textarea-control/types.d.ts +26 -0
- package/build-types/textarea-control/types.d.ts.map +1 -0
- package/build-types/utils/hooks/index.d.ts +0 -1
- package/package.json +18 -18
- package/src/alignment-matrix-control/index.js +4 -2
- package/src/autocomplete/autocompleter-ui.js +1 -1
- package/src/autocomplete/autocompleter-ui.native.js +2 -2
- package/src/autocomplete/index.js +21 -9
- package/src/border-box-control/border-box-control/hook.ts +2 -2
- package/src/border-box-control/border-box-control-split-controls/component.tsx +2 -0
- package/src/border-box-control/border-box-control-split-controls/hook.ts +18 -4
- package/src/border-box-control/border-box-control-visualizer/hook.ts +5 -2
- package/src/border-box-control/styles.ts +6 -2
- package/src/border-control/border-control/hook.ts +8 -2
- package/src/box-control/test/index.js +120 -109
- package/src/card/types.ts +1 -1
- package/src/checkbox-control/test/__snapshots__/index.tsx.snap +42 -0
- package/src/checkbox-control/test/index.tsx +109 -0
- package/src/color-palette/index.js +11 -4
- package/src/color-palette/index.native.js +3 -0
- package/src/color-palette/stories/index.js +25 -1
- package/src/color-palette/test/utils.ts +24 -0
- package/src/color-picker/color-copy-button.tsx +76 -0
- package/src/color-picker/component.tsx +18 -38
- package/src/color-picker/hex-input.tsx +16 -0
- package/src/color-picker/styles.ts +5 -1
- package/src/color-picker/types.ts +9 -0
- package/src/custom-gradient-picker/utils.js +1 -1
- package/src/date-time/README.md +16 -0
- package/src/date-time/{datepicker.scss → date/datepicker.scss} +0 -0
- package/src/date-time/{date.tsx → date/index.tsx} +38 -15
- package/src/date-time/date/style.scss +75 -0
- package/src/date-time/date/styles.ts +55 -0
- package/src/date-time/{test/date.tsx → date/test/index.tsx} +1 -1
- package/src/date-time/{test → date/test}/utils.ts +0 -0
- package/src/date-time/{utils.ts → date/utils.ts} +0 -0
- package/src/date-time/date-time/index.tsx +217 -0
- package/src/date-time/date-time/styles.ts +8 -0
- package/src/date-time/index.ts +9 -0
- package/src/date-time/stories/{index.tsx → date-time.tsx} +1 -1
- package/src/date-time/style.scss +1 -262
- package/src/date-time/time/index.tsx +356 -0
- package/src/date-time/time/styles.ts +119 -0
- package/src/date-time/{test/time.tsx → time/test/index.tsx} +85 -38
- package/src/date-time/{timezone.tsx → time/timezone.tsx} +5 -2
- package/src/date-time/types.ts +16 -18
- package/src/draggable/index.native.js +14 -3
- package/src/draggable/test/index.native.js +130 -0
- package/src/dropdown/index.js +5 -1
- package/src/input-control/index.tsx +8 -2
- package/src/input-control/input-field.tsx +10 -30
- package/src/input-control/reducer/reducer.ts +40 -26
- package/src/input-control/reducer/state.ts +2 -3
- package/src/input-control/utils.ts +55 -1
- package/src/popover/index.js +42 -27
- package/src/query-controls/README.md +1 -1
- package/src/search-control/index.js +6 -7
- package/src/select-control/README.md +11 -0
- package/src/select-control/index.tsx +6 -1
- package/src/select-control/types.ts +1 -1
- package/src/slot-fill/README.md +1 -1
- package/src/spacer/hook.ts +13 -13
- package/src/surface/README.md +15 -15
- package/src/surface/{component.js → component.tsx} +13 -7
- package/src/surface/{hook.js → hook.ts} +13 -12
- package/src/surface/{index.js → index.ts} +0 -0
- package/src/surface/stories/index.tsx +40 -0
- package/src/surface/{styles.js → styles.ts} +15 -44
- package/src/surface/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
- package/src/surface/test/{index.js → index.tsx} +2 -1
- package/src/surface/types.ts +1 -1
- package/src/textarea-control/README.md +14 -20
- package/src/textarea-control/index.tsx +86 -0
- package/src/textarea-control/stories/index.tsx +58 -0
- package/src/textarea-control/styles/{textarea-control-styles.js → textarea-control-styles.ts} +0 -0
- package/src/textarea-control/types.ts +30 -0
- package/src/utils/hooks/index.js +0 -1
- package/tsconfig.json +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/color-picker/color-display.js +0 -184
- package/build/color-picker/color-display.js.map +0 -1
- package/build/date-time/date.js.map +0 -1
- package/build/date-time/time.js +0 -289
- package/build/date-time/time.js.map +0 -1
- package/build/date-time/timezone.js.map +0 -1
- package/build/date-time/utils.js.map +0 -1
- package/build/utils/hooks/use-combined-ref.js +0 -32
- package/build/utils/hooks/use-combined-ref.js.map +0 -1
- package/build-module/color-picker/color-display.js +0 -170
- package/build-module/color-picker/color-display.js.map +0 -1
- package/build-module/date-time/date.js.map +0 -1
- package/build-module/date-time/time.js +0 -271
- package/build-module/date-time/time.js.map +0 -1
- package/build-module/date-time/timezone.js.map +0 -1
- package/build-module/date-time/utils.js.map +0 -1
- package/build-module/utils/hooks/use-combined-ref.js +0 -28
- package/build-module/utils/hooks/use-combined-ref.js.map +0 -1
- package/build-types/color-picker/color-display.d.ts +0 -14
- package/build-types/color-picker/color-display.d.ts.map +0 -1
- package/build-types/date-time/date.d.ts.map +0 -1
- package/build-types/date-time/stories/index.d.ts.map +0 -1
- package/build-types/date-time/test/date.d.ts +0 -2
- package/build-types/date-time/test/date.d.ts.map +0 -1
- package/build-types/date-time/test/time.d.ts +0 -2
- package/build-types/date-time/test/time.d.ts.map +0 -1
- package/build-types/date-time/test/utils.d.ts.map +0 -1
- package/build-types/date-time/time.d.ts.map +0 -1
- package/build-types/date-time/timezone.d.ts.map +0 -1
- package/build-types/date-time/utils.d.ts.map +0 -1
- package/build-types/utils/hooks/use-combined-ref.d.ts +0 -8
- package/build-types/utils/hooks/use-combined-ref.d.ts.map +0 -1
- package/src/color-picker/color-display.tsx +0 -169
- package/src/date-time/index.tsx +0 -196
- package/src/date-time/time.tsx +0 -321
- package/src/surface/stories/index.js +0 -46
- package/src/textarea-control/index.js +0 -45
- package/src/textarea-control/stories/index.js +0 -48
- package/src/utils/hooks/use-combined-ref.ts +0 -28
|
@@ -1,22 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
borderRight?: boolean | undefined;
|
|
12
|
-
borderTop?: boolean | undefined;
|
|
13
|
-
}): import("@emotion/utils").SerializedStyles;
|
|
14
|
-
export const Surface: import("@emotion/utils").SerializedStyles;
|
|
15
|
-
export const background: import("@emotion/utils").SerializedStyles;
|
|
16
|
-
export const primary: import("@emotion/utils").SerializedStyles;
|
|
17
|
-
export const secondary: import("@emotion/utils").SerializedStyles;
|
|
18
|
-
export const tertiary: import("@emotion/utils").SerializedStyles;
|
|
19
|
-
export function getDotted(surfaceBackgroundSize: string, surfaceBackgroundSizeDotted: string): import("@emotion/utils").SerializedStyles;
|
|
20
|
-
export function getGrid(surfaceBackgroundSize: string): import('@emotion/react').SerializedStyles;
|
|
21
|
-
export function getVariant(variant: 'dotted' | 'grid' | 'primary' | 'secondary' | 'tertiary', surfaceBackgroundSize: string, surfaceBackgroundSizeDotted: string): import("@emotion/utils").SerializedStyles;
|
|
1
|
+
import type { SurfaceVariant, SurfaceProps } from './types';
|
|
2
|
+
export declare const Surface: import("@emotion/utils").SerializedStyles;
|
|
3
|
+
export declare const background: import("@emotion/utils").SerializedStyles;
|
|
4
|
+
export declare function getBorders({ borderBottom, borderLeft, borderRight, borderTop, }: Pick<SurfaceProps, 'borderBottom' | 'borderLeft' | 'borderRight' | 'borderTop'>): import("@emotion/utils").SerializedStyles;
|
|
5
|
+
export declare const primary: import("@emotion/utils").SerializedStyles;
|
|
6
|
+
export declare const secondary: import("@emotion/utils").SerializedStyles;
|
|
7
|
+
export declare const tertiary: import("@emotion/utils").SerializedStyles;
|
|
8
|
+
export declare const getDotted: (surfaceBackgroundSize: string, surfaceBackgroundSizeDotted: string) => import("@emotion/utils").SerializedStyles;
|
|
9
|
+
export declare const getGrid: (surfaceBackgroundSize: string) => import("@emotion/utils").SerializedStyles;
|
|
10
|
+
export declare const getVariant: (variant: SurfaceVariant, surfaceBackgroundSize: string, surfaceBackgroundSizeDotted: string) => import("@emotion/utils").SerializedStyles;
|
|
22
11
|
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/surface/styles.
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/surface/styles.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5D,eAAO,MAAM,OAAO,2CAInB,CAAC;AAEF,eAAO,MAAM,UAAU,2CAEtB,CAAC;AAEF,wBAAgB,UAAU,CAAE,EAC3B,YAAY,EACZ,UAAU,EACV,WAAW,EACX,SAAS,GACT,EAAE,IAAI,CACN,YAAY,EACZ,cAAc,GAAG,YAAY,GAAG,aAAa,GAAG,WAAW,CAC3D,6CASA;AAED,eAAO,MAAM,OAAO,2CAAQ,CAAC;AAE7B,eAAO,MAAM,SAAS,2CAErB,CAAC;AAEF,eAAO,MAAM,QAAQ,2CAEpB,CAAC;AAiCF,eAAO,MAAM,SAAS,0BACE,MAAM,+BACA,MAAM,8CAInC,CAAC;AAkBF,eAAO,MAAM,OAAO,0BAA4B,MAAM,8CAMrD,CAAC;AAEF,eAAO,MAAM,UAAU,YACb,cAAc,yBACA,MAAM,+BACA,MAAM,8CAsBnC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/surface/test/index.tsx"],"names":[],"mappings":""}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare type SurfaceVariant = 'primary' | 'secondary' | 'tertiary' | 'dotted' | 'grid';
|
|
3
|
-
export declare type
|
|
3
|
+
export declare type SurfaceProps = {
|
|
4
4
|
/**
|
|
5
5
|
* Determines the grid size for "dotted" and "grid" variants.
|
|
6
6
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/surface/types.ts"],"names":[],"mappings":";AAAA,oBAAY,cAAc,GACvB,SAAS,GACT,WAAW,GACX,UAAU,GACV,QAAQ,GACR,MAAM,CAAC;AAEV,oBAAY,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/surface/types.ts"],"names":[],"mappings":";AAAA,oBAAY,cAAc,GACvB,SAAS,GACT,WAAW,GACX,UAAU,GACV,QAAQ,GACR,MAAM,CAAC;AAEV,oBAAY,YAAY,GAAG;IAC1B;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { TextareaControlProps } from './types';
|
|
3
|
+
import type { WordPressComponentProps } from '../ui/context';
|
|
4
|
+
/**
|
|
5
|
+
* TextareaControls are TextControls that allow for multiple lines of text, and
|
|
6
|
+
* wrap overflow text onto a new line. They are a fixed height and scroll
|
|
7
|
+
* vertically when the cursor reaches the bottom of the field.
|
|
8
|
+
*
|
|
9
|
+
* ```jsx
|
|
10
|
+
* import { TextareaControl } from '@wordpress/components';
|
|
11
|
+
* import { useState } from '@wordpress/element';
|
|
12
|
+
*
|
|
13
|
+
* const MyTextareaControl = () => {
|
|
14
|
+
* const [ text, setText ] = useState( '' );
|
|
15
|
+
*
|
|
16
|
+
* return (
|
|
17
|
+
* <TextareaControl
|
|
18
|
+
* label="Text"
|
|
19
|
+
* help="Enter some text"
|
|
20
|
+
* value={ text }
|
|
21
|
+
* onChange={ ( value ) => setText( value ) }
|
|
22
|
+
* />
|
|
23
|
+
* );
|
|
24
|
+
* };
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function TextareaControl(props: Omit<WordPressComponentProps<TextareaControlProps, 'textarea', false>, 'ref'>): JSX.Element;
|
|
28
|
+
export default TextareaControl;
|
|
29
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/textarea-control/index.tsx"],"names":[],"mappings":";AAeA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,eAAe,CAG9B,KAAK,EAAE,IAAI,CACV,uBAAuB,CAAE,oBAAoB,EAAE,UAAU,EAAE,KAAK,CAAE,EAClE,KAAK,CACL,eAoCD;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
5
|
+
/**
|
|
6
|
+
* Internal dependencies
|
|
7
|
+
*/
|
|
8
|
+
import TextareaControl from '..';
|
|
9
|
+
declare const meta: ComponentMeta<typeof TextareaControl>;
|
|
10
|
+
export default meta;
|
|
11
|
+
export declare const Default: ComponentStory<typeof TextareaControl>;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/textarea-control/stories/index.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAOtE;;GAEG;AACH,OAAO,eAAe,MAAM,IAAI,CAAC;AAEjC,QAAA,MAAM,IAAI,EAAE,aAAa,CAAE,OAAO,eAAe,CAehD,CAAC;AACF,eAAe,IAAI,CAAC;AAoBpB,eAAO,MAAM,OAAO,EAAE,cAAc,CAAE,OAAO,eAAe,CAE3D,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const StyledTextarea: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
4
|
+
as?: import("react").ElementType<any> | undefined;
|
|
5
|
+
}, import("react").DetailedHTMLProps<import("react").TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, {}>;
|
|
6
|
+
//# sourceMappingURL=textarea-control-styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textarea-control-styles.d.ts","sourceRoot":"","sources":["../../../src/textarea-control/styles/textarea-control-styles.ts"],"names":[],"mappings":";AAUA,eAAO,MAAM,cAAc;;;2HAG1B,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { TextareaHTMLAttributes } from 'react';
|
|
5
|
+
/**
|
|
6
|
+
* Internal dependencies
|
|
7
|
+
*/
|
|
8
|
+
import type { BaseControlProps } from '../base-control/types';
|
|
9
|
+
export declare type TextareaControlProps = Pick<BaseControlProps, 'hideLabelFromVision' | 'help' | 'label'> & {
|
|
10
|
+
/**
|
|
11
|
+
* A function that receives the new value of the textarea each time it
|
|
12
|
+
* changes.
|
|
13
|
+
*/
|
|
14
|
+
onChange: (value: string) => void;
|
|
15
|
+
/**
|
|
16
|
+
* The current value of the textarea.
|
|
17
|
+
*/
|
|
18
|
+
value: string;
|
|
19
|
+
/**
|
|
20
|
+
* The number of rows the textarea should contain.
|
|
21
|
+
*
|
|
22
|
+
* @default 4
|
|
23
|
+
*/
|
|
24
|
+
rows?: TextareaHTMLAttributes<HTMLTextAreaElement>['rows'];
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/textarea-control/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAC;AAEpD;;GAEG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,oBAAY,oBAAoB,GAAG,IAAI,CACtC,gBAAgB,EAChB,qBAAqB,GAAG,MAAM,GAAG,OAAO,CACxC,GAAG;IACH;;;OAGG;IACH,QAAQ,EAAE,CAAE,KAAK,EAAE,MAAM,KAAM,IAAI,CAAC;IACpC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,IAAI,CAAC,EAAE,sBAAsB,CAAE,mBAAmB,CAAE,CAAE,MAAM,CAAE,CAAC;CAC/D,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { default as useControlledState } from "./use-controlled-state";
|
|
2
2
|
export { default as useUpdateEffect } from "./use-update-effect";
|
|
3
|
-
export { useCombinedRef } from "./use-combined-ref";
|
|
4
3
|
export { useControlledValue } from "./use-controlled-value";
|
|
5
4
|
export { useCx } from "./use-cx";
|
|
6
5
|
export { useLatestRef } from "./use-latest-ref";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/components",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.12.0",
|
|
4
4
|
"description": "UI components for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -38,21 +38,21 @@
|
|
|
38
38
|
"@emotion/utils": "1.0.0",
|
|
39
39
|
"@floating-ui/react-dom": "0.6.3",
|
|
40
40
|
"@use-gesture/react": "^10.2.6",
|
|
41
|
-
"@wordpress/a11y": "^3.
|
|
42
|
-
"@wordpress/compose": "^5.
|
|
43
|
-
"@wordpress/date": "^4.
|
|
44
|
-
"@wordpress/deprecated": "^3.
|
|
45
|
-
"@wordpress/dom": "^3.
|
|
46
|
-
"@wordpress/element": "^4.
|
|
47
|
-
"@wordpress/escape-html": "^2.
|
|
48
|
-
"@wordpress/hooks": "^3.
|
|
49
|
-
"@wordpress/i18n": "^4.
|
|
50
|
-
"@wordpress/icons": "^9.
|
|
51
|
-
"@wordpress/is-shallow-equal": "^4.
|
|
52
|
-
"@wordpress/keycodes": "^3.
|
|
53
|
-
"@wordpress/primitives": "^3.
|
|
54
|
-
"@wordpress/rich-text": "^5.
|
|
55
|
-
"@wordpress/warning": "^2.
|
|
41
|
+
"@wordpress/a11y": "^3.10.0",
|
|
42
|
+
"@wordpress/compose": "^5.8.0",
|
|
43
|
+
"@wordpress/date": "^4.10.0",
|
|
44
|
+
"@wordpress/deprecated": "^3.10.0",
|
|
45
|
+
"@wordpress/dom": "^3.10.0",
|
|
46
|
+
"@wordpress/element": "^4.8.0",
|
|
47
|
+
"@wordpress/escape-html": "^2.10.0",
|
|
48
|
+
"@wordpress/hooks": "^3.10.0",
|
|
49
|
+
"@wordpress/i18n": "^4.10.0",
|
|
50
|
+
"@wordpress/icons": "^9.1.0",
|
|
51
|
+
"@wordpress/is-shallow-equal": "^4.10.0",
|
|
52
|
+
"@wordpress/keycodes": "^3.10.0",
|
|
53
|
+
"@wordpress/primitives": "^3.8.0",
|
|
54
|
+
"@wordpress/rich-text": "^5.8.0",
|
|
55
|
+
"@wordpress/warning": "^2.10.0",
|
|
56
56
|
"classnames": "^2.3.1",
|
|
57
57
|
"colord": "^2.7.0",
|
|
58
58
|
"dom-scroll-into-view": "^1.2.1",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"highlight-words-core": "^1.2.2",
|
|
63
63
|
"lodash": "^4.17.21",
|
|
64
64
|
"memize": "^1.1.0",
|
|
65
|
-
"moment": "^2.
|
|
65
|
+
"moment": "^2.26.0",
|
|
66
66
|
"re-resizable": "^6.4.0",
|
|
67
67
|
"react-colorful": "^5.3.1",
|
|
68
68
|
"react-dates": "^21.8.0",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"publishConfig": {
|
|
77
77
|
"access": "public"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "a3e0b62091e8a8bdf5e2518e42d60d7098af48cc"
|
|
80
80
|
}
|
|
@@ -53,11 +53,13 @@ export default function AlignmentMatrixControl( {
|
|
|
53
53
|
onChange( nextValue );
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
+
const { setCurrentId } = composite;
|
|
57
|
+
|
|
56
58
|
useEffect( () => {
|
|
57
59
|
if ( typeof value !== 'undefined' ) {
|
|
58
|
-
|
|
60
|
+
setCurrentId( getItemId( baseId, value ) );
|
|
59
61
|
}
|
|
60
|
-
}, [ value,
|
|
62
|
+
}, [ value, setCurrentId, baseId ] );
|
|
61
63
|
|
|
62
64
|
const classes = classnames(
|
|
63
65
|
'component-alignment-matrix-control',
|
|
@@ -71,7 +71,7 @@ export function getAutoCompleterUI( autocompleter ) {
|
|
|
71
71
|
} else if ( isVisible && text.length === 0 ) {
|
|
72
72
|
startAnimation( false );
|
|
73
73
|
}
|
|
74
|
-
}, [ items, isVisible, text ] );
|
|
74
|
+
}, [ onChangeOptions, items, isVisible, text, startAnimation ] );
|
|
75
75
|
|
|
76
76
|
const activeItemStyles = usePreferredColorSchemeStyle(
|
|
77
77
|
styles[ 'components-autocomplete__item-active' ],
|
|
@@ -111,7 +111,7 @@ export function getAutoCompleterUI( autocompleter ) {
|
|
|
111
111
|
}
|
|
112
112
|
} );
|
|
113
113
|
},
|
|
114
|
-
[ isVisible ]
|
|
114
|
+
[ animationValue, isVisible, reset ]
|
|
115
115
|
);
|
|
116
116
|
|
|
117
117
|
const contentStyles = {
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
useEffect,
|
|
12
12
|
useState,
|
|
13
13
|
useRef,
|
|
14
|
+
useMemo,
|
|
14
15
|
} from '@wordpress/element';
|
|
15
16
|
import {
|
|
16
17
|
ENTER,
|
|
@@ -132,7 +133,7 @@ function useAutocomplete( {
|
|
|
132
133
|
const [ filterValue, setFilterValue ] = useState( '' );
|
|
133
134
|
const [ autocompleter, setAutocompleter ] = useState( null );
|
|
134
135
|
const [ AutocompleterUI, setAutocompleterUI ] = useState( null );
|
|
135
|
-
const
|
|
136
|
+
const backspacing = useRef( false );
|
|
136
137
|
|
|
137
138
|
function insertCompletion( replacement ) {
|
|
138
139
|
const end = record.start;
|
|
@@ -218,7 +219,7 @@ function useAutocomplete( {
|
|
|
218
219
|
}
|
|
219
220
|
|
|
220
221
|
function handleKeyDown( event ) {
|
|
221
|
-
|
|
222
|
+
backspacing.current = event.keyCode === BACKSPACE;
|
|
222
223
|
|
|
223
224
|
if ( ! autocompleter ) {
|
|
224
225
|
return;
|
|
@@ -268,11 +269,14 @@ function useAutocomplete( {
|
|
|
268
269
|
event.preventDefault();
|
|
269
270
|
}
|
|
270
271
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
272
|
+
// textContent is a primitive (string), memoizing is not strictly necessary
|
|
273
|
+
// but this is a preemptive performance improvement, since the autocompleter
|
|
274
|
+
// is a potential bottleneck for the editor type metric.
|
|
275
|
+
const textContent = useMemo( () => {
|
|
276
|
+
if ( isCollapsed( record ) ) {
|
|
277
|
+
return getTextContent( slice( record, 0 ) );
|
|
278
|
+
}
|
|
279
|
+
}, [ record ] );
|
|
276
280
|
|
|
277
281
|
useEffect( () => {
|
|
278
282
|
if ( ! textContent ) {
|
|
@@ -325,7 +329,8 @@ function useAutocomplete( {
|
|
|
325
329
|
// Ex: "Some text @marcelo sekkkk" <--- "kkkk" caused a mismatch, but
|
|
326
330
|
// if the user presses backspace here, it will show the completion popup again.
|
|
327
331
|
const matchingWhileBackspacing =
|
|
328
|
-
backspacing &&
|
|
332
|
+
backspacing.current &&
|
|
333
|
+
textWithoutTrigger.split( /\s/ ).length <= 3;
|
|
329
334
|
|
|
330
335
|
if (
|
|
331
336
|
mismatch &&
|
|
@@ -370,7 +375,14 @@ function useAutocomplete( {
|
|
|
370
375
|
: AutocompleterUI
|
|
371
376
|
);
|
|
372
377
|
setFilterValue( query );
|
|
373
|
-
}, [
|
|
378
|
+
}, [
|
|
379
|
+
textContent,
|
|
380
|
+
AutocompleterUI,
|
|
381
|
+
autocompleter,
|
|
382
|
+
completers,
|
|
383
|
+
record,
|
|
384
|
+
filteredOptions.length,
|
|
385
|
+
] );
|
|
374
386
|
|
|
375
387
|
const { key: selectedKey = '' } = filteredOptions[ selectedIndex ] || {};
|
|
376
388
|
const { className } = autocompleter || {};
|
|
@@ -98,11 +98,11 @@ export function useBorderBoxControl(
|
|
|
98
98
|
const cx = useCx();
|
|
99
99
|
const classes = useMemo( () => {
|
|
100
100
|
return cx( styles.BorderBoxControl, className );
|
|
101
|
-
}, [ className ] );
|
|
101
|
+
}, [ cx, className ] );
|
|
102
102
|
|
|
103
103
|
const linkedControlClassName = useMemo( () => {
|
|
104
104
|
return cx( styles.LinkedBorderControl );
|
|
105
|
-
}, [] );
|
|
105
|
+
}, [ cx ] );
|
|
106
106
|
|
|
107
107
|
return {
|
|
108
108
|
...otherProps,
|
|
@@ -29,6 +29,7 @@ const BorderBoxControlSplitControls = (
|
|
|
29
29
|
onChange,
|
|
30
30
|
popoverPlacement,
|
|
31
31
|
popoverOffset,
|
|
32
|
+
rightAlignedClassName,
|
|
32
33
|
value,
|
|
33
34
|
__experimentalHasMultipleOrigins,
|
|
34
35
|
__experimentalIsRenderedInSidebar,
|
|
@@ -80,6 +81,7 @@ const BorderBoxControlSplitControls = (
|
|
|
80
81
|
{ ...sharedBorderControlProps }
|
|
81
82
|
/>
|
|
82
83
|
<BorderControl
|
|
84
|
+
className={ rightAlignedClassName }
|
|
83
85
|
hideLabelFromVision={ true }
|
|
84
86
|
label={ __( 'Right border' ) }
|
|
85
87
|
onChange={ ( newBorder ) => onChange( newBorder, 'right' ) }
|
|
@@ -22,13 +22,27 @@ export function useBorderBoxControlSplitControls(
|
|
|
22
22
|
|
|
23
23
|
// Generate class names.
|
|
24
24
|
const cx = useCx();
|
|
25
|
+
const rtlWatchResult = rtl.watch();
|
|
25
26
|
const classes = useMemo( () => {
|
|
26
|
-
return cx( styles.
|
|
27
|
-
|
|
27
|
+
return cx( styles.borderBoxControlSplitControls(), className );
|
|
28
|
+
// rtlWatchResult is needed to refresh styles when the writing direction changes
|
|
29
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
30
|
+
}, [ cx, className, rtlWatchResult ] );
|
|
28
31
|
|
|
29
32
|
const centeredClassName = useMemo( () => {
|
|
30
33
|
return cx( styles.CenteredBorderControl, className );
|
|
31
|
-
}, [] );
|
|
34
|
+
}, [ cx, className ] );
|
|
32
35
|
|
|
33
|
-
|
|
36
|
+
const rightAlignedClassName = useMemo( () => {
|
|
37
|
+
return cx( styles.rightBorderControl(), className );
|
|
38
|
+
// rtlWatchResult is needed to refresh styles when the writing direction changes
|
|
39
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
40
|
+
}, [ cx, className, rtlWatchResult ] );
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
...otherProps,
|
|
44
|
+
centeredClassName,
|
|
45
|
+
className: classes,
|
|
46
|
+
rightAlignedClassName,
|
|
47
|
+
};
|
|
34
48
|
}
|
|
@@ -24,12 +24,15 @@ export function useBorderBoxControlVisualizer(
|
|
|
24
24
|
|
|
25
25
|
// Generate class names.
|
|
26
26
|
const cx = useCx();
|
|
27
|
+
const rtlWatchResult = rtl.watch();
|
|
27
28
|
const classes = useMemo( () => {
|
|
28
29
|
return cx(
|
|
29
|
-
styles.
|
|
30
|
+
styles.borderBoxControlVisualizer( value, __next36pxDefaultSize ),
|
|
30
31
|
className
|
|
31
32
|
);
|
|
32
|
-
|
|
33
|
+
// rtlWatchResult is needed to refresh styles when the writing direction changes
|
|
34
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
35
|
+
}, [ cx, className, value, __next36pxDefaultSize, rtlWatchResult ] );
|
|
33
36
|
|
|
34
37
|
return { ...otherProps, className: classes, value };
|
|
35
38
|
}
|
|
@@ -43,7 +43,7 @@ const BorderBoxStyleWithFallback = ( border?: Border ) => {
|
|
|
43
43
|
return `${ color } ${ borderStyle } ${ clampedWidth }`;
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
export const
|
|
46
|
+
export const borderBoxControlVisualizer = (
|
|
47
47
|
borders?: Borders,
|
|
48
48
|
__next36pxDefaultSize?: boolean
|
|
49
49
|
) => {
|
|
@@ -64,7 +64,7 @@ export const BorderBoxControlVisualizer = (
|
|
|
64
64
|
`;
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
-
export const
|
|
67
|
+
export const borderBoxControlSplitControls = () => css`
|
|
68
68
|
position: relative;
|
|
69
69
|
flex: 1;
|
|
70
70
|
${ rtl( { marginRight: space( 3 ) }, { marginLeft: space( 3 ) } )() }
|
|
@@ -74,3 +74,7 @@ export const CenteredBorderControl = css`
|
|
|
74
74
|
grid-column: span 2;
|
|
75
75
|
margin: 0 auto;
|
|
76
76
|
`;
|
|
77
|
+
|
|
78
|
+
export const rightBorderControl = () => css`
|
|
79
|
+
${ rtl( { marginLeft: 'auto' }, { marginRight: 'auto' } )() }
|
|
80
|
+
`;
|
|
@@ -56,7 +56,7 @@ export function useBorderControl(
|
|
|
56
56
|
|
|
57
57
|
onChange( newBorder );
|
|
58
58
|
},
|
|
59
|
-
[ onChange, shouldSanitizeBorder
|
|
59
|
+
[ onChange, shouldSanitizeBorder ]
|
|
60
60
|
);
|
|
61
61
|
|
|
62
62
|
const onWidthChange = useCallback(
|
|
@@ -97,7 +97,13 @@ export function useBorderControl(
|
|
|
97
97
|
|
|
98
98
|
onBorderChange( updatedBorder );
|
|
99
99
|
},
|
|
100
|
-
[
|
|
100
|
+
[
|
|
101
|
+
border,
|
|
102
|
+
hadPreviousZeroWidth,
|
|
103
|
+
colorSelection,
|
|
104
|
+
styleSelection,
|
|
105
|
+
onBorderChange,
|
|
106
|
+
]
|
|
101
107
|
);
|
|
102
108
|
|
|
103
109
|
const onSliderChange = useCallback(
|