@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 @@
|
|
|
1
|
+
{"version":3,"file":"create-number-field-state.js","names":[],"sources":["../../src/numberfield/create-number-field-state.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/numberfield/useNumberFieldState.ts.\n * Modified for Solid Aria: adapted state handling, APIs, or formatting 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 { NumberFormatter, NumberParser } from \"@internationalized/number\";\nimport type {\n FocusableProps,\n HelpTextProps,\n InputBase,\n LabelableProps,\n RangeInputBase,\n TextInputBase,\n Validation,\n ValueBase,\n} from \"@solid2-aria/types-shared\";\nimport {\n createMemo,\n createSignal,\n createRenderEffect,\n merge,\n untrack,\n} from \"solid-js\";\n\nimport { createFormValidationState } from \"../form/create-form-validation-state\";\nimport type { FormValidationState } from \"../form/create-form-validation-state\";\nimport { createControlledSignal } from \"../utils/create-controlled-signal\";\nimport { clamp, snapValueToStep } from \"../utils/number\";\n\nexport interface NumberFieldProps\n extends\n InputBase,\n Validation<number>,\n FocusableProps,\n TextInputBase,\n ValueBase<number>,\n RangeInputBase<number>,\n LabelableProps,\n HelpTextProps {\n /**\n * Formatting options for the value displayed in the number field.\n * This also affects what characters are allowed to be typed by the user.\n */\n formatOptions?: Intl.NumberFormatOptions;\n /**\n * Controls the behavior of the number field when the user blurs the field after editing. 'snap'\n * will clamp the value to the min/max values, and snap to the nearest step value. 'validate' will\n * not clamp the value, and will validate that the value is within the min/max range and on a\n * valid step.\n *\n * @default 'snap'\n */\n commitBehavior?: \"snap\" | \"validate\";\n}\n\nexport interface NumberFieldState extends FormValidationState {\n /**\n * The current text value of the input. Updated as the user types,\n * and formatted according to `formatOptions` on blur.\n */\n inputValue: string;\n /**\n * The currently parsed number value, or Number.NaN if a valid number could not be parsed.\n * Updated based on the `inputValue` as the user types.\n */\n numberValue: number;\n /** The default value of the input. */\n defaultNumberValue: number;\n /** The minimum value of the number field. */\n minValue?: number;\n /** The maximum value of the number field. */\n maxValue?: number;\n /** Whether the current value can be incremented according to the maximum value and step. */\n canIncrement: boolean;\n /** Whether the current value can be decremented according to the minimum value and step. */\n canDecrement: boolean;\n /**\n * Validates a user input string according to the current locale and format options. Values can be\n * partially entered, and may be valid even if they cannot currently be parsed to a number. Can be\n * used to implement validation as a user types.\n */\n validate: (value: string) => boolean;\n /** Sets the current text value of the input. */\n setInputValue: (val: string) => void;\n /** Sets the number value. */\n setNumberValue: (val: number) => void;\n /**\n * Commits the current input value. The value is parsed to a number, clamped according to the\n * minimum and maximum values of the field, and snapped to the nearest step value. This will fire\n * the `onChange` prop with the new value, and if uncontrolled, update the `numberValue`.\n * Typically this is called when the field is blurred.\n *\n * @param value - The value to commit. If not provided, the current input value is used.\n */\n commit: (value?: string) => void;\n /** Increments the current input value to the next step boundary, and fires `onChange`. */\n increment: () => void;\n /** Decrements the current input value to the next step boundary, and fires `onChange`. */\n decrement: () => void;\n /** Sets the current value to the `maxValue` if any, and fires `onChange`. */\n incrementToMax: () => void;\n /** Sets the current value to the `minValue` if any, and fires `onChange`. */\n decrementToMin: () => void;\n}\n\nexport interface NumberFieldStateOptions extends NumberFieldProps {\n /**\n * The locale that should be used for parsing.\n *\n * @default 'en-US'\n */\n locale: string;\n}\n\nexport function createNumberFieldState(\n props: NumberFieldStateOptions\n): NumberFieldState {\n const snap = (v: number) =>\n props.step === undefined || Number.isNaN(props.step)\n ? clamp(v, props.minValue, props.maxValue)\n : snapValueToStep(v, props.minValue, props.maxValue, props.step);\n\n const normalize = (v: number) =>\n props.commitBehavior === \"validate\" || Number.isNaN(v) ? v : snap(v);\n\n const defaults = () => normalize(props.defaultValue ?? Number.NaN);\n\n const [numberValue, setNumberValue] = createControlledSignal(\n () => (props.value === undefined ? undefined : normalize(props.value)),\n untrack(defaults),\n (v) => props.onChange?.(v)\n );\n\n const initial = untrack(numberValue);\n\n const parser = createMemo(\n () => new NumberParser(props.locale, props.formatOptions)\n );\n\n const [inputValue, setInputValue] = createSignal(\n untrack(() =>\n Number.isNaN(initial)\n ? \"\"\n : new NumberFormatter(props.locale, props.formatOptions).format(initial)\n ),\n { ownedWrite: true }\n );\n\n const formatter = createMemo(\n () =>\n new NumberFormatter(props.locale, {\n ...props.formatOptions,\n numberingSystem: parser().getNumberingSystem(inputValue()),\n })\n );\n\n const format = (v: number) => (Number.isNaN(v) ? \"\" : formatter().format(v));\n let previous = initial;\n let previousLocale = untrack(() => props.locale);\n let previousOptions = JSON.stringify(untrack(() => props.formatOptions));\n createRenderEffect(\n () => ({\n formatted: format(numberValue()),\n locale: props.locale,\n options: JSON.stringify(props.formatOptions),\n v: numberValue(),\n }),\n (current) => {\n if (\n !Object.is(previous, current.v) ||\n previousLocale !== current.locale ||\n previousOptions !== current.options\n ) {\n previous = current.v;\n previousLocale = current.locale;\n previousOptions = current.options;\n setInputValue(current.formatted);\n }\n }\n );\n\n const parsed = createMemo(() =>\n inputValue().length === 0 ? Number.NaN : parser().parse(inputValue())\n );\n\n const validation = createFormValidationState(\n merge(props, {\n get value() {\n return numberValue();\n },\n })\n );\n\n const step = () => {\n if (props.step !== undefined && !Number.isNaN(props.step)) {\n return props.step;\n }\n\n return formatter().resolvedOptions().style === \"percent\" ? 0.01 : 1;\n };\n\n const nextStep = (direction: 1 | -1) => {\n const v = parsed();\n\n if (Number.isNaN(v)) {\n return snapValueToStep(\n (direction === 1 ? props.minValue : props.maxValue) ?? 0,\n props.minValue,\n props.maxValue,\n step()\n );\n }\n\n const n = snapValueToStep(v, props.minValue, props.maxValue, step());\n\n return direction * (n - v) > 0\n ? n\n : snapValueToStep(\n Number((v + direction * step()).toPrecision(15)),\n props.minValue,\n props.maxValue,\n step()\n );\n };\n\n const move = (direction: 1 | -1) => {\n const v = nextStep(direction);\n\n if (v === numberValue()) {\n setInputValue(format(v));\n }\n\n setNumberValue(v);\n validation.commitValidation();\n };\n\n return merge(validation, {\n get canDecrement() {\n return (\n props.isDisabled !== true &&\n props.isReadOnly !== true &&\n (Number.isNaN(parsed()) ||\n props.minValue === undefined ||\n Number.isNaN(props.minValue) ||\n nextStep(-1) < parsed())\n );\n },\n get canIncrement() {\n return (\n props.isDisabled !== true &&\n props.isReadOnly !== true &&\n (Number.isNaN(parsed()) ||\n props.maxValue === undefined ||\n Number.isNaN(props.maxValue) ||\n nextStep(1) > parsed())\n );\n },\n commit(override?: string) {\n const text = override ?? inputValue();\n\n if (!text.length) {\n setNumberValue(Number.NaN);\n setInputValue(props.value === undefined ? \"\" : format(numberValue()));\n\n return;\n }\n\n const v = parser().parse(text);\n\n if (Number.isNaN(v)) {\n setInputValue(format(numberValue()));\n\n return;\n }\n\n const n = parser().parse(format(normalize(v)));\n const changed = n !== numberValue();\n setNumberValue(n);\n setInputValue(format(props.value === undefined ? n : numberValue()));\n\n if (changed) {\n validation.commitValidation();\n }\n },\n decrement() {\n move(-1);\n },\n decrementToMin() {\n if (props.minValue !== undefined) {\n setNumberValue(props.minValue);\n validation.commitValidation();\n }\n },\n get defaultNumberValue() {\n return Number.isNaN(defaults()) ? initial : defaults();\n },\n increment() {\n move(1);\n },\n incrementToMax() {\n if (props.maxValue !== undefined) {\n setNumberValue(\n snapValueToStep(\n props.maxValue,\n props.minValue,\n props.maxValue,\n step()\n )\n );\n validation.commitValidation();\n }\n },\n get inputValue() {\n return inputValue();\n },\n get maxValue() {\n return props.maxValue;\n },\n get minValue() {\n return props.minValue;\n },\n get numberValue() {\n return parsed();\n },\n setInputValue,\n setNumberValue,\n validate(v: string) {\n return parser().isValidPartialNumber(v, props.minValue, props.maxValue);\n },\n });\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,51 @@
|
|
|
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/overlays/useOverlayTriggerState.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 OverlayTriggerProps {
|
|
18
|
+
/** Whether the overlay is open by default (controlled). */
|
|
19
|
+
isOpen?: boolean;
|
|
20
|
+
/** Whether the overlay is open by default (uncontrolled). */
|
|
21
|
+
defaultOpen?: boolean;
|
|
22
|
+
/** Handler that is called when the overlay's open state changes. */
|
|
23
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
24
|
+
}
|
|
25
|
+
interface Point {
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
}
|
|
29
|
+
export interface OverlayTriggerState {
|
|
30
|
+
/** Whether the overlay is currently open. */
|
|
31
|
+
readonly isOpen: boolean;
|
|
32
|
+
/** Sets whether the overlay is open. */
|
|
33
|
+
setOpen: (isOpen: boolean) => void;
|
|
34
|
+
/** Opens the overlay. */
|
|
35
|
+
open: () => void;
|
|
36
|
+
/** Closes the overlay. */
|
|
37
|
+
close: () => void;
|
|
38
|
+
/** Toggles the overlay's visibility. */
|
|
39
|
+
toggle: () => void;
|
|
40
|
+
/** The cursor position when the overlay was triggered, relative to the window viewport. */
|
|
41
|
+
readonly point: Point | null;
|
|
42
|
+
/** Sets the cursor position relative to the window viewport. */
|
|
43
|
+
setPoint: (point: Point) => void;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Manages state for an overlay trigger. Tracks whether the overlay is open, and provides
|
|
47
|
+
* methods to toggle this state.
|
|
48
|
+
*/
|
|
49
|
+
export declare function createOverlayTriggerState(props: OverlayTriggerProps): OverlayTriggerState;
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=create-overlay-trigger-state.d.ts.map
|
|
@@ -0,0 +1,56 @@
|
|
|
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/overlays/useOverlayTriggerState.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 { createSignal, untrack } from "solid-js";
|
|
19
|
+
// src/overlays/create-overlay-trigger-state.ts
|
|
20
|
+
/**
|
|
21
|
+
* Manages state for an overlay trigger. Tracks whether the overlay is open, and provides
|
|
22
|
+
* methods to toggle this state.
|
|
23
|
+
*/
|
|
24
|
+
function createOverlayTriggerState(props) {
|
|
25
|
+
const [isOpen, setOpen] = createControlledSignal(() => props.isOpen, untrack(() => props.defaultOpen ?? false), (value) => {
|
|
26
|
+
props.onOpenChange?.(value);
|
|
27
|
+
});
|
|
28
|
+
const [point, setPoint] = createSignal(null, { ownedWrite: true });
|
|
29
|
+
const open = () => {
|
|
30
|
+
setOpen(true);
|
|
31
|
+
};
|
|
32
|
+
const close = () => {
|
|
33
|
+
setOpen(false);
|
|
34
|
+
};
|
|
35
|
+
const toggle = () => {
|
|
36
|
+
setOpen((previous) => !previous);
|
|
37
|
+
};
|
|
38
|
+
return {
|
|
39
|
+
close,
|
|
40
|
+
get isOpen() {
|
|
41
|
+
return isOpen();
|
|
42
|
+
},
|
|
43
|
+
open,
|
|
44
|
+
get point() {
|
|
45
|
+
return point();
|
|
46
|
+
},
|
|
47
|
+
setOpen,
|
|
48
|
+
setPoint: (value) => {
|
|
49
|
+
setPoint(value);
|
|
50
|
+
},
|
|
51
|
+
toggle
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export { createOverlayTriggerState };
|
|
55
|
+
|
|
56
|
+
//# sourceMappingURL=create-overlay-trigger-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-overlay-trigger-state.js","names":[],"sources":["../../src/overlays/create-overlay-trigger-state.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/overlays/useOverlayTriggerState.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 { createSignal, untrack } from \"solid-js\";\n\nimport { createControlledSignal } from \"../utils/create-controlled-signal\";\n\nexport interface OverlayTriggerProps {\n /** Whether the overlay is open by default (controlled). */\n isOpen?: boolean;\n /** Whether the overlay is open by default (uncontrolled). */\n defaultOpen?: boolean;\n /** Handler that is called when the overlay's open state changes. */\n onOpenChange?: (isOpen: boolean) => void;\n}\n\ninterface Point {\n x: number;\n y: number;\n}\n\nexport interface OverlayTriggerState {\n /** Whether the overlay is currently open. */\n readonly isOpen: boolean;\n /** Sets whether the overlay is open. */\n setOpen: (isOpen: boolean) => void;\n /** Opens the overlay. */\n open: () => void;\n /** Closes the overlay. */\n close: () => void;\n /** Toggles the overlay's visibility. */\n toggle: () => void;\n /** The cursor position when the overlay was triggered, relative to the window viewport. */\n readonly point: Point | null;\n /** Sets the cursor position relative to the window viewport. */\n setPoint: (point: Point) => void;\n}\n\n/**\n * Manages state for an overlay trigger. Tracks whether the overlay is open, and provides\n * methods to toggle this state.\n */\nexport function createOverlayTriggerState(\n props: OverlayTriggerProps\n): OverlayTriggerState {\n const [isOpen, setOpen] = createControlledSignal(\n () => props.isOpen,\n untrack(() => props.defaultOpen ?? false),\n (value) => {\n props.onOpenChange?.(value);\n }\n );\n\n const [point, setPoint] = createSignal<Point | null>(null, {\n ownedWrite: true,\n });\n\n const open = () => {\n setOpen(true);\n };\n\n const close = () => {\n setOpen(false);\n };\n\n const toggle = () => {\n setOpen((previous) => !previous);\n };\n\n return {\n close,\n get isOpen() {\n return isOpen();\n },\n open,\n get point() {\n return point();\n },\n setOpen,\n setPoint: (value) => {\n setPoint(value);\n },\n toggle,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAwDA,SAAgB,0BACd,OACqB;CACrB,MAAM,CAAC,QAAQ,WAAW,6BAClB,MAAM,QACZ,cAAc,MAAM,eAAe,KAAK,IACvC,UAAU;EACT,MAAM,eAAe,KAAK;CAC5B,CACF;CAEA,MAAM,CAAC,OAAO,YAAY,aAA2B,MAAM,EACzD,YAAY,KACd,CAAC;CAED,MAAM,aAAa;EACjB,QAAQ,IAAI;CACd;CAEA,MAAM,cAAc;EAClB,QAAQ,KAAK;CACf;CAEA,MAAM,eAAe;EACnB,SAAS,aAAa,CAAC,QAAQ;CACjC;CAEA,OAAO;EACL;EACA,IAAI,SAAS;GACX,OAAO,OAAO;EAChB;EACA;EACA,IAAI,QAAQ;GACV,OAAO,MAAM;EACf;EACA;EACA,WAAW,UAAU;GACnB,SAAS,KAAK;EAChB;EACA;CACF;AACF"}
|
|
@@ -0,0 +1,61 @@
|
|
|
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/radio/useRadioGroupState.ts.
|
|
14
|
+
* Modified for Solid Aria: adapted imports, collection descriptors, and reactive state 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 { FormValidationState } from "../form/create-form-validation-state.js";
|
|
18
|
+
import { FocusEvents, HelpTextProps, InputBase, InputDOMProps, LabelableProps, Orientation, Validation, ValidationState, ValueBase } from "@solid2-aria/types-shared";
|
|
19
|
+
export interface RadioGroupProps extends ValueBase<string | null, string>, InputBase, Pick<InputDOMProps, "name">, Validation<string>, LabelableProps, HelpTextProps, FocusEvents {
|
|
20
|
+
/**
|
|
21
|
+
* The axis the Radio Button(s) should align with.
|
|
22
|
+
*
|
|
23
|
+
* @default 'vertical'
|
|
24
|
+
*/
|
|
25
|
+
orientation?: Orientation;
|
|
26
|
+
}
|
|
27
|
+
export interface RadioGroupState extends FormValidationState {
|
|
28
|
+
/**
|
|
29
|
+
* The name for the group, used for native form submission.
|
|
30
|
+
*
|
|
31
|
+
* @private
|
|
32
|
+
* @deprecated
|
|
33
|
+
*/
|
|
34
|
+
readonly name: string;
|
|
35
|
+
/** Whether the radio group is disabled. */
|
|
36
|
+
readonly isDisabled: boolean;
|
|
37
|
+
/** Whether the radio group is read only. */
|
|
38
|
+
readonly isReadOnly: boolean;
|
|
39
|
+
/** Whether the radio group is required. */
|
|
40
|
+
readonly isRequired: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Whether the radio group is valid or invalid.
|
|
43
|
+
*
|
|
44
|
+
* @deprecated Use `isInvalid` instead.
|
|
45
|
+
*/
|
|
46
|
+
readonly validationState: ValidationState | null;
|
|
47
|
+
/** Whether the radio group is invalid. */
|
|
48
|
+
readonly isInvalid: boolean;
|
|
49
|
+
/** The currently selected value. */
|
|
50
|
+
readonly selectedValue: string | null;
|
|
51
|
+
/** The default selected value. */
|
|
52
|
+
readonly defaultSelectedValue: string | null;
|
|
53
|
+
/** Sets the selected value. */
|
|
54
|
+
setSelectedValue: (value: string | null) => void;
|
|
55
|
+
/** The value of the last focused radio. */
|
|
56
|
+
readonly lastFocusedValue: string | null;
|
|
57
|
+
/** Sets the last focused value. */
|
|
58
|
+
setLastFocusedValue: (value: string | null) => void;
|
|
59
|
+
}
|
|
60
|
+
export declare function createRadioGroupState(props: RadioGroupProps): RadioGroupState;
|
|
61
|
+
//# sourceMappingURL=create-radio-group-state.d.ts.map
|
|
@@ -0,0 +1,71 @@
|
|
|
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/radio/useRadioGroupState.ts.
|
|
14
|
+
* Modified for Solid Aria: adapted imports, collection descriptors, and reactive state 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 { getLegacyValidationState } from "../utils/legacy-props.js";
|
|
19
|
+
import { createFormValidationState } from "../form/create-form-validation-state.js";
|
|
20
|
+
import { createSignal, createUniqueId, merge, untrack } from "solid-js";
|
|
21
|
+
// src/radio/create-radio-group-state.ts
|
|
22
|
+
function createRadioGroupState(props) {
|
|
23
|
+
const id = createUniqueId();
|
|
24
|
+
const [selectedValue, setSelected] = createControlledSignal(() => props.value, untrack(() => props.defaultValue ?? null), (value) => {
|
|
25
|
+
if (value !== null) props.onChange?.(value);
|
|
26
|
+
});
|
|
27
|
+
const initialValue = untrack(selectedValue);
|
|
28
|
+
const [lastFocusedValue, setLastFocusedValue] = createSignal(null, { ownedWrite: true });
|
|
29
|
+
const validation = createFormValidationState(merge(props, { get value() {
|
|
30
|
+
return selectedValue();
|
|
31
|
+
} }));
|
|
32
|
+
return merge(validation, {
|
|
33
|
+
get defaultSelectedValue() {
|
|
34
|
+
return props.value === void 0 ? props.defaultValue ?? null : initialValue;
|
|
35
|
+
},
|
|
36
|
+
get isDisabled() {
|
|
37
|
+
return props.isDisabled ?? false;
|
|
38
|
+
},
|
|
39
|
+
get isInvalid() {
|
|
40
|
+
return validation.displayValidation.isInvalid;
|
|
41
|
+
},
|
|
42
|
+
get isReadOnly() {
|
|
43
|
+
return props.isReadOnly ?? false;
|
|
44
|
+
},
|
|
45
|
+
get isRequired() {
|
|
46
|
+
return props.isRequired ?? false;
|
|
47
|
+
},
|
|
48
|
+
get lastFocusedValue() {
|
|
49
|
+
return lastFocusedValue();
|
|
50
|
+
},
|
|
51
|
+
get name() {
|
|
52
|
+
return props.name !== void 0 && props.name !== "" ? props.name : `radio-group-${id}`;
|
|
53
|
+
},
|
|
54
|
+
get selectedValue() {
|
|
55
|
+
return selectedValue();
|
|
56
|
+
},
|
|
57
|
+
setLastFocusedValue,
|
|
58
|
+
setSelectedValue(value) {
|
|
59
|
+
if (!(props.isReadOnly === true) && !(props.isDisabled === true)) {
|
|
60
|
+
setSelected(value);
|
|
61
|
+
validation.commitValidation();
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
get validationState() {
|
|
65
|
+
return getLegacyValidationState(props) ?? (validation.displayValidation.isInvalid ? "invalid" : null);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
export { createRadioGroupState };
|
|
70
|
+
|
|
71
|
+
//# sourceMappingURL=create-radio-group-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-radio-group-state.js","names":[],"sources":["../../src/radio/create-radio-group-state.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/radio/useRadioGroupState.ts.\n * Modified for Solid Aria: adapted imports, collection descriptors, and reactive state 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 {\n FocusEvents,\n HelpTextProps,\n InputBase,\n InputDOMProps,\n LabelableProps,\n Orientation,\n Validation,\n ValidationState,\n ValueBase,\n} from \"@solid2-aria/types-shared\";\nimport { createSignal, createUniqueId, merge, untrack } from \"solid-js\";\n\nimport { createFormValidationState } from \"../form/create-form-validation-state\";\nimport type { FormValidationState } from \"../form/create-form-validation-state\";\nimport { createControlledSignal } from \"../utils/create-controlled-signal\";\nimport { getLegacyValidationState } from \"../utils/legacy-props\";\n\nexport interface RadioGroupProps\n extends\n ValueBase<string | null, string>,\n InputBase,\n Pick<InputDOMProps, \"name\">,\n Validation<string>,\n LabelableProps,\n HelpTextProps,\n FocusEvents {\n /**\n * The axis the Radio Button(s) should align with.\n *\n * @default 'vertical'\n */\n orientation?: Orientation;\n}\n\nexport interface RadioGroupState extends FormValidationState {\n /**\n * The name for the group, used for native form submission.\n *\n * @private\n * @deprecated\n */\n readonly name: string;\n /** Whether the radio group is disabled. */\n readonly isDisabled: boolean;\n /** Whether the radio group is read only. */\n readonly isReadOnly: boolean;\n /** Whether the radio group is required. */\n readonly isRequired: boolean;\n /**\n * Whether the radio group is valid or invalid.\n *\n * @deprecated Use `isInvalid` instead.\n */\n readonly validationState: ValidationState | null;\n /** Whether the radio group is invalid. */\n readonly isInvalid: boolean;\n /** The currently selected value. */\n readonly selectedValue: string | null;\n /** The default selected value. */\n readonly defaultSelectedValue: string | null;\n /** Sets the selected value. */\n setSelectedValue: (value: string | null) => void;\n /** The value of the last focused radio. */\n readonly lastFocusedValue: string | null;\n /** Sets the last focused value. */\n setLastFocusedValue: (value: string | null) => void;\n}\n\nexport function createRadioGroupState(props: RadioGroupProps): RadioGroupState {\n const id = createUniqueId();\n\n const [selectedValue, setSelected] = createControlledSignal(\n () => props.value,\n untrack(() => props.defaultValue ?? null),\n (value) => {\n if (value !== null) {\n props.onChange?.(value);\n }\n }\n );\n\n const initialValue = untrack(selectedValue);\n\n const [lastFocusedValue, setLastFocusedValue] = createSignal<string | null>(\n null,\n { ownedWrite: true }\n );\n\n const validation = createFormValidationState(\n merge(props, {\n get value() {\n return selectedValue();\n },\n })\n );\n\n return merge(validation, {\n get defaultSelectedValue() {\n return props.value === undefined\n ? (props.defaultValue ?? null)\n : initialValue;\n },\n get isDisabled() {\n return props.isDisabled ?? false;\n },\n get isInvalid() {\n return validation.displayValidation.isInvalid;\n },\n get isReadOnly() {\n return props.isReadOnly ?? false;\n },\n get isRequired() {\n return props.isRequired ?? false;\n },\n get lastFocusedValue() {\n return lastFocusedValue();\n },\n get name() {\n return props.name !== undefined && props.name !== \"\"\n ? props.name\n : `radio-group-${id}`;\n },\n get selectedValue() {\n return selectedValue();\n },\n setLastFocusedValue,\n setSelectedValue(value: string | null) {\n if (!(props.isReadOnly === true) && !(props.isDisabled === true)) {\n setSelected(value);\n validation.commitValidation();\n }\n },\n get validationState() {\n return (\n getLegacyValidationState(props) ??\n (validation.displayValidation.isInvalid ? (\"invalid\" as const) : null)\n );\n },\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsFA,SAAgB,sBAAsB,OAAyC;CAC7E,MAAM,KAAK,eAAe;CAE1B,MAAM,CAAC,eAAe,eAAe,6BAC7B,MAAM,OACZ,cAAc,MAAM,gBAAgB,IAAI,IACvC,UAAU;EACT,IAAI,UAAU,MACZ,MAAM,WAAW,KAAK;CAE1B,CACF;CAEA,MAAM,eAAe,QAAQ,aAAa;CAE1C,MAAM,CAAC,kBAAkB,uBAAuB,aAC9C,MACA,EAAE,YAAY,KAAK,CACrB;CAEA,MAAM,aAAa,0BACjB,MAAM,OAAO,EACX,IAAI,QAAQ;EACV,OAAO,cAAc;CACvB,EACF,CAAC,CACH;CAEA,OAAO,MAAM,YAAY;EACvB,IAAI,uBAAuB;GACzB,OAAO,MAAM,UAAU,KAAA,IAClB,MAAM,gBAAgB,OACvB;EACN;EACA,IAAI,aAAa;GACf,OAAO,MAAM,cAAc;EAC7B;EACA,IAAI,YAAY;GACd,OAAO,WAAW,kBAAkB;EACtC;EACA,IAAI,aAAa;GACf,OAAO,MAAM,cAAc;EAC7B;EACA,IAAI,aAAa;GACf,OAAO,MAAM,cAAc;EAC7B;EACA,IAAI,mBAAmB;GACrB,OAAO,iBAAiB;EAC1B;EACA,IAAI,OAAO;GACT,OAAO,MAAM,SAAS,KAAA,KAAa,MAAM,SAAS,KAC9C,MAAM,OACN,eAAe;EACrB;EACA,IAAI,gBAAgB;GAClB,OAAO,cAAc;EACvB;EACA;EACA,iBAAiB,OAAsB;GACrC,IAAI,EAAE,MAAM,eAAe,SAAS,EAAE,MAAM,eAAe,OAAO;IAChE,YAAY,KAAK;IACjB,WAAW,iBAAiB;GAC9B;EACF;EACA,IAAI,kBAAkB;GACpB,OACE,yBAAyB,KAAK,MAC7B,WAAW,kBAAkB,YAAa,YAAsB;EAErE;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,35 @@
|
|
|
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/searchfield/useSearchFieldState.ts.
|
|
14
|
+
* Modified for Solid Aria: adapted imports, collection descriptors, and reactive state 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 { FocusableProps, HelpTextProps, InputBase, LabelableProps, TextInputBase, Validation, ValueBase } from "@solid2-aria/types-shared";
|
|
18
|
+
export interface TextFieldProps<T = HTMLInputElement> extends InputBase, Validation<string>, HelpTextProps, FocusableProps<T>, TextInputBase, ValueBase<string>, LabelableProps {}
|
|
19
|
+
export interface SearchFieldProps extends TextFieldProps {
|
|
20
|
+
/** Handler that is called when the SearchField is submitted. */
|
|
21
|
+
onSubmit?: (value: string) => void;
|
|
22
|
+
/** Handler that is called when the clear button is pressed. */
|
|
23
|
+
onClear?: () => void;
|
|
24
|
+
}
|
|
25
|
+
export interface SearchFieldState {
|
|
26
|
+
/** The current value of the search field. */
|
|
27
|
+
readonly value: string;
|
|
28
|
+
/** Sets the value of the search field. */
|
|
29
|
+
setValue: (value: string) => void;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Provides state management for a search field.
|
|
33
|
+
*/
|
|
34
|
+
export declare function createSearchFieldState(props: SearchFieldProps): SearchFieldState;
|
|
35
|
+
//# sourceMappingURL=create-search-field-state.d.ts.map
|
|
@@ -0,0 +1,34 @@
|
|
|
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/searchfield/useSearchFieldState.ts.
|
|
14
|
+
* Modified for Solid Aria: adapted imports, collection descriptors, and reactive state 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/searchfield/create-search-field-state.ts
|
|
20
|
+
/**
|
|
21
|
+
* Provides state management for a search field.
|
|
22
|
+
*/
|
|
23
|
+
function createSearchFieldState(props) {
|
|
24
|
+
const [value, setValue] = createControlledSignal(() => props.value ?? void 0, untrack(() => props.defaultValue ?? ""), (localValue) => props.onChange?.(localValue));
|
|
25
|
+
return {
|
|
26
|
+
setValue,
|
|
27
|
+
get value() {
|
|
28
|
+
return value();
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export { createSearchFieldState };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=create-search-field-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-search-field-state.js","names":[],"sources":["../../src/searchfield/create-search-field-state.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/searchfield/useSearchFieldState.ts.\n * Modified for Solid Aria: adapted imports, collection descriptors, and reactive state 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 {\n FocusableProps,\n HelpTextProps,\n InputBase,\n LabelableProps,\n TextInputBase,\n Validation,\n ValueBase,\n} from \"@solid2-aria/types-shared\";\nimport { untrack } from \"solid-js\";\n\nimport { createControlledSignal } from \"../utils/create-controlled-signal\";\n\n// Copied here to avoid depending on @react-aria/textfield from stately.\nexport interface TextFieldProps<T = HTMLInputElement>\n extends\n InputBase,\n Validation<string>,\n HelpTextProps,\n FocusableProps<T>,\n TextInputBase,\n ValueBase<string>,\n LabelableProps {}\n\nexport interface SearchFieldProps extends TextFieldProps {\n /** Handler that is called when the SearchField is submitted. */\n onSubmit?: (value: string) => void;\n /** Handler that is called when the clear button is pressed. */\n onClear?: () => void;\n}\n\nexport interface SearchFieldState {\n /** The current value of the search field. */\n readonly value: string;\n /** Sets the value of the search field. */\n setValue: (value: string) => void;\n}\n\n/**\n * Provides state management for a search field.\n */\nexport function createSearchFieldState(\n props: SearchFieldProps\n): SearchFieldState {\n const [value, setValue] = createControlledSignal(\n () => props.value ?? undefined,\n untrack(() => props.defaultValue ?? \"\"),\n (localValue) => props.onChange?.(localValue)\n );\n\n return {\n setValue,\n get value() {\n return value();\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA0DA,SAAgB,uBACd,OACkB;CAClB,MAAM,CAAC,OAAO,YAAY,6BAClB,MAAM,SAAS,KAAA,GACrB,cAAc,MAAM,gBAAgB,EAAE,IACrC,eAAe,MAAM,WAAW,UAAU,CAC7C;CAEA,OAAO;EACL;EACA,IAAI,QAAQ;GACV,OAAO,MAAM;EACf;CACF;AACF"}
|
|
@@ -0,0 +1,116 @@
|
|
|
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/select/useSelectState.ts.
|
|
14
|
+
* Modified for Solid Aria: adapted imports, collection descriptors, and reactive state 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 { FormValidationState } from "../form/create-form-validation-state.js";
|
|
18
|
+
import { ListState } from "../list/create-list-state.js";
|
|
19
|
+
import { OverlayTriggerState } from "../overlays/create-overlay-trigger-state.js";
|
|
20
|
+
import { CollectionBase, CollectionStateBase, FocusStrategy, FocusableProps, HelpTextProps, InputBase, Key, LabelableProps, Node, TextInputBase, Validation, ValueBase } from "@solid2-aria/types-shared";
|
|
21
|
+
export type SelectionMode = "single" | "multiple";
|
|
22
|
+
export type ValueType<M extends SelectionMode> = M extends "single" ? Key | null : readonly Key[];
|
|
23
|
+
export type ChangeValueType<M extends SelectionMode> = M extends "single" ? Key | null : Key[];
|
|
24
|
+
type ValidationType<M extends SelectionMode> = M extends "single" ? Key : Key[];
|
|
25
|
+
export interface SelectProps<T, M extends SelectionMode = "single"> extends CollectionBase<T>, Omit<InputBase, "isReadOnly">, ValueBase<ValueType<M>, ChangeValueType<M>>, Validation<ValidationType<M>>, HelpTextProps, LabelableProps, TextInputBase, FocusableProps {
|
|
26
|
+
/**
|
|
27
|
+
* Whether single or multiple selection is enabled.
|
|
28
|
+
*
|
|
29
|
+
* @default 'single'
|
|
30
|
+
*/
|
|
31
|
+
selectionMode?: M;
|
|
32
|
+
/**
|
|
33
|
+
* The currently selected key in the collection (controlled).
|
|
34
|
+
*
|
|
35
|
+
* @deprecated
|
|
36
|
+
*/
|
|
37
|
+
selectedKey?: Key | null;
|
|
38
|
+
/**
|
|
39
|
+
* The initial selected key in the collection (uncontrolled).
|
|
40
|
+
*
|
|
41
|
+
* @deprecated
|
|
42
|
+
*/
|
|
43
|
+
defaultSelectedKey?: Key | null;
|
|
44
|
+
/**
|
|
45
|
+
* Handler that is called when the selection changes.
|
|
46
|
+
*
|
|
47
|
+
* @deprecated
|
|
48
|
+
*/
|
|
49
|
+
onSelectionChange?: (key: Key | null) => void;
|
|
50
|
+
/** Sets the open state of the menu. */
|
|
51
|
+
isOpen?: boolean;
|
|
52
|
+
/** Sets the default open state of the menu. */
|
|
53
|
+
defaultOpen?: boolean;
|
|
54
|
+
/** Method that is called when the open state of the menu changes. */
|
|
55
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
56
|
+
/**
|
|
57
|
+
* Whether the Select should close when an item is selected. Defaults to true if selectionMode is
|
|
58
|
+
* single, false otherwise.
|
|
59
|
+
*/
|
|
60
|
+
shouldCloseOnSelect?: boolean;
|
|
61
|
+
/** Whether the select should be allowed to be open when the collection is empty. */
|
|
62
|
+
allowsEmptyCollection?: boolean;
|
|
63
|
+
}
|
|
64
|
+
export interface SelectStateOptions<T, M extends SelectionMode = "single"> extends Omit<SelectProps<T, M>, "children">, CollectionStateBase<T> {}
|
|
65
|
+
export interface SelectState<T, M extends SelectionMode = "single"> extends ListState<T>, OverlayTriggerState, FormValidationState {
|
|
66
|
+
/**
|
|
67
|
+
* The key for the first selected item.
|
|
68
|
+
*
|
|
69
|
+
* @deprecated
|
|
70
|
+
*/
|
|
71
|
+
readonly selectedKey: Key | null;
|
|
72
|
+
/**
|
|
73
|
+
* The default selected key.
|
|
74
|
+
*
|
|
75
|
+
* @deprecated
|
|
76
|
+
*/
|
|
77
|
+
readonly defaultSelectedKey: Key | null;
|
|
78
|
+
/**
|
|
79
|
+
* Sets the selected key.
|
|
80
|
+
*
|
|
81
|
+
* @deprecated
|
|
82
|
+
*/
|
|
83
|
+
setSelectedKey: (key: Key | null) => void;
|
|
84
|
+
/** The current select value. */
|
|
85
|
+
readonly value: ValueType<M>;
|
|
86
|
+
/** The default select value. */
|
|
87
|
+
readonly defaultValue: ValueType<M>;
|
|
88
|
+
/** Sets the select value. */
|
|
89
|
+
setValue: (value: Key | readonly Key[] | null) => void;
|
|
90
|
+
/**
|
|
91
|
+
* The value of the first selected item.
|
|
92
|
+
*
|
|
93
|
+
* @deprecated
|
|
94
|
+
*/
|
|
95
|
+
readonly selectedItem: Node<T> | null;
|
|
96
|
+
/** The value of the selected items. */
|
|
97
|
+
readonly selectedItems: Node<T>[];
|
|
98
|
+
/** Whether the select is currently focused. */
|
|
99
|
+
readonly isFocused: boolean;
|
|
100
|
+
/** Sets whether the select is focused. */
|
|
101
|
+
setFocused: (isFocused: boolean) => void;
|
|
102
|
+
/** Controls which item will be auto focused when the menu opens. */
|
|
103
|
+
readonly focusStrategy: FocusStrategy | null;
|
|
104
|
+
/** Opens the menu. */
|
|
105
|
+
open: (focusStrategy?: FocusStrategy | null) => void;
|
|
106
|
+
/** Toggles the menu. */
|
|
107
|
+
toggle: (focusStrategy?: FocusStrategy | null) => void;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Provides state management for a select component. Handles building a collection
|
|
111
|
+
* of items from props, handles the open state for the popup menu, and manages
|
|
112
|
+
* multiple selection state.
|
|
113
|
+
*/
|
|
114
|
+
export declare function createSelectState<T extends object, M extends SelectionMode = "single">(props: SelectStateOptions<T, M>): SelectState<T, M>;
|
|
115
|
+
export {};
|
|
116
|
+
//# sourceMappingURL=create-select-state.d.ts.map
|
|
@@ -0,0 +1,151 @@
|
|
|
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/select/useSelectState.ts.
|
|
14
|
+
* Modified for Solid Aria: adapted imports, collection descriptors, and reactive state 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 { getLegacyDefaultSelectedKey, getLegacySelectedKey, notifyLegacySelectionChange } from "../utils/legacy-props.js";
|
|
19
|
+
import { createFormValidationState } from "../form/create-form-validation-state.js";
|
|
20
|
+
import { createListState } from "../list/create-list-state.js";
|
|
21
|
+
import { createOverlayTriggerState } from "../overlays/create-overlay-trigger-state.js";
|
|
22
|
+
import { createMemo, createSignal, merge, omit, untrack } from "solid-js";
|
|
23
|
+
// src/select/create-select-state.ts
|
|
24
|
+
/**
|
|
25
|
+
* Provides state management for a select component. Handles building a collection
|
|
26
|
+
* of items from props, handles the open state for the popup menu, and manages
|
|
27
|
+
* multiple selection state.
|
|
28
|
+
*/
|
|
29
|
+
function createSelectState(props) {
|
|
30
|
+
const triggerState = createOverlayTriggerState(props);
|
|
31
|
+
const [focusStrategy, setFocusStrategy] = createSignal(null, { ownedWrite: true });
|
|
32
|
+
const defaultValue = createMemo(() => props.defaultValue ?? ((props.selectionMode ?? "single") === "single" ? getLegacyDefaultSelectedKey(props) ?? null : []));
|
|
33
|
+
const value = createMemo(() => props.value ?? ((props.selectionMode ?? "single") === "single" ? getLegacySelectedKey(props) : void 0));
|
|
34
|
+
const [controlledValue, setControlledValue] = createControlledSignal(() => value(), untrack(() => defaultValue()), (nextValue) => {
|
|
35
|
+
const change = isKeyArray(nextValue) ? [...nextValue] : nextValue;
|
|
36
|
+
props.onChange?.(change);
|
|
37
|
+
});
|
|
38
|
+
const displayValue = createMemo(() => {
|
|
39
|
+
const current = controlledValue();
|
|
40
|
+
return (props.selectionMode ?? "single") === "single" && isKeyArray(current) ? current[0] ?? null : current;
|
|
41
|
+
});
|
|
42
|
+
const setValue = (localValue) => {
|
|
43
|
+
if ((props.selectionMode ?? "single") === "single") {
|
|
44
|
+
const key = isKeyArray(localValue) ? localValue[0] ?? null : localValue;
|
|
45
|
+
setControlledValue(key);
|
|
46
|
+
if (key !== displayValue()) notifyLegacySelectionChange(props, key);
|
|
47
|
+
} else {
|
|
48
|
+
let keys = [];
|
|
49
|
+
if (isKeyArray(localValue)) keys = [...localValue];
|
|
50
|
+
else if (localValue !== null && localValue !== void 0) keys = typeof localValue === "string" || typeof localValue === "number" ? [localValue] : [...localValue];
|
|
51
|
+
setControlledValue(keys);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
const validationState = createFormValidationState(merge(omit(props, "value"), { get value() {
|
|
55
|
+
const current = displayValue();
|
|
56
|
+
let validationValue = null;
|
|
57
|
+
if (isKeyArray(current)) validationValue = current.length === 0 ? null : [...current];
|
|
58
|
+
else validationValue = current;
|
|
59
|
+
return validationValue;
|
|
60
|
+
} }));
|
|
61
|
+
const listState = createListState(merge(props, {
|
|
62
|
+
get allowDuplicateSelectionEvents() {
|
|
63
|
+
return true;
|
|
64
|
+
},
|
|
65
|
+
get disallowEmptySelection() {
|
|
66
|
+
return (props.selectionMode ?? "single") === "single";
|
|
67
|
+
},
|
|
68
|
+
get onSelectionChange() {
|
|
69
|
+
return (keys) => {
|
|
70
|
+
if (keys === "all") return;
|
|
71
|
+
if ((props.selectionMode ?? "single") === "single") {
|
|
72
|
+
const key = keys.values().next().value ?? null;
|
|
73
|
+
setValue(key);
|
|
74
|
+
} else setValue([...keys]);
|
|
75
|
+
if (props.shouldCloseOnSelect ?? (props.selectionMode ?? "single") === "single") triggerState.close();
|
|
76
|
+
validationState.commitValidation();
|
|
77
|
+
};
|
|
78
|
+
},
|
|
79
|
+
get selectedKeys() {
|
|
80
|
+
return convertValue(displayValue());
|
|
81
|
+
},
|
|
82
|
+
get selectionMode() {
|
|
83
|
+
return props.selectionMode ?? "single";
|
|
84
|
+
}
|
|
85
|
+
}));
|
|
86
|
+
const selectedKey = createMemo(() => listState.selectionManager.firstSelectedKey);
|
|
87
|
+
const selectedItems = createMemo(() => [...listState.selectionManager.selectedKeys].flatMap((key) => {
|
|
88
|
+
const item = listState.collection.getItem(key);
|
|
89
|
+
return item === null || item === void 0 ? [] : [item];
|
|
90
|
+
}));
|
|
91
|
+
const [isFocused, setFocused] = createSignal(false, { ownedWrite: true });
|
|
92
|
+
const initialValue = untrack(() => displayValue());
|
|
93
|
+
return merge(validationState, listState, triggerState, {
|
|
94
|
+
get defaultSelectedKey() {
|
|
95
|
+
return getLegacyDefaultSelectedKey(props) ?? (props.selectionMode === "single" && (typeof initialValue === "string" || typeof initialValue === "number") ? initialValue : null);
|
|
96
|
+
},
|
|
97
|
+
get defaultValue() {
|
|
98
|
+
return defaultValue() ?? initialValue;
|
|
99
|
+
},
|
|
100
|
+
get focusStrategy() {
|
|
101
|
+
return focusStrategy();
|
|
102
|
+
},
|
|
103
|
+
get isFocused() {
|
|
104
|
+
return isFocused();
|
|
105
|
+
},
|
|
106
|
+
open(localFocusStrategy = null) {
|
|
107
|
+
if (listState.collection.size !== 0 || props.allowsEmptyCollection === true) {
|
|
108
|
+
setFocusStrategy(localFocusStrategy);
|
|
109
|
+
triggerState.open();
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
get selectedItem() {
|
|
113
|
+
return selectedItems()[0] ?? null;
|
|
114
|
+
},
|
|
115
|
+
get selectedItems() {
|
|
116
|
+
return selectedItems();
|
|
117
|
+
},
|
|
118
|
+
get selectedKey() {
|
|
119
|
+
return selectedKey();
|
|
120
|
+
},
|
|
121
|
+
get setFocused() {
|
|
122
|
+
return setFocused;
|
|
123
|
+
},
|
|
124
|
+
get setSelectedKey() {
|
|
125
|
+
return setValue;
|
|
126
|
+
},
|
|
127
|
+
get setValue() {
|
|
128
|
+
return setValue;
|
|
129
|
+
},
|
|
130
|
+
toggle(localFocusStrategy = null) {
|
|
131
|
+
if (listState.collection.size !== 0 || props.allowsEmptyCollection === true) {
|
|
132
|
+
setFocusStrategy(localFocusStrategy);
|
|
133
|
+
triggerState.toggle();
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
get value() {
|
|
137
|
+
return displayValue();
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
function convertValue(value) {
|
|
142
|
+
if (value === void 0) return value;
|
|
143
|
+
if (value === null) return [];
|
|
144
|
+
return isKeyArray(value) ? value : [value];
|
|
145
|
+
}
|
|
146
|
+
function isKeyArray(value) {
|
|
147
|
+
return Array.isArray(value);
|
|
148
|
+
}
|
|
149
|
+
export { createSelectState };
|
|
150
|
+
|
|
151
|
+
//# sourceMappingURL=create-select-state.js.map
|