@solid2-aria/components 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/dist/NOTICE.txt +33 -11
- package/dist/browser/collection-dnd.js +37 -40
- package/dist/browser/collection-dnd.js.map +1 -1
- package/dist/browser/color-field.js +12 -6
- package/dist/browser/color-field.js.map +1 -1
- package/dist/browser/drop-zone.js +6 -3
- package/dist/browser/drop-zone.js.map +1 -1
- package/dist/browser/grid-list.d.ts +2 -2
- package/dist/browser/grid-list.js +8 -7
- package/dist/browser/grid-list.js.map +1 -1
- package/dist/browser/list-box.js +31 -37
- package/dist/browser/list-box.js.map +1 -1
- package/dist/browser/menu.js +16 -19
- package/dist/browser/menu.js.map +1 -1
- package/dist/browser/modal.js +28 -31
- package/dist/browser/modal.js.map +1 -1
- package/dist/browser/number-field.js +5 -4
- package/dist/browser/number-field.js.map +1 -1
- package/dist/browser/popover.js +26 -29
- package/dist/browser/popover.js.map +1 -1
- package/dist/browser/shared-element-transition.js +19 -22
- package/dist/browser/shared-element-transition.js.map +1 -1
- package/dist/browser/sheet.d.ts +1 -1
- package/dist/browser/sheet.js +82 -7
- package/dist/browser/sheet.js.map +1 -1
- package/dist/browser/table.d.ts +2 -2
- package/dist/browser/table.js +5 -2
- package/dist/browser/table.js.map +1 -1
- package/dist/browser/tabs.d.ts +1 -1
- package/dist/browser/tabs.js +65 -26
- package/dist/browser/tabs.js.map +1 -1
- package/dist/browser/toast.js +43 -46
- package/dist/browser/toast.js.map +1 -1
- package/dist/browser/token-field.js +0 -1
- package/dist/browser/token-field.js.map +1 -1
- package/dist/browser/tooltip.js +22 -25
- package/dist/browser/tooltip.js.map +1 -1
- package/dist/browser/tree.js +21 -10
- package/dist/browser/tree.js.map +1 -1
- package/dist/server/calendar.js +3 -1
- package/dist/server/calendar.js.map +1 -1
- package/dist/server/checkbox.js +3 -1
- package/dist/server/checkbox.js.map +1 -1
- package/dist/server/collection-dnd.js +8 -36
- package/dist/server/collection-dnd.js.map +1 -1
- package/dist/server/color-field.js +7 -2
- package/dist/server/color-field.js.map +1 -1
- package/dist/server/color-thumb.js +6 -2
- package/dist/server/color-thumb.js.map +1 -1
- package/dist/server/drop-zone.js +12 -5
- package/dist/server/drop-zone.js.map +1 -1
- package/dist/server/grid-list.js +16 -32
- package/dist/server/grid-list.js.map +1 -1
- package/dist/server/hidden-date-input.js +3 -1
- package/dist/server/hidden-date-input.js.map +1 -1
- package/dist/server/list-box.js +25 -69
- package/dist/server/list-box.js.map +1 -1
- package/dist/server/menu.js +10 -31
- package/dist/server/menu.js.map +1 -1
- package/dist/server/modal.js +35 -67
- package/dist/server/modal.js.map +1 -1
- package/dist/server/popover.js +71 -98
- package/dist/server/popover.js.map +1 -1
- package/dist/server/radio-group.js +3 -1
- package/dist/server/radio-group.js.map +1 -1
- package/dist/server/shared-element-transition.js +13 -42
- package/dist/server/shared-element-transition.js.map +1 -1
- package/dist/server/sheet.js +135 -60
- package/dist/server/sheet.js.map +1 -1
- package/dist/server/slider.js +3 -1
- package/dist/server/slider.js.map +1 -1
- package/dist/server/switch.js +3 -1
- package/dist/server/switch.js.map +1 -1
- package/dist/server/table.js +8 -3
- package/dist/server/table.js.map +1 -1
- package/dist/server/tabs.js +180 -169
- package/dist/server/tabs.js.map +1 -1
- package/dist/server/toast.js +68 -101
- package/dist/server/toast.js.map +1 -1
- package/dist/server/token-field.js +2 -2
- package/dist/server/tooltip.js +34 -61
- package/dist/server/tooltip.js.map +1 -1
- package/dist/server/tree.js +156 -130
- package/dist/server/tree.js.map +1 -1
- package/dist/server/virtualizer.js +3 -1
- package/dist/server/virtualizer.js.map +1 -1
- package/package.json +12 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-field.js","names":["<HexColorField\n {...props}\n ref={(element: HTMLDivElement) => {\n setRef(element);\n }}\n />","ref={(element: HTMLDivElement) => {\n setRef(element);\n }}","typeof props.slot === \"string\" && props.slot.length > 0\n ? props.slot\n : undefined","dom.div","<dom.div\n {\n // oxlint-disable solid/reactivity -- Keep prop filtering in the renderer's lazy evaluation.\n ...omit(filterDOMProps(props, { global: true }), \"id\")\n // oxlint-enable solid/reactivity\n }\n {...render}\n ref={(el: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n el\n );\n }}\n slot={\n typeof props.slot === \"string\" && props.slot.length > 0\n ? props.slot\n : undefined\n }\n data-channel={props.channel ?? \"hex\"}\n data-disabled={props.isDisabled === true ? true : undefined}\n data-invalid={aria.isInvalid || undefined}\n data-readonly={props.isReadOnly === true ? true : undefined}\n data-required={props.isRequired === true ? true : undefined}\n >\n {render.children}\n </dom.div>","<ColorChannelField\n {...props}\n ref={(element: HTMLDivElement) => {\n setRef(element);\n }}\n channel={channel()}\n />","inputRef={(element: HTMLInputElement) => {\n setInputRef(element);\n }}","inputRef={(element: HTMLInputElement) => {\n setInputRef(element);\n }}","{(props.name?.length ?? 0) > 0 && (\n <input\n type=\"hidden\"\n name={props.name}\n form={props.form}\n value={Number.isNaN(state.numberValue) ? \"\" : state.numberValue}\n />\n )}","name={props.name}","props.name","form={props.form}","props.form","state.numberValue","<input\n type=\"hidden\"\n name={props.name}\n form={props.form}\n value={Number.isNaN(state.numberValue) ? \"\" : state.numberValue}\n />","value={Number.isNaN(state.numberValue) ? \"\" : state.numberValue}","_$mergeProps","_$memo","_$ssrHydrationKey","_$ssrGroup","_$ssrAttribute","_$escape","_$ssr"],"sources":["../../src/color-field.tsx"],"sourcesContent":["/*\n * Copyright 2022 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-aria-components/src/ColorField.tsx.\n * Modified for Solid Aria: composed Solid Aria and Stately primitives with Solid 2 contexts, reactive getters, and DOM refs; uses Solid class props.\n * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.\n */\n\nimport { createColorChannelField } from \"@solid2-aria/core/color/create-color-channel-field\";\nimport { createColorField } from \"@solid2-aria/core/color/create-color-field\";\nimport type {\n AriaColorFieldProps,\n ColorFieldAria,\n} from \"@solid2-aria/core/color/create-color-field\";\nimport { createLocale } from \"@solid2-aria/core/i18n/i18n-provider\";\nimport { filterDOMProps } from \"@solid2-aria/core/utils/filter-dom-props\";\nimport { mergeProps } from \"@solid2-aria/core/utils/merge-props\";\nimport { createColorChannelFieldState } from \"@solid2-aria/stately/color/create-color-channel-field-state\";\nimport { createColorFieldState } from \"@solid2-aria/stately/color/create-color-field-state\";\nimport type { ColorFieldState } from \"@solid2-aria/stately/color/create-color-field-state\";\nimport type {\n ColorChannel,\n ColorSpace,\n} from \"@solid2-aria/stately/color/types\";\nimport type { GlobalDOMAttributes } from \"@solid2-aria/types-shared-web\";\nimport type { JSX } from \"@solidjs/web\";\nimport {\n untrack,\n createSignal,\n merge,\n createContext,\n Show,\n omit,\n} from \"solid-js\";\n\nimport { FieldErrorContext } from \"./field-error\";\nimport { GroupContext } from \"./group\";\nimport { InputContext } from \"./input\";\nimport { LabelContext } from \"./label\";\nimport { TextContext } from \"./text\";\nimport {\n dom,\n assignRef,\n createContextProps,\n createRenderProps,\n createSlot,\n removeDataAttributes,\n} from \"./utils\";\nimport type {\n ContextValue,\n RenderProps,\n SlotProps,\n Ref,\n RACValidation,\n} from \"./utils\";\n\nexport interface ColorFieldRenderProps {\n isDisabled: boolean;\n isInvalid: boolean;\n isReadOnly: boolean;\n isRequired: boolean;\n channel: ColorChannel | \"hex\";\n state: ColorFieldState;\n}\n\nexport interface ColorFieldProps\n extends\n Omit<\n AriaColorFieldProps,\n | \"label\"\n | \"placeholder\"\n | \"description\"\n | \"errorMessage\"\n | \"validationState\"\n | \"validationBehavior\"\n >,\n RACValidation,\n RenderProps<ColorFieldRenderProps>,\n SlotProps,\n GlobalDOMAttributes<HTMLDivElement> {\n channel?: ColorChannel;\n colorSpace?: ColorSpace;\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const ColorFieldContext =\n createContext<ContextValue<ColorFieldProps, HTMLDivElement>>(null);\n\nexport const ColorFieldStateContext = createContext<ColorFieldState | null>(\n null\n);\n\nexport function ColorField(input: ColorFieldProps): JSX.Element {\n const [props, , setRef] = createContextProps(\n input,\n untrack(() => input.ref),\n ColorFieldContext\n );\n\n return (\n <Show\n when={props.channel}\n fallback={\n <HexColorField\n {...props}\n ref={(element: HTMLDivElement) => {\n setRef(element);\n }}\n />\n }\n >\n {(channel) => (\n <ColorChannelField\n {...props}\n ref={(element: HTMLDivElement) => {\n setRef(element);\n }}\n channel={channel()}\n />\n )}\n </Show>\n );\n}\n\nfunction HexColorField(props: ColorFieldProps): JSX.Element {\n const options = mergeProps(props, {\n get validationBehavior() {\n return props.validationBehavior ?? \"native\";\n },\n });\n\n const state = createColorFieldState(options);\n\n const [inputRef, setInputRef] = createSignal<HTMLInputElement | null>(null, {\n ownedWrite: true,\n });\n\n const [registerLabel, label] = createSlot(\n () =>\n (props[\"aria-label\"]?.length ?? 0) === 0 &&\n (props[\"aria-labelledby\"]?.length ?? 0) === 0\n );\n\n const aria = createColorField(\n mergeProps(removeDataAttributes(options), {\n get label() {\n return label();\n },\n }),\n state,\n inputRef\n );\n\n return (\n <ColorFieldChildren\n props={props}\n state={state}\n aria={aria}\n inputRef={(element: HTMLInputElement) => {\n setInputRef(element);\n }}\n registerLabel={registerLabel}\n />\n );\n}\n\nfunction ColorChannelField(\n props: ColorFieldProps & { channel: ColorChannel }\n): JSX.Element {\n const locale = createLocale();\n\n const options = mergeProps(props, {\n get locale() {\n return locale.locale;\n },\n get validationBehavior() {\n return props.validationBehavior ?? \"native\";\n },\n });\n\n const state = createColorChannelFieldState(options);\n\n const [inputRef, setInputRef] = createSignal<HTMLInputElement | null>(null, {\n ownedWrite: true,\n });\n\n const [registerLabel, label] = createSlot(\n () =>\n (props[\"aria-label\"]?.length ?? 0) === 0 &&\n (props[\"aria-labelledby\"]?.length ?? 0) === 0\n );\n\n const aria = createColorChannelField(\n mergeProps(removeDataAttributes(options), {\n get label() {\n return label();\n },\n }),\n state,\n inputRef\n );\n\n return (\n <>\n <ColorFieldChildren\n props={props}\n state={state}\n aria={aria}\n inputRef={(element: HTMLInputElement) => {\n setInputRef(element);\n }}\n registerLabel={registerLabel}\n />\n {(props.name?.length ?? 0) > 0 && (\n <input\n type=\"hidden\"\n name={props.name}\n form={props.form}\n value={Number.isNaN(state.numberValue) ? \"\" : state.numberValue}\n />\n )}\n </>\n );\n}\n\nfunction ColorFieldChildren(input: {\n props: ColorFieldProps;\n state: ColorFieldState;\n aria: ColorFieldAria | ReturnType<typeof createColorChannelField>;\n inputRef: (element: HTMLInputElement) => void;\n registerLabel: ReturnType<typeof createSlot>[0];\n}): JSX.Element {\n const { props } = untrack(() => input);\n const { state } = untrack(() => input);\n const { aria } = untrack(() => input);\n\n const values: ColorFieldRenderProps = {\n get channel() {\n return props.channel ?? \"hex\";\n },\n get isDisabled() {\n return props.isDisabled ?? false;\n },\n get isInvalid() {\n return aria.isInvalid;\n },\n get isReadOnly() {\n return props.isReadOnly ?? false;\n },\n get isRequired() {\n return props.isRequired ?? false;\n },\n state,\n };\n\n const render = createRenderProps(\n mergeProps(props, { defaultClass: \"solid2-aria-ColorField\", values })\n );\n\n return (\n <ColorFieldStateContext value={state}>\n <InputContext\n value={mergeProps(\n merge(() => aria.inputProps),\n {\n get ref() {\n return input.inputRef;\n },\n }\n )}\n >\n <LabelContext\n value={mergeProps(\n merge(() => aria.labelProps),\n {\n get registerSlot() {\n return input.registerLabel;\n },\n }\n )}\n >\n <GroupContext\n value={{\n get isDisabled() {\n return props.isDisabled ?? false;\n },\n get isInvalid() {\n return aria.isInvalid;\n },\n role: \"presentation\",\n }}\n >\n <TextContext\n value={{\n slots: {\n get description() {\n return aria.descriptionProps;\n },\n get errorMessage() {\n return aria.errorMessageProps;\n },\n },\n }}\n >\n <FieldErrorContext value={aria}>\n <dom.div\n {\n // oxlint-disable solid/reactivity -- Keep prop filtering in the renderer's lazy evaluation.\n ...omit(filterDOMProps(props, { global: true }), \"id\")\n // oxlint-enable solid/reactivity\n }\n {...render}\n ref={(el: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n el\n );\n }}\n slot={\n typeof props.slot === \"string\" && props.slot.length > 0\n ? props.slot\n : undefined\n }\n data-channel={props.channel ?? \"hex\"}\n data-disabled={props.isDisabled === true ? true : undefined}\n data-invalid={aria.isInvalid || undefined}\n data-readonly={props.isReadOnly === true ? true : undefined}\n data-required={props.isRequired === true ? true : undefined}\n >\n {render.children}\n </dom.div>\n </FieldErrorContext>\n </TextContext>\n </GroupContext>\n </LabelContext>\n </InputContext>\n </ColorFieldStateContext>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8HU,OAAS,QAAQ;;;;;;;;;;;;;EAhBrB,O,SAAM,CAAM;;;;;;;;;EACZ,OAAA,cACEA,aACM,OADN,EAEEC,MAAM,YAA4B;GAChC,OAAO,OAAO;EAChB,EACD,CAAA,CAAA;;;;;;;;;;;;;;;;EAkNS,OACEC,WAAAA;GAAO,OAAA,CAAA,EAAA,OAAA,MAAM,SAAS,YAAY,MAAM,KAAK,SAAS;EAE1C,CAAA,CAAC,CAAD,IADR,MAAM,OACN,KAAA;;;;;;;EAEN,O,SAAc,CAAM,WAAW;;;;;;;EAC/B,O,SAAe,CAAM,eAAe,OAAO,OAAO,KAAA;;;;;;;EAClD,O,UAAc,CAAK,aAAa,KAAA;;;;;;;EAChC,O,SAAe,CAAM,eAAe,OAAO,OAAO,KAAA;;;;;;;EAClD,O,SAAe,CAAM,eAAe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AqB,OAAO,GAAG,EACxC,IAAI,QAAQ;GACV,OAAO,MAAM;EACf,EACF,CAAC,GACD,OACA,QAQU;EACNC,WAAW,YAA8B;GACvC,YAAY,OAAO;EACrB;EACe;CAChB,CAAA,GACDC,WAAAA;;;GAAE,QAAA,MAAM,MAAM,UAAU,KAAK;EAO5B,CAAA,CAAC,CAAD,MANC,MAAAU,gBAKC,GALD,MAAAC,eAAA;GAEEV,OAAAA,CAAAA,aAAAA,QAAMC,OAAAA,MAAM,MAAN,IAAS,CAAC,GAChBC,aAAAA,QAAMC,OAAAA,MAAM,MAAN,IAAS,CAAC,CAAA;EAHlB,GAAA,CAAA,GAAA,aAIE;GAAO,OAAAQ,aAAA,SAAA,OAAO,MAAM,MAAM,WAAW,IAAI,KAAKP,OAAAA,MAAM,aAAN,IAAgB,CAAC;EAJjEC,GAAAA,IAAAA,QAAAA,KAAAA,KAAAA,KAIEC,IACD;CACF,CAAA,CACD;AAEN;AAEA,SAAS,mBAAmB,OAMZ;CACd,MAAM,EAAE,UAAU,cAAc,KAAK;CACrC,MAAM,EAAE,UAAU,cAAc,KAAK;CACrC,MAAM,EAAE,SAAS,cAAc,KAAK;CAqBpC,MAAM,SAAS,kBACb,WAAW,OAAO;EAAE,cAAc;EAA0B,QAAA;GAnB5D,IAAI,UAAU;IACZ,OAAO,MAAM,WAAW;GAC1B;GACA,IAAI,aAAa;IACf,OAAO,MAAM,cAAc;GAC7B;GACA,IAAI,YAAY;IACd,OAAO,KAAK;GACd;GACA,IAAI,aAAa;IACf,OAAO,MAAM,cAAc;GAC7B;GACA,IAAI,aAAa;IACf,OAAO,MAAM,cAAc;GAC7B;GACA;EAI4D;CAAO,CAAC,CACtE;CAEA,OAAA,uBACE,IAAA,KAGkB,MAGD,OA0CsB,OAGrB,QAnDa,KA4EP,CAAA;AAE5B"}
|
|
1
|
+
{"version":3,"file":"color-field.js","names":["<HexColorField\n {...props}\n ref={(element: HTMLDivElement) => {\n setRef(element);\n }}\n />","ref={(element: HTMLDivElement) => {\n setRef(element);\n }}","typeof props.slot === \"string\" && props.slot.length > 0\n ? props.slot\n : undefined","dom.div","<dom.div\n {\n // oxlint-disable solid/reactivity -- Keep prop filtering in the renderer's lazy evaluation.\n ...omit(filterDOMProps(props, { global: true }), \"id\")\n // oxlint-enable solid/reactivity\n }\n {...render}\n ref={(el: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n el\n );\n }}\n slot={\n typeof props.slot === \"string\" && props.slot.length > 0\n ? props.slot\n : undefined\n }\n data-channel={props.channel ?? \"hex\"}\n data-disabled={props.isDisabled === true ? true : undefined}\n data-invalid={aria.isInvalid || undefined}\n data-readonly={props.isReadOnly === true ? true : undefined}\n data-required={props.isRequired === true ? true : undefined}\n >\n {render.children}\n </dom.div>","<ColorChannelField\n {...props}\n ref={(element: HTMLDivElement) => {\n setRef(element);\n }}\n channel={channel()}\n />","inputRef={(element: HTMLInputElement) => {\n setInputRef(element);\n }}","inputRef={(element: HTMLInputElement) => {\n setInputRef(element);\n }}","{(props.name?.length ?? 0) > 0 && (\n <input\n type=\"hidden\"\n name={props.name}\n form={props.form}\n value={Number.isNaN(state.numberValue) ? \"\" : state.numberValue}\n />\n )}","name={props.name}","props.name","form={props.form}","props.form","state.numberValue","<input\n type=\"hidden\"\n name={props.name}\n form={props.form}\n value={Number.isNaN(state.numberValue) ? \"\" : state.numberValue}\n />","value={Number.isNaN(state.numberValue) ? \"\" : state.numberValue}","_$mergeProps","_$memo","_$ssrHydrationKey","_$ssrGroup","_$ssrAttribute","_$escape","_$ssr"],"sources":["../../src/color-field.tsx"],"sourcesContent":["/*\n * Copyright 2022 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-aria-components/src/ColorField.tsx.\n * Modified for Solid Aria: composed Solid Aria and Stately primitives with Solid 2 contexts, reactive getters, and DOM refs; uses Solid class props.\n * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.\n */\n\nimport { createColorChannelField } from \"@solid2-aria/core/color/create-color-channel-field\";\nimport { createColorField } from \"@solid2-aria/core/color/create-color-field\";\nimport type {\n AriaColorFieldProps,\n ColorFieldAria,\n} from \"@solid2-aria/core/color/create-color-field\";\nimport { createLocale } from \"@solid2-aria/core/i18n/i18n-provider\";\nimport { filterDOMProps } from \"@solid2-aria/core/utils/filter-dom-props\";\nimport { mergeProps } from \"@solid2-aria/core/utils/merge-props\";\nimport { createColorChannelFieldState } from \"@solid2-aria/stately/color/create-color-channel-field-state\";\nimport { createColorFieldState } from \"@solid2-aria/stately/color/create-color-field-state\";\nimport type { ColorFieldState } from \"@solid2-aria/stately/color/create-color-field-state\";\nimport type {\n ColorChannel,\n ColorSpace,\n} from \"@solid2-aria/stately/color/types\";\nimport type { GlobalDOMAttributes } from \"@solid2-aria/types-shared-web\";\nimport type { JSX } from \"@solidjs/web\";\nimport {\n untrack,\n createSignal,\n merge,\n createContext,\n Show,\n omit,\n} from \"solid-js\";\n\nimport { FieldErrorContext } from \"./field-error\";\nimport { FormContext } from \"./form\";\nimport { GroupContext } from \"./group\";\nimport { InputContext } from \"./input\";\nimport { LabelContext } from \"./label\";\nimport { TextContext } from \"./text\";\nimport {\n dom,\n assignRef,\n createContextProps,\n createRenderProps,\n createSlot,\n createSlottedContext,\n removeDataAttributes,\n} from \"./utils\";\nimport type {\n ContextValue,\n RenderProps,\n SlotProps,\n Ref,\n RACValidation,\n} from \"./utils\";\n\nexport interface ColorFieldRenderProps {\n isDisabled: boolean;\n isInvalid: boolean;\n isReadOnly: boolean;\n isRequired: boolean;\n channel: ColorChannel | \"hex\";\n state: ColorFieldState;\n}\n\nexport interface ColorFieldProps\n extends\n Omit<\n AriaColorFieldProps,\n | \"label\"\n | \"placeholder\"\n | \"description\"\n | \"errorMessage\"\n | \"validationState\"\n | \"validationBehavior\"\n >,\n RACValidation,\n RenderProps<ColorFieldRenderProps>,\n SlotProps,\n GlobalDOMAttributes<HTMLDivElement> {\n channel?: ColorChannel;\n colorSpace?: ColorSpace;\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const ColorFieldContext =\n createContext<ContextValue<ColorFieldProps, HTMLDivElement>>(null);\n\nexport const ColorFieldStateContext = createContext<ColorFieldState | null>(\n null\n);\n\nexport function ColorField(input: ColorFieldProps): JSX.Element {\n const [contextProps, , setRef] = createContextProps(\n input,\n untrack(() => input.ref),\n ColorFieldContext\n );\n\n const form = createSlottedContext(FormContext);\n\n const props = mergeProps(contextProps, {\n get validationBehavior() {\n return (\n contextProps.validationBehavior ?? form?.validationBehavior ?? \"native\"\n );\n },\n });\n\n return (\n <Show\n when={props.channel}\n fallback={\n <HexColorField\n {...props}\n ref={(element: HTMLDivElement) => {\n setRef(element);\n }}\n />\n }\n >\n {(channel) => (\n <ColorChannelField\n {...props}\n ref={(element: HTMLDivElement) => {\n setRef(element);\n }}\n channel={channel()}\n />\n )}\n </Show>\n );\n}\n\nfunction HexColorField(props: ColorFieldProps): JSX.Element {\n const options = mergeProps(props, {\n get validationBehavior() {\n return props.validationBehavior ?? \"native\";\n },\n });\n\n const state = createColorFieldState(options);\n\n const [inputRef, setInputRef] = createSignal<HTMLInputElement | null>(null, {\n ownedWrite: true,\n });\n\n const [registerLabel, label] = createSlot(\n () =>\n (props[\"aria-label\"]?.length ?? 0) === 0 &&\n (props[\"aria-labelledby\"]?.length ?? 0) === 0\n );\n\n const aria = createColorField(\n mergeProps(removeDataAttributes(options), {\n get label() {\n return label();\n },\n }),\n state,\n inputRef\n );\n\n return (\n <ColorFieldChildren\n props={props}\n state={state}\n aria={aria}\n inputRef={(element: HTMLInputElement) => {\n setInputRef(element);\n }}\n registerLabel={registerLabel}\n />\n );\n}\n\nfunction ColorChannelField(\n props: ColorFieldProps & { channel: ColorChannel }\n): JSX.Element {\n const locale = createLocale();\n\n const options = mergeProps(props, {\n get locale() {\n return locale.locale;\n },\n get validationBehavior() {\n return props.validationBehavior ?? \"native\";\n },\n });\n\n const state = createColorChannelFieldState(options);\n\n const [inputRef, setInputRef] = createSignal<HTMLInputElement | null>(null, {\n ownedWrite: true,\n });\n\n const [registerLabel, label] = createSlot(\n () =>\n (props[\"aria-label\"]?.length ?? 0) === 0 &&\n (props[\"aria-labelledby\"]?.length ?? 0) === 0\n );\n\n const aria = createColorChannelField(\n mergeProps(removeDataAttributes(options), {\n get label() {\n return label();\n },\n }),\n state,\n inputRef\n );\n\n return (\n <>\n <ColorFieldChildren\n props={props}\n state={state}\n aria={aria}\n inputRef={(element: HTMLInputElement) => {\n setInputRef(element);\n }}\n registerLabel={registerLabel}\n />\n {(props.name?.length ?? 0) > 0 && (\n <input\n type=\"hidden\"\n name={props.name}\n form={props.form}\n value={Number.isNaN(state.numberValue) ? \"\" : state.numberValue}\n />\n )}\n </>\n );\n}\n\nfunction ColorFieldChildren(input: {\n props: ColorFieldProps;\n state: ColorFieldState;\n aria: ColorFieldAria | ReturnType<typeof createColorChannelField>;\n inputRef: (element: HTMLInputElement) => void;\n registerLabel: ReturnType<typeof createSlot>[0];\n}): JSX.Element {\n const { props } = untrack(() => input);\n const { state } = untrack(() => input);\n const { aria } = untrack(() => input);\n\n const values: ColorFieldRenderProps = {\n get channel() {\n return props.channel ?? \"hex\";\n },\n get isDisabled() {\n return props.isDisabled ?? false;\n },\n get isInvalid() {\n return aria.isInvalid;\n },\n get isReadOnly() {\n return props.isReadOnly ?? false;\n },\n get isRequired() {\n return props.isRequired ?? false;\n },\n state,\n };\n\n const render = createRenderProps(\n mergeProps(props, { defaultClass: \"solid2-aria-ColorField\", values })\n );\n\n return (\n <ColorFieldStateContext value={state}>\n <InputContext\n value={mergeProps(\n merge(() => aria.inputProps),\n {\n get ref() {\n return input.inputRef;\n },\n }\n )}\n >\n <LabelContext\n value={mergeProps(\n merge(() => aria.labelProps),\n {\n get registerSlot() {\n return input.registerLabel;\n },\n }\n )}\n >\n <GroupContext\n value={{\n get isDisabled() {\n return props.isDisabled ?? false;\n },\n get isInvalid() {\n return aria.isInvalid;\n },\n role: \"presentation\",\n }}\n >\n <TextContext\n value={{\n slots: {\n get description() {\n return aria.descriptionProps;\n },\n get errorMessage() {\n return aria.errorMessageProps;\n },\n },\n }}\n >\n <FieldErrorContext value={aria}>\n <dom.div\n {\n // oxlint-disable solid/reactivity -- Keep prop filtering in the renderer's lazy evaluation.\n ...omit(filterDOMProps(props, { global: true }), \"id\")\n // oxlint-enable solid/reactivity\n }\n {...render}\n ref={(el: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n el\n );\n }}\n slot={\n typeof props.slot === \"string\" && props.slot.length > 0\n ? props.slot\n : undefined\n }\n data-channel={props.channel ?? \"hex\"}\n data-disabled={props.isDisabled === true ? true : undefined}\n data-invalid={aria.isInvalid || undefined}\n data-readonly={props.isReadOnly === true ? true : undefined}\n data-required={props.isRequired === true ? true : undefined}\n >\n {render.children}\n </dom.div>\n </FieldErrorContext>\n </TextContext>\n </GroupContext>\n </LabelContext>\n </InputContext>\n </ColorFieldStateContext>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0IU,OAAS,QAAQ;;;;;;;;;;;;;EAhBrB,O,SAAM,CAAM;;;;;;;;;EACZ,OAAA,cACEA,aACM,OADN,EAEEC,MAAM,YAA4B;GAChC,OAAO,OAAO;EAChB,EACD,CAAA,CAAA;;;;;;;;;;;;;;;;EAkNS,OACEC,WAAAA;GAAO,OAAA,CAAA,EAAA,OAAA,MAAM,SAAS,YAAY,MAAM,KAAK,SAAS;EAE1C,CAAA,CAAC,CAAD,IADR,MAAM,OACN,KAAA;;;;;;;EAEN,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A,IAAI,YAAY;IACd,OAAO,KAAK;GACd;GACA,IAAI,aAAa;IACf,OAAO,MAAM,cAAc;GAC7B;GACA,IAAI,aAAa;IACf,OAAO,MAAM,cAAc;GAC7B;GACA;EAI4D;CAAO,CAAC,CACtE;CAEA,OAAA,uBACE,IAAA,KAGkB,MAGD,OA0CsB,OAGrB,QAnDa,KA4EP,CAAA;AAE5B"}
|
|
@@ -57,11 +57,15 @@ var _d$6 = {
|
|
|
57
57
|
const focus = this[_m$3];
|
|
58
58
|
const render = this[_m$4];
|
|
59
59
|
return [
|
|
60
|
-
ssrElement("input",
|
|
60
|
+
ssrElement("input", () => {
|
|
61
|
+
return mergeProps(merge(() => ctx.xInputProps), merge(() => focus.focusProps ?? {}));
|
|
62
|
+
}, void 0, true),
|
|
61
63
|
memo(() => {
|
|
62
64
|
return memo(() => {
|
|
63
65
|
return !!ctx.yInputProps;
|
|
64
|
-
})() ? ssrElement("input",
|
|
66
|
+
})() ? ssrElement("input", () => {
|
|
67
|
+
return mergeProps(merge(() => ctx.yInputProps ?? {}), merge(() => focus.focusProps ?? {}));
|
|
68
|
+
}, void 0, true) : ctx.yInputProps;
|
|
65
69
|
}),
|
|
66
70
|
memo(() => {
|
|
67
71
|
return render.children;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-thumb.js","names":["<input\n {...mergeProps(\n merge(() => ctx.xInputProps),\n merge(() => focus.focusProps ?? {})\n )}\n ref={(element: HTMLInputElement) => {\n ctx.setInputXRef(element);\n }}\n />","{ctx.yInputProps && (\n <input\n {...mergeProps(\n merge(() => ctx.yInputProps ?? {}),\n merge(() => focus.focusProps ?? {})\n )}\n ref={(el: HTMLInputElement) => {\n if (ctx.setInputYRef) {\n ctx.setInputYRef(el);\n }\n }}\n />\n )}","<input\n {...mergeProps(\n merge(() => ctx.yInputProps ?? {}),\n merge(() => focus.focusProps ?? {})\n )}\n ref={(el: HTMLInputElement) => {\n if (ctx.setInputYRef) {\n ctx.setInputYRef(el);\n }\n }}\n />","{render.children}","dom.div","<dom.div\n {...mergeProps(\n merge(() => ctx.thumbProps),\n merge(() => hover.hoverProps ?? {}),\n omit(filterDOMProps(props, { global: true }), \"id\"),\n render\n )}\n ref={(element: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n }}\n data-hovered={hover.isHovered || undefined}\n data-dragging={ctx.state.isDragging || undefined}\n data-focused={focus.isFocused || undefined}\n data-focus-visible={focus.isFocusVisible || undefined}\n data-disabled={ctx.isDisabled === true ? true : undefined}\n >\n <input\n {...mergeProps(\n merge(() => ctx.xInputProps),\n merge(() => focus.focusProps ?? {})\n )}\n ref={(element: HTMLInputElement) => {\n ctx.setInputXRef(element);\n }}\n />\n {ctx.yInputProps && (\n <input\n {...mergeProps(\n merge(() => ctx.yInputProps ?? {}),\n merge(() => focus.focusProps ?? {})\n )}\n ref={(el: HTMLInputElement) => {\n if (ctx.setInputYRef) {\n ctx.setInputYRef(el);\n }\n }}\n />\n )}\n {render.children}\n </dom.div>","_$ssrElement","_$memo","_$mergeProps"],"sources":["../../src/color-thumb.tsx"],"sourcesContent":["/*\n * Derived from Adobe React Spectrum: packages/react-aria-components/src/ColorThumb.tsx.\n * Modified for Solid Aria: composed Solid Aria and Stately primitives with Solid 2 contexts, reactive getters, and DOM refs; uses Solid class props.\n * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.\n */\n\nimport { createFocusRing } from \"@solid2-aria/core/focus/create-focus-ring\";\nimport { createHover } from \"@solid2-aria/core/interactions/create-hover\";\nimport type { InputHTMLAttributes } from \"@solid2-aria/core/types\";\nimport { filterDOMProps } from \"@solid2-aria/core/utils/filter-dom-props\";\nimport { mergeProps } from \"@solid2-aria/core/utils/merge-props\";\nimport { requireValue } from \"@solid2-aria/core/utils/require-value\";\nimport type { Color } from \"@solid2-aria/stately/color/types\";\nimport type { HoverEvents } from \"@solid2-aria/types-shared\";\nimport type {\n GlobalDOMAttributes,\n DOMAttributes,\n} from \"@solid2-aria/types-shared-web\";\nimport type { JSX } from \"@solidjs/web\";\nimport { untrack, merge, createContext, omit, useContext } from \"solid-js\";\nimport type { Accessor } from \"solid-js\";\n\nimport { assignRef, dom, createRenderProps } from \"./utils\";\nimport type { RenderProps, Ref } from \"./utils\";\n\ninterface ColorState {\n getDisplayColor: () => Color;\n isDragging: boolean;\n}\n\ninterface InternalColorThumbContextValue {\n state: ColorState;\n thumbProps: DOMAttributes;\n inputXRef: Accessor<HTMLInputElement | null>;\n setInputXRef: (element: HTMLInputElement) => void;\n inputYRef?: Accessor<HTMLInputElement | null>;\n setInputYRef?: (element: HTMLInputElement) => void;\n xInputProps: InputHTMLAttributes;\n yInputProps?: InputHTMLAttributes;\n isDisabled?: boolean;\n}\n\nexport const InternalColorThumbContext =\n createContext<InternalColorThumbContextValue | null>(null);\n\nexport interface ColorThumbRenderProps {\n color: Color;\n isDragging: boolean;\n isHovered: boolean;\n isFocused: boolean;\n isFocusVisible: boolean;\n isDisabled: boolean;\n}\n\nexport interface ColorThumbProps\n extends\n HoverEvents,\n RenderProps<ColorThumbRenderProps>,\n GlobalDOMAttributes<HTMLDivElement> {\n ref?: Ref<HTMLDivElement>;\n}\n\nexport function ColorThumb(props: ColorThumbProps): JSX.Element {\n const ctx = requireValue(\n useContext(InternalColorThumbContext),\n \"Expected required component value\"\n );\n\n const focus = createFocusRing();\n const hover = createHover(props);\n\n const values: ColorThumbRenderProps = {\n get color() {\n return ctx.state.getDisplayColor();\n },\n get isDisabled() {\n return ctx.isDisabled ?? false;\n },\n get isDragging() {\n return ctx.state.isDragging;\n },\n get isFocusVisible() {\n return focus.isFocusVisible;\n },\n get isFocused() {\n return focus.isFocused;\n },\n get isHovered() {\n return hover.isHovered;\n },\n };\n\n const render = createRenderProps(\n mergeProps(props, {\n defaultClass: \"solid2-aria-ColorThumb\",\n get defaultStyle() {\n const { style } = ctx.thumbProps;\n\n const background = {\n \"background-color\": ctx.state.getDisplayColor().toString(),\n };\n\n return typeof style === \"object\"\n ? { ...style, ...background }\n : background;\n },\n values,\n })\n );\n\n return (\n <dom.div\n {...mergeProps(\n merge(() => ctx.thumbProps),\n merge(() => hover.hoverProps ?? {}),\n omit(filterDOMProps(props, { global: true }), \"id\"),\n render\n )}\n ref={(element: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n }}\n data-hovered={hover.isHovered || undefined}\n data-dragging={ctx.state.isDragging || undefined}\n data-focused={focus.isFocused || undefined}\n data-focus-visible={focus.isFocusVisible || undefined}\n data-disabled={ctx.isDisabled === true ? true : undefined}\n >\n <input\n {...mergeProps(\n merge(() => ctx.xInputProps),\n merge(() => focus.focusProps ?? {})\n )}\n ref={(element: HTMLInputElement) => {\n ctx.setInputXRef(element);\n }}\n />\n {ctx.yInputProps && (\n <input\n {...mergeProps(\n merge(() => ctx.yInputProps ?? {}),\n merge(() => focus.focusProps ?? {})\n )}\n ref={(el: HTMLInputElement) => {\n if (ctx.setInputYRef) {\n ctx.setInputYRef(el);\n }\n }}\n />\n )}\n {render.children}\n </dom.div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;EA4HM,O,SAAc,CAAM,aAAa,KAAA;;;;;;;EACjC,O,UAAe,CAAI,MAAM,cAAc,KAAA;;;;;;;EACvC,O,UAAc,CAAM,aAAa,KAAA;;;;;;;EACjC,O,UAAoB,CAAM,kBAAkB,KAAA;;;;;;;EAC5C,O,UAAe,CAAI,eAAe,OAAO,OAAO,KAAA;;;;;;;;;;EAjBlD,OAkBC;GACCA,WAAAA,
|
|
1
|
+
{"version":3,"file":"color-thumb.js","names":["<input\n {...mergeProps(\n merge(() => ctx.xInputProps),\n merge(() => focus.focusProps ?? {})\n )}\n ref={(element: HTMLInputElement) => {\n ctx.setInputXRef(element);\n }}\n />","{ctx.yInputProps && (\n <input\n {...mergeProps(\n merge(() => ctx.yInputProps ?? {}),\n merge(() => focus.focusProps ?? {})\n )}\n ref={(el: HTMLInputElement) => {\n if (ctx.setInputYRef) {\n ctx.setInputYRef(el);\n }\n }}\n />\n )}","<input\n {...mergeProps(\n merge(() => ctx.yInputProps ?? {}),\n merge(() => focus.focusProps ?? {})\n )}\n ref={(el: HTMLInputElement) => {\n if (ctx.setInputYRef) {\n ctx.setInputYRef(el);\n }\n }}\n />","{render.children}","dom.div","<dom.div\n {...mergeProps(\n merge(() => ctx.thumbProps),\n merge(() => hover.hoverProps ?? {}),\n omit(filterDOMProps(props, { global: true }), \"id\"),\n render\n )}\n ref={(element: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n }}\n data-hovered={hover.isHovered || undefined}\n data-dragging={ctx.state.isDragging || undefined}\n data-focused={focus.isFocused || undefined}\n data-focus-visible={focus.isFocusVisible || undefined}\n data-disabled={ctx.isDisabled === true ? true : undefined}\n >\n <input\n {...mergeProps(\n merge(() => ctx.xInputProps),\n merge(() => focus.focusProps ?? {})\n )}\n ref={(element: HTMLInputElement) => {\n ctx.setInputXRef(element);\n }}\n />\n {ctx.yInputProps && (\n <input\n {...mergeProps(\n merge(() => ctx.yInputProps ?? {}),\n merge(() => focus.focusProps ?? {})\n )}\n ref={(el: HTMLInputElement) => {\n if (ctx.setInputYRef) {\n ctx.setInputYRef(el);\n }\n }}\n />\n )}\n {render.children}\n </dom.div>","_$ssrElement","_$memo","_$mergeProps"],"sources":["../../src/color-thumb.tsx"],"sourcesContent":["/*\n * Derived from Adobe React Spectrum: packages/react-aria-components/src/ColorThumb.tsx.\n * Modified for Solid Aria: composed Solid Aria and Stately primitives with Solid 2 contexts, reactive getters, and DOM refs; uses Solid class props.\n * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.\n */\n\nimport { createFocusRing } from \"@solid2-aria/core/focus/create-focus-ring\";\nimport { createHover } from \"@solid2-aria/core/interactions/create-hover\";\nimport type { InputHTMLAttributes } from \"@solid2-aria/core/types\";\nimport { filterDOMProps } from \"@solid2-aria/core/utils/filter-dom-props\";\nimport { mergeProps } from \"@solid2-aria/core/utils/merge-props\";\nimport { requireValue } from \"@solid2-aria/core/utils/require-value\";\nimport type { Color } from \"@solid2-aria/stately/color/types\";\nimport type { HoverEvents } from \"@solid2-aria/types-shared\";\nimport type {\n GlobalDOMAttributes,\n DOMAttributes,\n} from \"@solid2-aria/types-shared-web\";\nimport type { JSX } from \"@solidjs/web\";\nimport { untrack, merge, createContext, omit, useContext } from \"solid-js\";\nimport type { Accessor } from \"solid-js\";\n\nimport { assignRef, dom, createRenderProps } from \"./utils\";\nimport type { RenderProps, Ref } from \"./utils\";\n\ninterface ColorState {\n getDisplayColor: () => Color;\n isDragging: boolean;\n}\n\ninterface InternalColorThumbContextValue {\n state: ColorState;\n thumbProps: DOMAttributes;\n inputXRef: Accessor<HTMLInputElement | null>;\n setInputXRef: (element: HTMLInputElement) => void;\n inputYRef?: Accessor<HTMLInputElement | null>;\n setInputYRef?: (element: HTMLInputElement) => void;\n xInputProps: InputHTMLAttributes;\n yInputProps?: InputHTMLAttributes;\n isDisabled?: boolean;\n}\n\nexport const InternalColorThumbContext =\n createContext<InternalColorThumbContextValue | null>(null);\n\nexport interface ColorThumbRenderProps {\n color: Color;\n isDragging: boolean;\n isHovered: boolean;\n isFocused: boolean;\n isFocusVisible: boolean;\n isDisabled: boolean;\n}\n\nexport interface ColorThumbProps\n extends\n HoverEvents,\n RenderProps<ColorThumbRenderProps>,\n GlobalDOMAttributes<HTMLDivElement> {\n ref?: Ref<HTMLDivElement>;\n}\n\nexport function ColorThumb(props: ColorThumbProps): JSX.Element {\n const ctx = requireValue(\n useContext(InternalColorThumbContext),\n \"Expected required component value\"\n );\n\n const focus = createFocusRing();\n const hover = createHover(props);\n\n const values: ColorThumbRenderProps = {\n get color() {\n return ctx.state.getDisplayColor();\n },\n get isDisabled() {\n return ctx.isDisabled ?? false;\n },\n get isDragging() {\n return ctx.state.isDragging;\n },\n get isFocusVisible() {\n return focus.isFocusVisible;\n },\n get isFocused() {\n return focus.isFocused;\n },\n get isHovered() {\n return hover.isHovered;\n },\n };\n\n const render = createRenderProps(\n mergeProps(props, {\n defaultClass: \"solid2-aria-ColorThumb\",\n get defaultStyle() {\n const { style } = ctx.thumbProps;\n\n const background = {\n \"background-color\": ctx.state.getDisplayColor().toString(),\n };\n\n return typeof style === \"object\"\n ? { ...style, ...background }\n : background;\n },\n values,\n })\n );\n\n return (\n <dom.div\n {...mergeProps(\n merge(() => ctx.thumbProps),\n merge(() => hover.hoverProps ?? {}),\n omit(filterDOMProps(props, { global: true }), \"id\"),\n render\n )}\n ref={(element: HTMLDivElement) => {\n assignRef(\n untrack(() => props.ref),\n element\n );\n }}\n data-hovered={hover.isHovered || undefined}\n data-dragging={ctx.state.isDragging || undefined}\n data-focused={focus.isFocused || undefined}\n data-focus-visible={focus.isFocusVisible || undefined}\n data-disabled={ctx.isDisabled === true ? true : undefined}\n >\n <input\n {...mergeProps(\n merge(() => ctx.xInputProps),\n merge(() => focus.focusProps ?? {})\n )}\n ref={(element: HTMLInputElement) => {\n ctx.setInputXRef(element);\n }}\n />\n {ctx.yInputProps && (\n <input\n {...mergeProps(\n merge(() => ctx.yInputProps ?? {}),\n merge(() => focus.focusProps ?? {})\n )}\n ref={(el: HTMLInputElement) => {\n if (ctx.setInputYRef) {\n ctx.setInputYRef(el);\n }\n }}\n />\n )}\n {render.children}\n </dom.div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;EA4HM,O,SAAc,CAAM,aAAa,KAAA;;;;;;;EACjC,O,UAAe,CAAI,MAAM,cAAc,KAAA;;;;;;;EACvC,O,UAAc,CAAM,aAAa,KAAA;;;;;;;EACjC,O,UAAoB,CAAM,kBAAkB,KAAA;;;;;;;EAC5C,O,UAAe,CAAI,eAAe,OAAO,OAAO,KAAA;;;;;;;;;;EAjBlD,OAkBC;GACCA,WAAAA,eACM;IACF,OAAA,WAAA,YAAY,IAAI,WAAW,GAC3B,YAAY,MAAM,cAAc,CAAC,CAAC,CACpC;GAJF,GAAA,KAAA,GAAA,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agB,OACC,KACD,OA0Bb,SAlCK,YAA4B;EAChC,UACE,cAAc,MAAM,GAAG,GACvB,OACF;CACF,CA8BO,CAAA,CAAA;AAEb"}
|
package/dist/server/drop-zone.js
CHANGED
|
@@ -26,12 +26,14 @@ import { createHover } from "@solid2-aria/core/interactions/create-hover";
|
|
|
26
26
|
import { createButton } from "@solid2-aria/core/button/create-button";
|
|
27
27
|
import { createVisuallyHidden } from "@solid2-aria/core/visually-hidden/visually-hidden";
|
|
28
28
|
import { createLocalizedStringFormatter } from "@solid2-aria/core/i18n/create-localized-string-formatter";
|
|
29
|
+
import { getEventTarget, getParentElement, nodeContains } from "@solid2-aria/core/utils/shadowdom/dom-functions";
|
|
29
30
|
import { createClipboard } from "@solid2-aria/core/dnd/create-clipboard";
|
|
30
31
|
import { createDrop } from "@solid2-aria/core/dnd/create-drop";
|
|
31
32
|
import { createSlotId } from "@solid2-aria/core/utils/create-id";
|
|
32
33
|
import { createLabels } from "@solid2-aria/core/utils/create-labels";
|
|
33
34
|
import { focusWithoutScrolling } from "@solid2-aria/core/utils/focus-without-scrolling";
|
|
34
35
|
import { isFocusable } from "@solid2-aria/core/utils/is-focusable";
|
|
36
|
+
import { isElement } from "@solid2-aria/core/utils/type-helpers";
|
|
35
37
|
// src/drop-zone.tsx
|
|
36
38
|
var _m$ = Symbol();
|
|
37
39
|
var _m$2 = Symbol();
|
|
@@ -95,8 +97,12 @@ var _d$7 = {
|
|
|
95
97
|
const clipboard = this[_m$7];
|
|
96
98
|
const labels = this[_m$8];
|
|
97
99
|
const render = this[_m$9];
|
|
98
|
-
return [ssrElement("div",
|
|
99
|
-
return
|
|
100
|
+
return [ssrElement("div", () => {
|
|
101
|
+
return hidden.visuallyHiddenProps;
|
|
102
|
+
}, () => {
|
|
103
|
+
return ssrElement("button", () => {
|
|
104
|
+
return mergeProps(merge(() => button.buttonProps ?? {}), merge(() => focus.focusProps ?? {}), merge(() => clipboard.clipboardProps ?? {}), labels);
|
|
105
|
+
}, void 0, false);
|
|
100
106
|
}, true), memo(() => {
|
|
101
107
|
return render.children;
|
|
102
108
|
})];
|
|
@@ -144,15 +150,16 @@ var _d$8 = {
|
|
|
144
150
|
}, new _P$(props, hover, focus, drop, hidden, button, clipboard, labels, render, (element) => {
|
|
145
151
|
setRef(element);
|
|
146
152
|
}, (event) => {
|
|
147
|
-
|
|
148
|
-
|
|
153
|
+
const eventTarget = getEventTarget(event);
|
|
154
|
+
let target = isElement(eventTarget) ? eventTarget : null;
|
|
155
|
+
while (target && nodeContains(ref(), target)) {
|
|
149
156
|
if (isFocusable(target)) break;
|
|
150
157
|
const focusTarget = buttonRef();
|
|
151
158
|
if (target === ref() && focusTarget) {
|
|
152
159
|
focusWithoutScrolling(focusTarget);
|
|
153
160
|
break;
|
|
154
161
|
}
|
|
155
|
-
target = target
|
|
162
|
+
target = getParentElement(target);
|
|
156
163
|
}
|
|
157
164
|
})));
|
|
158
165
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drop-zone.js","names":["<div {...hidden.visuallyHiddenProps}>\n <button\n {...mergeProps(\n merge(() => button.buttonProps ?? {}),\n merge(() => focus.focusProps ?? {}),\n merge(() => clipboard.clipboardProps ?? {}),\n labels\n )}\n\n ref={(element: HTMLButtonElement) => {\n setButtonRef(element);\n }}\n />\n </div>","<button\n {...mergeProps(\n merge(() => button.buttonProps ?? {}),\n merge(() => focus.focusProps ?? {}),\n merge(() => clipboard.clipboardProps ?? {}),\n labels\n )}\n\n ref={(element: HTMLButtonElement) => {\n setButtonRef(element);\n }}\n />","{render.children}","dom.div","<dom.div\n {...mergeProps(\n filterDOMProps(props, { global: true }),\n render,\n merge(() => drop.dropProps ?? {}),\n merge(() => hover.hoverProps ?? {})\n )}\n ref={(element: HTMLDivElement) => {\n setRef(element);\n }}\n slot={props.slot ?? undefined}\n data-hovered={hover.isHovered || undefined}\n data-focused={focus.isFocused || undefined}\n data-focus-visible={focus.isFocusVisible || undefined}\n data-drop-target={drop.isDropTarget || undefined}\n data-disabled={props.isDisabled ?? undefined}\n onClick={(event) => {\n let target =\n event.target instanceof HTMLElement ? event.target : null;\n\n while (target && ref()?.contains(target) === true) {\n if (isFocusable(target)) {\n break;\n }\n\n const focusTarget = buttonRef();\n\n if (target === ref() && focusTarget) {\n focusWithoutScrolling(focusTarget);\n break;\n }\n\n target = target.parentElement;\n }\n }}\n >\n <div {...hidden.visuallyHiddenProps}>\n <button\n {...mergeProps(\n merge(() => button.buttonProps ?? {}),\n merge(() => focus.focusProps ?? {}),\n merge(() => clipboard.clipboardProps ?? {}),\n labels\n )}\n\n ref={(element: HTMLButtonElement) => {\n setButtonRef(element);\n }}\n />\n </div>\n {render.children}\n </dom.div>","_$ssrElement","_$memo","_$mergeProps","intlMessages"],"sources":["../../src/drop-zone.tsx"],"sourcesContent":["/*\n * Copyright 2023 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-aria-components/src/DropZone.tsx.\n * Modified for Solid Aria: DOM refs, focus, drag, clipboard and render state use Solid factories; uses Solid class props.\n * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.\n */\n\nimport { createButton } from \"@solid2-aria/core/button/create-button\";\nimport { createClipboard } from \"@solid2-aria/core/dnd/create-clipboard\";\nimport { createDrop } from \"@solid2-aria/core/dnd/create-drop\";\nimport type { DropOptions } from \"@solid2-aria/core/dnd/create-drop\";\nimport { createFocusRing } from \"@solid2-aria/core/focus/create-focus-ring\";\nimport { createLocalizedStringFormatter } from \"@solid2-aria/core/i18n/create-localized-string-formatter\";\nimport { createHover } from \"@solid2-aria/core/interactions/create-hover\";\nimport { createSlotId } from \"@solid2-aria/core/utils/create-id\";\nimport { createLabels } from \"@solid2-aria/core/utils/create-labels\";\nimport { filterDOMProps } from \"@solid2-aria/core/utils/filter-dom-props\";\nimport { focusWithoutScrolling } from \"@solid2-aria/core/utils/focus-without-scrolling\";\nimport { isFocusable } from \"@solid2-aria/core/utils/is-focusable\";\nimport { mergeProps } from \"@solid2-aria/core/utils/merge-props\";\nimport { createVisuallyHidden } from \"@solid2-aria/core/visually-hidden/visually-hidden\";\nimport type { AriaLabelingProps, HoverEvents } from \"@solid2-aria/types-shared\";\nimport type { GlobalDOMAttributes } from \"@solid2-aria/types-shared-web\";\nimport { merge, untrack, createSignal, createContext } from \"solid-js\";\n\nimport intlMessages from \"../intl\";\nimport { TextContext } from \"./text\";\nimport { dom, createContextProps, createRenderProps } from \"./utils\";\nimport type { ContextValue, RenderProps, SlotProps, Ref } from \"./utils\";\n\nexport interface DropZoneRenderProps {\n isHovered: boolean;\n isFocused: boolean;\n isFocusVisible: boolean;\n isDropTarget: boolean;\n isDisabled: boolean;\n}\n\nexport interface DropZoneProps\n extends\n Omit<DropOptions, \"getDropOperationForPoint\" | \"ref\" | \"hasDropButton\">,\n HoverEvents,\n RenderProps<DropZoneRenderProps>,\n SlotProps,\n AriaLabelingProps,\n GlobalDOMAttributes<HTMLDivElement> {\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const DropZoneContext =\n createContext<ContextValue<DropZoneProps, HTMLDivElement>>(null);\n\nexport function DropZone(input: DropZoneProps) {\n const [props, ref, setRef] = createContextProps(\n input,\n untrack(() => input.ref),\n DropZoneContext\n );\n\n const [buttonRef, setButtonRef] = createSignal<HTMLButtonElement | null>(\n null,\n { ownedWrite: true }\n );\n\n const drop = createDrop(\n mergeProps(props, { hasDropButton: true, ref: buttonRef })\n );\n\n const button = createButton(\n mergeProps(\n {\n get children() {\n return props.children;\n },\n },\n drop.dropButtonProps ?? {}\n ),\n buttonRef\n );\n\n const hover = createHover(props);\n const focus = createFocusRing();\n const hidden = createVisuallyHidden();\n const textId = createSlotId();\n\n const formatter = createLocalizedStringFormatter(\n intlMessages,\n \"@solid2-aria/components\"\n );\n\n const labels = createLabels({\n get \"aria-label\"() {\n return props[\"aria-label\"] ?? formatter.format(\"dropzoneLabel\");\n },\n get \"aria-labelledby\"() {\n return (\n [textId(), props[\"aria-labelledby\"]].filter(Boolean).join(\" \") ||\n undefined\n );\n },\n });\n\n const clipboard = createClipboard({\n get isDisabled() {\n return props.isDisabled;\n },\n onPaste: (items) =>\n props.onDrop?.({\n dropOperation: \"copy\",\n items,\n type: \"drop\",\n x: 0,\n y: 0,\n }),\n });\n\n const values = {\n get isDisabled() {\n return props.isDisabled === true;\n },\n get isDropTarget() {\n return drop.isDropTarget;\n },\n get isFocusVisible() {\n return focus.isFocusVisible;\n },\n get isFocused() {\n return focus.isFocused;\n },\n get isHovered() {\n return hover.isHovered;\n },\n };\n\n const render = createRenderProps(\n mergeProps(props, { defaultClass: \"solid2-aria-DropZone\", values })\n );\n\n return (\n <TextContext\n value={{\n slots: {\n label: {\n get id() {\n return textId();\n },\n },\n },\n }}\n >\n <dom.div\n {...mergeProps(\n filterDOMProps(props, { global: true }),\n render,\n merge(() => drop.dropProps ?? {}),\n merge(() => hover.hoverProps ?? {})\n )}\n ref={(element: HTMLDivElement) => {\n setRef(element);\n }}\n slot={props.slot ?? undefined}\n data-hovered={hover.isHovered || undefined}\n data-focused={focus.isFocused || undefined}\n data-focus-visible={focus.isFocusVisible || undefined}\n data-drop-target={drop.isDropTarget || undefined}\n data-disabled={props.isDisabled ?? undefined}\n onClick={(event) => {\n let target =\n event.target instanceof HTMLElement ? event.target : null;\n\n while (target && ref()?.contains(target) === true) {\n if (isFocusable(target)) {\n break;\n }\n\n const focusTarget = buttonRef();\n\n if (target === ref() && focusTarget) {\n focusWithoutScrolling(focusTarget);\n break;\n }\n\n target = target.parentElement;\n }\n }}\n >\n <div {...hidden.visuallyHiddenProps}>\n <button\n {...mergeProps(\n merge(() => button.buttonProps ?? {}),\n merge(() => focus.focusProps ?? {}),\n merge(() => clipboard.clipboardProps ?? {}),\n labels\n )}\n\n ref={(element: HTMLButtonElement) => {\n setButtonRef(element);\n }}\n />\n </div>\n {render.children}\n </dom.div>\n </TextContext>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0KQ,O,SAAM,CAAM,QAAQ,KAAA;;;;;;;EACpB,O,UAAc,CAAM,aAAa,KAAA;;;;;;;EACjC,O,UAAc,CAAM,aAAa,KAAA;;;;;;;EACjC,O,UAAoB,CAAM,kBAAkB,KAAA;;;;;;;EAC5C,O,UAAkB,CAAK,gBAAgB,KAAA;;;;;;;EACvC,O,SAAe,CAAM,cAAc,KAAA;;;;;;;;;;;;;EAfrC,OAmCC,CACCA,WAAAA,OAAS,OAAO,2BAAhB;GACEC,OAAAA,WAAAA,UACM,WACF,YAAY,OAAO,eAAe,CAAC,CAAC,GACpC,YAAY,MAAM,cAAc,CAAC,CAAC,GAClC,YAAY,UAAU,kBAAkB,CAAC,CAAC,GAC1C,MACF,GAAA,KAAA,GANF,KAWC;EACE,GAbL,IAaK,GACLC,WAAAA;GAAC,OAAA,OAAO;EAAQ,CAAA,CAdjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EApCD,OAAA,IAACC,IAADC,mBACE;GAAI,OAAA,WACF,eAAe,OAAO,EAAE,QAAQ,KAAK,CAAC,GACtC,QACA,YAAY,KAAK,aAAa,CAAC,CAAC,GAChC,YAAY,MAAM,cAAc,CAAC,CAAC,CACpC;EAAC,GANH,IAAA,IAUQ,OACQ,OACA,OAEI,MAsBT,QAGS,QAEA,WACZ,QAQL,SA3CK,YAA4B;GAChC,OAAO,OAAO;EAChB,IAOU,UAAU;GAClB,IAAI,SACF,MAAM,kBAAkB,cAAc,MAAM,SAAS;GAEvD,OAAO,UAAU,IAAI,CAAC,EA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;GAlB1D,IAAI,aAAa;IACf,OAAO,MAAM,eAAe;GAC9B;GACA,IAAI,eAAe;IACjB,OAAO,KAAK;GACd;GACA,IAAI,iBAAiB;IACnB,OAAO,MAAM;GACf;GACA,IAAI,YAAY;IACd,OAAO,MAAM;GACf;GACA,IAAI,YAAY;IACd,OAAO,MAAM;GACf;EAI0D;CAAO,CAAC,CACpE;CAEA,OAAA,YACE,IAAA,KAaqB,OACf,QACY,MACA,OAOA,OAwBL,QAGS,QAEA,WACZ,QAlCJ,QAYiB,KAKK,WAnCnB,EACL,OAAO,EACL,OAAO,EACL,IAAI,KAAK;EACP,OAAO,OAAO;CAChB,EACF,EACF,EACF,CAsDW,CAAA;AAEjB"}
|
|
1
|
+
{"version":3,"file":"drop-zone.js","names":["<div {...hidden.visuallyHiddenProps}>\n <button\n {...mergeProps(\n merge(() => button.buttonProps ?? {}),\n merge(() => focus.focusProps ?? {}),\n merge(() => clipboard.clipboardProps ?? {}),\n labels\n )}\n\n ref={(element: HTMLButtonElement) => {\n setButtonRef(element);\n }}\n />\n </div>","<button\n {...mergeProps(\n merge(() => button.buttonProps ?? {}),\n merge(() => focus.focusProps ?? {}),\n merge(() => clipboard.clipboardProps ?? {}),\n labels\n )}\n\n ref={(element: HTMLButtonElement) => {\n setButtonRef(element);\n }}\n />","{render.children}","dom.div","<dom.div\n {...mergeProps(\n filterDOMProps(props, { global: true }),\n render,\n merge(() => drop.dropProps ?? {}),\n merge(() => hover.hoverProps ?? {})\n )}\n ref={(element: HTMLDivElement) => {\n setRef(element);\n }}\n slot={props.slot ?? undefined}\n data-hovered={hover.isHovered || undefined}\n data-focused={focus.isFocused || undefined}\n data-focus-visible={focus.isFocusVisible || undefined}\n data-drop-target={drop.isDropTarget || undefined}\n data-disabled={props.isDisabled ?? undefined}\n onClick={(event) => {\n const eventTarget = getEventTarget(event);\n\n let target: Element | null = isElement(eventTarget)\n ? eventTarget\n : null;\n\n while (target && nodeContains(ref(), target)) {\n if (isFocusable(target)) {\n break;\n }\n\n const focusTarget = buttonRef();\n\n if (target === ref() && focusTarget) {\n focusWithoutScrolling(focusTarget);\n break;\n }\n\n target = getParentElement(target);\n }\n }}\n >\n <div {...hidden.visuallyHiddenProps}>\n <button\n {...mergeProps(\n merge(() => button.buttonProps ?? {}),\n merge(() => focus.focusProps ?? {}),\n merge(() => clipboard.clipboardProps ?? {}),\n labels\n )}\n\n ref={(element: HTMLButtonElement) => {\n setButtonRef(element);\n }}\n />\n </div>\n {render.children}\n </dom.div>","_$ssrElement","_$memo","_$mergeProps","intlMessages"],"sources":["../../src/drop-zone.tsx"],"sourcesContent":["/*\n * Copyright 2023 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-aria-components/src/DropZone.tsx.\n * Modified for Solid Aria: DOM refs, focus, drag, clipboard and render state use Solid factories; uses Solid class props.\n * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.\n */\n\nimport { createButton } from \"@solid2-aria/core/button/create-button\";\nimport { createClipboard } from \"@solid2-aria/core/dnd/create-clipboard\";\nimport { createDrop } from \"@solid2-aria/core/dnd/create-drop\";\nimport type { DropOptions } from \"@solid2-aria/core/dnd/create-drop\";\nimport { createFocusRing } from \"@solid2-aria/core/focus/create-focus-ring\";\nimport { createLocalizedStringFormatter } from \"@solid2-aria/core/i18n/create-localized-string-formatter\";\nimport { createHover } from \"@solid2-aria/core/interactions/create-hover\";\nimport { createSlotId } from \"@solid2-aria/core/utils/create-id\";\nimport { createLabels } from \"@solid2-aria/core/utils/create-labels\";\nimport { filterDOMProps } from \"@solid2-aria/core/utils/filter-dom-props\";\nimport { focusWithoutScrolling } from \"@solid2-aria/core/utils/focus-without-scrolling\";\nimport { isFocusable } from \"@solid2-aria/core/utils/is-focusable\";\nimport { mergeProps } from \"@solid2-aria/core/utils/merge-props\";\nimport {\n getEventTarget,\n getParentElement,\n nodeContains,\n} from \"@solid2-aria/core/utils/shadowdom/dom-functions\";\nimport { isElement } from \"@solid2-aria/core/utils/type-helpers\";\nimport { createVisuallyHidden } from \"@solid2-aria/core/visually-hidden/visually-hidden\";\nimport type { AriaLabelingProps, HoverEvents } from \"@solid2-aria/types-shared\";\nimport type { GlobalDOMAttributes } from \"@solid2-aria/types-shared-web\";\nimport { merge, untrack, createSignal, createContext } from \"solid-js\";\n\nimport intlMessages from \"../intl\";\nimport { TextContext } from \"./text\";\nimport { dom, createContextProps, createRenderProps } from \"./utils\";\nimport type { ContextValue, RenderProps, SlotProps, Ref } from \"./utils\";\n\nexport interface DropZoneRenderProps {\n isHovered: boolean;\n isFocused: boolean;\n isFocusVisible: boolean;\n isDropTarget: boolean;\n isDisabled: boolean;\n}\n\nexport interface DropZoneProps\n extends\n Omit<DropOptions, \"getDropOperationForPoint\" | \"ref\" | \"hasDropButton\">,\n HoverEvents,\n RenderProps<DropZoneRenderProps>,\n SlotProps,\n AriaLabelingProps,\n GlobalDOMAttributes<HTMLDivElement> {\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const DropZoneContext =\n createContext<ContextValue<DropZoneProps, HTMLDivElement>>(null);\n\nexport function DropZone(input: DropZoneProps) {\n const [props, ref, setRef] = createContextProps(\n input,\n untrack(() => input.ref),\n DropZoneContext\n );\n\n const [buttonRef, setButtonRef] = createSignal<HTMLButtonElement | null>(\n null,\n { ownedWrite: true }\n );\n\n const drop = createDrop(\n mergeProps(props, { hasDropButton: true, ref: buttonRef })\n );\n\n const button = createButton(\n mergeProps(\n {\n get children() {\n return props.children;\n },\n },\n drop.dropButtonProps ?? {}\n ),\n buttonRef\n );\n\n const hover = createHover(props);\n const focus = createFocusRing();\n const hidden = createVisuallyHidden();\n const textId = createSlotId();\n\n const formatter = createLocalizedStringFormatter(\n intlMessages,\n \"@solid2-aria/components\"\n );\n\n const labels = createLabels({\n get \"aria-label\"() {\n return props[\"aria-label\"] ?? formatter.format(\"dropzoneLabel\");\n },\n get \"aria-labelledby\"() {\n return (\n [textId(), props[\"aria-labelledby\"]].filter(Boolean).join(\" \") ||\n undefined\n );\n },\n });\n\n const clipboard = createClipboard({\n get isDisabled() {\n return props.isDisabled;\n },\n onPaste: (items) =>\n props.onDrop?.({\n dropOperation: \"copy\",\n items,\n type: \"drop\",\n x: 0,\n y: 0,\n }),\n });\n\n const values = {\n get isDisabled() {\n return props.isDisabled === true;\n },\n get isDropTarget() {\n return drop.isDropTarget;\n },\n get isFocusVisible() {\n return focus.isFocusVisible;\n },\n get isFocused() {\n return focus.isFocused;\n },\n get isHovered() {\n return hover.isHovered;\n },\n };\n\n const render = createRenderProps(\n mergeProps(props, { defaultClass: \"solid2-aria-DropZone\", values })\n );\n\n return (\n <TextContext\n value={{\n slots: {\n label: {\n get id() {\n return textId();\n },\n },\n },\n }}\n >\n <dom.div\n {...mergeProps(\n filterDOMProps(props, { global: true }),\n render,\n merge(() => drop.dropProps ?? {}),\n merge(() => hover.hoverProps ?? {})\n )}\n ref={(element: HTMLDivElement) => {\n setRef(element);\n }}\n slot={props.slot ?? undefined}\n data-hovered={hover.isHovered || undefined}\n data-focused={focus.isFocused || undefined}\n data-focus-visible={focus.isFocusVisible || undefined}\n data-drop-target={drop.isDropTarget || undefined}\n data-disabled={props.isDisabled ?? undefined}\n onClick={(event) => {\n const eventTarget = getEventTarget(event);\n\n let target: Element | null = isElement(eventTarget)\n ? eventTarget\n : null;\n\n while (target && nodeContains(ref(), target)) {\n if (isFocusable(target)) {\n break;\n }\n\n const focusTarget = buttonRef();\n\n if (target === ref() && focusTarget) {\n focusWithoutScrolling(focusTarget);\n break;\n }\n\n target = getParentElement(target);\n }\n }}\n >\n <div {...hidden.visuallyHiddenProps}>\n <button\n {...mergeProps(\n merge(() => button.buttonProps ?? {}),\n merge(() => focus.focusProps ?? {}),\n merge(() => clipboard.clipboardProps ?? {}),\n labels\n )}\n\n ref={(element: HTMLButtonElement) => {\n setButtonRef(element);\n }}\n />\n </div>\n {render.children}\n </dom.div>\n </TextContext>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgLQ,O,SAAM,CAAM,QAAQ,KAAA;;;;;;;EACpB,O,UAAc,CAAM,aAAa,KAAA;;;;;;;EACjC,O,UAAc,CAAM,aAAa,KAAA;;;;;;;EACjC,O,UAAoB,CAAM,kBAAkB,KAAA;;;;;;;EAC5C,O,UAAkB,CAAK,gBAAgB,KAAA;;;;;;;EACvC,O,SAAe,CAAM,cAAc,KAAA;;;;;;;;;;;;;EAfrC,OAsCC,CACCA,WAAAA,aAAS;GAAO,OAAA,OAAA;EAAkB,SAAlC;GACEC,OAAAA,WAAAA,gBACM;IACF,OAAA,WAAA,YAAY,OAAO,eAAe,CAAC,CAAC,GACpC,YAAY,MAAM,cAAc,CAAC,CAAC,GAClC,YAAY,UAAU,kBAAkB,CAAC,CAAC,GAC1C,MACF;GANF,GAAA,KAAA,GAAA,KAWC;EACE,GAbL,IAaK,GACLC,WAAAA;GAAC,OAAA,OAAO;EAAQ,CAAA,CAdjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAvCD,OAAA,IAACC,IAADC,mBACE;GAAI,OAAA,WACF,eAAe,OAAO,EAAE,QAAQ,KAAK,CAAC,GACtC,QACA,YAAY,KAAK,aAAa,CAAC,CAAC,GAChC,YAAY,MAAM,cAAc,CAAC,CAAC,CACpC;EAAC,GANH,IAAA,IAUQ,OACQ,OACA,OAEI,MAyBT,QAGS,QAEA,WACZ,QAQL,SA9CK,YAA4B;GAChC,OAAO,OAAO;EAChB,IAOU,UAAU;GAClB,MAAM,cAAc,eAA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;EACL,CAAC;CACL,CAAC;CAoBD,MAAM,SAAS,kBACb,WAAW,OAAO;EAAE,cAAc;EAAwB,QAAA;GAlB1D,IAAI,aAAa;IACf,OAAO,MAAM,eAAe;GAC9B;GACA,IAAI,eAAe;IACjB,OAAO,KAAK;GACd;GACA,IAAI,iBAAiB;IACnB,OAAO,MAAM;GACf;GACA,IAAI,YAAY;IACd,OAAO,MAAM;GACf;GACA,IAAI,YAAY;IACd,OAAO,MAAM;GACf;EAI0D;CAAO,CAAC,CACpE;CAEA,OAAA,YACE,IAAA,KAaqB,OACf,QACY,MACA,OAOA,OA2BL,QAGS,QAEA,WACZ,QArCJ,QAe8B,KAKR,WAtCnB,EACL,OAAO,EACL,OAAO,EACL,IAAI,KAAK;EACP,OAAO,OAAO;CAChB,EACF,EACF,EACF,CAyDW,CAAA;AAEjB"}
|
package/dist/server/grid-list.js
CHANGED
|
@@ -24,7 +24,7 @@ import { DragAndDropContext, DropIndicatorContext, createDndPersistedKeys, creat
|
|
|
24
24
|
import { CollectionDropIndicator, createCollectionDragAndDrop, createCollectionItemDragAndDrop } from "./collection-dnd.js";
|
|
25
25
|
import { ListStateContext } from "./list-box.js";
|
|
26
26
|
import { mergeProps } from "@solid2-aria/core/utils/merge-props";
|
|
27
|
-
import {
|
|
27
|
+
import { createContext, createMemo, createSignal, merge, omit, untrack, useContext } from "solid-js";
|
|
28
28
|
import { applyRef, escape, memo, mergeProps as mergeProps$1, scope, ssr, ssrAttribute, ssrElement, ssrElementAttribute, ssrHydrationKey, ssrStyleProperties, ssrStyleProperty } from "@solidjs/web";
|
|
29
29
|
import { requireValue } from "@solid2-aria/core/utils/require-value";
|
|
30
30
|
import { BaseCollection, HeaderNode, ItemNode, LoaderNode, SectionNode } from "@solid2-aria/core/collections/base-collection";
|
|
@@ -36,6 +36,7 @@ import { createLocale } from "@solid2-aria/core/i18n/i18n-provider";
|
|
|
36
36
|
import { createVisuallyHidden } from "@solid2-aria/core/visually-hidden/visually-hidden";
|
|
37
37
|
import { ListKeyboardDelegate } from "@solid2-aria/core/selection/list-keyboard-delegate";
|
|
38
38
|
import { createCollator } from "@solid2-aria/core/i18n/create-collator";
|
|
39
|
+
import { createFocus } from "@solid2-aria/core/interactions/create-focus";
|
|
39
40
|
import { createLoadMoreSentinel } from "@solid2-aria/core/utils/create-load-more-sentinel";
|
|
40
41
|
import { createListState } from "@solid2-aria/stately/list/create-list-state";
|
|
41
42
|
import { createGridList } from "@solid2-aria/core/gridlist/create-grid-list";
|
|
@@ -709,35 +710,6 @@ function _P$19(_p82, _p83, _p84, _p85, _p86, _p87) {
|
|
|
709
710
|
Object.defineProperty(this, "children", _d$45);
|
|
710
711
|
}
|
|
711
712
|
_P$19.prototype = Object.prototype;
|
|
712
|
-
var _d$46 = {
|
|
713
|
-
get() {
|
|
714
|
-
return !this[_m$].isHidden;
|
|
715
|
-
},
|
|
716
|
-
enumerable: true,
|
|
717
|
-
configurable: true
|
|
718
|
-
};
|
|
719
|
-
var _d$47 = {
|
|
720
|
-
get() {
|
|
721
|
-
const props = this[_m$2];
|
|
722
|
-
const button = this[_m$3];
|
|
723
|
-
var _v$8, _v$9, _v$10, _v$11, _v$12;
|
|
724
|
-
return memo(() => {
|
|
725
|
-
return props.table === true;
|
|
726
|
-
})() ? (_v$8 = ssrHydrationKey(), _v$9 = () => {
|
|
727
|
-
return ssrAttribute("colspan", escape(props.columnCount, true));
|
|
728
|
-
}, _v$10 = escape(button), ssr(_tmpl$5, _v$8, ssrStyleProperty("position:", "absolute"), _v$9, _v$10)) : (_v$11 = ssrHydrationKey(), _v$12 = escape(button), ssr(_tmpl$2, _v$11, ssrStyleProperty("position:", "absolute"), _v$12));
|
|
729
|
-
},
|
|
730
|
-
enumerable: true,
|
|
731
|
-
configurable: true
|
|
732
|
-
};
|
|
733
|
-
function _P$20(_p88, _p89, _p90) {
|
|
734
|
-
this[_m$] = _p88;
|
|
735
|
-
this[_m$2] = _p89;
|
|
736
|
-
this[_m$3] = _p90;
|
|
737
|
-
Object.defineProperty(this, "when", _d$46);
|
|
738
|
-
Object.defineProperty(this, "children", _d$47);
|
|
739
|
-
}
|
|
740
|
-
_P$20.prototype = Object.prototype;
|
|
741
713
|
const GridListContext = createContext(null);
|
|
742
714
|
function GridList(input) {
|
|
743
715
|
const [props, ref, setRef] = createContextProps(input, untrack(() => input.ref), GridListContext);
|
|
@@ -880,6 +852,7 @@ const GridListItem = createLeafComponent(ItemNode, (props, forwardedRef, item) =
|
|
|
880
852
|
const hover = createHover(mergeProps(props, { get isDisabled() {
|
|
881
853
|
return !aria.allowsSelection && !aria.hasAction && !dnd.dragState;
|
|
882
854
|
} }));
|
|
855
|
+
const focusEvents = createFocus(props);
|
|
883
856
|
const focus = createFocusRing();
|
|
884
857
|
const within = createFocusRing({ within: true });
|
|
885
858
|
const checkbox = createGridListSelectionCheckbox({ key: item.key }, state);
|
|
@@ -942,7 +915,7 @@ const GridListItem = createLeafComponent(ItemNode, (props, forwardedRef, item) =
|
|
|
942
915
|
return mergeProps(merge(() => hidden.visuallyHiddenProps ?? {}), merge(() => drop.dropIndicatorProps ?? {}));
|
|
943
916
|
}, void 0, false, _sk$2, " role=\"button\""), ssr(_tmpl$2, _v$3, ssrStyleProperty("position:", "absolute"), _v$4)) : drop && !drop.isHidden;
|
|
944
917
|
}), dom.div(mergeProps$1(() => {
|
|
945
|
-
return mergeProps(omit(filterDOMProps(props, { global: true }), "id", "onClick"), render, merge(() => aria.rowProps ?? {}), merge(() => focus.focusProps ?? {}), merge(() => within.focusProps ?? {}), merge(() => hover.hoverProps ?? {}), merge(() => drag?.dragProps ?? {}));
|
|
918
|
+
return mergeProps(omit(filterDOMProps(props, { global: true }), "id", "onClick"), render, merge(() => aria.rowProps ?? {}), merge(() => focusEvents.focusProps ?? {}), merge(() => focus.focusProps ?? {}), merge(() => within.focusProps ?? {}), merge(() => hover.hoverProps ?? {}), merge(() => drag?.dragProps ?? {}));
|
|
946
919
|
}, new _P$14(aria, hover, focus, within, dnd, values, drop, state, drag, render, checkbox, (element) => {
|
|
947
920
|
setRef(element);
|
|
948
921
|
})))];
|
|
@@ -1008,7 +981,18 @@ function RootDropIndicator(props = {}) {
|
|
|
1008
981
|
const button = ssrElement("div", () => {
|
|
1009
982
|
return mergeProps(merge(() => hidden.visuallyHiddenProps ?? {}), merge(() => aria.dropIndicatorProps ?? {}));
|
|
1010
983
|
}, void 0, true, _sk$2, " role=\"button\"");
|
|
1011
|
-
return
|
|
984
|
+
return memo(() => {
|
|
985
|
+
return memo(() => {
|
|
986
|
+
return !aria.isHidden;
|
|
987
|
+
})() ? memo(() => {
|
|
988
|
+
var _v$8, _v$9, _v$10, _v$11, _v$12;
|
|
989
|
+
return memo(() => {
|
|
990
|
+
return props.table === true;
|
|
991
|
+
})() ? (_v$8 = ssrHydrationKey(), _v$9 = () => {
|
|
992
|
+
return ssrAttribute("colspan", escape(props.columnCount, true));
|
|
993
|
+
}, _v$10 = escape(button), ssr(_tmpl$5, _v$8, ssrStyleProperty("position:", "absolute"), _v$9, _v$10)) : (_v$11 = ssrHydrationKey(), _v$12 = escape(button), ssr(_tmpl$2, _v$11, ssrStyleProperty("position:", "absolute"), _v$12));
|
|
994
|
+
}) : void 0;
|
|
995
|
+
});
|
|
1012
996
|
}
|
|
1013
997
|
export { CollectionDropIndicator, GridList, GridListContext, GridListHeader, GridListHeaderContext, GridListHeaderInnerContext, GridListItem, GridListLoadMoreItem, GridListSection, RootDropIndicator, createCollectionDragAndDrop };
|
|
1014
998
|
|