@entropix/react 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/dist/accordion.cjs +27 -0
  2. package/dist/accordion.css +57 -0
  3. package/dist/accordion.d.cts +30 -0
  4. package/dist/accordion.d.ts +30 -0
  5. package/dist/accordion.js +6 -0
  6. package/dist/button.cjs +15 -0
  7. package/dist/button.css +113 -0
  8. package/dist/button.d.cts +25 -0
  9. package/dist/button.d.ts +25 -0
  10. package/dist/button.js +6 -0
  11. package/dist/checkbox.cjs +15 -0
  12. package/dist/checkbox.css +89 -0
  13. package/dist/checkbox.d.cts +26 -0
  14. package/dist/checkbox.d.ts +26 -0
  15. package/dist/checkbox.js +6 -0
  16. package/dist/chunk-2MKJZEUK.cjs +4 -0
  17. package/dist/chunk-34IVVIO3.cjs +119 -0
  18. package/dist/chunk-36ZHHJYV.js +79 -0
  19. package/dist/chunk-5DKE5YQD.cjs +10 -0
  20. package/dist/chunk-664P2RGR.js +108 -0
  21. package/dist/chunk-6NKHMBF3.cjs +97 -0
  22. package/dist/chunk-6UAQCHIW.js +8 -0
  23. package/dist/chunk-7AUIZOEH.cjs +84 -0
  24. package/dist/chunk-AVCBDUKH.js +3 -0
  25. package/dist/chunk-B5JZHE4I.cjs +90 -0
  26. package/dist/chunk-BN57JPKV.js +26 -0
  27. package/dist/chunk-BY4E26CV.js +114 -0
  28. package/dist/chunk-CL6JXZIY.js +88 -0
  29. package/dist/chunk-CTT3LXMZ.js +76 -0
  30. package/dist/chunk-EASSPJBG.cjs +110 -0
  31. package/dist/chunk-EWY7MSXF.cjs +94 -0
  32. package/dist/chunk-FJGLK3I4.js +89 -0
  33. package/dist/chunk-GTVBKK3W.js +88 -0
  34. package/dist/chunk-GZXXUFCJ.cjs +15 -0
  35. package/dist/chunk-IXH7OVN3.cjs +86 -0
  36. package/dist/chunk-KGIUECLG.cjs +91 -0
  37. package/dist/chunk-LDOP6DVX.cjs +28 -0
  38. package/dist/chunk-LJK6KK2H.cjs +43 -0
  39. package/dist/chunk-OT2HJUCB.js +84 -0
  40. package/dist/chunk-PILZGMQG.js +87 -0
  41. package/dist/chunk-PN42JF6U.js +92 -0
  42. package/dist/chunk-RPIYYBFJ.cjs +90 -0
  43. package/dist/chunk-S6DVQAH4.cjs +240 -0
  44. package/dist/chunk-U5CZHO6D.js +13 -0
  45. package/dist/chunk-UGCCJI2F.js +111 -0
  46. package/dist/chunk-W6N4D4N4.js +230 -0
  47. package/dist/chunk-Y2M2LJGJ.js +41 -0
  48. package/dist/chunk-YJG5KX6O.cjs +81 -0
  49. package/dist/chunk-ZG4PZBSL.cjs +113 -0
  50. package/dist/dialog.cjs +39 -0
  51. package/dist/dialog.css +89 -0
  52. package/dist/dialog.d.cts +62 -0
  53. package/dist/dialog.d.ts +62 -0
  54. package/dist/dialog.js +6 -0
  55. package/dist/index.cjs +170 -1223
  56. package/dist/index.d.cts +17 -477
  57. package/dist/index.d.ts +17 -477
  58. package/dist/index.js +19 -1189
  59. package/dist/input.cjs +15 -0
  60. package/dist/input.css +135 -0
  61. package/dist/input.d.cts +37 -0
  62. package/dist/input.d.ts +37 -0
  63. package/dist/input.js +6 -0
  64. package/dist/layout.cjs +25 -0
  65. package/dist/layout.css +176 -0
  66. package/dist/layout.d.cts +108 -0
  67. package/dist/layout.d.ts +108 -0
  68. package/dist/layout.js +4 -0
  69. package/dist/menu.cjs +27 -0
  70. package/dist/menu.css +51 -0
  71. package/dist/menu.d.cts +31 -0
  72. package/dist/menu.d.ts +31 -0
  73. package/dist/menu.js +6 -0
  74. package/dist/radio.cjs +19 -0
  75. package/dist/radio.css +93 -0
  76. package/dist/radio.d.cts +37 -0
  77. package/dist/radio.d.ts +37 -0
  78. package/dist/radio.js +6 -0
  79. package/dist/select.cjs +27 -0
  80. package/dist/select.css +114 -0
  81. package/dist/select.d.cts +59 -0
  82. package/dist/select.d.ts +59 -0
  83. package/dist/select.js +6 -0
  84. package/dist/styles/accordion.css +1 -67
  85. package/dist/styles/button.css +1 -133
  86. package/dist/styles/checkbox.css +1 -119
  87. package/dist/styles/dialog.css +1 -102
  88. package/dist/styles/index.css +1 -14
  89. package/dist/styles/input.css +1 -176
  90. package/dist/styles/layout.css +1 -125
  91. package/dist/styles/menu.css +1 -62
  92. package/dist/styles/radio.css +1 -128
  93. package/dist/styles/select.css +1 -148
  94. package/dist/styles/switch.css +1 -53
  95. package/dist/styles/tabs.css +1 -84
  96. package/dist/styles/toggle.css +1 -45
  97. package/dist/switch.cjs +16 -0
  98. package/dist/switch.css +89 -0
  99. package/dist/switch.d.cts +14 -0
  100. package/dist/switch.d.ts +14 -0
  101. package/dist/switch.js +7 -0
  102. package/dist/tabs.cjs +27 -0
  103. package/dist/tabs.css +69 -0
  104. package/dist/tabs.d.cts +31 -0
  105. package/dist/tabs.d.ts +31 -0
  106. package/dist/tabs.js +6 -0
  107. package/dist/textarea.cjs +15 -0
  108. package/dist/textarea.css +135 -0
  109. package/dist/textarea.d.cts +41 -0
  110. package/dist/textarea.d.ts +41 -0
  111. package/dist/textarea.js +6 -0
  112. package/dist/toggle.cjs +19 -0
  113. package/dist/toggle.css +41 -0
  114. package/dist/toggle.d.cts +34 -0
  115. package/dist/toggle.d.ts +34 -0
  116. package/dist/toggle.js +6 -0
  117. package/package.json +135 -4
  118. package/dist/index.cjs.map +0 -1
  119. package/dist/index.css.map +0 -1
  120. package/dist/index.js.map +0 -1
@@ -0,0 +1,88 @@
1
+ import { useKeyboardHandler } from './chunk-BN57JPKV.js';
2
+ import { mapAccessibilityToAria } from './chunk-Y2M2LJGJ.js';
3
+ import { cn } from './chunk-6UAQCHIW.js';
4
+ import { forwardRef, useMemo, useCallback } from 'react';
5
+ import { useToggle } from '@entropix/core';
6
+ import { jsxs, jsx } from 'react/jsx-runtime';
7
+
8
+ var Checkbox = forwardRef(
9
+ function Checkbox2({
10
+ checked,
11
+ defaultChecked,
12
+ onChange,
13
+ disabled,
14
+ label,
15
+ indeterminate = false,
16
+ className,
17
+ style,
18
+ children,
19
+ onClick,
20
+ onKeyDown: externalOnKeyDown,
21
+ ...rest
22
+ }, ref) {
23
+ const { isChecked, isDisabled, getToggleProps } = useToggle({
24
+ checked,
25
+ defaultChecked,
26
+ onChange,
27
+ disabled,
28
+ role: "checkbox"
29
+ });
30
+ const propGetterReturn = getToggleProps();
31
+ const ariaProps = mapAccessibilityToAria(propGetterReturn.accessibility);
32
+ if (indeterminate) {
33
+ ariaProps["aria-checked"] = "mixed";
34
+ }
35
+ if (label && !children) {
36
+ ariaProps["aria-label"] = label;
37
+ }
38
+ const actionMap = useMemo(
39
+ () => ({
40
+ toggle: propGetterReturn.onAction ?? (() => {
41
+ })
42
+ }),
43
+ [propGetterReturn.onAction]
44
+ );
45
+ const onKeyDown = useKeyboardHandler(
46
+ propGetterReturn.keyboardConfig,
47
+ actionMap
48
+ );
49
+ const handleClick = useCallback(
50
+ (event) => {
51
+ propGetterReturn.onAction?.();
52
+ onClick?.(event);
53
+ },
54
+ [propGetterReturn.onAction, onClick]
55
+ );
56
+ const handleKeyDown = useCallback(
57
+ (event) => {
58
+ onKeyDown?.(event);
59
+ externalOnKeyDown?.(event);
60
+ },
61
+ [onKeyDown, externalOnKeyDown]
62
+ );
63
+ const dataState = indeterminate ? "indeterminate" : isChecked ? "checked" : "unchecked";
64
+ return /* @__PURE__ */ jsxs(
65
+ "button",
66
+ {
67
+ ref,
68
+ type: "button",
69
+ className: cn("entropix-checkbox", className),
70
+ style,
71
+ ...ariaProps,
72
+ ...rest,
73
+ disabled: isDisabled || void 0,
74
+ onClick: propGetterReturn.onAction || onClick ? handleClick : void 0,
75
+ onKeyDown: onKeyDown || externalOnKeyDown ? handleKeyDown : void 0,
76
+ "data-state": dataState,
77
+ children: [
78
+ /* @__PURE__ */ jsx("span", { className: "entropix-checkbox__indicator", "data-state": dataState }),
79
+ (label || children) && /* @__PURE__ */ jsx("span", { className: "entropix-checkbox__label", children: label || children })
80
+ ]
81
+ }
82
+ );
83
+ }
84
+ );
85
+
86
+ export { Checkbox };
87
+ //# sourceMappingURL=chunk-CL6JXZIY.js.map
88
+ //# sourceMappingURL=chunk-CL6JXZIY.js.map
@@ -0,0 +1,76 @@
1
+ import { cn } from './chunk-6UAQCHIW.js';
2
+ import { forwardRef } from 'react';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ var Stack = forwardRef(function Stack2({ gap, align, fullWidth, as: Component = "div", className, children, ...rest }, ref) {
6
+ return /* @__PURE__ */ jsx(
7
+ Component,
8
+ {
9
+ ref,
10
+ className: cn(
11
+ "entropix-stack",
12
+ gap && `entropix-stack--gap-${gap}`,
13
+ align && `entropix-stack--align-${align}`,
14
+ fullWidth && "entropix-stack--full-width",
15
+ className
16
+ ),
17
+ ...rest,
18
+ children
19
+ }
20
+ );
21
+ });
22
+ var Inline = forwardRef(function Inline2({ gap, align, justify, wrap, as: Component = "div", className, children, ...rest }, ref) {
23
+ return /* @__PURE__ */ jsx(
24
+ Component,
25
+ {
26
+ ref,
27
+ className: cn(
28
+ "entropix-inline",
29
+ gap && `entropix-inline--gap-${gap}`,
30
+ align && `entropix-inline--align-${align}`,
31
+ justify && `entropix-inline--justify-${justify}`,
32
+ wrap && "entropix-inline--wrap",
33
+ className
34
+ ),
35
+ ...rest,
36
+ children
37
+ }
38
+ );
39
+ });
40
+ var Container = forwardRef(function Container2({ maxWidth = "lg", center, as: Component = "div", className, children, ...rest }, ref) {
41
+ return /* @__PURE__ */ jsx(
42
+ Component,
43
+ {
44
+ ref,
45
+ className: cn(
46
+ "entropix-container",
47
+ `entropix-container--${maxWidth}`,
48
+ center && "entropix-container--center",
49
+ className
50
+ ),
51
+ ...rest,
52
+ children
53
+ }
54
+ );
55
+ });
56
+ var Divider = forwardRef(function Divider2({ orientation = "horizontal", spacing, className, ...rest }, ref) {
57
+ return /* @__PURE__ */ jsx(
58
+ "hr",
59
+ {
60
+ ref,
61
+ role: orientation === "vertical" ? "separator" : void 0,
62
+ "aria-orientation": orientation === "vertical" ? "vertical" : void 0,
63
+ className: cn(
64
+ "entropix-divider",
65
+ orientation === "vertical" && "entropix-divider--vertical",
66
+ spacing && `entropix-divider--spacing-${spacing}`,
67
+ className
68
+ ),
69
+ ...rest
70
+ }
71
+ );
72
+ });
73
+
74
+ export { Container, Divider, Inline, Stack };
75
+ //# sourceMappingURL=chunk-CTT3LXMZ.js.map
76
+ //# sourceMappingURL=chunk-CTT3LXMZ.js.map
@@ -0,0 +1,110 @@
1
+ 'use strict';
2
+
3
+ var chunkLJK6KK2H_cjs = require('./chunk-LJK6KK2H.cjs');
4
+ var chunk5DKE5YQD_cjs = require('./chunk-5DKE5YQD.cjs');
5
+ var react = require('react');
6
+ var core = require('@entropix/core');
7
+ var jsxRuntime = require('react/jsx-runtime');
8
+
9
+ var Input = react.forwardRef(function Input2({
10
+ value,
11
+ defaultValue,
12
+ onChange,
13
+ disabled,
14
+ readOnly,
15
+ required,
16
+ invalid,
17
+ label,
18
+ helperText,
19
+ errorMessage,
20
+ variant = "default",
21
+ size = "md",
22
+ className,
23
+ type,
24
+ placeholder,
25
+ name,
26
+ ...rest
27
+ }, ref) {
28
+ const isInvalid = invalid || !!errorMessage;
29
+ const {
30
+ value: inputValue,
31
+ isDisabled,
32
+ isReadOnly,
33
+ isRequired,
34
+ isInvalid: _,
35
+ getInputProps,
36
+ getLabelProps,
37
+ getHelperTextProps,
38
+ getErrorMessageProps
39
+ } = core.useInput({
40
+ value,
41
+ defaultValue,
42
+ onChange,
43
+ disabled,
44
+ readOnly,
45
+ required,
46
+ invalid: isInvalid,
47
+ type,
48
+ placeholder,
49
+ name
50
+ });
51
+ const propGetterReturn = getInputProps();
52
+ const ariaProps = chunkLJK6KK2H_cjs.mapAccessibilityToAria(propGetterReturn.accessibility);
53
+ const labelProps = getLabelProps();
54
+ const helperProps = getHelperTextProps();
55
+ const errorProps = getErrorMessageProps();
56
+ const handleChange = react.useCallback(
57
+ (event) => {
58
+ onChange?.(event.target.value);
59
+ },
60
+ [onChange]
61
+ );
62
+ const dataState = isInvalid ? "invalid" : isDisabled ? "disabled" : void 0;
63
+ return /* @__PURE__ */ jsxRuntime.jsxs(
64
+ "div",
65
+ {
66
+ className: chunk5DKE5YQD_cjs.cn("entropix-input-wrapper", className),
67
+ "data-state": dataState,
68
+ "data-variant": variant,
69
+ "data-size": size,
70
+ children: [
71
+ label && /* @__PURE__ */ jsxRuntime.jsxs(
72
+ "label",
73
+ {
74
+ className: "entropix-input-label",
75
+ id: labelProps.id,
76
+ htmlFor: labelProps.htmlFor,
77
+ children: [
78
+ label,
79
+ isRequired && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "entropix-input-required", children: "*" })
80
+ ]
81
+ }
82
+ ),
83
+ /* @__PURE__ */ jsxRuntime.jsx(
84
+ "input",
85
+ {
86
+ ref,
87
+ className: "entropix-input",
88
+ ...ariaProps,
89
+ ...rest,
90
+ type,
91
+ name,
92
+ placeholder,
93
+ value: inputValue,
94
+ onChange: handleChange,
95
+ disabled: isDisabled || void 0,
96
+ readOnly: isReadOnly || void 0,
97
+ "data-state": dataState,
98
+ "data-variant": variant,
99
+ "data-size": size
100
+ }
101
+ ),
102
+ isInvalid && errorMessage ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "entropix-input-error", ...errorProps, children: errorMessage }) : helperText ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "entropix-input-helper", ...helperProps, children: helperText }) : null
103
+ ]
104
+ }
105
+ );
106
+ });
107
+
108
+ exports.Input = Input;
109
+ //# sourceMappingURL=chunk-EASSPJBG.cjs.map
110
+ //# sourceMappingURL=chunk-EASSPJBG.cjs.map
@@ -0,0 +1,94 @@
1
+ 'use strict';
2
+
3
+ var chunkLDOP6DVX_cjs = require('./chunk-LDOP6DVX.cjs');
4
+ var chunkLJK6KK2H_cjs = require('./chunk-LJK6KK2H.cjs');
5
+ var chunk5DKE5YQD_cjs = require('./chunk-5DKE5YQD.cjs');
6
+ var core = require('@entropix/core');
7
+ var react = require('react');
8
+ var jsxRuntime = require('react/jsx-runtime');
9
+
10
+ var AccordionContext = react.createContext(null);
11
+ function useAccordionContext() {
12
+ const context = react.useContext(AccordionContext);
13
+ if (!context) {
14
+ throw new Error(
15
+ "Accordion compound components must be used within an <Accordion> provider."
16
+ );
17
+ }
18
+ return context;
19
+ }
20
+ var AccordionItemContext = react.createContext(null);
21
+ function useAccordionItemContext() {
22
+ const context = react.useContext(AccordionItemContext);
23
+ if (context === null) {
24
+ throw new Error(
25
+ "AccordionTrigger and AccordionPanel must be used within an <AccordionItem>."
26
+ );
27
+ }
28
+ return context;
29
+ }
30
+ function Accordion({ children, className, ...options }) {
31
+ const accordion = core.useAccordion(options);
32
+ return /* @__PURE__ */ jsxRuntime.jsx(AccordionContext.Provider, { value: accordion, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunk5DKE5YQD_cjs.cn("entropix-accordion", className), children }) });
33
+ }
34
+ function AccordionItem({
35
+ value,
36
+ children,
37
+ className
38
+ }) {
39
+ const { isExpanded } = useAccordionContext();
40
+ return /* @__PURE__ */ jsxRuntime.jsx(AccordionItemContext.Provider, { value, children: /* @__PURE__ */ jsxRuntime.jsx(
41
+ "div",
42
+ {
43
+ className: chunk5DKE5YQD_cjs.cn("entropix-accordion-item", className),
44
+ "data-state": isExpanded(value) ? "open" : "closed",
45
+ children
46
+ }
47
+ ) });
48
+ }
49
+ function AccordionTrigger({
50
+ children,
51
+ className
52
+ }) {
53
+ const itemKey = useAccordionItemContext();
54
+ const { getItemTriggerProps, toggle } = useAccordionContext();
55
+ const propGetterReturn = getItemTriggerProps(itemKey);
56
+ const ariaProps = chunkLJK6KK2H_cjs.mapAccessibilityToAria(propGetterReturn.accessibility);
57
+ const triggerId = propGetterReturn.accessibility.controls ? String(propGetterReturn.accessibility.controls).replace("panel-", "trigger-") : void 0;
58
+ const handleClick = react.useCallback(() => {
59
+ propGetterReturn.onAction?.();
60
+ }, [propGetterReturn.onAction]);
61
+ const onKeyDown = chunkLDOP6DVX_cjs.useKeyboardHandler(propGetterReturn.keyboardConfig, {
62
+ activate: () => toggle(itemKey)
63
+ });
64
+ return /* @__PURE__ */ jsxRuntime.jsx(
65
+ "button",
66
+ {
67
+ ...ariaProps,
68
+ id: triggerId,
69
+ className: chunk5DKE5YQD_cjs.cn("entropix-accordion-trigger", className),
70
+ onClick: handleClick,
71
+ onKeyDown,
72
+ children
73
+ }
74
+ );
75
+ }
76
+ function AccordionPanel({ children, className }) {
77
+ const itemKey = useAccordionItemContext();
78
+ const { getItemPanelProps, isExpanded } = useAccordionContext();
79
+ const propGetterReturn = getItemPanelProps(itemKey);
80
+ const ariaProps = chunkLJK6KK2H_cjs.mapAccessibilityToAria(propGetterReturn.accessibility);
81
+ const panelId = propGetterReturn.accessibility.labelledBy ? String(propGetterReturn.accessibility.labelledBy).replace(
82
+ "trigger-",
83
+ "panel-"
84
+ ) : void 0;
85
+ if (!isExpanded(itemKey)) return null;
86
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ...ariaProps, id: panelId, className: chunk5DKE5YQD_cjs.cn("entropix-accordion-panel", className), "data-state": "open", children });
87
+ }
88
+
89
+ exports.Accordion = Accordion;
90
+ exports.AccordionItem = AccordionItem;
91
+ exports.AccordionPanel = AccordionPanel;
92
+ exports.AccordionTrigger = AccordionTrigger;
93
+ //# sourceMappingURL=chunk-EWY7MSXF.cjs.map
94
+ //# sourceMappingURL=chunk-EWY7MSXF.cjs.map
@@ -0,0 +1,89 @@
1
+ import { useKeyboardHandler } from './chunk-BN57JPKV.js';
2
+ import { mapAccessibilityToAria } from './chunk-Y2M2LJGJ.js';
3
+ import { cn } from './chunk-6UAQCHIW.js';
4
+ import { useAccordion } from '@entropix/core';
5
+ import { createContext, useCallback, useContext } from 'react';
6
+ import { jsx } from 'react/jsx-runtime';
7
+
8
+ var AccordionContext = createContext(null);
9
+ function useAccordionContext() {
10
+ const context = useContext(AccordionContext);
11
+ if (!context) {
12
+ throw new Error(
13
+ "Accordion compound components must be used within an <Accordion> provider."
14
+ );
15
+ }
16
+ return context;
17
+ }
18
+ var AccordionItemContext = createContext(null);
19
+ function useAccordionItemContext() {
20
+ const context = useContext(AccordionItemContext);
21
+ if (context === null) {
22
+ throw new Error(
23
+ "AccordionTrigger and AccordionPanel must be used within an <AccordionItem>."
24
+ );
25
+ }
26
+ return context;
27
+ }
28
+ function Accordion({ children, className, ...options }) {
29
+ const accordion = useAccordion(options);
30
+ return /* @__PURE__ */ jsx(AccordionContext.Provider, { value: accordion, children: /* @__PURE__ */ jsx("div", { className: cn("entropix-accordion", className), children }) });
31
+ }
32
+ function AccordionItem({
33
+ value,
34
+ children,
35
+ className
36
+ }) {
37
+ const { isExpanded } = useAccordionContext();
38
+ return /* @__PURE__ */ jsx(AccordionItemContext.Provider, { value, children: /* @__PURE__ */ jsx(
39
+ "div",
40
+ {
41
+ className: cn("entropix-accordion-item", className),
42
+ "data-state": isExpanded(value) ? "open" : "closed",
43
+ children
44
+ }
45
+ ) });
46
+ }
47
+ function AccordionTrigger({
48
+ children,
49
+ className
50
+ }) {
51
+ const itemKey = useAccordionItemContext();
52
+ const { getItemTriggerProps, toggle } = useAccordionContext();
53
+ const propGetterReturn = getItemTriggerProps(itemKey);
54
+ const ariaProps = mapAccessibilityToAria(propGetterReturn.accessibility);
55
+ const triggerId = propGetterReturn.accessibility.controls ? String(propGetterReturn.accessibility.controls).replace("panel-", "trigger-") : void 0;
56
+ const handleClick = useCallback(() => {
57
+ propGetterReturn.onAction?.();
58
+ }, [propGetterReturn.onAction]);
59
+ const onKeyDown = useKeyboardHandler(propGetterReturn.keyboardConfig, {
60
+ activate: () => toggle(itemKey)
61
+ });
62
+ return /* @__PURE__ */ jsx(
63
+ "button",
64
+ {
65
+ ...ariaProps,
66
+ id: triggerId,
67
+ className: cn("entropix-accordion-trigger", className),
68
+ onClick: handleClick,
69
+ onKeyDown,
70
+ children
71
+ }
72
+ );
73
+ }
74
+ function AccordionPanel({ children, className }) {
75
+ const itemKey = useAccordionItemContext();
76
+ const { getItemPanelProps, isExpanded } = useAccordionContext();
77
+ const propGetterReturn = getItemPanelProps(itemKey);
78
+ const ariaProps = mapAccessibilityToAria(propGetterReturn.accessibility);
79
+ const panelId = propGetterReturn.accessibility.labelledBy ? String(propGetterReturn.accessibility.labelledBy).replace(
80
+ "trigger-",
81
+ "panel-"
82
+ ) : void 0;
83
+ if (!isExpanded(itemKey)) return null;
84
+ return /* @__PURE__ */ jsx("div", { ...ariaProps, id: panelId, className: cn("entropix-accordion-panel", className), "data-state": "open", children });
85
+ }
86
+
87
+ export { Accordion, AccordionItem, AccordionPanel, AccordionTrigger };
88
+ //# sourceMappingURL=chunk-FJGLK3I4.js.map
89
+ //# sourceMappingURL=chunk-FJGLK3I4.js.map
@@ -0,0 +1,88 @@
1
+ import { useKeyboardHandler } from './chunk-BN57JPKV.js';
2
+ import { mapAccessibilityToAria } from './chunk-Y2M2LJGJ.js';
3
+ import { cn } from './chunk-6UAQCHIW.js';
4
+ import { useRadioGroup } from '@entropix/core';
5
+ import { createContext, useMemo, useCallback, useContext } from 'react';
6
+ import { jsx, jsxs } from 'react/jsx-runtime';
7
+
8
+ var RadioContext = createContext(null);
9
+ function useRadioContext() {
10
+ const context = useContext(RadioContext);
11
+ if (!context) {
12
+ throw new Error(
13
+ "Radio compound components must be used within a <RadioGroup> provider."
14
+ );
15
+ }
16
+ return context;
17
+ }
18
+ function RadioGroup({
19
+ children,
20
+ label,
21
+ className,
22
+ ...options
23
+ }) {
24
+ const radioGroup = useRadioGroup(options);
25
+ const propGetterReturn = radioGroup.getRadioGroupProps();
26
+ const ariaProps = mapAccessibilityToAria(propGetterReturn.accessibility);
27
+ if (label) {
28
+ ariaProps["aria-label"] = label;
29
+ }
30
+ return /* @__PURE__ */ jsx(RadioContext.Provider, { value: radioGroup, children: /* @__PURE__ */ jsx(
31
+ "div",
32
+ {
33
+ ...ariaProps,
34
+ className: cn("entropix-radio-group", className),
35
+ "data-orientation": options.orientation ?? "vertical",
36
+ children
37
+ }
38
+ ) });
39
+ }
40
+ function RadioItem({
41
+ value,
42
+ disabled,
43
+ label,
44
+ children,
45
+ className
46
+ }) {
47
+ const { getRadioProps, selectedValue } = useRadioContext();
48
+ const propGetterReturn = getRadioProps(value, { disabled });
49
+ const ariaProps = mapAccessibilityToAria(propGetterReturn.accessibility);
50
+ const isChecked = value === selectedValue;
51
+ const actionMap = useMemo(
52
+ () => ({}),
53
+ []
54
+ );
55
+ const onKeyDown = useKeyboardHandler(
56
+ propGetterReturn.keyboardConfig,
57
+ actionMap
58
+ );
59
+ const handleClick = useCallback(() => {
60
+ propGetterReturn.onAction?.();
61
+ }, [propGetterReturn.onAction]);
62
+ return /* @__PURE__ */ jsxs(
63
+ "button",
64
+ {
65
+ type: "button",
66
+ ...ariaProps,
67
+ className: cn("entropix-radio-item", className),
68
+ onClick: handleClick,
69
+ onKeyDown,
70
+ "data-state": isChecked ? "checked" : "unchecked",
71
+ "data-disabled": disabled || void 0,
72
+ children: [
73
+ /* @__PURE__ */ jsx(
74
+ "span",
75
+ {
76
+ className: "entropix-radio-item__indicator",
77
+ "data-state": isChecked ? "checked" : "unchecked"
78
+ }
79
+ ),
80
+ (label || children) && /* @__PURE__ */ jsx("span", { className: "entropix-radio-item__label", children: label || children })
81
+ ]
82
+ }
83
+ );
84
+ }
85
+
86
+ export { RadioGroup, RadioItem };
87
+ //# sourceMappingURL=chunk-GTVBKK3W.js.map
88
+ //# sourceMappingURL=chunk-GTVBKK3W.js.map
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ var chunkB5JZHE4I_cjs = require('./chunk-B5JZHE4I.cjs');
4
+ var react = require('react');
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+
7
+ var Switch = react.forwardRef(
8
+ function Switch2(props, ref) {
9
+ return /* @__PURE__ */ jsxRuntime.jsx(chunkB5JZHE4I_cjs.ToggleInner, { ...props, ref, role: "switch", componentClass: "entropix-switch" });
10
+ }
11
+ );
12
+
13
+ exports.Switch = Switch;
14
+ //# sourceMappingURL=chunk-GZXXUFCJ.cjs.map
15
+ //# sourceMappingURL=chunk-GZXXUFCJ.cjs.map
@@ -0,0 +1,86 @@
1
+ 'use strict';
2
+
3
+ var chunkLDOP6DVX_cjs = require('./chunk-LDOP6DVX.cjs');
4
+ var chunkLJK6KK2H_cjs = require('./chunk-LJK6KK2H.cjs');
5
+ var chunk5DKE5YQD_cjs = require('./chunk-5DKE5YQD.cjs');
6
+ var react = require('react');
7
+ var core = require('@entropix/core');
8
+ var jsxRuntime = require('react/jsx-runtime');
9
+
10
+ var Button = react.forwardRef(function Button2({
11
+ disabled,
12
+ loading,
13
+ onPress,
14
+ as: Component = "button",
15
+ variant,
16
+ size,
17
+ className,
18
+ style,
19
+ children,
20
+ onClick,
21
+ onKeyDown: externalOnKeyDown,
22
+ ...rest
23
+ }, ref) {
24
+ const elementType = typeof Component === "string" ? Component : "div";
25
+ const { isDisabled, isLoading, getButtonProps } = core.useButton({
26
+ disabled,
27
+ loading,
28
+ onPress,
29
+ elementType
30
+ });
31
+ const propGetterReturn = getButtonProps();
32
+ const ariaProps = chunkLJK6KK2H_cjs.mapAccessibilityToAria(propGetterReturn.accessibility);
33
+ const actionMap = react.useMemo(
34
+ () => ({
35
+ activate: propGetterReturn.onAction ?? (() => {
36
+ })
37
+ }),
38
+ [propGetterReturn.onAction]
39
+ );
40
+ const onKeyDown = chunkLDOP6DVX_cjs.useKeyboardHandler(
41
+ propGetterReturn.keyboardConfig,
42
+ actionMap
43
+ );
44
+ const handleClick = react.useCallback(
45
+ (event) => {
46
+ propGetterReturn.onAction?.();
47
+ onClick?.(event);
48
+ },
49
+ [propGetterReturn.onAction, onClick]
50
+ );
51
+ const handleKeyDown = react.useCallback(
52
+ (event) => {
53
+ onKeyDown?.(event);
54
+ externalOnKeyDown?.(event);
55
+ },
56
+ [onKeyDown, externalOnKeyDown]
57
+ );
58
+ const dataState = isLoading ? "loading" : isDisabled ? "disabled" : void 0;
59
+ return /* @__PURE__ */ jsxRuntime.jsx(
60
+ Component,
61
+ {
62
+ ref,
63
+ className: chunk5DKE5YQD_cjs.cn(
64
+ "entropix-button",
65
+ variant && `entropix-button--${variant}`,
66
+ size && `entropix-button--${size}`,
67
+ className
68
+ ),
69
+ style,
70
+ ...ariaProps,
71
+ ...rest,
72
+ type: Component === "button" ? "button" : void 0,
73
+ disabled: Component === "button" && isDisabled ? true : void 0,
74
+ onClick: propGetterReturn.onAction || onClick ? handleClick : void 0,
75
+ onKeyDown: onKeyDown || externalOnKeyDown ? handleKeyDown : void 0,
76
+ "data-state": dataState,
77
+ "data-variant": variant,
78
+ "data-size": size,
79
+ children
80
+ }
81
+ );
82
+ });
83
+
84
+ exports.Button = Button;
85
+ //# sourceMappingURL=chunk-IXH7OVN3.cjs.map
86
+ //# sourceMappingURL=chunk-IXH7OVN3.cjs.map