@ariakit/solid-components 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.
Files changed (94) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/as/as.d.ts +30 -0
  3. package/dist/as/as.d.ts.map +1 -0
  4. package/dist/as/as.js +40 -0
  5. package/dist/as/as.js.map +1 -0
  6. package/dist/focus-trap/focus-trap-region.d.ts +42 -0
  7. package/dist/focus-trap/focus-trap-region.d.ts.map +1 -0
  8. package/dist/focus-trap/focus-trap-region.js +71 -0
  9. package/dist/focus-trap/focus-trap-region.js.map +1 -0
  10. package/dist/focus-trap/focus-trap.d.ts +31 -0
  11. package/dist/focus-trap/focus-trap.d.ts.map +1 -0
  12. package/dist/focus-trap/focus-trap.js +42 -0
  13. package/dist/focus-trap/focus-trap.js.map +1 -0
  14. package/dist/group/group-label-context.d.ts +7 -0
  15. package/dist/group/group-label-context.d.ts.map +1 -0
  16. package/dist/group/group-label-context.js +7 -0
  17. package/dist/group/group-label-context.js.map +1 -0
  18. package/dist/group/group-label.d.ts +37 -0
  19. package/dist/group/group-label.d.ts.map +1 -0
  20. package/dist/group/group-label.js +51 -0
  21. package/dist/group/group-label.js.map +1 -0
  22. package/dist/group/group.d.ts +32 -0
  23. package/dist/group/group.d.ts.map +1 -0
  24. package/dist/group/group.js +49 -0
  25. package/dist/group/group.js.map +1 -0
  26. package/dist/heading/heading-context.d.ts +8 -0
  27. package/dist/heading/heading-context.d.ts.map +1 -0
  28. package/dist/heading/heading-context.js +7 -0
  29. package/dist/heading/heading-context.js.map +1 -0
  30. package/dist/heading/heading-level.d.ts +32 -0
  31. package/dist/heading/heading-level.d.ts.map +1 -0
  32. package/dist/heading/heading-level.js +34 -0
  33. package/dist/heading/heading-level.js.map +1 -0
  34. package/dist/heading/heading.d.ts +42 -0
  35. package/dist/heading/heading.d.ts.map +1 -0
  36. package/dist/heading/heading.js +57 -0
  37. package/dist/heading/heading.js.map +1 -0
  38. package/dist/heading/utils.d.ts +5 -0
  39. package/dist/heading/utils.d.ts.map +1 -0
  40. package/dist/heading/utils.js +0 -0
  41. package/dist/role/role.d.ts +34 -0
  42. package/dist/role/role.d.ts.map +1 -0
  43. package/dist/role/role.js +67 -0
  44. package/dist/role/role.js.map +1 -0
  45. package/dist/separator/separator.d.ts +36 -0
  46. package/dist/separator/separator.d.ts.map +1 -0
  47. package/dist/separator/separator.js +36 -0
  48. package/dist/separator/separator.js.map +1 -0
  49. package/dist/visually-hidden/visually-hidden.d.ts +37 -0
  50. package/dist/visually-hidden/visually-hidden.d.ts.map +1 -0
  51. package/dist/visually-hidden/visually-hidden.js +48 -0
  52. package/dist/visually-hidden/visually-hidden.js.map +1 -0
  53. package/index.ts +1 -0
  54. package/license +21 -0
  55. package/package.json +113 -0
  56. package/readme.md +19 -0
  57. package/solid/as/as.jsx +38 -0
  58. package/solid/as/as.jsx.map +1 -0
  59. package/solid/focus-trap/focus-trap-region.jsx +65 -0
  60. package/solid/focus-trap/focus-trap-region.jsx.map +1 -0
  61. package/solid/focus-trap/focus-trap.jsx +42 -0
  62. package/solid/focus-trap/focus-trap.jsx.map +1 -0
  63. package/solid/group/group-label-context.jsx +7 -0
  64. package/solid/group/group-label-context.jsx.map +1 -0
  65. package/solid/group/group-label.jsx +51 -0
  66. package/solid/group/group-label.jsx.map +1 -0
  67. package/solid/group/group.jsx +43 -0
  68. package/solid/group/group.jsx.map +1 -0
  69. package/solid/heading/heading-context.jsx +7 -0
  70. package/solid/heading/heading-context.jsx.map +1 -0
  71. package/solid/heading/heading-level.jsx +30 -0
  72. package/solid/heading/heading-level.jsx.map +1 -0
  73. package/solid/heading/heading.jsx +57 -0
  74. package/solid/heading/heading.jsx.map +1 -0
  75. package/solid/heading/utils.jsx +0 -0
  76. package/solid/role/role.jsx +67 -0
  77. package/solid/role/role.jsx.map +1 -0
  78. package/solid/separator/separator.jsx +36 -0
  79. package/solid/separator/separator.jsx.map +1 -0
  80. package/solid/visually-hidden/visually-hidden.jsx +48 -0
  81. package/solid/visually-hidden/visually-hidden.jsx.map +1 -0
  82. package/src/as/as.tsx +62 -0
  83. package/src/focus-trap/focus-trap-region.tsx +108 -0
  84. package/src/focus-trap/focus-trap.tsx +61 -0
  85. package/src/group/group-label-context.tsx +4 -0
  86. package/src/group/group-label.tsx +76 -0
  87. package/src/group/group.tsx +68 -0
  88. package/src/heading/heading-context.tsx +5 -0
  89. package/src/heading/heading-level.tsx +43 -0
  90. package/src/heading/heading.tsx +87 -0
  91. package/src/heading/utils.ts +1 -0
  92. package/src/role/role.tsx +91 -0
  93. package/src/separator/separator.tsx +66 -0
  94. package/src/visually-hidden/visually-hidden.tsx +63 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,19 @@
1
+ # @ariakit/solid-components
2
+
3
+ ## 0.1.0
4
+
5
+ ### Added component packages
6
+
7
+ The internal component packages are now available under these names:
8
+
9
+ - `@ariakit/components`
10
+ - `@ariakit/react-components`
11
+ - `@ariakit/solid-components`
12
+
13
+ ### Other updates
14
+
15
+ - Updated dependencies: `@ariakit/utils@0.1.0`, `@ariakit/solid-utils@0.1.0`
16
+
17
+ ## 0.0.0
18
+
19
+ Initial release.
@@ -0,0 +1,30 @@
1
+ import { Component, ComponentProps, JSX, ValidComponent } from "solid-js";
2
+
3
+ //#region src/as/as.d.ts
4
+ type AsElements = { [K in keyof JSX.IntrinsicElements]: Component<ComponentProps<K>> };
5
+ type AsComponent = <T extends Component<any>, P = ComponentProps<T>>(props: AsProps<T, P>) => JSX.Element;
6
+ /**
7
+ * Allows a component to be rendered as a different HTML element or Solid
8
+ * component. Must be passed to the `render` prop of a component that
9
+ * supports it.
10
+ *
11
+ * To render as an HTML element, use `<As.element />` (e.g. `<As.button />`).
12
+ *
13
+ * To render as a component, use `<As component={Component} />` (e.g. `<As
14
+ * component={MyButton} />`).
15
+ *
16
+ * Check out the [Composition](https://solid.ariakit.com/guide/composition)
17
+ * guide for more details.
18
+ * @example
19
+ * ```jsx
20
+ * <Role render={<As component={MyButton} variant="primary" />} />
21
+ * <Role render={<As.button type="button" />} />
22
+ * ```
23
+ */
24
+ declare const As: AsComponent & AsElements;
25
+ type AsProps<T extends ValidComponent, P = ComponentProps<T>> = { [K in keyof P]: P[K] } & {
26
+ component: T;
27
+ };
28
+ //#endregion
29
+ export { As, AsProps };
30
+ //# sourceMappingURL=as.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"as.d.ts","names":["Component","ComponentProps","JSX","ValidComponent","AsElements","IntrinsicElements","K","AsComponent","T","P","AsProps","Element","props","As","component"],"sources":["../../src/as/as.d.ts"],"mappings":";;;KACKI,UAAAA,iBACWF,GAAAA,CAAIG,iBAAAA,GAAoBL,SAAAA,CAAUC,cAAAA,CAAeK,CAAAA;AAAAA,KAE5DC,WAAAA,cAAyBP,SAAAA,WAAoBC,cAAAA,CAAeO,CAAAA,GAAII,KAAAA,EAAOF,OAAAA,CAAQF,CAAAA,EAAGC,CAAAA,MAAOP,GAAAA,CAAIS,OAAAA;;;;;;;;;;;;;;;AAFhC;AAAA;;;cAqB7CE,EAAAA,EAAIN,WAAAA,GAAcH,UAAU;AAAA,KACrCM,OAAAA,WAAkBP,cAAAA,MAAoBF,cAAAA,CAAeO,CAAAA,mBACjDC,CAAAA,GAAIA,CAAAA,CAAEH,CAAAA;EAElBQ,SAAAA,EAAWN,CAAAA;AAAAA"}
package/dist/as/as.js ADDED
@@ -0,0 +1,40 @@
1
+ import { Dynamic, createComponent, mergeProps } from "solid-js/web";
2
+ import { mergeProps as mergeProps$1 } from "@ariakit/solid-utils";
3
+ //#region src/as/as.tsx
4
+ const cache = /* @__PURE__ */ new Map();
5
+ /**
6
+ * Allows a component to be rendered as a different HTML element or Solid
7
+ * component. Must be passed to the `render` prop of a component that
8
+ * supports it.
9
+ *
10
+ * To render as an HTML element, use `<As.element />` (e.g. `<As.button />`).
11
+ *
12
+ * To render as a component, use `<As component={Component} />` (e.g. `<As
13
+ * component={MyButton} />`).
14
+ *
15
+ * Check out the [Composition](https://solid.ariakit.com/guide/composition)
16
+ * guide for more details.
17
+ * @example
18
+ * ```jsx
19
+ * <Role render={<As component={MyButton} variant="primary" />} />
20
+ * <Role render={<As.button type="button" />} />
21
+ * ```
22
+ */
23
+ const As = new Proxy(function As(props) {
24
+ return ((parentProps) => createComponent(Dynamic, mergeProps(() => mergeProps$1(parentProps, props), { get component() {
25
+ return props.component;
26
+ } })));
27
+ }, { get: (_, key) => {
28
+ let component = cache.get(key);
29
+ if (!component) {
30
+ component = function AsElement(props) {
31
+ return ((parentProps) => createComponent(Dynamic, mergeProps(() => mergeProps$1(parentProps, props), { component: key })));
32
+ };
33
+ cache.set(key, component);
34
+ }
35
+ return component;
36
+ } });
37
+ //#endregion
38
+ export { As };
39
+
40
+ //# sourceMappingURL=as.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"as.js","names":["mergeProps","Component","ComponentProps","JSX","ValidComponent","Dynamic","AsElements","IntrinsicElements","K","AsComponent","T","props","AsProps","P","Element","cache","Map","As","Proxy","parentProps","_$createComponent","_$mergeProps","component","get","_","key","AsElement","set"],"sources":["../../src/as/as.tsx"],"sourcesContent":["import { mergeProps } from \"@ariakit/solid-utils\";\nimport type { Component, ComponentProps, JSX, ValidComponent } from \"solid-js\";\nimport { Dynamic } from \"solid-js/web\";\n\ntype AsElements = {\n [K in keyof JSX.IntrinsicElements]: Component<ComponentProps<K>>;\n};\n\ntype AsComponent = <T extends Component<any>, P = ComponentProps<T>>(\n props: AsProps<T, P>,\n) => JSX.Element;\n\nconst cache = new Map<string, Component<any>>();\n\n/**\n * Allows a component to be rendered as a different HTML element or Solid\n * component. Must be passed to the `render` prop of a component that\n * supports it.\n *\n * To render as an HTML element, use `<As.element />` (e.g. `<As.button />`).\n *\n * To render as a component, use `<As component={Component} />` (e.g. `<As\n * component={MyButton} />`).\n *\n * Check out the [Composition](https://solid.ariakit.com/guide/composition)\n * guide for more details.\n * @example\n * ```jsx\n * <Role render={<As component={MyButton} variant=\"primary\" />} />\n * <Role render={<As.button type=\"button\" />} />\n * ```\n */\nexport const As = new Proxy(\n function As(props: any) {\n return ((parentProps: unknown) => (\n // TODO: replace with LazyDynamic\n <Dynamic\n {...mergeProps(parentProps, props)}\n component={props.component}\n />\n )) as unknown as JSX.Element;\n } as AsComponent & AsElements,\n {\n get: (_, key: keyof JSX.IntrinsicElements) => {\n let component = cache.get(key);\n if (!component) {\n component = function AsElement(props: any): JSX.Element {\n return ((parentProps: unknown) => (\n // TODO: replace with LazyDynamic\n <Dynamic {...mergeProps(parentProps, props)} component={key} />\n )) as unknown as JSX.Element;\n };\n cache.set(key, component);\n }\n return component;\n },\n },\n);\n\nexport type AsProps<T extends ValidComponent, P = ComponentProps<T>> = {\n [K in keyof P]: P[K];\n} & { component: T };\n"],"mappings":";;;AAYA,MAAMe,wBAAQ,IAAIC,IAA4B;;;;;;;;;;;;;;;;;;;AAoB9C,MAAaC,KAAK,IAAIC,MACpB,SAASD,GAAGN,OAAY;CACtB,SAASQ,gBACPC,gBACCf,SAAOgB,iBACFrB,aAAWmB,aAAaR,KAAK,GAAC,EAAA,IAClCW,YAAS;EAAA,OAAEX,MAAMW;CAAS,EAAA,CAAA,CAAA;AAGhC,GACA,EACEC,MAAMC,GAAGC,QAAqC;CAC5C,IAAIH,YAAYP,MAAMQ,IAAIE,GAAG;CAC7B,IAAI,CAACH,WAAW;EACdA,YAAY,SAASI,UAAUf,OAAyB;GACtD,SAASQ,gBACPC,gBACCf,SAAOgB,iBAAKrB,aAAWmB,aAAaR,KAAK,GAAC,EAAEW,WAAWG,IAAG,CAAA,CAAA;EAE/D;EACAV,MAAMY,IAAIF,KAAKH,SAAS;CAC1B;CACA,OAAOA;AACT,EACF,CACF"}
@@ -0,0 +1,42 @@
1
+ import { ValidComponent } from "solid-js";
2
+ import { Options, Props } from "@ariakit/solid-utils";
3
+
4
+ //#region src/focus-trap/focus-trap-region.d.ts
5
+ declare const TagName = "div";
6
+ type TagName = typeof TagName;
7
+ /**
8
+ * Returns props to create a `FocusTrapRegion` component.
9
+ * @see https://solid.ariakit.com/components/focus-trap-region
10
+ * @example
11
+ * ```jsx
12
+ * const props = useFocusTrapRegion();
13
+ * <Role {...props} />
14
+ * ```
15
+ */
16
+ declare const useFocusTrapRegion: import("@ariakit/solid-utils").Hook<"div", FocusTrapRegionOptions<"div">>;
17
+ /**
18
+ * Renders a wrapper element that traps the focus inside it when the
19
+ * [`enabled`](https://solid.ariakit.com/reference/focus-trap-region#enabled)
20
+ * prop is `true`.
21
+ * @see https://solid.ariakit.com/components/focus-trap
22
+ * @example
23
+ * ```jsx
24
+ * <FocusTrapRegion>
25
+ * <Button>click me</Button>
26
+ * <Button>trap focus</Button>
27
+ * <Button disabled>disabled Button</Button>
28
+ * </FocusTrapRegion>
29
+ * ```
30
+ */
31
+ declare const FocusTrapRegion: (props: FocusTrapRegionProps) => import("solid-js").JSX.Element;
32
+ interface FocusTrapRegionOptions<_T extends ValidComponent = TagName> extends Options {
33
+ /**
34
+ * If true, it will trap the focus in the region.
35
+ * @default false
36
+ */
37
+ enabled?: boolean;
38
+ }
39
+ type FocusTrapRegionProps<T extends ValidComponent = TagName> = Props<T, FocusTrapRegionOptions<T>>;
40
+ //#endregion
41
+ export { FocusTrapRegion, FocusTrapRegionOptions, FocusTrapRegionProps, useFocusTrapRegion };
42
+ //# sourceMappingURL=focus-trap-region.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focus-trap-region.d.ts","names":["Options","Props","ValidComponent","TagName","useFocusTrapRegion","FocusTrapRegionOptions","Hook","FocusTrapRegion","FocusTrapRegionProps","props","JSX","Element","_T","enabled","T"],"sources":["../../src/focus-trap/focus-trap-region.d.ts"],"mappings":";;;;cAEcG,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAFkB;;;;AAC1B;AAAA;;;;AAD0B,cAY1BC,kBAAAA,iCAAmDE,IAAAA,QAAYD,sBAAsB;AAA1G;;;;AAA0G;AAe1G;;;;;;;;;AAfA,cAeqBE,eAAAA,GAAkBE,KAAAA,EAAOD,oBAAoB,wBAAwBE,GAAAA,CAAIC,OAAAA;AAAAA,UAC7EN,sBAAAA,YAAkCH,cAAAA,GAAiBC,OAAAA,UAAiBH,OAAAA;EAA9C;;;;EAKnCa,OAAAA;AAAAA;AAAAA,KAEQL,oBAAAA,WAA+BN,cAAAA,GAAiBC,OAAAA,IAAWF,KAAAA,CAAMa,CAAAA,EAAGT,sBAAAA,CAAuBS,CAAAA"}
@@ -0,0 +1,71 @@
1
+ import { FocusTrap } from "./focus-trap.js";
2
+ import { createComponent, memo } from "solid-js/web";
3
+ import { createHook, createInstance, createRef, mergeProps as mergeProps$1, withOptions, wrapInstance } from "@ariakit/solid-utils";
4
+ import { getAllTabbableIn } from "@ariakit/utils";
5
+ import { Show } from "solid-js";
6
+ //#region src/focus-trap/focus-trap-region.tsx
7
+ const TagName = "div";
8
+ /**
9
+ * Returns props to create a `FocusTrapRegion` component.
10
+ * @see https://solid.ariakit.com/components/focus-trap-region
11
+ * @example
12
+ * ```jsx
13
+ * const props = useFocusTrapRegion();
14
+ * <Role {...props} />
15
+ * ```
16
+ */
17
+ const useFocusTrapRegion = createHook(withOptions({ enabled: false }, function useFocusTrapRegion(props, options) {
18
+ const ref = createRef();
19
+ props = wrapInstance(props, (wrapperProps) => {
20
+ const renderFocusTrap = () => {
21
+ return createComponent(Show, {
22
+ get when() {
23
+ return options.enabled;
24
+ },
25
+ get children() {
26
+ return createComponent(FocusTrap, { onFocus: (event) => {
27
+ const container = ref.current;
28
+ if (!container) return;
29
+ const tabbables = getAllTabbableIn(container, true);
30
+ const first = tabbables[0];
31
+ const last = tabbables[tabbables.length - 1];
32
+ if (!tabbables.length) {
33
+ container.focus();
34
+ return;
35
+ }
36
+ if (event.relatedTarget === first) last?.focus();
37
+ else first?.focus();
38
+ } });
39
+ }
40
+ });
41
+ };
42
+ return [
43
+ memo(renderFocusTrap),
44
+ memo(() => wrapperProps.children),
45
+ memo(renderFocusTrap)
46
+ ];
47
+ });
48
+ props = mergeProps$1({ ref: ref.set }, props);
49
+ return props;
50
+ }));
51
+ /**
52
+ * Renders a wrapper element that traps the focus inside it when the
53
+ * [`enabled`](https://solid.ariakit.com/reference/focus-trap-region#enabled)
54
+ * prop is `true`.
55
+ * @see https://solid.ariakit.com/components/focus-trap
56
+ * @example
57
+ * ```jsx
58
+ * <FocusTrapRegion>
59
+ * <Button>click me</Button>
60
+ * <Button>trap focus</Button>
61
+ * <Button disabled>disabled Button</Button>
62
+ * </FocusTrapRegion>
63
+ * ```
64
+ */
65
+ const FocusTrapRegion = function FocusTrapRegion(props) {
66
+ return createInstance(TagName, useFocusTrapRegion(props));
67
+ };
68
+ //#endregion
69
+ export { FocusTrapRegion, useFocusTrapRegion };
70
+
71
+ //# sourceMappingURL=focus-trap-region.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focus-trap-region.js","names":["createRef","mergeProps","createHook","createInstance","withOptions","wrapInstance","Options","Props","getAllTabbableIn","ValidComponent","Show","FocusTrap","TagName","HTMLType","HTMLElementTagNameMap","useFocusTrapRegion","FocusTrapRegionOptions","enabled","props","options","ref","wrapperProps","renderFocusTrap","_$createComponent","when","children","onFocus","event","container","current","tabbables","first","last","length","focus","relatedTarget","_$memo","set","FocusTrapRegion","FocusTrapRegionProps","htmlProps","T"],"sources":["../../src/focus-trap/focus-trap-region.tsx"],"sourcesContent":["import {\n createRef,\n mergeProps,\n createHook,\n createInstance,\n withOptions,\n wrapInstance,\n} from \"@ariakit/solid-utils\";\nimport type { Options, Props } from \"@ariakit/solid-utils\";\nimport { getAllTabbableIn } from \"@ariakit/utils\";\nimport type { ValidComponent } from \"solid-js\";\nimport { Show } from \"solid-js\";\nimport { FocusTrap } from \"./focus-trap.tsx\";\n\nconst TagName = \"div\" satisfies ValidComponent;\ntype TagName = typeof TagName;\ntype HTMLType = HTMLElementTagNameMap[TagName];\n\n/**\n * Returns props to create a `FocusTrapRegion` component.\n * @see https://solid.ariakit.com/components/focus-trap-region\n * @example\n * ```jsx\n * const props = useFocusTrapRegion();\n * <Role {...props} />\n * ```\n */\nexport const useFocusTrapRegion = createHook<TagName, FocusTrapRegionOptions>(\n withOptions({ enabled: false }, function useFocusTrapRegion(props, options) {\n const ref = createRef<HTMLType>();\n\n props = wrapInstance(props, (wrapperProps) => {\n const renderFocusTrap = () => {\n return (\n <Show when={options.enabled}>\n <FocusTrap\n onFocus={(event) => {\n // TODO: (react) opportunity to extract into @ariakit/components?\n const container = ref.current;\n if (!container) return;\n const tabbables = getAllTabbableIn(container, true);\n const first = tabbables[0];\n const last = tabbables[tabbables.length - 1];\n // Fallbacks to the container element\n if (!tabbables.length) {\n container.focus();\n return;\n }\n if (event.relatedTarget === first) {\n last?.focus();\n } else {\n first?.focus();\n }\n }}\n />\n </Show>\n );\n };\n return (\n <>\n {renderFocusTrap()}\n {wrapperProps.children}\n {renderFocusTrap()}\n </>\n );\n });\n\n props = mergeProps({ ref: ref.set }, props);\n\n return props;\n }),\n);\n\n/**\n * Renders a wrapper element that traps the focus inside it when the\n * [`enabled`](https://solid.ariakit.com/reference/focus-trap-region#enabled)\n * prop is `true`.\n * @see https://solid.ariakit.com/components/focus-trap\n * @example\n * ```jsx\n * <FocusTrapRegion>\n * <Button>click me</Button>\n * <Button>trap focus</Button>\n * <Button disabled>disabled Button</Button>\n * </FocusTrapRegion>\n * ```\n */\nexport const FocusTrapRegion = function FocusTrapRegion(\n props: FocusTrapRegionProps,\n) {\n const htmlProps = useFocusTrapRegion(props);\n return createInstance(TagName, htmlProps);\n};\n\nexport interface FocusTrapRegionOptions<\n _T extends ValidComponent = TagName,\n> extends Options {\n /**\n * If true, it will trap the focus in the region.\n * @default false\n */\n enabled?: boolean;\n}\n\nexport type FocusTrapRegionProps<T extends ValidComponent = TagName> = Props<\n T,\n FocusTrapRegionOptions<T>\n>;\n"],"mappings":";;;;;;AAcA,MAAMY,UAAU;;;;;;;;;;AAahB,MAAaG,qBAAqBb,WAChCE,YAAY,EAAEa,SAAS,MAAM,GAAG,SAASF,mBAAmBG,OAAOC,SAAS;CAC1E,MAAMC,MAAMpB,UAAoB;CAEhCkB,QAAQb,aAAaa,QAAQG,iBAAiB;EAC5C,MAAMC,wBAAwB;GAC5B,OAAAC,gBACGb,MAAI;IAAA,IAACc,OAAI;KAAA,OAAEL,QAAQF;IAAO;IAAA,IAAAQ,WAAA;KAAA,OAAAF,gBACxBZ,WAAS,EACRe,UAAUC,UAAU;MAElB,MAAMC,YAAYR,IAAIS;MACtB,IAAI,CAACD,WAAW;MAChB,MAAME,YAAYtB,iBAAiBoB,WAAW,IAAI;MAClD,MAAMG,QAAQD,UAAU;MACxB,MAAME,OAAOF,UAAUA,UAAUG,SAAS;MAE1C,IAAI,CAACH,UAAUG,QAAQ;OACrBL,UAAUM,MAAM;OAChB;MACF;MACA,IAAIP,MAAMQ,kBAAkBJ,OAC1BC,MAAME,MAAM;WAEZH,OAAOG,MAAM;KAEjB,EAAC,CAAA;IAAA;GAAA,CAAA;EAIT;EACA,OAAA;GAAAE,KAEKd,eAAe;GAAAc,WACff,aAAaI,QAAQ;GAAAW,KACrBd,eAAe;EAAA;CAGtB,CAAC;CAEDJ,QAAQjB,aAAW,EAAEmB,KAAKA,IAAIiB,IAAI,GAAGnB,KAAK;CAE1C,OAAOA;AACT,CAAC,CACH;;;;;;;;;;;;;;;AAgBA,MAAaoB,kBAAkB,SAASA,gBACtCpB,OACA;CAEA,OAAOf,eAAeS,SADJG,mBAAmBG,KACNsB,CAAS;AAC1C"}
@@ -0,0 +1,31 @@
1
+ import { VisuallyHiddenOptions } from "../visually-hidden/visually-hidden.js";
2
+ import { ValidComponent } from "solid-js";
3
+ import { Props } from "@ariakit/solid-utils";
4
+
5
+ //#region src/focus-trap/focus-trap.d.ts
6
+ declare const TagName = "span";
7
+ type TagName = typeof TagName;
8
+ /**
9
+ * Returns props to create a `FocusTrap` component.
10
+ * @see https://solid.ariakit.com/components/focus-trap
11
+ * @example
12
+ * ```jsx
13
+ * const props = useFocusTrap();
14
+ * <Role {...props} />
15
+ * ```
16
+ */
17
+ declare const useFocusTrap: import("@ariakit/solid-utils").Hook<"span", FocusTrapOptions<"span">>;
18
+ /**
19
+ * Renders a focus trap element.
20
+ * @see https://solid.ariakit.com/components/focus-trap
21
+ * @example
22
+ * ```jsx
23
+ * <FocusTrap onFocus={focusSomethingElse} />
24
+ * ```
25
+ */
26
+ declare function FocusTrap(props: FocusTrapProps): import("solid-js").JSX.Element;
27
+ type FocusTrapOptions<T extends ValidComponent = TagName> = VisuallyHiddenOptions<T>;
28
+ type FocusTrapProps<T extends ValidComponent = TagName> = Props<T, FocusTrapOptions<T>>;
29
+ //#endregion
30
+ export { FocusTrap, FocusTrapOptions, FocusTrapProps, useFocusTrap };
31
+ //# sourceMappingURL=focus-trap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focus-trap.d.ts","names":["Props","ValidComponent","VisuallyHiddenOptions","TagName","useFocusTrap","FocusTrapOptions","Hook","FocusTrap","FocusTrapProps","props","JSX","Element","T"],"sources":["../../src/focus-trap/focus-trap.d.ts"],"mappings":";;;;;cAGcG,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAFuD;;;;AAC/D;AAAA;;;;AAD+D,cAY/DC,YAAAA,iCAA6CE,IAAAA,SAAaD,gBAAgB;AAA/F;;;;AAA+F;AAS/F;;;AATA,iBASwBE,SAAAA,CAAUE,KAAAA,EAAOD,cAAc,sBAAsBE,GAAAA,CAAIC,OAAAA;AAAAA,KACrEN,gBAAAA,WAA2BJ,cAAAA,GAAiBE,OAAAA,IAAWD,qBAAAA,CAAsBU,CAAAA;AAAAA,KAC7EJ,cAAAA,WAAyBP,cAAAA,GAAiBE,OAAAA,IAAWH,KAAAA,CAAMY,CAAAA,EAAGP,gBAAAA,CAAiBO,CAAAA"}
@@ -0,0 +1,42 @@
1
+ import { useVisuallyHidden } from "../visually-hidden/visually-hidden.js";
2
+ import { createHook, createInstance, mergeProps } from "@ariakit/solid-utils";
3
+ //#region src/focus-trap/focus-trap.tsx
4
+ const TagName = "span";
5
+ /**
6
+ * Returns props to create a `FocusTrap` component.
7
+ * @see https://solid.ariakit.com/components/focus-trap
8
+ * @example
9
+ * ```jsx
10
+ * const props = useFocusTrap();
11
+ * <Role {...props} />
12
+ * ```
13
+ */
14
+ const useFocusTrap = createHook(function useFocusTrap(props) {
15
+ props = mergeProps({
16
+ "data-focus-trap": "",
17
+ tabIndex: 0,
18
+ "aria-hidden": true,
19
+ style: {
20
+ position: "fixed",
21
+ top: 0,
22
+ left: 0
23
+ }
24
+ }, props);
25
+ props = useVisuallyHidden(props);
26
+ return props;
27
+ });
28
+ /**
29
+ * Renders a focus trap element.
30
+ * @see https://solid.ariakit.com/components/focus-trap
31
+ * @example
32
+ * ```jsx
33
+ * <FocusTrap onFocus={focusSomethingElse} />
34
+ * ```
35
+ */
36
+ function FocusTrap(props) {
37
+ return createInstance(TagName, useFocusTrap(props));
38
+ }
39
+ //#endregion
40
+ export { FocusTrap, useFocusTrap };
41
+
42
+ //# sourceMappingURL=focus-trap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focus-trap.js","names":["mergeProps","createHook","createInstance","Props","ValidComponent","VisuallyHiddenOptions","useVisuallyHidden","TagName","useFocusTrap","FocusTrapOptions","props","tabIndex","style","position","top","left","FocusTrap","FocusTrapProps","htmlProps","T"],"sources":["../../src/focus-trap/focus-trap.tsx"],"sourcesContent":["import { mergeProps, createHook, createInstance } from \"@ariakit/solid-utils\";\nimport type { Props } from \"@ariakit/solid-utils\";\nimport type { ValidComponent } from \"solid-js\";\nimport type { VisuallyHiddenOptions } from \"../visually-hidden/visually-hidden.tsx\";\nimport { useVisuallyHidden } from \"../visually-hidden/visually-hidden.tsx\";\n\nconst TagName = \"span\" satisfies ValidComponent;\ntype TagName = typeof TagName;\n\n/**\n * Returns props to create a `FocusTrap` component.\n * @see https://solid.ariakit.com/components/focus-trap\n * @example\n * ```jsx\n * const props = useFocusTrap();\n * <Role {...props} />\n * ```\n */\nexport const useFocusTrap = createHook<TagName, FocusTrapOptions>(\n function useFocusTrap(props) {\n props = mergeProps(\n {\n \"data-focus-trap\": \"\",\n tabIndex: 0,\n \"aria-hidden\": true,\n style: {\n // Prevents unintended scroll jumps.\n position: \"fixed\",\n top: 0,\n left: 0,\n },\n },\n props,\n );\n\n props = useVisuallyHidden(props);\n\n return props;\n },\n);\n\n/**\n * Renders a focus trap element.\n * @see https://solid.ariakit.com/components/focus-trap\n * @example\n * ```jsx\n * <FocusTrap onFocus={focusSomethingElse} />\n * ```\n */\nexport function FocusTrap(props: FocusTrapProps) {\n const htmlProps = useFocusTrap(props);\n return createInstance(TagName, htmlProps);\n}\n\nexport type FocusTrapOptions<T extends ValidComponent = TagName> =\n VisuallyHiddenOptions<T>;\n\nexport type FocusTrapProps<T extends ValidComponent = TagName> = Props<\n T,\n FocusTrapOptions<T>\n>;\n"],"mappings":";;;AAMA,MAAMO,UAAU;;;;;;;;;;AAYhB,MAAaC,eAAeP,WAC1B,SAASO,aAAaE,OAAO;CAC3BA,QAAQV,WACN;EACE,mBAAmB;EACnBW,UAAU;EACV,eAAe;EACfC,OAAO;GAELC,UAAU;GACVC,KAAK;GACLC,MAAM;EACR;CACF,GACAL,KACF;CAEAA,QAAQJ,kBAAkBI,KAAK;CAE/B,OAAOA;AACT,CACF;;;;;;;;;AAUA,SAAgBM,UAAUN,OAAuB;CAE/C,OAAOR,eAAeK,SADJC,aAAaE,KACAQ,CAAS;AAC1C"}
@@ -0,0 +1,7 @@
1
+ import { Setter } from "solid-js";
2
+
3
+ //#region src/group/group-label-context.d.ts
4
+ declare const GroupLabelContext: import("solid-js").Context<Setter<string | undefined> | undefined>;
5
+ //#endregion
6
+ export { GroupLabelContext };
7
+ //# sourceMappingURL=group-label-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"group-label-context.d.ts","names":["Setter","GroupLabelContext","Context"],"sources":["../../src/group/group-label-context.d.ts"],"mappings":";;;cACqBC,iBAAAA,qBAAsCC,OAAAA,CAAQF,MAAM"}
@@ -0,0 +1,7 @@
1
+ import { createContext } from "solid-js";
2
+ //#region src/group/group-label-context.tsx
3
+ const GroupLabelContext = createContext();
4
+ //#endregion
5
+ export { GroupLabelContext };
6
+
7
+ //# sourceMappingURL=group-label-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"group-label-context.js","names":["Setter","createContext","GroupLabelContext"],"sources":["../../src/group/group-label-context.tsx"],"sourcesContent":["import type { Setter } from \"solid-js\";\nimport { createContext } from \"solid-js\";\n\nexport const GroupLabelContext = createContext<Setter<string | undefined>>();\n"],"mappings":";;AAGA,MAAaE,oBAAoBD,cAA0C"}
@@ -0,0 +1,37 @@
1
+ import { ValidComponent } from "solid-js";
2
+ import { Options, Props } from "@ariakit/solid-utils";
3
+
4
+ //#region src/group/group-label.d.ts
5
+ declare const TagName = "div";
6
+ type TagName = typeof TagName;
7
+ /**
8
+ * Returns props to create a `GroupLabel` component. This hook must be used in a
9
+ * component that's wrapped with `Group` so the `aria-labelledby` prop is
10
+ * properly set on the group element.
11
+ * @see https://solid.ariakit.com/components/group
12
+ * @example
13
+ * ```jsx
14
+ * // This component must be wrapped with Group
15
+ * const props = useGroupLabel();
16
+ * <Role {...props}>Label</Role>
17
+ * ```
18
+ */
19
+ declare const useGroupLabel: import("@ariakit/solid-utils").Hook<"div", GroupLabelOptions<"div">>;
20
+ /**
21
+ * Renders a label in a group. This component should be wrapped with a
22
+ * [`Group`](https://solid.ariakit.com/reference/group) so the `aria-labelledby`
23
+ * prop is correctly set on the group element.
24
+ * @see https://solid.ariakit.com/components/group
25
+ * @example
26
+ * ```jsx
27
+ * <Group>
28
+ * <GroupLabel>Label</GroupLabel>
29
+ * </Group>
30
+ * ```
31
+ */
32
+ declare const GroupLabel: (props: GroupLabelProps) => import("solid-js").JSX.Element;
33
+ interface GroupLabelOptions<_T extends ValidComponent = TagName> extends Options {}
34
+ type GroupLabelProps<T extends ValidComponent = TagName> = Props<T, GroupLabelOptions<T>>;
35
+ //#endregion
36
+ export { GroupLabel, GroupLabelOptions, GroupLabelProps, useGroupLabel };
37
+ //# sourceMappingURL=group-label.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"group-label.d.ts","names":["Options","Props","ValidComponent","TagName","useGroupLabel","GroupLabelOptions","Hook","GroupLabel","GroupLabelProps","props","JSX","Element","_T","T"],"sources":["../../src/group/group-label.d.ts"],"mappings":";;;;cAEcG,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAFkB;;;;AAC1B;AAAA;;;;AACQ;AAa7B;;AAf+C,cAe1BC,aAAAA,iCAA8CE,IAAAA,QAAYD,iBAAiB;;AAAA;AAahG;;;;;;;;;AAA2F;cAAtEE,UAAAA,GAAaE,KAAAA,EAAOD,eAAe,wBAAwBE,GAAAA,CAAIC,OAAAA;AAAAA,UACnEN,iBAAAA,YAA6BH,cAAAA,GAAiBC,OAAAA,UAAiBH,OAAAA;AAAAA,KAEpEQ,eAAAA,WAA0BN,cAAAA,GAAiBC,OAAAA,IAAWF,KAAAA,CAAMY,CAAAA,EAAGR,iBAAAA,CAAkBQ,CAAAA"}
@@ -0,0 +1,51 @@
1
+ import { GroupLabelContext } from "./group-label-context.js";
2
+ import { createHook, createId, createInstance, mergeProps, stableAccessor } from "@ariakit/solid-utils";
3
+ import { createEffect, onCleanup, useContext } from "solid-js";
4
+ //#region src/group/group-label.tsx
5
+ const TagName = "div";
6
+ /**
7
+ * Returns props to create a `GroupLabel` component. This hook must be used in a
8
+ * component that's wrapped with `Group` so the `aria-labelledby` prop is
9
+ * properly set on the group element.
10
+ * @see https://solid.ariakit.com/components/group
11
+ * @example
12
+ * ```jsx
13
+ * // This component must be wrapped with Group
14
+ * const props = useGroupLabel();
15
+ * <Role {...props}>Label</Role>
16
+ * ```
17
+ */
18
+ const useGroupLabel = createHook(function useGroupLabel(props) {
19
+ const setLabelId = useContext(GroupLabelContext);
20
+ const id = createId(stableAccessor(props, (p) => p.id));
21
+ createEffect(() => {
22
+ setLabelId?.(id());
23
+ onCleanup(() => setLabelId?.(void 0));
24
+ });
25
+ props = mergeProps({
26
+ get id() {
27
+ return id();
28
+ },
29
+ "aria-hidden": true
30
+ }, props);
31
+ return props;
32
+ });
33
+ /**
34
+ * Renders a label in a group. This component should be wrapped with a
35
+ * [`Group`](https://solid.ariakit.com/reference/group) so the `aria-labelledby`
36
+ * prop is correctly set on the group element.
37
+ * @see https://solid.ariakit.com/components/group
38
+ * @example
39
+ * ```jsx
40
+ * <Group>
41
+ * <GroupLabel>Label</GroupLabel>
42
+ * </Group>
43
+ * ```
44
+ */
45
+ const GroupLabel = function GroupLabel(props) {
46
+ return createInstance(TagName, useGroupLabel(props));
47
+ };
48
+ //#endregion
49
+ export { GroupLabel, useGroupLabel };
50
+
51
+ //# sourceMappingURL=group-label.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"group-label.js","names":["createId","mergeProps","stableAccessor","createHook","createInstance","Options","Props","ValidComponent","createEffect","onCleanup","useContext","GroupLabelContext","TagName","useGroupLabel","GroupLabelOptions","props","setLabelId","id","p","undefined","GroupLabel","GroupLabelProps","htmlProps","T"],"sources":["../../src/group/group-label.tsx"],"sourcesContent":["import {\n createId,\n mergeProps,\n stableAccessor,\n createHook,\n createInstance,\n} from \"@ariakit/solid-utils\";\nimport type { Options, Props } from \"@ariakit/solid-utils\";\nimport type { ValidComponent } from \"solid-js\";\nimport { createEffect, onCleanup, useContext } from \"solid-js\";\nimport { GroupLabelContext } from \"./group-label-context.tsx\";\n\nconst TagName = \"div\" satisfies ValidComponent;\ntype TagName = typeof TagName;\n\n/**\n * Returns props to create a `GroupLabel` component. This hook must be used in a\n * component that's wrapped with `Group` so the `aria-labelledby` prop is\n * properly set on the group element.\n * @see https://solid.ariakit.com/components/group\n * @example\n * ```jsx\n * // This component must be wrapped with Group\n * const props = useGroupLabel();\n * <Role {...props}>Label</Role>\n * ```\n */\nexport const useGroupLabel = createHook<TagName, GroupLabelOptions>(\n function useGroupLabel(props) {\n const setLabelId = useContext(GroupLabelContext);\n const id = createId(stableAccessor(props, (p) => p.id));\n\n createEffect(() => {\n setLabelId?.(id());\n onCleanup(() => setLabelId?.(undefined));\n });\n\n props = mergeProps(\n {\n get id() {\n return id();\n },\n \"aria-hidden\": true,\n },\n props,\n );\n\n return props;\n },\n);\n\n/**\n * Renders a label in a group. This component should be wrapped with a\n * [`Group`](https://solid.ariakit.com/reference/group) so the `aria-labelledby`\n * prop is correctly set on the group element.\n * @see https://solid.ariakit.com/components/group\n * @example\n * ```jsx\n * <Group>\n * <GroupLabel>Label</GroupLabel>\n * </Group>\n * ```\n */\nexport const GroupLabel = function GroupLabel(props: GroupLabelProps) {\n const htmlProps = useGroupLabel(props);\n return createInstance(TagName, htmlProps);\n};\n\nexport interface GroupLabelOptions<\n _T extends ValidComponent = TagName,\n> extends Options {}\n\nexport type GroupLabelProps<T extends ValidComponent = TagName> = Props<\n T,\n GroupLabelOptions<T>\n>;\n"],"mappings":";;;;AAYA,MAAMY,UAAU;;;;;;;;;;;;;AAehB,MAAaC,gBAAgBV,WAC3B,SAASU,cAAcE,OAAO;CAC5B,MAAMC,aAAaN,WAAWC,iBAAiB;CAC/C,MAAMM,KAAKjB,SAASE,eAAea,QAAQG,MAAMA,EAAED,EAAE,CAAC;CAEtDT,mBAAmB;EACjBQ,aAAaC,GAAG,CAAC;EACjBR,gBAAgBO,aAAaG,KAAAA,CAAS,CAAC;CACzC,CAAC;CAEDJ,QAAQd,WACN;EACE,IAAIgB,KAAK;GACP,OAAOA,GAAG;EACZ;EACA,eAAe;CACjB,GACAF,KACF;CAEA,OAAOA;AACT,CACF;;;;;;;;;;;;;AAcA,MAAaK,aAAa,SAASA,WAAWL,OAAwB;CAEpE,OAAOX,eAAeQ,SADJC,cAAcE,KACDO,CAAS;AAC1C"}
@@ -0,0 +1,32 @@
1
+ import { ValidComponent } from "solid-js";
2
+ import { Options, Props } from "@ariakit/solid-utils";
3
+
4
+ //#region src/group/group.d.ts
5
+ declare const TagName = "div";
6
+ type TagName = typeof TagName;
7
+ /**
8
+ * Returns props to create a `Group` component.
9
+ * @see https://solid.ariakit.com/components/group
10
+ * @example
11
+ * ```jsx
12
+ * const props = useGroup();
13
+ * <Role {...props}>Group</Role>
14
+ * ```
15
+ */
16
+ declare const useGroup: import("@ariakit/solid-utils").Hook<"div", Options>;
17
+ /**
18
+ * Renders a group element. Optionally, a
19
+ * [`GroupLabel`](https://solid.ariakit.com/reference/group-label) can be rendered as
20
+ * a child to provide a label for the group.
21
+ * @see https://solid.ariakit.com/components/group
22
+ * @example
23
+ * ```jsx
24
+ * <Group>Group</Group>
25
+ * ```
26
+ */
27
+ declare const Group: (props: GroupProps) => import("solid-js").JSX.Element;
28
+ type GroupOptions<_T extends ValidComponent = TagName> = Options;
29
+ type GroupProps<T extends ValidComponent = TagName> = Props<T, GroupOptions<T>>;
30
+ //#endregion
31
+ export { Group, GroupOptions, GroupProps, useGroup };
32
+ //# sourceMappingURL=group.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"group.d.ts","names":["Options","Props","ValidComponent","TagName","useGroup","Hook","Group","GroupProps","props","JSX","Element","GroupOptions","_T","T"],"sources":["../../src/group/group.d.ts"],"mappings":";;;;cAEcG,OAAAA;AAAAA,KACTA,OAAAA,UAAiBA,OAAO;AAFkB;;;;AAC1B;AAAA;;;;AAD0B,cAY1BC,QAAAA,iCAAyCC,IAAAA,QAAYL,OAAO;AAAjF;;;;AAAiF;AAWjF;;;;;AAXA,cAWqBM,KAAAA,GAAQE,KAAAA,EAAOD,UAAU,wBAAwBE,GAAAA,CAAIC,OAAAA;AAAAA,KAC9DC,YAAAA,YAAwBT,cAAAA,GAAiBC,OAAAA,IAAWH,OAAAA;AAAAA,KACpDO,UAAAA,WAAqBL,cAAAA,GAAiBC,OAAAA,IAAWF,KAAAA,CAAMY,CAAAA,EAAGF,YAAAA,CAAaE,CAAAA"}
@@ -0,0 +1,49 @@
1
+ import { As } from "../as/as.js";
2
+ import { GroupLabelContext } from "./group-label-context.js";
3
+ import { createComponent } from "solid-js/web";
4
+ import { createHook, createInstance, mergeProps as mergeProps$1, wrapInstance } from "@ariakit/solid-utils";
5
+ import { createSignal } from "solid-js";
6
+ //#region src/group/group.tsx
7
+ const TagName = "div";
8
+ /**
9
+ * Returns props to create a `Group` component.
10
+ * @see https://solid.ariakit.com/components/group
11
+ * @example
12
+ * ```jsx
13
+ * const props = useGroup();
14
+ * <Role {...props}>Group</Role>
15
+ * ```
16
+ */
17
+ const useGroup = createHook(function useGroup(props) {
18
+ const [labelId, setLabelId] = createSignal();
19
+ props = wrapInstance(props, createComponent(As, {
20
+ get component() {
21
+ return GroupLabelContext.Provider;
22
+ },
23
+ value: setLabelId
24
+ }));
25
+ props = mergeProps$1({
26
+ role: "group",
27
+ get "aria-labelledby"() {
28
+ return labelId();
29
+ }
30
+ }, props);
31
+ return props;
32
+ });
33
+ /**
34
+ * Renders a group element. Optionally, a
35
+ * [`GroupLabel`](https://solid.ariakit.com/reference/group-label) can be rendered as
36
+ * a child to provide a label for the group.
37
+ * @see https://solid.ariakit.com/components/group
38
+ * @example
39
+ * ```jsx
40
+ * <Group>Group</Group>
41
+ * ```
42
+ */
43
+ const Group = function Group(props) {
44
+ return createInstance(TagName, useGroup(props));
45
+ };
46
+ //#endregion
47
+ export { Group, useGroup };
48
+
49
+ //# sourceMappingURL=group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"group.js","names":["mergeProps","createHook","createInstance","wrapInstance","Options","Props","ValidComponent","createSignal","As","GroupLabelContext","TagName","useGroup","GroupOptions","props","labelId","setLabelId","_$createComponent","component","Provider","value","role","const","aria-labelledby","Group","GroupProps","htmlProps","T"],"sources":["../../src/group/group.tsx"],"sourcesContent":["import {\n mergeProps,\n createHook,\n createInstance,\n wrapInstance,\n} from \"@ariakit/solid-utils\";\nimport type { Options, Props } from \"@ariakit/solid-utils\";\nimport type { ValidComponent } from \"solid-js\";\nimport { createSignal } from \"solid-js\";\nimport { As } from \"../as/as.tsx\";\nimport { GroupLabelContext } from \"./group-label-context.tsx\";\n\nconst TagName = \"div\" satisfies ValidComponent;\ntype TagName = typeof TagName;\n\n/**\n * Returns props to create a `Group` component.\n * @see https://solid.ariakit.com/components/group\n * @example\n * ```jsx\n * const props = useGroup();\n * <Role {...props}>Group</Role>\n * ```\n */\nexport const useGroup = createHook<TagName, GroupOptions>(\n function useGroup(props) {\n const [labelId, setLabelId] = createSignal<string>();\n\n props = wrapInstance(\n props,\n <As component={GroupLabelContext.Provider} value={setLabelId} />,\n );\n\n props = mergeProps(\n {\n role: \"group\" as const,\n get \"aria-labelledby\"() {\n return labelId();\n },\n },\n props,\n );\n\n return props;\n },\n);\n\n/**\n * Renders a group element. Optionally, a\n * [`GroupLabel`](https://solid.ariakit.com/reference/group-label) can be rendered as\n * a child to provide a label for the group.\n * @see https://solid.ariakit.com/components/group\n * @example\n * ```jsx\n * <Group>Group</Group>\n * ```\n */\nexport const Group = function Group(props: GroupProps) {\n const htmlProps = useGroup(props);\n return createInstance(TagName, htmlProps);\n};\n\nexport type GroupOptions<_T extends ValidComponent = TagName> = Options;\n\nexport type GroupProps<T extends ValidComponent = TagName> = Props<\n T,\n GroupOptions<T>\n>;\n"],"mappings":";;;;;;AAYA,MAAMU,UAAU;;;;;;;;;;AAYhB,MAAaC,WAAWV,WACtB,SAASU,SAASE,OAAO;CACvB,MAAM,CAACC,SAASC,cAAcR,aAAqB;CAEnDM,QAAQV,aACNU,OAAKG,gBACJR,IAAE;EAAA,IAACS,YAAS;GAAA,OAAER,kBAAkBS;EAAQ;EAAEC,OAAOJ;CAAU,CAAA,CAC9D;CAEAF,QAAQb,aACN;EACEoB,MAAM;EACN,IAAI,oBAAoB;GACtB,OAAON,QAAQ;EACjB;CACF,GACAD,KACF;CAEA,OAAOA;AACT,CACF;;;;;;;;;;;AAYA,MAAaU,QAAQ,SAASA,MAAMV,OAAmB;CAErD,OAAOX,eAAeQ,SADJC,SAASE,KACIY,CAAS;AAC1C"}
@@ -0,0 +1,8 @@
1
+ import { HeadingLevels } from "./utils.js";
2
+ import { Accessor } from "solid-js";
3
+
4
+ //#region src/heading/heading-context.d.ts
5
+ declare const HeadingContext: import("solid-js").Context<Accessor<HeadingLevels> | undefined>;
6
+ //#endregion
7
+ export { HeadingContext };
8
+ //# sourceMappingURL=heading-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"heading-context.d.ts","names":["Accessor","HeadingLevels","HeadingContext","Context"],"sources":["../../src/heading/heading-context.d.ts"],"mappings":";;;;cAEqBE,cAAAA,qBAAmCC,OAAAA,CAAQH,QAAQ,CAACC,aAAAA"}
@@ -0,0 +1,7 @@
1
+ import { createContext } from "solid-js";
2
+ //#region src/heading/heading-context.tsx
3
+ const HeadingContext = createContext();
4
+ //#endregion
5
+ export { HeadingContext };
6
+
7
+ //# sourceMappingURL=heading-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"heading-context.js","names":["Accessor","createContext","HeadingLevels","HeadingContext"],"sources":["../../src/heading/heading-context.tsx"],"sourcesContent":["import type { Accessor } from \"solid-js\";\nimport { createContext } from \"solid-js\";\nimport type { HeadingLevels } from \"./utils.ts\";\n\nexport const HeadingContext = createContext<Accessor<HeadingLevels>>();\n"],"mappings":";;AAIA,MAAaG,iBAAiBF,cAAuC"}
@@ -0,0 +1,32 @@
1
+ import { HeadingLevels } from "./utils.js";
2
+ import { JSX } from "solid-js";
3
+
4
+ //#region src/heading/heading-level.d.ts
5
+ /**
6
+ * A component that sets the heading level for its children. It doesn't render
7
+ * any HTML element, just sets the
8
+ * [`level`](https://solid.ariakit.com/reference/heading-level#level) prop on the
9
+ * context.
10
+ * @see https://solid.ariakit.com/components/heading
11
+ * @example
12
+ * ```jsx
13
+ * <HeadingLevel>
14
+ * <Heading>Heading 1</Heading>
15
+ * <HeadingLevel>
16
+ * <Heading>Heading 2</Heading>
17
+ * </HeadingLevel>
18
+ * </HeadingLevel>
19
+ * ```
20
+ */
21
+ declare function HeadingLevel(props: HeadingLevelProps): JSX.Element;
22
+ interface HeadingLevelProps {
23
+ /**
24
+ * The heading level. By default, it'll increase the level by 1 based on the
25
+ * context.
26
+ */
27
+ level?: HeadingLevels;
28
+ children?: JSX.Element;
29
+ }
30
+ //#endregion
31
+ export { HeadingLevel, HeadingLevelProps };
32
+ //# sourceMappingURL=heading-level.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"heading-level.d.ts","names":["JSX","HeadingLevels","HeadingLevel","HeadingLevelProps","Element","props","level","children"],"sources":["../../src/heading/heading-level.d.ts"],"mappings":";;;;;;AAkBA;;;;;;;;;AAA2E;AAC3E;;;;iBADwBE,YAAAA,CAAaG,KAAAA,EAAOF,iBAAAA,GAAoBH,GAAAA,CAAII,OAAO;AAAA,UAC1DD,iBAAAA;EAMbI;;;;EADAD,KAAAA,GAAQL,aAAAA;EACRM,QAAAA,GAAWP,GAAAA,CAAII,OAAO;AAAA"}