lecom-ui 4.1.8 → 4.2.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 (152) hide show
  1. package/dist/_virtual/_commonjsHelpers.js +5 -0
  2. package/dist/_virtual/index.js +7 -0
  3. package/dist/components/Accordion/Accordion.js +40 -37
  4. package/dist/components/Button/Button.js +10 -9
  5. package/dist/components/Button/CustomButton.js +6 -5
  6. package/dist/components/Card/Card.js +7 -6
  7. package/dist/components/Checkbox/Checkbox.js +35 -30
  8. package/dist/components/CustomIcon/Icons/CadastroFacil.js +15 -5
  9. package/dist/components/CustomIcon/Icons/LogoLecom.js +15 -12
  10. package/dist/components/CustomIcon/Icons/LogoLecomBrand.js +8 -5
  11. package/dist/components/CustomIcon/Icons/ModoTeste.js +13 -5
  12. package/dist/components/CustomIcon/Icons/Rpa.js +17 -5
  13. package/dist/components/DataTable/DataTable.js +33 -127
  14. package/dist/components/Dialog/Dialog.js +40 -31
  15. package/dist/components/DropdownMenu/DropdownMenu.js +55 -46
  16. package/dist/components/Header/Header.js +51 -35
  17. package/dist/components/Header/HelpMenu.js +52 -41
  18. package/dist/components/Header/ImgBrand.js +5 -8
  19. package/dist/components/Header/ModulesMenu.js +63 -50
  20. package/dist/components/Header/SocialMenu.js +5 -6
  21. package/dist/components/Header/UserMenu.js +81 -51
  22. package/dist/components/Input/Input.js +11 -2
  23. package/dist/components/Layout/Layout.js +62 -45
  24. package/dist/components/Notification/Notification.js +9 -8
  25. package/dist/components/Notification/NotificationBase.js +5 -5
  26. package/dist/components/Notification/NotificationCallout.js +33 -27
  27. package/dist/components/Notification/NotificationCloseButton.js +4 -3
  28. package/dist/components/Notification/NotificationContent.js +24 -18
  29. package/dist/components/Notification/NotificationIcon.js +9 -6
  30. package/dist/components/Notification/NotificationInline.js +23 -20
  31. package/dist/components/Notification/NotificationToast.js +28 -25
  32. package/dist/components/Notification/useNotificationToast.js +0 -1
  33. package/dist/components/Popover/Popover.js +8 -7
  34. package/dist/components/ScrollArea/ScrollArea.js +18 -15
  35. package/dist/components/Select/Select.js +63 -54
  36. package/dist/components/Separator/Separator.js +5 -4
  37. package/dist/components/Sheet/Sheet.js +35 -26
  38. package/dist/components/Sidebar/Sidebar.js +112 -95
  39. package/dist/components/Skeleton/Skeleton.js +2 -2
  40. package/dist/components/Table/Table.js +15 -26
  41. package/dist/components/Tag/Tag.js +6 -5
  42. package/dist/components/Tooltip/Tooltip.js +17 -15
  43. package/dist/components/Typography/Typography.js +6 -7
  44. package/dist/hooks/use-mobile.js +1 -1
  45. package/dist/i18n/index.js +4 -53
  46. package/dist/i18n/locales/en_us.js +4 -3
  47. package/dist/i18n/locales/es_es.js +4 -3
  48. package/dist/i18n/locales/index.js +4 -4
  49. package/dist/i18n/locales/pt_br.js +4 -3
  50. package/dist/index.d.ts +108 -304
  51. package/dist/index.js +1 -12
  52. package/dist/lib/utils.js +2 -2
  53. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +806 -0
  54. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +726 -0
  55. package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +347 -0
  56. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +154 -0
  57. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +136 -0
  58. package/dist/node_modules/@radix-ui/number/dist/index.js +6 -0
  59. package/dist/node_modules/@radix-ui/primitive/dist/index.js +11 -0
  60. package/dist/node_modules/@radix-ui/react-accordion/dist/index.js +303 -0
  61. package/dist/node_modules/@radix-ui/react-arrow/dist/index.js +25 -0
  62. package/dist/node_modules/@radix-ui/react-checkbox/dist/index.js +157 -0
  63. package/dist/node_modules/@radix-ui/react-collapsible/dist/index.js +144 -0
  64. package/dist/node_modules/@radix-ui/react-collection/dist/index.js +68 -0
  65. package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +39 -0
  66. package/dist/node_modules/@radix-ui/react-context/dist/index.js +79 -0
  67. package/dist/node_modules/@radix-ui/react-dialog/dist/index.js +319 -0
  68. package/dist/node_modules/@radix-ui/react-direction/dist/index.js +11 -0
  69. package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +211 -0
  70. package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +265 -0
  71. package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +29 -0
  72. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +207 -0
  73. package/dist/node_modules/@radix-ui/react-id/dist/index.js +15 -0
  74. package/dist/node_modules/@radix-ui/react-menu/dist/index.js +831 -0
  75. package/dist/node_modules/@radix-ui/react-popover/dist/index.js +296 -0
  76. package/dist/node_modules/@radix-ui/react-popper/dist/index.js +278 -0
  77. package/dist/node_modules/@radix-ui/react-portal/dist/index.js +17 -0
  78. package/dist/node_modules/@radix-ui/react-presence/dist/index.js +130 -0
  79. package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +41 -0
  80. package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.js +220 -0
  81. package/dist/node_modules/@radix-ui/react-scroll-area/dist/index.js +718 -0
  82. package/dist/node_modules/@radix-ui/react-select/dist/index.js +1143 -0
  83. package/dist/node_modules/@radix-ui/react-separator/dist/index.js +30 -0
  84. package/dist/node_modules/@radix-ui/react-slot/dist/index.js +81 -0
  85. package/dist/node_modules/@radix-ui/react-tooltip/dist/index.js +476 -0
  86. package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +12 -0
  87. package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +46 -0
  88. package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +18 -0
  89. package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +7 -0
  90. package/dist/node_modules/@radix-ui/react-use-previous/dist/index.js +15 -0
  91. package/dist/node_modules/@radix-ui/react-use-size/dist/index.js +40 -0
  92. package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.js +35 -0
  93. package/dist/node_modules/@tanstack/react-table/build/lib/index.js +74 -0
  94. package/dist/node_modules/@tanstack/table-core/build/lib/index.js +3023 -0
  95. package/dist/node_modules/aria-hidden/dist/es2015/index.js +136 -0
  96. package/dist/node_modules/class-variance-authority/dist/index.js +44 -0
  97. package/dist/node_modules/clsx/dist/clsx.js +3 -0
  98. package/dist/node_modules/get-nonce/dist/es2015/index.js +8 -0
  99. package/dist/node_modules/hex-color-opacity/lib/index.js +22 -0
  100. package/dist/node_modules/i18next/dist/esm/i18next.js +2228 -0
  101. package/dist/node_modules/lucide-react/dist/esm/Icon.js +44 -0
  102. package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.js +26 -0
  103. package/dist/node_modules/lucide-react/dist/esm/defaultAttributes.js +20 -0
  104. package/dist/node_modules/lucide-react/dist/esm/icons/check.js +13 -0
  105. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-down.js +15 -0
  106. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-right.js +15 -0
  107. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-up.js +13 -0
  108. package/dist/node_modules/lucide-react/dist/esm/icons/circle-alert.js +17 -0
  109. package/dist/node_modules/lucide-react/dist/esm/icons/circle-check.js +16 -0
  110. package/dist/node_modules/lucide-react/dist/esm/icons/circle-help.js +17 -0
  111. package/dist/node_modules/lucide-react/dist/esm/icons/circle.js +15 -0
  112. package/dist/node_modules/lucide-react/dist/esm/icons/info.js +17 -0
  113. package/dist/node_modules/lucide-react/dist/esm/icons/menu.js +17 -0
  114. package/dist/node_modules/lucide-react/dist/esm/icons/message-square.js +15 -0
  115. package/dist/node_modules/lucide-react/dist/esm/icons/minus.js +13 -0
  116. package/dist/node_modules/lucide-react/dist/esm/icons/panel-left.js +16 -0
  117. package/dist/node_modules/lucide-react/dist/esm/icons/triangle-alert.js +23 -0
  118. package/dist/node_modules/lucide-react/dist/esm/icons/user.js +16 -0
  119. package/dist/node_modules/lucide-react/dist/esm/icons/x.js +16 -0
  120. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils.js +13 -0
  121. package/dist/node_modules/react-i18next/dist/es/context.js +18 -0
  122. package/dist/node_modules/react-i18next/dist/es/defaults.js +21 -0
  123. package/dist/node_modules/react-i18next/dist/es/i18nInstance.js +7 -0
  124. package/dist/node_modules/react-i18next/dist/es/initReactI18next.js +12 -0
  125. package/dist/node_modules/react-i18next/dist/es/unescape.js +27 -0
  126. package/dist/node_modules/react-i18next/dist/es/useTranslation.js +112 -0
  127. package/dist/node_modules/react-i18next/dist/es/utils.js +63 -0
  128. package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js +9 -0
  129. package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +160 -0
  130. package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +38 -0
  131. package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +21 -0
  132. package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +109 -0
  133. package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js +5 -0
  134. package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js +7 -0
  135. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js +56 -0
  136. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +10 -0
  137. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +31 -0
  138. package/dist/node_modules/react-style-singleton/dist/es2015/component.js +19 -0
  139. package/dist/node_modules/react-style-singleton/dist/es2015/hook.js +25 -0
  140. package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js +51 -0
  141. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +2493 -0
  142. package/dist/node_modules/tslib/tslib.es6.js +56 -0
  143. package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js +24 -0
  144. package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +48 -0
  145. package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js +42 -0
  146. package/dist/node_modules/use-color-luminance/index.es.js +105 -0
  147. package/dist/node_modules/use-sidecar/dist/es2015/exports.js +21 -0
  148. package/dist/node_modules/use-sidecar/dist/es2015/medium.js +77 -0
  149. package/dist/plugin/typographies.ts +146 -152
  150. package/dist/style.min.css +1 -1
  151. package/dist/utils/cookie.js +9 -6
  152. package/package.json +11 -3
@@ -0,0 +1,303 @@
1
+ import React__default from 'react';
2
+ import { createContextScope } from '../../react-context/dist/index.js';
3
+ import { createCollection } from '../../react-collection/dist/index.js';
4
+ import { useComposedRefs } from '../../react-compose-refs/dist/index.js';
5
+ import { composeEventHandlers } from '../../primitive/dist/index.js';
6
+ import { useControllableState } from '../../react-use-controllable-state/dist/index.js';
7
+ import { Primitive } from '../../react-primitive/dist/index.js';
8
+ import { createCollapsibleScope, Root, Trigger, Content } from '../../react-collapsible/dist/index.js';
9
+ import { useId } from '../../react-id/dist/index.js';
10
+ import { useDirection } from '../../react-direction/dist/index.js';
11
+ import { jsx } from 'react/jsx-runtime';
12
+
13
+ var ACCORDION_NAME = "Accordion";
14
+ var ACCORDION_KEYS = ["Home", "End", "ArrowDown", "ArrowUp", "ArrowLeft", "ArrowRight"];
15
+ var [Collection, useCollection, createCollectionScope] = createCollection(ACCORDION_NAME);
16
+ var [createAccordionContext, createAccordionScope] = createContextScope(ACCORDION_NAME, [
17
+ createCollectionScope,
18
+ createCollapsibleScope
19
+ ]);
20
+ var useCollapsibleScope = createCollapsibleScope();
21
+ var Accordion = React__default.forwardRef(
22
+ (props, forwardedRef) => {
23
+ const { type, ...accordionProps } = props;
24
+ const singleProps = accordionProps;
25
+ const multipleProps = accordionProps;
26
+ return /* @__PURE__ */ jsx(Collection.Provider, { scope: props.__scopeAccordion, children: type === "multiple" ? /* @__PURE__ */ jsx(AccordionImplMultiple, { ...multipleProps, ref: forwardedRef }) : /* @__PURE__ */ jsx(AccordionImplSingle, { ...singleProps, ref: forwardedRef }) });
27
+ }
28
+ );
29
+ Accordion.displayName = ACCORDION_NAME;
30
+ var [AccordionValueProvider, useAccordionValueContext] = createAccordionContext(ACCORDION_NAME);
31
+ var [AccordionCollapsibleProvider, useAccordionCollapsibleContext] = createAccordionContext(
32
+ ACCORDION_NAME,
33
+ { collapsible: false }
34
+ );
35
+ var AccordionImplSingle = React__default.forwardRef(
36
+ (props, forwardedRef) => {
37
+ const {
38
+ value: valueProp,
39
+ defaultValue,
40
+ onValueChange = () => {
41
+ },
42
+ collapsible = false,
43
+ ...accordionSingleProps
44
+ } = props;
45
+ const [value, setValue] = useControllableState({
46
+ prop: valueProp,
47
+ defaultProp: defaultValue,
48
+ onChange: onValueChange
49
+ });
50
+ return /* @__PURE__ */ jsx(
51
+ AccordionValueProvider,
52
+ {
53
+ scope: props.__scopeAccordion,
54
+ value: value ? [value] : [],
55
+ onItemOpen: setValue,
56
+ onItemClose: React__default.useCallback(() => collapsible && setValue(""), [collapsible, setValue]),
57
+ children: /* @__PURE__ */ jsx(AccordionCollapsibleProvider, { scope: props.__scopeAccordion, collapsible, children: /* @__PURE__ */ jsx(AccordionImpl, { ...accordionSingleProps, ref: forwardedRef }) })
58
+ }
59
+ );
60
+ }
61
+ );
62
+ var AccordionImplMultiple = React__default.forwardRef((props, forwardedRef) => {
63
+ const {
64
+ value: valueProp,
65
+ defaultValue,
66
+ onValueChange = () => {
67
+ },
68
+ ...accordionMultipleProps
69
+ } = props;
70
+ const [value = [], setValue] = useControllableState({
71
+ prop: valueProp,
72
+ defaultProp: defaultValue,
73
+ onChange: onValueChange
74
+ });
75
+ const handleItemOpen = React__default.useCallback(
76
+ (itemValue) => setValue((prevValue = []) => [...prevValue, itemValue]),
77
+ [setValue]
78
+ );
79
+ const handleItemClose = React__default.useCallback(
80
+ (itemValue) => setValue((prevValue = []) => prevValue.filter((value2) => value2 !== itemValue)),
81
+ [setValue]
82
+ );
83
+ return /* @__PURE__ */ jsx(
84
+ AccordionValueProvider,
85
+ {
86
+ scope: props.__scopeAccordion,
87
+ value,
88
+ onItemOpen: handleItemOpen,
89
+ onItemClose: handleItemClose,
90
+ children: /* @__PURE__ */ jsx(AccordionCollapsibleProvider, { scope: props.__scopeAccordion, collapsible: true, children: /* @__PURE__ */ jsx(AccordionImpl, { ...accordionMultipleProps, ref: forwardedRef }) })
91
+ }
92
+ );
93
+ });
94
+ var [AccordionImplProvider, useAccordionContext] = createAccordionContext(ACCORDION_NAME);
95
+ var AccordionImpl = React__default.forwardRef(
96
+ (props, forwardedRef) => {
97
+ const { __scopeAccordion, disabled, dir, orientation = "vertical", ...accordionProps } = props;
98
+ const accordionRef = React__default.useRef(null);
99
+ const composedRefs = useComposedRefs(accordionRef, forwardedRef);
100
+ const getItems = useCollection(__scopeAccordion);
101
+ const direction = useDirection(dir);
102
+ const isDirectionLTR = direction === "ltr";
103
+ const handleKeyDown = composeEventHandlers(props.onKeyDown, (event) => {
104
+ if (!ACCORDION_KEYS.includes(event.key)) return;
105
+ const target = event.target;
106
+ const triggerCollection = getItems().filter((item) => !item.ref.current?.disabled);
107
+ const triggerIndex = triggerCollection.findIndex((item) => item.ref.current === target);
108
+ const triggerCount = triggerCollection.length;
109
+ if (triggerIndex === -1) return;
110
+ event.preventDefault();
111
+ let nextIndex = triggerIndex;
112
+ const homeIndex = 0;
113
+ const endIndex = triggerCount - 1;
114
+ const moveNext = () => {
115
+ nextIndex = triggerIndex + 1;
116
+ if (nextIndex > endIndex) {
117
+ nextIndex = homeIndex;
118
+ }
119
+ };
120
+ const movePrev = () => {
121
+ nextIndex = triggerIndex - 1;
122
+ if (nextIndex < homeIndex) {
123
+ nextIndex = endIndex;
124
+ }
125
+ };
126
+ switch (event.key) {
127
+ case "Home":
128
+ nextIndex = homeIndex;
129
+ break;
130
+ case "End":
131
+ nextIndex = endIndex;
132
+ break;
133
+ case "ArrowRight":
134
+ if (orientation === "horizontal") {
135
+ if (isDirectionLTR) {
136
+ moveNext();
137
+ } else {
138
+ movePrev();
139
+ }
140
+ }
141
+ break;
142
+ case "ArrowDown":
143
+ if (orientation === "vertical") {
144
+ moveNext();
145
+ }
146
+ break;
147
+ case "ArrowLeft":
148
+ if (orientation === "horizontal") {
149
+ if (isDirectionLTR) {
150
+ movePrev();
151
+ } else {
152
+ moveNext();
153
+ }
154
+ }
155
+ break;
156
+ case "ArrowUp":
157
+ if (orientation === "vertical") {
158
+ movePrev();
159
+ }
160
+ break;
161
+ }
162
+ const clampedIndex = nextIndex % triggerCount;
163
+ triggerCollection[clampedIndex].ref.current?.focus();
164
+ });
165
+ return /* @__PURE__ */ jsx(
166
+ AccordionImplProvider,
167
+ {
168
+ scope: __scopeAccordion,
169
+ disabled,
170
+ direction: dir,
171
+ orientation,
172
+ children: /* @__PURE__ */ jsx(Collection.Slot, { scope: __scopeAccordion, children: /* @__PURE__ */ jsx(
173
+ Primitive.div,
174
+ {
175
+ ...accordionProps,
176
+ "data-orientation": orientation,
177
+ ref: composedRefs,
178
+ onKeyDown: disabled ? void 0 : handleKeyDown
179
+ }
180
+ ) })
181
+ }
182
+ );
183
+ }
184
+ );
185
+ var ITEM_NAME = "AccordionItem";
186
+ var [AccordionItemProvider, useAccordionItemContext] = createAccordionContext(ITEM_NAME);
187
+ var AccordionItem = React__default.forwardRef(
188
+ (props, forwardedRef) => {
189
+ const { __scopeAccordion, value, ...accordionItemProps } = props;
190
+ const accordionContext = useAccordionContext(ITEM_NAME, __scopeAccordion);
191
+ const valueContext = useAccordionValueContext(ITEM_NAME, __scopeAccordion);
192
+ const collapsibleScope = useCollapsibleScope(__scopeAccordion);
193
+ const triggerId = useId();
194
+ const open = value && valueContext.value.includes(value) || false;
195
+ const disabled = accordionContext.disabled || props.disabled;
196
+ return /* @__PURE__ */ jsx(
197
+ AccordionItemProvider,
198
+ {
199
+ scope: __scopeAccordion,
200
+ open,
201
+ disabled,
202
+ triggerId,
203
+ children: /* @__PURE__ */ jsx(
204
+ Root,
205
+ {
206
+ "data-orientation": accordionContext.orientation,
207
+ "data-state": getState(open),
208
+ ...collapsibleScope,
209
+ ...accordionItemProps,
210
+ ref: forwardedRef,
211
+ disabled,
212
+ open,
213
+ onOpenChange: (open2) => {
214
+ if (open2) {
215
+ valueContext.onItemOpen(value);
216
+ } else {
217
+ valueContext.onItemClose(value);
218
+ }
219
+ }
220
+ }
221
+ )
222
+ }
223
+ );
224
+ }
225
+ );
226
+ AccordionItem.displayName = ITEM_NAME;
227
+ var HEADER_NAME = "AccordionHeader";
228
+ var AccordionHeader = React__default.forwardRef(
229
+ (props, forwardedRef) => {
230
+ const { __scopeAccordion, ...headerProps } = props;
231
+ const accordionContext = useAccordionContext(ACCORDION_NAME, __scopeAccordion);
232
+ const itemContext = useAccordionItemContext(HEADER_NAME, __scopeAccordion);
233
+ return /* @__PURE__ */ jsx(
234
+ Primitive.h3,
235
+ {
236
+ "data-orientation": accordionContext.orientation,
237
+ "data-state": getState(itemContext.open),
238
+ "data-disabled": itemContext.disabled ? "" : void 0,
239
+ ...headerProps,
240
+ ref: forwardedRef
241
+ }
242
+ );
243
+ }
244
+ );
245
+ AccordionHeader.displayName = HEADER_NAME;
246
+ var TRIGGER_NAME = "AccordionTrigger";
247
+ var AccordionTrigger = React__default.forwardRef(
248
+ (props, forwardedRef) => {
249
+ const { __scopeAccordion, ...triggerProps } = props;
250
+ const accordionContext = useAccordionContext(ACCORDION_NAME, __scopeAccordion);
251
+ const itemContext = useAccordionItemContext(TRIGGER_NAME, __scopeAccordion);
252
+ const collapsibleContext = useAccordionCollapsibleContext(TRIGGER_NAME, __scopeAccordion);
253
+ const collapsibleScope = useCollapsibleScope(__scopeAccordion);
254
+ return /* @__PURE__ */ jsx(Collection.ItemSlot, { scope: __scopeAccordion, children: /* @__PURE__ */ jsx(
255
+ Trigger,
256
+ {
257
+ "aria-disabled": itemContext.open && !collapsibleContext.collapsible || void 0,
258
+ "data-orientation": accordionContext.orientation,
259
+ id: itemContext.triggerId,
260
+ ...collapsibleScope,
261
+ ...triggerProps,
262
+ ref: forwardedRef
263
+ }
264
+ ) });
265
+ }
266
+ );
267
+ AccordionTrigger.displayName = TRIGGER_NAME;
268
+ var CONTENT_NAME = "AccordionContent";
269
+ var AccordionContent = React__default.forwardRef(
270
+ (props, forwardedRef) => {
271
+ const { __scopeAccordion, ...contentProps } = props;
272
+ const accordionContext = useAccordionContext(ACCORDION_NAME, __scopeAccordion);
273
+ const itemContext = useAccordionItemContext(CONTENT_NAME, __scopeAccordion);
274
+ const collapsibleScope = useCollapsibleScope(__scopeAccordion);
275
+ return /* @__PURE__ */ jsx(
276
+ Content,
277
+ {
278
+ role: "region",
279
+ "aria-labelledby": itemContext.triggerId,
280
+ "data-orientation": accordionContext.orientation,
281
+ ...collapsibleScope,
282
+ ...contentProps,
283
+ ref: forwardedRef,
284
+ style: {
285
+ ["--radix-accordion-content-height"]: "var(--radix-collapsible-content-height)",
286
+ ["--radix-accordion-content-width"]: "var(--radix-collapsible-content-width)",
287
+ ...props.style
288
+ }
289
+ }
290
+ );
291
+ }
292
+ );
293
+ AccordionContent.displayName = CONTENT_NAME;
294
+ function getState(open) {
295
+ return open ? "open" : "closed";
296
+ }
297
+ var Root2 = Accordion;
298
+ var Item = AccordionItem;
299
+ var Header = AccordionHeader;
300
+ var Trigger2 = AccordionTrigger;
301
+ var Content2 = AccordionContent;
302
+
303
+ export { Accordion, AccordionContent, AccordionHeader, AccordionItem, AccordionTrigger, Content2 as Content, Header, Item, Root2 as Root, Trigger2 as Trigger, createAccordionScope };
@@ -0,0 +1,25 @@
1
+ import * as React from 'react';
2
+ import { Primitive } from '../../react-primitive/dist/index.js';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ // packages/react/arrow/src/arrow.tsx
6
+ var NAME = "Arrow";
7
+ var Arrow = React.forwardRef((props, forwardedRef) => {
8
+ const { children, width = 10, height = 5, ...arrowProps } = props;
9
+ return /* @__PURE__ */ jsx(
10
+ Primitive.svg,
11
+ {
12
+ ...arrowProps,
13
+ ref: forwardedRef,
14
+ width,
15
+ height,
16
+ viewBox: "0 0 30 10",
17
+ preserveAspectRatio: "none",
18
+ children: props.asChild ? children : /* @__PURE__ */ jsx("polygon", { points: "0,0 30,0 15,10" })
19
+ }
20
+ );
21
+ });
22
+ Arrow.displayName = NAME;
23
+ var Root = Arrow;
24
+
25
+ export { Arrow, Root };
@@ -0,0 +1,157 @@
1
+ import * as React from 'react';
2
+ import { useComposedRefs } from '../../react-compose-refs/dist/index.js';
3
+ import { createContextScope } from '../../react-context/dist/index.js';
4
+ import { composeEventHandlers } from '../../primitive/dist/index.js';
5
+ import { useControllableState } from '../../react-use-controllable-state/dist/index.js';
6
+ import { usePrevious } from '../../react-use-previous/dist/index.js';
7
+ import { useSize } from '../../react-use-size/dist/index.js';
8
+ import { Presence } from '../../react-presence/dist/index.js';
9
+ import { Primitive } from '../../react-primitive/dist/index.js';
10
+ import { jsxs, jsx } from 'react/jsx-runtime';
11
+
12
+ var CHECKBOX_NAME = "Checkbox";
13
+ var [createCheckboxContext, createCheckboxScope] = createContextScope(CHECKBOX_NAME);
14
+ var [CheckboxProvider, useCheckboxContext] = createCheckboxContext(CHECKBOX_NAME);
15
+ var Checkbox = React.forwardRef(
16
+ (props, forwardedRef) => {
17
+ const {
18
+ __scopeCheckbox,
19
+ name,
20
+ checked: checkedProp,
21
+ defaultChecked,
22
+ required,
23
+ disabled,
24
+ value = "on",
25
+ onCheckedChange,
26
+ form,
27
+ ...checkboxProps
28
+ } = props;
29
+ const [button, setButton] = React.useState(null);
30
+ const composedRefs = useComposedRefs(forwardedRef, (node) => setButton(node));
31
+ const hasConsumerStoppedPropagationRef = React.useRef(false);
32
+ const isFormControl = button ? form || !!button.closest("form") : true;
33
+ const [checked = false, setChecked] = useControllableState({
34
+ prop: checkedProp,
35
+ defaultProp: defaultChecked,
36
+ onChange: onCheckedChange
37
+ });
38
+ const initialCheckedStateRef = React.useRef(checked);
39
+ React.useEffect(() => {
40
+ const form2 = button?.form;
41
+ if (form2) {
42
+ const reset = () => setChecked(initialCheckedStateRef.current);
43
+ form2.addEventListener("reset", reset);
44
+ return () => form2.removeEventListener("reset", reset);
45
+ }
46
+ }, [button, setChecked]);
47
+ return /* @__PURE__ */ jsxs(CheckboxProvider, { scope: __scopeCheckbox, state: checked, disabled, children: [
48
+ /* @__PURE__ */ jsx(
49
+ Primitive.button,
50
+ {
51
+ type: "button",
52
+ role: "checkbox",
53
+ "aria-checked": isIndeterminate(checked) ? "mixed" : checked,
54
+ "aria-required": required,
55
+ "data-state": getState(checked),
56
+ "data-disabled": disabled ? "" : void 0,
57
+ disabled,
58
+ value,
59
+ ...checkboxProps,
60
+ ref: composedRefs,
61
+ onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
62
+ if (event.key === "Enter") event.preventDefault();
63
+ }),
64
+ onClick: composeEventHandlers(props.onClick, (event) => {
65
+ setChecked((prevChecked) => isIndeterminate(prevChecked) ? true : !prevChecked);
66
+ if (isFormControl) {
67
+ hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
68
+ if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
69
+ }
70
+ })
71
+ }
72
+ ),
73
+ isFormControl && /* @__PURE__ */ jsx(
74
+ BubbleInput,
75
+ {
76
+ control: button,
77
+ bubbles: !hasConsumerStoppedPropagationRef.current,
78
+ name,
79
+ value,
80
+ checked,
81
+ required,
82
+ disabled,
83
+ form,
84
+ style: { transform: "translateX(-100%)" },
85
+ defaultChecked: isIndeterminate(defaultChecked) ? false : defaultChecked
86
+ }
87
+ )
88
+ ] });
89
+ }
90
+ );
91
+ Checkbox.displayName = CHECKBOX_NAME;
92
+ var INDICATOR_NAME = "CheckboxIndicator";
93
+ var CheckboxIndicator = React.forwardRef(
94
+ (props, forwardedRef) => {
95
+ const { __scopeCheckbox, forceMount, ...indicatorProps } = props;
96
+ const context = useCheckboxContext(INDICATOR_NAME, __scopeCheckbox);
97
+ return /* @__PURE__ */ jsx(Presence, { present: forceMount || isIndeterminate(context.state) || context.state === true, children: /* @__PURE__ */ jsx(
98
+ Primitive.span,
99
+ {
100
+ "data-state": getState(context.state),
101
+ "data-disabled": context.disabled ? "" : void 0,
102
+ ...indicatorProps,
103
+ ref: forwardedRef,
104
+ style: { pointerEvents: "none", ...props.style }
105
+ }
106
+ ) });
107
+ }
108
+ );
109
+ CheckboxIndicator.displayName = INDICATOR_NAME;
110
+ var BubbleInput = (props) => {
111
+ const { control, checked, bubbles = true, defaultChecked, ...inputProps } = props;
112
+ const ref = React.useRef(null);
113
+ const prevChecked = usePrevious(checked);
114
+ const controlSize = useSize(control);
115
+ React.useEffect(() => {
116
+ const input = ref.current;
117
+ const inputProto = window.HTMLInputElement.prototype;
118
+ const descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked");
119
+ const setChecked = descriptor.set;
120
+ if (prevChecked !== checked && setChecked) {
121
+ const event = new Event("click", { bubbles });
122
+ input.indeterminate = isIndeterminate(checked);
123
+ setChecked.call(input, isIndeterminate(checked) ? false : checked);
124
+ input.dispatchEvent(event);
125
+ }
126
+ }, [prevChecked, checked, bubbles]);
127
+ const defaultCheckedRef = React.useRef(isIndeterminate(checked) ? false : checked);
128
+ return /* @__PURE__ */ jsx(
129
+ "input",
130
+ {
131
+ type: "checkbox",
132
+ "aria-hidden": true,
133
+ defaultChecked: defaultChecked ?? defaultCheckedRef.current,
134
+ ...inputProps,
135
+ tabIndex: -1,
136
+ ref,
137
+ style: {
138
+ ...props.style,
139
+ ...controlSize,
140
+ position: "absolute",
141
+ pointerEvents: "none",
142
+ opacity: 0,
143
+ margin: 0
144
+ }
145
+ }
146
+ );
147
+ };
148
+ function isIndeterminate(checked) {
149
+ return checked === "indeterminate";
150
+ }
151
+ function getState(checked) {
152
+ return isIndeterminate(checked) ? "indeterminate" : checked ? "checked" : "unchecked";
153
+ }
154
+ var Root = Checkbox;
155
+ var Indicator = CheckboxIndicator;
156
+
157
+ export { Checkbox, CheckboxIndicator, Indicator, Root, createCheckboxScope };
@@ -0,0 +1,144 @@
1
+ import * as React from 'react';
2
+ import { composeEventHandlers } from '../../primitive/dist/index.js';
3
+ import { createContextScope } from '../../react-context/dist/index.js';
4
+ import { useControllableState } from '../../react-use-controllable-state/dist/index.js';
5
+ import { useLayoutEffect as useLayoutEffect2 } from '../../react-use-layout-effect/dist/index.js';
6
+ import { useComposedRefs } from '../../react-compose-refs/dist/index.js';
7
+ import { Primitive } from '../../react-primitive/dist/index.js';
8
+ import { Presence } from '../../react-presence/dist/index.js';
9
+ import { useId } from '../../react-id/dist/index.js';
10
+ import { jsx } from 'react/jsx-runtime';
11
+
12
+ var COLLAPSIBLE_NAME = "Collapsible";
13
+ var [createCollapsibleContext, createCollapsibleScope] = createContextScope(COLLAPSIBLE_NAME);
14
+ var [CollapsibleProvider, useCollapsibleContext] = createCollapsibleContext(COLLAPSIBLE_NAME);
15
+ var Collapsible = React.forwardRef(
16
+ (props, forwardedRef) => {
17
+ const {
18
+ __scopeCollapsible,
19
+ open: openProp,
20
+ defaultOpen,
21
+ disabled,
22
+ onOpenChange,
23
+ ...collapsibleProps
24
+ } = props;
25
+ const [open = false, setOpen] = useControllableState({
26
+ prop: openProp,
27
+ defaultProp: defaultOpen,
28
+ onChange: onOpenChange
29
+ });
30
+ return /* @__PURE__ */ jsx(
31
+ CollapsibleProvider,
32
+ {
33
+ scope: __scopeCollapsible,
34
+ disabled,
35
+ contentId: useId(),
36
+ open,
37
+ onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
38
+ children: /* @__PURE__ */ jsx(
39
+ Primitive.div,
40
+ {
41
+ "data-state": getState(open),
42
+ "data-disabled": disabled ? "" : void 0,
43
+ ...collapsibleProps,
44
+ ref: forwardedRef
45
+ }
46
+ )
47
+ }
48
+ );
49
+ }
50
+ );
51
+ Collapsible.displayName = COLLAPSIBLE_NAME;
52
+ var TRIGGER_NAME = "CollapsibleTrigger";
53
+ var CollapsibleTrigger = React.forwardRef(
54
+ (props, forwardedRef) => {
55
+ const { __scopeCollapsible, ...triggerProps } = props;
56
+ const context = useCollapsibleContext(TRIGGER_NAME, __scopeCollapsible);
57
+ return /* @__PURE__ */ jsx(
58
+ Primitive.button,
59
+ {
60
+ type: "button",
61
+ "aria-controls": context.contentId,
62
+ "aria-expanded": context.open || false,
63
+ "data-state": getState(context.open),
64
+ "data-disabled": context.disabled ? "" : void 0,
65
+ disabled: context.disabled,
66
+ ...triggerProps,
67
+ ref: forwardedRef,
68
+ onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
69
+ }
70
+ );
71
+ }
72
+ );
73
+ CollapsibleTrigger.displayName = TRIGGER_NAME;
74
+ var CONTENT_NAME = "CollapsibleContent";
75
+ var CollapsibleContent = React.forwardRef(
76
+ (props, forwardedRef) => {
77
+ const { forceMount, ...contentProps } = props;
78
+ const context = useCollapsibleContext(CONTENT_NAME, props.__scopeCollapsible);
79
+ return /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: ({ present }) => /* @__PURE__ */ jsx(CollapsibleContentImpl, { ...contentProps, ref: forwardedRef, present }) });
80
+ }
81
+ );
82
+ CollapsibleContent.displayName = CONTENT_NAME;
83
+ var CollapsibleContentImpl = React.forwardRef((props, forwardedRef) => {
84
+ const { __scopeCollapsible, present, children, ...contentProps } = props;
85
+ const context = useCollapsibleContext(CONTENT_NAME, __scopeCollapsible);
86
+ const [isPresent, setIsPresent] = React.useState(present);
87
+ const ref = React.useRef(null);
88
+ const composedRefs = useComposedRefs(forwardedRef, ref);
89
+ const heightRef = React.useRef(0);
90
+ const height = heightRef.current;
91
+ const widthRef = React.useRef(0);
92
+ const width = widthRef.current;
93
+ const isOpen = context.open || isPresent;
94
+ const isMountAnimationPreventedRef = React.useRef(isOpen);
95
+ const originalStylesRef = React.useRef(void 0);
96
+ React.useEffect(() => {
97
+ const rAF = requestAnimationFrame(() => isMountAnimationPreventedRef.current = false);
98
+ return () => cancelAnimationFrame(rAF);
99
+ }, []);
100
+ useLayoutEffect2(() => {
101
+ const node = ref.current;
102
+ if (node) {
103
+ originalStylesRef.current = originalStylesRef.current || {
104
+ transitionDuration: node.style.transitionDuration,
105
+ animationName: node.style.animationName
106
+ };
107
+ node.style.transitionDuration = "0s";
108
+ node.style.animationName = "none";
109
+ const rect = node.getBoundingClientRect();
110
+ heightRef.current = rect.height;
111
+ widthRef.current = rect.width;
112
+ if (!isMountAnimationPreventedRef.current) {
113
+ node.style.transitionDuration = originalStylesRef.current.transitionDuration;
114
+ node.style.animationName = originalStylesRef.current.animationName;
115
+ }
116
+ setIsPresent(present);
117
+ }
118
+ }, [context.open, present]);
119
+ return /* @__PURE__ */ jsx(
120
+ Primitive.div,
121
+ {
122
+ "data-state": getState(context.open),
123
+ "data-disabled": context.disabled ? "" : void 0,
124
+ id: context.contentId,
125
+ hidden: !isOpen,
126
+ ...contentProps,
127
+ ref: composedRefs,
128
+ style: {
129
+ [`--radix-collapsible-content-height`]: height ? `${height}px` : void 0,
130
+ [`--radix-collapsible-content-width`]: width ? `${width}px` : void 0,
131
+ ...props.style
132
+ },
133
+ children: isOpen && children
134
+ }
135
+ );
136
+ });
137
+ function getState(open) {
138
+ return open ? "open" : "closed";
139
+ }
140
+ var Root = Collapsible;
141
+ var Trigger = CollapsibleTrigger;
142
+ var Content = CollapsibleContent;
143
+
144
+ export { Collapsible, CollapsibleContent, CollapsibleTrigger, Content, Root, Trigger, createCollapsibleScope };