@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,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/date-time/time/index.tsx"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["import { startOfMinute } from 'date-fns';\nimport { useState, useMemo, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { date as formatDate } from '@wordpress/date';\nimport BaseControl from '../../base-control';\nimport { VisuallyHidden } from '../../visually-hidden';\nimport SelectControl from '../../select-control';\nimport TimeZone from './timezone';\nimport { Wrapper, Fieldset, MonthSelectWrapper, DayInput, YearInput } from './styles';\nimport { HStack } from '../../h-stack';\nimport { Spacer } from '../../spacer';\nimport { inputToDate, buildPadInputStateReducer, validateInputElementTarget, setInConfiguredTimezone, getDaysInMonth } from '../utils';\nimport { TIMEZONELESS_FORMAT } from '../constants';\nimport { TimeInput } from './time-input';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst VALID_DATE_ORDERS = ['dmy', 'mdy', 'ymd'];\n\n/**\n * TimePicker is a React component that renders a clock for time selection.\n *\n * ```jsx\n * import { TimePicker } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyTimePicker = () => {\n * const [ time, setTime ] = useState( new Date() );\n *\n * return (\n * <TimePicker\n * currentTime={ date }\n * onChange={ ( newTime ) => setTime( newTime ) }\n * is12Hour\n * />\n * );\n * };\n * ```\n */\nexport function TimePicker({\n is12Hour,\n currentTime,\n onChange,\n dateOrder: dateOrderProp,\n hideLabelFromVision = false\n}) {\n const [date, setDate] = useState(() =>\n // Truncate the date at the minutes, see: #15495.\n startOfMinute(inputToDate(currentTime ?? new Date())));\n\n // Reset the state when currentTime changed.\n // TODO: useEffect() shouldn't be used like this, causes an unnecessary render\n useEffect(() => {\n setDate(startOfMinute(inputToDate(currentTime ?? new Date())));\n }, [currentTime]);\n const monthOptions = [{\n value: '01',\n label: __('January')\n }, {\n value: '02',\n label: __('February')\n }, {\n value: '03',\n label: __('March')\n }, {\n value: '04',\n label: __('April')\n }, {\n value: '05',\n label: __('May')\n }, {\n value: '06',\n label: __('June')\n }, {\n value: '07',\n label: __('July')\n }, {\n value: '08',\n label: __('August')\n }, {\n value: '09',\n label: __('September')\n }, {\n value: '10',\n label: __('October')\n }, {\n value: '11',\n label: __('November')\n }, {\n value: '12',\n label: __('December')\n }];\n const {\n day,\n month,\n year,\n minutes,\n hours\n } = useMemo(() => ({\n day: formatDate('d', date),\n month: formatDate('m', date),\n year: formatDate('Y', date),\n minutes: formatDate('i', date),\n hours: formatDate('H', date)\n }), [date]);\n const buildNumberControlChangeCallback = method => {\n const callback = (value, {\n event\n }) => {\n if (!validateInputElementTarget(event)) {\n return;\n }\n\n // We can safely assume value is a number if target is valid.\n const numberValue = Number(value);\n\n // Internal date is UTC-normalized, but the field should be updated\n // as if in the configured timezone.\n const newDate = setInConfiguredTimezone(date, {\n [method]: numberValue\n });\n setDate(newDate);\n onChange?.(formatDate(TIMEZONELESS_FORMAT, newDate));\n };\n return callback;\n };\n const onTimeInputChangeCallback = ({\n hours: newHours,\n minutes: newMinutes\n }) => {\n // Internal date is UTC-normalized, but the field should be updated\n // as if in the configured timezone.\n const newDate = setInConfiguredTimezone(date, {\n hours: newHours,\n minutes: newMinutes\n });\n setDate(newDate);\n onChange?.(formatDate(TIMEZONELESS_FORMAT, newDate));\n };\n const dayField = /*#__PURE__*/_jsx(DayInput, {\n className: \"components-datetime__time-field components-datetime__time-field-day\" // Unused, for backwards compatibility.\n ,\n label: __('Day'),\n hideLabelFromVision: true,\n __next40pxDefaultSize: true,\n value: day,\n step: 1,\n min: 1,\n max: getDaysInMonth(Number(year), Number(month) - 1),\n required: true,\n spinControls: \"none\",\n isPressEnterToChange: true,\n isDragEnabled: false,\n isShiftStepEnabled: false,\n onChange: buildNumberControlChangeCallback('date')\n }, \"day\");\n const monthField = /*#__PURE__*/_jsx(MonthSelectWrapper, {\n children: /*#__PURE__*/_jsx(SelectControl, {\n className: \"components-datetime__time-field components-datetime__time-field-month\" // Unused, for backwards compatibility.\n ,\n label: __('Month'),\n hideLabelFromVision: true,\n __next40pxDefaultSize: true,\n value: month,\n options: monthOptions,\n onChange: value => {\n // Internal date is UTC-normalized, but the field should be updated\n // as if in the configured timezone.\n const newDate = setInConfiguredTimezone(date, {\n month: Number(value) - 1\n });\n setDate(newDate);\n onChange?.(formatDate(TIMEZONELESS_FORMAT, newDate));\n }\n })\n }, \"month\");\n const yearField = /*#__PURE__*/_jsx(YearInput, {\n className: \"components-datetime__time-field components-datetime__time-field-year\" // Unused, for backwards compatibility.\n ,\n label: __('Year'),\n hideLabelFromVision: true,\n __next40pxDefaultSize: true,\n value: year,\n step: 1,\n min: 1,\n max: 9999,\n required: true,\n spinControls: \"none\",\n isPressEnterToChange: true,\n isDragEnabled: false,\n isShiftStepEnabled: false,\n onChange: buildNumberControlChangeCallback('year'),\n __unstableStateReducer: buildPadInputStateReducer(4)\n }, \"year\");\n const defaultDateOrder = is12Hour ? 'mdy' : 'dmy';\n const dateOrder = dateOrderProp && VALID_DATE_ORDERS.includes(dateOrderProp) ? dateOrderProp : defaultDateOrder;\n const fields = dateOrder.split('').map(field => {\n switch (field) {\n case 'd':\n return dayField;\n case 'm':\n return monthField;\n case 'y':\n return yearField;\n default:\n return null;\n }\n });\n return /*#__PURE__*/_jsxs(Wrapper, {\n className: \"components-datetime__time\" // Unused, for backwards compatibility.\n ,\n children: [/*#__PURE__*/_jsxs(Fieldset, {\n children: [hideLabelFromVision ? /*#__PURE__*/_jsx(VisuallyHidden, {\n as: \"legend\",\n children: __('Time')\n }) : /*#__PURE__*/_jsx(BaseControl.VisualLabel, {\n as: \"legend\",\n className: \"components-datetime__time-legend\" // Unused, for backwards compatibility.\n ,\n children: __('Time')\n }), /*#__PURE__*/_jsxs(HStack, {\n className: \"components-datetime__time-wrapper\" // Unused, for backwards compatibility.\n ,\n children: [/*#__PURE__*/_jsx(TimeInput, {\n value: {\n hours: Number(hours),\n minutes: Number(minutes)\n },\n is12Hour: is12Hour,\n onChange: onTimeInputChangeCallback\n }), /*#__PURE__*/_jsx(Spacer, {}), /*#__PURE__*/_jsx(TimeZone, {})]\n })]\n }), /*#__PURE__*/_jsxs(Fieldset, {\n children: [hideLabelFromVision ? /*#__PURE__*/_jsx(VisuallyHidden, {\n as: \"legend\",\n children: __('Date')\n }) : /*#__PURE__*/_jsx(BaseControl.VisualLabel, {\n as: \"legend\",\n className: \"components-datetime__time-legend\" // Unused, for backwards compatibility.\n ,\n children: __('Date')\n }), /*#__PURE__*/_jsx(HStack, {\n className: \"components-datetime__time-wrapper\" // Unused, for backwards compatibility.\n ,\n children: fields\n })]\n })]\n });\n}\n\n/**\n * A component to input a time.\n *\n * Values are passed as an object in 24-hour format (`{ hours: number, minutes: number }`).\n *\n * ```jsx\n * import { TimePicker } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyTimeInput = () => {\n * \tconst [ time, setTime ] = useState( { hours: 13, minutes: 30 } );\n *\n * \treturn (\n * \t\t<TimePicker.TimeInput\n * \t\t\tvalue={ time }\n * \t\t\tonChange={ setTime }\n * \t\t\tlabel=\"Time\"\n * \t\t/>\n * \t);\n * };\n * ```\n */\nTimePicker.TimeInput = TimeInput;\nObject.assign(TimePicker.TimeInput, {\n displayName: 'TimePicker.TimeInput'\n});\nexport default TimePicker;"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,qBAAqB;AAC9B,SAAS,UAAU,SAAS,iBAAiB;AAC7C,SAAS,UAAU;AACnB,SAAS,QAAQ,kBAAkB;AACnC,OAAO,iBAAiB;AACxB,SAAS,sBAAsB;AAC/B,OAAO,mBAAmB;AAC1B,OAAO,cAAc;AACrB,SAAS,SAAS,UAAU,oBAAoB,UAAU,iBAAiB;AAC3E,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,aAAa,2BAA2B,4BAA4B,yBAAyB,sBAAsB;AAC5H,SAAS,2BAA2B;AACpC,SAAS,iBAAiB;AAC1B,SAAS,OAAO,MAAM,QAAQ,aAAa;AAC3C,IAAM,oBAAoB,CAAC,OAAO,OAAO,KAAK;AAsBvC,SAAS,WAAW;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,sBAAsB;AACxB,GAAG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GAAgB,sBAAM,QAAQ;AAAA,QAC7B,WAAW;AAAA,QAEX,UAAU,CAAc,qBAAK,WAAW;AAAA,UACtC,OAAO;AAAA,YACL,OAAO,OAAO,KAAK;AAAA,YACnB,SAAS,OAAO,OAAO;AAAA,UACzB;AAAA,UACA;AAAA,UACA,UAAU;AAAA,QACZ,CAAC,GAAgB,qBAAK,QAAQ,CAAC,CAAC,GAAgB,qBAAK,UAAU,CAAC,CAAC,CAAC;AAAA,MACpE,CAAC,CAAC;AAAA,IACJ,CAAC,GAAgB,sBAAM,UAAU;AAAA,MAC/B,UAAU,CAAC,sBAAmC,qBAAK,gBAAgB;AAAA,QACjE,IAAI;AAAA,QACJ,UAAU,GAAG,MAAM;AAAA,MACrB,CAAC,IAAiB,qBAAK,YAAY,aAAa;AAAA,QAC9C,IAAI;AAAA,QACJ,WAAW;AAAA,QAEX,UAAU,GAAG,MAAM;AAAA,MACrB,CAAC,GAAgB,qBAAK,QAAQ;AAAA,QAC5B,WAAW;AAAA,QAEX,UAAU;AAAA,MACZ,CAAC,CAAC;AAAA,IACJ,CAAC,CAAC;AAAA,EACJ,CAAC;AACH;AAwBA,WAAW,YAAY;AACvB,OAAO,OAAO,WAAW,WAAW;AAAA,EAClC,aAAa;AACf,CAAC;AACD,IAAO,eAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -38,6 +38,11 @@ function buildPadInputStateReducer(pad) {
|
|
|
38
38
|
return nextState;
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
+
var getDaysInMonth = (year, month) => (
|
|
42
|
+
// Take advantage of JavaScript's built-in date wrapping logic, where day 0
|
|
43
|
+
// of the next month is interpreted as the last day of the preceding month.
|
|
44
|
+
new Date(year, month + 1, 0).getDate()
|
|
45
|
+
);
|
|
41
46
|
function setInConfiguredTimezone(date, updates) {
|
|
42
47
|
const values = {
|
|
43
48
|
year: Number(formatDate("Y", date)),
|
|
@@ -48,6 +53,8 @@ function setInConfiguredTimezone(date, updates) {
|
|
|
48
53
|
seconds: Number(formatDate("s", date)),
|
|
49
54
|
...updates
|
|
50
55
|
};
|
|
56
|
+
const daysInMonth = getDaysInMonth(values.year, values.month);
|
|
57
|
+
values.date = Math.min(values.date, daysInMonth);
|
|
51
58
|
const year = String(values.year).padStart(4, "0");
|
|
52
59
|
const month = String(values.month + 1).padStart(2, "0");
|
|
53
60
|
const day = String(values.date).padStart(2, "0");
|
|
@@ -68,6 +75,7 @@ export {
|
|
|
68
75
|
buildPadInputStateReducer,
|
|
69
76
|
from12hTo24h,
|
|
70
77
|
from24hTo12h,
|
|
78
|
+
getDaysInMonth,
|
|
71
79
|
inputToDate,
|
|
72
80
|
setInConfiguredTimezone,
|
|
73
81
|
startOfDayInConfiguredTimezone,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/date-time/utils.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport { UTCDateMini } from '@date-fns/utc';\n\n/**\n * WordPress dependencies\n */\nimport { date as formatDate, getDate } from '@wordpress/date';\n\n/**\n * Internal dependencies\n */\n\nimport { COMMIT, PRESS_DOWN, PRESS_UP } from '../input-control/reducer/actions';\n\n/**\n * Converts a date input to a UTC-normalized date for consistent date\n * manipulation. Timezoneless strings are interpreted using the timezone\n * offset from @wordpress/date settings. Date objects and timestamps\n * represent specific UTC instants.\n *\n * @param input Value to turn into a date.\n */\nexport function inputToDate(input) {\n if (typeof input === 'string') {\n // Note that JavaScript doesn't fully support ISO-8601 time strings, so\n // the behavior of passing these through to the Date constructor is\n // non-deterministic.\n //\n // See: https://tc39.es/ecma262/#sec-date-time-string-format\n const hasTimezone = /Z|[+-]\\d{2}(:?\\d{2})?$/.test(input);\n if (hasTimezone) {\n return new UTCDateMini(new Date(input));\n }\n\n // Strings without timezone indicators are interpreted using configured\n // timezone offset, then converted to UTC for internal storage.\n return new UTCDateMini(getDate(input).getTime());\n }\n\n // Date objects and number timestamps represent specific UTC moments.\n // Convert to milliseconds since epoch for consistent UTC handling.\n const time = input instanceof Date ? input.getTime() : input;\n return new UTCDateMini(time);\n}\n\n/**\n * Returns the start of day (midnight) as a browser-local Date for the calendar\n * day in the configured timezone in @wordpress/date settings. This is necessary\n * because date-fns's startOfDay operates in browser local time, which can cause\n * off-by-one-day bugs when browser and configured timezones differ.\n *\n * For example, if the UTC time is Nov 16, 01:00 UTC and configured timezone\n * is UTC-5, the date is Nov 15. This function returns a browser-local Date\n * at Nov 15, 00:00 (browser local midnight) so it matches calendar days.\n *\n * @param date A Date object normalized to UTC\n * @return A browser-local Date at midnight for the configured timezone date\n */\nexport function startOfDayInConfiguredTimezone(date) {\n // Determine the calendar day in the configured WordPress timezone and\n // return a browser-local Date at midnight for that calendar day.\n const year = Number(formatDate('Y', date));\n const month = Number(formatDate('n', date)) - 1;\n const day = Number(formatDate('j', date));\n return new Date(year, month, day, 0, 0, 0, 0);\n}\n\n/**\n * Converts a 12-hour time to a 24-hour time.\n * @param hours\n * @param isPm\n */\nexport function from12hTo24h(hours, isPm) {\n return isPm ? (hours % 12 + 12) % 24 : hours % 12;\n}\n\n/**\n * Converts a 24-hour time to a 12-hour time.\n * @param hours\n */\nexport function from24hTo12h(hours) {\n return hours % 12 || 12;\n}\n\n/**\n * Creates an InputControl reducer used to pad an input so that it is always a\n * given width. For example, the hours and minutes inputs are padded to 2 so\n * that '4' appears as '04'.\n *\n * @param pad How many digits the value should be.\n */\nexport function buildPadInputStateReducer(pad) {\n return (state, action) => {\n const nextState = {\n ...state\n };\n if (action.type === COMMIT || action.type === PRESS_UP || action.type === PRESS_DOWN) {\n if (nextState.value !== undefined) {\n nextState.value = nextState.value.toString().padStart(pad, '0');\n }\n }\n return nextState;\n };\n}\n\n/**\n * Updates specific date fields in the configured timezone and returns a new\n * UTC date.\n *\n * @param date A Date object\n * @param updates Object with fields to update\n * @return A Date object normalized to UTC with the updated values\n */\nexport function setInConfiguredTimezone(date, updates) {\n const values = {\n year: Number(formatDate('Y', date)),\n month: Number(formatDate('n', date)) - 1,\n date: Number(formatDate('j', date)),\n hours: Number(formatDate('H', date)),\n minutes: Number(formatDate('i', date)),\n seconds: Number(formatDate('s', date)),\n ...updates\n };\n const year = String(values.year).padStart(4, '0');\n const month = String(values.month + 1).padStart(2, '0');\n const day = String(values.date).padStart(2, '0');\n const hours = String(values.hours).padStart(2, '0');\n const minutes = String(values.minutes).padStart(2, '0');\n const seconds = String(values.seconds).padStart(2, '0');\n const timezoneless = `${year}-${month}-${day}T${hours}:${minutes}:${seconds}`;\n\n // Parse as WordPress-configured timezone time and convert to a UTC instant.\n return new UTCDateMini(getDate(timezoneless).getTime());\n}\n\n/**\n * Validates the target of a React event to ensure it is an input element and\n * that the input is valid.\n * @param event\n */\nexport function validateInputElementTarget(event) {\n // `instanceof` checks need to get the instance definition from the\n // corresponding window object \u2014 therefore, the following logic makes\n // the component work correctly even when rendered inside an iframe.\n const HTMLInputElementInstance = event.target?.ownerDocument.defaultView?.HTMLInputElement ?? HTMLInputElement;\n if (!(event.target instanceof HTMLInputElementInstance)) {\n return false;\n }\n return event.target.validity.valid;\n}"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,mBAAmB;AAK5B,SAAS,QAAQ,YAAY,eAAe;AAM5C,SAAS,QAAQ,YAAY,gBAAgB;AAUtC,SAAS,YAAY,OAAO;AACjC,MAAI,OAAO,UAAU,UAAU;AAM7B,UAAM,cAAc,yBAAyB,KAAK,KAAK;AACvD,QAAI,aAAa;AACf,aAAO,IAAI,YAAY,IAAI,KAAK,KAAK,CAAC;AAAA,IACxC;AAIA,WAAO,IAAI,YAAY,QAAQ,KAAK,EAAE,QAAQ,CAAC;AAAA,EACjD;AAIA,QAAM,OAAO,iBAAiB,OAAO,MAAM,QAAQ,IAAI;AACvD,SAAO,IAAI,YAAY,IAAI;AAC7B;AAeO,SAAS,+BAA+B,MAAM;AAGnD,QAAM,OAAO,OAAO,WAAW,KAAK,IAAI,CAAC;AACzC,QAAM,QAAQ,OAAO,WAAW,KAAK,IAAI,CAAC,IAAI;AAC9C,QAAM,MAAM,OAAO,WAAW,KAAK,IAAI,CAAC;AACxC,SAAO,IAAI,KAAK,MAAM,OAAO,KAAK,GAAG,GAAG,GAAG,CAAC;AAC9C;AAOO,SAAS,aAAa,OAAO,MAAM;AACxC,SAAO,QAAQ,QAAQ,KAAK,MAAM,KAAK,QAAQ;AACjD;AAMO,SAAS,aAAa,OAAO;AAClC,SAAO,QAAQ,MAAM;AACvB;AASO,SAAS,0BAA0B,KAAK;AAC7C,SAAO,CAAC,OAAO,WAAW;AACxB,UAAM,YAAY;AAAA,MAChB,GAAG;AAAA,IACL;AACA,QAAI,OAAO,SAAS,UAAU,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;AACpF,UAAI,UAAU,UAAU,QAAW;AACjC,kBAAU,QAAQ,UAAU,MAAM,SAAS,EAAE,SAAS,KAAK,GAAG;AAAA,MAChE;AAAA,IACF;AACA,WAAO;AAAA,EACT;AACF;AAUO,SAAS,wBAAwB,MAAM,SAAS;AACrD,QAAM,SAAS;AAAA,IACb,MAAM,OAAO,WAAW,KAAK,IAAI,CAAC;AAAA,IAClC,OAAO,OAAO,WAAW,KAAK,IAAI,CAAC,IAAI;AAAA,IACvC,MAAM,OAAO,WAAW,KAAK,IAAI,CAAC;AAAA,IAClC,OAAO,OAAO,WAAW,KAAK,IAAI,CAAC;AAAA,IACnC,SAAS,OAAO,WAAW,KAAK,IAAI,CAAC;AAAA,IACrC,SAAS,OAAO,WAAW,KAAK,IAAI,CAAC;AAAA,IACrC,GAAG;AAAA,EACL;
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport { UTCDateMini } from '@date-fns/utc';\n\n/**\n * WordPress dependencies\n */\nimport { date as formatDate, getDate } from '@wordpress/date';\n\n/**\n * Internal dependencies\n */\n\nimport { COMMIT, PRESS_DOWN, PRESS_UP } from '../input-control/reducer/actions';\n\n/**\n * Converts a date input to a UTC-normalized date for consistent date\n * manipulation. Timezoneless strings are interpreted using the timezone\n * offset from @wordpress/date settings. Date objects and timestamps\n * represent specific UTC instants.\n *\n * @param input Value to turn into a date.\n */\nexport function inputToDate(input) {\n if (typeof input === 'string') {\n // Note that JavaScript doesn't fully support ISO-8601 time strings, so\n // the behavior of passing these through to the Date constructor is\n // non-deterministic.\n //\n // See: https://tc39.es/ecma262/#sec-date-time-string-format\n const hasTimezone = /Z|[+-]\\d{2}(:?\\d{2})?$/.test(input);\n if (hasTimezone) {\n return new UTCDateMini(new Date(input));\n }\n\n // Strings without timezone indicators are interpreted using configured\n // timezone offset, then converted to UTC for internal storage.\n return new UTCDateMini(getDate(input).getTime());\n }\n\n // Date objects and number timestamps represent specific UTC moments.\n // Convert to milliseconds since epoch for consistent UTC handling.\n const time = input instanceof Date ? input.getTime() : input;\n return new UTCDateMini(time);\n}\n\n/**\n * Returns the start of day (midnight) as a browser-local Date for the calendar\n * day in the configured timezone in @wordpress/date settings. This is necessary\n * because date-fns's startOfDay operates in browser local time, which can cause\n * off-by-one-day bugs when browser and configured timezones differ.\n *\n * For example, if the UTC time is Nov 16, 01:00 UTC and configured timezone\n * is UTC-5, the date is Nov 15. This function returns a browser-local Date\n * at Nov 15, 00:00 (browser local midnight) so it matches calendar days.\n *\n * @param date A Date object normalized to UTC\n * @return A browser-local Date at midnight for the configured timezone date\n */\nexport function startOfDayInConfiguredTimezone(date) {\n // Determine the calendar day in the configured WordPress timezone and\n // return a browser-local Date at midnight for that calendar day.\n const year = Number(formatDate('Y', date));\n const month = Number(formatDate('n', date)) - 1;\n const day = Number(formatDate('j', date));\n return new Date(year, month, day, 0, 0, 0, 0);\n}\n\n/**\n * Converts a 12-hour time to a 24-hour time.\n * @param hours\n * @param isPm\n */\nexport function from12hTo24h(hours, isPm) {\n return isPm ? (hours % 12 + 12) % 24 : hours % 12;\n}\n\n/**\n * Converts a 24-hour time to a 12-hour time.\n * @param hours\n */\nexport function from24hTo12h(hours) {\n return hours % 12 || 12;\n}\n\n/**\n * Creates an InputControl reducer used to pad an input so that it is always a\n * given width. For example, the hours and minutes inputs are padded to 2 so\n * that '4' appears as '04'.\n *\n * @param pad How many digits the value should be.\n */\nexport function buildPadInputStateReducer(pad) {\n return (state, action) => {\n const nextState = {\n ...state\n };\n if (action.type === COMMIT || action.type === PRESS_UP || action.type === PRESS_DOWN) {\n if (nextState.value !== undefined) {\n nextState.value = nextState.value.toString().padStart(pad, '0');\n }\n }\n return nextState;\n };\n}\n\n/**\n * Returns the number of days in a month.\n *\n * @param year The year\n * @param month The month, zero-indexed (0-11)\n *\n * @return The number of days in the month\n */\nexport const getDaysInMonth = (year, month) =>\n// Take advantage of JavaScript's built-in date wrapping logic, where day 0\n// of the next month is interpreted as the last day of the preceding month.\nnew Date(year, month + 1, 0).getDate();\n\n/**\n * Updates specific date fields in the configured timezone and returns a new\n * UTC date.\n *\n * @param date A Date object\n * @param updates Object with fields to update\n * @return A Date object normalized to UTC with the updated values\n */\nexport function setInConfiguredTimezone(date, updates) {\n const values = {\n year: Number(formatDate('Y', date)),\n month: Number(formatDate('n', date)) - 1,\n date: Number(formatDate('j', date)),\n hours: Number(formatDate('H', date)),\n minutes: Number(formatDate('i', date)),\n seconds: Number(formatDate('s', date)),\n ...updates\n };\n\n // Clamp the day to the last valid day of the month, to avoid producing\n // invalid date strings (e.g. \"2026-02-31\").\n const daysInMonth = getDaysInMonth(values.year, values.month);\n values.date = Math.min(values.date, daysInMonth);\n const year = String(values.year).padStart(4, '0');\n const month = String(values.month + 1).padStart(2, '0');\n const day = String(values.date).padStart(2, '0');\n const hours = String(values.hours).padStart(2, '0');\n const minutes = String(values.minutes).padStart(2, '0');\n const seconds = String(values.seconds).padStart(2, '0');\n const timezoneless = `${year}-${month}-${day}T${hours}:${minutes}:${seconds}`;\n\n // Parse as WordPress-configured timezone time and convert to a UTC instant.\n return new UTCDateMini(getDate(timezoneless).getTime());\n}\n\n/**\n * Validates the target of a React event to ensure it is an input element and\n * that the input is valid.\n * @param event\n */\nexport function validateInputElementTarget(event) {\n // `instanceof` checks need to get the instance definition from the\n // corresponding window object \u2014 therefore, the following logic makes\n // the component work correctly even when rendered inside an iframe.\n const HTMLInputElementInstance = event.target?.ownerDocument.defaultView?.HTMLInputElement ?? HTMLInputElement;\n if (!(event.target instanceof HTMLInputElementInstance)) {\n return false;\n }\n return event.target.validity.valid;\n}"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,mBAAmB;AAK5B,SAAS,QAAQ,YAAY,eAAe;AAM5C,SAAS,QAAQ,YAAY,gBAAgB;AAUtC,SAAS,YAAY,OAAO;AACjC,MAAI,OAAO,UAAU,UAAU;AAM7B,UAAM,cAAc,yBAAyB,KAAK,KAAK;AACvD,QAAI,aAAa;AACf,aAAO,IAAI,YAAY,IAAI,KAAK,KAAK,CAAC;AAAA,IACxC;AAIA,WAAO,IAAI,YAAY,QAAQ,KAAK,EAAE,QAAQ,CAAC;AAAA,EACjD;AAIA,QAAM,OAAO,iBAAiB,OAAO,MAAM,QAAQ,IAAI;AACvD,SAAO,IAAI,YAAY,IAAI;AAC7B;AAeO,SAAS,+BAA+B,MAAM;AAGnD,QAAM,OAAO,OAAO,WAAW,KAAK,IAAI,CAAC;AACzC,QAAM,QAAQ,OAAO,WAAW,KAAK,IAAI,CAAC,IAAI;AAC9C,QAAM,MAAM,OAAO,WAAW,KAAK,IAAI,CAAC;AACxC,SAAO,IAAI,KAAK,MAAM,OAAO,KAAK,GAAG,GAAG,GAAG,CAAC;AAC9C;AAOO,SAAS,aAAa,OAAO,MAAM;AACxC,SAAO,QAAQ,QAAQ,KAAK,MAAM,KAAK,QAAQ;AACjD;AAMO,SAAS,aAAa,OAAO;AAClC,SAAO,QAAQ,MAAM;AACvB;AASO,SAAS,0BAA0B,KAAK;AAC7C,SAAO,CAAC,OAAO,WAAW;AACxB,UAAM,YAAY;AAAA,MAChB,GAAG;AAAA,IACL;AACA,QAAI,OAAO,SAAS,UAAU,OAAO,SAAS,YAAY,OAAO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AQ,YAAY,EAAE,QAAQ,CAAC;AACxD;AAOO,SAAS,2BAA2B,OAAO;AAIhD,QAAM,2BAA2B,MAAM,QAAQ,cAAc,aAAa,oBAAoB;AAC9F,MAAI,EAAE,MAAM,kBAAkB,2BAA2B;AACvD,WAAO;AAAA,EACT;AACA,SAAO,MAAM,OAAO,SAAS;AAC/B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import * as Ariakit from "@ariakit/react";
|
|
3
3
|
import { forwardRef, useContext } from "@wordpress/element";
|
|
4
4
|
import { Icon } from "@wordpress/icons";
|
|
5
|
+
import { SVG, Circle } from "@wordpress/primitives";
|
|
5
6
|
import { Context } from "./context.mjs";
|
|
6
7
|
import * as Styled from "./styles.mjs";
|
|
7
|
-
import { SVG, Circle } from "@wordpress/primitives";
|
|
8
8
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
9
|
var radioCheck = /* @__PURE__ */ _jsx(SVG, {
|
|
10
10
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/menu/radio-item.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport * as Ariakit from '@ariakit/react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useContext } from '@wordpress/element';\nimport { Icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\n\nimport { Context } from './context';\nimport * as Styled from './styles';\nimport {
|
|
5
|
-
"mappings": ";AAGA,YAAY,aAAa;AAKzB,SAAS,YAAY,kBAAkB;AACvC,SAAS,YAAY;
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport * as Ariakit from '@ariakit/react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useContext } from '@wordpress/element';\nimport { Icon } from '@wordpress/icons';\nimport { SVG, Circle } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\n\nimport { Context } from './context';\nimport * as Styled from './styles';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst radioCheck = /*#__PURE__*/_jsx(SVG, {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 24 24\",\n children: /*#__PURE__*/_jsx(Circle, {\n cx: 12,\n cy: 12,\n r: 3\n })\n});\nexport const RadioItem = forwardRef(function RadioItem({\n suffix,\n children,\n disabled = false,\n hideOnClick = false,\n ...props\n}, ref) {\n const menuContext = useContext(Context);\n if (!menuContext?.store) {\n throw new Error('Menu.RadioItem can only be rendered inside a Menu component');\n }\n return /*#__PURE__*/_jsxs(Styled.RadioItem, {\n ref: ref,\n ...props,\n accessibleWhenDisabled: true,\n disabled: disabled,\n hideOnClick: hideOnClick,\n store: menuContext.store,\n children: [/*#__PURE__*/_jsx(Ariakit.MenuItemCheck, {\n store: menuContext.store,\n render: /*#__PURE__*/_jsx(Styled.ItemPrefixWrapper, {})\n // Override some ariakit inline styles\n ,\n style: {\n width: 'auto',\n height: 'auto'\n },\n children: /*#__PURE__*/_jsx(Icon, {\n icon: radioCheck,\n size: 24\n })\n }), /*#__PURE__*/_jsxs(Styled.ItemContentWrapper, {\n children: [/*#__PURE__*/_jsx(Styled.ItemChildrenWrapper, {\n children: children\n }), suffix && /*#__PURE__*/_jsx(Styled.ItemSuffixWrapper, {\n children: suffix\n })]\n })]\n });\n});"],
|
|
5
|
+
"mappings": ";AAGA,YAAY,aAAa;AAKzB,SAAS,YAAY,kBAAkB;AACvC,SAAS,YAAY;AACrB,SAAS,KAAK,cAAc;AAM5B,SAAS,eAAe;AACxB,YAAY,YAAY;AACxB,SAAS,OAAO,MAAM,QAAQ,aAAa;AAC3C,IAAM,aAA0B,qBAAK,KAAK;AAAA,EACxC,OAAO;AAAA,EACP,SAAS;AAAA,EACT,UAAuB,qBAAK,QAAQ;AAAA,IAClC,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,GAAG;AAAA,EACL,CAAC;AACH,CAAC;AACM,IAAMA,aAAY,WAAW,SAASA,WAAU;AAAA,EACrD;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,cAAc;AAAA,EACd,GAAG;AACL,GAAG,KAAK;AACN,QAAM,cAAc,WAAW,OAAO;AACtC,MAAI,CAAC,aAAa,OAAO;AACvB,UAAM,IAAI,MAAM,6DAA6D;AAAA,EAC/E;AACA,SAAoB,sBAAa,kBAAW;AAAA,IAC1C;AAAA,IACA,GAAG;AAAA,IACH,wBAAwB;AAAA,IACxB;AAAA,IACA;AAAA,IACA,OAAO,YAAY;AAAA,IACnB,UAAU,CAAc,qBAAa,uBAAe;AAAA,MAClD,OAAO,YAAY;AAAA,MACnB,QAAqB,qBAAY,0BAAmB,CAAC,CAAC;AAAA,MAGtD,OAAO;AAAA,QACL,OAAO;AAAA,QACP,QAAQ;AAAA,MACV;AAAA,MACA,UAAuB,qBAAK,MAAM;AAAA,QAChC,MAAM;AAAA,QACN,MAAM;AAAA,MACR,CAAC;AAAA,IACH,CAAC,GAAgB,sBAAa,2BAAoB;AAAA,MAChD,UAAU,CAAc,qBAAY,4BAAqB;AAAA,QACvD;AAAA,MACF,CAAC,GAAG,UAAuB,qBAAY,0BAAmB;AAAA,QACxD,UAAU;AAAA,MACZ,CAAC,CAAC;AAAA,IACJ,CAAC,CAAC;AAAA,EACJ,CAAC;AACH,CAAC;",
|
|
6
6
|
"names": ["RadioItem"]
|
|
7
7
|
}
|
|
@@ -8,8 +8,6 @@ import { Tabs } from "./tabs/index.mjs";
|
|
|
8
8
|
import { kebabCase, normalizeTextString } from "./utils/strings.mjs";
|
|
9
9
|
import { withIgnoreIMEEvents } from "./utils/with-ignore-ime-events.mjs";
|
|
10
10
|
import { lock } from "./lock-unlock.mjs";
|
|
11
|
-
import Avatar from "./avatar/index.mjs";
|
|
12
|
-
import AvatarGroup from "./avatar-group/index.mjs";
|
|
13
11
|
import Badge from "./badge/index.mjs";
|
|
14
12
|
import { DateCalendar, DateRangeCalendar, TZDate } from "./calendar/index.mjs";
|
|
15
13
|
import { ValidatedCheckboxControl, ValidatedComboboxControl, ValidatedInputControl, ValidatedNumberControl, ValidatedSelectControl, ValidatedRadioControl, ValidatedTextControl, ValidatedTextareaControl, ValidatedToggleControl, ValidatedToggleGroupControl } from "./validated-form-controls/index.mjs";
|
|
@@ -17,8 +15,6 @@ import { ValidatedFormTokenField } from "./validated-form-controls/components/fo
|
|
|
17
15
|
var privateApis = {};
|
|
18
16
|
lock(privateApis, {
|
|
19
17
|
__experimentalPopoverLegacyPositionToPlacement,
|
|
20
|
-
Avatar,
|
|
21
|
-
AvatarGroup,
|
|
22
18
|
ComponentsContext,
|
|
23
19
|
Tabs,
|
|
24
20
|
Theme,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/private-apis.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport { useDrag } from '@use-gesture/react';\n\n/**\n * Internal dependencies\n */\nimport { positionToPlacement as __experimentalPopoverLegacyPositionToPlacement } from './popover/utils';\nimport { Menu } from './menu';\nimport { ComponentsContext } from './context/context-system-provider';\nimport Theme from './theme';\nimport { Tabs } from './tabs';\nimport { kebabCase, normalizeTextString } from './utils/strings';\nimport { withIgnoreIMEEvents } from './utils/with-ignore-ime-events';\nimport { lock } from './lock-unlock';\nimport
|
|
5
|
-
"mappings": ";AAGA,SAAS,eAAe;AAKxB,SAAS,uBAAuB,sDAAsD;AACtF,SAAS,YAAY;AACrB,SAAS,yBAAyB;AAClC,OAAO,WAAW;AAClB,SAAS,YAAY;AACrB,SAAS,WAAW,2BAA2B;AAC/C,SAAS,2BAA2B;AACpC,SAAS,YAAY;AACrB,OAAO,
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport { useDrag } from '@use-gesture/react';\n\n/**\n * Internal dependencies\n */\nimport { positionToPlacement as __experimentalPopoverLegacyPositionToPlacement } from './popover/utils';\nimport { Menu } from './menu';\nimport { ComponentsContext } from './context/context-system-provider';\nimport Theme from './theme';\nimport { Tabs } from './tabs';\nimport { kebabCase, normalizeTextString } from './utils/strings';\nimport { withIgnoreIMEEvents } from './utils/with-ignore-ime-events';\nimport { lock } from './lock-unlock';\nimport Badge from './badge';\nimport { DateCalendar, DateRangeCalendar, TZDate } from './calendar';\nimport { ValidatedCheckboxControl, ValidatedComboboxControl, ValidatedInputControl, ValidatedNumberControl, ValidatedSelectControl, ValidatedRadioControl, ValidatedTextControl, ValidatedTextareaControl, ValidatedToggleControl, ValidatedToggleGroupControl } from './validated-form-controls';\nimport { ValidatedFormTokenField } from './validated-form-controls/components/form-token-field';\nexport const privateApis = {};\nlock(privateApis, {\n __experimentalPopoverLegacyPositionToPlacement,\n ComponentsContext,\n Tabs,\n Theme,\n Menu,\n kebabCase,\n withIgnoreIMEEvents,\n Badge,\n normalizeTextString,\n DateCalendar,\n DateRangeCalendar,\n TZDate,\n useDrag,\n ValidatedInputControl,\n ValidatedCheckboxControl,\n ValidatedComboboxControl,\n ValidatedNumberControl,\n ValidatedSelectControl,\n ValidatedRadioControl,\n ValidatedTextControl,\n ValidatedTextareaControl,\n ValidatedToggleControl,\n ValidatedToggleGroupControl,\n ValidatedFormTokenField\n});"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,eAAe;AAKxB,SAAS,uBAAuB,sDAAsD;AACtF,SAAS,YAAY;AACrB,SAAS,yBAAyB;AAClC,OAAO,WAAW;AAClB,SAAS,YAAY;AACrB,SAAS,WAAW,2BAA2B;AAC/C,SAAS,2BAA2B;AACpC,SAAS,YAAY;AACrB,OAAO,WAAW;AAClB,SAAS,cAAc,mBAAmB,cAAc;AACxD,SAAS,0BAA0B,0BAA0B,uBAAuB,wBAAwB,wBAAwB,uBAAuB,sBAAsB,0BAA0B,wBAAwB,mCAAmC;AACtQ,SAAS,+BAA+B;AACjC,IAAM,cAAc,CAAC;AAC5B,KAAK,aAAa;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -45,7 +45,7 @@ function UnforwardedTooltip(props, ref) {
|
|
|
45
45
|
alternative: "`placement` prop"
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
-
computedPlacement = computedPlacement || "
|
|
48
|
+
computedPlacement = computedPlacement || "top";
|
|
49
49
|
const tooltipStore = Ariakit.useTooltipStore({
|
|
50
50
|
placement: computedPlacement,
|
|
51
51
|
showTimeout: delay
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/tooltip/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as Ariakit from '@ariakit/react';\nimport clsx from 'clsx';\nimport { useInstanceId } from '@wordpress/compose';\nimport { Children, useContext, forwardRef, cloneElement } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\nimport Shortcut from '../shortcut';\nimport { positionToPlacement } from '../popover/utils';\nimport { TooltipInternalContext } from './context';\n\n/**\n * Time over anchor to wait before showing tooltip\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport const TOOLTIP_DELAY = 700;\nconst CONTEXT_VALUE = {\n isNestedInTooltip: true\n};\nfunction UnforwardedTooltip(props, ref) {\n const {\n children,\n className,\n delay = TOOLTIP_DELAY,\n hideOnClick = true,\n placement,\n position,\n shortcut,\n text,\n ...restProps\n } = props;\n const {\n isNestedInTooltip\n } = useContext(TooltipInternalContext);\n const baseId = useInstanceId(Tooltip, 'tooltip');\n const describedById = text || shortcut ? baseId : undefined;\n const isOnlyChild = Children.count(children) === 1;\n // console error if more than one child element is added\n if (!isOnlyChild) {\n if ('development' === process.env.NODE_ENV) {\n // eslint-disable-next-line no-console\n console.error('wp-components.Tooltip should be called with only a single child element.');\n }\n }\n\n // Compute tooltip's placement:\n // - give priority to `placement` prop, if defined\n // - otherwise, compute it from the legacy `position` prop (if defined)\n // - finally, fallback to the default placement: '
|
|
4
|
+
"sourcesContent": ["import * as Ariakit from '@ariakit/react';\nimport clsx from 'clsx';\nimport { useInstanceId } from '@wordpress/compose';\nimport { Children, useContext, forwardRef, cloneElement } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\nimport Shortcut from '../shortcut';\nimport { positionToPlacement } from '../popover/utils';\nimport { TooltipInternalContext } from './context';\n\n/**\n * Time over anchor to wait before showing tooltip\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport const TOOLTIP_DELAY = 700;\nconst CONTEXT_VALUE = {\n isNestedInTooltip: true\n};\nfunction UnforwardedTooltip(props, ref) {\n const {\n children,\n className,\n delay = TOOLTIP_DELAY,\n hideOnClick = true,\n placement,\n position,\n shortcut,\n text,\n ...restProps\n } = props;\n const {\n isNestedInTooltip\n } = useContext(TooltipInternalContext);\n const baseId = useInstanceId(Tooltip, 'tooltip');\n const describedById = text || shortcut ? baseId : undefined;\n const isOnlyChild = Children.count(children) === 1;\n // console error if more than one child element is added\n if (!isOnlyChild) {\n if ('development' === process.env.NODE_ENV) {\n // eslint-disable-next-line no-console\n console.error('wp-components.Tooltip should be called with only a single child element.');\n }\n }\n\n // Compute tooltip's placement:\n // - give priority to `placement` prop, if defined\n // - otherwise, compute it from the legacy `position` prop (if defined)\n // - finally, fallback to the default placement: 'top'\n let computedPlacement;\n if (placement !== undefined) {\n computedPlacement = placement;\n } else if (position !== undefined) {\n computedPlacement = positionToPlacement(position);\n deprecated('`position` prop in wp.components.tooltip', {\n since: '6.4',\n alternative: '`placement` prop'\n });\n }\n computedPlacement = computedPlacement || 'top';\n const tooltipStore = Ariakit.useTooltipStore({\n placement: computedPlacement,\n showTimeout: delay\n });\n const mounted = Ariakit.useStoreState(tooltipStore, 'mounted');\n if (isNestedInTooltip) {\n return isOnlyChild ? /*#__PURE__*/_jsx(Ariakit.Role, {\n ...restProps,\n render: children\n }) : children;\n }\n\n // TODO: this is a temporary workaround to minimize the effects of the\n // Ariakit upgrade. Ariakit doesn't pass the `aria-describedby` prop to\n // the tooltip anchor anymore since 0.4.0, so we need to add it manually.\n // The `aria-describedby` attribute is added only if the anchor doesn't have\n // one already, and if the tooltip text is not the same as the anchor's\n // `aria-label`\n // See: https://github.com/WordPress/gutenberg/pull/64066\n // See: https://github.com/WordPress/gutenberg/pull/65989\n function addDescribedById(element) {\n return describedById && mounted && element.props['aria-describedby'] === undefined && element.props['aria-label'] !== text ? cloneElement(element, {\n 'aria-describedby': describedById\n }) : element;\n }\n return /*#__PURE__*/_jsxs(TooltipInternalContext.Provider, {\n value: CONTEXT_VALUE,\n children: [/*#__PURE__*/_jsx(Ariakit.TooltipAnchor, {\n onClick: hideOnClick ? tooltipStore.hide : undefined,\n store: tooltipStore,\n render: isOnlyChild ? addDescribedById(children) : undefined,\n ref: ref,\n children: isOnlyChild ? undefined : children\n }), isOnlyChild && (text || shortcut) && /*#__PURE__*/_jsxs(Ariakit.Tooltip, {\n ...restProps,\n className: clsx('components-tooltip', className),\n unmountOnHide: true,\n gutter: 4,\n id: describedById,\n overflowPadding: 0.5,\n store: tooltipStore,\n children: [text, shortcut && /*#__PURE__*/_jsx(Shortcut, {\n className: text ? 'components-tooltip__shortcut' : '',\n shortcut: shortcut\n })]\n })]\n });\n}\nexport const Tooltip = forwardRef(UnforwardedTooltip);\nexport default Tooltip;"],
|
|
5
5
|
"mappings": ";AAAA,YAAY,aAAa;AACzB,OAAO,UAAU;AACjB,SAAS,qBAAqB;AAC9B,SAAS,UAAU,YAAY,YAAY,oBAAoB;AAC/D,OAAO,gBA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AAAA,MACjJ,oBAAoB;AAAA,IACtB,CAAC,IAAI;AAAA,EACP;AACA,SAAoB,sBAAM,uBAAuB,UAAU;AAAA,IACzD,OAAO;AAAA,IACP,UAAU,CAAc,qBAAa,uBAAe;AAAA,MAClD,SAAS,cAAc,aAAa,OAAO;AAAA,MAC3C,OAAO;AAAA,MACP,QAAQ,cAAc,iBAAiB,QAAQ,IAAI;AAAA,MACnD;AAAA,MACA,UAAU,cAAc,SAAY;AAAA,IACtC,CAAC,GAAG,gBAAgB,QAAQ,aAA0B,sBAAc,iBAAS;AAAA,MAC3E,GAAG;AAAA,MACH,WAAW,KAAK,sBAAsB,SAAS;AAAA,MAC/C,eAAe;AAAA,MACf,QAAQ;AAAA,MACR,IAAI;AAAA,MACJ,iBAAiB;AAAA,MACjB,OAAO;AAAA,MACP,UAAU,CAAC,MAAM,YAAyB,qBAAK,UAAU;AAAA,QACvD,WAAW,OAAO,iCAAiC;AAAA,QACnD;AAAA,MACF,CAAC,CAAC;AAAA,IACJ,CAAC,CAAC;AAAA,EACJ,CAAC;AACH;AACO,IAAMA,WAAU,WAAW,kBAAkB;AACpD,IAAO,kBAAQA;",
|
|
6
6
|
"names": ["Tooltip"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/visually-hidden/styles.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\n\nexport const visuallyHidden = {\n border: 0,\n clip: 'rect(1px, 1px, 1px, 1px)',\n WebkitClipPath: 'inset( 50% )',\n clipPath: 'inset( 50% )',\n height: '1px',\n margin: '-1px',\n overflow: 'hidden',\n padding: 0,\n position: 'absolute',\n width: '1px',\n wordWrap: 'normal'\n};"],
|
|
5
|
-
"mappings": ";AAIO,IAAM,iBAAiB;AAAA,EAC5B,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,gBAAgB;AAAA,EAChB,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,SAAS;AAAA,EACT,UAAU;AAAA,EACV,OAAO;AAAA,EACP,UAAU;
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\n\nexport const visuallyHidden = {\n border: 0,\n clip: 'rect(1px, 1px, 1px, 1px)',\n WebkitClipPath: 'inset( 50% )',\n clipPath: 'inset( 50% )',\n height: '1px',\n margin: '-1px',\n overflow: 'hidden',\n padding: 0,\n position: 'absolute',\n width: '1px',\n wordWrap: 'normal',\n wordBreak: 'normal'\n};"],
|
|
5
|
+
"mappings": ";AAIO,IAAM,iBAAiB;AAAA,EAC5B,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,gBAAgB;AAAA,EAChB,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,SAAS;AAAA,EACT,UAAU;AAAA,EACV,OAAO;AAAA,EACP,UAAU;AAAA,EACV,WAAW;AACb;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -167,186 +167,6 @@
|
|
|
167
167
|
outline: 2px solid transparent;
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
.components-avatar {
|
|
171
|
-
display: inline-flex;
|
|
172
|
-
align-items: center;
|
|
173
|
-
border-radius: 9999px;
|
|
174
|
-
overflow: clip;
|
|
175
|
-
flex-shrink: 0;
|
|
176
|
-
background-color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
|
|
177
|
-
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) #fff, 0 1px 1px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.02), 0 3px 3px rgba(0, 0, 0, 0.02), 0 4px 4px rgba(0, 0, 0, 0.01);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
.components-avatar__image {
|
|
181
|
-
box-sizing: border-box;
|
|
182
|
-
position: relative;
|
|
183
|
-
width: 32px;
|
|
184
|
-
height: 32px;
|
|
185
|
-
border-radius: 9999px;
|
|
186
|
-
border: 0;
|
|
187
|
-
background-color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
|
|
188
|
-
overflow: clip;
|
|
189
|
-
flex-shrink: 0;
|
|
190
|
-
font-size: 0;
|
|
191
|
-
color: #fff;
|
|
192
|
-
}
|
|
193
|
-
.is-small > .components-avatar__image {
|
|
194
|
-
width: 24px;
|
|
195
|
-
height: 24px;
|
|
196
|
-
}
|
|
197
|
-
.has-src > .components-avatar__image {
|
|
198
|
-
background-image: var(--components-avatar-url);
|
|
199
|
-
background-size: cover;
|
|
200
|
-
background-position: center;
|
|
201
|
-
}
|
|
202
|
-
.has-avatar-border-color > .components-avatar__image {
|
|
203
|
-
border: var(--wp-admin-border-width-focus) solid var(--components-avatar-outline-color);
|
|
204
|
-
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) #fff;
|
|
205
|
-
background-clip: padding-box;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
.components-avatar:not(.has-src) > .components-avatar__image {
|
|
209
|
-
display: flex;
|
|
210
|
-
align-items: center;
|
|
211
|
-
justify-content: center;
|
|
212
|
-
font-size: 11px;
|
|
213
|
-
font-weight: 499;
|
|
214
|
-
border: 0;
|
|
215
|
-
box-shadow: none;
|
|
216
|
-
background-clip: border-box;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
.components-avatar:not(.has-src).has-avatar-border-color > .components-avatar__image {
|
|
220
|
-
background-color: var(--components-avatar-outline-color);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
.components-avatar__name {
|
|
224
|
-
font-size: 13px;
|
|
225
|
-
line-height: 20px;
|
|
226
|
-
color: #fff;
|
|
227
|
-
min-width: 0;
|
|
228
|
-
padding-bottom: 2px;
|
|
229
|
-
overflow: hidden;
|
|
230
|
-
opacity: 0;
|
|
231
|
-
white-space: nowrap;
|
|
232
|
-
transition: opacity 0.15s cubic-bezier(0.15, 0, 0.15, 1);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
.components-avatar.has-badge {
|
|
236
|
-
display: inline-grid;
|
|
237
|
-
grid-template-columns: min-content 0fr;
|
|
238
|
-
column-gap: 0;
|
|
239
|
-
padding-inline-end: 0;
|
|
240
|
-
transition: grid-template-columns 0.3s cubic-bezier(0.15, 0, 0.15, 1), column-gap 0.3s cubic-bezier(0.15, 0, 0.15, 1), padding-inline-end 0.3s cubic-bezier(0.15, 0, 0.15, 1);
|
|
241
|
-
}
|
|
242
|
-
.components-avatar.has-badge:hover {
|
|
243
|
-
grid-template-columns: min-content 1fr;
|
|
244
|
-
column-gap: 4px;
|
|
245
|
-
padding-inline-end: 8px;
|
|
246
|
-
transition-timing-function: cubic-bezier(0.85, 0, 0.85, 1);
|
|
247
|
-
}
|
|
248
|
-
.components-avatar.has-badge:hover .components-avatar__name {
|
|
249
|
-
opacity: 1;
|
|
250
|
-
transition-timing-function: cubic-bezier(0.85, 0, 0.85, 1);
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
.components-avatar.has-badge.has-avatar-border-color {
|
|
254
|
-
background-color: var(--components-avatar-outline-color);
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
.components-avatar.has-status.has-src > .components-avatar__image {
|
|
258
|
-
background-image: none;
|
|
259
|
-
}
|
|
260
|
-
.components-avatar.has-status.has-src > .components-avatar__image::before {
|
|
261
|
-
content: "";
|
|
262
|
-
position: absolute;
|
|
263
|
-
inset: 0;
|
|
264
|
-
border-radius: inherit;
|
|
265
|
-
background-image: var(--components-avatar-url);
|
|
266
|
-
background-size: cover;
|
|
267
|
-
background-position: center;
|
|
268
|
-
mix-blend-mode: luminosity;
|
|
269
|
-
opacity: 0.3;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
.components-avatar.has-status:not(.has-src) > .components-avatar__image {
|
|
273
|
-
color: rgba(255, 255, 255, 0.3);
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
.components-avatar.has-status.has-avatar-border-color > .components-avatar__image {
|
|
277
|
-
background-color: var(--components-avatar-outline-color);
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
.components-avatar__status-indicator {
|
|
281
|
-
position: absolute;
|
|
282
|
-
inset: 0;
|
|
283
|
-
display: flex;
|
|
284
|
-
align-items: center;
|
|
285
|
-
justify-content: center;
|
|
286
|
-
z-index: 1;
|
|
287
|
-
color: #fff;
|
|
288
|
-
fill: #fff;
|
|
289
|
-
}
|
|
290
|
-
.components-avatar__status-indicator svg {
|
|
291
|
-
width: 75%;
|
|
292
|
-
height: 75%;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
@media (prefers-reduced-motion: reduce) {
|
|
296
|
-
.components-avatar.has-badge,
|
|
297
|
-
.components-avatar__name {
|
|
298
|
-
transition: none;
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
.components-avatar-group {
|
|
302
|
-
display: flex;
|
|
303
|
-
align-items: center;
|
|
304
|
-
}
|
|
305
|
-
.components-avatar-group > .components-avatar + .components-avatar {
|
|
306
|
-
margin-inline-start: -8px;
|
|
307
|
-
}
|
|
308
|
-
.components-avatar-group > .components-avatar {
|
|
309
|
-
position: relative;
|
|
310
|
-
}
|
|
311
|
-
.components-avatar-group > .components-avatar:nth-child(1) {
|
|
312
|
-
z-index: 10;
|
|
313
|
-
}
|
|
314
|
-
.components-avatar-group > .components-avatar:nth-child(2) {
|
|
315
|
-
z-index: 9;
|
|
316
|
-
}
|
|
317
|
-
.components-avatar-group > .components-avatar:nth-child(3) {
|
|
318
|
-
z-index: 8;
|
|
319
|
-
}
|
|
320
|
-
.components-avatar-group > .components-avatar:nth-child(4) {
|
|
321
|
-
z-index: 7;
|
|
322
|
-
}
|
|
323
|
-
.components-avatar-group > .components-avatar:nth-child(5) {
|
|
324
|
-
z-index: 6;
|
|
325
|
-
}
|
|
326
|
-
.components-avatar-group > .components-avatar:nth-child(6) {
|
|
327
|
-
z-index: 5;
|
|
328
|
-
}
|
|
329
|
-
.components-avatar-group > .components-avatar:nth-child(7) {
|
|
330
|
-
z-index: 4;
|
|
331
|
-
}
|
|
332
|
-
.components-avatar-group > .components-avatar:nth-child(8) {
|
|
333
|
-
z-index: 3;
|
|
334
|
-
}
|
|
335
|
-
.components-avatar-group > .components-avatar:nth-child(9) {
|
|
336
|
-
z-index: 2;
|
|
337
|
-
}
|
|
338
|
-
.components-avatar-group > .components-avatar:nth-child(10) {
|
|
339
|
-
z-index: 1;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
.components-avatar-group__overflow {
|
|
343
|
-
margin-inline-start: 4px;
|
|
344
|
-
font-size: 12px;
|
|
345
|
-
line-height: 20px;
|
|
346
|
-
color: #1e1e1e;
|
|
347
|
-
white-space: nowrap;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
170
|
.components-badge {
|
|
351
171
|
box-sizing: border-box;
|
|
352
172
|
}
|
|
@@ -935,6 +755,10 @@ p + .components-button.is-tertiary {
|
|
|
935
755
|
background-color: var(--wp-components-color-gray-800, #2f2f2f);
|
|
936
756
|
}
|
|
937
757
|
|
|
758
|
+
.components-calendar__day--outside {
|
|
759
|
+
color: var(--wp-components-color-gray-600, #949494);
|
|
760
|
+
}
|
|
761
|
+
|
|
938
762
|
.components-calendar__day--hidden {
|
|
939
763
|
visibility: hidden;
|
|
940
764
|
}
|
|
@@ -2253,6 +2077,7 @@ body.is-dragging-components-draggable {
|
|
|
2253
2077
|
outline-style: solid;
|
|
2254
2078
|
outline-width: calc(2 * var(--wp-admin-border-width-focus) / var(--wp-block-editor-iframe-zoom-out-scale, 1));
|
|
2255
2079
|
outline-offset: calc(2 * -1 * var(--wp-admin-border-width-focus) / var(--wp-block-editor-iframe-zoom-out-scale, 1));
|
|
2080
|
+
box-shadow: inset 0 0 0 calc(var(--wp-admin-border-width-focus, 2px) + 1px) #fff, 0 0 0 1px #fff, 0 1px 1px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.02), 0 3px 3px rgba(0, 0, 0, 0.02), 0 4px 4px rgba(0, 0, 0, 0.01);
|
|
2256
2081
|
z-index: 1000000;
|
|
2257
2082
|
}
|
|
2258
2083
|
|
|
@@ -2268,6 +2093,7 @@ body.is-dragging-components-draggable {
|
|
|
2268
2093
|
outline-style: solid;
|
|
2269
2094
|
outline-width: calc(2 * var(--wp-admin-border-width-focus) / var(--wp-block-editor-iframe-zoom-out-scale, 1));
|
|
2270
2095
|
outline-offset: calc(2 * -1 * var(--wp-admin-border-width-focus) / var(--wp-block-editor-iframe-zoom-out-scale, 1));
|
|
2096
|
+
box-shadow: inset 0 0 0 calc(var(--wp-admin-border-width-focus, 2px) + 1px) #fff, 0 0 0 1px #fff, 0 1px 1px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.02), 0 3px 3px rgba(0, 0, 0, 0.02), 0 4px 4px rgba(0, 0, 0, 0.01);
|
|
2271
2097
|
z-index: 1000000;
|
|
2272
2098
|
}
|
|
2273
2099
|
.is-focusing-regions.is-distraction-free .interface-interface-skeleton__header .edit-post-header,
|
|
@@ -2279,6 +2105,7 @@ body.is-dragging-components-draggable {
|
|
|
2279
2105
|
outline-style: solid;
|
|
2280
2106
|
outline-width: calc(2 * var(--wp-admin-border-width-focus) / var(--wp-block-editor-iframe-zoom-out-scale, 1));
|
|
2281
2107
|
outline-offset: calc(2 * -1 * var(--wp-admin-border-width-focus) / var(--wp-block-editor-iframe-zoom-out-scale, 1));
|
|
2108
|
+
box-shadow: inset 0 0 0 calc(var(--wp-admin-border-width-focus, 2px) + 1px) #fff, 0 0 0 1px #fff, 0 1px 1px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.02), 0 3px 3px rgba(0, 0, 0, 0.02), 0 4px 4px rgba(0, 0, 0, 0.01);
|
|
2282
2109
|
}
|
|
2283
2110
|
|
|
2284
2111
|
.components-menu-group + .components-menu-group {
|
|
@@ -2480,7 +2307,7 @@ body.is-dragging-components-draggable {
|
|
|
2480
2307
|
border-radius: 8px;
|
|
2481
2308
|
margin: auto;
|
|
2482
2309
|
width: auto;
|
|
2483
|
-
min-width:
|
|
2310
|
+
min-width: var(--wpds-dimension-surface-width-sm, 320px);
|
|
2484
2311
|
max-width: calc(100% - 32px);
|
|
2485
2312
|
max-height: calc(100% - 128px);
|
|
2486
2313
|
}
|
|
@@ -2504,13 +2331,13 @@ body.is-dragging-components-draggable {
|
|
|
2504
2331
|
width: 100%;
|
|
2505
2332
|
}
|
|
2506
2333
|
.components-modal__frame.has-size-small {
|
|
2507
|
-
max-width:
|
|
2334
|
+
max-width: var(--wpds-dimension-surface-width-md, 400px);
|
|
2508
2335
|
}
|
|
2509
2336
|
.components-modal__frame.has-size-medium {
|
|
2510
|
-
max-width:
|
|
2337
|
+
max-width: var(--wpds-dimension-surface-width-lg, 560px);
|
|
2511
2338
|
}
|
|
2512
2339
|
.components-modal__frame.has-size-large {
|
|
2513
|
-
max-width:
|
|
2340
|
+
max-width: var(--wpds-dimension-surface-width-2xl, 960px);
|
|
2514
2341
|
}
|
|
2515
2342
|
}
|
|
2516
2343
|
@media (min-width: 960px) {
|