@solid2-aria/stately 0.0.0-stage → 0.0.1
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/LICENSE +21 -0
- package/README.md +45 -2
- package/dist/LICENSES/Apache-2.0.txt +201 -0
- package/dist/LICENSES/react-spectrum-NOTICE.txt +242 -0
- package/dist/NOTICE.txt +636 -0
- package/dist/autocomplete/create-autocomplete-state.d.ts +46 -0
- package/dist/autocomplete/create-autocomplete-state.js +41 -0
- package/dist/autocomplete/create-autocomplete-state.js.map +1 -0
- package/dist/calendar/create-calendar-state.d.ts +62 -0
- package/dist/calendar/create-calendar-state.js +357 -0
- package/dist/calendar/create-calendar-state.js.map +1 -0
- package/dist/calendar/create-range-calendar-state.d.ts +63 -0
- package/dist/calendar/create-range-calendar-state.js +204 -0
- package/dist/calendar/create-range-calendar-state.js.map +1 -0
- package/dist/calendar/types.d.ts +222 -0
- package/dist/calendar/types.js +16 -0
- package/dist/calendar/utils.d.ts +27 -0
- package/dist/calendar/utils.js +81 -0
- package/dist/calendar/utils.js.map +1 -0
- package/dist/checkbox/create-checkbox-group-state.d.ts +60 -0
- package/dist/checkbox/create-checkbox-group-state.js +88 -0
- package/dist/checkbox/create-checkbox-group-state.js.map +1 -0
- package/dist/collections/collection-builder.d.ts +28 -0
- package/dist/collections/collection-builder.js +164 -0
- package/dist/collections/collection-builder.js.map +1 -0
- package/dist/collections/create-collection.d.ts +24 -0
- package/dist/collections/create-collection.js +35 -0
- package/dist/collections/create-collection.js.map +1 -0
- package/dist/collections/get-child-nodes.d.ts +25 -0
- package/dist/collections/get-child-nodes.js +67 -0
- package/dist/collections/get-child-nodes.js.map +1 -0
- package/dist/collections/get-item-count.d.ts +19 -0
- package/dist/collections/get-item-count.js +34 -0
- package/dist/collections/get-item-count.js.map +1 -0
- package/dist/collections/item.d.ts +29 -0
- package/dist/collections/item.js +68 -0
- package/dist/collections/item.js.map +1 -0
- package/dist/collections/section.d.ts +29 -0
- package/dist/collections/section.js +60 -0
- package/dist/collections/section.js.map +1 -0
- package/dist/collections/types.d.ts +46 -0
- package/dist/collections/types.js +29 -0
- package/dist/collections/types.js.map +1 -0
- package/dist/color/color/base-color.d.ts +40 -0
- package/dist/color/color/base-color.js +122 -0
- package/dist/color/color/base-color.js.map +1 -0
- package/dist/color/color/color-classes.d.ts +27 -0
- package/dist/color/color/color-classes.js +29 -0
- package/dist/color/color/color-classes.js.map +1 -0
- package/dist/color/color/color-constructors.d.ts +23 -0
- package/dist/color/color/color-constructors.js +16 -0
- package/dist/color/color/color.d.ts +3 -0
- package/dist/color/color/color.js +2 -0
- package/dist/color/color/hsb-color.d.ts +24 -0
- package/dist/color/color/hsb-color.js +183 -0
- package/dist/color/color/hsb-color.js.map +1 -0
- package/dist/color/color/hsl-color.d.ts +24 -0
- package/dist/color/color/hsl-color.js +184 -0
- package/dist/color/color/hsl-color.js.map +1 -0
- package/dist/color/color/normalize-hue.d.ts +18 -0
- package/dist/color/color/normalize-hue.js +24 -0
- package/dist/color/color/normalize-hue.js.map +1 -0
- package/dist/color/color/oklch.d.ts +19 -0
- package/dist/color/color/oklch.js +97 -0
- package/dist/color/color/oklch.js.map +1 -0
- package/dist/color/color/rgb-color.d.ts +24 -0
- package/dist/color/color/rgb-color.js +230 -0
- package/dist/color/color/rgb-color.js.map +1 -0
- package/dist/color/color.d.ts +25 -0
- package/dist/color/color.js +41 -0
- package/dist/color/color.js.map +1 -0
- package/dist/color/create-color-area-state.d.ts +105 -0
- package/dist/color/create-color-area-state.js +138 -0
- package/dist/color/create-color-area-state.js.map +1 -0
- package/dist/color/create-color-channel-field-state.d.ts +29 -0
- package/dist/color/create-color-channel-field-state.js +69 -0
- package/dist/color/create-color-channel-field-state.js.map +1 -0
- package/dist/color/create-color-field-state.d.ts +61 -0
- package/dist/color/create-color-field-state.js +113 -0
- package/dist/color/create-color-field-state.js.map +1 -0
- package/dist/color/create-color-picker-state.d.ts +16 -0
- package/dist/color/create-color-picker-state.js +26 -0
- package/dist/color/create-color-picker-state.js.map +1 -0
- package/dist/color/create-color-slider-state.d.ts +50 -0
- package/dist/color/create-color-slider-state.js +93 -0
- package/dist/color/create-color-slider-state.js.map +1 -0
- package/dist/color/create-color-wheel-state.d.ts +76 -0
- package/dist/color/create-color-wheel-state.js +130 -0
- package/dist/color/create-color-wheel-state.js.map +1 -0
- package/dist/color/create-color.d.ts +20 -0
- package/dist/color/create-color.js +33 -0
- package/dist/color/create-color.js.map +1 -0
- package/dist/color/types.d.ts +87 -0
- package/dist/color/types.js +5 -0
- package/dist/combobox/create-combo-box-state.d.ts +157 -0
- package/dist/combobox/create-combo-box-state.js +450 -0
- package/dist/combobox/create-combo-box-state.js.map +1 -0
- package/dist/data/create-async-list.d.ts +88 -0
- package/dist/data/create-async-list.js +276 -0
- package/dist/data/create-async-list.js.map +1 -0
- package/dist/data/create-list-data.d.ts +140 -0
- package/dist/data/create-list-data.js +250 -0
- package/dist/data/create-list-data.js.map +1 -0
- package/dist/data/create-tree-data.d.ts +134 -0
- package/dist/data/create-tree-data.js +364 -0
- package/dist/data/create-tree-data.js.map +1 -0
- package/dist/datepicker/create-date-field-state.d.ts +138 -0
- package/dist/datepicker/create-date-field-state.js +449 -0
- package/dist/datepicker/create-date-field-state.js.map +1 -0
- package/dist/datepicker/create-date-picker-state.d.ts +82 -0
- package/dist/datepicker/create-date-picker-state.js +191 -0
- package/dist/datepicker/create-date-picker-state.js.map +1 -0
- package/dist/datepicker/create-date-range-picker-state.d.ts +97 -0
- package/dist/datepicker/create-date-range-picker-state.js +305 -0
- package/dist/datepicker/create-date-range-picker-state.js.map +1 -0
- package/dist/datepicker/create-time-field-state.d.ts +34 -0
- package/dist/datepicker/create-time-field-state.js +128 -0
- package/dist/datepicker/create-time-field-state.js.map +1 -0
- package/dist/datepicker/incomplete-date.d.ts +71 -0
- package/dist/datepicker/incomplete-date.js +324 -0
- package/dist/datepicker/incomplete-date.js.map +1 -0
- package/dist/datepicker/placeholders.d.ts +18 -0
- package/dist/datepicker/placeholders.js +418 -0
- package/dist/datepicker/placeholders.js.map +1 -0
- package/dist/datepicker/types.d.ts +131 -0
- package/dist/datepicker/types.js +16 -0
- package/dist/datepicker/utils.d.ts +37 -0
- package/dist/datepicker/utils.js +168 -0
- package/dist/datepicker/utils.js.map +1 -0
- package/dist/disclosure/create-disclosure-group-state.d.ts +47 -0
- package/dist/disclosure/create-disclosure-group-state.js +62 -0
- package/dist/disclosure/create-disclosure-group-state.js.map +1 -0
- package/dist/disclosure/create-disclosure-state.d.ts +42 -0
- package/dist/disclosure/create-disclosure-state.js +49 -0
- package/dist/disclosure/create-disclosure-state.js.map +1 -0
- package/dist/dnd/create-draggable-collection-state.d.ts +63 -0
- package/dist/dnd/create-draggable-collection-state.js +136 -0
- package/dist/dnd/create-draggable-collection-state.js.map +1 -0
- package/dist/dnd/create-droppable-collection-state.d.ts +55 -0
- package/dist/dnd/create-droppable-collection-state.js +155 -0
- package/dist/dnd/create-droppable-collection-state.js.map +1 -0
- package/dist/flags/flags.d.ts +21 -0
- package/dist/flags/flags.js +34 -0
- package/dist/flags/flags.js.map +1 -0
- package/dist/form/create-form-validation-state.d.ts +37 -0
- package/dist/form/create-form-validation-state.js +152 -0
- package/dist/form/create-form-validation-state.js.map +1 -0
- package/dist/grid/create-grid-state.d.ts +38 -0
- package/dist/grid/create-grid-state.js +85 -0
- package/dist/grid/create-grid-state.js.map +1 -0
- package/dist/grid/grid-collection.d.ts +68 -0
- package/dist/grid/grid-collection.js +133 -0
- package/dist/grid/grid-collection.js.map +1 -0
- package/dist/index.d.ts +91 -0
- package/dist/index.js +86 -0
- package/dist/intl/color/ar-AE.js +44 -0
- package/dist/intl/color/ar-AE.js.map +1 -0
- package/dist/intl/color/bg-BG.js +44 -0
- package/dist/intl/color/bg-BG.js.map +1 -0
- package/dist/intl/color/cs-CZ.js +44 -0
- package/dist/intl/color/cs-CZ.js.map +1 -0
- package/dist/intl/color/da-DK.js +44 -0
- package/dist/intl/color/da-DK.js.map +1 -0
- package/dist/intl/color/de-DE.js +44 -0
- package/dist/intl/color/de-DE.js.map +1 -0
- package/dist/intl/color/el-GR.js +44 -0
- package/dist/intl/color/el-GR.js.map +1 -0
- package/dist/intl/color/en-US.js +44 -0
- package/dist/intl/color/en-US.js.map +1 -0
- package/dist/intl/color/es-ES.js +44 -0
- package/dist/intl/color/es-ES.js.map +1 -0
- package/dist/intl/color/et-EE.js +44 -0
- package/dist/intl/color/et-EE.js.map +1 -0
- package/dist/intl/color/fi-FI.js +44 -0
- package/dist/intl/color/fi-FI.js.map +1 -0
- package/dist/intl/color/fr-FR.js +44 -0
- package/dist/intl/color/fr-FR.js.map +1 -0
- package/dist/intl/color/he-IL.js +44 -0
- package/dist/intl/color/he-IL.js.map +1 -0
- package/dist/intl/color/hr-HR.js +44 -0
- package/dist/intl/color/hr-HR.js.map +1 -0
- package/dist/intl/color/hu-HU.js +44 -0
- package/dist/intl/color/hu-HU.js.map +1 -0
- package/dist/intl/color/index.js +75 -0
- package/dist/intl/color/index.js.map +1 -0
- package/dist/intl/color/it-IT.js +44 -0
- package/dist/intl/color/it-IT.js.map +1 -0
- package/dist/intl/color/ja-JP.js +44 -0
- package/dist/intl/color/ja-JP.js.map +1 -0
- package/dist/intl/color/ko-KR.js +44 -0
- package/dist/intl/color/ko-KR.js.map +1 -0
- package/dist/intl/color/lt-LT.js +44 -0
- package/dist/intl/color/lt-LT.js.map +1 -0
- package/dist/intl/color/lv-LV.js +44 -0
- package/dist/intl/color/lv-LV.js.map +1 -0
- package/dist/intl/color/nb-NO.js +44 -0
- package/dist/intl/color/nb-NO.js.map +1 -0
- package/dist/intl/color/nl-NL.js +44 -0
- package/dist/intl/color/nl-NL.js.map +1 -0
- package/dist/intl/color/pl-PL.js +44 -0
- package/dist/intl/color/pl-PL.js.map +1 -0
- package/dist/intl/color/pt-BR.js +44 -0
- package/dist/intl/color/pt-BR.js.map +1 -0
- package/dist/intl/color/pt-PT.js +44 -0
- package/dist/intl/color/pt-PT.js.map +1 -0
- package/dist/intl/color/ro-RO.js +44 -0
- package/dist/intl/color/ro-RO.js.map +1 -0
- package/dist/intl/color/ru-RU.js +44 -0
- package/dist/intl/color/ru-RU.js.map +1 -0
- package/dist/intl/color/sk-SK.js +44 -0
- package/dist/intl/color/sk-SK.js.map +1 -0
- package/dist/intl/color/sl-SI.js +44 -0
- package/dist/intl/color/sl-SI.js.map +1 -0
- package/dist/intl/color/sr-SP.js +44 -0
- package/dist/intl/color/sr-SP.js.map +1 -0
- package/dist/intl/color/sv-SE.js +44 -0
- package/dist/intl/color/sv-SE.js.map +1 -0
- package/dist/intl/color/tr-TR.js +44 -0
- package/dist/intl/color/tr-TR.js.map +1 -0
- package/dist/intl/color/uk-UA.js +44 -0
- package/dist/intl/color/uk-UA.js.map +1 -0
- package/dist/intl/color/zh-CN.js +44 -0
- package/dist/intl/color/zh-CN.js.map +1 -0
- package/dist/intl/color/zh-TW.js +44 -0
- package/dist/intl/color/zh-TW.js.map +1 -0
- package/dist/intl/datepicker/ar-AE.js +11 -0
- package/dist/intl/datepicker/ar-AE.js.map +1 -0
- package/dist/intl/datepicker/bg-BG.js +11 -0
- package/dist/intl/datepicker/bg-BG.js.map +1 -0
- package/dist/intl/datepicker/cs-CZ.js +11 -0
- package/dist/intl/datepicker/cs-CZ.js.map +1 -0
- package/dist/intl/datepicker/da-DK.js +11 -0
- package/dist/intl/datepicker/da-DK.js.map +1 -0
- package/dist/intl/datepicker/de-DE.js +11 -0
- package/dist/intl/datepicker/de-DE.js.map +1 -0
- package/dist/intl/datepicker/el-GR.js +11 -0
- package/dist/intl/datepicker/el-GR.js.map +1 -0
- package/dist/intl/datepicker/en-US.js +11 -0
- package/dist/intl/datepicker/en-US.js.map +1 -0
- package/dist/intl/datepicker/es-ES.js +11 -0
- package/dist/intl/datepicker/es-ES.js.map +1 -0
- package/dist/intl/datepicker/et-EE.js +11 -0
- package/dist/intl/datepicker/et-EE.js.map +1 -0
- package/dist/intl/datepicker/fi-FI.js +11 -0
- package/dist/intl/datepicker/fi-FI.js.map +1 -0
- package/dist/intl/datepicker/fr-FR.js +11 -0
- package/dist/intl/datepicker/fr-FR.js.map +1 -0
- package/dist/intl/datepicker/he-IL.js +11 -0
- package/dist/intl/datepicker/he-IL.js.map +1 -0
- package/dist/intl/datepicker/hr-HR.js +11 -0
- package/dist/intl/datepicker/hr-HR.js.map +1 -0
- package/dist/intl/datepicker/hu-HU.js +11 -0
- package/dist/intl/datepicker/hu-HU.js.map +1 -0
- package/dist/intl/datepicker/index.js +75 -0
- package/dist/intl/datepicker/index.js.map +1 -0
- package/dist/intl/datepicker/it-IT.js +11 -0
- package/dist/intl/datepicker/it-IT.js.map +1 -0
- package/dist/intl/datepicker/ja-JP.js +11 -0
- package/dist/intl/datepicker/ja-JP.js.map +1 -0
- package/dist/intl/datepicker/ko-KR.js +11 -0
- package/dist/intl/datepicker/ko-KR.js.map +1 -0
- package/dist/intl/datepicker/lt-LT.js +11 -0
- package/dist/intl/datepicker/lt-LT.js.map +1 -0
- package/dist/intl/datepicker/lv-LV.js +11 -0
- package/dist/intl/datepicker/lv-LV.js.map +1 -0
- package/dist/intl/datepicker/nb-NO.js +11 -0
- package/dist/intl/datepicker/nb-NO.js.map +1 -0
- package/dist/intl/datepicker/nl-NL.js +11 -0
- package/dist/intl/datepicker/nl-NL.js.map +1 -0
- package/dist/intl/datepicker/pl-PL.js +11 -0
- package/dist/intl/datepicker/pl-PL.js.map +1 -0
- package/dist/intl/datepicker/pt-BR.js +11 -0
- package/dist/intl/datepicker/pt-BR.js.map +1 -0
- package/dist/intl/datepicker/pt-PT.js +11 -0
- package/dist/intl/datepicker/pt-PT.js.map +1 -0
- package/dist/intl/datepicker/ro-RO.js +11 -0
- package/dist/intl/datepicker/ro-RO.js.map +1 -0
- package/dist/intl/datepicker/ru-RU.js +11 -0
- package/dist/intl/datepicker/ru-RU.js.map +1 -0
- package/dist/intl/datepicker/sk-SK.js +11 -0
- package/dist/intl/datepicker/sk-SK.js.map +1 -0
- package/dist/intl/datepicker/sl-SI.js +11 -0
- package/dist/intl/datepicker/sl-SI.js.map +1 -0
- package/dist/intl/datepicker/sr-SP.js +11 -0
- package/dist/intl/datepicker/sr-SP.js.map +1 -0
- package/dist/intl/datepicker/sv-SE.js +11 -0
- package/dist/intl/datepicker/sv-SE.js.map +1 -0
- package/dist/intl/datepicker/tr-TR.js +11 -0
- package/dist/intl/datepicker/tr-TR.js.map +1 -0
- package/dist/intl/datepicker/uk-UA.js +11 -0
- package/dist/intl/datepicker/uk-UA.js.map +1 -0
- package/dist/intl/datepicker/zh-CN.js +11 -0
- package/dist/intl/datepicker/zh-CN.js.map +1 -0
- package/dist/intl/datepicker/zh-TW.js +11 -0
- package/dist/intl/datepicker/zh-TW.js.map +1 -0
- package/dist/layout/grid-layout.d.ts +107 -0
- package/dist/layout/grid-layout.js +253 -0
- package/dist/layout/grid-layout.js.map +1 -0
- package/dist/layout/list-layout.d.ts +187 -0
- package/dist/layout/list-layout.js +488 -0
- package/dist/layout/list-layout.js.map +1 -0
- package/dist/layout/table-layout.d.ts +98 -0
- package/dist/layout/table-layout.js +476 -0
- package/dist/layout/table-layout.js.map +1 -0
- package/dist/layout/waterfall-layout.d.ts +85 -0
- package/dist/layout/waterfall-layout.js +225 -0
- package/dist/layout/waterfall-layout.js.map +1 -0
- package/dist/list/create-list-state.d.ts +48 -0
- package/dist/list/create-list-state.js +123 -0
- package/dist/list/create-list-state.js.map +1 -0
- package/dist/list/create-single-select-list-state.d.ts +38 -0
- package/dist/list/create-single-select-list-state.js +55 -0
- package/dist/list/create-single-select-list-state.js.map +1 -0
- package/dist/list/list-collection.d.ts +36 -0
- package/dist/list/list-collection.js +91 -0
- package/dist/list/list-collection.js.map +1 -0
- package/dist/menu/create-menu-trigger-state.d.ts +55 -0
- package/dist/menu/create-menu-trigger-state.js +58 -0
- package/dist/menu/create-menu-trigger-state.js.map +1 -0
- package/dist/menu/create-submenu-trigger-state.d.ts +47 -0
- package/dist/menu/create-submenu-trigger-state.js +59 -0
- package/dist/menu/create-submenu-trigger-state.js.map +1 -0
- package/dist/numberfield/create-number-field-state.d.ts +93 -0
- package/dist/numberfield/create-number-field-state.js +139 -0
- package/dist/numberfield/create-number-field-state.js.map +1 -0
- package/dist/overlays/create-overlay-trigger-state.d.ts +51 -0
- package/dist/overlays/create-overlay-trigger-state.js +56 -0
- package/dist/overlays/create-overlay-trigger-state.js.map +1 -0
- package/dist/radio/create-radio-group-state.d.ts +61 -0
- package/dist/radio/create-radio-group-state.js +71 -0
- package/dist/radio/create-radio-group-state.js.map +1 -0
- package/dist/searchfield/create-search-field-state.d.ts +35 -0
- package/dist/searchfield/create-search-field-state.js +34 -0
- package/dist/searchfield/create-search-field-state.js.map +1 -0
- package/dist/select/create-select-state.d.ts +116 -0
- package/dist/select/create-select-state.js +151 -0
- package/dist/select/create-select-state.js.map +1 -0
- package/dist/selection/create-multiple-selection-state.d.ts +39 -0
- package/dist/selection/create-multiple-selection-state.js +114 -0
- package/dist/selection/create-multiple-selection-state.js.map +1 -0
- package/dist/selection/selection-manager.d.ts +139 -0
- package/dist/selection/selection-manager.js +334 -0
- package/dist/selection/selection-manager.js.map +1 -0
- package/dist/selection/selection.d.ts +27 -0
- package/dist/selection/selection.js +38 -0
- package/dist/selection/selection.js.map +1 -0
- package/dist/selection/types.d.ts +116 -0
- package/dist/selection/types.js +16 -0
- package/dist/slider/create-slider-state.d.ts +182 -0
- package/dist/slider/create-slider-state.js +131 -0
- package/dist/slider/create-slider-state.js.map +1 -0
- package/dist/steplist/create-step-list-state.d.ts +40 -0
- package/dist/steplist/create-step-list-state.js +132 -0
- package/dist/steplist/create-step-list-state.js.map +1 -0
- package/dist/table/cell.d.ts +37 -0
- package/dist/table/cell.js +47 -0
- package/dist/table/cell.js.map +1 -0
- package/dist/table/collection-context.d.ts +4 -0
- package/dist/table/collection-context.js +8 -0
- package/dist/table/collection-context.js.map +1 -0
- package/dist/table/column.d.ts +66 -0
- package/dist/table/column.js +71 -0
- package/dist/table/column.js.map +1 -0
- package/dist/table/create-table-column-resize-state.d.ts +65 -0
- package/dist/table/create-table-column-resize-state.js +100 -0
- package/dist/table/create-table-column-resize-state.js.map +1 -0
- package/dist/table/create-table-state.d.ts +112 -0
- package/dist/table/create-table-state.js +122 -0
- package/dist/table/create-table-state.js.map +1 -0
- package/dist/table/create-tree-grid-state.d.ts +44 -0
- package/dist/table/create-tree-grid-state.js +145 -0
- package/dist/table/create-tree-grid-state.js.map +1 -0
- package/dist/table/row.d.ts +44 -0
- package/dist/table/row.js +91 -0
- package/dist/table/row.js.map +1 -0
- package/dist/table/table-body.d.ts +36 -0
- package/dist/table/table-body.js +57 -0
- package/dist/table/table-body.js.map +1 -0
- package/dist/table/table-collection.d.ts +62 -0
- package/dist/table/table-collection.js +274 -0
- package/dist/table/table-collection.js.map +1 -0
- package/dist/table/table-column-layout.d.ts +47 -0
- package/dist/table/table-column-layout.js +94 -0
- package/dist/table/table-column-layout.js.map +1 -0
- package/dist/table/table-header.d.ts +37 -0
- package/dist/table/table-header.js +52 -0
- package/dist/table/table-header.js.map +1 -0
- package/dist/table/table-utils.d.ts +60 -0
- package/dist/table/table-utils.js +203 -0
- package/dist/table/table-utils.js.map +1 -0
- package/dist/tabs/create-tab-list-state.d.ts +42 -0
- package/dist/tabs/create-tab-list-state.js +78 -0
- package/dist/tabs/create-tab-list-state.js.map +1 -0
- package/dist/toast/create-toast-state.d.ts +97 -0
- package/dist/toast/create-toast-state.js +166 -0
- package/dist/toast/create-toast-state.js.map +1 -0
- package/dist/toggle/create-toggle-group-state.d.ts +55 -0
- package/dist/toggle/create-toggle-group-state.js +62 -0
- package/dist/toggle/create-toggle-group-state.js.map +1 -0
- package/dist/toggle/create-toggle-state.d.ts +58 -0
- package/dist/toggle/create-toggle-state.js +43 -0
- package/dist/toggle/create-toggle-state.js.map +1 -0
- package/dist/tokenfield/create-token-field-state.d.ts +39 -0
- package/dist/tokenfield/create-token-field-state.js +44 -0
- package/dist/tokenfield/create-token-field-state.js.map +1 -0
- package/dist/tokenfield/token-field-value.d.ts +111 -0
- package/dist/tokenfield/token-field-value.js +327 -0
- package/dist/tokenfield/token-field-value.js.map +1 -0
- package/dist/tooltip/create-tooltip-trigger-state.d.ts +73 -0
- package/dist/tooltip/create-tooltip-trigger-state.js +136 -0
- package/dist/tooltip/create-tooltip-trigger-state.js.map +1 -0
- package/dist/tree/create-tree-state.d.ts +42 -0
- package/dist/tree/create-tree-state.js +75 -0
- package/dist/tree/create-tree-state.js.map +1 -0
- package/dist/tree/tree-collection.d.ts +36 -0
- package/dist/tree/tree-collection.js +84 -0
- package/dist/tree/tree-collection.js.map +1 -0
- package/dist/utils/create-controlled-signal.d.ts +23 -0
- package/dist/utils/create-controlled-signal.js +54 -0
- package/dist/utils/create-controlled-signal.js.map +1 -0
- package/dist/utils/get-item-key.d.ts +5 -0
- package/dist/utils/get-item-key.js +12 -0
- package/dist/utils/get-item-key.js.map +1 -0
- package/dist/utils/get-node-props.d.ts +23 -0
- package/dist/utils/get-node-props.js +38 -0
- package/dist/utils/get-node-props.js.map +1 -0
- package/dist/utils/has-content.d.ts +5 -0
- package/dist/utils/has-content.js +7 -0
- package/dist/utils/has-content.js.map +1 -0
- package/dist/utils/legacy-props.d.ts +10 -0
- package/dist/utils/legacy-props.js +17 -0
- package/dist/utils/legacy-props.js.map +1 -0
- package/dist/utils/number.d.ts +25 -0
- package/dist/utils/number.js +59 -0
- package/dist/utils/number.js.map +1 -0
- package/dist/utils/parse-calendar-identifier.d.ts +5 -0
- package/dist/utils/parse-calendar-identifier.js +31 -0
- package/dist/utils/parse-calendar-identifier.js.map +1 -0
- package/dist/utils/require-value.d.ts +4 -0
- package/dist/utils/require-value.js +10 -0
- package/dist/utils/require-value.js.map +1 -0
- package/dist/virtualizer/create-virtualizer-state.d.ts +44 -0
- package/dist/virtualizer/create-virtualizer-state.js +92 -0
- package/dist/virtualizer/create-virtualizer-state.js.map +1 -0
- package/dist/virtualizer/layout-info.d.ts +94 -0
- package/dist/virtualizer/layout-info.js +118 -0
- package/dist/virtualizer/layout-info.js.map +1 -0
- package/dist/virtualizer/layout.d.ts +91 -0
- package/dist/virtualizer/layout.js +71 -0
- package/dist/virtualizer/layout.js.map +1 -0
- package/dist/virtualizer/overscan-manager.d.ts +25 -0
- package/dist/virtualizer/overscan-manager.js +46 -0
- package/dist/virtualizer/overscan-manager.js.map +1 -0
- package/dist/virtualizer/point.d.ts +36 -0
- package/dist/virtualizer/point.js +48 -0
- package/dist/virtualizer/point.js.map +1 -0
- package/dist/virtualizer/rect.d.ts +103 -0
- package/dist/virtualizer/rect.js +156 -0
- package/dist/virtualizer/rect.js.map +1 -0
- package/dist/virtualizer/reusable-view.d.ts +51 -0
- package/dist/virtualizer/reusable-view.js +81 -0
- package/dist/virtualizer/reusable-view.js.map +1 -0
- package/dist/virtualizer/scroll-anchor.d.ts +98 -0
- package/dist/virtualizer/scroll-anchor.js +150 -0
- package/dist/virtualizer/scroll-anchor.js.map +1 -0
- package/dist/virtualizer/size.d.ts +34 -0
- package/dist/virtualizer/size.js +46 -0
- package/dist/virtualizer/size.js.map +1 -0
- package/dist/virtualizer/types.d.ts +47 -0
- package/dist/virtualizer/types.js +16 -0
- package/dist/virtualizer/utils.d.ts +19 -0
- package/dist/virtualizer/utils.js +27 -0
- package/dist/virtualizer/utils.js.map +1 -0
- package/dist/virtualizer/virtualizer.d.ts +99 -0
- package/dist/virtualizer/virtualizer.js +314 -0
- package/dist/virtualizer/virtualizer.js.map +1 -0
- package/package.json +174 -4
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
/*
|
|
13
|
+
* Derived from Adobe React Spectrum: packages/react-stately/src/datepicker/utils.ts.
|
|
14
|
+
* Modified for Solid Aria: adapted reactive state, getters, imports, and APIs for Solid 2.
|
|
15
|
+
* Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.
|
|
16
|
+
*/
|
|
17
|
+
import { DatePickerProps, DateValue, Granularity, TimeValue } from "./types.js";
|
|
18
|
+
import { Calendar } from "@internationalized/date";
|
|
19
|
+
import { RangeValue, ValidationResult } from "@solid2-aria/types-shared";
|
|
20
|
+
export declare function getValidationResult(value: DateValue | null, minValue: DateValue | null | undefined, maxValue: DateValue | null | undefined, isDateUnavailable: ((v: DateValue) => boolean) | undefined, options: FormatterOptions): ValidationResult;
|
|
21
|
+
export declare function getRangeValidationResult(value: RangeValue<DateValue | null> | null, minValue: DateValue | null | undefined, maxValue: DateValue | null | undefined, isDateUnavailable: ((v: DateValue) => boolean) | undefined, options: FormatterOptions): ValidationResult;
|
|
22
|
+
export type FieldOptions = Pick<Intl.DateTimeFormatOptions, "year" | "month" | "day" | "hour" | "minute" | "second">;
|
|
23
|
+
export interface FormatterOptions {
|
|
24
|
+
timeZone?: string;
|
|
25
|
+
hideTimeZone?: boolean;
|
|
26
|
+
granularity?: DatePickerProps<DateValue>["granularity"];
|
|
27
|
+
maxGranularity?: "year" | "month" | DatePickerProps<DateValue>["granularity"];
|
|
28
|
+
hourCycle?: 12 | 24;
|
|
29
|
+
showEra?: boolean;
|
|
30
|
+
shouldForceLeadingZeros?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export declare function getFormatOptions(initialFieldOptions: FieldOptions, options: FormatterOptions): Intl.DateTimeFormatOptions;
|
|
33
|
+
export declare function getPlaceholderTime(placeholderValue: DateValue | null | undefined): TimeValue;
|
|
34
|
+
export declare function convertValue(value: DateValue | null | undefined, calendar: Calendar): DateValue | null | undefined;
|
|
35
|
+
export declare function createPlaceholderDate(placeholderValue: DateValue | null | undefined, granularity: string, calendar: Calendar, timeZone: string | undefined): DateValue;
|
|
36
|
+
export declare function createDefaultProps(value: () => DateValue | null, granularity: () => Granularity | undefined): () => [Granularity, string | undefined];
|
|
37
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
/*
|
|
13
|
+
* Derived from Adobe React Spectrum: packages/react-stately/src/datepicker/utils.ts.
|
|
14
|
+
* Modified for Solid Aria: adapted reactive state, getters, imports, and APIs for Solid 2.
|
|
15
|
+
* Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.
|
|
16
|
+
*/
|
|
17
|
+
import { VALID_VALIDITY_STATE, mergeValidation } from "../form/create-form-validation-state.js";
|
|
18
|
+
import datepicker_default from "../intl/datepicker/index.js";
|
|
19
|
+
import { createMemo } from "solid-js";
|
|
20
|
+
import { DateFormatter, Time, getLocalTimeZone, now, toCalendar, toCalendarDate, toCalendarDateTime } from "@internationalized/date";
|
|
21
|
+
import { LocalizedStringDictionary, LocalizedStringFormatter } from "@internationalized/string";
|
|
22
|
+
// src/datepicker/utils.ts
|
|
23
|
+
const dictionary = new LocalizedStringDictionary(datepicker_default);
|
|
24
|
+
function getLocale() {
|
|
25
|
+
let locale = typeof navigator !== "undefined" && (navigator.language || ("userLanguage" in navigator ? String(navigator.userLanguage) : "")) || "en-US";
|
|
26
|
+
try {
|
|
27
|
+
Intl.DateTimeFormat.supportedLocalesOf([locale]);
|
|
28
|
+
} catch {
|
|
29
|
+
locale = "en-US";
|
|
30
|
+
}
|
|
31
|
+
return locale;
|
|
32
|
+
}
|
|
33
|
+
function getValidationResult(value, minValue, maxValue, isDateUnavailable, options) {
|
|
34
|
+
const maximumComparison = compareDateBoundary(value, maxValue);
|
|
35
|
+
const minimumComparison = compareDateBoundary(value, minValue);
|
|
36
|
+
const rangeOverflow = maximumComparison !== null && maximumComparison > 0;
|
|
37
|
+
const rangeUnderflow = minimumComparison !== null && minimumComparison < 0;
|
|
38
|
+
const isUnavailable = (value !== null && isDateUnavailable?.(value)) ?? false;
|
|
39
|
+
const isInvalid = rangeOverflow || rangeUnderflow || isUnavailable;
|
|
40
|
+
const errors = [];
|
|
41
|
+
if (isInvalid) {
|
|
42
|
+
const locale = getLocale();
|
|
43
|
+
const strings = LocalizedStringDictionary.getGlobalDictionaryForPackage("@react-stately/datepicker") ?? dictionary;
|
|
44
|
+
const formatter = new LocalizedStringFormatter(locale, strings);
|
|
45
|
+
const dateFormatter = new DateFormatter(locale, getFormatOptions({}, options));
|
|
46
|
+
const { timeZone } = dateFormatter.resolvedOptions();
|
|
47
|
+
if (rangeUnderflow && minValue !== null && minValue !== void 0) errors.push(formatter.format("rangeUnderflow", { minValue: dateFormatter.format(minValue.toDate(timeZone)) }));
|
|
48
|
+
if (rangeOverflow && maxValue !== null && maxValue !== void 0) errors.push(formatter.format("rangeOverflow", { maxValue: dateFormatter.format(maxValue.toDate(timeZone)) }));
|
|
49
|
+
if (isUnavailable) errors.push(formatter.format("unavailableDate"));
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
isInvalid,
|
|
53
|
+
validationDetails: {
|
|
54
|
+
badInput: isUnavailable,
|
|
55
|
+
customError: false,
|
|
56
|
+
patternMismatch: false,
|
|
57
|
+
rangeOverflow,
|
|
58
|
+
rangeUnderflow,
|
|
59
|
+
stepMismatch: false,
|
|
60
|
+
tooLong: false,
|
|
61
|
+
tooShort: false,
|
|
62
|
+
typeMismatch: false,
|
|
63
|
+
valid: !isInvalid,
|
|
64
|
+
valueMissing: false
|
|
65
|
+
},
|
|
66
|
+
validationErrors: errors
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function getRangeValidationResult(value, minValue, maxValue, isDateUnavailable, options) {
|
|
70
|
+
const startValidation = getValidationResult(value?.start ?? null, minValue, maxValue, isDateUnavailable, options);
|
|
71
|
+
const endValidation = getValidationResult(value?.end ?? null, minValue, maxValue, isDateUnavailable, options);
|
|
72
|
+
let result = mergeValidation(startValidation, endValidation);
|
|
73
|
+
if (value?.end !== null && value?.end !== void 0 && value.start !== null && value.start !== void 0 && value.end.compare(value.start) < 0) {
|
|
74
|
+
const strings = LocalizedStringDictionary.getGlobalDictionaryForPackage("@react-stately/datepicker") ?? dictionary;
|
|
75
|
+
result = mergeValidation(result, {
|
|
76
|
+
isInvalid: true,
|
|
77
|
+
validationDetails: {
|
|
78
|
+
...VALID_VALIDITY_STATE,
|
|
79
|
+
rangeOverflow: true,
|
|
80
|
+
rangeUnderflow: true,
|
|
81
|
+
valid: false
|
|
82
|
+
},
|
|
83
|
+
validationErrors: [strings.getStringForLocale("rangeReversed", getLocale())]
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return result;
|
|
87
|
+
}
|
|
88
|
+
const DEFAULT_FIELD_OPTIONS = {
|
|
89
|
+
day: "numeric",
|
|
90
|
+
hour: "numeric",
|
|
91
|
+
minute: "2-digit",
|
|
92
|
+
month: "numeric",
|
|
93
|
+
second: "2-digit",
|
|
94
|
+
year: "numeric"
|
|
95
|
+
};
|
|
96
|
+
const TWO_DIGIT_FIELD_OPTIONS = {
|
|
97
|
+
day: "2-digit",
|
|
98
|
+
hour: "2-digit",
|
|
99
|
+
minute: "2-digit",
|
|
100
|
+
month: "2-digit",
|
|
101
|
+
second: "2-digit",
|
|
102
|
+
year: "numeric"
|
|
103
|
+
};
|
|
104
|
+
function getFormatOptions(initialFieldOptions, options) {
|
|
105
|
+
let fieldOptions = initialFieldOptions;
|
|
106
|
+
fieldOptions = {
|
|
107
|
+
...options.shouldForceLeadingZeros === true ? TWO_DIGIT_FIELD_OPTIONS : DEFAULT_FIELD_OPTIONS,
|
|
108
|
+
...fieldOptions
|
|
109
|
+
};
|
|
110
|
+
const granularity = options.granularity ?? "minute";
|
|
111
|
+
const keys = [
|
|
112
|
+
"year",
|
|
113
|
+
"month",
|
|
114
|
+
"day",
|
|
115
|
+
"hour",
|
|
116
|
+
"minute",
|
|
117
|
+
"second"
|
|
118
|
+
];
|
|
119
|
+
let startIdx = keys.indexOf(options.maxGranularity ?? "year");
|
|
120
|
+
if (startIdx < 0) startIdx = 0;
|
|
121
|
+
let endIdx = keys.indexOf(granularity);
|
|
122
|
+
if (endIdx < 0) endIdx = 2;
|
|
123
|
+
if (startIdx > endIdx) throw new Error("maxGranularity must be greater than granularity");
|
|
124
|
+
const opts = {};
|
|
125
|
+
for (const key of keys.slice(startIdx, endIdx + 1)) Object.assign(opts, { [key]: fieldOptions[key] });
|
|
126
|
+
if (options.hourCycle !== null && options.hourCycle !== void 0) opts.hour12 = options.hourCycle === 12;
|
|
127
|
+
opts.timeZone = options.timeZone ?? "UTC";
|
|
128
|
+
if ((granularity === "hour" || granularity === "minute" || granularity === "second") && options.timeZone !== void 0 && options.timeZone !== "" && !(options.hideTimeZone === true)) opts.timeZoneName = "short";
|
|
129
|
+
if (options.showEra === true && startIdx === 0) opts.era = "short";
|
|
130
|
+
return opts;
|
|
131
|
+
}
|
|
132
|
+
function getPlaceholderTime(placeholderValue) {
|
|
133
|
+
if (placeholderValue && "hour" in placeholderValue) return placeholderValue;
|
|
134
|
+
return new Time();
|
|
135
|
+
}
|
|
136
|
+
function convertValue(value, calendar) {
|
|
137
|
+
if (value === null) return null;
|
|
138
|
+
if (!value) return;
|
|
139
|
+
return toCalendar(value, calendar);
|
|
140
|
+
}
|
|
141
|
+
function createPlaceholderDate(placeholderValue, granularity, calendar, timeZone) {
|
|
142
|
+
if (placeholderValue) return toCalendar(placeholderValue, calendar);
|
|
143
|
+
const date = toCalendar(now(timeZone ?? getLocalTimeZone()).set({
|
|
144
|
+
hour: 0,
|
|
145
|
+
millisecond: 0,
|
|
146
|
+
minute: 0,
|
|
147
|
+
second: 0
|
|
148
|
+
}), calendar);
|
|
149
|
+
if (granularity === "year" || granularity === "month" || granularity === "day") return toCalendarDate(date);
|
|
150
|
+
if (timeZone === void 0 || timeZone === "") return toCalendarDateTime(date);
|
|
151
|
+
return date;
|
|
152
|
+
}
|
|
153
|
+
function createDefaultProps(value, granularity) {
|
|
154
|
+
let last = ["day", void 0];
|
|
155
|
+
return createMemo(() => {
|
|
156
|
+
const v = value();
|
|
157
|
+
const requested = granularity();
|
|
158
|
+
if (v && requested && !(requested in v)) throw new Error(`Invalid granularity ${requested} for value ${v.toString()}`);
|
|
159
|
+
if (v) last = ["minute" in v ? "minute" : "day", "timeZone" in v ? v.timeZone : void 0];
|
|
160
|
+
return [requested ?? last[0], last[1]];
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
function compareDateBoundary(value, boundary) {
|
|
164
|
+
return value !== null && boundary !== null && boundary !== void 0 ? value.compare(boundary) : null;
|
|
165
|
+
}
|
|
166
|
+
export { convertValue, createDefaultProps, createPlaceholderDate, getFormatOptions, getPlaceholderTime, getRangeValidationResult, getValidationResult };
|
|
167
|
+
|
|
168
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","names":["i18nMessages"],"sources":["../../src/datepicker/utils.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n/*\n * Derived from Adobe React Spectrum: packages/react-stately/src/datepicker/utils.ts.\n * Modified for Solid Aria: adapted reactive state, getters, imports, and APIs for Solid 2.\n * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.\n */\n\nimport {\n DateFormatter,\n getLocalTimeZone,\n now,\n Time,\n toCalendar,\n toCalendarDate,\n toCalendarDateTime,\n} from \"@internationalized/date\";\nimport type { Calendar } from \"@internationalized/date\";\nimport {\n LocalizedStringDictionary,\n LocalizedStringFormatter,\n} from \"@internationalized/string\";\nimport type { RangeValue, ValidationResult } from \"@solid2-aria/types-shared\";\nimport { createMemo } from \"solid-js\";\n\nimport i18nMessages from \"../../intl/datepicker/index\";\nimport {\n mergeValidation,\n VALID_VALIDITY_STATE,\n} from \"../form/create-form-validation-state\";\nimport type {\n DatePickerProps,\n DateValue,\n Granularity,\n TimeValue,\n} from \"./types\";\n\nconst dictionary = new LocalizedStringDictionary(i18nMessages);\n\nfunction getLocale() {\n // Match browser language setting here, NOT react-aria's I18nProvider, so that we match other browser-provided\n // validation messages, which to not respect our provider's language.\n let locale =\n (typeof navigator !== \"undefined\" &&\n (navigator.language ||\n (\"userLanguage\" in navigator ? String(navigator.userLanguage) : \"\"))) ||\n \"en-US\";\n\n try {\n Intl.DateTimeFormat.supportedLocalesOf([locale]);\n } catch {\n locale = \"en-US\";\n }\n\n return locale;\n}\n\nexport function getValidationResult(\n value: DateValue | null,\n minValue: DateValue | null | undefined,\n maxValue: DateValue | null | undefined,\n isDateUnavailable: ((v: DateValue) => boolean) | undefined,\n options: FormatterOptions\n): ValidationResult {\n const maximumComparison = compareDateBoundary(value, maxValue);\n const minimumComparison = compareDateBoundary(value, minValue);\n const rangeOverflow = maximumComparison !== null && maximumComparison > 0;\n const rangeUnderflow = minimumComparison !== null && minimumComparison < 0;\n\n const isUnavailable = (value !== null && isDateUnavailable?.(value)) ?? false;\n\n const isInvalid = rangeOverflow || rangeUnderflow || isUnavailable;\n const errors: string[] = [];\n\n if (isInvalid) {\n const locale = getLocale();\n\n const strings =\n LocalizedStringDictionary.getGlobalDictionaryForPackage(\n \"@react-stately/datepicker\"\n ) ?? dictionary;\n\n const formatter = new LocalizedStringFormatter(locale, strings);\n\n const dateFormatter = new DateFormatter(\n locale,\n getFormatOptions({}, options)\n );\n\n const { timeZone } = dateFormatter.resolvedOptions();\n\n if (rangeUnderflow && minValue !== null && minValue !== undefined) {\n errors.push(\n formatter.format(\"rangeUnderflow\", {\n minValue: dateFormatter.format(minValue.toDate(timeZone)),\n })\n );\n }\n\n if (rangeOverflow && maxValue !== null && maxValue !== undefined) {\n errors.push(\n formatter.format(\"rangeOverflow\", {\n maxValue: dateFormatter.format(maxValue.toDate(timeZone)),\n })\n );\n }\n\n if (isUnavailable) {\n errors.push(formatter.format(\"unavailableDate\"));\n }\n }\n\n return {\n isInvalid,\n validationDetails: {\n badInput: isUnavailable,\n customError: false,\n patternMismatch: false,\n rangeOverflow,\n rangeUnderflow,\n stepMismatch: false,\n tooLong: false,\n tooShort: false,\n typeMismatch: false,\n valid: !isInvalid,\n valueMissing: false,\n },\n validationErrors: errors,\n };\n}\n\nexport function getRangeValidationResult(\n value: RangeValue<DateValue | null> | null,\n minValue: DateValue | null | undefined,\n maxValue: DateValue | null | undefined,\n isDateUnavailable: ((v: DateValue) => boolean) | undefined,\n options: FormatterOptions\n): ValidationResult {\n const startValidation = getValidationResult(\n value?.start ?? null,\n minValue,\n maxValue,\n isDateUnavailable,\n options\n );\n\n const endValidation = getValidationResult(\n value?.end ?? null,\n minValue,\n maxValue,\n isDateUnavailable,\n options\n );\n\n let result = mergeValidation(startValidation, endValidation);\n\n if (\n value?.end !== null &&\n value?.end !== undefined &&\n value.start !== null &&\n value.start !== undefined &&\n value.end.compare(value.start) < 0\n ) {\n const strings =\n LocalizedStringDictionary.getGlobalDictionaryForPackage(\n \"@react-stately/datepicker\"\n ) ?? dictionary;\n\n result = mergeValidation(result, {\n isInvalid: true,\n validationDetails: {\n // oxlint-disable-next-line typescript/no-misused-spread -- The DOM interface describes a plain object of validation flags here.\n ...VALID_VALIDITY_STATE,\n rangeOverflow: true,\n rangeUnderflow: true,\n valid: false,\n },\n validationErrors: [\n strings.getStringForLocale(\"rangeReversed\", getLocale()),\n ],\n });\n }\n\n return result;\n}\n\nexport type FieldOptions = Pick<\n Intl.DateTimeFormatOptions,\n \"year\" | \"month\" | \"day\" | \"hour\" | \"minute\" | \"second\"\n>;\n\nexport interface FormatterOptions {\n timeZone?: string;\n hideTimeZone?: boolean;\n granularity?: DatePickerProps<DateValue>[\"granularity\"];\n maxGranularity?: \"year\" | \"month\" | DatePickerProps<DateValue>[\"granularity\"];\n hourCycle?: 12 | 24;\n showEra?: boolean;\n shouldForceLeadingZeros?: boolean;\n}\n\nconst DEFAULT_FIELD_OPTIONS: FieldOptions = {\n day: \"numeric\",\n hour: \"numeric\",\n minute: \"2-digit\",\n month: \"numeric\",\n second: \"2-digit\",\n year: \"numeric\",\n};\n\nconst TWO_DIGIT_FIELD_OPTIONS: FieldOptions = {\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n month: \"2-digit\",\n second: \"2-digit\",\n year: \"numeric\",\n};\n\nexport function getFormatOptions(\n initialFieldOptions: FieldOptions,\n options: FormatterOptions\n): Intl.DateTimeFormatOptions {\n let fieldOptions = initialFieldOptions;\n\n const defaultFieldOptions =\n options.shouldForceLeadingZeros === true\n ? TWO_DIGIT_FIELD_OPTIONS\n : DEFAULT_FIELD_OPTIONS;\n\n fieldOptions = { ...defaultFieldOptions, ...fieldOptions };\n const granularity = options.granularity ?? \"minute\";\n\n const keys: (keyof FieldOptions)[] = [\n \"year\",\n \"month\",\n \"day\",\n \"hour\",\n \"minute\",\n \"second\",\n ];\n\n let startIdx = keys.indexOf(options.maxGranularity ?? \"year\");\n\n if (startIdx < 0) {\n startIdx = 0;\n }\n\n let endIdx = keys.indexOf(granularity);\n\n if (endIdx < 0) {\n endIdx = 2;\n }\n\n if (startIdx > endIdx) {\n throw new Error(\"maxGranularity must be greater than granularity\");\n }\n\n const opts: Intl.DateTimeFormatOptions = {};\n\n for (const key of keys.slice(startIdx, endIdx + 1)) {\n Object.assign(opts, { [key]: fieldOptions[key] });\n }\n\n if (options.hourCycle !== null && options.hourCycle !== undefined) {\n opts.hour12 = options.hourCycle === 12;\n }\n\n opts.timeZone = options.timeZone ?? \"UTC\";\n\n const hasTime =\n granularity === \"hour\" ||\n granularity === \"minute\" ||\n granularity === \"second\";\n\n if (\n hasTime &&\n options.timeZone !== undefined &&\n options.timeZone !== \"\" &&\n !(options.hideTimeZone === true)\n ) {\n opts.timeZoneName = \"short\";\n }\n\n if (options.showEra === true && startIdx === 0) {\n opts.era = \"short\";\n }\n\n return opts;\n}\n\nexport function getPlaceholderTime(\n placeholderValue: DateValue | null | undefined\n): TimeValue {\n if (placeholderValue && \"hour\" in placeholderValue) {\n return placeholderValue;\n }\n\n return new Time();\n}\n\nexport function convertValue(\n value: DateValue | null | undefined,\n calendar: Calendar\n): DateValue | null | undefined {\n if (value === null) {\n return null;\n }\n\n if (!value) {\n return undefined;\n }\n\n return toCalendar(value, calendar);\n}\n\nexport function createPlaceholderDate(\n placeholderValue: DateValue | null | undefined,\n granularity: string,\n calendar: Calendar,\n timeZone: string | undefined\n): DateValue {\n if (placeholderValue) {\n return toCalendar(placeholderValue, calendar);\n }\n\n const date = toCalendar(\n now(timeZone ?? getLocalTimeZone()).set({\n hour: 0,\n millisecond: 0,\n minute: 0,\n second: 0,\n }),\n calendar\n );\n\n if (\n granularity === \"year\" ||\n granularity === \"month\" ||\n granularity === \"day\"\n ) {\n return toCalendarDate(date);\n }\n\n if (timeZone === undefined || timeZone === \"\") {\n return toCalendarDateTime(date);\n }\n\n return date;\n}\n\nexport function createDefaultProps(\n value: () => DateValue | null,\n granularity: () => Granularity | undefined\n): () => [Granularity, string | undefined] {\n let last: [Granularity, string | undefined] = [\"day\", undefined];\n\n return createMemo(() => {\n const v = value();\n const requested = granularity();\n\n if (v && requested && !(requested in v)) {\n throw new Error(\n `Invalid granularity ${requested} for value ${v.toString()}`\n );\n }\n\n if (v) {\n last = [\n \"minute\" in v ? \"minute\" : \"day\",\n \"timeZone\" in v ? v.timeZone : undefined,\n ];\n }\n\n return [requested ?? last[0], last[1]];\n });\n}\n\nfunction compareDateBoundary(\n value: DateValue | null,\n boundary: DateValue | null | undefined\n): number | null {\n return value !== null && boundary !== null && boundary !== undefined\n ? value.compare(boundary)\n : null;\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
/*
|
|
13
|
+
* Derived from Adobe React Spectrum: packages/react-stately/src/disclosure/useDisclosureGroupState.ts.
|
|
14
|
+
* Modified for Solid Aria: adapted reactive state, getters, imports, and APIs for Solid 2.
|
|
15
|
+
* Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.
|
|
16
|
+
*/
|
|
17
|
+
import { Key } from "@solid2-aria/types-shared";
|
|
18
|
+
export interface DisclosureGroupProps {
|
|
19
|
+
/** Whether multiple items can be expanded at the same time. */
|
|
20
|
+
allowsMultipleExpanded?: boolean;
|
|
21
|
+
/** Whether all items are disabled. */
|
|
22
|
+
isDisabled?: boolean;
|
|
23
|
+
/** The currently expanded keys in the group (controlled). */
|
|
24
|
+
expandedKeys?: Iterable<Key>;
|
|
25
|
+
/** The initial expanded keys in the group (uncontrolled). */
|
|
26
|
+
defaultExpandedKeys?: Iterable<Key>;
|
|
27
|
+
/** Handler that is called when items are expanded or collapsed. */
|
|
28
|
+
onExpandedChange?: (keys: Set<Key>) => void;
|
|
29
|
+
}
|
|
30
|
+
export interface DisclosureGroupState {
|
|
31
|
+
/** Whether multiple items can be expanded at the same time. */
|
|
32
|
+
readonly allowsMultipleExpanded: boolean;
|
|
33
|
+
/** Whether all items are disabled. */
|
|
34
|
+
readonly isDisabled: boolean;
|
|
35
|
+
/** A set of keys for items that are expanded. */
|
|
36
|
+
readonly expandedKeys: Set<Key>;
|
|
37
|
+
/** Toggles the expanded state for an item by its key. */
|
|
38
|
+
toggleKey: (key: Key) => void;
|
|
39
|
+
/** Replaces the set of expanded keys. */
|
|
40
|
+
setExpandedKeys: (keys: Set<Key>) => void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Manages state for a group of disclosures, e.g. an accordion.
|
|
44
|
+
* It supports both single and multiple expanded items.
|
|
45
|
+
*/
|
|
46
|
+
export declare function createDisclosureGroupState(props: DisclosureGroupProps): DisclosureGroupState;
|
|
47
|
+
//# sourceMappingURL=create-disclosure-group-state.d.ts.map
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
/*
|
|
13
|
+
* Derived from Adobe React Spectrum: packages/react-stately/src/disclosure/useDisclosureGroupState.ts.
|
|
14
|
+
* Modified for Solid Aria: adapted reactive state, getters, imports, and APIs for Solid 2.
|
|
15
|
+
* Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.
|
|
16
|
+
*/
|
|
17
|
+
import { createControlledSignal } from "../utils/create-controlled-signal.js";
|
|
18
|
+
import { createMemo, createRenderEffect, untrack } from "solid-js";
|
|
19
|
+
// src/disclosure/create-disclosure-group-state.ts
|
|
20
|
+
/**
|
|
21
|
+
* Manages state for a group of disclosures, e.g. an accordion.
|
|
22
|
+
* It supports both single and multiple expanded items.
|
|
23
|
+
*/
|
|
24
|
+
function createDisclosureGroupState(props) {
|
|
25
|
+
const allowsMultipleExpanded = createMemo(() => props.allowsMultipleExpanded ?? false);
|
|
26
|
+
const isDisabled = createMemo(() => props.isDisabled ?? false);
|
|
27
|
+
const controlledKeys = createMemo(() => props.expandedKeys ? new Set(props.expandedKeys) : void 0);
|
|
28
|
+
const [expandedKeys, setExpandedKeys] = createControlledSignal(controlledKeys, untrack(() => new Set(props.defaultExpandedKeys)), (keys) => props.onExpandedChange?.(keys));
|
|
29
|
+
createRenderEffect(() => ({
|
|
30
|
+
allowsMultipleExpanded: allowsMultipleExpanded(),
|
|
31
|
+
expandedKeys: expandedKeys()
|
|
32
|
+
}), (current) => {
|
|
33
|
+
if (!current.allowsMultipleExpanded && current.expandedKeys.size > 1) {
|
|
34
|
+
const firstKey = current.expandedKeys.values().next().value;
|
|
35
|
+
if (firstKey !== void 0) setExpandedKeys(/* @__PURE__ */ new Set([firstKey]));
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
return {
|
|
39
|
+
get allowsMultipleExpanded() {
|
|
40
|
+
return allowsMultipleExpanded();
|
|
41
|
+
},
|
|
42
|
+
get expandedKeys() {
|
|
43
|
+
return expandedKeys();
|
|
44
|
+
},
|
|
45
|
+
get isDisabled() {
|
|
46
|
+
return isDisabled();
|
|
47
|
+
},
|
|
48
|
+
setExpandedKeys,
|
|
49
|
+
toggleKey(key) {
|
|
50
|
+
setExpandedKeys((previous) => {
|
|
51
|
+
if (!allowsMultipleExpanded()) return new Set(previous.has(key) ? [] : [key]);
|
|
52
|
+
const keys = new Set(previous);
|
|
53
|
+
if (keys.has(key)) keys.delete(key);
|
|
54
|
+
else keys.add(key);
|
|
55
|
+
return keys;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
export { createDisclosureGroupState };
|
|
61
|
+
|
|
62
|
+
//# sourceMappingURL=create-disclosure-group-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-disclosure-group-state.js","names":[],"sources":["../../src/disclosure/create-disclosure-group-state.ts"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n/*\n * Derived from Adobe React Spectrum: packages/react-stately/src/disclosure/useDisclosureGroupState.ts.\n * Modified for Solid Aria: adapted reactive state, getters, imports, and APIs for Solid 2.\n * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.\n */\n\nimport type { Key } from \"@solid2-aria/types-shared\";\nimport { createMemo, createRenderEffect, untrack } from \"solid-js\";\n\nimport { createControlledSignal } from \"../utils/create-controlled-signal\";\n\nexport interface DisclosureGroupProps {\n /** Whether multiple items can be expanded at the same time. */\n allowsMultipleExpanded?: boolean;\n /** Whether all items are disabled. */\n isDisabled?: boolean;\n /** The currently expanded keys in the group (controlled). */\n expandedKeys?: Iterable<Key>;\n /** The initial expanded keys in the group (uncontrolled). */\n defaultExpandedKeys?: Iterable<Key>;\n /** Handler that is called when items are expanded or collapsed. */\n onExpandedChange?: (keys: Set<Key>) => void;\n}\n\nexport interface DisclosureGroupState {\n /** Whether multiple items can be expanded at the same time. */\n readonly allowsMultipleExpanded: boolean;\n /** Whether all items are disabled. */\n readonly isDisabled: boolean;\n /** A set of keys for items that are expanded. */\n readonly expandedKeys: Set<Key>;\n /** Toggles the expanded state for an item by its key. */\n toggleKey: (key: Key) => void;\n /** Replaces the set of expanded keys. */\n setExpandedKeys: (keys: Set<Key>) => void;\n}\n\n/**\n * Manages state for a group of disclosures, e.g. an accordion.\n * It supports both single and multiple expanded items.\n */\nexport function createDisclosureGroupState(\n props: DisclosureGroupProps\n): DisclosureGroupState {\n const allowsMultipleExpanded = createMemo(\n () => props.allowsMultipleExpanded ?? false\n );\n\n const isDisabled = createMemo(() => props.isDisabled ?? false);\n\n const controlledKeys = createMemo(() =>\n props.expandedKeys ? new Set(props.expandedKeys) : undefined\n );\n\n const [expandedKeys, setExpandedKeys] = createControlledSignal(\n controlledKeys,\n untrack(() => new Set<Key>(props.defaultExpandedKeys)),\n (keys) => props.onExpandedChange?.(keys)\n );\n\n createRenderEffect(\n () => ({\n allowsMultipleExpanded: allowsMultipleExpanded(),\n expandedKeys: expandedKeys(),\n }),\n (current) => {\n if (!current.allowsMultipleExpanded && current.expandedKeys.size > 1) {\n const firstKey = current.expandedKeys.values().next().value;\n\n if (firstKey !== undefined) {\n setExpandedKeys(new Set([firstKey]));\n }\n }\n }\n );\n\n return {\n get allowsMultipleExpanded() {\n return allowsMultipleExpanded();\n },\n get expandedKeys() {\n return expandedKeys();\n },\n get isDisabled() {\n return isDisabled();\n },\n setExpandedKeys,\n toggleKey(key) {\n setExpandedKeys((previous) => {\n if (!allowsMultipleExpanded()) {\n return new Set(previous.has(key) ? [] : [key]);\n }\n\n const keys = new Set(previous);\n\n if (keys.has(key)) {\n keys.delete(key);\n } else {\n keys.add(key);\n }\n\n return keys;\n });\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAoDA,SAAgB,2BACd,OACsB;CACtB,MAAM,yBAAyB,iBACvB,MAAM,0BAA0B,KACxC;CAEA,MAAM,aAAa,iBAAiB,MAAM,cAAc,KAAK;CAE7D,MAAM,iBAAiB,iBACrB,MAAM,eAAe,IAAI,IAAI,MAAM,YAAY,IAAI,KAAA,CACrD;CAEA,MAAM,CAAC,cAAc,mBAAmB,uBACtC,gBACA,cAAc,IAAI,IAAS,MAAM,mBAAmB,CAAC,IACpD,SAAS,MAAM,mBAAmB,IAAI,CACzC;CAEA,0BACS;EACL,wBAAwB,uBAAuB;EAC/C,cAAc,aAAa;CAC7B,KACC,YAAY;EACX,IAAI,CAAC,QAAQ,0BAA0B,QAAQ,aAAa,OAAO,GAAG;GACpE,MAAM,WAAW,QAAQ,aAAa,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC;GAEtD,IAAI,aAAa,KAAA,GACf,gCAAgB,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC;EAEvC;CACF,CACF;CAEA,OAAO;EACL,IAAI,yBAAyB;GAC3B,OAAO,uBAAuB;EAChC;EACA,IAAI,eAAe;GACjB,OAAO,aAAa;EACtB;EACA,IAAI,aAAa;GACf,OAAO,WAAW;EACpB;EACA;EACA,UAAU,KAAK;GACb,iBAAiB,aAAa;IAC5B,IAAI,CAAC,uBAAuB,GAC1B,OAAO,IAAI,IAAI,SAAS,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;IAG/C,MAAM,OAAO,IAAI,IAAI,QAAQ;IAE7B,IAAI,KAAK,IAAI,GAAG,GACd,KAAK,OAAO,GAAG;SAEf,KAAK,IAAI,GAAG;IAGd,OAAO;GACT,CAAC;EACH;CACF;AACF"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
/*
|
|
13
|
+
* Derived from Adobe React Spectrum: packages/react-stately/src/disclosure/useDisclosureState.ts.
|
|
14
|
+
* Modified for Solid Aria: adapted reactive state, getters, imports, and APIs for Solid 2.
|
|
15
|
+
* Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.
|
|
16
|
+
*/
|
|
17
|
+
export interface DisclosureProps {
|
|
18
|
+
/** Whether the disclosure is expanded (controlled). */
|
|
19
|
+
isExpanded?: boolean;
|
|
20
|
+
/** Whether the disclosure is expanded by default (uncontrolled). */
|
|
21
|
+
defaultExpanded?: boolean;
|
|
22
|
+
/** Handler that is called when the disclosure expanded state changes. */
|
|
23
|
+
onExpandedChange?: (isExpanded: boolean) => void;
|
|
24
|
+
}
|
|
25
|
+
export interface DisclosureState {
|
|
26
|
+
/** Whether the disclosure is currently expanded. */
|
|
27
|
+
readonly isExpanded: boolean;
|
|
28
|
+
/** Sets whether the disclosure is expanded. */
|
|
29
|
+
setExpanded: (isExpanded: boolean) => void;
|
|
30
|
+
/** Expand the disclosure. */
|
|
31
|
+
expand: () => void;
|
|
32
|
+
/** Collapse the disclosure. */
|
|
33
|
+
collapse: () => void;
|
|
34
|
+
/** Toggles the disclosure's visibility. */
|
|
35
|
+
toggle: () => void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Manages state for a disclosure widget. Tracks whether the disclosure is expanded, and provides
|
|
39
|
+
* methods to toggle this state.
|
|
40
|
+
*/
|
|
41
|
+
export declare function createDisclosureState(props: DisclosureProps): DisclosureState;
|
|
42
|
+
//# sourceMappingURL=create-disclosure-state.d.ts.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
/*
|
|
13
|
+
* Derived from Adobe React Spectrum: packages/react-stately/src/disclosure/useDisclosureState.ts.
|
|
14
|
+
* Modified for Solid Aria: adapted reactive state, getters, imports, and APIs for Solid 2.
|
|
15
|
+
* Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.
|
|
16
|
+
*/
|
|
17
|
+
import { createControlledSignal } from "../utils/create-controlled-signal.js";
|
|
18
|
+
import { untrack } from "solid-js";
|
|
19
|
+
// src/disclosure/create-disclosure-state.ts
|
|
20
|
+
/**
|
|
21
|
+
* Manages state for a disclosure widget. Tracks whether the disclosure is expanded, and provides
|
|
22
|
+
* methods to toggle this state.
|
|
23
|
+
*/
|
|
24
|
+
function createDisclosureState(props) {
|
|
25
|
+
const [isExpanded, setExpanded] = createControlledSignal(() => props.isExpanded, untrack(() => props.defaultExpanded ?? false), (value) => {
|
|
26
|
+
props.onExpandedChange?.(value);
|
|
27
|
+
});
|
|
28
|
+
const expand = () => {
|
|
29
|
+
setExpanded(true);
|
|
30
|
+
};
|
|
31
|
+
const collapse = () => {
|
|
32
|
+
setExpanded(false);
|
|
33
|
+
};
|
|
34
|
+
const toggle = () => {
|
|
35
|
+
setExpanded((previous) => !previous);
|
|
36
|
+
};
|
|
37
|
+
return {
|
|
38
|
+
collapse,
|
|
39
|
+
expand,
|
|
40
|
+
get isExpanded() {
|
|
41
|
+
return isExpanded();
|
|
42
|
+
},
|
|
43
|
+
setExpanded,
|
|
44
|
+
toggle
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export { createDisclosureState };
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=create-disclosure-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-disclosure-state.js","names":[],"sources":["../../src/disclosure/create-disclosure-state.ts"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n/*\n * Derived from Adobe React Spectrum: packages/react-stately/src/disclosure/useDisclosureState.ts.\n * Modified for Solid Aria: adapted reactive state, getters, imports, and APIs for Solid 2.\n * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.\n */\n\nimport { untrack } from \"solid-js\";\n\nimport { createControlledSignal } from \"../utils/create-controlled-signal\";\n\nexport interface DisclosureProps {\n /** Whether the disclosure is expanded (controlled). */\n isExpanded?: boolean;\n /** Whether the disclosure is expanded by default (uncontrolled). */\n defaultExpanded?: boolean;\n /** Handler that is called when the disclosure expanded state changes. */\n onExpandedChange?: (isExpanded: boolean) => void;\n}\n\nexport interface DisclosureState {\n /** Whether the disclosure is currently expanded. */\n readonly isExpanded: boolean;\n /** Sets whether the disclosure is expanded. */\n setExpanded: (isExpanded: boolean) => void;\n /** Expand the disclosure. */\n expand: () => void;\n /** Collapse the disclosure. */\n collapse: () => void;\n /** Toggles the disclosure's visibility. */\n toggle: () => void;\n}\n\n/**\n * Manages state for a disclosure widget. Tracks whether the disclosure is expanded, and provides\n * methods to toggle this state.\n */\nexport function createDisclosureState(props: DisclosureProps): DisclosureState {\n const [isExpanded, setExpanded] = createControlledSignal(\n () => props.isExpanded,\n untrack(() => props.defaultExpanded ?? false),\n (value) => {\n props.onExpandedChange?.(value);\n }\n );\n\n const expand = () => {\n setExpanded(true);\n };\n\n const collapse = () => {\n setExpanded(false);\n };\n\n const toggle = () => {\n setExpanded((previous) => !previous);\n };\n\n return {\n collapse,\n expand,\n get isExpanded() {\n return isExpanded();\n },\n setExpanded,\n toggle,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA+CA,SAAgB,sBAAsB,OAAyC;CAC7E,MAAM,CAAC,YAAY,eAAe,6BAC1B,MAAM,YACZ,cAAc,MAAM,mBAAmB,KAAK,IAC3C,UAAU;EACT,MAAM,mBAAmB,KAAK;CAChC,CACF;CAEA,MAAM,eAAe;EACnB,YAAY,IAAI;CAClB;CAEA,MAAM,iBAAiB;EACrB,YAAY,KAAK;CACnB;CAEA,MAAM,eAAe;EACnB,aAAa,aAAa,CAAC,QAAQ;CACrC;CAEA,OAAO;EACL;EACA;EACA,IAAI,aAAa;GACf,OAAO,WAAW;EACpB;EACA;EACA;CACF;AACF"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
/*
|
|
13
|
+
* Derived from Adobe React Spectrum: packages/react-stately/src/dnd/useDraggableCollectionState.ts.
|
|
14
|
+
* Modified for Solid Aria: adapted reactive state, getters, imports, and APIs for Solid 2.
|
|
15
|
+
* Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.
|
|
16
|
+
*/
|
|
17
|
+
import { MultipleSelectionManager } from "../selection/types.js";
|
|
18
|
+
import { Accessor } from "solid-js";
|
|
19
|
+
import { Collection, DragItem, DragMoveEvent, DragPreviewRenderer, DragStartEvent, DraggableCollectionEndEvent, DraggableCollectionProps, DropOperation, Key, Node } from "@solid2-aria/types-shared";
|
|
20
|
+
export interface DraggableCollectionStateOptions<T = object> extends DraggableCollectionProps<T> {
|
|
21
|
+
/** A collection of items. */
|
|
22
|
+
collection: Collection<Node<T>>;
|
|
23
|
+
/** An interface for reading and updating multiple selection state. */
|
|
24
|
+
selectionManager: MultipleSelectionManager;
|
|
25
|
+
/** Whether the drag events should be disabled. */
|
|
26
|
+
isDisabled?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface DraggableCollectionState {
|
|
29
|
+
/** A collection of items. */
|
|
30
|
+
collection: Collection<Node<unknown>>;
|
|
31
|
+
/** An interface for reading and updating multiple selection state. */
|
|
32
|
+
selectionManager: MultipleSelectionManager;
|
|
33
|
+
/** The key of the item that initiated a drag. */
|
|
34
|
+
draggedKey: Key | null;
|
|
35
|
+
/** The keys of the items that are currently being dragged. */
|
|
36
|
+
draggingKeys: Set<Key>;
|
|
37
|
+
/** Whether drag events are disabled. */
|
|
38
|
+
isDisabled?: boolean;
|
|
39
|
+
/** Returns whether the given key is currently being dragged. */
|
|
40
|
+
isDragging: (key: Key) => boolean;
|
|
41
|
+
/** Returns the keys of the items that will be dragged with the given key (e.g. selected items). */
|
|
42
|
+
getKeysForDrag: (key: Key) => Set<Key>;
|
|
43
|
+
/** Returns the items to drag for the given key. */
|
|
44
|
+
getItems: (key: Key) => DragItem[];
|
|
45
|
+
/** The ref of the element that will be rendered as the drag preview while dragging. */
|
|
46
|
+
preview?: Accessor<DragPreviewRenderer | null>;
|
|
47
|
+
/**
|
|
48
|
+
* Function that returns the drop operations that are allowed for the dragged items. If not
|
|
49
|
+
* provided, all drop operations are allowed.
|
|
50
|
+
*/
|
|
51
|
+
getAllowedDropOperations?: () => DropOperation[];
|
|
52
|
+
/** Begins a drag for the given key. This triggers the onDragStart event. */
|
|
53
|
+
startDrag: (key: Key, event: DragStartEvent) => void;
|
|
54
|
+
/** Triggers an onDragMove event. */
|
|
55
|
+
moveDrag: (event: DragMoveEvent) => void;
|
|
56
|
+
/** Ends the current drag, and emits an onDragEnd event. */
|
|
57
|
+
endDrag: (event: DraggableCollectionEndEvent) => void;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Manages state for a draggable collection.
|
|
61
|
+
*/
|
|
62
|
+
export declare function createDraggableCollectionState<T = object>(props: DraggableCollectionStateOptions<T>): DraggableCollectionState;
|
|
63
|
+
//# sourceMappingURL=create-draggable-collection-state.d.ts.map
|