@wordpress/components 32.3.1-next.v.202602271551.0 → 32.4.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 +22 -1
- package/build/alignment-matrix-control/cell.cjs +2 -2
- package/build/alignment-matrix-control/cell.cjs.map +1 -1
- package/build/alignment-matrix-control/index.cjs +2 -2
- package/build/alignment-matrix-control/index.cjs.map +1 -1
- package/build/angle-picker-control/angle-circle.cjs +2 -2
- package/build/angle-picker-control/angle-circle.cjs.map +1 -1
- package/build/calendar/utils/constants.cjs +1 -0
- package/build/calendar/utils/constants.cjs.map +2 -2
- package/build/date-time/date/styles.cjs +9 -9
- package/build/date-time/date/styles.cjs.map +2 -2
- package/build/date-time/time/index.cjs +1 -1
- package/build/date-time/time/index.cjs.map +2 -2
- package/build/date-time/utils.cjs +9 -0
- package/build/date-time/utils.cjs.map +2 -2
- package/build/menu/radio-item.cjs +1 -1
- package/build/menu/radio-item.cjs.map +2 -2
- package/build/private-apis.cjs +0 -4
- package/build/private-apis.cjs.map +3 -3
- package/build/tooltip/index.cjs +1 -1
- package/build/tooltip/index.cjs.map +1 -1
- package/build/visually-hidden/styles.cjs +2 -1
- package/build/visually-hidden/styles.cjs.map +2 -2
- package/build-module/alignment-matrix-control/cell.mjs +2 -2
- package/build-module/alignment-matrix-control/cell.mjs.map +1 -1
- package/build-module/alignment-matrix-control/index.mjs +2 -2
- package/build-module/alignment-matrix-control/index.mjs.map +1 -1
- package/build-module/angle-picker-control/angle-circle.mjs +2 -2
- package/build-module/angle-picker-control/angle-circle.mjs.map +1 -1
- package/build-module/calendar/utils/constants.mjs +1 -0
- package/build-module/calendar/utils/constants.mjs.map +2 -2
- package/build-module/date-time/date/styles.mjs +9 -9
- package/build-module/date-time/date/styles.mjs.map +2 -2
- package/build-module/date-time/time/index.mjs +2 -2
- package/build-module/date-time/time/index.mjs.map +2 -2
- package/build-module/date-time/utils.mjs +8 -0
- package/build-module/date-time/utils.mjs.map +2 -2
- package/build-module/menu/radio-item.mjs +1 -1
- package/build-module/menu/radio-item.mjs.map +2 -2
- package/build-module/private-apis.mjs +0 -4
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/tooltip/index.mjs +1 -1
- package/build-module/tooltip/index.mjs.map +1 -1
- package/build-module/visually-hidden/styles.mjs +2 -1
- package/build-module/visually-hidden/styles.mjs.map +2 -2
- package/build-style/style-rtl.css +11 -184
- package/build-style/style.css +11 -184
- package/build-types/alignment-matrix-control/stories/index.story.d.ts +1 -1
- package/build-types/alignment-matrix-control/stories/index.story.d.ts.map +1 -1
- package/build-types/angle-picker-control/stories/index.story.d.ts +1 -1
- package/build-types/animate/stories/index.story.d.ts +7 -7
- package/build-types/animate/stories/index.story.d.ts.map +1 -1
- package/build-types/base-control/stories/index.story.d.ts +1 -1
- package/build-types/border-box-control/stories/index.story.d.ts +1 -1
- package/build-types/border-control/stories/index.story.d.ts +5 -5
- package/build-types/box-control/stories/index.story.d.ts +7 -7
- package/build-types/box-control/stories/index.story.d.ts.map +1 -1
- package/build-types/button/stories/e2e/index.story.d.ts +1 -1
- package/build-types/button/stories/e2e/index.story.d.ts.map +1 -1
- package/build-types/button/stories/index.story.d.ts +7 -7
- package/build-types/button/stories/index.story.d.ts.map +1 -1
- package/build-types/calendar/stories/date-calendar.story.d.ts +5 -0
- package/build-types/calendar/stories/date-calendar.story.d.ts.map +1 -1
- package/build-types/calendar/stories/date-range-calendar.story.d.ts +5 -0
- package/build-types/calendar/stories/date-range-calendar.story.d.ts.map +1 -1
- package/build-types/calendar/types.d.ts +12 -0
- package/build-types/calendar/types.d.ts.map +1 -1
- package/build-types/calendar/utils/constants.d.ts +1 -0
- package/build-types/calendar/utils/constants.d.ts.map +1 -1
- package/build-types/circular-option-picker/stories/index.story.d.ts +5 -5
- package/build-types/circular-option-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/combobox-control/stories/index.story.d.ts +4 -4
- package/build-types/confirm-dialog/stories/index.story.d.ts +2 -2
- package/build-types/confirm-dialog/stories/index.story.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/stories/index.story.d.ts +1 -1
- package/build-types/custom-gradient-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/custom-select-control/stories/index.story.d.ts +3 -3
- package/build-types/custom-select-control/stories/index.story.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/stories/index.story.d.ts +3 -3
- package/build-types/date-time/date/styles.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/index.d.ts.map +1 -1
- package/build-types/date-time/utils.d.ts +9 -0
- package/build-types/date-time/utils.d.ts.map +1 -1
- package/build-types/drop-zone/stories/index.story.d.ts +1 -1
- package/build-types/drop-zone/stories/index.story.d.ts.map +1 -1
- package/build-types/duotone-picker/stories/duotone-picker.story.d.ts +1 -1
- package/build-types/duotone-picker/stories/duotone-picker.story.d.ts.map +1 -1
- package/build-types/duotone-picker/stories/duotone-swatch.story.d.ts +3 -3
- package/build-types/duotone-picker/stories/duotone-swatch.story.d.ts.map +1 -1
- package/build-types/focal-point-picker/stories/index.story.d.ts +4 -4
- package/build-types/form-file-upload/stories/index.story.d.ts +5 -5
- package/build-types/form-file-upload/stories/index.story.d.ts.map +1 -1
- package/build-types/guide/stories/index.story.d.ts +1 -1
- package/build-types/guide/stories/index.story.d.ts.map +1 -1
- package/build-types/icon/stories/index.story.d.ts +4 -4
- package/build-types/icon/stories/index.story.d.ts.map +1 -1
- package/build-types/input-control/stories/index.story.d.ts +7 -7
- package/build-types/input-control/stories/index.story.d.ts.map +1 -1
- package/build-types/keyboard-shortcuts/stories/index.story.d.ts +1 -1
- package/build-types/keyboard-shortcuts/stories/index.story.d.ts.map +1 -1
- package/build-types/menu/radio-item.d.ts.map +1 -1
- package/build-types/menu-group/stories/index.story.d.ts +1 -1
- package/build-types/menu-group/stories/index.story.d.ts.map +1 -1
- package/build-types/menu-item/stories/index.story.d.ts +4 -4
- package/build-types/navigation/stories/index.story.d.ts +6 -6
- package/build-types/navigation/stories/index.story.d.ts.map +1 -1
- package/build-types/notice/stories/index.story.d.ts +5 -5
- package/build-types/notice/stories/index.story.d.ts.map +1 -1
- package/build-types/number-control/stories/index.story.d.ts +1 -1
- package/build-types/palette-edit/stories/index.story.d.ts +2 -2
- package/build-types/palette-edit/stories/index.story.d.ts.map +1 -1
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/progress-bar/stories/index.story.d.ts +1 -1
- package/build-types/progress-bar/stories/index.story.d.ts.map +1 -1
- package/build-types/query-controls/stories/index.story.d.ts +1 -1
- package/build-types/query-controls/stories/index.story.d.ts.map +1 -1
- package/build-types/resizable-box/stories/index.story.d.ts +2 -2
- package/build-types/responsive-wrapper/stories/index.story.d.ts +1 -1
- package/build-types/responsive-wrapper/stories/index.story.d.ts.map +1 -1
- package/build-types/sandbox/stories/index.story.d.ts +1 -1
- package/build-types/sandbox/stories/index.story.d.ts.map +1 -1
- package/build-types/search-control/stories/index.story.d.ts +1 -1
- package/build-types/select-control/stories/index.story.d.ts +5 -5
- package/build-types/shortcut/stories/index.story.d.ts +1 -1
- package/build-types/shortcut/stories/index.story.d.ts.map +1 -1
- package/build-types/tab-panel/stories/index.story.d.ts +4 -4
- package/build-types/tab-panel/stories/index.story.d.ts.map +1 -1
- package/build-types/tabs/stories/index.story.d.ts +7 -7
- package/build-types/tabs/stories/index.story.d.ts.map +1 -1
- package/build-types/text/stories/index.story.d.ts +3 -3
- package/build-types/theme/stories/index.story.d.ts +1 -1
- package/build-types/toggle-control/stories/index.story.d.ts +2 -2
- package/build-types/toolbar/stories/index.story.d.ts +3 -3
- package/build-types/toolbar/stories/index.story.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel/hook.d.ts +1 -1
- package/build-types/tools-panel/types.d.ts +1 -1
- package/build-types/tools-panel/types.d.ts.map +1 -1
- package/build-types/tooltip/stories/index.story.d.ts +1 -1
- package/build-types/tooltip/stories/index.story.d.ts.map +1 -1
- package/build-types/tooltip/types.d.ts +2 -2
- package/build-types/tree-grid/stories/index.story.d.ts +1 -1
- package/build-types/tree-grid/stories/index.story.d.ts.map +1 -1
- package/build-types/tree-select/stories/index.story.d.ts +1 -1
- package/build-types/tree-select/stories/index.story.d.ts.map +1 -1
- package/build-types/v-stack/stories/index.story.d.ts +1 -1
- package/build-types/visually-hidden/styles.d.ts.map +1 -1
- package/package.json +25 -25
- package/src/button-group/stories/index.story.tsx +1 -1
- package/src/calendar/stories/date-calendar.story.tsx +11 -0
- package/src/calendar/stories/date-range-calendar.story.tsx +11 -0
- package/src/calendar/style.scss +5 -0
- package/src/calendar/types.ts +12 -0
- package/src/calendar/utils/constants.ts +1 -0
- package/src/composite/legacy/stories/index.story.tsx +1 -1
- package/src/date-time/date/styles.ts +1 -0
- package/src/date-time/test/utils.test.ts +8 -11
- package/src/date-time/time/index.tsx +2 -12
- package/src/date-time/time/test/index.tsx +69 -0
- package/src/date-time/utils.ts +18 -0
- package/src/guide/style.scss +3 -0
- package/src/menu/radio-item.tsx +1 -1
- package/src/modal/style.scss +4 -7
- package/src/navigation/stories/index.story.tsx +1 -1
- package/src/notice/test/__snapshots__/index.tsx.snap +1 -1
- package/src/private-apis.ts +0 -4
- package/src/radio-group/stories/index.story.tsx +1 -1
- package/src/snackbar/style.scss +1 -0
- package/src/style.scss +0 -2
- package/src/tools-panel/types.ts +4 -1
- package/src/tooltip/README.md +2 -2
- package/src/tooltip/index.tsx +2 -2
- package/src/tooltip/types.ts +2 -2
- package/src/visually-hidden/styles.ts +1 -0
- package/src/visually-hidden/test/__snapshots__/index.tsx.snap +1 -1
- package/build/avatar/component.cjs +0 -99
- package/build/avatar/component.cjs.map +0 -7
- package/build/avatar/index.cjs +0 -37
- package/build/avatar/index.cjs.map +0 -7
- package/build/avatar/types.cjs +0 -19
- package/build/avatar/types.cjs.map +0 -7
- package/build/avatar-group/component.cjs +0 -60
- package/build/avatar-group/component.cjs.map +0 -7
- package/build/avatar-group/index.cjs +0 -37
- package/build/avatar-group/index.cjs.map +0 -7
- package/build/avatar-group/types.cjs +0 -19
- package/build/avatar-group/types.cjs.map +0 -7
- package/build-module/avatar/component.mjs +0 -68
- package/build-module/avatar/component.mjs.map +0 -7
- package/build-module/avatar/index.mjs +0 -6
- package/build-module/avatar/index.mjs.map +0 -7
- package/build-module/avatar/types.mjs +0 -1
- package/build-module/avatar/types.mjs.map +0 -7
- package/build-module/avatar-group/component.mjs +0 -29
- package/build-module/avatar-group/component.mjs.map +0 -7
- package/build-module/avatar-group/index.mjs +0 -6
- package/build-module/avatar-group/index.mjs.map +0 -7
- package/build-module/avatar-group/types.mjs +0 -1
- package/build-module/avatar-group/types.mjs.map +0 -7
- package/build-types/avatar/component.d.ts +0 -5
- package/build-types/avatar/component.d.ts.map +0 -1
- package/build-types/avatar/index.d.ts +0 -3
- package/build-types/avatar/index.d.ts.map +0 -1
- package/build-types/avatar/types.d.ts +0 -59
- package/build-types/avatar/types.d.ts.map +0 -1
- package/build-types/avatar-group/component.d.ts +0 -8
- package/build-types/avatar-group/component.d.ts.map +0 -1
- package/build-types/avatar-group/index.d.ts +0 -3
- package/build-types/avatar-group/index.d.ts.map +0 -1
- package/build-types/avatar-group/types.d.ts +0 -14
- package/build-types/avatar-group/types.d.ts.map +0 -1
- package/src/avatar/component.tsx +0 -82
- package/src/avatar/index.ts +0 -2
- package/src/avatar/styles.scss +0 -152
- package/src/avatar/types.ts +0 -59
- package/src/avatar-group/component.tsx +0 -46
- package/src/avatar-group/index.ts +0 -2
- package/src/avatar-group/styles.scss +0 -32
- package/src/avatar-group/types.ts +0 -13
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
1
|
import { startOfMinute } from 'date-fns';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
2
|
import { useState, useMemo, useEffect } from '@wordpress/element';
|
|
10
3
|
import { __ } from '@wordpress/i18n';
|
|
11
4
|
import { date as formatDate } from '@wordpress/date';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Internal dependencies
|
|
15
|
-
*/
|
|
16
5
|
import BaseControl from '../../base-control';
|
|
17
6
|
import { VisuallyHidden } from '../../visually-hidden';
|
|
18
7
|
import SelectControl from '../../select-control';
|
|
@@ -33,6 +22,7 @@ import {
|
|
|
33
22
|
buildPadInputStateReducer,
|
|
34
23
|
validateInputElementTarget,
|
|
35
24
|
setInConfiguredTimezone,
|
|
25
|
+
getDaysInMonth,
|
|
36
26
|
} from '../utils';
|
|
37
27
|
import { TIMEZONELESS_FORMAT } from '../constants';
|
|
38
28
|
import { TimeInput } from './time-input';
|
|
@@ -150,7 +140,7 @@ export function TimePicker( {
|
|
|
150
140
|
value={ day }
|
|
151
141
|
step={ 1 }
|
|
152
142
|
min={ 1 }
|
|
153
|
-
max={
|
|
143
|
+
max={ getDaysInMonth( Number( year ), Number( month ) - 1 ) }
|
|
154
144
|
required
|
|
155
145
|
spinControls="none"
|
|
156
146
|
isPressEnterToChange
|
|
@@ -158,6 +158,75 @@ describe( 'TimePicker', () => {
|
|
|
158
158
|
expect( onChangeSpy ).toHaveBeenCalledWith( '1986-10-18T11:59:00' );
|
|
159
159
|
} );
|
|
160
160
|
|
|
161
|
+
it( 'should call onChange with a bounded day if out of bounds', async () => {
|
|
162
|
+
const user = userEvent.setup();
|
|
163
|
+
|
|
164
|
+
const onChangeSpy = jest.fn();
|
|
165
|
+
|
|
166
|
+
render(
|
|
167
|
+
<TimePicker
|
|
168
|
+
currentTime="2026-02-05T00:00:00"
|
|
169
|
+
onChange={ onChangeSpy }
|
|
170
|
+
is12Hour
|
|
171
|
+
/>
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
const dayInput = screen.getByLabelText( 'Day' );
|
|
175
|
+
|
|
176
|
+
await user.clear( dayInput );
|
|
177
|
+
await user.type( dayInput, '30' );
|
|
178
|
+
await user.keyboard( '{Tab}' );
|
|
179
|
+
|
|
180
|
+
expect( onChangeSpy ).toHaveBeenCalledWith( '2026-02-28T00:00:00' );
|
|
181
|
+
expect( dayInput ).toHaveValue( 28 );
|
|
182
|
+
} );
|
|
183
|
+
|
|
184
|
+
it( 'should clamp day when switching months', async () => {
|
|
185
|
+
const user = userEvent.setup();
|
|
186
|
+
|
|
187
|
+
const onChangeSpy = jest.fn();
|
|
188
|
+
|
|
189
|
+
render(
|
|
190
|
+
<TimePicker
|
|
191
|
+
currentTime="2026-03-31T00:00:00"
|
|
192
|
+
onChange={ onChangeSpy }
|
|
193
|
+
is12Hour
|
|
194
|
+
/>
|
|
195
|
+
);
|
|
196
|
+
|
|
197
|
+
const monthSelect = screen.getByLabelText( 'Month' );
|
|
198
|
+
const dayInput = screen.getByLabelText( 'Day' );
|
|
199
|
+
|
|
200
|
+
await user.selectOptions( monthSelect, '02' );
|
|
201
|
+
|
|
202
|
+
expect( onChangeSpy ).toHaveBeenCalledWith( '2026-02-28T00:00:00' );
|
|
203
|
+
expect( dayInput ).toHaveValue( 28 );
|
|
204
|
+
} );
|
|
205
|
+
|
|
206
|
+
it( 'should clamp day when switching year from leap to non-leap', async () => {
|
|
207
|
+
const user = userEvent.setup();
|
|
208
|
+
|
|
209
|
+
const onChangeSpy = jest.fn();
|
|
210
|
+
|
|
211
|
+
render(
|
|
212
|
+
<TimePicker
|
|
213
|
+
currentTime="2028-02-29T00:00:00"
|
|
214
|
+
onChange={ onChangeSpy }
|
|
215
|
+
is12Hour
|
|
216
|
+
/>
|
|
217
|
+
);
|
|
218
|
+
|
|
219
|
+
const dayInput = screen.getByLabelText( 'Day' );
|
|
220
|
+
const yearInput = screen.getByLabelText( 'Year' );
|
|
221
|
+
|
|
222
|
+
await user.clear( yearInput );
|
|
223
|
+
await user.type( yearInput, '2026' );
|
|
224
|
+
await user.keyboard( '{Tab}' );
|
|
225
|
+
|
|
226
|
+
expect( onChangeSpy ).toHaveBeenCalledWith( '2026-02-28T00:00:00' );
|
|
227
|
+
expect( dayInput ).toHaveValue( 28 );
|
|
228
|
+
} );
|
|
229
|
+
|
|
161
230
|
it( 'should switch to PM correctly', async () => {
|
|
162
231
|
const user = userEvent.setup();
|
|
163
232
|
|
package/src/date-time/utils.ts
CHANGED
|
@@ -110,6 +110,19 @@ export function buildPadInputStateReducer( pad: number ) {
|
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
/**
|
|
114
|
+
* Returns the number of days in a month.
|
|
115
|
+
*
|
|
116
|
+
* @param year The year
|
|
117
|
+
* @param month The month, zero-indexed (0-11)
|
|
118
|
+
*
|
|
119
|
+
* @return The number of days in the month
|
|
120
|
+
*/
|
|
121
|
+
export const getDaysInMonth = ( year: number, month: number ) =>
|
|
122
|
+
// Take advantage of JavaScript's built-in date wrapping logic, where day 0
|
|
123
|
+
// of the next month is interpreted as the last day of the preceding month.
|
|
124
|
+
new Date( year, month + 1, 0 ).getDate();
|
|
125
|
+
|
|
113
126
|
/**
|
|
114
127
|
* Updates specific date fields in the configured timezone and returns a new
|
|
115
128
|
* UTC date.
|
|
@@ -139,6 +152,11 @@ export function setInConfiguredTimezone(
|
|
|
139
152
|
...updates,
|
|
140
153
|
};
|
|
141
154
|
|
|
155
|
+
// Clamp the day to the last valid day of the month, to avoid producing
|
|
156
|
+
// invalid date strings (e.g. "2026-02-31").
|
|
157
|
+
const daysInMonth = getDaysInMonth( values.year, values.month );
|
|
158
|
+
values.date = Math.min( values.date, daysInMonth );
|
|
159
|
+
|
|
142
160
|
const year = String( values.year ).padStart( 4, '0' );
|
|
143
161
|
const month = String( values.month + 1 ).padStart( 2, '0' );
|
|
144
162
|
const day = String( values.date ).padStart( 2, '0' );
|
package/src/guide/style.scss
CHANGED
|
@@ -6,9 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
.components-guide {
|
|
8
8
|
$image-height: 300px;
|
|
9
|
+
// TODO: Replace with a --wpds-dimension-surface-width-* token.
|
|
9
10
|
$image-width: 320px;
|
|
10
11
|
|
|
11
12
|
@include break-small() {
|
|
13
|
+
// TODO: Replace with a --wpds-dimension-surface-width-* token.
|
|
12
14
|
width: 600px;
|
|
13
15
|
}
|
|
14
16
|
|
|
@@ -86,6 +88,7 @@
|
|
|
86
88
|
|
|
87
89
|
.components-modal__frame.components-guide {
|
|
88
90
|
border: none;
|
|
91
|
+
// TODO: Replace with a --wpds-dimension-surface-width-* token.
|
|
89
92
|
min-width: 312px;
|
|
90
93
|
max-height: 575px;
|
|
91
94
|
|
package/src/menu/radio-item.tsx
CHANGED
|
@@ -8,6 +8,7 @@ import * as Ariakit from '@ariakit/react';
|
|
|
8
8
|
*/
|
|
9
9
|
import { forwardRef, useContext } from '@wordpress/element';
|
|
10
10
|
import { Icon } from '@wordpress/icons';
|
|
11
|
+
import { SVG, Circle } from '@wordpress/primitives';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Internal dependencies
|
|
@@ -16,7 +17,6 @@ import type { WordPressComponentProps } from '../context';
|
|
|
16
17
|
import { Context } from './context';
|
|
17
18
|
import type { RadioItemProps } from './types';
|
|
18
19
|
import * as Styled from './styles';
|
|
19
|
-
import { SVG, Circle } from '@wordpress/primitives';
|
|
20
20
|
|
|
21
21
|
const radioCheck = (
|
|
22
22
|
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
package/src/modal/style.scss
CHANGED
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
border-radius: $radius-large;
|
|
66
66
|
margin: auto;
|
|
67
67
|
width: auto;
|
|
68
|
-
min-width:
|
|
68
|
+
min-width: var(--wpds-dimension-surface-width-sm);
|
|
69
69
|
max-width: calc(100% - #{$grid-unit-20 * 2});
|
|
70
70
|
max-height: calc(100% - #{$header-height * 2});
|
|
71
71
|
|
|
@@ -88,17 +88,14 @@
|
|
|
88
88
|
width: 100%;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
// The following widths were selected to align with existing baselines
|
|
92
|
-
// found elsewhere in the editor.
|
|
93
|
-
// See https://github.com/WordPress/gutenberg/pull/54471#issuecomment-1723818809
|
|
94
91
|
&.has-size-small {
|
|
95
|
-
max-width:
|
|
92
|
+
max-width: var(--wpds-dimension-surface-width-md);
|
|
96
93
|
}
|
|
97
94
|
&.has-size-medium {
|
|
98
|
-
max-width:
|
|
95
|
+
max-width: var(--wpds-dimension-surface-width-lg);
|
|
99
96
|
}
|
|
100
97
|
&.has-size-large {
|
|
101
|
-
max-width:
|
|
98
|
+
max-width: var(--wpds-dimension-surface-width-2xl);
|
|
102
99
|
}
|
|
103
100
|
|
|
104
101
|
}
|
|
@@ -26,7 +26,7 @@ import './style.css';
|
|
|
26
26
|
* This component is deprecated. Consider using `Navigator` instead.
|
|
27
27
|
*/
|
|
28
28
|
const meta: Meta< typeof Navigation > = {
|
|
29
|
-
title: 'Components
|
|
29
|
+
title: 'Components/Deprecated/Navigation',
|
|
30
30
|
id: 'components-navigation',
|
|
31
31
|
component: Navigation,
|
|
32
32
|
subcomponents: {
|
|
@@ -9,7 +9,7 @@ exports[`Notice should match snapshot 1`] = `
|
|
|
9
9
|
class="components-visually-hidden css-1ragr82-PolymorphicDiv emotion-0"
|
|
10
10
|
data-wp-c16t="true"
|
|
11
11
|
data-wp-component="VisuallyHidden"
|
|
12
|
-
style="border: 0px; clip: rect(1px, 1px, 1px, 1px); clip-path: inset( 50% ); height: 1px; margin: -1px; overflow: hidden; padding: 0px; position: absolute; width: 1px; word-wrap: normal;"
|
|
12
|
+
style="border: 0px; clip: rect(1px, 1px, 1px, 1px); clip-path: inset( 50% ); height: 1px; margin: -1px; overflow: hidden; padding: 0px; position: absolute; width: 1px; word-wrap: normal; word-break: normal;"
|
|
13
13
|
>
|
|
14
14
|
Notice
|
|
15
15
|
</div>
|
package/src/private-apis.ts
CHANGED
|
@@ -14,8 +14,6 @@ import { Tabs } from './tabs';
|
|
|
14
14
|
import { kebabCase, normalizeTextString } from './utils/strings';
|
|
15
15
|
import { withIgnoreIMEEvents } from './utils/with-ignore-ime-events';
|
|
16
16
|
import { lock } from './lock-unlock';
|
|
17
|
-
import Avatar from './avatar';
|
|
18
|
-
import AvatarGroup from './avatar-group';
|
|
19
17
|
import Badge from './badge';
|
|
20
18
|
|
|
21
19
|
import { DateCalendar, DateRangeCalendar, TZDate } from './calendar';
|
|
@@ -36,8 +34,6 @@ import { ValidatedFormTokenField } from './validated-form-controls/components/fo
|
|
|
36
34
|
export const privateApis = {};
|
|
37
35
|
lock( privateApis, {
|
|
38
36
|
__experimentalPopoverLegacyPositionToPlacement,
|
|
39
|
-
Avatar,
|
|
40
|
-
AvatarGroup,
|
|
41
37
|
ComponentsContext,
|
|
42
38
|
Tabs,
|
|
43
39
|
Theme,
|
|
@@ -16,7 +16,7 @@ import { RadioGroup } from '..';
|
|
|
16
16
|
import { Radio } from '../radio';
|
|
17
17
|
|
|
18
18
|
const meta: Meta< typeof RadioGroup > = {
|
|
19
|
-
title: 'Components
|
|
19
|
+
title: 'Components/Deprecated/RadioGroup',
|
|
20
20
|
id: 'components-radiogroup',
|
|
21
21
|
component: RadioGroup,
|
|
22
22
|
subcomponents: { Radio },
|
package/src/snackbar/style.scss
CHANGED
package/src/style.scss
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
@use "@wordpress/base-styles/mixins" as *;
|
|
2
2
|
@use "./animate/style.scss" as *;
|
|
3
3
|
@use "./autocomplete/style.scss" as *;
|
|
4
|
-
@use "./avatar/styles.scss" as *;
|
|
5
|
-
@use "./avatar-group/styles.scss" as *;
|
|
6
4
|
@use "./badge/styles.scss" as *;
|
|
7
5
|
@use "./button-group/style.scss" as *;
|
|
8
6
|
@use "./button/style.scss" as *;
|
package/src/tools-panel/types.ts
CHANGED
|
@@ -20,7 +20,10 @@ export type ToolsPanelProps = {
|
|
|
20
20
|
/**
|
|
21
21
|
* The dropdown menu props to configure the panel's `DropdownMenu`.
|
|
22
22
|
*/
|
|
23
|
-
dropdownMenuProps?:
|
|
23
|
+
dropdownMenuProps?: Omit<
|
|
24
|
+
React.ComponentProps< typeof DropdownMenu >,
|
|
25
|
+
'label'
|
|
26
|
+
>;
|
|
24
27
|
/**
|
|
25
28
|
* Flags that the items in this ToolsPanel will be contained within an inner
|
|
26
29
|
* wrapper element allowing the panel to lay them out accordingly.
|
package/src/tooltip/README.md
CHANGED
|
@@ -51,7 +51,7 @@ Option to hide the tooltip when the anchor is clicked.
|
|
|
51
51
|
Used to specify the tooltip's placement with respect to its anchor.
|
|
52
52
|
|
|
53
53
|
- Required: No
|
|
54
|
-
- Default: `'
|
|
54
|
+
- Default: `'top'`
|
|
55
55
|
|
|
56
56
|
#### `position`: `string`
|
|
57
57
|
|
|
@@ -60,7 +60,7 @@ _Note: use the `placement` prop instead when possible._
|
|
|
60
60
|
Legacy way to specify the popover's position with respect to its anchor. Specify y- and x-axis as a space-separated string. Supports `'top'`, `'middle'`, `'bottom'` y axis, and `'left'`, `'center'`, `'right'` x axis.
|
|
61
61
|
|
|
62
62
|
- Required: No
|
|
63
|
-
- Default: `'
|
|
63
|
+
- Default: `'top'`
|
|
64
64
|
|
|
65
65
|
#### `shortcut`: `string` | `object`
|
|
66
66
|
|
package/src/tooltip/index.tsx
CHANGED
|
@@ -58,7 +58,7 @@ function UnforwardedTooltip(
|
|
|
58
58
|
// Compute tooltip's placement:
|
|
59
59
|
// - give priority to `placement` prop, if defined
|
|
60
60
|
// - otherwise, compute it from the legacy `position` prop (if defined)
|
|
61
|
-
// - finally, fallback to the default placement: '
|
|
61
|
+
// - finally, fallback to the default placement: 'top'
|
|
62
62
|
let computedPlacement;
|
|
63
63
|
if ( placement !== undefined ) {
|
|
64
64
|
computedPlacement = placement;
|
|
@@ -69,7 +69,7 @@ function UnforwardedTooltip(
|
|
|
69
69
|
alternative: '`placement` prop',
|
|
70
70
|
} );
|
|
71
71
|
}
|
|
72
|
-
computedPlacement = computedPlacement || '
|
|
72
|
+
computedPlacement = computedPlacement || 'top';
|
|
73
73
|
|
|
74
74
|
const tooltipStore = Ariakit.useTooltipStore( {
|
|
75
75
|
placement: computedPlacement,
|
package/src/tooltip/types.ts
CHANGED
|
@@ -35,7 +35,7 @@ export type TooltipProps = {
|
|
|
35
35
|
/**
|
|
36
36
|
* Where the tooltip should be positioned relative to its parent.
|
|
37
37
|
*
|
|
38
|
-
* @default
|
|
38
|
+
* @default top
|
|
39
39
|
*/
|
|
40
40
|
placement?: Placement;
|
|
41
41
|
/**
|
|
@@ -47,7 +47,7 @@ export type TooltipProps = {
|
|
|
47
47
|
* `"bottom"` y axis, and `"left"`, `"center"`, `"right"` x axis.
|
|
48
48
|
*
|
|
49
49
|
* @deprecated
|
|
50
|
-
* @default
|
|
50
|
+
* @default top
|
|
51
51
|
*/
|
|
52
52
|
position?: PopoverProps[ 'position' ];
|
|
53
53
|
/**
|
|
@@ -5,7 +5,7 @@ exports[`VisuallyHidden should render correctly 1`] = `
|
|
|
5
5
|
class="components-visually-hidden css-1ragr82-PolymorphicDiv emotion-0"
|
|
6
6
|
data-wp-c16t="true"
|
|
7
7
|
data-wp-component="VisuallyHidden"
|
|
8
|
-
style="border: 0px; clip: rect(1px, 1px, 1px, 1px); clip-path: inset( 50% ); height: 1px; margin: -1px; overflow: hidden; padding: 0px; position: absolute; width: 1px; word-wrap: normal;"
|
|
8
|
+
style="border: 0px; clip: rect(1px, 1px, 1px, 1px); clip-path: inset( 50% ); height: 1px; margin: -1px; overflow: hidden; padding: 0px; position: absolute; width: 1px; word-wrap: normal; word-break: normal;"
|
|
9
9
|
>
|
|
10
10
|
This is hidden
|
|
11
11
|
</div>
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// packages/components/src/avatar/component.tsx
|
|
31
|
-
var component_exports = {};
|
|
32
|
-
__export(component_exports, {
|
|
33
|
-
default: () => component_default
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(component_exports);
|
|
36
|
-
var import_clsx = __toESM(require("clsx"));
|
|
37
|
-
var import_icon = __toESM(require("../icon/index.cjs"));
|
|
38
|
-
var import_tooltip = __toESM(require("../tooltip/index.cjs"));
|
|
39
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
40
|
-
function Avatar({
|
|
41
|
-
className,
|
|
42
|
-
src,
|
|
43
|
-
name,
|
|
44
|
-
label,
|
|
45
|
-
badge = false,
|
|
46
|
-
size = "default",
|
|
47
|
-
borderColor,
|
|
48
|
-
status,
|
|
49
|
-
statusIndicator,
|
|
50
|
-
style,
|
|
51
|
-
...props
|
|
52
|
-
}) {
|
|
53
|
-
const showBadge = badge && !!name;
|
|
54
|
-
const initials = name ? name.split(/\s+/).slice(0, 2).map((word) => word[0]).join("").toUpperCase() : void 0;
|
|
55
|
-
const customProperties = {
|
|
56
|
-
...style,
|
|
57
|
-
...src ? {
|
|
58
|
-
"--components-avatar-url": `url(${src})`
|
|
59
|
-
} : {},
|
|
60
|
-
...borderColor ? {
|
|
61
|
-
"--components-avatar-outline-color": borderColor
|
|
62
|
-
} : {}
|
|
63
|
-
};
|
|
64
|
-
const avatar = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
65
|
-
className: (0, import_clsx.default)("components-avatar", className, {
|
|
66
|
-
"has-avatar-border-color": !!borderColor,
|
|
67
|
-
"has-src": !!src,
|
|
68
|
-
"has-badge": showBadge,
|
|
69
|
-
"is-small": size === "small",
|
|
70
|
-
"has-status": !!status,
|
|
71
|
-
[`is-${status}`]: !!status
|
|
72
|
-
}),
|
|
73
|
-
style: customProperties,
|
|
74
|
-
role: "img",
|
|
75
|
-
"aria-label": name,
|
|
76
|
-
...props,
|
|
77
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
78
|
-
className: "components-avatar__image",
|
|
79
|
-
children: [!src && initials, !!status && !!statusIndicator && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
80
|
-
className: "components-avatar__status-indicator",
|
|
81
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon.default, {
|
|
82
|
-
icon: statusIndicator
|
|
83
|
-
})
|
|
84
|
-
})]
|
|
85
|
-
}), showBadge && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
86
|
-
className: "components-avatar__name",
|
|
87
|
-
children: label || name
|
|
88
|
-
})]
|
|
89
|
-
});
|
|
90
|
-
if (name && (!showBadge || label)) {
|
|
91
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tooltip.default, {
|
|
92
|
-
text: name,
|
|
93
|
-
children: avatar
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
return avatar;
|
|
97
|
-
}
|
|
98
|
-
var component_default = Avatar;
|
|
99
|
-
//# sourceMappingURL=component.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/avatar/component.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * Internal dependencies\n */\nimport Icon from '../icon';\nimport Tooltip from '../tooltip';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nfunction Avatar({\n className,\n src,\n name,\n label,\n badge = false,\n size = 'default',\n borderColor,\n status,\n statusIndicator,\n style,\n ...props\n}) {\n const showBadge = badge && !!name;\n const initials = name ? name.split(/\\s+/).slice(0, 2).map(word => word[0]).join('').toUpperCase() : undefined;\n const customProperties = {\n ...style,\n ...(src ? {\n '--components-avatar-url': `url(${src})`\n } : {}),\n ...(borderColor ? {\n '--components-avatar-outline-color': borderColor\n } : {})\n };\n const avatar = /*#__PURE__*/_jsxs(\"div\", {\n className: clsx('components-avatar', className, {\n 'has-avatar-border-color': !!borderColor,\n 'has-src': !!src,\n 'has-badge': showBadge,\n 'is-small': size === 'small',\n 'has-status': !!status,\n [`is-${status}`]: !!status\n }),\n style: customProperties,\n role: \"img\",\n \"aria-label\": name,\n ...props,\n children: [/*#__PURE__*/_jsxs(\"span\", {\n className: \"components-avatar__image\",\n children: [!src && initials, !!status && !!statusIndicator && /*#__PURE__*/_jsx(\"span\", {\n className: \"components-avatar__status-indicator\",\n children: /*#__PURE__*/_jsx(Icon, {\n icon: statusIndicator\n })\n })]\n }), showBadge && /*#__PURE__*/_jsx(\"span\", {\n className: \"components-avatar__name\",\n children: label || name\n })]\n });\n if (name && (!showBadge || label)) {\n return /*#__PURE__*/_jsx(Tooltip, {\n text: name,\n children: avatar\n });\n }\n return avatar;\n}\nexport default Avatar;"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,kBAAiB;AACjB,qBAAoB;AACpB,yBAA2C;AAC3C,SAAS,OAAO;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAG;AACD,QAAM,YAAY,SAAS,CAAC,CAAC;AAC7B,QAAM,WAAW,OAAO,KAAK,MAAM,KAAK,EAAE,MAAM,GAAG,CAAC,EAAE,IAAI,UAAQ,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,YAAY,IAAI;AACpG,QAAM,mBAAmB;AAAA,IACvB,GAAG;AAAA,IACH,GAAI,MAAM;AAAA,MACR,2BAA2B,OAAO,GAAG;AAAA,IACvC,IAAI,CAAC;AAAA,IACL,GAAI,cAAc;AAAA,MAChB,qCAAqC;AAAA,IACvC,IAAI,CAAC;AAAA,EACP;AACA,QAAM,SAAsB,uCAAAA,MAAM,OAAO;AAAA,IACvC,eAAW,YAAAC,SAAK,qBAAqB,WAAW;AAAA,MAC9C,2BAA2B,CAAC,CAAC;AAAA,MAC7B,WAAW,CAAC,CAAC;AAAA,MACb,aAAa;AAAA,MACb,YAAY,SAAS;AAAA,MACrB,cAAc,CAAC,CAAC;AAAA,MAChB,CAAC,MAAM,MAAM,EAAE,GAAG,CAAC,CAAC;AAAA,IACtB,CAAC;AAAA,IACD,OAAO;AAAA,IACP,MAAM;AAAA,IACN,cAAc;AAAA,IACd,GAAG;AAAA,IACH,UAAU,CAAc,uCAAAD,MAAM,QAAQ;AAAA,MACpC,WAAW;AAAA,MACX,UAAU,CAAC,CAAC,OAAO,UAAU,CAAC,CAAC,UAAU,CAAC,CAAC,mBAAgC,uCAAAE,KAAK,QAAQ;AAAA,QACtF,WAAW;AAAA,QACX,UAAuB,uCAAAA,KAAK,YAAAC,SAAM;AAAA,UAChC,MAAM;AAAA,QACR,CAAC;AAAA,MACH,CAAC,CAAC;AAAA,IACJ,CAAC,GAAG,aAA0B,uCAAAD,KAAK,QAAQ;AAAA,MACzC,WAAW;AAAA,MACX,UAAU,SAAS;AAAA,IACrB,CAAC,CAAC;AAAA,EACJ,CAAC;AACD,MAAI,SAAS,CAAC,aAAa,QAAQ;AACjC,WAAoB,uCAAAA,KAAK,eAAAE,SAAS;AAAA,MAChC,MAAM;AAAA,MACN,UAAU;AAAA,IACZ,CAAC;AAAA,EACH;AACA,SAAO;AACT;AACA,IAAO,oBAAQ;",
|
|
6
|
-
"names": ["_jsxs", "clsx", "_jsx", "Icon", "Tooltip"]
|
|
7
|
-
}
|
package/build/avatar/index.cjs
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// packages/components/src/avatar/index.ts
|
|
31
|
-
var avatar_exports = {};
|
|
32
|
-
__export(avatar_exports, {
|
|
33
|
-
default: () => import_component.default
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(avatar_exports);
|
|
36
|
-
var import_component = __toESM(require("./component.cjs"));
|
|
37
|
-
//# sourceMappingURL=index.cjs.map
|
package/build/avatar/types.cjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
|
|
16
|
-
// packages/components/src/avatar/types.ts
|
|
17
|
-
var types_exports = {};
|
|
18
|
-
module.exports = __toCommonJS(types_exports);
|
|
19
|
-
//# sourceMappingURL=types.cjs.map
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// packages/components/src/avatar-group/component.tsx
|
|
31
|
-
var component_exports = {};
|
|
32
|
-
__export(component_exports, {
|
|
33
|
-
default: () => component_default
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(component_exports);
|
|
36
|
-
var import_clsx = __toESM(require("clsx"));
|
|
37
|
-
var import_element = require("@wordpress/element");
|
|
38
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
39
|
-
function AvatarGroup({
|
|
40
|
-
className,
|
|
41
|
-
max = 3,
|
|
42
|
-
children,
|
|
43
|
-
...props
|
|
44
|
-
}) {
|
|
45
|
-
const childArray = import_element.Children.toArray(children);
|
|
46
|
-
const visible = childArray.slice(0, max);
|
|
47
|
-
const overflowCount = childArray.length - max;
|
|
48
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
49
|
-
role: "group",
|
|
50
|
-
className: (0, import_clsx.default)("components-avatar-group", className),
|
|
51
|
-
...props,
|
|
52
|
-
children: [visible, overflowCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
53
|
-
className: "components-avatar-group__overflow",
|
|
54
|
-
"aria-label": `${overflowCount} more`,
|
|
55
|
-
children: `+${overflowCount}`
|
|
56
|
-
})]
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
var component_default = AvatarGroup;
|
|
60
|
-
//# sourceMappingURL=component.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/avatar-group/component.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { Children } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nfunction AvatarGroup({\n className,\n max = 3,\n children,\n ...props\n}) {\n const childArray = Children.toArray(children);\n const visible = childArray.slice(0, max);\n const overflowCount = childArray.length - max;\n return /*#__PURE__*/_jsxs(\"div\", {\n role: \"group\",\n className: clsx('components-avatar-group', className),\n ...props,\n children: [visible, overflowCount > 0 && /*#__PURE__*/_jsx(\"span\", {\n className: \"components-avatar-group__overflow\",\n \"aria-label\": `${overflowCount} more`,\n children: `+${overflowCount}`\n })]\n });\n}\nexport default AvatarGroup;"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,qBAAyB;AAKzB,yBAA2C;AAC3C,SAAS,YAAY;AAAA,EACnB;AAAA,EACA,MAAM;AAAA,EACN;AAAA,EACA,GAAG;AACL,GAAG;AACD,QAAM,aAAa,wBAAS,QAAQ,QAAQ;AAC5C,QAAM,UAAU,WAAW,MAAM,GAAG,GAAG;AACvC,QAAM,gBAAgB,WAAW,SAAS;AAC1C,SAAoB,uCAAAA,MAAM,OAAO;AAAA,IAC/B,MAAM;AAAA,IACN,eAAW,YAAAC,SAAK,2BAA2B,SAAS;AAAA,IACpD,GAAG;AAAA,IACH,UAAU,CAAC,SAAS,gBAAgB,KAAkB,uCAAAC,KAAK,QAAQ;AAAA,MACjE,WAAW;AAAA,MACX,cAAc,GAAG,aAAa;AAAA,MAC9B,UAAU,IAAI,aAAa;AAAA,IAC7B,CAAC,CAAC;AAAA,EACJ,CAAC;AACH;AACA,IAAO,oBAAQ;",
|
|
6
|
-
"names": ["_jsxs", "clsx", "_jsx"]
|
|
7
|
-
}
|