@wordpress/components 32.5.0 → 32.6.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/AGENTS.md +2 -2
- package/CHANGELOG.md +40 -0
- package/README.md +18 -4
- package/build/alignment-matrix-control/cell.cjs +3 -3
- package/build/alignment-matrix-control/cell.cjs.map +2 -2
- package/build/alignment-matrix-control/index.cjs +3 -3
- package/build/alignment-matrix-control/index.cjs.map +2 -2
- package/build/autocomplete/autocompleter-ui.cjs +75 -79
- package/build/autocomplete/autocompleter-ui.cjs.map +2 -2
- package/build/autocomplete/get-autocomplete-match.cjs +91 -0
- package/build/autocomplete/get-autocomplete-match.cjs.map +7 -0
- package/build/autocomplete/index.cjs +104 -107
- package/build/autocomplete/index.cjs.map +3 -3
- package/build/box-control/index.cjs +0 -8
- package/build/box-control/index.cjs.map +2 -2
- package/build/box-control/utils.cjs +1 -10
- package/build/box-control/utils.cjs.map +2 -2
- package/build/calendar/utils/use-localization-props.cjs +3 -2
- package/build/calendar/utils/use-localization-props.cjs.map +2 -2
- package/build/custom-gradient-picker/index.cjs.map +2 -2
- package/build/custom-select-control/index.cjs.map +3 -3
- package/build/custom-select-control-v2/custom-select.cjs +2 -2
- package/build/custom-select-control-v2/custom-select.cjs.map +2 -2
- package/build/custom-select-control-v2/index.cjs.map +3 -3
- package/build/date-time/{date → date-picker}/index.cjs +6 -6
- package/build/date-time/{date → date-picker}/index.cjs.map +2 -2
- package/build/date-time/{date → date-picker}/styles.cjs +17 -17
- package/build/date-time/{date → date-picker}/styles.cjs.map +2 -2
- package/build/date-time/{date → date-picker}/use-lilius/index.cjs +1 -1
- package/build/date-time/{date → date-picker}/use-lilius/index.cjs.map +1 -1
- package/build/date-time/date-time/index.cjs +6 -6
- package/build/date-time/date-time/index.cjs.map +2 -2
- package/build/date-time/index.cjs +4 -4
- package/build/date-time/index.cjs.map +2 -2
- package/build/date-time/{time → time-picker}/index.cjs +6 -6
- package/build/date-time/time-picker/index.cjs.map +7 -0
- package/build/date-time/{time → time-picker}/styles.cjs +21 -21
- package/build/date-time/{time → time-picker}/styles.cjs.map +2 -2
- package/build/date-time/{time → time-picker}/time-input/index.cjs +1 -1
- package/build/date-time/{time → time-picker}/time-input/index.cjs.map +1 -1
- package/build/date-time/{time → time-picker}/timezone.cjs +1 -1
- package/build/date-time/{time → time-picker}/timezone.cjs.map +1 -1
- package/build/modal/index.cjs.map +2 -2
- package/build/palette-edit/index.cjs.map +2 -2
- package/build/radio-control/index.cjs +2 -0
- package/build/radio-control/index.cjs.map +2 -2
- package/build/sandbox/index.cjs +127 -3
- package/build/sandbox/index.cjs.map +2 -2
- package/build/textarea-control/styles/textarea-control-styles.cjs +3 -3
- package/build/textarea-control/styles/textarea-control-styles.cjs.map +2 -2
- package/build/validated-form-controls/control-with-error.cjs +12 -8
- package/build/validated-form-controls/control-with-error.cjs.map +2 -2
- package/build-module/alignment-matrix-control/cell.mjs +3 -3
- package/build-module/alignment-matrix-control/cell.mjs.map +2 -2
- package/build-module/alignment-matrix-control/index.mjs +3 -3
- package/build-module/alignment-matrix-control/index.mjs.map +2 -2
- package/build-module/autocomplete/autocompleter-ui.mjs +74 -78
- package/build-module/autocomplete/autocompleter-ui.mjs.map +2 -2
- package/build-module/autocomplete/get-autocomplete-match.mjs +56 -0
- package/build-module/autocomplete/get-autocomplete-match.mjs.map +7 -0
- package/build-module/autocomplete/index.mjs +103 -107
- package/build-module/autocomplete/index.mjs.map +3 -3
- package/build-module/box-control/index.mjs +1 -9
- package/build-module/box-control/index.mjs.map +2 -2
- package/build-module/box-control/utils.mjs +1 -9
- package/build-module/box-control/utils.mjs.map +2 -2
- package/build-module/calendar/utils/use-localization-props.mjs +3 -2
- package/build-module/calendar/utils/use-localization-props.mjs.map +2 -2
- package/build-module/custom-gradient-picker/index.mjs.map +2 -2
- package/build-module/custom-select-control/index.mjs +2 -2
- package/build-module/custom-select-control/index.mjs.map +2 -2
- package/build-module/custom-select-control-v2/custom-select.mjs +2 -2
- package/build-module/custom-select-control-v2/custom-select.mjs.map +2 -2
- package/build-module/custom-select-control-v2/index.mjs +2 -2
- package/build-module/custom-select-control-v2/index.mjs.map +2 -2
- package/build-module/date-time/{date → date-picker}/index.mjs +3 -3
- package/build-module/date-time/{date → date-picker}/index.mjs.map +2 -2
- package/build-module/date-time/{date → date-picker}/styles.mjs +17 -17
- package/build-module/date-time/{date → date-picker}/styles.mjs.map +2 -2
- package/build-module/date-time/{date → date-picker}/use-lilius/index.mjs +1 -1
- package/build-module/date-time/{date → date-picker}/use-lilius/index.mjs.map +1 -1
- package/build-module/date-time/date-time/index.mjs +2 -2
- package/build-module/date-time/date-time/index.mjs.map +1 -1
- package/build-module/date-time/index.mjs +2 -2
- package/build-module/date-time/index.mjs.map +1 -1
- package/build-module/date-time/{time → time-picker}/index.mjs +3 -3
- package/build-module/date-time/time-picker/index.mjs.map +7 -0
- package/build-module/date-time/{time → time-picker}/styles.mjs +21 -21
- package/build-module/date-time/{time → time-picker}/styles.mjs.map +2 -2
- package/build-module/date-time/{time → time-picker}/time-input/index.mjs +1 -1
- package/build-module/date-time/{time → time-picker}/time-input/index.mjs.map +1 -1
- package/build-module/date-time/{time → time-picker}/timezone.mjs +1 -1
- package/build-module/date-time/{time → time-picker}/timezone.mjs.map +1 -1
- package/build-module/modal/index.mjs.map +2 -2
- package/build-module/palette-edit/index.mjs.map +2 -2
- package/build-module/radio-control/index.mjs +2 -0
- package/build-module/radio-control/index.mjs.map +2 -2
- package/build-module/sandbox/index.mjs +128 -4
- package/build-module/sandbox/index.mjs.map +2 -2
- package/build-module/textarea-control/styles/textarea-control-styles.mjs +3 -3
- package/build-module/textarea-control/styles/textarea-control-styles.mjs.map +2 -2
- package/build-module/validated-form-controls/control-with-error.mjs +12 -8
- package/build-module/validated-form-controls/control-with-error.mjs.map +2 -2
- package/build-style/style-rtl.css +83 -26
- package/build-style/style.css +83 -26
- package/build-types/autocomplete/autocompleter-ui.d.ts +2 -2
- package/build-types/autocomplete/autocompleter-ui.d.ts.map +1 -1
- package/build-types/autocomplete/get-autocomplete-match.d.ts +11 -0
- package/build-types/autocomplete/get-autocomplete-match.d.ts.map +1 -0
- package/build-types/autocomplete/index.d.ts +8 -0
- package/build-types/autocomplete/index.d.ts.map +1 -1
- package/build-types/autocomplete/test/get-autocomplete-match.d.ts +2 -0
- package/build-types/autocomplete/test/get-autocomplete-match.d.ts.map +1 -0
- package/build-types/autocomplete/types.d.ts +23 -9
- package/build-types/autocomplete/types.d.ts.map +1 -1
- package/build-types/box-control/index.d.ts.map +1 -1
- package/build-types/box-control/utils.d.ts +7 -16
- package/build-types/box-control/utils.d.ts.map +1 -1
- package/build-types/button/stories/index.story.d.ts +0 -1
- package/build-types/button/stories/index.story.d.ts.map +1 -1
- package/build-types/calendar/utils/use-localization-props.d.ts +3 -3
- package/build-types/calendar/utils/use-localization-props.d.ts.map +1 -1
- package/build-types/checkbox-control/types.d.ts +4 -0
- package/build-types/checkbox-control/types.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/constants.d.ts +2 -2
- package/build-types/custom-gradient-picker/index.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/custom-select.d.ts +3 -3
- package/build-types/custom-select-control-v2/custom-select.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/types.d.ts +1 -1
- package/build-types/custom-select-control-v2/types.d.ts.map +1 -1
- package/build-types/date-time/date-picker/index.d.ts.map +1 -0
- package/build-types/date-time/date-picker/styles.d.ts.map +1 -0
- package/build-types/date-time/date-picker/test/index.d.ts.map +1 -0
- package/build-types/date-time/date-picker/test/use-lilius.d.ts.map +1 -0
- package/build-types/date-time/date-picker/use-lilius/index.d.ts.map +1 -0
- package/build-types/date-time/date-time/index.d.ts +2 -2
- package/build-types/date-time/date-time/index.d.ts.map +1 -1
- package/build-types/date-time/index.d.ts +2 -2
- package/build-types/date-time/index.d.ts.map +1 -1
- package/build-types/date-time/stories/date.story.d.ts +1 -1
- package/build-types/date-time/stories/date.story.d.ts.map +1 -1
- package/build-types/date-time/stories/time.story.d.ts +1 -1
- package/build-types/date-time/stories/time.story.d.ts.map +1 -1
- package/build-types/date-time/{time → time-picker}/index.d.ts +1 -1
- package/build-types/date-time/time-picker/index.d.ts.map +1 -0
- package/build-types/date-time/time-picker/styles.d.ts.map +1 -0
- package/build-types/date-time/time-picker/test/index.d.ts.map +1 -0
- package/build-types/date-time/time-picker/time-input/index.d.ts.map +1 -0
- package/build-types/date-time/time-picker/time-input/test/index.d.ts.map +1 -0
- package/build-types/date-time/time-picker/timezone.d.ts.map +1 -0
- package/build-types/date-time/types.d.ts +1 -1
- package/build-types/date-time/types.d.ts.map +1 -1
- package/build-types/font-size-picker/constants.d.ts +2 -2
- package/build-types/font-size-picker/constants.d.ts.map +1 -1
- package/build-types/modal/index.d.ts.map +1 -1
- package/build-types/palette-edit/index.d.ts +1 -1
- package/build-types/palette-edit/index.d.ts.map +1 -1
- package/build-types/radio-control/index.d.ts.map +1 -1
- package/build-types/radio-control/types.d.ts +6 -0
- package/build-types/radio-control/types.d.ts.map +1 -1
- package/build-types/sandbox/index.d.ts +1 -1
- package/build-types/sandbox/index.d.ts.map +1 -1
- package/build-types/sandbox/types.d.ts +11 -0
- package/build-types/sandbox/types.d.ts.map +1 -1
- package/build-types/textarea-control/stories/index.story.d.ts.map +1 -1
- package/build-types/textarea-control/styles/textarea-control-styles.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/checkbox-control.d.ts +2 -1
- package/build-types/validated-form-controls/components/checkbox-control.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/radio-control.d.ts +2 -1
- package/build-types/validated-form-controls/components/radio-control.d.ts.map +1 -1
- package/build-types/validated-form-controls/control-with-error.d.ts.map +1 -1
- package/package.json +21 -21
- package/src/alignment-matrix-control/README.md +1 -1
- package/src/alignment-matrix-control/style.module.scss +1 -1
- package/src/angle-picker-control/style.module.scss +1 -0
- package/src/autocomplete/README.md +2 -2
- package/src/autocomplete/autocompleter-ui.native.js +166 -173
- package/src/autocomplete/autocompleter-ui.tsx +114 -116
- package/src/autocomplete/get-autocomplete-match.ts +115 -0
- package/src/autocomplete/index.tsx +129 -208
- package/src/autocomplete/test/get-autocomplete-match.ts +338 -0
- package/src/autocomplete/test/index.tsx +112 -4
- package/src/autocomplete/types.ts +17 -10
- package/src/box-control/index.tsx +1 -19
- package/src/box-control/utils.ts +1 -19
- package/src/button/README.md +1 -1
- package/src/button/stories/index.story.tsx +0 -1
- package/src/button/style.scss +1 -7
- package/src/calendar/style.scss +3 -3
- package/src/calendar/utils/use-localization-props.ts +3 -4
- package/src/checkbox-control/style.scss +17 -5
- package/src/checkbox-control/types.ts +4 -0
- package/src/circular-option-picker/style.scss +1 -1
- package/src/color-palette/style.scss +1 -1
- package/src/css.d.ts +1 -0
- package/src/custom-gradient-picker/index.tsx +1 -0
- package/src/custom-select-control/index.tsx +3 -3
- package/src/custom-select-control-v2/custom-select.tsx +4 -4
- package/src/custom-select-control-v2/index.tsx +2 -2
- package/src/custom-select-control-v2/types.ts +1 -1
- package/src/date-time/README.md +3 -3
- package/src/date-time/date-picker/README.md +65 -0
- package/src/date-time/date-time/index.tsx +2 -2
- package/src/date-time/index.ts +2 -2
- package/src/date-time/stories/date.story.tsx +1 -1
- package/src/date-time/stories/time.story.tsx +1 -1
- package/src/date-time/time-picker/README.md +119 -0
- package/src/date-time/{time → time-picker}/index.tsx +1 -1
- package/src/date-time/types.ts +1 -1
- package/src/divider/README.md +5 -6
- package/src/dropdown-menu/style.scss +1 -1
- package/src/flex/stories/index.story.tsx +1 -1
- package/src/form-file-upload/README.md +3 -3
- package/src/form-toggle/style.scss +35 -2
- package/src/form-token-field/style.scss +12 -3
- package/src/gradient-picker/README.md +2 -2
- package/src/h-stack/README.md +10 -15
- package/src/h-stack/stories/index.story.tsx +2 -2
- package/src/heading/stories/index.story.tsx +1 -1
- package/src/higher-order/with-focus-outside/index.native.js +21 -20
- package/src/icon/README.md +1 -1
- package/src/menu/README.md +2 -2
- package/src/mobile/utils/get-px-from-css-unit.native.js +1 -1
- package/src/modal/index.tsx +1 -0
- package/src/palette-edit/index.tsx +1 -0
- package/src/radio-control/index.tsx +2 -0
- package/src/radio-control/style.scss +21 -2
- package/src/radio-control/test/index.tsx +10 -0
- package/src/radio-control/types.ts +6 -0
- package/src/sandbox/index.native.js +2 -2
- package/src/sandbox/index.tsx +191 -11
- package/src/sandbox/test/index.tsx +65 -24
- package/src/sandbox/types.ts +11 -0
- package/src/snackbar/style.scss +2 -2
- package/src/tab-panel/style.scss +1 -1
- package/src/tabs/README.md +6 -6
- package/src/text/stories/index.story.tsx +1 -1
- package/src/textarea-control/stories/index.story.tsx +3 -0
- package/src/textarea-control/styles/textarea-control-styles.ts +6 -0
- package/src/toggle-control/style.scss +1 -1
- package/src/toggle-control/test/index.tsx +8 -2
- package/src/toolbar/toolbar-button/toolbar-button-container.native.js +3 -1
- package/src/tree-select/README.md +1 -1
- package/src/v-stack/README.md +10 -15
- package/src/v-stack/stories/index.story.tsx +2 -2
- package/src/validated-form-controls/control-with-error.tsx +17 -12
- package/src/validated-form-controls/test/control-with-error.tsx +28 -1
- package/src/view/README.md +2 -5
- package/build/date-time/time/index.cjs.map +0 -7
- package/build-module/date-time/time/index.mjs.map +0 -7
- package/build-types/date-time/date/index.d.ts.map +0 -1
- package/build-types/date-time/date/styles.d.ts.map +0 -1
- package/build-types/date-time/date/test/index.d.ts.map +0 -1
- package/build-types/date-time/date/test/use-lilius.d.ts.map +0 -1
- package/build-types/date-time/date/use-lilius/index.d.ts.map +0 -1
- package/build-types/date-time/time/index.d.ts.map +0 -1
- package/build-types/date-time/time/styles.d.ts.map +0 -1
- package/build-types/date-time/time/test/index.d.ts.map +0 -1
- package/build-types/date-time/time/time-input/index.d.ts.map +0 -1
- package/build-types/date-time/time/time-input/test/index.d.ts.map +0 -1
- package/build-types/date-time/time/timezone.d.ts.map +0 -1
- package/src/button/stories/style.css +0 -8
- /package/build-types/date-time/{date → date-picker}/index.d.ts +0 -0
- /package/build-types/date-time/{date → date-picker}/styles.d.ts +0 -0
- /package/build-types/date-time/{date → date-picker}/test/index.d.ts +0 -0
- /package/build-types/date-time/{date → date-picker}/test/use-lilius.d.ts +0 -0
- /package/build-types/date-time/{date → date-picker}/use-lilius/index.d.ts +0 -0
- /package/build-types/date-time/{time → time-picker}/styles.d.ts +0 -0
- /package/build-types/date-time/{time → time-picker}/test/index.d.ts +0 -0
- /package/build-types/date-time/{time → time-picker}/time-input/index.d.ts +0 -0
- /package/build-types/date-time/{time → time-picker}/time-input/test/index.d.ts +0 -0
- /package/build-types/date-time/{time → time-picker}/timezone.d.ts +0 -0
- /package/src/date-time/{date → date-picker}/index.tsx +0 -0
- /package/src/date-time/{date → date-picker}/styles.ts +0 -0
- /package/src/date-time/{date → date-picker}/test/index.tsx +0 -0
- /package/src/date-time/{date → date-picker}/test/use-lilius.ts +0 -0
- /package/src/date-time/{date → date-picker}/use-lilius/index.ts +0 -0
- /package/src/date-time/{time → time-picker}/styles.ts +0 -0
- /package/src/date-time/{time → time-picker}/test/index.tsx +0 -0
- /package/src/date-time/{time → time-picker}/time-input/index.tsx +0 -0
- /package/src/date-time/{time → time-picker}/time-input/test/index.tsx +0 -0
- /package/src/date-time/{time → time-picker}/timezone.tsx +0 -0
|
@@ -10,10 +10,9 @@ import type { Modifiers, BaseProps } from '../types';
|
|
|
10
10
|
|
|
11
11
|
function isLocaleRTL( localeCode: string ) {
|
|
12
12
|
const localeObj = new Intl.Locale( localeCode );
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return localeObj.getTextInfo().direction === 'rtl';
|
|
13
|
+
const direction = localeObj.getTextInfo?.().direction;
|
|
14
|
+
if ( direction ) {
|
|
15
|
+
return direction === 'rtl';
|
|
17
16
|
}
|
|
18
17
|
return [
|
|
19
18
|
'ar', // Arabic
|
|
@@ -17,7 +17,10 @@
|
|
|
17
17
|
.components-checkbox-control__label {
|
|
18
18
|
// Ensure label is aligned with checkbox along X axis
|
|
19
19
|
line-height: var(--checkbox-input-size);
|
|
20
|
-
|
|
20
|
+
|
|
21
|
+
.components-checkbox-control:not(:has(:disabled)) & {
|
|
22
|
+
cursor: var(--wpds-cursor-control);
|
|
23
|
+
}
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
.components-checkbox-control__input[type="checkbox"] {
|
|
@@ -25,7 +28,6 @@
|
|
|
25
28
|
background: $white;
|
|
26
29
|
color: $gray-900;
|
|
27
30
|
clear: none;
|
|
28
|
-
cursor: pointer;
|
|
29
31
|
display: inline-block;
|
|
30
32
|
line-height: 0;
|
|
31
33
|
margin: 0 $grid-unit-05 0 0;
|
|
@@ -46,12 +48,15 @@
|
|
|
46
48
|
@include button-style-outset__focus(var(--wp-admin-theme-color));
|
|
47
49
|
}
|
|
48
50
|
|
|
49
|
-
&:checked,
|
|
50
|
-
&:indeterminate {
|
|
51
|
+
&:not(:disabled):is(:checked, :indeterminate) {
|
|
51
52
|
background: $components-color-accent;
|
|
52
53
|
border-color: $components-color-accent;
|
|
53
54
|
}
|
|
54
55
|
|
|
56
|
+
&:not(:disabled) {
|
|
57
|
+
cursor: var(--wpds-cursor-control);
|
|
58
|
+
}
|
|
59
|
+
|
|
55
60
|
&:checked::before {
|
|
56
61
|
content: none;
|
|
57
62
|
}
|
|
@@ -73,7 +78,7 @@ svg.components-checkbox-control__indeterminate {
|
|
|
73
78
|
--checkmark-size: var(--checkbox-input-size);
|
|
74
79
|
|
|
75
80
|
fill: $white;
|
|
76
|
-
cursor:
|
|
81
|
+
cursor: var(--wpds-cursor-control);
|
|
77
82
|
position: absolute;
|
|
78
83
|
left: 50%;
|
|
79
84
|
top: 50%;
|
|
@@ -88,6 +93,13 @@ svg.components-checkbox-control__indeterminate {
|
|
|
88
93
|
}
|
|
89
94
|
}
|
|
90
95
|
|
|
96
|
+
.components-checkbox-control:has(:disabled) {
|
|
97
|
+
svg.components-checkbox-control__checked,
|
|
98
|
+
svg.components-checkbox-control__indeterminate {
|
|
99
|
+
fill: $components-color-gray-400;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
91
103
|
.components-checkbox-control__help {
|
|
92
104
|
display: inline-block;
|
|
93
105
|
margin-inline-start: calc(var(--checkbox-input-size) + var(--checkbox-input-margin));
|
|
@@ -12,6 +12,10 @@ export type CheckboxControlProps = Pick<
|
|
|
12
12
|
BaseControlProps,
|
|
13
13
|
'__nextHasNoMarginBottom' | 'help'
|
|
14
14
|
> & {
|
|
15
|
+
/**
|
|
16
|
+
* Whether the checkbox should be disabled.
|
|
17
|
+
*/
|
|
18
|
+
disabled?: boolean;
|
|
15
19
|
/**
|
|
16
20
|
* A function that receives the checked state (boolean) as input.
|
|
17
21
|
*/
|
|
@@ -16,7 +16,7 @@ $border-as-box-shadow: inset 0 0 0 $border-width rgba(0, 0, 0, 0.2);
|
|
|
16
16
|
height: $grid-unit-80;
|
|
17
17
|
width: 100%;
|
|
18
18
|
box-sizing: border-box;
|
|
19
|
-
cursor:
|
|
19
|
+
cursor: var(--wpds-cursor-control);
|
|
20
20
|
// Show a thin outline in Windows high contrast mode.
|
|
21
21
|
outline: 1px solid transparent;
|
|
22
22
|
border-radius: $radius-medium $radius-medium 0 0;
|
package/src/css.d.ts
CHANGED
|
@@ -76,6 +76,7 @@ const GradientTypePicker = ( {
|
|
|
76
76
|
);
|
|
77
77
|
|
|
78
78
|
if ( type === 'linear-gradient' && gradientAST.orientation ) {
|
|
79
|
+
// eslint-disable-next-line react-compiler/react-compiler -- false positive, see https://github.com/facebook/react/issues/29196
|
|
79
80
|
lastLinearOrientationAngle.current = Number(
|
|
80
81
|
gradientAST.orientation.value
|
|
81
82
|
);
|
|
@@ -13,7 +13,7 @@ import { __, sprintf } from '@wordpress/i18n';
|
|
|
13
13
|
/**
|
|
14
14
|
* Internal dependencies
|
|
15
15
|
*/
|
|
16
|
-
import
|
|
16
|
+
import CustomSelect from '../custom-select-control-v2/custom-select';
|
|
17
17
|
import CustomSelectItem from '../custom-select-control-v2/item';
|
|
18
18
|
import * as Styled from '../custom-select-control-v2/styles';
|
|
19
19
|
import type { CustomSelectProps, CustomSelectOption } from './types';
|
|
@@ -189,7 +189,7 @@ function CustomSelectControl< T extends CustomSelectOption >(
|
|
|
189
189
|
|
|
190
190
|
return (
|
|
191
191
|
<>
|
|
192
|
-
<
|
|
192
|
+
<CustomSelect
|
|
193
193
|
aria-describedby={ descriptionId }
|
|
194
194
|
renderSelectedValue={ renderSelectedValue }
|
|
195
195
|
size={ translatedSize }
|
|
@@ -203,7 +203,7 @@ function CustomSelectControl< T extends CustomSelectOption >(
|
|
|
203
203
|
{ ...restProps }
|
|
204
204
|
>
|
|
205
205
|
{ children }
|
|
206
|
-
</
|
|
206
|
+
</CustomSelect>
|
|
207
207
|
<VisuallyHidden>
|
|
208
208
|
<span id={ descriptionId }>
|
|
209
209
|
{ getDescribedBy( selectedOption?.name, describedBy ) }
|
|
@@ -19,7 +19,7 @@ import type {
|
|
|
19
19
|
CustomSelectStore,
|
|
20
20
|
CustomSelectButtonProps,
|
|
21
21
|
CustomSelectButtonSize,
|
|
22
|
-
|
|
22
|
+
CustomSelectInternalProps,
|
|
23
23
|
_CustomSelectProps,
|
|
24
24
|
} from './types';
|
|
25
25
|
import InputBase from '../input-control/input-base';
|
|
@@ -85,8 +85,8 @@ const CustomSelectButton = ( {
|
|
|
85
85
|
);
|
|
86
86
|
};
|
|
87
87
|
|
|
88
|
-
function
|
|
89
|
-
props:
|
|
88
|
+
function CustomSelect(
|
|
89
|
+
props: CustomSelectInternalProps &
|
|
90
90
|
_CustomSelectProps &
|
|
91
91
|
CustomSelectStore &
|
|
92
92
|
CustomSelectButtonSize
|
|
@@ -161,4 +161,4 @@ function _CustomSelect(
|
|
|
161
161
|
);
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
export default
|
|
164
|
+
export default CustomSelect;
|
|
@@ -5,7 +5,7 @@ import * as Ariakit from '@ariakit/react';
|
|
|
5
5
|
/**
|
|
6
6
|
* Internal dependencies
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
8
|
+
import CustomSelect from './custom-select';
|
|
9
9
|
import type { CustomSelectProps } from './types';
|
|
10
10
|
import type { WordPressComponentProps } from '../context';
|
|
11
11
|
import Item from './item';
|
|
@@ -21,7 +21,7 @@ function CustomSelectControlV2(
|
|
|
21
21
|
value,
|
|
22
22
|
} );
|
|
23
23
|
|
|
24
|
-
return <
|
|
24
|
+
return <CustomSelect { ...restProps } store={ store } />;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
CustomSelectControlV2.Item = Item;
|
|
@@ -50,7 +50,7 @@ export type CustomSelectButtonProps = {
|
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
// Props only exposed on the internal implementation
|
|
53
|
-
export type
|
|
53
|
+
export type CustomSelectInternalProps = {
|
|
54
54
|
/**
|
|
55
55
|
* True if the consumer is emulating the legacy component behavior and look
|
|
56
56
|
*/
|
package/src/date-time/README.md
CHANGED
|
@@ -70,7 +70,7 @@ A callback function which receives a Date object representing a day as an argume
|
|
|
70
70
|
|
|
71
71
|
- Required: No
|
|
72
72
|
|
|
73
|
-
### `onMonthPreviewed`: `( date:
|
|
73
|
+
### `onMonthPreviewed`: `( date: string ) => void`
|
|
74
74
|
|
|
75
75
|
A callback invoked when selecting the previous/next month in the date picker. The callback receives the new month date in the ISO format as an argument.
|
|
76
76
|
|
|
@@ -87,5 +87,5 @@ List of events to show in the date picker. Each event will appear as a dot on th
|
|
|
87
87
|
|
|
88
88
|
The day that the week should start on. 0 for Sunday, 1 for Monday, etc.
|
|
89
89
|
|
|
90
|
-
-
|
|
91
|
-
-
|
|
90
|
+
- Required: No
|
|
91
|
+
- Default: 0
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# DatePicker
|
|
2
|
+
|
|
3
|
+
DatePicker is a React component that renders a calendar for date selection. It can be used independently or as part of the `DateTimePicker` component.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
Render a DatePicker.
|
|
8
|
+
|
|
9
|
+
```jsx
|
|
10
|
+
import { useState } from 'react';
|
|
11
|
+
import { DatePicker } from '@wordpress/components';
|
|
12
|
+
|
|
13
|
+
const MyDatePicker = () => {
|
|
14
|
+
const [ date, setDate ] = useState( new Date() );
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<DatePicker
|
|
18
|
+
currentDate={ date }
|
|
19
|
+
onChange={ ( newDate ) => setDate( newDate ) }
|
|
20
|
+
/>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Props
|
|
26
|
+
|
|
27
|
+
The component accepts the following props:
|
|
28
|
+
|
|
29
|
+
### `currentDate`: `Date | string | number | null`
|
|
30
|
+
|
|
31
|
+
The current date at initialization. Optionally pass in a `null` value to specify no date is currently selected.
|
|
32
|
+
|
|
33
|
+
- Required: No
|
|
34
|
+
- Default: today's date
|
|
35
|
+
|
|
36
|
+
### `onChange`: `( date: string ) => void`
|
|
37
|
+
|
|
38
|
+
The function called when a new date has been selected. It is passed the `currentDate` as an argument.
|
|
39
|
+
|
|
40
|
+
- Required: No
|
|
41
|
+
|
|
42
|
+
### `events`: `{ date: Date }[]`
|
|
43
|
+
|
|
44
|
+
List of events to show in the date picker. Each event will appear as a dot on the day of the event.
|
|
45
|
+
|
|
46
|
+
- Required: No
|
|
47
|
+
|
|
48
|
+
### `isInvalidDate`: `( date: Date ) => boolean`
|
|
49
|
+
|
|
50
|
+
A callback function which receives a Date object representing a day as an argument, and should return a Boolean to signify if the day is valid or not.
|
|
51
|
+
|
|
52
|
+
- Required: No
|
|
53
|
+
|
|
54
|
+
### `onMonthPreviewed`: `( date: string ) => void`
|
|
55
|
+
|
|
56
|
+
A callback invoked when selecting the previous/next month in the date picker. The callback receives the new month date in the ISO format as an argument.
|
|
57
|
+
|
|
58
|
+
- Required: No
|
|
59
|
+
|
|
60
|
+
### `startOfWeek`: `0 | 1 | 2 | 3 | 4 | 5 | 6`
|
|
61
|
+
|
|
62
|
+
The day that the week should start on. 0 for Sunday, 1 for Monday, etc.
|
|
63
|
+
|
|
64
|
+
- Required: No
|
|
65
|
+
- Default: 0
|
|
@@ -11,8 +11,8 @@ import { forwardRef } from '@wordpress/element';
|
|
|
11
11
|
/**
|
|
12
12
|
* Internal dependencies
|
|
13
13
|
*/
|
|
14
|
-
import { default as DatePicker } from '../date';
|
|
15
|
-
import { default as TimePicker } from '../time';
|
|
14
|
+
import { default as DatePicker } from '../date-picker';
|
|
15
|
+
import { default as TimePicker } from '../time-picker';
|
|
16
16
|
import type { DateTimePickerProps } from '../types';
|
|
17
17
|
import { Wrapper } from './styles';
|
|
18
18
|
|
package/src/date-time/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { default as DatePicker } from './date';
|
|
5
|
-
import { default as TimePicker } from './time';
|
|
4
|
+
import { default as DatePicker } from './date-picker';
|
|
5
|
+
import { default as TimePicker } from './time-picker';
|
|
6
6
|
import { default as DateTimePicker } from './date-time';
|
|
7
7
|
|
|
8
8
|
export { DatePicker, TimePicker };
|
|
@@ -11,7 +11,7 @@ import { useState, useEffect } from '@wordpress/element';
|
|
|
11
11
|
/**
|
|
12
12
|
* Internal dependencies
|
|
13
13
|
*/
|
|
14
|
-
import DatePicker from '../date';
|
|
14
|
+
import DatePicker from '../date-picker';
|
|
15
15
|
import { daysFromNow, isWeekend } from './utils';
|
|
16
16
|
|
|
17
17
|
const meta: Meta< typeof DatePicker > = {
|
|
@@ -11,7 +11,7 @@ import { useState, useEffect } from '@wordpress/element';
|
|
|
11
11
|
/**
|
|
12
12
|
* Internal dependencies
|
|
13
13
|
*/
|
|
14
|
-
import TimePicker from '../time';
|
|
14
|
+
import TimePicker from '../time-picker';
|
|
15
15
|
|
|
16
16
|
const meta: Meta< typeof TimePicker > = {
|
|
17
17
|
title: 'Components/Selection & Input/Time & Date/TimePicker',
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# TimePicker
|
|
2
|
+
|
|
3
|
+
TimePicker is a React component that renders form inputs for time and date selection. It can be used independently or as part of the `DateTimePicker` component.
|
|
4
|
+
|
|
5
|
+
**Note:** `TimePicker` also exposes a compound sub-component, `TimePicker.TimeInput`, which can be used independently to render a time input field without the full picker UI.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
Render a TimePicker.
|
|
10
|
+
|
|
11
|
+
```jsx
|
|
12
|
+
import { useState } from 'react';
|
|
13
|
+
import { TimePicker } from '@wordpress/components';
|
|
14
|
+
|
|
15
|
+
const MyTimePicker = () => {
|
|
16
|
+
const [ time, setTime ] = useState( new Date() );
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<TimePicker
|
|
20
|
+
currentTime={ time }
|
|
21
|
+
onChange={ ( newTime ) => setTime( newTime ) }
|
|
22
|
+
is12Hour
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Props
|
|
29
|
+
|
|
30
|
+
The component accepts the following props:
|
|
31
|
+
|
|
32
|
+
### `currentTime`: `Date | string | number | null`
|
|
33
|
+
|
|
34
|
+
The current time at initialization. Optionally pass in a `null` value to specify no time is currently selected.
|
|
35
|
+
|
|
36
|
+
- Required: No
|
|
37
|
+
- Default: current time
|
|
38
|
+
|
|
39
|
+
### `onChange`: `( time: string ) => void`
|
|
40
|
+
|
|
41
|
+
The function called when a new time has been selected. It is passed the time as an ISO-formatted string.
|
|
42
|
+
|
|
43
|
+
- Required: No
|
|
44
|
+
|
|
45
|
+
### `is12Hour`: `boolean`
|
|
46
|
+
|
|
47
|
+
Whether we use a 12-hour clock. With a 12-hour clock, an AM/PM widget is displayed.
|
|
48
|
+
|
|
49
|
+
- Required: No
|
|
50
|
+
- Default: false
|
|
51
|
+
|
|
52
|
+
### `dateOrder`: `'dmy' | 'mdy' | 'ymd'`
|
|
53
|
+
|
|
54
|
+
The order of day, month, and year. This prop overrides the time format determined by `is12Hour` prop.
|
|
55
|
+
|
|
56
|
+
- Required: No
|
|
57
|
+
- Default: `'dmy'` (or `'mdy'` when `is12Hour` is `true`)
|
|
58
|
+
|
|
59
|
+
### `hideLabelFromVision`: `boolean`
|
|
60
|
+
|
|
61
|
+
Whether to visually hide field labels while keeping them accessible to screen readers.
|
|
62
|
+
|
|
63
|
+
- Required: No
|
|
64
|
+
- Default: false
|
|
65
|
+
|
|
66
|
+
## TimePicker.TimeInput
|
|
67
|
+
|
|
68
|
+
A standalone time input component. Values are passed as an object in 24-hour format (`{ hours: number, minutes: number }`).
|
|
69
|
+
|
|
70
|
+
### Usage
|
|
71
|
+
|
|
72
|
+
```jsx
|
|
73
|
+
import { useState } from 'react';
|
|
74
|
+
import { TimePicker } from '@wordpress/components';
|
|
75
|
+
|
|
76
|
+
const MyTimeInput = () => {
|
|
77
|
+
const [ time, setTime ] = useState( { hours: 13, minutes: 30 } );
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<TimePicker.TimeInput
|
|
81
|
+
value={ time }
|
|
82
|
+
onChange={ setTime }
|
|
83
|
+
label="Time"
|
|
84
|
+
/>
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Props
|
|
90
|
+
|
|
91
|
+
#### `value`: `{ hours: number, minutes: number }`
|
|
92
|
+
|
|
93
|
+
The time input value in 24-hour format.
|
|
94
|
+
|
|
95
|
+
- Required: No
|
|
96
|
+
|
|
97
|
+
#### `defaultValue`: `{ hours: number, minutes: number }`
|
|
98
|
+
|
|
99
|
+
An optional default value for the control when used in uncontrolled mode. If left `undefined`, the current time will be used.
|
|
100
|
+
|
|
101
|
+
- Required: No
|
|
102
|
+
|
|
103
|
+
#### `onChange`: `( time: { hours: number, minutes: number } ) => void`
|
|
104
|
+
|
|
105
|
+
Called when the time changes. Receives the new value as an object with `hours` and `minutes`.
|
|
106
|
+
|
|
107
|
+
- Required: No
|
|
108
|
+
|
|
109
|
+
#### `is12Hour`: `boolean`
|
|
110
|
+
|
|
111
|
+
Whether to use a 12-hour clock. With a 12-hour clock, an AM/PM widget is displayed.
|
|
112
|
+
|
|
113
|
+
- Required: No
|
|
114
|
+
|
|
115
|
+
#### `label`: `string`
|
|
116
|
+
|
|
117
|
+
The label for the time input.
|
|
118
|
+
|
|
119
|
+
- Required: No
|
|
@@ -30,7 +30,7 @@ import { TimeInput } from './time-input';
|
|
|
30
30
|
const VALID_DATE_ORDERS = [ 'dmy', 'mdy', 'ymd' ];
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* TimePicker is a React component that renders
|
|
33
|
+
* TimePicker is a React component that renders form inputs for time and date selection. It can be used independently or as part of the `DateTimePicker` component.
|
|
34
34
|
*
|
|
35
35
|
* ```jsx
|
|
36
36
|
* import { TimePicker } from '@wordpress/components';
|
package/src/date-time/types.ts
CHANGED
package/src/divider/README.md
CHANGED
|
@@ -11,17 +11,16 @@ This feature is still experimental. “Experimental” means this is an early im
|
|
|
11
11
|
```jsx
|
|
12
12
|
import {
|
|
13
13
|
__experimentalDivider as Divider,
|
|
14
|
-
__experimentalText as Text,
|
|
15
|
-
__experimentalVStack as VStack,
|
|
16
14
|
} from `@wordpress/components`;
|
|
15
|
+
import { Stack } from '@wordpress/ui';
|
|
17
16
|
|
|
18
17
|
function Example() {
|
|
19
18
|
return (
|
|
20
|
-
<
|
|
21
|
-
<
|
|
19
|
+
<Stack direction="column" gap="lg">
|
|
20
|
+
<span>Some text here</span>
|
|
22
21
|
<Divider />
|
|
23
|
-
<
|
|
24
|
-
</
|
|
22
|
+
<span>Some more text here</span>
|
|
23
|
+
</Stack>
|
|
25
24
|
);
|
|
26
25
|
}
|
|
27
26
|
```
|
|
@@ -34,7 +34,7 @@ const meta: Meta< typeof Flex > = {
|
|
|
34
34
|
componentStatus: {
|
|
35
35
|
status: 'not-recommended',
|
|
36
36
|
whereUsed: 'global',
|
|
37
|
-
notes: 'Planned for deprecation. For use cases not covered by `
|
|
37
|
+
notes: 'Planned for deprecation. For use cases not covered by `Stack` from `@wordpress/ui`, write your own CSS.',
|
|
38
38
|
},
|
|
39
39
|
},
|
|
40
40
|
};
|
|
@@ -48,7 +48,7 @@ Children are passed as children of `Button`.
|
|
|
48
48
|
|
|
49
49
|
### `icon`
|
|
50
50
|
|
|
51
|
-
- Type: `IconType`
|
|
51
|
+
- Type: `IconType | null`
|
|
52
52
|
- Required: No
|
|
53
53
|
|
|
54
54
|
The icon to render in the default button.
|
|
@@ -65,7 +65,7 @@ Whether to allow multiple selection of files or not.
|
|
|
65
65
|
|
|
66
66
|
### `onChange`
|
|
67
67
|
|
|
68
|
-
- Type: `ChangeEventHandler<HTMLInputElement
|
|
68
|
+
- Type: `ChangeEventHandler<HTMLInputElement> | undefined`
|
|
69
69
|
- Required: Yes
|
|
70
70
|
|
|
71
71
|
Callback function passed directly to the `input` file element.
|
|
@@ -95,7 +95,7 @@ an empty string in the `onClick` function.
|
|
|
95
95
|
|
|
96
96
|
### `render`
|
|
97
97
|
|
|
98
|
-
- Type: `(arg: { openFileDialog: () => void; }) => ReactNode`
|
|
98
|
+
- Type: `((arg: { openFileDialog: () => void; }) => ReactNode)`
|
|
99
99
|
- Required: No
|
|
100
100
|
|
|
101
101
|
Optional callback function used to render the UI.
|
|
@@ -104,7 +104,40 @@ $transition-duration: 0.2s;
|
|
|
104
104
|
// Disabled state:
|
|
105
105
|
&.is-disabled,
|
|
106
106
|
.components-disabled & {
|
|
107
|
-
|
|
107
|
+
.components-form-toggle__track {
|
|
108
|
+
background-color: $components-color-gray-100;
|
|
109
|
+
border-color: $components-color-gray-300;
|
|
110
|
+
|
|
111
|
+
@media ( forced-colors: active ) {
|
|
112
|
+
border-color: GrayText;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.components-form-toggle__thumb {
|
|
117
|
+
background-color: $components-color-gray-400;
|
|
118
|
+
box-shadow: none;
|
|
119
|
+
|
|
120
|
+
@media ( forced-colors: active ) {
|
|
121
|
+
border-color: GrayText;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
&.is-checked .components-form-toggle__track {
|
|
126
|
+
background-color: $components-color-gray-400;
|
|
127
|
+
border-color: $components-color-gray-400;
|
|
128
|
+
|
|
129
|
+
@media ( forced-colors: active ) {
|
|
130
|
+
border-color: GrayText;
|
|
131
|
+
|
|
132
|
+
&::after {
|
|
133
|
+
border-top-color: GrayText;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
&.is-checked .components-form-toggle__thumb {
|
|
139
|
+
background-color: $white;
|
|
140
|
+
}
|
|
108
141
|
}
|
|
109
142
|
}
|
|
110
143
|
|
|
@@ -132,6 +165,6 @@ $transition-duration: 0.2s;
|
|
|
132
165
|
}
|
|
133
166
|
|
|
134
167
|
&:not(:disabled, [aria-disabled="true"]) {
|
|
135
|
-
cursor:
|
|
168
|
+
cursor: var(--wpds-cursor-control);
|
|
136
169
|
}
|
|
137
170
|
}
|
|
@@ -11,8 +11,9 @@
|
|
|
11
11
|
cursor: text;
|
|
12
12
|
|
|
13
13
|
&.is-disabled {
|
|
14
|
-
background: $gray-
|
|
15
|
-
border-color: $gray-
|
|
14
|
+
background: $components-color-gray-100;
|
|
15
|
+
border-color: $components-color-gray-400;
|
|
16
|
+
cursor: default;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
&.is-active {
|
|
@@ -82,6 +83,14 @@
|
|
|
82
83
|
}
|
|
83
84
|
}
|
|
84
85
|
|
|
86
|
+
&.is-disabled {
|
|
87
|
+
.components-form-token-field__token-text,
|
|
88
|
+
.components-form-token-field__remove-token.components-button {
|
|
89
|
+
background: $components-color-gray-100;
|
|
90
|
+
color: $components-color-gray-600;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
85
94
|
&.is-borderless {
|
|
86
95
|
position: relative;
|
|
87
96
|
padding: 0 24px 0 0;
|
|
@@ -198,6 +207,6 @@
|
|
|
198
207
|
}
|
|
199
208
|
|
|
200
209
|
&:not(.is-empty) {
|
|
201
|
-
cursor:
|
|
210
|
+
cursor: var(--wpds-cursor-control);
|
|
202
211
|
}
|
|
203
212
|
}
|
|
@@ -141,7 +141,7 @@ Only used when `asButtons` is not true.
|
|
|
141
141
|
|
|
142
142
|
### `onChange`
|
|
143
143
|
|
|
144
|
-
- Type: `(currentGradient: string) => void`
|
|
144
|
+
- Type: `(currentGradient: string | undefined) => void`
|
|
145
145
|
- Required: Yes
|
|
146
146
|
|
|
147
147
|
The function called when a new gradient has been defined. It is passed to
|
|
@@ -149,7 +149,7 @@ the `currentGradient` as an argument.
|
|
|
149
149
|
|
|
150
150
|
### `value`
|
|
151
151
|
|
|
152
|
-
- Type: `string`
|
|
152
|
+
- Type: `string | null`
|
|
153
153
|
- Required: No
|
|
154
154
|
- Default: `'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)'`
|
|
155
155
|
|