@wordpress/components 29.11.0 → 29.13.1-next.719a03cbe.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 -0
- package/build/box-control/input-control.js +2 -2
- package/build/box-control/input-control.js.map +1 -1
- package/build/calendar/date-calendar/index.js +60 -0
- package/build/calendar/date-calendar/index.js.map +1 -0
- package/build/calendar/date-range-calendar/index.js +168 -0
- package/build/calendar/date-range-calendar/index.js.map +1 -0
- package/build/calendar/index.js +27 -0
- package/build/calendar/index.js.map +1 -0
- package/build/calendar/types.js +6 -0
- package/build/calendar/types.js.map +1 -0
- package/build/calendar/utils/constants.js +68 -0
- package/build/calendar/utils/constants.js.map +1 -0
- package/build/calendar/utils/day-cell.js +137 -0
- package/build/calendar/utils/day-cell.js.map +1 -0
- package/build/calendar/utils/misc.js +10 -0
- package/build/calendar/utils/misc.js.map +1 -0
- package/build/calendar/utils/use-controlled-value.js +58 -0
- package/build/calendar/utils/use-controlled-value.js.map +1 -0
- package/build/calendar/utils/use-localization-props.js +162 -0
- package/build/calendar/utils/use-localization-props.js.map +1 -0
- package/build/custom-gradient-picker/gradient-bar/control-points.js +1 -1
- package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
- package/build/custom-select-control-v2/custom-select.js +3 -3
- package/build/custom-select-control-v2/custom-select.js.map +1 -1
- package/build/date-time/date/index.js +1 -1
- package/build/date-time/date/index.js.map +1 -1
- package/build/form-file-upload/index.js +4 -6
- package/build/form-file-upload/index.js.map +1 -1
- package/build/form-token-field/index.js +11 -1
- package/build/form-token-field/index.js.map +1 -1
- package/build/form-token-field/token.js +1 -1
- package/build/form-token-field/token.js.map +1 -1
- package/build/index.js +19 -0
- package/build/index.js.map +1 -1
- package/build/mobile/bottom-sheet/cell.native.js +2 -2
- package/build/mobile/bottom-sheet/cell.native.js.map +1 -1
- package/build/mobile/image/index.native.js +1 -1
- package/build/mobile/image/index.native.js.map +1 -1
- package/build/mobile/link-picker/index.native.js +1 -1
- package/build/mobile/link-picker/index.native.js.map +1 -1
- package/build/navigation/menu/menu-title-search.js +1 -1
- package/build/navigation/menu/menu-title-search.js.map +1 -1
- package/build/palette-edit/index.js +4 -4
- package/build/palette-edit/index.js.map +1 -1
- package/build-module/box-control/input-control.js +2 -2
- package/build-module/box-control/input-control.js.map +1 -1
- package/build-module/calendar/date-calendar/index.js +51 -0
- package/build-module/calendar/date-calendar/index.js.map +1 -0
- package/build-module/calendar/date-range-calendar/index.js +157 -0
- package/build-module/calendar/date-range-calendar/index.js.map +1 -0
- package/build-module/calendar/index.js +4 -0
- package/build-module/calendar/index.js.map +1 -0
- package/build-module/calendar/types.js +2 -0
- package/build-module/calendar/types.js.map +1 -0
- package/build-module/calendar/utils/constants.js +61 -0
- package/build-module/calendar/utils/constants.js.map +1 -0
- package/build-module/calendar/utils/day-cell.js +131 -0
- package/build-module/calendar/utils/day-cell.js.map +1 -0
- package/build-module/calendar/utils/misc.js +4 -0
- package/build-module/calendar/utils/misc.js.map +1 -0
- package/build-module/calendar/utils/use-controlled-value.js +51 -0
- package/build-module/calendar/utils/use-controlled-value.js.map +1 -0
- package/build-module/calendar/utils/use-localization-props.js +154 -0
- package/build-module/calendar/utils/use-localization-props.js.map +1 -0
- package/build-module/custom-gradient-picker/gradient-bar/control-points.js +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
- package/build-module/custom-select-control-v2/custom-select.js +4 -4
- package/build-module/custom-select-control-v2/custom-select.js.map +1 -1
- package/build-module/date-time/date/index.js +1 -1
- package/build-module/date-time/date/index.js.map +1 -1
- package/build-module/form-file-upload/index.js +4 -6
- package/build-module/form-file-upload/index.js.map +1 -1
- package/build-module/form-token-field/index.js +11 -1
- package/build-module/form-token-field/index.js.map +1 -1
- package/build-module/form-token-field/token.js +1 -1
- package/build-module/form-token-field/token.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/mobile/bottom-sheet/cell.native.js +2 -2
- package/build-module/mobile/bottom-sheet/cell.native.js.map +1 -1
- package/build-module/mobile/image/index.native.js +1 -1
- package/build-module/mobile/image/index.native.js.map +1 -1
- package/build-module/mobile/link-picker/index.native.js +1 -1
- package/build-module/mobile/link-picker/index.native.js.map +1 -1
- package/build-module/navigation/menu/menu-title-search.js +1 -1
- package/build-module/navigation/menu/menu-title-search.js.map +1 -1
- package/build-module/palette-edit/index.js +4 -4
- package/build-module/palette-edit/index.js.map +1 -1
- package/build-style/style-rtl.css +358 -5
- package/build-style/style.css +358 -5
- package/build-types/box-control/input-control.d.ts.map +1 -1
- package/build-types/box-control/utils.d.ts +7 -7
- package/build-types/calendar/date-calendar/index.d.ts +11 -0
- package/build-types/calendar/date-calendar/index.d.ts.map +1 -0
- package/build-types/calendar/date-range-calendar/index.d.ts +14 -0
- package/build-types/calendar/date-range-calendar/index.d.ts.map +1 -0
- package/build-types/calendar/index.d.ts +4 -0
- package/build-types/calendar/index.d.ts.map +1 -0
- package/build-types/calendar/stories/date-calendar.story.d.ts +16 -0
- package/build-types/calendar/stories/date-calendar.story.d.ts.map +1 -0
- package/build-types/calendar/stories/date-range-calendar.story.d.ts +16 -0
- package/build-types/calendar/stories/date-range-calendar.story.d.ts.map +1 -0
- package/build-types/calendar/test/__utils__/index.d.ts +10 -0
- package/build-types/calendar/test/__utils__/index.d.ts.map +1 -0
- package/build-types/calendar/test/date-calendar.d.ts +2 -0
- package/build-types/calendar/test/date-calendar.d.ts.map +1 -0
- package/build-types/calendar/test/date-range-calendar.d.ts +2 -0
- package/build-types/calendar/test/date-range-calendar.d.ts.map +1 -0
- package/build-types/calendar/types.d.ts +317 -0
- package/build-types/calendar/types.d.ts.map +1 -0
- package/build-types/calendar/utils/constants.d.ts +52 -0
- package/build-types/calendar/utils/constants.d.ts.map +1 -0
- package/build-types/calendar/utils/day-cell.d.ts +21 -0
- package/build-types/calendar/utils/day-cell.d.ts.map +1 -0
- package/build-types/calendar/utils/misc.d.ts +2 -0
- package/build-types/calendar/utils/misc.d.ts.map +1 -0
- package/build-types/calendar/utils/use-controlled-value.d.ts +27 -0
- package/build-types/calendar/utils/use-controlled-value.d.ts.map +1 -0
- package/build-types/calendar/utils/use-localization-props.d.ts +64 -0
- package/build-types/calendar/utils/use-localization-props.d.ts.map +1 -0
- package/build-types/custom-gradient-picker/constants.d.ts +6 -3
- package/build-types/custom-gradient-picker/constants.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/custom-select.d.ts.map +1 -1
- package/build-types/dimension-control/sizes.d.ts +15 -3
- package/build-types/dimension-control/sizes.d.ts.map +1 -1
- package/build-types/font-size-picker/constants.d.ts +2 -2
- package/build-types/font-size-picker/constants.d.ts.map +1 -1
- package/build-types/form-file-upload/index.d.ts.map +1 -1
- package/build-types/form-token-field/index.d.ts.map +1 -1
- package/build-types/index.d.ts +1 -0
- package/build-types/index.d.ts.map +1 -1
- package/build-types/popover/overlay-middlewares.d.ts +6 -1
- package/build-types/popover/overlay-middlewares.d.ts.map +1 -1
- package/package.json +21 -20
- package/src/box-control/input-control.tsx +14 -5
- package/src/calendar/date-calendar/README.md +250 -0
- package/src/calendar/date-calendar/index.tsx +55 -0
- package/src/calendar/date-range-calendar/README.md +287 -0
- package/src/calendar/date-range-calendar/index.tsx +203 -0
- package/src/calendar/index.tsx +3 -0
- package/src/calendar/stories/date-calendar.story.tsx +221 -0
- package/src/calendar/stories/date-range-calendar.story.tsx +230 -0
- package/src/calendar/style.scss +431 -0
- package/src/calendar/test/__utils__/index.ts +56 -0
- package/src/calendar/test/date-calendar.tsx +975 -0
- package/src/calendar/test/date-range-calendar.tsx +1701 -0
- package/src/calendar/types.ts +342 -0
- package/src/calendar/utils/constants.ts +62 -0
- package/src/calendar/utils/day-cell.tsx +133 -0
- package/src/calendar/utils/misc.ts +3 -0
- package/src/calendar/utils/use-controlled-value.ts +61 -0
- package/src/calendar/utils/use-localization-props.ts +169 -0
- package/src/circular-option-picker/stories/index.story.tsx +2 -2
- package/src/custom-gradient-picker/gradient-bar/control-points.tsx +1 -1
- package/src/custom-select-control-v2/custom-select.tsx +6 -3
- package/src/date-time/date/index.tsx +1 -1
- package/src/form-file-upload/index.tsx +6 -12
- package/src/form-token-field/index.tsx +12 -1
- package/src/form-token-field/token.tsx +1 -1
- package/src/index.ts +1 -0
- package/src/mobile/bottom-sheet/cell.native.js +2 -2
- package/src/mobile/image/index.native.js +1 -1
- package/src/mobile/link-picker/index.native.js +1 -1
- package/src/navigation/menu/menu-title-search.tsx +1 -1
- package/src/palette-edit/index.tsx +4 -4
- package/src/select-control/style.scss +0 -6
- package/src/style.scss +1 -0
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 29.13.0-next.0 (2025-07-08)
|
|
6
|
+
|
|
7
|
+
### New Features
|
|
8
|
+
|
|
9
|
+
- Add new `DateCalendar` and `DateRangeCalendar` components ([#70578](https://github.com/WordPress/gutenberg/pull/70578)).
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
- `FormTokenField`: Fix focus lost on tab when `__experimentalExpandOnFocus` is set ([#70591](https://github.com/WordPress/gutenberg/pull/70591)).
|
|
14
|
+
- `SelectControl`: Fix font-size for medium screens to ensure consistency with other inputs ([#70619](https://github.com/WordPress/gutenberg/pull/70619)).
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## 29.12.0 (2025-06-25)
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
- `FormFileUpload`: Extend audio accept MIME types for iOS compatibility ([#70354](https://github.com/WordPress/gutenberg/pull/70354)).
|
|
22
|
+
|
|
23
|
+
### Internal
|
|
24
|
+
|
|
25
|
+
- `FormFileUpload`: Remove temporary fix for selecting .heic file in Chromium browsers ([#70383](https://github.com/WordPress/gutenberg/pull/70383)).
|
|
26
|
+
|
|
5
27
|
## 29.11.0 (2025-06-04)
|
|
6
28
|
|
|
7
29
|
### Enhancement
|
|
@@ -138,14 +138,14 @@ function BoxInputControl({
|
|
|
138
138
|
value: 0,
|
|
139
139
|
label: '',
|
|
140
140
|
tooltip: (0, _i18n.__)('None')
|
|
141
|
-
}
|
|
141
|
+
}, ...presets.map((preset, index) => {
|
|
142
142
|
var _preset$name;
|
|
143
143
|
return {
|
|
144
144
|
value: index + 1,
|
|
145
145
|
label: '',
|
|
146
146
|
tooltip: (_preset$name = preset.name) !== null && _preset$name !== void 0 ? _preset$name : preset.slug
|
|
147
147
|
};
|
|
148
|
-
})
|
|
148
|
+
})] : [];
|
|
149
149
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_boxControlStyles.InputWrapper, {
|
|
150
150
|
expanded: true,
|
|
151
151
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_boxControlStyles.FlexedBoxControlIcon, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_compose","require","_i18n","_element","_icons","_tooltip","_interopRequireDefault","_utils","_utils2","_boxControlStyles","_button","_jsxRuntime","noop","getSidesToModify","side","sides","isAlt","allowedSides","getAllowedSides","modifiedSides","push","filter","s","has","BoxInputControl","__next40pxDefaultSize","onChange","onFocus","values","selectedUnits","setSelectedUnits","min","presets","presetKey","props","_CUSTOM_VALUE_SETTING","_CUSTOM_VALUE_SETTING2","defaultValuesToModify","handleOnFocus","event","handleOnChange","nextValues","handleRawOnValueChange","next","forEach","modifiedSide","handleOnValueChange","extra","isNumeric","undefined","isNaN","parseFloat","nextValue","altKey","handleOnUnitChange","newUnits","mergedValue","getMergedValue","hasValues","isValuesDefined","isMixed","length","isValueMixed","parsedQuantity","parsedUnit","parseQuantityAndUnitFromRawValue","computedUnit","generatedId","useInstanceId","inputId","join","isMixedUnit","some","usedValue","mixedPlaceholder","__","hasPresets","hasPresetValue","isValuePreset","showCustomValueControl","setShowCustomValueControl","useState","presetIndex","getPresetIndexFromValue","marks","value","label","tooltip","concat","map","preset","index","_preset$name","name","slug","jsxs","InputWrapper","expanded","children","jsx","FlexedBoxControlIcon","Fragment","default","placement","text","LABELS","StyledUnitControl","__shouldNotWarnDeprecated36pxSize","className","id","isPressEnterToChange","disableUnits","onUnitChange","placeholder","hideLabelFromVision","FlexedRangeControl","__nextHasNoMarginBottom","newValue","isFinite","max","CUSTOM_VALUE_SETTINGS","step","withInputField","newIndex","getPresetValueFromIndex","renderTooltipContent","icon","settings","onClick","isPressed","size","iconSize"],"sources":["@wordpress/components/src/box-control/input-control.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { settings } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Tooltip from '../tooltip';\nimport { parseQuantityAndUnitFromRawValue } from '../unit-control/utils';\nimport {\n\tCUSTOM_VALUE_SETTINGS,\n\tgetMergedValue,\n\tgetAllowedSides,\n\tgetPresetIndexFromValue,\n\tgetPresetValueFromIndex,\n\tisValuePreset,\n\tisValuesDefined,\n\tisValueMixed,\n\tLABELS,\n} from './utils';\nimport {\n\tFlexedBoxControlIcon,\n\tFlexedRangeControl,\n\tInputWrapper,\n\tStyledUnitControl,\n} from './styles/box-control-styles';\nimport type { BoxControlInputControlProps, BoxControlValue } from './types';\nimport Button from '../button';\n\nconst noop = () => {};\n\nfunction getSidesToModify(\n\tside: BoxControlInputControlProps[ 'side' ],\n\tsides: BoxControlInputControlProps[ 'sides' ],\n\tisAlt?: boolean\n) {\n\tconst allowedSides = getAllowedSides( sides );\n\n\tlet modifiedSides: ( keyof BoxControlValue )[] = [];\n\tswitch ( side ) {\n\t\tcase 'all':\n\t\t\tmodifiedSides = [ 'top', 'bottom', 'left', 'right' ];\n\t\t\tbreak;\n\t\tcase 'horizontal':\n\t\t\tmodifiedSides = [ 'left', 'right' ];\n\t\t\tbreak;\n\t\tcase 'vertical':\n\t\t\tmodifiedSides = [ 'top', 'bottom' ];\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tmodifiedSides = [ side ];\n\t}\n\n\tif ( isAlt ) {\n\t\tswitch ( side ) {\n\t\t\tcase 'top':\n\t\t\t\tmodifiedSides.push( 'bottom' );\n\t\t\t\tbreak;\n\t\t\tcase 'bottom':\n\t\t\t\tmodifiedSides.push( 'top' );\n\t\t\t\tbreak;\n\t\t\tcase 'left':\n\t\t\t\tmodifiedSides.push( 'left' );\n\t\t\t\tbreak;\n\t\t\tcase 'right':\n\t\t\t\tmodifiedSides.push( 'right' );\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn modifiedSides.filter( ( s ) => allowedSides.has( s ) );\n}\n\nexport default function BoxInputControl( {\n\t__next40pxDefaultSize,\n\tonChange = noop,\n\tonFocus = noop,\n\tvalues,\n\tselectedUnits,\n\tsetSelectedUnits,\n\tsides,\n\tside,\n\tmin = 0,\n\tpresets,\n\tpresetKey,\n\t...props\n}: BoxControlInputControlProps ) {\n\tconst defaultValuesToModify = getSidesToModify( side, sides );\n\n\tconst handleOnFocus = ( event: React.FocusEvent< HTMLInputElement > ) => {\n\t\tonFocus( event, { side } );\n\t};\n\n\tconst handleOnChange = ( nextValues: BoxControlValue ) => {\n\t\tonChange( nextValues );\n\t};\n\n\tconst handleRawOnValueChange = ( next?: string ) => {\n\t\tconst nextValues = { ...values };\n\t\tdefaultValuesToModify.forEach( ( modifiedSide ) => {\n\t\t\tnextValues[ modifiedSide ] = next;\n\t\t} );\n\n\t\thandleOnChange( nextValues );\n\t};\n\n\tconst handleOnValueChange = (\n\t\tnext?: string,\n\t\textra?: { event: React.SyntheticEvent< Element, Event > }\n\t) => {\n\t\tconst nextValues = { ...values };\n\t\tconst isNumeric = next !== undefined && ! isNaN( parseFloat( next ) );\n\t\tconst nextValue = isNumeric ? next : undefined;\n\t\tconst modifiedSides = getSidesToModify(\n\t\t\tside,\n\t\t\tsides,\n\t\t\t/**\n\t\t\t * Supports changing pair sides. For example, holding the ALT key\n\t\t\t * when changing the TOP will also update BOTTOM.\n\t\t\t */\n\t\t\t// @ts-expect-error - TODO: event.altKey is only present when the change event was\n\t\t\t// triggered by a keyboard event. Should this feature be implemented differently so\n\t\t\t// it also works with drag events?\n\t\t\t!! extra?.event.altKey\n\t\t);\n\n\t\tmodifiedSides.forEach( ( modifiedSide ) => {\n\t\t\tnextValues[ modifiedSide ] = nextValue;\n\t\t} );\n\n\t\thandleOnChange( nextValues );\n\t};\n\n\tconst handleOnUnitChange = ( next?: string ) => {\n\t\tconst newUnits = { ...selectedUnits };\n\t\tdefaultValuesToModify.forEach( ( modifiedSide ) => {\n\t\t\tnewUnits[ modifiedSide ] = next;\n\t\t} );\n\t\tsetSelectedUnits( newUnits );\n\t};\n\n\tconst mergedValue = getMergedValue( values, defaultValuesToModify );\n\tconst hasValues = isValuesDefined( values );\n\tconst isMixed =\n\t\thasValues &&\n\t\tdefaultValuesToModify.length > 1 &&\n\t\tisValueMixed( values, defaultValuesToModify );\n\tconst [ parsedQuantity, parsedUnit ] =\n\t\tparseQuantityAndUnitFromRawValue( mergedValue );\n\tconst computedUnit = hasValues\n\t\t? parsedUnit\n\t\t: selectedUnits[ defaultValuesToModify[ 0 ] ];\n\tconst generatedId = useInstanceId( BoxInputControl, 'box-control-input' );\n\tconst inputId = [ generatedId, side ].join( '-' );\n\tconst isMixedUnit =\n\t\tdefaultValuesToModify.length > 1 &&\n\t\tmergedValue === undefined &&\n\t\tdefaultValuesToModify.some(\n\t\t\t( s ) => selectedUnits[ s ] !== computedUnit\n\t\t);\n\tconst usedValue =\n\t\tmergedValue === undefined && computedUnit ? computedUnit : mergedValue;\n\tconst mixedPlaceholder = isMixed || isMixedUnit ? __( 'Mixed' ) : undefined;\n\tconst hasPresets = presets && presets.length > 0 && presetKey;\n\tconst hasPresetValue =\n\t\thasPresets &&\n\t\tmergedValue !== undefined &&\n\t\t! isMixed &&\n\t\tisValuePreset( mergedValue, presetKey );\n\tconst [ showCustomValueControl, setShowCustomValueControl ] = useState(\n\t\t! hasPresets ||\n\t\t\t( ! hasPresetValue && ! isMixed && mergedValue !== undefined )\n\t);\n\tconst presetIndex = hasPresetValue\n\t\t? getPresetIndexFromValue( mergedValue, presetKey, presets )\n\t\t: undefined;\n\tconst marks = hasPresets\n\t\t? [ { value: 0, label: '', tooltip: __( 'None' ) } ].concat(\n\t\t\t\tpresets.map( ( preset, index ) => ( {\n\t\t\t\t\tvalue: index + 1,\n\t\t\t\t\tlabel: '',\n\t\t\t\t\ttooltip: preset.name ?? preset.slug,\n\t\t\t\t} ) )\n\t\t )\n\t\t: [];\n\n\treturn (\n\t\t<InputWrapper key={ `box-control-${ side }` } expanded>\n\t\t\t<FlexedBoxControlIcon side={ side } sides={ sides } />\n\t\t\t{ showCustomValueControl && (\n\t\t\t\t<>\n\t\t\t\t\t<Tooltip placement=\"top-end\" text={ LABELS[ side ] }>\n\t\t\t\t\t\t<StyledUnitControl\n\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t\tmin={ min }\n\t\t\t\t\t\t\t__shouldNotWarnDeprecated36pxSize\n\t\t\t\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t\t\t\tclassName=\"component-box-control__unit-control\"\n\t\t\t\t\t\t\tid={ inputId }\n\t\t\t\t\t\t\tisPressEnterToChange\n\t\t\t\t\t\t\tdisableUnits={ isMixed || isMixedUnit }\n\t\t\t\t\t\t\tvalue={ usedValue }\n\t\t\t\t\t\t\tonChange={ handleOnValueChange }\n\t\t\t\t\t\t\tonUnitChange={ handleOnUnitChange }\n\t\t\t\t\t\t\tonFocus={ handleOnFocus }\n\t\t\t\t\t\t\tlabel={ LABELS[ side ] }\n\t\t\t\t\t\t\tplaceholder={ mixedPlaceholder }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Tooltip>\n\n\t\t\t\t\t<FlexedRangeControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t\t\t__shouldNotWarnDeprecated36pxSize\n\t\t\t\t\t\taria-controls={ inputId }\n\t\t\t\t\t\tlabel={ LABELS[ side ] }\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\thandleOnValueChange(\n\t\t\t\t\t\t\t\tnewValue !== undefined\n\t\t\t\t\t\t\t\t\t? [ newValue, computedUnit ].join( '' )\n\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tmin={ isFinite( min ) ? min : 0 }\n\t\t\t\t\t\tmax={\n\t\t\t\t\t\t\tCUSTOM_VALUE_SETTINGS[ computedUnit ?? 'px' ]\n\t\t\t\t\t\t\t\t?.max ?? 10\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstep={\n\t\t\t\t\t\t\tCUSTOM_VALUE_SETTINGS[ computedUnit ?? 'px' ]\n\t\t\t\t\t\t\t\t?.step ?? 0.1\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvalue={ parsedQuantity ?? 0 }\n\t\t\t\t\t\twithInputField={ false }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\n\t\t\t{ hasPresets && ! showCustomValueControl && (\n\t\t\t\t<FlexedRangeControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tclassName=\"spacing-sizes-control__range-control\"\n\t\t\t\t\tvalue={ presetIndex !== undefined ? presetIndex + 1 : 0 }\n\t\t\t\t\tonChange={ ( newIndex ) => {\n\t\t\t\t\t\tconst newValue =\n\t\t\t\t\t\t\tnewIndex === 0 || newIndex === undefined\n\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t: getPresetValueFromIndex(\n\t\t\t\t\t\t\t\t\t\tnewIndex - 1,\n\t\t\t\t\t\t\t\t\t\tpresetKey,\n\t\t\t\t\t\t\t\t\t\tpresets\n\t\t\t\t\t\t\t\t );\n\t\t\t\t\t\thandleRawOnValueChange( newValue );\n\t\t\t\t\t} }\n\t\t\t\t\twithInputField={ false }\n\t\t\t\t\taria-valuenow={\n\t\t\t\t\t\tpresetIndex !== undefined ? presetIndex + 1 : 0\n\t\t\t\t\t}\n\t\t\t\t\taria-valuetext={\n\t\t\t\t\t\tmarks[ presetIndex !== undefined ? presetIndex + 1 : 0 ]\n\t\t\t\t\t\t\t.tooltip\n\t\t\t\t\t}\n\t\t\t\t\trenderTooltipContent={ ( index ) =>\n\t\t\t\t\t\tmarks[ ! index ? 0 : index ].tooltip\n\t\t\t\t\t}\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tmax={ marks.length - 1 }\n\t\t\t\t\tmarks={ marks }\n\t\t\t\t\tlabel={ LABELS[ side ] }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ hasPresets && (\n\t\t\t\t<Button\n\t\t\t\t\tlabel={\n\t\t\t\t\t\tshowCustomValueControl\n\t\t\t\t\t\t\t? __( 'Use size preset' )\n\t\t\t\t\t\t\t: __( 'Set custom size' )\n\t\t\t\t\t}\n\t\t\t\t\ticon={ settings }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tsetShowCustomValueControl( ! showCustomValueControl );\n\t\t\t\t\t} }\n\t\t\t\t\tisPressed={ showCustomValueControl }\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t\ticonSize={ 24 }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</InputWrapper>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAKA,IAAAI,QAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAA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,KAAK,CAAE,CAAEO,KAAK,GAAG,CAAC,GAAGA,KAAK,CAAE,CAACJ,OAC7B;MACDxD,GAAG,EAAG,CAAG;MACTwF,GAAG,EAAGnC,KAAK,CAACvB,MAAM,GAAG,CAAG;MACxBuB,KAAK,EAAGA,KAAO;MACfE,KAAK,EAAGmB,cAAM,CAAE3F,IAAI,CAAI;MACxBoG,mBAAmB;MACnBE,uBAAuB;IAAA,CACvB,CACD,EAECxC,UAAU,iBACX,IAAAjE,WAAA,CAAAwF,GAAA,EAACzF,OAAA,CAAA4F,OAAM;MACNhB,KAAK,EACJP,sBAAsB,GACnB,IAAAJ,QAAE,EAAE,iBAAkB,CAAC,GACvB,IAAAA,QAAE,EAAE,iBAAkB,CACzB;MACDmD,IAAI,EAAGC,eAAU;MACjBC,OAAO,EAAGA,CAAA,KAAM;QACfhD,yBAAyB,CAAE,CAAED,sBAAuB,CAAC;MACtD,CAAG;MACHkD,SAAS,EAAGlD,sBAAwB;MACpCmD,IAAI,EAAC,OAAO;MACZC,QAAQ,EAAG;IAAI,CACf,CACD;EAAA,GAxGkB,eAAgBrH,IAAI,EAyG1B,CAAC;AAEjB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_compose","require","_i18n","_element","_icons","_tooltip","_interopRequireDefault","_utils","_utils2","_boxControlStyles","_button","_jsxRuntime","noop","getSidesToModify","side","sides","isAlt","allowedSides","getAllowedSides","modifiedSides","push","filter","s","has","BoxInputControl","__next40pxDefaultSize","onChange","onFocus","values","selectedUnits","setSelectedUnits","min","presets","presetKey","props","_CUSTOM_VALUE_SETTING","_CUSTOM_VALUE_SETTING2","defaultValuesToModify","handleOnFocus","event","handleOnChange","nextValues","handleRawOnValueChange","next","forEach","modifiedSide","handleOnValueChange","extra","isNumeric","undefined","isNaN","parseFloat","nextValue","altKey","handleOnUnitChange","newUnits","mergedValue","getMergedValue","hasValues","isValuesDefined","isMixed","length","isValueMixed","parsedQuantity","parsedUnit","parseQuantityAndUnitFromRawValue","computedUnit","generatedId","useInstanceId","inputId","join","isMixedUnit","some","usedValue","mixedPlaceholder","__","hasPresets","hasPresetValue","isValuePreset","showCustomValueControl","setShowCustomValueControl","useState","presetIndex","getPresetIndexFromValue","marks","value","label","tooltip","map","preset","index","_preset$name","name","slug","jsxs","InputWrapper","expanded","children","jsx","FlexedBoxControlIcon","Fragment","default","placement","text","LABELS","StyledUnitControl","__shouldNotWarnDeprecated36pxSize","className","id","isPressEnterToChange","disableUnits","onUnitChange","placeholder","hideLabelFromVision","FlexedRangeControl","__nextHasNoMarginBottom","newValue","isFinite","max","CUSTOM_VALUE_SETTINGS","step","withInputField","newIndex","getPresetValueFromIndex","renderTooltipContent","icon","settings","onClick","isPressed","size","iconSize"],"sources":["@wordpress/components/src/box-control/input-control.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { settings } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Tooltip from '../tooltip';\nimport { parseQuantityAndUnitFromRawValue } from '../unit-control/utils';\nimport {\n\tCUSTOM_VALUE_SETTINGS,\n\tgetMergedValue,\n\tgetAllowedSides,\n\tgetPresetIndexFromValue,\n\tgetPresetValueFromIndex,\n\tisValuePreset,\n\tisValuesDefined,\n\tisValueMixed,\n\tLABELS,\n} from './utils';\nimport {\n\tFlexedBoxControlIcon,\n\tFlexedRangeControl,\n\tInputWrapper,\n\tStyledUnitControl,\n} from './styles/box-control-styles';\nimport type { BoxControlInputControlProps, BoxControlValue } from './types';\nimport Button from '../button';\n\nconst noop = () => {};\n\nfunction getSidesToModify(\n\tside: BoxControlInputControlProps[ 'side' ],\n\tsides: BoxControlInputControlProps[ 'sides' ],\n\tisAlt?: boolean\n) {\n\tconst allowedSides = getAllowedSides( sides );\n\n\tlet modifiedSides: ( keyof BoxControlValue )[] = [];\n\tswitch ( side ) {\n\t\tcase 'all':\n\t\t\tmodifiedSides = [ 'top', 'bottom', 'left', 'right' ];\n\t\t\tbreak;\n\t\tcase 'horizontal':\n\t\t\tmodifiedSides = [ 'left', 'right' ];\n\t\t\tbreak;\n\t\tcase 'vertical':\n\t\t\tmodifiedSides = [ 'top', 'bottom' ];\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tmodifiedSides = [ side ];\n\t}\n\n\tif ( isAlt ) {\n\t\tswitch ( side ) {\n\t\t\tcase 'top':\n\t\t\t\tmodifiedSides.push( 'bottom' );\n\t\t\t\tbreak;\n\t\t\tcase 'bottom':\n\t\t\t\tmodifiedSides.push( 'top' );\n\t\t\t\tbreak;\n\t\t\tcase 'left':\n\t\t\t\tmodifiedSides.push( 'left' );\n\t\t\t\tbreak;\n\t\t\tcase 'right':\n\t\t\t\tmodifiedSides.push( 'right' );\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn modifiedSides.filter( ( s ) => allowedSides.has( s ) );\n}\n\nexport default function BoxInputControl( {\n\t__next40pxDefaultSize,\n\tonChange = noop,\n\tonFocus = noop,\n\tvalues,\n\tselectedUnits,\n\tsetSelectedUnits,\n\tsides,\n\tside,\n\tmin = 0,\n\tpresets,\n\tpresetKey,\n\t...props\n}: BoxControlInputControlProps ) {\n\tconst defaultValuesToModify = getSidesToModify( side, sides );\n\n\tconst handleOnFocus = ( event: React.FocusEvent< HTMLInputElement > ) => {\n\t\tonFocus( event, { side } );\n\t};\n\n\tconst handleOnChange = ( nextValues: BoxControlValue ) => {\n\t\tonChange( nextValues );\n\t};\n\n\tconst handleRawOnValueChange = ( next?: string ) => {\n\t\tconst nextValues = { ...values };\n\t\tdefaultValuesToModify.forEach( ( modifiedSide ) => {\n\t\t\tnextValues[ modifiedSide ] = next;\n\t\t} );\n\n\t\thandleOnChange( nextValues );\n\t};\n\n\tconst handleOnValueChange = (\n\t\tnext?: string,\n\t\textra?: { event: React.SyntheticEvent< Element, Event > }\n\t) => {\n\t\tconst nextValues = { ...values };\n\t\tconst isNumeric = next !== undefined && ! isNaN( parseFloat( next ) );\n\t\tconst nextValue = isNumeric ? next : undefined;\n\t\tconst modifiedSides = getSidesToModify(\n\t\t\tside,\n\t\t\tsides,\n\t\t\t/**\n\t\t\t * Supports changing pair sides. For example, holding the ALT key\n\t\t\t * when changing the TOP will also update BOTTOM.\n\t\t\t */\n\t\t\t// @ts-expect-error - TODO: event.altKey is only present when the change event was\n\t\t\t// triggered by a keyboard event. Should this feature be implemented differently so\n\t\t\t// it also works with drag events?\n\t\t\t!! extra?.event.altKey\n\t\t);\n\n\t\tmodifiedSides.forEach( ( modifiedSide ) => {\n\t\t\tnextValues[ modifiedSide ] = nextValue;\n\t\t} );\n\n\t\thandleOnChange( nextValues );\n\t};\n\n\tconst handleOnUnitChange = ( next?: string ) => {\n\t\tconst newUnits = { ...selectedUnits };\n\t\tdefaultValuesToModify.forEach( ( modifiedSide ) => {\n\t\t\tnewUnits[ modifiedSide ] = next;\n\t\t} );\n\t\tsetSelectedUnits( newUnits );\n\t};\n\n\tconst mergedValue = getMergedValue( values, defaultValuesToModify );\n\tconst hasValues = isValuesDefined( values );\n\tconst isMixed =\n\t\thasValues &&\n\t\tdefaultValuesToModify.length > 1 &&\n\t\tisValueMixed( values, defaultValuesToModify );\n\tconst [ parsedQuantity, parsedUnit ] =\n\t\tparseQuantityAndUnitFromRawValue( mergedValue );\n\tconst computedUnit = hasValues\n\t\t? parsedUnit\n\t\t: selectedUnits[ defaultValuesToModify[ 0 ] ];\n\tconst generatedId = useInstanceId( BoxInputControl, 'box-control-input' );\n\tconst inputId = [ generatedId, side ].join( '-' );\n\tconst isMixedUnit =\n\t\tdefaultValuesToModify.length > 1 &&\n\t\tmergedValue === undefined &&\n\t\tdefaultValuesToModify.some(\n\t\t\t( s ) => selectedUnits[ s ] !== computedUnit\n\t\t);\n\tconst usedValue =\n\t\tmergedValue === undefined && computedUnit ? computedUnit : mergedValue;\n\tconst mixedPlaceholder = isMixed || isMixedUnit ? __( 'Mixed' ) : undefined;\n\tconst hasPresets = presets && presets.length > 0 && presetKey;\n\tconst hasPresetValue =\n\t\thasPresets &&\n\t\tmergedValue !== undefined &&\n\t\t! isMixed &&\n\t\tisValuePreset( mergedValue, presetKey );\n\tconst [ showCustomValueControl, setShowCustomValueControl ] = useState(\n\t\t! hasPresets ||\n\t\t\t( ! hasPresetValue && ! isMixed && mergedValue !== undefined )\n\t);\n\tconst presetIndex = hasPresetValue\n\t\t? getPresetIndexFromValue( mergedValue, presetKey, presets )\n\t\t: undefined;\n\tconst marks: Array< {\n\t\tvalue: number;\n\t\tlabel: string;\n\t\ttooltip: string;\n\t} > = hasPresets\n\t\t? [\n\t\t\t\t{\n\t\t\t\t\tvalue: 0,\n\t\t\t\t\tlabel: '',\n\t\t\t\t\ttooltip: __( 'None' ),\n\t\t\t\t},\n\t\t\t\t...presets.map( ( preset, index ) => ( {\n\t\t\t\t\tvalue: index + 1,\n\t\t\t\t\tlabel: '',\n\t\t\t\t\ttooltip: preset.name ?? preset.slug,\n\t\t\t\t} ) ),\n\t\t ]\n\t\t: [];\n\n\treturn (\n\t\t<InputWrapper key={ `box-control-${ side }` } expanded>\n\t\t\t<FlexedBoxControlIcon side={ side } sides={ sides } />\n\t\t\t{ showCustomValueControl && (\n\t\t\t\t<>\n\t\t\t\t\t<Tooltip placement=\"top-end\" text={ LABELS[ side ] }>\n\t\t\t\t\t\t<StyledUnitControl\n\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t\tmin={ min }\n\t\t\t\t\t\t\t__shouldNotWarnDeprecated36pxSize\n\t\t\t\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t\t\t\tclassName=\"component-box-control__unit-control\"\n\t\t\t\t\t\t\tid={ inputId }\n\t\t\t\t\t\t\tisPressEnterToChange\n\t\t\t\t\t\t\tdisableUnits={ isMixed || isMixedUnit }\n\t\t\t\t\t\t\tvalue={ usedValue }\n\t\t\t\t\t\t\tonChange={ handleOnValueChange }\n\t\t\t\t\t\t\tonUnitChange={ handleOnUnitChange }\n\t\t\t\t\t\t\tonFocus={ handleOnFocus }\n\t\t\t\t\t\t\tlabel={ LABELS[ side ] }\n\t\t\t\t\t\t\tplaceholder={ mixedPlaceholder }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Tooltip>\n\n\t\t\t\t\t<FlexedRangeControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t\t\t__shouldNotWarnDeprecated36pxSize\n\t\t\t\t\t\taria-controls={ inputId }\n\t\t\t\t\t\tlabel={ LABELS[ side ] }\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\thandleOnValueChange(\n\t\t\t\t\t\t\t\tnewValue !== undefined\n\t\t\t\t\t\t\t\t\t? [ newValue, computedUnit ].join( '' )\n\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tmin={ isFinite( min ) ? min : 0 }\n\t\t\t\t\t\tmax={\n\t\t\t\t\t\t\tCUSTOM_VALUE_SETTINGS[ computedUnit ?? 'px' ]\n\t\t\t\t\t\t\t\t?.max ?? 10\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstep={\n\t\t\t\t\t\t\tCUSTOM_VALUE_SETTINGS[ computedUnit ?? 'px' ]\n\t\t\t\t\t\t\t\t?.step ?? 0.1\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvalue={ parsedQuantity ?? 0 }\n\t\t\t\t\t\twithInputField={ false }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\n\t\t\t{ hasPresets && ! showCustomValueControl && (\n\t\t\t\t<FlexedRangeControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tclassName=\"spacing-sizes-control__range-control\"\n\t\t\t\t\tvalue={ presetIndex !== undefined ? presetIndex + 1 : 0 }\n\t\t\t\t\tonChange={ ( newIndex ) => {\n\t\t\t\t\t\tconst newValue =\n\t\t\t\t\t\t\tnewIndex === 0 || newIndex === undefined\n\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t: getPresetValueFromIndex(\n\t\t\t\t\t\t\t\t\t\tnewIndex - 1,\n\t\t\t\t\t\t\t\t\t\tpresetKey,\n\t\t\t\t\t\t\t\t\t\tpresets\n\t\t\t\t\t\t\t\t );\n\t\t\t\t\t\thandleRawOnValueChange( newValue );\n\t\t\t\t\t} }\n\t\t\t\t\twithInputField={ false }\n\t\t\t\t\taria-valuenow={\n\t\t\t\t\t\tpresetIndex !== undefined ? presetIndex + 1 : 0\n\t\t\t\t\t}\n\t\t\t\t\taria-valuetext={\n\t\t\t\t\t\tmarks[ presetIndex !== undefined ? presetIndex + 1 : 0 ]\n\t\t\t\t\t\t\t.tooltip\n\t\t\t\t\t}\n\t\t\t\t\trenderTooltipContent={ ( index ) =>\n\t\t\t\t\t\tmarks[ ! index ? 0 : index ].tooltip\n\t\t\t\t\t}\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tmax={ marks.length - 1 }\n\t\t\t\t\tmarks={ marks }\n\t\t\t\t\tlabel={ LABELS[ side ] }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ hasPresets && (\n\t\t\t\t<Button\n\t\t\t\t\tlabel={\n\t\t\t\t\t\tshowCustomValueControl\n\t\t\t\t\t\t\t? __( 'Use size preset' )\n\t\t\t\t\t\t\t: __( 'Set custom size' )\n\t\t\t\t\t}\n\t\t\t\t\ticon={ settings }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tsetShowCustomValueControl( ! showCustomValueControl );\n\t\t\t\t\t} }\n\t\t\t\t\tisPressed={ showCustomValueControl }\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t\ticonSize={ 24 }\n\t\t\t\t/>\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O;MACxB,iBACCvC,WAAW,KAAKjC,SAAS,GAAGiC,WAAW,GAAG,CAAC,GAAG,CAC9C;MACD,kBACCE,KAAK,CAAEF,WAAW,KAAKjC,SAAS,GAAGiC,WAAW,GAAG,CAAC,GAAG,CAAC,CAAE,CACtDK,OACF;MACDqC,oBAAoB,EAAKlC,KAAK,IAC7BN,KAAK,CAAE,CAAEM,KAAK,GAAG,CAAC,GAAGA,KAAK,CAAE,CAACH,OAC7B;MACDxD,GAAG,EAAG,CAAG;MACTuF,GAAG,EAAGlC,KAAK,CAACvB,MAAM,GAAG,CAAG;MACxBuB,KAAK,EAAGA,KAAO;MACfE,KAAK,EAAGkB,cAAM,CAAE1F,IAAI,CAAI;MACxBmG,mBAAmB;MACnBE,uBAAuB;IAAA,CACvB,CACD,EAECvC,UAAU,iBACX,IAAAjE,WAAA,CAAAuF,GAAA,EAACxF,OAAA,CAAA2F,OAAM;MACNf,KAAK,EACJP,sBAAsB,GACnB,IAAAJ,QAAE,EAAE,iBAAkB,CAAC,GACvB,IAAAA,QAAE,EAAE,iBAAkB,CACzB;MACDkD,IAAI,EAAGC,eAAU;MACjBC,OAAO,EAAGA,CAAA,KAAM;QACf/C,yBAAyB,CAAE,CAAED,sBAAuB,CAAC;MACtD,CAAG;MACHiD,SAAS,EAAGjD,sBAAwB;MACpCkD,IAAI,EAAC,OAAO;MACZC,QAAQ,EAAG;IAAI,CACf,CACD;EAAA,GAxGkB,eAAgBpH,IAAI,EAyG1B,CAAC;AAEjB","ignoreList":[]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DateCalendar = void 0;
|
|
7
|
+
var _reactDayPicker = require("react-day-picker");
|
|
8
|
+
var _locale = require("react-day-picker/locale");
|
|
9
|
+
var _constants = require("../utils/constants");
|
|
10
|
+
var _misc = require("../utils/misc");
|
|
11
|
+
var _useControlledValue = require("../utils/use-controlled-value");
|
|
12
|
+
var _useLocalizationProps = require("../utils/use-localization-props");
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
/**
|
|
15
|
+
* External dependencies
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Internal dependencies
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* `DateCalendar` is a React component that provides a customizable calendar
|
|
24
|
+
* interface for **single date** selection.
|
|
25
|
+
*
|
|
26
|
+
* The component is built with accessibility in mind and follows ARIA best
|
|
27
|
+
* practices for calendar widgets. It provides keyboard navigation, screen reader
|
|
28
|
+
* support, and customizable labels for internationalization.
|
|
29
|
+
*/
|
|
30
|
+
const DateCalendar = ({
|
|
31
|
+
defaultSelected,
|
|
32
|
+
selected: selectedProp,
|
|
33
|
+
onSelect,
|
|
34
|
+
numberOfMonths = 1,
|
|
35
|
+
locale = _locale.enUS,
|
|
36
|
+
timeZone,
|
|
37
|
+
...props
|
|
38
|
+
}) => {
|
|
39
|
+
const localizationProps = (0, _useLocalizationProps.useLocalizationProps)({
|
|
40
|
+
locale,
|
|
41
|
+
timeZone,
|
|
42
|
+
mode: 'single'
|
|
43
|
+
});
|
|
44
|
+
const [selected, setSelected] = (0, _useControlledValue.useControlledValue)({
|
|
45
|
+
defaultValue: defaultSelected,
|
|
46
|
+
value: selectedProp,
|
|
47
|
+
onChange: onSelect
|
|
48
|
+
});
|
|
49
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactDayPicker.DayPicker, {
|
|
50
|
+
..._constants.COMMON_PROPS,
|
|
51
|
+
...localizationProps,
|
|
52
|
+
...props,
|
|
53
|
+
mode: "single",
|
|
54
|
+
numberOfMonths: (0, _misc.clampNumberOfMonths)(numberOfMonths),
|
|
55
|
+
selected: selected,
|
|
56
|
+
onSelect: setSelected
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
exports.DateCalendar = DateCalendar;
|
|
60
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactDayPicker","require","_locale","_constants","_misc","_useControlledValue","_useLocalizationProps","_jsxRuntime","DateCalendar","defaultSelected","selected","selectedProp","onSelect","numberOfMonths","locale","enUS","timeZone","props","localizationProps","useLocalizationProps","mode","setSelected","useControlledValue","defaultValue","value","onChange","jsx","DayPicker","COMMON_PROPS","clampNumberOfMonths","exports"],"sources":["@wordpress/components/src/calendar/date-calendar/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport { DayPicker } from 'react-day-picker';\nimport { enUS } from 'react-day-picker/locale';\n/**\n * Internal dependencies\n */\nimport { COMMON_PROPS } from '../utils/constants';\nimport { clampNumberOfMonths } from '../utils/misc';\nimport { useControlledValue } from '../utils/use-controlled-value';\nimport { useLocalizationProps } from '../utils/use-localization-props';\nimport type { DateCalendarProps } from '../types';\n\n/**\n * `DateCalendar` is a React component that provides a customizable calendar\n * interface for **single date** selection.\n *\n * The component is built with accessibility in mind and follows ARIA best\n * practices for calendar widgets. It provides keyboard navigation, screen reader\n * support, and customizable labels for internationalization.\n */\nexport const DateCalendar = ( {\n\tdefaultSelected,\n\tselected: selectedProp,\n\tonSelect,\n\tnumberOfMonths = 1,\n\tlocale = enUS,\n\ttimeZone,\n\t...props\n}: DateCalendarProps ) => {\n\tconst localizationProps = useLocalizationProps( {\n\t\tlocale,\n\t\ttimeZone,\n\t\tmode: 'single',\n\t} );\n\n\tconst [ selected, setSelected ] = useControlledValue< Date | undefined >( {\n\t\tdefaultValue: defaultSelected,\n\t\tvalue: selectedProp,\n\t\tonChange: onSelect,\n\t} );\n\n\treturn (\n\t\t<DayPicker\n\t\t\t{ ...COMMON_PROPS }\n\t\t\t{ ...localizationProps }\n\t\t\t{ ...props }\n\t\t\tmode=\"single\"\n\t\t\tnumberOfMonths={ clampNumberOfMonths( numberOfMonths ) }\n\t\t\tselected={ selected }\n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defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DateRangeCalendar = void 0;
|
|
7
|
+
exports.usePreviewRange = usePreviewRange;
|
|
8
|
+
var _dateFns = require("date-fns");
|
|
9
|
+
var _reactDayPicker = require("react-day-picker");
|
|
10
|
+
var _locale = require("react-day-picker/locale");
|
|
11
|
+
var _element = require("@wordpress/element");
|
|
12
|
+
var _constants = require("../utils/constants");
|
|
13
|
+
var _misc = require("../utils/misc");
|
|
14
|
+
var _useControlledValue = require("../utils/use-controlled-value");
|
|
15
|
+
var _useLocalizationProps = require("../utils/use-localization-props");
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
/**
|
|
18
|
+
* External dependencies
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* WordPress dependencies
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Internal dependencies
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
function usePreviewRange({
|
|
30
|
+
selected,
|
|
31
|
+
hoveredDate,
|
|
32
|
+
excludeDisabled,
|
|
33
|
+
min,
|
|
34
|
+
max,
|
|
35
|
+
disabled
|
|
36
|
+
}) {
|
|
37
|
+
return (0, _element.useMemo)(() => {
|
|
38
|
+
if (!hoveredDate || !selected?.from) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
let previewHighlight;
|
|
42
|
+
let potentialNewRange;
|
|
43
|
+
|
|
44
|
+
// Hovering on a date before the start of the selected range
|
|
45
|
+
if (hoveredDate < selected.from) {
|
|
46
|
+
var _selected$to;
|
|
47
|
+
previewHighlight = {
|
|
48
|
+
from: hoveredDate,
|
|
49
|
+
to: selected.from
|
|
50
|
+
};
|
|
51
|
+
potentialNewRange = {
|
|
52
|
+
from: hoveredDate,
|
|
53
|
+
to: (_selected$to = selected.to) !== null && _selected$to !== void 0 ? _selected$to : selected.from
|
|
54
|
+
};
|
|
55
|
+
} else if (selected.to && hoveredDate > selected.from && hoveredDate < selected.to) {
|
|
56
|
+
// Hovering on a date between the start and end of the selected range
|
|
57
|
+
previewHighlight = {
|
|
58
|
+
from: selected.from,
|
|
59
|
+
to: hoveredDate
|
|
60
|
+
};
|
|
61
|
+
potentialNewRange = {
|
|
62
|
+
from: selected.from,
|
|
63
|
+
to: hoveredDate
|
|
64
|
+
};
|
|
65
|
+
} else if (hoveredDate > selected.from) {
|
|
66
|
+
var _selected$to2;
|
|
67
|
+
// Hovering on a date after the end of the selected range (either
|
|
68
|
+
// because it's greater than selected.to, or because it's not defined)
|
|
69
|
+
previewHighlight = {
|
|
70
|
+
from: (_selected$to2 = selected.to) !== null && _selected$to2 !== void 0 ? _selected$to2 : selected.from,
|
|
71
|
+
to: hoveredDate
|
|
72
|
+
};
|
|
73
|
+
potentialNewRange = {
|
|
74
|
+
from: selected.from,
|
|
75
|
+
to: hoveredDate
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
if (min !== undefined && min > 0 && potentialNewRange && (0, _dateFns.differenceInCalendarDays)(potentialNewRange.to, potentialNewRange.from) < min) {
|
|
79
|
+
previewHighlight = {
|
|
80
|
+
from: hoveredDate,
|
|
81
|
+
to: hoveredDate
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
if (max !== undefined && max > 0 && potentialNewRange && (0, _dateFns.differenceInCalendarDays)(potentialNewRange.to, potentialNewRange.from) > max) {
|
|
85
|
+
previewHighlight = {
|
|
86
|
+
from: hoveredDate,
|
|
87
|
+
to: hoveredDate
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
if (excludeDisabled && disabled && potentialNewRange && (0, _reactDayPicker.rangeContainsModifiers)(potentialNewRange, disabled)) {
|
|
91
|
+
previewHighlight = {
|
|
92
|
+
from: hoveredDate,
|
|
93
|
+
to: hoveredDate
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
return previewHighlight;
|
|
97
|
+
}, [selected, hoveredDate, excludeDisabled, min, max, disabled]);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* `DateRangeCalendar` is a React component that provides a customizable calendar
|
|
102
|
+
* interface for **date range** selection.
|
|
103
|
+
*
|
|
104
|
+
* The component is built with accessibility in mind and follows ARIA best
|
|
105
|
+
* practices for calendar widgets. It provides keyboard navigation, screen reader
|
|
106
|
+
* support, and customizable labels for internationalization.
|
|
107
|
+
*/
|
|
108
|
+
const DateRangeCalendar = ({
|
|
109
|
+
defaultSelected,
|
|
110
|
+
selected: selectedProp,
|
|
111
|
+
onSelect,
|
|
112
|
+
numberOfMonths = 1,
|
|
113
|
+
excludeDisabled,
|
|
114
|
+
min,
|
|
115
|
+
max,
|
|
116
|
+
disabled,
|
|
117
|
+
locale = _locale.enUS,
|
|
118
|
+
timeZone,
|
|
119
|
+
...props
|
|
120
|
+
}) => {
|
|
121
|
+
const localizationProps = (0, _useLocalizationProps.useLocalizationProps)({
|
|
122
|
+
locale,
|
|
123
|
+
timeZone,
|
|
124
|
+
mode: 'range'
|
|
125
|
+
});
|
|
126
|
+
const [selected, setSelected] = (0, _useControlledValue.useControlledValue)({
|
|
127
|
+
defaultValue: defaultSelected,
|
|
128
|
+
value: selectedProp,
|
|
129
|
+
onChange: onSelect
|
|
130
|
+
});
|
|
131
|
+
const [hoveredDate, setHoveredDate] = (0, _element.useState)(undefined);
|
|
132
|
+
|
|
133
|
+
// Compute the preview range for hover effect
|
|
134
|
+
const previewRange = usePreviewRange({
|
|
135
|
+
selected,
|
|
136
|
+
hoveredDate,
|
|
137
|
+
excludeDisabled,
|
|
138
|
+
min,
|
|
139
|
+
max,
|
|
140
|
+
disabled
|
|
141
|
+
});
|
|
142
|
+
const modifiers = (0, _element.useMemo)(() => {
|
|
143
|
+
return {
|
|
144
|
+
preview: previewRange,
|
|
145
|
+
preview_start: previewRange?.from,
|
|
146
|
+
preview_end: previewRange?.to
|
|
147
|
+
};
|
|
148
|
+
}, [previewRange]);
|
|
149
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactDayPicker.DayPicker, {
|
|
150
|
+
..._constants.COMMON_PROPS,
|
|
151
|
+
...localizationProps,
|
|
152
|
+
...props,
|
|
153
|
+
mode: "range",
|
|
154
|
+
numberOfMonths: (0, _misc.clampNumberOfMonths)(numberOfMonths),
|
|
155
|
+
disabled: disabled,
|
|
156
|
+
excludeDisabled: excludeDisabled,
|
|
157
|
+
min: min,
|
|
158
|
+
max: max,
|
|
159
|
+
selected: selected,
|
|
160
|
+
onSelect: setSelected,
|
|
161
|
+
onDayMouseEnter: date => setHoveredDate(date),
|
|
162
|
+
onDayMouseLeave: () => setHoveredDate(undefined),
|
|
163
|
+
modifiers: modifiers,
|
|
164
|
+
modifiersClassNames: _constants.MODIFIER_CLASSNAMES
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
exports.DateRangeCalendar = DateRangeCalendar;
|
|
168
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_dateFns","require","_reactDayPicker","_locale","_element","_constants","_misc","_useControlledValue","_useLocalizationProps","_jsxRuntime","usePreviewRange","selected","hoveredDate","excludeDisabled","min","max","disabled","useMemo","from","previewHighlight","potentialNewRange","_selected$to","to","_selected$to2","undefined","differenceInCalendarDays","rangeContainsModifiers","DateRangeCalendar","defaultSelected","selectedProp","onSelect","numberOfMonths","locale","enUS","timeZone","props","localizationProps","useLocalizationProps","mode","setSelected","useControlledValue","defaultValue","value","onChange","setHoveredDate","useState","previewRange","modifiers","preview","preview_start","preview_end","jsx","DayPicker","COMMON_PROPS","clampNumberOfMonths","onDayMouseEnter","date","onDayMouseLeave","modifiersClassNames","MODIFIER_CLASSNAMES","exports"],"sources":["@wordpress/components/src/calendar/date-range-calendar/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport { differenceInCalendarDays } from 'date-fns';\nimport { DayPicker, rangeContainsModifiers } from 'react-day-picker';\nimport { enUS } from 'react-day-picker/locale';\n/**\n * WordPress dependencies\n */\nimport { useMemo, useState } from '@wordpress/element';\n/**\n * Internal dependencies\n */\nimport { COMMON_PROPS, MODIFIER_CLASSNAMES } from '../utils/constants';\nimport { clampNumberOfMonths } from '../utils/misc';\nimport { useControlledValue } from '../utils/use-controlled-value';\nimport { useLocalizationProps } from '../utils/use-localization-props';\nimport type { DateRangeCalendarProps, DateRange } from '../types';\n\nexport function usePreviewRange( {\n\tselected,\n\thoveredDate,\n\texcludeDisabled,\n\tmin,\n\tmax,\n\tdisabled,\n}: Pick<\n\tDateRangeCalendarProps,\n\t'selected' | 'excludeDisabled' | 'min' | 'max' | 'disabled'\n> & {\n\thoveredDate: Date | undefined;\n} ) {\n\treturn useMemo( () => {\n\t\tif ( ! hoveredDate || ! selected?.from ) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet previewHighlight: DateRange | undefined;\n\t\tlet potentialNewRange: { from: Date; to: Date } | undefined;\n\n\t\t// Hovering on a date before the start of the selected range\n\t\tif ( hoveredDate < selected.from ) {\n\t\t\tpreviewHighlight = {\n\t\t\t\tfrom: hoveredDate,\n\t\t\t\tto: selected.from,\n\t\t\t};\n\n\t\t\tpotentialNewRange = {\n\t\t\t\tfrom: hoveredDate,\n\t\t\t\tto: selected.to ?? selected.from,\n\t\t\t};\n\t\t} else if (\n\t\t\tselected.to &&\n\t\t\thoveredDate > selected.from &&\n\t\t\thoveredDate < selected.to\n\t\t) {\n\t\t\t// Hovering on a date between the start and end of the selected range\n\t\t\tpreviewHighlight = {\n\t\t\t\tfrom: selected.from,\n\t\t\t\tto: hoveredDate,\n\t\t\t};\n\n\t\t\tpotentialNewRange = {\n\t\t\t\tfrom: selected.from,\n\t\t\t\tto: hoveredDate,\n\t\t\t};\n\t\t} else if ( hoveredDate > selected.from ) {\n\t\t\t// Hovering on a date after the end of the selected range (either\n\t\t\t// because it's greater than selected.to, or because it's not defined)\n\t\t\tpreviewHighlight = {\n\t\t\t\tfrom: selected.to ?? selected.from,\n\t\t\t\tto: hoveredDate,\n\t\t\t};\n\n\t\t\tpotentialNewRange = {\n\t\t\t\tfrom: selected.from,\n\t\t\t\tto: hoveredDate,\n\t\t\t};\n\t\t}\n\n\t\tif (\n\t\t\tmin !== undefined &&\n\t\t\tmin > 0 &&\n\t\t\tpotentialNewRange &&\n\t\t\tdifferenceInCalendarDays(\n\t\t\t\tpotentialNewRange.to,\n\t\t\t\tpotentialNewRange.from\n\t\t\t) < min\n\t\t) {\n\t\t\tpreviewHighlight = {\n\t\t\t\tfrom: hoveredDate,\n\t\t\t\tto: hoveredDate,\n\t\t\t};\n\t\t}\n\n\t\tif (\n\t\t\tmax !== undefined &&\n\t\t\tmax > 0 &&\n\t\t\tpotentialNewRange &&\n\t\t\tdifferenceInCalendarDays(\n\t\t\t\tpotentialNewRange.to,\n\t\t\t\tpotentialNewRange.from\n\t\t\t) > max\n\t\t) {\n\t\t\tpreviewHighlight = {\n\t\t\t\tfrom: hoveredDate,\n\t\t\t\tto: hoveredDate,\n\t\t\t};\n\t\t}\n\n\t\tif (\n\t\t\texcludeDisabled &&\n\t\t\tdisabled &&\n\t\t\tpotentialNewRange &&\n\t\t\trangeContainsModifiers( potentialNewRange, disabled )\n\t\t) {\n\t\t\tpreviewHighlight = {\n\t\t\t\tfrom: hoveredDate,\n\t\t\t\tto: hoveredDate,\n\t\t\t};\n\t\t}\n\n\t\treturn previewHighlight;\n\t}, [ selected, hoveredDate, excludeDisabled, min, max, disabled ] );\n}\n\n/**\n * `DateRangeCalendar` is a React component that provides a customizable calendar\n * interface for **date range** selection.\n *\n * The component is built with accessibility in mind and follows ARIA best\n * practices for calendar widgets. It provides keyboard navigation, screen reader\n * support, and customizable labels for internationalization.\n */\nexport const DateRangeCalendar = ( {\n\tdefaultSelected,\n\tselected: selectedProp,\n\tonSelect,\n\tnumberOfMonths = 1,\n\texcludeDisabled,\n\tmin,\n\tmax,\n\tdisabled,\n\tlocale = enUS,\n\ttimeZone,\n\t...props\n}: DateRangeCalendarProps ) => {\n\tconst localizationProps = useLocalizationProps( {\n\t\tlocale,\n\t\ttimeZone,\n\t\tmode: 'range',\n\t} );\n\n\tconst [ selected, setSelected ] = useControlledValue<\n\t\tDateRange | undefined\n\t>( {\n\t\tdefaultValue: defaultSelected,\n\t\tvalue: selectedProp,\n\t\tonChange: onSelect,\n\t} );\n\n\tconst [ hoveredDate, setHoveredDate ] = useState< Date | undefined >(\n\t\tundefined\n\t);\n\n\t// Compute the preview range for hover effect\n\tconst previewRange = usePreviewRange( {\n\t\tselected,\n\t\thoveredDate,\n\t\texcludeDisabled,\n\t\tmin,\n\t\tmax,\n\t\tdisabled,\n\t} );\n\n\tconst modifiers = useMemo( () => {\n\t\treturn {\n\t\t\tpreview: previewRange,\n\t\t\tpreview_start: previewRange?.from,\n\t\t\tpreview_end: previewRange?.to,\n\t\t};\n\t}, [ previewRange ] );\n\n\treturn (\n\t\t<DayPicker\n\t\t\t{ ...COMMON_PROPS }\n\t\t\t{ ...localizationProps }\n\t\t\t{ ...props }\n\t\t\tmode=\"range\"\n\t\t\tnumberOfMonths={ clampNumberOfMonths( numberOfMonths ) }\n\t\t\tdisabled={ disabled }\n\t\t\texcludeDisabled={ excludeDisabled }\n\t\t\tmin={ min }\n\t\t\tmax={ max }\n\t\t\tselected={ selected }\n\t\t\tonSelect={ setSelected }\n\t\t\tonDayMouseEnter={ ( date ) => setHoveredDate( date ) }\n\t\t\tonDayMouseLeave={ () => setHoveredDate( undefined ) }\n\t\t\tmodifiers={ modifiers }\n\t\t\tmodifiersClassNames={ MODIFIER_CLASSNAMES }\n\t\t/>\n\t);\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAIA,IAAAG,QAAA,GAAAH,OAAA;AAIA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,mBAA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e,EAAGA,CAAA,KAAMb,cAAc,CAAEpB,SAAU,CAAG;IACrDuB,SAAS,EAAGA,SAAW;IACvBW,mBAAmB,EAAGC;EAAqB,CAC3C,CAAC;AAEJ,CAAC;AAACC,OAAA,CAAAjC,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "DateCalendar", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _dateCalendar.DateCalendar;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "DateRangeCalendar", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _dateRangeCalendar.DateRangeCalendar;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "TZDate", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _reactDayPicker.TZDate;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
var _reactDayPicker = require("react-day-picker");
|
|
25
|
+
var _dateCalendar = require("./date-calendar");
|
|
26
|
+
var _dateRangeCalendar = require("./date-range-calendar");
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactDayPicker","require","_dateCalendar","_dateRangeCalendar"],"sources":["@wordpress/components/src/calendar/index.tsx"],"sourcesContent":["export { TZDate } from 'react-day-picker';\nexport { DateCalendar } from './date-calendar';\nexport { DateRangeCalendar } from './date-range-calendar';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,kBAAA,GAAAF,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["@wordpress/components/src/calendar/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { Locale } from 'date-fns';\nimport type * as React from 'react';\n\n/**\n * Represents the modifiers that match a specific day in the calendar.\n * @example\n * const modifiers: Modifiers = {\n * today: false, // the day is not today\n * selected: true, // the day is selected\n * disabled: false, // the day is not disabled\n * outside: false, // the day is not outside the month\n * focused: false, // the day is not focused\n *\n * weekend: false // custom modifier example for matching a weekend\n * booked: true // custom modifier example for matching a booked day\n * available: false // custom modifier example for matching an available day\n * };\n */\nexport type Modifiers = Record< string, boolean >;\n\n/**\n * A value or a function that matches a specific day.\n * @example\n * // will always match the day\n * const booleanMatcher: Matcher = true;\n *\n * // will match the today's date\n * const dateMatcher: Matcher = new Date();\n *\n * // will match the days in the array\n * const arrayMatcher: Matcher = [\n * new Date(2019, 1, 2),\n * new Date(2019, 1, 4)\n * ];\n *\n * // will match days after the 2nd of February 2019\n * const afterMatcher: DateAfter = { after: new Date(2019, 1, 2) };\n *\n * // will match days before the 2nd of February 2019 }\n * const beforeMatcher: DateBefore = { before: new Date(2019, 1, 2) };\n *\n * // will match Sundays\n * const dayOfWeekMatcher: DayOfWeek = {\n * dayOfWeek: 0\n * };\n *\n * // will match the included days, except the two dates\n * const intervalMatcher: DateInterval = {\n * after: new Date(2019, 1, 2),\n * before: new Date(2019, 1, 5)\n * };\n *\n * // will match the included days, including the two dates\n * const rangeMatcher: DateRange = {\n * from: new Date(2019, 1, 2),\n * to: new Date(2019, 1, 5)\n * };\n *\n * // will match when the function return true\n * const functionMatcher: Matcher = (day: Date) => {\n * return day.getMonth() === 2; // match when month is March\n * };\n */\ntype Matcher =\n\t| boolean\n\t| ( ( date: Date ) => boolean )\n\t| Date\n\t| Date[]\n\t| DateRange\n\t| DateBefore\n\t| DateAfter\n\t| DateInterval\n\t| DayOfWeek;\n/**\n * Match a day falling after the specified date, with the date not included.\n * @example\n * // Match days after the 2nd of February 2019\n * const matcher: DateAfter = { after: new Date(2019, 1, 2) };\n */\ntype DateAfter = {\n\tafter: Date;\n};\n/**\n * Match a day falling before the specified date, with the date not included.\n * @example\n * // Match days before the 2nd of February 2019\n * const matcher: DateBefore = { before: new Date(2019, 1, 2) };\n */\ntype DateBefore = {\n\tbefore: Date;\n};\n/**\n * An interval of dates. Differently from `DateRange`, the range ends here\n * are not included.\n * @example\n * // Match the days between the 2nd and the 5th of February 2019\n * const matcher: DateInterval = {\n * after: new Date(2019, 1, 2),\n * before: new Date(2019, 1, 5)\n * };\n */\ntype DateInterval = {\n\tbefore: Date;\n\tafter: Date;\n};\n/**\n * A range of dates. The range can be open. Differently from\n * `DateInterval`, the range ends here are included.\n * @example\n * // Match the days between the 2nd and the 5th of February 2019\n * const matcher: DateRange = {\n * from: new Date(2019, 1, 2),\n * to: new Date(2019, 1, 5)\n * };\n */\nexport type DateRange = {\n\tfrom: Date | undefined;\n\tto?: Date | undefined;\n};\n/**\n * Match dates being one of the specified days of the week (`0-6`, where `0` is\n * Sunday).\n * @example\n * // Match Sundays\n * const matcher: DayOfWeek = { dayOfWeek: 0 };\n * // Match weekends\n * const matcher: DayOfWeek = { dayOfWeek: [0, 6] };\n */\ntype DayOfWeek = {\n\tdayOfWeek: number | number[];\n};\n\n/**\n * Shared handler type for `onSelect` callback when a selection mode is set.\n * @example\n * const handleSelect: OnSelectHandler<Date> = (\n * selected,\n * triggerDate,\n * modifiers,\n * e\n * ) => {\n * console.log( \"Selected:\", selected );\n * console.log( \"Triggered by:\", triggerDate );\n * };\n * @template T - The type of the selected item.\n * @callback OnSelectHandler\n * @param {T} selected - The selected item after the event.\n * @param {Date} triggerDate - The date when the event was triggered. This is\n * typically the day clicked or interacted with.\n * @param {Modifiers} modifiers - The modifiers associated with the event.\n * @param {React.MouseEvent | React.KeyboardEvent} e - The event object.\n */\ntype OnSelectHandler< T > = (\n\tselected: T,\n\ttriggerDate: Date,\n\tmodifiers: Modifiers,\n\te: React.MouseEvent | React.KeyboardEvent\n) => void;\n\nexport interface BaseProps\n\textends Omit<\n\t\tReact.HTMLAttributes< HTMLDivElement >,\n\t\t'onSelect' | 'defaultValue'\n\t> {\n\t/**\n\t * Whether the selection is required.\n\t * When `true`, there always needs to be a date selected.\n\t * @default false\n\t */\n\trequired?: boolean;\n\n\t/**\n\t * The initial month to show in the calendar view (uncontrolled).\n\t * @default The current month\n\t */\n\tdefaultMonth?: Date;\n\t/**\n\t * The month displayed in the calendar view (controlled). Use together with\n\t * `onMonthChange` to change the month programmatically.\n\t */\n\tmonth?: Date;\n\t/**\n\t * The number of months displayed at once.\n\t * @default 1\n\t */\n\tnumberOfMonths?: number;\n\t/**\n\t * The earliest month to start the month navigation.\n\t */\n\tstartMonth?: Date;\n\t/**\n\t * The latest month to end the month navigation.\n\t */\n\tendMonth?: Date;\n\t/**\n\t * Focus the first selected day (if set) or today's date (if not disabled).\n\t *\n\t * Use this prop when you need to focus the calendar after a user action\n\t * (e.g. opening the dialog with the calendar).\n\t */\n\tautoFocus?: boolean;\n\t/**\n\t * Specify which days are disabled. Using `true` will disable all dates.\n\t */\n\tdisabled?: Matcher | Matcher[] | undefined;\n\t/**\n\t * Disable the navigation buttons.\n\t */\n\tdisableNavigation?: boolean;\n\t/**\n\t * Use custom labels, useful for translating the component.\n\t *\n\t * For a correct localized experience, consumers should make sure the locale\n\t * used for the translated labels and `locale` prop are consistent.\n\t */\n\tlabels?: {\n\t\t/**\n\t\t * The label for the navigation toolbar.\n\t\t * @default \"\"\n\t\t */\n\t\tlabelNav?: () => string;\n\t\t/**\n\t\t * The label for the month grid.\n\t\t * @default \"LLLL y\" (e.g. \"November 2022\")\n\t\t */\n\t\tlabelGrid?: ( date: Date ) => string;\n\t\t/**\n\t\t * The label for the gridcell, when the calendar is not interactive.\n\t\t * @default The formatted date.\n\t\t */\n\t\tlabelGridcell?: ( date: Date, modifiers?: Modifiers ) => string;\n\t\t/**\n\t\t * The label for the \"next month\" button.\n\t\t * @default \"Go to the Next Month\"\n\t\t */\n\t\tlabelNext?: ( month: Date | undefined ) => string;\n\t\t/**\n\t\t * The label for the \"previous month\" button.\n\t\t * @default \"Go to the Previous Month\"\n\t\t */\n\t\tlabelPrevious?: ( month: Date | undefined ) => string;\n\t\t/**\n\t\t * The label for the day button.\n\t\t * @default The formatted date.\n\t\t */\n\t\tlabelDayButton?: ( date: Date, modifiers?: Modifiers ) => string;\n\t\t/**\n\t\t * The label for the weekday.\n\t\t * @default ( date: Date ) => \"Monday\" | \"Tuesday\" | \"Wednesday\" | \"Thursday\" | \"Friday\" | \"Saturday\" | \"Sunday\"\n\t\t */\n\t\tlabelWeekday?: ( date: Date ) => string;\n\t};\n\n\t/**\n\t * The locale object used to localize dates. Pass a locale from\n\t * `@date-fns/locale` to localize the calendar.\n\t *\n\t * For a correct localized experience, consumers should make sure the locale\n\t * used for the translated labels and `locale` prop are consistent.\n\t * @see https://github.com/date-fns/date-fns/tree/main/src/locale for a list of the supported locales\n\t * @default The `enUS` locale from `@date-fns/locale`\n\t */\n\tlocale?: Locale;\n\t/**\n\t * The index of the first day of the week (0 - Sunday). Overrides the locale's\n\t * one.\n\t * @default Based on the `locale` prop\n\t */\n\tweekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined;\n\t/**\n\t * Event fired when the user navigates between months.\n\t */\n\tonMonthChange?: ( month: Date ) => void;\n\t/**\n\t * The time zone (IANA or UTC offset) to use in the calendar.\n\t *\n\t * See\n\t * [Wikipedia](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)\n\t * for the possible values.\n\t *\n\t * When working with time zones, use the `TZDate` object exported by this\n\t * package instead of the native `Date` object.\n\t * @example\n\t * import { DateCalendar, TZDate } from \"@automattic/components\";\n\t *\n\t * export function WithTimeZone() {\n\t * const timeZone = \"America/New_York\";\n\t * const [ selected, setSelected ] = useState< Date | undefined >(\n\t * new TZDate( 2024, 12, 10, timeZone ) // Use `TZDate` instead of `Date`\n\t * );\n\t * return (\n\t * <DateCalendar\n\t * timeZone={ timeZone }\n\t * selected={ selected }\n\t * onSelect={ setSelected }\n\t * />\n\t * );\n\t * }\n\t */\n\ttimeZone?: string;\n\t/**\n\t * The role attribute to add to the container element.\n\t * @default 'application'\n\t */\n\trole?: 'application' | 'dialog' | undefined;\n}\n\ninterface SingleProps {\n\t/** The selected date. */\n\tselected?: Date | undefined | null;\n\t/** Event handler when a day is selected. */\n\tonSelect?: OnSelectHandler< Date | undefined >;\n\t/** The default selected date (for uncontrolled usage). */\n\tdefaultSelected?: Date;\n}\n\ninterface RangeProps {\n\t/**\n\t * When `true`, the range will reset when including a disabled day.\n\t */\n\texcludeDisabled?: boolean;\n\t/**\n\t * The minimum number of nights to include in the range.\n\t */\n\tmin?: number;\n\t/**\n\t * The maximum number of nights to include in the range.\n\t */\n\tmax?: number;\n\t/** The selected range. */\n\tselected?: DateRange | undefined | null;\n\t/** Event handler when the selection changes. */\n\tonSelect?: OnSelectHandler< DateRange | undefined >;\n\t/** The default selected range (for uncontrolled usage). */\n\tdefaultSelected?: DateRange;\n}\n\nexport type DateCalendarProps = BaseProps & SingleProps;\nexport type DateRangeCalendarProps = BaseProps & RangeProps;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.MODIFIER_CLASSNAMES = exports.COMMON_PROPS = void 0;
|
|
7
|
+
var _dayCell = require("./day-cell");
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const CLASSNAMES = {
|
|
13
|
+
root: 'components-calendar',
|
|
14
|
+
day: 'components-calendar__day',
|
|
15
|
+
day_button: 'components-calendar__day-button',
|
|
16
|
+
caption_label: 'components-calendar__caption-label',
|
|
17
|
+
button_next: 'components-calendar__button-next',
|
|
18
|
+
button_previous: 'components-calendar__button-previous',
|
|
19
|
+
chevron: 'components-calendar__chevron',
|
|
20
|
+
nav: 'components-calendar__nav',
|
|
21
|
+
month_caption: 'components-calendar__month-caption',
|
|
22
|
+
months: 'components-calendar__months',
|
|
23
|
+
month_grid: 'components-calendar__month-grid',
|
|
24
|
+
weekday: 'components-calendar__weekday',
|
|
25
|
+
today: 'components-calendar__day--today',
|
|
26
|
+
selected: 'components-calendar__day--selected',
|
|
27
|
+
disabled: 'components-calendar__day--disabled',
|
|
28
|
+
hidden: 'components-calendar__day--hidden',
|
|
29
|
+
range_start: 'components-calendar__range-start',
|
|
30
|
+
range_end: 'components-calendar__range-end',
|
|
31
|
+
range_middle: 'components-calendar__range-middle',
|
|
32
|
+
weeks_before_enter: 'components-calendar__weeks-before-enter',
|
|
33
|
+
weeks_before_exit: 'components-calendar__weeks-before-exit',
|
|
34
|
+
weeks_after_enter: 'components-calendar__weeks-after-enter',
|
|
35
|
+
weeks_after_exit: 'components-calendar__weeks-after-exit',
|
|
36
|
+
caption_after_enter: 'components-calendar__caption-after-enter',
|
|
37
|
+
caption_after_exit: 'components-calendar__caption-after-exit',
|
|
38
|
+
caption_before_enter: 'components-calendar__caption-before-enter',
|
|
39
|
+
caption_before_exit: 'components-calendar__caption-before-exit'
|
|
40
|
+
};
|
|
41
|
+
const MODIFIER_CLASSNAMES = exports.MODIFIER_CLASSNAMES = {
|
|
42
|
+
preview: 'components-calendar__day--preview',
|
|
43
|
+
preview_start: 'components-calendar__day--preview-start',
|
|
44
|
+
preview_end: 'components-calendar__day--preview-end'
|
|
45
|
+
};
|
|
46
|
+
const COMMON_PROPS = exports.COMMON_PROPS = {
|
|
47
|
+
animate: true,
|
|
48
|
+
// Only show days in the current month
|
|
49
|
+
showOutsideDays: false,
|
|
50
|
+
// Hide week number column
|
|
51
|
+
showWeekNumber: false,
|
|
52
|
+
// Show weekdays row
|
|
53
|
+
hideWeekdays: false,
|
|
54
|
+
// Month and year caption are not interactive
|
|
55
|
+
captionLayout: 'label',
|
|
56
|
+
// Show a variable number of weeks depending on the month
|
|
57
|
+
fixedWeeks: false,
|
|
58
|
+
// Show navigation buttons
|
|
59
|
+
hideNavigation: false,
|
|
60
|
+
// Class names
|
|
61
|
+
classNames: CLASSNAMES,
|
|
62
|
+
// Default role
|
|
63
|
+
role: 'application',
|
|
64
|
+
components: {
|
|
65
|
+
Day: _dayCell.Day
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_dayCell","require","CLASSNAMES","root","day","day_button","caption_label","button_next","button_previous","chevron","nav","month_caption","months","month_grid","weekday","today","selected","disabled","hidden","range_start","range_end","range_middle","weeks_before_enter","weeks_before_exit","weeks_after_enter","weeks_after_exit","caption_after_enter","caption_after_exit","caption_before_enter","caption_before_exit","MODIFIER_CLASSNAMES","exports","preview","preview_start","preview_end","COMMON_PROPS","animate","showOutsideDays","showWeekNumber","hideWeekdays","captionLayout","fixedWeeks","hideNavigation","classNames","role","components","Day"],"sources":["@wordpress/components/src/calendar/utils/constants.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { Day } from './day-cell';\n\nconst CLASSNAMES = {\n\troot: 'components-calendar',\n\tday: 'components-calendar__day',\n\tday_button: 'components-calendar__day-button',\n\tcaption_label: 'components-calendar__caption-label',\n\tbutton_next: 'components-calendar__button-next',\n\tbutton_previous: 'components-calendar__button-previous',\n\tchevron: 'components-calendar__chevron',\n\tnav: 'components-calendar__nav',\n\tmonth_caption: 'components-calendar__month-caption',\n\tmonths: 'components-calendar__months',\n\tmonth_grid: 'components-calendar__month-grid',\n\tweekday: 'components-calendar__weekday',\n\ttoday: 'components-calendar__day--today',\n\tselected: 'components-calendar__day--selected',\n\tdisabled: 'components-calendar__day--disabled',\n\thidden: 'components-calendar__day--hidden',\n\trange_start: 'components-calendar__range-start',\n\trange_end: 'components-calendar__range-end',\n\trange_middle: 'components-calendar__range-middle',\n\tweeks_before_enter: 'components-calendar__weeks-before-enter',\n\tweeks_before_exit: 'components-calendar__weeks-before-exit',\n\tweeks_after_enter: 'components-calendar__weeks-after-enter',\n\tweeks_after_exit: 'components-calendar__weeks-after-exit',\n\tcaption_after_enter: 'components-calendar__caption-after-enter',\n\tcaption_after_exit: 'components-calendar__caption-after-exit',\n\tcaption_before_enter: 'components-calendar__caption-before-enter',\n\tcaption_before_exit: 'components-calendar__caption-before-exit',\n};\nexport const MODIFIER_CLASSNAMES = {\n\tpreview: 'components-calendar__day--preview',\n\tpreview_start: 'components-calendar__day--preview-start',\n\tpreview_end: 'components-calendar__day--preview-end',\n};\n\nexport const COMMON_PROPS = {\n\tanimate: true,\n\t// Only show days in the current month\n\tshowOutsideDays: false,\n\t// Hide week number column\n\tshowWeekNumber: false,\n\t// Show weekdays row\n\thideWeekdays: false,\n\t// Month and year caption are not interactive\n\tcaptionLayout: 'label',\n\t// Show a variable number of weeks depending on the month\n\tfixedWeeks: false,\n\t// Show navigation buttons\n\thideNavigation: false,\n\t// Class names\n\tclassNames: CLASSNAMES,\n\t// Default role\n\trole: 'application',\n\tcomponents: {\n\t\tDay,\n\t},\n} as const;\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA,MAAMC,UAAU,GAAG;EAClBC,IAAI,EAAE,qBAAqB;EAC3BC,GAAG,EAAE,0BAA0B;EAC/BC,UAAU,EAAE,iCAAiC;EAC7CC,aAAa,EAAE,oCAAoC;EACnDC,WAAW,EAAE,kCAAkC;EAC/CC,eAAe,EAAE,sCAAsC;EACvDC,OAAO,EAAE,8BAA8B;EACvCC,GAAG,EAAE,0BAA0B;EAC/BC,aAAa,EAAE,oCAAoC;EACnDC,MAAM,EAAE,6BAA6B;EACrCC,UAAU,EAAE,iCAAiC;EAC7CC,OAAO,EAAE,8BAA8B;EACvCC,KAAK,EAAE,iCAAiC;EACxCC,QAAQ,EAAE,oCAAoC;EAC9CC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