pentatrion-design 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/main.ts +33 -0
- package/.storybook/manager.ts +8 -0
- package/.storybook/preview-head.html +2 -0
- package/.storybook/preview.ts +26 -0
- package/.storybook/public/bg-map.jpg +0 -0
- package/.storybook/public/favicon-32x32.png +0 -0
- package/.storybook/public/favicon.svg +28 -0
- package/.storybook/public/movies.json +2153 -0
- package/.storybook/public/population.json +1178 -0
- package/.storybook/public/town-74.geojson +8995 -0
- package/.storybook/public/town-74.json +4062 -0
- package/.storybook/theme.ts +14 -0
- package/Makefile +14 -0
- package/README.md +40 -0
- package/TODO.md +5 -0
- package/dist/index.d.ts +1110 -0
- package/dist/index.js +3707 -0
- package/dist/redux/index.d.ts +43 -0
- package/dist/redux/index.js +583 -0
- package/dist/types.d-DlHa_IaW.d.ts +14 -0
- package/images/logo-shadow.svg +173 -0
- package/images/logo.svg +76 -0
- package/package.json +85 -0
- package/postcss.config.js +7 -0
- package/src/components/autocomplete/Autocomplete.stories.tsx +89 -0
- package/src/components/autocomplete/Autocomplete.tsx +316 -0
- package/src/components/autocomplete/AutocompleteOption.tsx +35 -0
- package/src/components/autocomplete/LazyAutocomplete.tsx +130 -0
- package/src/components/autocomplete/SimpleAutocomplete.tsx +74 -0
- package/src/components/autocomplete/index.ts +6 -0
- package/src/components/autocomplete/useAutocompleteContext.ts +20 -0
- package/src/components/autocomplete/util.ts +19 -0
- package/src/components/badge/Badge.stories.tsx +72 -0
- package/src/components/badge/Badge.tsx +70 -0
- package/src/components/button/Button.stories.tsx +189 -0
- package/src/components/button/Button.test.tsx +20 -0
- package/src/components/button/Button.tsx +200 -0
- package/src/components/button/ButtonGroup.stories.tsx +46 -0
- package/src/components/button/ButtonGroup.tsx +29 -0
- package/src/components/button/index.ts +2 -0
- package/src/components/card/Card.stories.tsx +21 -0
- package/src/components/card/config.ts +4 -0
- package/src/components/card/index.ts +1 -0
- package/src/components/code/Code.tsx +15 -0
- package/src/components/context-menu/ContextMenu.stories.tsx +22 -0
- package/src/components/context-menu/ContextMenu.tsx +175 -0
- package/src/components/context-menu/ContextMenuItem.tsx +34 -0
- package/src/components/context-menu/index.ts +2 -0
- package/src/components/dialog/Dialog.stories.tsx +270 -0
- package/src/components/dialog/Dialog.tsx +46 -0
- package/src/components/dialog/index.ts +1 -0
- package/src/components/dialog/util.ts +29 -0
- package/src/components/dropdown-menu/DropdownMenu.stories.tsx +19 -0
- package/src/components/dropdown-menu/DropdownMenu.tsx +12 -0
- package/src/components/dropdown-menu/DropdownMenuContent.tsx +46 -0
- package/src/components/dropdown-menu/DropdownMenuItem.tsx +33 -0
- package/src/components/dropdown-menu/DropdownMenuTrigger.tsx +42 -0
- package/src/components/dropdown-menu/index.ts +7 -0
- package/src/components/dropdown-menu/interface.d.ts +13 -0
- package/src/components/dropdown-menu/useDropdownMenu.tsx +115 -0
- package/src/components/dropdown-menu/useDropdownMenuContext.ts +16 -0
- package/src/components/dropdown-menu-nested/DropdownMenuNested.stories.tsx +33 -0
- package/src/components/dropdown-menu-nested/DropdownMenuNested.tsx +19 -0
- package/src/components/dropdown-menu-nested/MenuContext.ts +15 -0
- package/src/components/dropdown-menu-nested/MenuItem.tsx +43 -0
- package/src/components/dropdown-menu-nested/MenuItemWithChildren.tsx +204 -0
- package/src/components/dropdown-menu-nested/index.ts +3 -0
- package/src/components/flash/Flash.stories.tsx +34 -0
- package/src/components/flash/Flash.tsx +24 -0
- package/src/components/highlight/Highlight.stories.tsx +128 -0
- package/src/components/highlight/Highlight.tsx +29 -0
- package/src/components/href/Href.stories.tsx +55 -0
- package/src/components/href/Href.tsx +18 -0
- package/src/components/input/Checkbox.stories.tsx +52 -0
- package/src/components/input/Checkbox.tsx +41 -0
- package/src/components/input/Input.stories.tsx +103 -0
- package/src/components/input/Input.test.tsx +10 -0
- package/src/components/input/Input.tsx +60 -0
- package/src/components/input/RadioGroup.stories.tsx +76 -0
- package/src/components/input/RadioGroup.tsx +84 -0
- package/src/components/input/Toggle.stories.tsx +29 -0
- package/src/components/input/Toggle.tsx +35 -0
- package/src/components/input/index.ts +4 -0
- package/src/components/input-field/InputField.stories.tsx +227 -0
- package/src/components/input-field/InputField.tsx +62 -0
- package/src/components/loader/Loader.stories.tsx +37 -0
- package/src/components/loader/Loader.tsx +54 -0
- package/src/components/modal/Components.tsx +58 -0
- package/src/components/modal/Modal.stories.tsx +113 -0
- package/src/components/modal/Modal.tsx +13 -0
- package/src/components/modal/ModalContent.tsx +46 -0
- package/src/components/modal/ModalTrigger.tsx +41 -0
- package/src/components/modal/index.ts +7 -0
- package/src/components/modal/interface.d.ts +10 -0
- package/src/components/modal/useModal.ts +48 -0
- package/src/components/modal/useModalContext.ts +16 -0
- package/src/components/notification/Notification.stories.tsx +51 -0
- package/src/components/notification/NotificationsContext.ts +79 -0
- package/src/components/notification/NotificationsProvider.tsx +58 -0
- package/src/components/notification/index.ts +2 -0
- package/src/components/popover/Components.tsx +45 -0
- package/src/components/popover/Popover.stories.tsx +46 -0
- package/src/components/popover/Popover.test.tsx +21 -0
- package/src/components/popover/Popover.tsx +12 -0
- package/src/components/popover/PopoverContent.tsx +46 -0
- package/src/components/popover/PopoverTrigger.tsx +42 -0
- package/src/components/popover/index.ts +7 -0
- package/src/components/popover/interface.d.ts +13 -0
- package/src/components/popover/usePopover.tsx +80 -0
- package/src/components/popover/usePopoverContext.ts +16 -0
- package/src/components/portal/Portal.tsx +12 -0
- package/src/components/quick-settings/QuickSettings.stories.tsx +182 -0
- package/src/components/resize-area/ResizeArea.stories.css +40 -0
- package/src/components/resize-area/ResizeArea.stories.tsx +30 -0
- package/src/components/resize-area/ResizeArea.tsx +79 -0
- package/src/components/scroll/Scroll.stories.tsx +81 -0
- package/src/components/scroll/Scroll.tsx +111 -0
- package/src/components/select/Select.stories.tsx +248 -0
- package/src/components/select/Select.tsx +362 -0
- package/src/components/select/SelectOption.tsx +29 -0
- package/src/components/select/SelectSelection.tsx +13 -0
- package/src/components/select/index.ts +5 -0
- package/src/components/select/interface.d.ts +36 -0
- package/src/components/select/useSelectContext.ts +19 -0
- package/src/components/select/util.ts +12 -0
- package/src/components/snack/Snack.stories.tsx +33 -0
- package/src/components/snack/Snack.tsx +47 -0
- package/src/components/sortable/Sortable.stories.tsx +98 -0
- package/src/components/sortable/Sortable.tsx +37 -0
- package/src/components/sortable/index.ts +2 -0
- package/src/components/sortable/types.d.ts +12 -0
- package/src/components/steps/Step.tsx +41 -0
- package/src/components/steps/Steps.stories.tsx +141 -0
- package/src/components/steps/Steps.tsx +49 -0
- package/src/components/steps/index.ts +3 -0
- package/src/components/steps/util.ts +3 -0
- package/src/components/table/Table.stories.tsx +36 -0
- package/src/components/table/Table.tsx +13 -0
- package/src/components/table/TableBody.tsx +9 -0
- package/src/components/table/TableCell.tsx +16 -0
- package/src/components/table/TableFooter.tsx +9 -0
- package/src/components/table/TableHeader.tsx +14 -0
- package/src/components/table/TableHeaderCell.tsx +14 -0
- package/src/components/table/TableRow.tsx +14 -0
- package/src/components/table/index.ts +7 -0
- package/src/components/tabs/Tabs.stories.tsx +66 -0
- package/src/components/tabs/Tabs.tsx +80 -0
- package/src/components/tooltip/SimpleTooltip.tsx +17 -0
- package/src/components/tooltip/Tooltip.stories.tsx +129 -0
- package/src/components/tooltip/Tooltip.test.tsx +18 -0
- package/src/components/tooltip/Tooltip.tsx +13 -0
- package/src/components/tooltip/TooltipContent.tsx +41 -0
- package/src/components/tooltip/TooltipTrigger.tsx +36 -0
- package/src/components/tooltip/index.ts +6 -0
- package/src/components/tooltip/interface.d.ts +15 -0
- package/src/components/tooltip/useTooltip.ts +87 -0
- package/src/components/tooltip/useTooltipContext.ts +16 -0
- package/src/env.d.ts +27 -0
- package/src/hooks/index.ts +13 -0
- package/src/hooks/useCombinedRefs.test.tsx +42 -0
- package/src/hooks/useCombinedRefs.ts +21 -0
- package/src/hooks/useCopyToClipboard.ts +28 -0
- package/src/hooks/useDebounce.ts +59 -0
- package/src/hooks/useEventCallback.ts +13 -0
- package/src/hooks/useEventListener.ts +86 -0
- package/src/hooks/useFetch.tsx +21 -0
- package/src/hooks/useIsClosing.ts +25 -0
- package/src/hooks/useIsMounted.tsx +16 -0
- package/src/hooks/useIsomorphicLayoutEffect.ts +4 -0
- package/src/hooks/useNotifications.tsx +13 -0
- package/src/hooks/useOnClickOutside.ts +35 -0
- package/src/hooks/usePrevious.ts +9 -0
- package/src/hooks/useRipple.test.tsx +52 -0
- package/src/hooks/useRipple.tsx +79 -0
- package/src/index.css +14 -0
- package/src/index.ts +39 -0
- package/src/lib/arrUtil.ts +8 -0
- package/src/lib/error.ts +18 -0
- package/src/lib/fetch.test.ts +107 -0
- package/src/lib/fetch.ts +115 -0
- package/src/lib/index.ts +3 -0
- package/src/lib/tailwindVariants.ts +35 -0
- package/src/redux/index.ts +1 -0
- package/src/redux/notification/components/NotificationConsumer.tsx +52 -0
- package/src/redux/notification/errorCatcherMiddleware.ts +17 -0
- package/src/redux/notification/hooks/useNotification.ts +26 -0
- package/src/redux/notification/index.ts +5 -0
- package/src/redux/notification/notificationSlice.ts +68 -0
- package/src/styles/Animation.stories.tsx +43 -0
- package/src/styles/Shadow.stories.tsx +43 -0
- package/src/styles/Themes.stories.tsx +31 -0
- package/src/styles/Typography.stories.tsx +101 -0
- package/src/tailwind/base.css +188 -0
- package/src/tailwind/components-input-outline.css +62 -0
- package/src/tailwind/components-resize-area.css +112 -0
- package/src/tailwind/components-step.css +161 -0
- package/src/tailwind/components.css +51 -0
- package/src/tailwind/keyframes.ts +69 -0
- package/src/tailwind/pentatrionTw.ts +147 -0
- package/src/tailwind/utilities-dialog.css +103 -0
- package/src/tailwind/utilities.css +3 -0
- package/src/types.d.ts +12 -0
- package/tailwind.config.js +18 -0
- package/tests/README.md +32 -0
- package/tests/setup.ts +1 -0
- package/tsconfig.json +14 -0
- package/tsup.config.ts +23 -0
- package/vite.config.ts +24 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,3707 @@
|
|
|
1
|
+
// src/components/table/Table.tsx
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
function Table({ children, ...props }) {
|
|
4
|
+
return /* @__PURE__ */ jsx("table", { className: "w-full", ...props, children });
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
// src/components/table/TableBody.tsx
|
|
8
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
9
|
+
function Table2({ children, ...props }) {
|
|
10
|
+
return /* @__PURE__ */ jsx2("tbody", { ...props, children });
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// src/components/table/TableCell.tsx
|
|
14
|
+
import clsx from "clsx";
|
|
15
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
16
|
+
function Table3({ children, className, label, ...props }) {
|
|
17
|
+
return /* @__PURE__ */ jsxs("td", { className: clsx("p-2 block lg:table-cell", className), ...props, children: [
|
|
18
|
+
label && /* @__PURE__ */ jsx3("p", { className: "font-medium text-sm text-gray-6 lg:hidden", children: label }),
|
|
19
|
+
children
|
|
20
|
+
] });
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// src/components/table/TableHeader.tsx
|
|
24
|
+
import clsx2 from "clsx";
|
|
25
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
26
|
+
function Table4({ children, className, ...props }) {
|
|
27
|
+
return /* @__PURE__ */ jsx4("thead", { className: clsx2("hidden lg:table-header-group", className), ...props, children });
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// src/components/table/TableHeaderCell.tsx
|
|
31
|
+
import clsx3 from "clsx";
|
|
32
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
33
|
+
function Table5({ children, className, ...props }) {
|
|
34
|
+
return /* @__PURE__ */ jsx5("th", { className: clsx3("text-left font-bold p-2", className), ...props, children });
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// src/components/table/TableRow.tsx
|
|
38
|
+
import clsx4 from "clsx";
|
|
39
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
40
|
+
function Table6({ children, className, ...props }) {
|
|
41
|
+
return /* @__PURE__ */ jsx6("tr", { className: clsx4("border-b border-gray-3 block lg:table-row", className), ...props, children });
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// src/components/table/TableFooter.tsx
|
|
45
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
46
|
+
function Table7({ children, ...props }) {
|
|
47
|
+
return /* @__PURE__ */ jsx7("tfoot", { ...props, children });
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// src/components/card/config.ts
|
|
51
|
+
var cardConfig = {
|
|
52
|
+
item: "p-2 bg-gray-1 rounded-2xl",
|
|
53
|
+
group: "grid grid-cols-2 gap-4"
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// src/components/code/Code.tsx
|
|
57
|
+
import clsx5 from "clsx";
|
|
58
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
59
|
+
function Code({ children, className }) {
|
|
60
|
+
return /* @__PURE__ */ jsx8("code", { className: clsx5("px-1 rounded m-[1px] bg-gray-1 border border-gray-2", className), children });
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// src/components/tabs/Tabs.tsx
|
|
64
|
+
import clsx6 from "clsx";
|
|
65
|
+
import { jsx as jsx9, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
66
|
+
function Tabs({
|
|
67
|
+
className,
|
|
68
|
+
listClassName,
|
|
69
|
+
contentClassName,
|
|
70
|
+
tabs = [],
|
|
71
|
+
value,
|
|
72
|
+
onChange,
|
|
73
|
+
fullWidth = false,
|
|
74
|
+
stickyTabs = false,
|
|
75
|
+
children
|
|
76
|
+
}) {
|
|
77
|
+
const content = tabs.find((t) => t.id === value)?.content;
|
|
78
|
+
return /* @__PURE__ */ jsxs2("div", { className: clsx6("ll-tabs md:rounded-sm shadow bg-gray-2 overflow-hidden", className), children: [
|
|
79
|
+
/* @__PURE__ */ jsxs2(
|
|
80
|
+
"div",
|
|
81
|
+
{
|
|
82
|
+
role: "tablist",
|
|
83
|
+
className: clsx6("tabs-list flex", stickyTabs && "sticky z-[1] top-0", listClassName),
|
|
84
|
+
children: [
|
|
85
|
+
tabs.map(({ title, id }) => {
|
|
86
|
+
return /* @__PURE__ */ jsx9(
|
|
87
|
+
"div",
|
|
88
|
+
{
|
|
89
|
+
className: clsx6(
|
|
90
|
+
"tabs-list-item border-t-4 hover:text-gray-7 transition-all",
|
|
91
|
+
fullWidth && "text-center flex-1",
|
|
92
|
+
value === id ? "border-t-yellow-3 bg-gray-0 text-gray-7" : "border-t-transparent text-gray-6"
|
|
93
|
+
),
|
|
94
|
+
children: /* @__PURE__ */ jsx9(
|
|
95
|
+
"button",
|
|
96
|
+
{
|
|
97
|
+
className: "px-2 py-1 focus-visible:outline-offset-0 w-full",
|
|
98
|
+
onClick: (event) => {
|
|
99
|
+
event.stopPropagation();
|
|
100
|
+
event.preventDefault();
|
|
101
|
+
onChange(id);
|
|
102
|
+
},
|
|
103
|
+
children: title
|
|
104
|
+
}
|
|
105
|
+
)
|
|
106
|
+
},
|
|
107
|
+
id
|
|
108
|
+
);
|
|
109
|
+
}),
|
|
110
|
+
children && /* @__PURE__ */ jsx9("div", { className: "extra ml-auto mr-2 flex items-center", children })
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
),
|
|
114
|
+
/* @__PURE__ */ jsx9("div", { className: clsx6("p-2 bg-gray-0 shadow", contentClassName), children: content })
|
|
115
|
+
] });
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// src/components/flash/Flash.tsx
|
|
119
|
+
import clsx7 from "clsx";
|
|
120
|
+
|
|
121
|
+
// src/lib/tailwindVariants.ts
|
|
122
|
+
var colorVariants = {
|
|
123
|
+
yellow: {
|
|
124
|
+
border: "border-yellow-3",
|
|
125
|
+
text: "text-yellow-4"
|
|
126
|
+
},
|
|
127
|
+
gray: {
|
|
128
|
+
border: "border-gray-3",
|
|
129
|
+
text: "text-gray-4"
|
|
130
|
+
},
|
|
131
|
+
red: {
|
|
132
|
+
border: "border-red-3",
|
|
133
|
+
text: "text-red-4"
|
|
134
|
+
},
|
|
135
|
+
orange: {
|
|
136
|
+
border: "border-orange-3",
|
|
137
|
+
text: "text-orange-4"
|
|
138
|
+
},
|
|
139
|
+
green: {
|
|
140
|
+
border: "border-green-3",
|
|
141
|
+
text: "text-green-4"
|
|
142
|
+
},
|
|
143
|
+
blue: {
|
|
144
|
+
border: "border-blue-3",
|
|
145
|
+
text: "text-blue-4"
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
// src/components/flash/Flash.tsx
|
|
150
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
151
|
+
function Alert({ color = "yellow", children, className }) {
|
|
152
|
+
return /* @__PURE__ */ jsx10(
|
|
153
|
+
"div",
|
|
154
|
+
{
|
|
155
|
+
className: clsx7(
|
|
156
|
+
"p-2 shadow border-l-4 dark:shadow-dark",
|
|
157
|
+
colorVariants[color].border,
|
|
158
|
+
className
|
|
159
|
+
),
|
|
160
|
+
children
|
|
161
|
+
}
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// src/components/scroll/Scroll.tsx
|
|
166
|
+
import { useEffect, useRef, useState } from "react";
|
|
167
|
+
import clsx8 from "clsx";
|
|
168
|
+
import { jsx as jsx11, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
169
|
+
var TOLERANCE = 5;
|
|
170
|
+
var scrollVariants = {
|
|
171
|
+
vertical: {
|
|
172
|
+
inner: "overflow-y-auto h-full",
|
|
173
|
+
shadow: "h-1 left-0 right-0",
|
|
174
|
+
shadowStart: "top-0 bg-gradient-to-b from-gray-8/10",
|
|
175
|
+
shadowEnd: "bottom-0 bg-gradient-to-t from-gray-8/10",
|
|
176
|
+
child: ""
|
|
177
|
+
},
|
|
178
|
+
horizontal: {
|
|
179
|
+
inner: "overflow-x-auto",
|
|
180
|
+
shadow: "w-1 top-0 bottom-0",
|
|
181
|
+
shadowStart: "left-0 bg-gradient-to-r from-gray-8/10",
|
|
182
|
+
shadowEnd: "right-0 bg-gradient-to-l from-gray-8/10",
|
|
183
|
+
child: "inline-block"
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
function Scroll({ horizontal = false, className, children, ...rest }) {
|
|
187
|
+
const [showStartShadow, setShowStartShadow] = useState(false);
|
|
188
|
+
const [showEndShadow, setShowEndShadow] = useState(false);
|
|
189
|
+
const scrollChildRef = useRef(null);
|
|
190
|
+
const scrollContainerRef = useRef(null);
|
|
191
|
+
const position = horizontal ? "horizontal" : "vertical";
|
|
192
|
+
const setShadows = (container, child) => {
|
|
193
|
+
if (!container || !child) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
const containerRect = container.getBoundingClientRect();
|
|
197
|
+
const childRect = child.getBoundingClientRect();
|
|
198
|
+
const isOnStartEdge = horizontal ? containerRect.left - childRect.left < TOLERANCE : containerRect.top - childRect.top < TOLERANCE;
|
|
199
|
+
const isOnEndEdge = horizontal ? childRect.right - containerRect.right < TOLERANCE : childRect.bottom - containerRect.bottom < TOLERANCE;
|
|
200
|
+
setShowStartShadow(
|
|
201
|
+
(previousShowStartShadow) => isOnStartEdge === previousShowStartShadow ? !previousShowStartShadow : previousShowStartShadow
|
|
202
|
+
);
|
|
203
|
+
setShowEndShadow(
|
|
204
|
+
(previousShowEndShadow) => isOnEndEdge === previousShowEndShadow ? !previousShowEndShadow : previousShowEndShadow
|
|
205
|
+
);
|
|
206
|
+
};
|
|
207
|
+
useEffect(() => {
|
|
208
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
209
|
+
setShadows(scrollContainerRef.current, scrollChildRef.current);
|
|
210
|
+
});
|
|
211
|
+
resizeObserver.observe(scrollChildRef.current);
|
|
212
|
+
resizeObserver.observe(scrollContainerRef.current);
|
|
213
|
+
return () => {
|
|
214
|
+
resizeObserver.disconnect();
|
|
215
|
+
};
|
|
216
|
+
});
|
|
217
|
+
function handleScroll(event) {
|
|
218
|
+
if (!scrollChildRef?.current) {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
setShadows(event.currentTarget, scrollChildRef.current);
|
|
222
|
+
}
|
|
223
|
+
return /* @__PURE__ */ jsxs3("div", { className: clsx8("ll-scroll-zone", "relative", className), ...rest, children: [
|
|
224
|
+
/* @__PURE__ */ jsx11(
|
|
225
|
+
"div",
|
|
226
|
+
{
|
|
227
|
+
className: clsx8(
|
|
228
|
+
"scroll-shadow z-[1] absolute opacity-0 transition-all",
|
|
229
|
+
scrollVariants[position].shadow,
|
|
230
|
+
scrollVariants[position].shadowStart,
|
|
231
|
+
showStartShadow && "opacity-100"
|
|
232
|
+
)
|
|
233
|
+
}
|
|
234
|
+
),
|
|
235
|
+
/* @__PURE__ */ jsx11(
|
|
236
|
+
"div",
|
|
237
|
+
{
|
|
238
|
+
className: clsx8(
|
|
239
|
+
"scroll-shadow z-[1] absolute opacity-0 transition-all",
|
|
240
|
+
scrollVariants[position].shadow,
|
|
241
|
+
scrollVariants[position].shadowEnd,
|
|
242
|
+
showEndShadow && "opacity-100"
|
|
243
|
+
)
|
|
244
|
+
}
|
|
245
|
+
),
|
|
246
|
+
/* @__PURE__ */ jsx11(
|
|
247
|
+
"div",
|
|
248
|
+
{
|
|
249
|
+
className: scrollVariants[position].inner,
|
|
250
|
+
ref: scrollContainerRef,
|
|
251
|
+
onScroll: handleScroll,
|
|
252
|
+
children: /* @__PURE__ */ jsx11("div", { className: scrollVariants[position].child, ref: scrollChildRef, children })
|
|
253
|
+
}
|
|
254
|
+
)
|
|
255
|
+
] });
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// src/components/loader/Loader.tsx
|
|
259
|
+
import { useId } from "react";
|
|
260
|
+
import clsx9 from "clsx";
|
|
261
|
+
import { jsx as jsx12, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
262
|
+
var sizeConfig = {
|
|
263
|
+
small: "w-6 h-6 text-base",
|
|
264
|
+
medium: "w-8 h-8 text-[2rem]",
|
|
265
|
+
large: "w-12 h-12 text-[3rem]"
|
|
266
|
+
};
|
|
267
|
+
var trackStyle = {
|
|
268
|
+
strokeLinecap: "round",
|
|
269
|
+
strokeWidth: 2
|
|
270
|
+
};
|
|
271
|
+
var circleStyle = {
|
|
272
|
+
strokeLinecap: "round",
|
|
273
|
+
strokeWidth: 2,
|
|
274
|
+
/**
|
|
275
|
+
* $total-length: 43.699; // total length of path, calculated by getTotalLength() in JS
|
|
276
|
+
* $looping-percent: 40;
|
|
277
|
+
* $looping-length: math.div($looping-percent * $total-length, 100) = 17.464;
|
|
278
|
+
* stroke-dasharray: #{$looping-length * 1px}, #{($total-length - $looping-length) * 1px};
|
|
279
|
+
*/
|
|
280
|
+
strokeDasharray: "17.45px, 26.21px"
|
|
281
|
+
};
|
|
282
|
+
function Loader({ size: size4 = "medium", color = "blue", className, ...rest }) {
|
|
283
|
+
const id = useId();
|
|
284
|
+
return /* @__PURE__ */ jsxs4(
|
|
285
|
+
"svg",
|
|
286
|
+
{
|
|
287
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
288
|
+
className: clsx9("inline-block", sizeConfig[size4], colorVariants[color].text, className),
|
|
289
|
+
viewBox: "0 0 16 16",
|
|
290
|
+
...rest,
|
|
291
|
+
children: [
|
|
292
|
+
/* @__PURE__ */ jsx12("defs", { children: /* @__PURE__ */ jsx12("circle", { id, cx: "8", cy: "8", r: "7" }) }),
|
|
293
|
+
/* @__PURE__ */ jsx12("use", { href: `#${id}`, className: "opacity-25 fill-none stroke-current", style: trackStyle }),
|
|
294
|
+
/* @__PURE__ */ jsx12(
|
|
295
|
+
"use",
|
|
296
|
+
{
|
|
297
|
+
href: `#${id}`,
|
|
298
|
+
className: "fill-none stroke-current animate-loader-stroke",
|
|
299
|
+
style: circleStyle
|
|
300
|
+
}
|
|
301
|
+
)
|
|
302
|
+
]
|
|
303
|
+
}
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// src/components/portal/Portal.tsx
|
|
308
|
+
import ReactDOM from "react-dom";
|
|
309
|
+
var Portal = ({ children }) => {
|
|
310
|
+
return ReactDOM.createPortal(children, document.body);
|
|
311
|
+
};
|
|
312
|
+
var Portal_default = Portal;
|
|
313
|
+
|
|
314
|
+
// src/components/badge/Badge.tsx
|
|
315
|
+
import clsx14 from "clsx";
|
|
316
|
+
|
|
317
|
+
// src/components/button/Button.tsx
|
|
318
|
+
import { forwardRef, useImperativeHandle, useRef as useRef8 } from "react";
|
|
319
|
+
import clsx10 from "clsx";
|
|
320
|
+
|
|
321
|
+
// src/hooks/useNotifications.tsx
|
|
322
|
+
import { useContext } from "react";
|
|
323
|
+
|
|
324
|
+
// src/components/notification/NotificationsContext.ts
|
|
325
|
+
import { createContext } from "react";
|
|
326
|
+
|
|
327
|
+
// src/lib/arrUtil.ts
|
|
328
|
+
function arrayEquals(a, b) {
|
|
329
|
+
return Array.isArray(a) && Array.isArray(b) && a.length === b.length && a.every((val, index) => val === b[index]);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// src/lib/fetch.ts
|
|
333
|
+
async function fetchAPI(urlObjOrString, enhancedOptions = {}, baseUrl, baseOptions) {
|
|
334
|
+
const { urlParams, query, body, ...rest } = enhancedOptions;
|
|
335
|
+
let options = rest;
|
|
336
|
+
let url;
|
|
337
|
+
if (urlObjOrString instanceof URL) {
|
|
338
|
+
url = urlObjOrString;
|
|
339
|
+
} else {
|
|
340
|
+
const origin = baseUrl ? new URL(baseUrl).origin : window.location.origin;
|
|
341
|
+
let prefix = baseUrl ? new URL(baseUrl).pathname : "";
|
|
342
|
+
if (prefix === "/") {
|
|
343
|
+
prefix = "";
|
|
344
|
+
}
|
|
345
|
+
url = new URL(`${prefix}${urlObjOrString}`, origin);
|
|
346
|
+
}
|
|
347
|
+
if (urlParams) {
|
|
348
|
+
for (const [name, value] of Object.entries(urlParams)) {
|
|
349
|
+
url.pathname = url.pathname.replace(`%7B${name}%7D`, value.toString());
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
if (query) {
|
|
353
|
+
for (const [name, value] of Object.entries(query)) {
|
|
354
|
+
url.searchParams.set(
|
|
355
|
+
name,
|
|
356
|
+
typeof value === "object" ? JSON.stringify(value) : value.toString()
|
|
357
|
+
);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
if (body && typeof body !== "string" && !(body instanceof FormData)) {
|
|
361
|
+
options.headers = {
|
|
362
|
+
...options.headers = {},
|
|
363
|
+
"Content-Type": "application/json"
|
|
364
|
+
};
|
|
365
|
+
options.body = JSON.stringify(body);
|
|
366
|
+
}
|
|
367
|
+
if (baseOptions) {
|
|
368
|
+
const { headers: baseHeaders = {}, ...baseRest } = baseOptions;
|
|
369
|
+
options = {
|
|
370
|
+
...baseRest,
|
|
371
|
+
...options,
|
|
372
|
+
headers: {
|
|
373
|
+
...baseHeaders,
|
|
374
|
+
...options.headers
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
const response = await fetch(url.toString(), options);
|
|
379
|
+
if (response.status === 204) {
|
|
380
|
+
return null;
|
|
381
|
+
}
|
|
382
|
+
const contentType = response.headers.get("content-type");
|
|
383
|
+
if (contentType?.includes("application/json") || contentType?.includes("application/geo+json")) {
|
|
384
|
+
const dataJson = await response.json();
|
|
385
|
+
if (response.ok) {
|
|
386
|
+
return dataJson;
|
|
387
|
+
}
|
|
388
|
+
let errorMessage = "request Error";
|
|
389
|
+
if (dataJson.message) {
|
|
390
|
+
errorMessage = dataJson.message;
|
|
391
|
+
}
|
|
392
|
+
if (dataJson.error?.message) {
|
|
393
|
+
errorMessage = dataJson.error?.message;
|
|
394
|
+
}
|
|
395
|
+
throw new FetchError(errorMessage, response.status, dataJson);
|
|
396
|
+
}
|
|
397
|
+
const dataText = await response.text();
|
|
398
|
+
if (response.ok) {
|
|
399
|
+
return dataText;
|
|
400
|
+
}
|
|
401
|
+
throw new FetchError(`${response.status} ${response.statusText}`, response.status, dataText);
|
|
402
|
+
}
|
|
403
|
+
var FetchError = class extends Error {
|
|
404
|
+
constructor(message, status, data) {
|
|
405
|
+
super(message);
|
|
406
|
+
this.status = status;
|
|
407
|
+
this.data = data;
|
|
408
|
+
this.name = "FetchError";
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
// src/lib/error.ts
|
|
413
|
+
function isErrorLike(err) {
|
|
414
|
+
if (err instanceof Error) {
|
|
415
|
+
return true;
|
|
416
|
+
} else if (err.name !== void 0 && err.message !== void 0) {
|
|
417
|
+
return true;
|
|
418
|
+
}
|
|
419
|
+
return false;
|
|
420
|
+
}
|
|
421
|
+
function parseError(err) {
|
|
422
|
+
if (isErrorLike(err)) {
|
|
423
|
+
return [err.message || "An error occured", { color: "red" }];
|
|
424
|
+
}
|
|
425
|
+
return null;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
// src/components/notification/NotificationsContext.ts
|
|
429
|
+
function createNotificationsManager(setNotifications) {
|
|
430
|
+
let idx = 1;
|
|
431
|
+
const timeoutIds = /* @__PURE__ */ new Map();
|
|
432
|
+
const removeNotification = (id) => {
|
|
433
|
+
const timeoutId = timeoutIds.get(id);
|
|
434
|
+
if (!timeoutId) {
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
clearTimeout(timeoutId);
|
|
438
|
+
timeoutIds.delete(id);
|
|
439
|
+
return setNotifications((oldNotifications) => {
|
|
440
|
+
return oldNotifications.filter(({ id: otherId }) => id !== otherId);
|
|
441
|
+
});
|
|
442
|
+
};
|
|
443
|
+
const addNotification = (content = "", {
|
|
444
|
+
expiration = 5e3,
|
|
445
|
+
color = "yellow",
|
|
446
|
+
canClose = true,
|
|
447
|
+
withLoader = false
|
|
448
|
+
} = {}) => {
|
|
449
|
+
const id = (idx++).toString();
|
|
450
|
+
if (timeoutIds.has(id)) {
|
|
451
|
+
throw new Error("notification already exists");
|
|
452
|
+
}
|
|
453
|
+
setNotifications((oldNotifications) => {
|
|
454
|
+
const newNotification = {
|
|
455
|
+
id,
|
|
456
|
+
content,
|
|
457
|
+
expiration,
|
|
458
|
+
color,
|
|
459
|
+
canClose,
|
|
460
|
+
withLoader
|
|
461
|
+
};
|
|
462
|
+
return [newNotification, ...oldNotifications];
|
|
463
|
+
});
|
|
464
|
+
timeoutIds.set(
|
|
465
|
+
id,
|
|
466
|
+
expiration === -1 ? -1 : setTimeout(() => removeNotification(id), expiration)
|
|
467
|
+
);
|
|
468
|
+
return id;
|
|
469
|
+
};
|
|
470
|
+
const notifyError = (err) => {
|
|
471
|
+
const errorMessage = parseError(err);
|
|
472
|
+
if (errorMessage) {
|
|
473
|
+
addNotification(...errorMessage);
|
|
474
|
+
} else {
|
|
475
|
+
throw err;
|
|
476
|
+
}
|
|
477
|
+
};
|
|
478
|
+
return {
|
|
479
|
+
addNotification,
|
|
480
|
+
removeNotification,
|
|
481
|
+
notifyError
|
|
482
|
+
};
|
|
483
|
+
}
|
|
484
|
+
var NotificationsContext = createContext(
|
|
485
|
+
null
|
|
486
|
+
);
|
|
487
|
+
|
|
488
|
+
// src/hooks/useNotifications.tsx
|
|
489
|
+
var useNotifications = () => {
|
|
490
|
+
const manager = useContext(NotificationsContext);
|
|
491
|
+
if (!manager) {
|
|
492
|
+
throw new Error("Trying to use uninitialized NotificationsContext");
|
|
493
|
+
}
|
|
494
|
+
return manager;
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
// src/hooks/useRipple.tsx
|
|
498
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
499
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
500
|
+
var useRipple = (ref) => {
|
|
501
|
+
const [ripples, setRipples] = useState2([]);
|
|
502
|
+
useEffect2(() => {
|
|
503
|
+
const handlePointerDown = (e) => {
|
|
504
|
+
if (ref.current) {
|
|
505
|
+
const elem = ref.current;
|
|
506
|
+
const rect = elem.getBoundingClientRect();
|
|
507
|
+
const left = (e.clientX ?? 0) - rect.left;
|
|
508
|
+
const top = (e.clientY ?? 0) - rect.top;
|
|
509
|
+
const height = elem.clientHeight;
|
|
510
|
+
const width = elem.clientWidth;
|
|
511
|
+
const diameter = Math.max(width, height);
|
|
512
|
+
setRipples((r) => [
|
|
513
|
+
...r,
|
|
514
|
+
{
|
|
515
|
+
top: top - diameter / 2,
|
|
516
|
+
left: left - diameter / 2,
|
|
517
|
+
height: Math.max(width, height),
|
|
518
|
+
width: Math.max(width, height)
|
|
519
|
+
}
|
|
520
|
+
]);
|
|
521
|
+
}
|
|
522
|
+
};
|
|
523
|
+
if (ref.current) {
|
|
524
|
+
const elem = ref.current;
|
|
525
|
+
elem.addEventListener("pointerdown", handlePointerDown);
|
|
526
|
+
return () => {
|
|
527
|
+
elem.removeEventListener("pointerdown", handlePointerDown);
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
}, [ref]);
|
|
531
|
+
const [_debounced] = useDebounce(ripples, 1e3);
|
|
532
|
+
useEffect2(() => {
|
|
533
|
+
if (_debounced.length) {
|
|
534
|
+
setRipples([]);
|
|
535
|
+
}
|
|
536
|
+
}, [_debounced]);
|
|
537
|
+
return ripples?.map((style, i) => {
|
|
538
|
+
return /* @__PURE__ */ jsx13(
|
|
539
|
+
"span",
|
|
540
|
+
{
|
|
541
|
+
"data-testid": "ripple",
|
|
542
|
+
className: "animate-ripple",
|
|
543
|
+
style: {
|
|
544
|
+
...style,
|
|
545
|
+
//should be absolutely positioned
|
|
546
|
+
position: "absolute",
|
|
547
|
+
backgroundColor: "#FFFFFF",
|
|
548
|
+
opacity: "25%",
|
|
549
|
+
transform: "scale(0)",
|
|
550
|
+
borderRadius: "50%"
|
|
551
|
+
}
|
|
552
|
+
},
|
|
553
|
+
i
|
|
554
|
+
);
|
|
555
|
+
});
|
|
556
|
+
};
|
|
557
|
+
|
|
558
|
+
// src/hooks/useIsMounted.tsx
|
|
559
|
+
import { useCallback, useEffect as useEffect3, useRef as useRef2 } from "react";
|
|
560
|
+
var useIsMounted = () => {
|
|
561
|
+
const mountedRef = useRef2(false);
|
|
562
|
+
useEffect3(() => {
|
|
563
|
+
mountedRef.current = true;
|
|
564
|
+
return () => {
|
|
565
|
+
mountedRef.current = false;
|
|
566
|
+
};
|
|
567
|
+
}, []);
|
|
568
|
+
return useCallback(() => {
|
|
569
|
+
return mountedRef.current;
|
|
570
|
+
}, []);
|
|
571
|
+
};
|
|
572
|
+
|
|
573
|
+
// src/hooks/useFetch.tsx
|
|
574
|
+
import { useCallback as useCallback2 } from "react";
|
|
575
|
+
var useFetch = () => {
|
|
576
|
+
const notificationManager = useNotifications();
|
|
577
|
+
const appFetch = useCallback2(
|
|
578
|
+
async (urlObjOrString, enhancedOptions = {}) => {
|
|
579
|
+
try {
|
|
580
|
+
return await fetchAPI(urlObjOrString, enhancedOptions);
|
|
581
|
+
} catch (err) {
|
|
582
|
+
notificationManager.notifyError(err);
|
|
583
|
+
}
|
|
584
|
+
},
|
|
585
|
+
[notificationManager]
|
|
586
|
+
);
|
|
587
|
+
return appFetch;
|
|
588
|
+
};
|
|
589
|
+
|
|
590
|
+
// src/hooks/useCombinedRefs.ts
|
|
591
|
+
import { useCallback as useCallback3 } from "react";
|
|
592
|
+
var useCombinedRefs = (...refs) => useCallback3(
|
|
593
|
+
(element) => refs.forEach((ref) => {
|
|
594
|
+
if (!ref) {
|
|
595
|
+
return;
|
|
596
|
+
}
|
|
597
|
+
if (typeof ref === "function") {
|
|
598
|
+
return ref(element);
|
|
599
|
+
}
|
|
600
|
+
ref.current = element;
|
|
601
|
+
}),
|
|
602
|
+
refs
|
|
603
|
+
);
|
|
604
|
+
|
|
605
|
+
// src/hooks/useIsClosing.ts
|
|
606
|
+
import { useCallback as useCallback4, useEffect as useEffect4, useRef as useRef3, useState as useState3 } from "react";
|
|
607
|
+
function useIsClosing(initialValue = false, delay = 500) {
|
|
608
|
+
const [[isOpen, isClosing], setState] = useState3([initialValue, false]);
|
|
609
|
+
const isMounted = useRef3(false);
|
|
610
|
+
useEffect4(() => {
|
|
611
|
+
isMounted.current = true;
|
|
612
|
+
return () => void (isMounted.current = false);
|
|
613
|
+
}, []);
|
|
614
|
+
const setIsOpen = useCallback4(
|
|
615
|
+
(newState) => {
|
|
616
|
+
if (newState) {
|
|
617
|
+
setState([true, false]);
|
|
618
|
+
} else {
|
|
619
|
+
setState([true, true]);
|
|
620
|
+
setTimeout(() => {
|
|
621
|
+
isMounted.current && setState([false, false]);
|
|
622
|
+
}, delay);
|
|
623
|
+
}
|
|
624
|
+
},
|
|
625
|
+
[delay]
|
|
626
|
+
);
|
|
627
|
+
return { isOpen, isClosing, setIsOpen };
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
// src/hooks/usePrevious.ts
|
|
631
|
+
import { useEffect as useEffect5, useRef as useRef4 } from "react";
|
|
632
|
+
function usePrevious(value) {
|
|
633
|
+
const ref = useRef4();
|
|
634
|
+
useEffect5(() => {
|
|
635
|
+
ref.current = value;
|
|
636
|
+
});
|
|
637
|
+
return ref.current;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
// src/hooks/useEventCallback.ts
|
|
641
|
+
import { useCallback as useCallback5, useRef as useRef5 } from "react";
|
|
642
|
+
function useEventCallback(callback) {
|
|
643
|
+
const ref = useRef5(() => {
|
|
644
|
+
throw new Error("Cannot call an event handler while rendering.");
|
|
645
|
+
});
|
|
646
|
+
ref.current = callback;
|
|
647
|
+
return useCallback5((...args) => ref.current?.(...args), [ref]);
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
// src/hooks/useDebounce.ts
|
|
651
|
+
import {
|
|
652
|
+
useCallback as useCallback6,
|
|
653
|
+
useEffect as useEffect6,
|
|
654
|
+
useRef as useRef6,
|
|
655
|
+
useState as useState4
|
|
656
|
+
} from "react";
|
|
657
|
+
function useDebounce(value, delay) {
|
|
658
|
+
const [debouncedValue, setImmediateValue] = useState4(value);
|
|
659
|
+
useEffect6(() => {
|
|
660
|
+
const timer = setTimeout(() => setImmediateValue(value), delay || 500);
|
|
661
|
+
return () => {
|
|
662
|
+
clearTimeout(timer);
|
|
663
|
+
};
|
|
664
|
+
}, [value, delay]);
|
|
665
|
+
return [debouncedValue, setImmediateValue];
|
|
666
|
+
}
|
|
667
|
+
function useRefDebounce(value, delay) {
|
|
668
|
+
const debouncedValueRef = useRef6(value);
|
|
669
|
+
useEffect6(() => {
|
|
670
|
+
const timer = setTimeout(() => {
|
|
671
|
+
debouncedValueRef.current = value;
|
|
672
|
+
}, delay || 500);
|
|
673
|
+
return () => {
|
|
674
|
+
clearTimeout(timer);
|
|
675
|
+
};
|
|
676
|
+
}, [value, delay]);
|
|
677
|
+
return debouncedValueRef;
|
|
678
|
+
}
|
|
679
|
+
function useStateDebounce(initialValue, delay) {
|
|
680
|
+
const [value, setImmediateValue] = useState4(initialValue);
|
|
681
|
+
const [debouncedValue, setDebouncedValue] = useState4(initialValue);
|
|
682
|
+
const setValue = useCallback6((value2, immediate = false) => {
|
|
683
|
+
setImmediateValue(value2);
|
|
684
|
+
if (immediate) {
|
|
685
|
+
setDebouncedValue(value2);
|
|
686
|
+
}
|
|
687
|
+
}, []);
|
|
688
|
+
useEffect6(() => {
|
|
689
|
+
const timer = setTimeout(() => setDebouncedValue(value), delay || 500);
|
|
690
|
+
return () => {
|
|
691
|
+
clearTimeout(timer);
|
|
692
|
+
};
|
|
693
|
+
}, [value, delay]);
|
|
694
|
+
return [value, debouncedValue, setValue];
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
// src/hooks/useCopyToClipboard.ts
|
|
698
|
+
import { useCallback as useCallback7, useState as useState5 } from "react";
|
|
699
|
+
function useCopyToClipboard() {
|
|
700
|
+
const [copiedText, setCopiedText] = useState5(null);
|
|
701
|
+
const copy = useCallback7(async (text) => {
|
|
702
|
+
if (!navigator?.clipboard) {
|
|
703
|
+
console.warn("Clipboard not supported");
|
|
704
|
+
return false;
|
|
705
|
+
}
|
|
706
|
+
try {
|
|
707
|
+
await navigator.clipboard.writeText(text);
|
|
708
|
+
setCopiedText(text);
|
|
709
|
+
return true;
|
|
710
|
+
} catch (error) {
|
|
711
|
+
console.warn("Copy failed", error);
|
|
712
|
+
setCopiedText(null);
|
|
713
|
+
return false;
|
|
714
|
+
}
|
|
715
|
+
}, []);
|
|
716
|
+
return [copiedText, copy];
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
// src/hooks/useEventListener.ts
|
|
720
|
+
import { useEffect as useEffect8, useRef as useRef7 } from "react";
|
|
721
|
+
|
|
722
|
+
// src/hooks/useIsomorphicLayoutEffect.ts
|
|
723
|
+
import { useEffect as useEffect7, useLayoutEffect } from "react";
|
|
724
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect7;
|
|
725
|
+
|
|
726
|
+
// src/hooks/useEventListener.ts
|
|
727
|
+
function useEventListener(eventName, handler, element, options) {
|
|
728
|
+
const savedHandler = useRef7(handler);
|
|
729
|
+
useIsomorphicLayoutEffect(() => {
|
|
730
|
+
savedHandler.current = handler;
|
|
731
|
+
}, [handler]);
|
|
732
|
+
useEffect8(() => {
|
|
733
|
+
const targetElement = element?.current ?? window;
|
|
734
|
+
if (!(targetElement && targetElement.addEventListener))
|
|
735
|
+
return;
|
|
736
|
+
const listener = (event) => {
|
|
737
|
+
savedHandler.current(event);
|
|
738
|
+
};
|
|
739
|
+
targetElement.addEventListener(eventName, listener, options);
|
|
740
|
+
return () => {
|
|
741
|
+
targetElement.removeEventListener(eventName, listener, options);
|
|
742
|
+
};
|
|
743
|
+
}, [eventName, element, options]);
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
// src/hooks/useOnClickOutside.ts
|
|
747
|
+
function useOnClickOutside(ref, handler, eventType = "mousedown", eventListenerOptions = {}) {
|
|
748
|
+
useEventListener(
|
|
749
|
+
eventType,
|
|
750
|
+
(event) => {
|
|
751
|
+
const target = event.target;
|
|
752
|
+
if (!target || !target.isConnected) {
|
|
753
|
+
return;
|
|
754
|
+
}
|
|
755
|
+
const isOutside = Array.isArray(ref) ? ref.filter((r) => Boolean(r.current)).every((r) => r.current && !r.current.contains(target)) : ref.current && !ref.current.contains(target);
|
|
756
|
+
if (isOutside) {
|
|
757
|
+
handler(event);
|
|
758
|
+
}
|
|
759
|
+
},
|
|
760
|
+
void 0,
|
|
761
|
+
eventListenerOptions
|
|
762
|
+
);
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
// src/components/button/Button.tsx
|
|
766
|
+
import { jsx as jsx14, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
767
|
+
var buttonVariants = {
|
|
768
|
+
size(icon, size4) {
|
|
769
|
+
if (size4 === "custom") {
|
|
770
|
+
return false;
|
|
771
|
+
}
|
|
772
|
+
switch (size4) {
|
|
773
|
+
case "small":
|
|
774
|
+
return clsx10(!icon && "px-2", "text-sm h-6");
|
|
775
|
+
case "medium":
|
|
776
|
+
return !icon && "px-4 h-8";
|
|
777
|
+
case "large":
|
|
778
|
+
return !icon && "px-8 h-12";
|
|
779
|
+
}
|
|
780
|
+
},
|
|
781
|
+
variant: {
|
|
782
|
+
contained(color) {
|
|
783
|
+
return clsx10(
|
|
784
|
+
"shadow hover:shadow-md focus:shadow-md active-full:shadow-lg outline-offset-0",
|
|
785
|
+
{
|
|
786
|
+
yellow: "text-yellow-text bg-yellow-3 hover:bg-yellow-4 active-full:bg-yellow-5 focus-visible:outline-yellow-5",
|
|
787
|
+
gray: "text-gray-text bg-gray-3 hover:bg-gray-4 active-full:bg-gray-5 focus-visible:outline-gray-5",
|
|
788
|
+
red: "text-red-text bg-red-3 hover:bg-red-4 active-full:bg-red-5 focus-visible:outline-red-5",
|
|
789
|
+
orange: "text-orange-text bg-orange-3 hover:bg-orange-4 active-full:bg-orange-5 focus-visible:outline-orange-5",
|
|
790
|
+
green: "text-green-text bg-green-3 hover:bg-green-4 active-full:bg-green-5 focus-visible:outline-green-5",
|
|
791
|
+
blue: "text-blue-text bg-blue-3 hover:bg-blue-4 active-full:bg-blue-5 focus-visible:outline-blue-5"
|
|
792
|
+
}[color]
|
|
793
|
+
);
|
|
794
|
+
},
|
|
795
|
+
light(color) {
|
|
796
|
+
return clsx10(
|
|
797
|
+
"shadow hover:shadow-md focus:shadow-md active-full:shadow-lg outline-offset-0 bg-gray-0",
|
|
798
|
+
{
|
|
799
|
+
yellow: "text-gray-text hover:text-yellow-text hover:bg-yellow-3 active-full:bg-yellow-4 dark:active-full:bg-yellow-4/50 focus-visible:outline-yellow-4",
|
|
800
|
+
gray: "text-gray-text hover:text-gray-text hover:bg-gray-3 active-full:bg-gray-4 dark:active-full:bg-gray-4/50 focus-visible:outline-gray-4",
|
|
801
|
+
red: "text-gray-text hover:text-red-text hover:bg-red-3 active-full:bg-red-4 dark:active-full:bg-red-4/50 focus-visible:outline-red-4",
|
|
802
|
+
orange: "text-gray-text hover:text-orange-text hover:bg-orange-3 active-full:bg-orange-4 dark:active-full:bg-orange-4/50 focus-visible:outline-orange-4",
|
|
803
|
+
green: "text-gray-text hover:text-green-text hover:bg-green-3 active-full:bg-green-4 dark:active-full:bg-green-4/50 focus-visible:outline-green-4",
|
|
804
|
+
blue: "text-gray-text hover:text-blue-text hover:bg-blue-3 active-full:bg-blue-4 dark:active-full:bg-blue-4/50 focus-visible:outline-blue-4"
|
|
805
|
+
}[color]
|
|
806
|
+
);
|
|
807
|
+
},
|
|
808
|
+
outlined(color) {
|
|
809
|
+
return clsx10(
|
|
810
|
+
"bg-gray-0 text-gray-7 outline outline-2 outline-offset-[-2px] focus-visible:ring-2 active-full:shadow-md",
|
|
811
|
+
{
|
|
812
|
+
yellow: "hover:bg-yellow-1/50 active-full:bg-yellow-2/50 outline-yellow-5 focus-visible:ring-yellow-4",
|
|
813
|
+
gray: "hover:bg-gray-1 active-full:bg-gray-2 outline-gray-5 focus-visible:ring-gray-4",
|
|
814
|
+
red: "hover:bg-red-1/50 active-full:bg-red-2/50 outline-red-5 focus-visible:ring-red-4",
|
|
815
|
+
orange: "hover:bg-orange-1/50 active-full:bg-orange-2/50 outline-orange-5 focus-visible:ring-orange-4",
|
|
816
|
+
green: "hover:bg-green-1/50 active-full:bg-green-2/50 outline-green-5 focus-visible:ring-green-4",
|
|
817
|
+
blue: "hover:bg-blue-1/50 active-full:bg-blue-2/50 outline-blue-5 focus-visible:ring-blue-4"
|
|
818
|
+
}[color]
|
|
819
|
+
);
|
|
820
|
+
},
|
|
821
|
+
text(color) {
|
|
822
|
+
return clsx10(
|
|
823
|
+
"bg-transparent active-full:shadow-sm outline-offset-0",
|
|
824
|
+
{
|
|
825
|
+
yellow: "hover:bg-yellow-1/50 active-full:bg-yellow-2/25 text-yellow-4 hover:text-yellow-5",
|
|
826
|
+
gray: "hover:bg-gray-1 active-full:bg-gray-2 text-gray-5 hover:text-gray-6 active-full:text-gray-7",
|
|
827
|
+
red: "hover:bg-red-1/50 active-full:bg-red-2/50 text-red-4 hover:text-red-5",
|
|
828
|
+
orange: "hover:bg-orange-1/50 active-full:bg-orange-2/50 text-orange-4 hover:text-orange-5",
|
|
829
|
+
green: "hover:bg-green-1/50 active-full:bg-green-2/50 text-green-4 hover:text-green-5",
|
|
830
|
+
blue: "hover:bg-blue-1/50 active-full:bg-blue-2/50 text-blue-4 hover:text-blue-5"
|
|
831
|
+
}[color]
|
|
832
|
+
);
|
|
833
|
+
},
|
|
834
|
+
ghost(color) {
|
|
835
|
+
return clsx10(
|
|
836
|
+
"bg-transparent outline-offset-0",
|
|
837
|
+
{
|
|
838
|
+
yellow: "text-yellow-4 hover:text-yellow-5",
|
|
839
|
+
gray: "text-gray-5 hover:text-gray-6 active-full:text-gray-7",
|
|
840
|
+
red: "text-red-4 hover:text-red-5",
|
|
841
|
+
orange: "text-orange-4 hover:text-orange-5",
|
|
842
|
+
green: "text-green-4 hover:text-green-5",
|
|
843
|
+
blue: "text-blue-4 hover:text-blue-5"
|
|
844
|
+
}[color]
|
|
845
|
+
);
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
};
|
|
849
|
+
var Button = forwardRef(
|
|
850
|
+
({
|
|
851
|
+
withRipple = true,
|
|
852
|
+
variant = "contained",
|
|
853
|
+
loading,
|
|
854
|
+
color = "yellow",
|
|
855
|
+
size: size4 = "medium",
|
|
856
|
+
focusable = true,
|
|
857
|
+
fullWidth,
|
|
858
|
+
className,
|
|
859
|
+
disabled,
|
|
860
|
+
children,
|
|
861
|
+
selected = false,
|
|
862
|
+
icon = false,
|
|
863
|
+
...props
|
|
864
|
+
}, ref) => {
|
|
865
|
+
const inputRef = useRef8(null);
|
|
866
|
+
useImperativeHandle(
|
|
867
|
+
ref,
|
|
868
|
+
() => inputRef.current
|
|
869
|
+
);
|
|
870
|
+
const notClickable = loading || disabled;
|
|
871
|
+
const ripples = useRipple(inputRef);
|
|
872
|
+
return /* @__PURE__ */ jsxs5(
|
|
873
|
+
"button",
|
|
874
|
+
{
|
|
875
|
+
tabIndex: focusable ? 0 : -1,
|
|
876
|
+
role: "button",
|
|
877
|
+
ref: inputRef,
|
|
878
|
+
className: clsx10(
|
|
879
|
+
"rounded-2xl cursor-pointer relative overflow-clip focus-visible:outline focus-visible:outline-2 no-underline border-0 inline-flex items-center transition-color-shadow duration-300 leading-5",
|
|
880
|
+
className,
|
|
881
|
+
buttonVariants.size(icon, size4),
|
|
882
|
+
buttonVariants.variant[variant](color),
|
|
883
|
+
icon && "justify-center min-w-8 h-8 [&_i]:w-8 [&_:last-child:not(i,img)]:pr-4",
|
|
884
|
+
fullWidth && "w-full",
|
|
885
|
+
selected && "active",
|
|
886
|
+
notClickable && "disabled"
|
|
887
|
+
),
|
|
888
|
+
"data-variant": variant,
|
|
889
|
+
disabled,
|
|
890
|
+
"aria-busy": loading,
|
|
891
|
+
...props,
|
|
892
|
+
children: [
|
|
893
|
+
!notClickable && withRipple && ripples,
|
|
894
|
+
children,
|
|
895
|
+
loading !== void 0 && /* @__PURE__ */ jsx14("span", { className: "", children: /* @__PURE__ */ jsx14(
|
|
896
|
+
Loader,
|
|
897
|
+
{
|
|
898
|
+
color,
|
|
899
|
+
size: "small",
|
|
900
|
+
className: clsx10("ml-2 -mr-2", !loading && "invisible")
|
|
901
|
+
}
|
|
902
|
+
) })
|
|
903
|
+
]
|
|
904
|
+
}
|
|
905
|
+
);
|
|
906
|
+
}
|
|
907
|
+
);
|
|
908
|
+
var Button_default = Button;
|
|
909
|
+
|
|
910
|
+
// src/components/href/Href.tsx
|
|
911
|
+
import { forwardRef as forwardRef2 } from "react";
|
|
912
|
+
import clsx11 from "clsx";
|
|
913
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
914
|
+
var Href = forwardRef2(
|
|
915
|
+
({ href = "#", ghost = false, children, className, ...rest }, ref) => {
|
|
916
|
+
return /* @__PURE__ */ jsx15("a", { ref, href, className: clsx11(ghost && "ghost-link", className), ...rest, children });
|
|
917
|
+
}
|
|
918
|
+
);
|
|
919
|
+
var Href_default = Href;
|
|
920
|
+
|
|
921
|
+
// src/components/tooltip/useTooltip.ts
|
|
922
|
+
import { useMemo, useRef as useRef9, useState as useState6 } from "react";
|
|
923
|
+
import {
|
|
924
|
+
arrow,
|
|
925
|
+
autoUpdate,
|
|
926
|
+
flip,
|
|
927
|
+
hide,
|
|
928
|
+
offset,
|
|
929
|
+
shift,
|
|
930
|
+
useDismiss,
|
|
931
|
+
useFloating,
|
|
932
|
+
useFocus,
|
|
933
|
+
useHover,
|
|
934
|
+
useInteractions,
|
|
935
|
+
useRole
|
|
936
|
+
} from "@floating-ui/react";
|
|
937
|
+
var arrowWidth = 16;
|
|
938
|
+
function useTooltip({
|
|
939
|
+
initialOpen = false,
|
|
940
|
+
placement = "top",
|
|
941
|
+
open: controlledOpen,
|
|
942
|
+
onOpen: setControlledOpen,
|
|
943
|
+
openDelay = 500,
|
|
944
|
+
closeDelay = 500,
|
|
945
|
+
color = "yellow"
|
|
946
|
+
} = {}) {
|
|
947
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState6(initialOpen);
|
|
948
|
+
const isUncontrolled = controlledOpen === null || controlledOpen === void 0;
|
|
949
|
+
const open = isUncontrolled ? uncontrolledOpen : controlledOpen;
|
|
950
|
+
const setOpen = isUncontrolled ? setUncontrolledOpen : setControlledOpen;
|
|
951
|
+
const arrowRef = useRef9(null);
|
|
952
|
+
const offsetVal = arrowWidth / 2;
|
|
953
|
+
const data = useFloating({
|
|
954
|
+
placement,
|
|
955
|
+
open,
|
|
956
|
+
onOpenChange: setOpen,
|
|
957
|
+
whileElementsMounted: autoUpdate,
|
|
958
|
+
middleware: [
|
|
959
|
+
offset(offsetVal),
|
|
960
|
+
flip(),
|
|
961
|
+
shift({ padding: 5 }),
|
|
962
|
+
arrow({
|
|
963
|
+
element: arrowRef,
|
|
964
|
+
padding: 12
|
|
965
|
+
}),
|
|
966
|
+
hide({
|
|
967
|
+
padding: 20
|
|
968
|
+
})
|
|
969
|
+
]
|
|
970
|
+
});
|
|
971
|
+
const { context } = data;
|
|
972
|
+
const hover = useHover(context, {
|
|
973
|
+
move: false,
|
|
974
|
+
enabled: isUncontrolled,
|
|
975
|
+
delay: {
|
|
976
|
+
open: openDelay || 1,
|
|
977
|
+
close: closeDelay
|
|
978
|
+
}
|
|
979
|
+
});
|
|
980
|
+
const focus = useFocus(context, {
|
|
981
|
+
enabled: isUncontrolled
|
|
982
|
+
});
|
|
983
|
+
const dismiss = useDismiss(context);
|
|
984
|
+
const role = useRole(context, { role: "tooltip" });
|
|
985
|
+
const interactions = useInteractions([hover, focus, dismiss, role]);
|
|
986
|
+
return useMemo(
|
|
987
|
+
() => ({
|
|
988
|
+
open,
|
|
989
|
+
setOpen,
|
|
990
|
+
...interactions,
|
|
991
|
+
...data,
|
|
992
|
+
arrowRef,
|
|
993
|
+
color
|
|
994
|
+
}),
|
|
995
|
+
[open, setOpen, color, interactions, data]
|
|
996
|
+
);
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
// src/components/tooltip/useTooltipContext.ts
|
|
1000
|
+
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
1001
|
+
var TooltipContext = createContext2(null);
|
|
1002
|
+
function useTooltipContext() {
|
|
1003
|
+
const context = useContext2(TooltipContext);
|
|
1004
|
+
if (context === null) {
|
|
1005
|
+
throw new Error("Tooltip components must be wrapped in <Tooltip />");
|
|
1006
|
+
}
|
|
1007
|
+
return context;
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
// src/components/tooltip/Tooltip.tsx
|
|
1011
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1012
|
+
function Tooltip({ children, ...options }) {
|
|
1013
|
+
const tooltip = useTooltip(options);
|
|
1014
|
+
return /* @__PURE__ */ jsx16(TooltipContext.Provider, { value: tooltip, children });
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
// src/components/tooltip/TooltipContent.tsx
|
|
1018
|
+
import { forwardRef as forwardRef3 } from "react";
|
|
1019
|
+
import { FloatingPortal, useMergeRefs } from "@floating-ui/react";
|
|
1020
|
+
import clsx13 from "clsx";
|
|
1021
|
+
|
|
1022
|
+
// src/components/dialog/util.ts
|
|
1023
|
+
function getSide(placement) {
|
|
1024
|
+
return placement.split("-")[0];
|
|
1025
|
+
}
|
|
1026
|
+
function computeArrowStyle({ middlewareData, placement }) {
|
|
1027
|
+
if (!middlewareData.arrow) {
|
|
1028
|
+
return {
|
|
1029
|
+
display: "none"
|
|
1030
|
+
};
|
|
1031
|
+
}
|
|
1032
|
+
const { x, y } = middlewareData.arrow;
|
|
1033
|
+
const staticSide = {
|
|
1034
|
+
top: "bottom",
|
|
1035
|
+
right: "left",
|
|
1036
|
+
bottom: "top",
|
|
1037
|
+
left: "right"
|
|
1038
|
+
}[getSide(placement)];
|
|
1039
|
+
return {
|
|
1040
|
+
left: x != null ? `${x}px` : "",
|
|
1041
|
+
top: y != null ? `${y}px` : "",
|
|
1042
|
+
[staticSide]: "-6px"
|
|
1043
|
+
};
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
// src/components/dialog/Dialog.tsx
|
|
1047
|
+
import clsx12 from "clsx";
|
|
1048
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
1049
|
+
var dialogVariants = {
|
|
1050
|
+
color(color) {
|
|
1051
|
+
if (!color) {
|
|
1052
|
+
return "bg-gray-0";
|
|
1053
|
+
}
|
|
1054
|
+
return clsx12(
|
|
1055
|
+
"border-t-4",
|
|
1056
|
+
{
|
|
1057
|
+
yellow: "border-t-yellow-3 bg-gray-0",
|
|
1058
|
+
gray: "border-t-gray-3 bg-gray-0",
|
|
1059
|
+
red: "border-t-red-3 bg-red-1",
|
|
1060
|
+
blue: "border-t-blue-3 bg-blue-1",
|
|
1061
|
+
green: "border-t-green-3 bg-green-1",
|
|
1062
|
+
orange: "border-t-orange-3 bg-orange-1"
|
|
1063
|
+
}[color]
|
|
1064
|
+
);
|
|
1065
|
+
}
|
|
1066
|
+
};
|
|
1067
|
+
function Dialog({ placement, color, children, className, ...rest }) {
|
|
1068
|
+
return /* @__PURE__ */ jsx17(
|
|
1069
|
+
"div",
|
|
1070
|
+
{
|
|
1071
|
+
className: clsx12(
|
|
1072
|
+
"rounded-2xl relative shadow dark:shadow-dark",
|
|
1073
|
+
dialogVariants.color(color),
|
|
1074
|
+
className
|
|
1075
|
+
),
|
|
1076
|
+
"data-placement": placement,
|
|
1077
|
+
"data-color": color,
|
|
1078
|
+
...rest,
|
|
1079
|
+
children
|
|
1080
|
+
}
|
|
1081
|
+
);
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
// src/components/tooltip/TooltipContent.tsx
|
|
1085
|
+
import { jsx as jsx18, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1086
|
+
var TooltipContent = forwardRef3(
|
|
1087
|
+
({ style, children, className, ...props }, propRef) => {
|
|
1088
|
+
const context = useTooltipContext();
|
|
1089
|
+
const ref = useMergeRefs([context.refs.setFloating, propRef]);
|
|
1090
|
+
if (!context.open) {
|
|
1091
|
+
return null;
|
|
1092
|
+
}
|
|
1093
|
+
return /* @__PURE__ */ jsx18(FloatingPortal, { children: /* @__PURE__ */ jsx18(
|
|
1094
|
+
"div",
|
|
1095
|
+
{
|
|
1096
|
+
ref,
|
|
1097
|
+
className: clsx13("z-tooltip", context.middlewareData.hide?.referenceHidden && "invisible"),
|
|
1098
|
+
style: { ...context.floatingStyles, ...style },
|
|
1099
|
+
...context.getFloatingProps(props),
|
|
1100
|
+
children: /* @__PURE__ */ jsxs6(
|
|
1101
|
+
Dialog,
|
|
1102
|
+
{
|
|
1103
|
+
placement: context.placement,
|
|
1104
|
+
className: clsx13("animate-fade-in px-2 py-1 max-w-80 text-sm", className),
|
|
1105
|
+
color: context.color,
|
|
1106
|
+
children: [
|
|
1107
|
+
children,
|
|
1108
|
+
/* @__PURE__ */ jsx18(
|
|
1109
|
+
"div",
|
|
1110
|
+
{
|
|
1111
|
+
ref: context.arrowRef,
|
|
1112
|
+
style: computeArrowStyle(context),
|
|
1113
|
+
className: "p8n-arrow"
|
|
1114
|
+
}
|
|
1115
|
+
)
|
|
1116
|
+
]
|
|
1117
|
+
}
|
|
1118
|
+
)
|
|
1119
|
+
}
|
|
1120
|
+
) });
|
|
1121
|
+
}
|
|
1122
|
+
);
|
|
1123
|
+
var TooltipContent_default = TooltipContent;
|
|
1124
|
+
|
|
1125
|
+
// src/components/tooltip/TooltipTrigger.tsx
|
|
1126
|
+
import { cloneElement, forwardRef as forwardRef4, isValidElement } from "react";
|
|
1127
|
+
import { useMergeRefs as useMergeRefs2 } from "@floating-ui/react";
|
|
1128
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
1129
|
+
var TooltipTrigger = forwardRef4(
|
|
1130
|
+
({ children, asChild = false, ...props }, propRef) => {
|
|
1131
|
+
const context = useTooltipContext();
|
|
1132
|
+
const childrenRef = children.ref;
|
|
1133
|
+
const ref = useMergeRefs2([context.refs.setReference, propRef, childrenRef]);
|
|
1134
|
+
if (asChild && isValidElement(children)) {
|
|
1135
|
+
return cloneElement(
|
|
1136
|
+
children,
|
|
1137
|
+
context.getReferenceProps({
|
|
1138
|
+
ref,
|
|
1139
|
+
...props,
|
|
1140
|
+
...children.props,
|
|
1141
|
+
"data-state": context.open ? "open" : "closed"
|
|
1142
|
+
})
|
|
1143
|
+
);
|
|
1144
|
+
}
|
|
1145
|
+
return /* @__PURE__ */ jsx19("abbr", { ref, ...context.getReferenceProps(props), children });
|
|
1146
|
+
}
|
|
1147
|
+
);
|
|
1148
|
+
var TooltipTrigger_default = TooltipTrigger;
|
|
1149
|
+
|
|
1150
|
+
// src/components/tooltip/SimpleTooltip.tsx
|
|
1151
|
+
import { isValidElement as isValidElement2 } from "react";
|
|
1152
|
+
import { jsx as jsx20, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1153
|
+
function SimpleTooltip({ content, children, contentClassName, ...options }) {
|
|
1154
|
+
return /* @__PURE__ */ jsxs7(Tooltip, { ...options, children: [
|
|
1155
|
+
/* @__PURE__ */ jsx20(TooltipContent_default, { className: contentClassName, children: content }),
|
|
1156
|
+
/* @__PURE__ */ jsx20(TooltipTrigger_default, { asChild: isValidElement2(children), children })
|
|
1157
|
+
] });
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
// src/components/badge/Badge.tsx
|
|
1161
|
+
import { jsx as jsx21, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1162
|
+
function Badge({
|
|
1163
|
+
children,
|
|
1164
|
+
className,
|
|
1165
|
+
onRemove,
|
|
1166
|
+
onClick,
|
|
1167
|
+
tooltip,
|
|
1168
|
+
url,
|
|
1169
|
+
color = "yellow"
|
|
1170
|
+
}) {
|
|
1171
|
+
const badge = /* @__PURE__ */ jsxs8(
|
|
1172
|
+
"span",
|
|
1173
|
+
{
|
|
1174
|
+
className: clsx14(
|
|
1175
|
+
"ll-badge",
|
|
1176
|
+
"text-xs rounded-full w-fit shadow overflow-hidden inline-flex items-stretch",
|
|
1177
|
+
buttonVariants.variant.contained(color),
|
|
1178
|
+
// badgeVariants.color[color],
|
|
1179
|
+
// `variant-solid-${color}`,
|
|
1180
|
+
// `text-${color}-4`,
|
|
1181
|
+
className
|
|
1182
|
+
),
|
|
1183
|
+
children: [
|
|
1184
|
+
onClick ? /* @__PURE__ */ jsx21("button", { className: "px-2", onClick, children }) : /* @__PURE__ */ jsx21("span", { className: "px-2", children }),
|
|
1185
|
+
onRemove && /* @__PURE__ */ jsx21("button", { className: "remove rounded-r-full pr-1 pl-0.5", onClick: onRemove, children: /* @__PURE__ */ jsx21("i", { className: "fe-cancel" }) })
|
|
1186
|
+
]
|
|
1187
|
+
}
|
|
1188
|
+
);
|
|
1189
|
+
const wrappedBadge = url ? /* @__PURE__ */ jsx21(Href_default, { href: url, ghost: true, children: badge }) : badge;
|
|
1190
|
+
if (!tooltip) {
|
|
1191
|
+
return wrappedBadge;
|
|
1192
|
+
}
|
|
1193
|
+
return /* @__PURE__ */ jsxs8(Tooltip, { children: [
|
|
1194
|
+
/* @__PURE__ */ jsx21(TooltipContent_default, { children: tooltip }),
|
|
1195
|
+
/* @__PURE__ */ jsx21(TooltipTrigger_default, { asChild: true, children: wrappedBadge })
|
|
1196
|
+
] });
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
// src/components/highlight/Highlight.tsx
|
|
1200
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
1201
|
+
function Hightlight({ value, indices, minLength = 2 }) {
|
|
1202
|
+
if (!indices || !value) {
|
|
1203
|
+
return value;
|
|
1204
|
+
}
|
|
1205
|
+
const content = [];
|
|
1206
|
+
let lastIndex = 0;
|
|
1207
|
+
indices.forEach((indice) => {
|
|
1208
|
+
if (indice[1] - indice[0] < minLength) {
|
|
1209
|
+
return;
|
|
1210
|
+
}
|
|
1211
|
+
if (indice[0] - lastIndex > 0) {
|
|
1212
|
+
content.push(value.substring(lastIndex, indice[0]));
|
|
1213
|
+
}
|
|
1214
|
+
content.push(/* @__PURE__ */ jsx22("mark", { children: value.substring(indice[0], indice[1] + 1) }, content.length));
|
|
1215
|
+
lastIndex = indice[1] + 1;
|
|
1216
|
+
});
|
|
1217
|
+
if (lastIndex <= value.length) {
|
|
1218
|
+
content.push(value.substring(lastIndex));
|
|
1219
|
+
}
|
|
1220
|
+
return /* @__PURE__ */ jsx22("span", { className: "text-gray-6", children: content });
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
// src/components/input-field/InputField.tsx
|
|
1224
|
+
import { forwardRef as forwardRef9, useId as useId3 } from "react";
|
|
1225
|
+
|
|
1226
|
+
// src/components/input/Input.tsx
|
|
1227
|
+
import { forwardRef as forwardRef5 } from "react";
|
|
1228
|
+
import clsx15 from "clsx";
|
|
1229
|
+
import { jsx as jsx23, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1230
|
+
var inputConfig = {
|
|
1231
|
+
container: "p8n-input-text rounded-2xl outline-offset-[-1px] flex ",
|
|
1232
|
+
input: "h-8 flex-1 appearance-none outline-none filter-none min-w-0 bg-transparent"
|
|
1233
|
+
};
|
|
1234
|
+
var Input = forwardRef5(
|
|
1235
|
+
({ variant = "normal", color = "yellow", disabled = false, prefix, suffix, className, ...rest }, ref) => {
|
|
1236
|
+
return /* @__PURE__ */ jsxs9(
|
|
1237
|
+
"div",
|
|
1238
|
+
{
|
|
1239
|
+
"data-color": color,
|
|
1240
|
+
"data-variant": variant,
|
|
1241
|
+
className: clsx15(inputConfig.container, disabled && "disabled", className),
|
|
1242
|
+
children: [
|
|
1243
|
+
prefix && /* @__PURE__ */ jsx23(
|
|
1244
|
+
"div",
|
|
1245
|
+
{
|
|
1246
|
+
className: clsx15([
|
|
1247
|
+
"flex-center relative",
|
|
1248
|
+
typeof prefix === "string" && "mx-2 select-none text-gray-6"
|
|
1249
|
+
]),
|
|
1250
|
+
children: prefix
|
|
1251
|
+
}
|
|
1252
|
+
),
|
|
1253
|
+
/* @__PURE__ */ jsx23(
|
|
1254
|
+
"input",
|
|
1255
|
+
{
|
|
1256
|
+
ref,
|
|
1257
|
+
className: clsx15(inputConfig.input, !prefix && "pl-4", !suffix && "pr-4"),
|
|
1258
|
+
...rest,
|
|
1259
|
+
disabled
|
|
1260
|
+
}
|
|
1261
|
+
),
|
|
1262
|
+
suffix && /* @__PURE__ */ jsx23(
|
|
1263
|
+
"div",
|
|
1264
|
+
{
|
|
1265
|
+
className: clsx15([
|
|
1266
|
+
"flex-center relative",
|
|
1267
|
+
typeof suffix === "string" && "mx-2 select-none text-gray-6"
|
|
1268
|
+
]),
|
|
1269
|
+
children: suffix
|
|
1270
|
+
}
|
|
1271
|
+
)
|
|
1272
|
+
]
|
|
1273
|
+
}
|
|
1274
|
+
);
|
|
1275
|
+
}
|
|
1276
|
+
);
|
|
1277
|
+
var Input_default = Input;
|
|
1278
|
+
|
|
1279
|
+
// src/components/input/Checkbox.tsx
|
|
1280
|
+
import { forwardRef as forwardRef6, useRef as useRef10 } from "react";
|
|
1281
|
+
import clsx16 from "clsx";
|
|
1282
|
+
import { jsx as jsx24, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1283
|
+
var Checkbox = forwardRef6(
|
|
1284
|
+
({ color = "yellow", indeterminate, disabled = false, checked, className, children, ...rest }, ref) => {
|
|
1285
|
+
const inputRef = useRef10(null);
|
|
1286
|
+
const combinedRef = useCombinedRefs(inputRef, ref);
|
|
1287
|
+
return /* @__PURE__ */ jsxs10("label", { className: clsx16("flex items-center cursor-pointer", disabled && "disabled"), children: [
|
|
1288
|
+
/* @__PURE__ */ jsx24(
|
|
1289
|
+
"input",
|
|
1290
|
+
{
|
|
1291
|
+
"data-color": color,
|
|
1292
|
+
ref: combinedRef,
|
|
1293
|
+
disabled,
|
|
1294
|
+
type: "checkbox",
|
|
1295
|
+
className: clsx16(
|
|
1296
|
+
"p8n-input-checkbox",
|
|
1297
|
+
"appearance-none p-0 inline-block bg-origin-border select-none shrink-0 h-5 w-5 bg-gray-0 my-0 mr-1 rounded",
|
|
1298
|
+
indeterminate && "indeterminate",
|
|
1299
|
+
className
|
|
1300
|
+
),
|
|
1301
|
+
checked,
|
|
1302
|
+
...rest
|
|
1303
|
+
}
|
|
1304
|
+
),
|
|
1305
|
+
children
|
|
1306
|
+
] });
|
|
1307
|
+
}
|
|
1308
|
+
);
|
|
1309
|
+
var Checkbox_default = Checkbox;
|
|
1310
|
+
|
|
1311
|
+
// src/components/input/RadioGroup.tsx
|
|
1312
|
+
import { forwardRef as forwardRef7, useId as useId2, useRef as useRef11 } from "react";
|
|
1313
|
+
import clsx17 from "clsx";
|
|
1314
|
+
import { jsx as jsx25, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1315
|
+
var Radio = forwardRef7(
|
|
1316
|
+
({ disabled = false, color = "yellow", checked, children, name, className, ...rest }, ref) => {
|
|
1317
|
+
const inputRef = useRef11(null);
|
|
1318
|
+
const combinedRef = useCombinedRefs(inputRef, ref);
|
|
1319
|
+
return /* @__PURE__ */ jsxs11("label", { className: clsx17("flex items-center cursor-pointer", disabled && "disabled"), children: [
|
|
1320
|
+
/* @__PURE__ */ jsx25(
|
|
1321
|
+
"input",
|
|
1322
|
+
{
|
|
1323
|
+
"data-color": color,
|
|
1324
|
+
ref: combinedRef,
|
|
1325
|
+
disabled,
|
|
1326
|
+
type: "radio",
|
|
1327
|
+
className: clsx17(
|
|
1328
|
+
"p8n-input-radio",
|
|
1329
|
+
"appearance-none p-0 inline-block bg-origin-border select-none shrink-0 cursor-pointer h-5 w-5 bg-gray-0 my-0 mr-1 rounded-full",
|
|
1330
|
+
className
|
|
1331
|
+
),
|
|
1332
|
+
checked,
|
|
1333
|
+
name,
|
|
1334
|
+
...rest
|
|
1335
|
+
}
|
|
1336
|
+
),
|
|
1337
|
+
children
|
|
1338
|
+
] });
|
|
1339
|
+
}
|
|
1340
|
+
);
|
|
1341
|
+
var placementVariants = {
|
|
1342
|
+
inline: "flex gap-2",
|
|
1343
|
+
"inline-grid": "grid gap-2 grid-cols-repeat-fill-160",
|
|
1344
|
+
block: ""
|
|
1345
|
+
};
|
|
1346
|
+
function RadioGroup({
|
|
1347
|
+
value,
|
|
1348
|
+
options,
|
|
1349
|
+
onChange = () => {
|
|
1350
|
+
},
|
|
1351
|
+
// onValue = () => {},
|
|
1352
|
+
placement = "block",
|
|
1353
|
+
disabled = false,
|
|
1354
|
+
className,
|
|
1355
|
+
color = "yellow"
|
|
1356
|
+
}) {
|
|
1357
|
+
const id = useId2();
|
|
1358
|
+
return /* @__PURE__ */ jsx25("div", { className: clsx17(placementVariants[placement]), children: options.map((option) => /* @__PURE__ */ jsx25(
|
|
1359
|
+
Radio,
|
|
1360
|
+
{
|
|
1361
|
+
disabled,
|
|
1362
|
+
checked: option.value === value,
|
|
1363
|
+
onChange: () => onChange(option.value),
|
|
1364
|
+
name: id,
|
|
1365
|
+
className,
|
|
1366
|
+
color,
|
|
1367
|
+
children: option.label
|
|
1368
|
+
},
|
|
1369
|
+
option.value
|
|
1370
|
+
)) });
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
// src/components/input/Toggle.tsx
|
|
1374
|
+
import { forwardRef as forwardRef8, useRef as useRef12 } from "react";
|
|
1375
|
+
import clsx18 from "clsx";
|
|
1376
|
+
import { jsx as jsx26, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1377
|
+
var Toggle = forwardRef8(
|
|
1378
|
+
({ color = "yellow", disabled = false, checked, className, children, ...rest }, ref) => {
|
|
1379
|
+
const inputRef = useRef12(null);
|
|
1380
|
+
const combinedRef = useCombinedRefs(inputRef, ref);
|
|
1381
|
+
return /* @__PURE__ */ jsxs12("label", { className: clsx18("cursor-pointer flex items-center", disabled && "disabled"), children: [
|
|
1382
|
+
/* @__PURE__ */ jsx26(
|
|
1383
|
+
"input",
|
|
1384
|
+
{
|
|
1385
|
+
"data-color": color,
|
|
1386
|
+
ref: combinedRef,
|
|
1387
|
+
disabled,
|
|
1388
|
+
type: "checkbox",
|
|
1389
|
+
className: clsx18(
|
|
1390
|
+
"p8n-input-checkbox p8n-input-toggle ll-toggle w-[30px] h-[18px] box-border appearance-none rounded-xl inline-block relative mr-1 bg-gray-1 checked:bg-gray-0 after:absolute after:top-[3px] after:left-[3px] after:rounded-full after:w-[12px] after:h-[12px] after:bg-gray-2 after:outline after:outline-1 after:outline-gray-3 checked:after:bg-current checked:after:translate-x-[12px] checked:after:outline-current after:transition-all",
|
|
1391
|
+
className
|
|
1392
|
+
),
|
|
1393
|
+
checked,
|
|
1394
|
+
...rest
|
|
1395
|
+
}
|
|
1396
|
+
),
|
|
1397
|
+
children
|
|
1398
|
+
] });
|
|
1399
|
+
}
|
|
1400
|
+
);
|
|
1401
|
+
var Toggle_default = Toggle;
|
|
1402
|
+
|
|
1403
|
+
// src/components/input-field/InputField.tsx
|
|
1404
|
+
import { jsx as jsx27, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1405
|
+
var defaultElement = Input_default;
|
|
1406
|
+
var InputFieldBase = ({ label, hint, help, error, warning, as, ...rest }, ref) => {
|
|
1407
|
+
const id = useId3();
|
|
1408
|
+
const Element = as || defaultElement;
|
|
1409
|
+
const labelElement = label && /* @__PURE__ */ jsx27("span", { className: "font-bold", children: label });
|
|
1410
|
+
const hintElement = hint && /* @__PURE__ */ jsx27("span", { className: "ml-auto text-gray-6 text-sm", children: hint });
|
|
1411
|
+
const errorElement = error && typeof error !== "boolean" && /* @__PURE__ */ jsxs13("span", { className: "text-red-4 font-medium", children: [
|
|
1412
|
+
/* @__PURE__ */ jsx27("i", { className: "fe-circle-exclamation" }),
|
|
1413
|
+
/* @__PURE__ */ jsx27("span", { children: error })
|
|
1414
|
+
] });
|
|
1415
|
+
const warningElement = warning && typeof warning !== "boolean" && /* @__PURE__ */ jsxs13("span", { className: "text-orange-4 font-medium", children: [
|
|
1416
|
+
/* @__PURE__ */ jsx27("i", { className: "fe-circle-exclamation" }),
|
|
1417
|
+
/* @__PURE__ */ jsx27("span", { children: warning })
|
|
1418
|
+
] });
|
|
1419
|
+
const color = error ? "red" : warning ? "orange" : "yellow";
|
|
1420
|
+
return /* @__PURE__ */ jsxs13("div", { children: [
|
|
1421
|
+
label || hint ? /* @__PURE__ */ jsxs13("label", { className: "flex items-end mb-1", htmlFor: id, children: [
|
|
1422
|
+
labelElement,
|
|
1423
|
+
hintElement
|
|
1424
|
+
] }) : /* @__PURE__ */ jsx27("label", { htmlFor: id, className: "invisible" }),
|
|
1425
|
+
/* @__PURE__ */ jsx27(Element, { ref, id, color, ...rest }),
|
|
1426
|
+
/* @__PURE__ */ jsx27("div", { className: "text-gray-6 text-sm mt-1", children: errorElement || warningElement || help })
|
|
1427
|
+
] });
|
|
1428
|
+
};
|
|
1429
|
+
InputFieldBase.displayName = "InputField";
|
|
1430
|
+
var InputField = forwardRef9(InputFieldBase);
|
|
1431
|
+
var InputField_default = InputField;
|
|
1432
|
+
|
|
1433
|
+
// src/components/resize-area/ResizeArea.tsx
|
|
1434
|
+
import { useCallback as useCallback8, useEffect as useEffect9 } from "react";
|
|
1435
|
+
import clsx19 from "clsx";
|
|
1436
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
1437
|
+
function ResizeArea({ name, position, initialValue }) {
|
|
1438
|
+
useEffect9(() => {
|
|
1439
|
+
const cssVarName = `--sidebar-${name}-${["top", "bottom"].includes(position) ? "height" : "width"}`;
|
|
1440
|
+
if (initialValue) {
|
|
1441
|
+
document.documentElement.style.setProperty(cssVarName, `${initialValue}px`);
|
|
1442
|
+
}
|
|
1443
|
+
}, []);
|
|
1444
|
+
useEffect9(() => {
|
|
1445
|
+
const cssVarName = `--sidebar-${name}-${["top", "bottom"].includes(position) ? "height" : "width"}`;
|
|
1446
|
+
return () => {
|
|
1447
|
+
document.documentElement.style.removeProperty(cssVarName);
|
|
1448
|
+
};
|
|
1449
|
+
}, [name, position]);
|
|
1450
|
+
const handlePointerMove = useCallback8(
|
|
1451
|
+
(e) => {
|
|
1452
|
+
const cssVarName = `--sidebar-${name}-${["top", "bottom"].includes(position) ? "height" : "width"}`;
|
|
1453
|
+
let cssVarValue;
|
|
1454
|
+
switch (position) {
|
|
1455
|
+
case "top":
|
|
1456
|
+
cssVarValue = document.documentElement.clientHeight - e.pageY;
|
|
1457
|
+
break;
|
|
1458
|
+
case "right":
|
|
1459
|
+
cssVarValue = e.pageX;
|
|
1460
|
+
break;
|
|
1461
|
+
case "left":
|
|
1462
|
+
cssVarValue = document.documentElement.clientWidth - e.pageX;
|
|
1463
|
+
break;
|
|
1464
|
+
case "bottom":
|
|
1465
|
+
cssVarValue = e.pageY;
|
|
1466
|
+
break;
|
|
1467
|
+
}
|
|
1468
|
+
document.documentElement.style.setProperty(cssVarName, `${cssVarValue}px`);
|
|
1469
|
+
return () => {
|
|
1470
|
+
document.documentElement.style.removeProperty(cssVarName);
|
|
1471
|
+
};
|
|
1472
|
+
},
|
|
1473
|
+
[name, position]
|
|
1474
|
+
);
|
|
1475
|
+
const handlePointerUp = useCallback8(() => {
|
|
1476
|
+
const handler = handlePointerMove;
|
|
1477
|
+
document.removeEventListener("pointermove", handler);
|
|
1478
|
+
document.documentElement.classList.remove("cursor-row-resize", "cursor-col-resize");
|
|
1479
|
+
return () => {
|
|
1480
|
+
document.removeEventListener("pointermove", handler);
|
|
1481
|
+
};
|
|
1482
|
+
}, [handlePointerMove]);
|
|
1483
|
+
function handlePointerDown() {
|
|
1484
|
+
document.addEventListener("pointerup", handlePointerUp, { once: true });
|
|
1485
|
+
document.addEventListener("pointermove", handlePointerMove);
|
|
1486
|
+
if (["top", "bottom"].includes(position)) {
|
|
1487
|
+
document.documentElement.classList.add(`cursor-row-resize`);
|
|
1488
|
+
} else {
|
|
1489
|
+
document.documentElement.classList.add(`cursor-col-resize`);
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1492
|
+
return /* @__PURE__ */ jsx28("div", { className: clsx19(["p8n-resize-area", position]), children: /* @__PURE__ */ jsx28("button", { className: "area-button", type: "button", onPointerDown: handlePointerDown }) });
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
// src/components/snack/Snack.tsx
|
|
1496
|
+
import clsx21 from "clsx";
|
|
1497
|
+
import { useEffect as useEffect10 } from "react";
|
|
1498
|
+
|
|
1499
|
+
// src/components/button/ButtonGroup.tsx
|
|
1500
|
+
import clsx20 from "clsx";
|
|
1501
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
1502
|
+
var buttonGroupVariants = {
|
|
1503
|
+
horizontal: "[&_:not(:first-child)]:rounded-bl-none [&_:not(:last-child)]:rounded-tr-none [&_[data-variant='outlined']]:-mx-[1px]",
|
|
1504
|
+
vertical: "flex flex-col [&_:not(:first-child)]:rounded-tr-none [&_:not(:last-child)]:rounded-bl-none [&_[data-variant='outlined']]:-my-[1px]"
|
|
1505
|
+
};
|
|
1506
|
+
function ButtonGroup({ children, className, direction = "horizontal" }) {
|
|
1507
|
+
return /* @__PURE__ */ jsx29(
|
|
1508
|
+
"div",
|
|
1509
|
+
{
|
|
1510
|
+
className: clsx20(
|
|
1511
|
+
"ll-button-group [&_:not(:first-child)]:rounded-tl-none [&_:not(:last-child)]:rounded-br-none",
|
|
1512
|
+
buttonGroupVariants[direction],
|
|
1513
|
+
`direction-${direction}`,
|
|
1514
|
+
className
|
|
1515
|
+
),
|
|
1516
|
+
children
|
|
1517
|
+
}
|
|
1518
|
+
);
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
// src/components/snack/Snack.tsx
|
|
1522
|
+
import { jsx as jsx30, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1523
|
+
function Snack({
|
|
1524
|
+
expiration = 5e3,
|
|
1525
|
+
content = "",
|
|
1526
|
+
color = "yellow",
|
|
1527
|
+
withLoader = false,
|
|
1528
|
+
canClose = false,
|
|
1529
|
+
onRemove = () => {
|
|
1530
|
+
}
|
|
1531
|
+
}) {
|
|
1532
|
+
const onRemoveStable = useEventCallback(onRemove);
|
|
1533
|
+
useEffect10(() => {
|
|
1534
|
+
if (expiration === -1) {
|
|
1535
|
+
return;
|
|
1536
|
+
}
|
|
1537
|
+
const timeoutId = setTimeout(() => onRemoveStable(), expiration);
|
|
1538
|
+
return () => void clearTimeout(timeoutId);
|
|
1539
|
+
}, [onRemoveStable, expiration]);
|
|
1540
|
+
return /* @__PURE__ */ jsx30(Dialog, { className: clsx21("animate-fade-in", "ll-snack"), placement: "top", color, children: /* @__PURE__ */ jsxs14("div", { className: "w-fit min-w-60 px-2 py-1 flex items-center", children: [
|
|
1541
|
+
/* @__PURE__ */ jsx30("span", { className: "pr-4 flex-1", children: content }),
|
|
1542
|
+
withLoader && /* @__PURE__ */ jsx30(Loader, { size: "small", color: "gray" }),
|
|
1543
|
+
canClose && /* @__PURE__ */ jsx30(Button_default, { icon: true, variant: "text", color: "gray", onClick: onRemove, children: /* @__PURE__ */ jsx30("i", { className: "fe-cancel" }) })
|
|
1544
|
+
] }) });
|
|
1545
|
+
}
|
|
1546
|
+
|
|
1547
|
+
// src/components/autocomplete/Autocomplete.tsx
|
|
1548
|
+
import {
|
|
1549
|
+
useCallback as useCallback9,
|
|
1550
|
+
useMemo as useMemo2,
|
|
1551
|
+
useRef as useRef13,
|
|
1552
|
+
useState as useState7,
|
|
1553
|
+
forwardRef as forwardRef10
|
|
1554
|
+
} from "react";
|
|
1555
|
+
|
|
1556
|
+
// src/components/autocomplete/AutocompleteOption.tsx
|
|
1557
|
+
import { memo, useId as useId4 } from "react";
|
|
1558
|
+
import { useListItem } from "@floating-ui/react";
|
|
1559
|
+
|
|
1560
|
+
// src/components/autocomplete/useAutocompleteContext.ts
|
|
1561
|
+
import { createContext as createContext3, useContext as useContext3 } from "react";
|
|
1562
|
+
var AutocompleteContext = createContext3(null);
|
|
1563
|
+
function useAutocomplete() {
|
|
1564
|
+
const context = useContext3(AutocompleteContext);
|
|
1565
|
+
if (context === null) {
|
|
1566
|
+
throw new Error("Autocomplete components must be wrapped in <Autocomplete>");
|
|
1567
|
+
}
|
|
1568
|
+
return context;
|
|
1569
|
+
}
|
|
1570
|
+
|
|
1571
|
+
// src/components/autocomplete/AutocompleteOption.tsx
|
|
1572
|
+
import clsx22 from "clsx";
|
|
1573
|
+
|
|
1574
|
+
// src/components/autocomplete/util.ts
|
|
1575
|
+
function getOptionLabel(option) {
|
|
1576
|
+
switch (option.type) {
|
|
1577
|
+
case "Feature":
|
|
1578
|
+
return option.properties.label;
|
|
1579
|
+
default:
|
|
1580
|
+
return option.label;
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
function getOptionValue(option) {
|
|
1584
|
+
switch (option.type) {
|
|
1585
|
+
case "Feature":
|
|
1586
|
+
return option.properties.id;
|
|
1587
|
+
default:
|
|
1588
|
+
return option.value;
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1591
|
+
|
|
1592
|
+
// src/components/autocomplete/AutocompleteOption.tsx
|
|
1593
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
1594
|
+
function AutocompleteOption(props) {
|
|
1595
|
+
const label = getOptionLabel(props);
|
|
1596
|
+
const id = useId4();
|
|
1597
|
+
const { activeIndex, selection, getItemProps, handleSelect } = useAutocomplete();
|
|
1598
|
+
const { ref, index } = useListItem({ label });
|
|
1599
|
+
const isActive = activeIndex === index;
|
|
1600
|
+
const isSelected = selection ? getOptionValue(selection) === getOptionValue(props) : false;
|
|
1601
|
+
return /* @__PURE__ */ jsx31(
|
|
1602
|
+
"div",
|
|
1603
|
+
{
|
|
1604
|
+
className: clsx22("option", isSelected && "bg-gray-2", isActive && "bg-gray-1"),
|
|
1605
|
+
ref,
|
|
1606
|
+
role: "option",
|
|
1607
|
+
id,
|
|
1608
|
+
"aria-selected": isActive,
|
|
1609
|
+
...getItemProps({
|
|
1610
|
+
onClick: () => handleSelect(index)
|
|
1611
|
+
}),
|
|
1612
|
+
children: label
|
|
1613
|
+
}
|
|
1614
|
+
);
|
|
1615
|
+
}
|
|
1616
|
+
var AutocompleteOption_default = memo(AutocompleteOption);
|
|
1617
|
+
|
|
1618
|
+
// src/components/autocomplete/Autocomplete.tsx
|
|
1619
|
+
import {
|
|
1620
|
+
FloatingFocusManager,
|
|
1621
|
+
FloatingList,
|
|
1622
|
+
FloatingPortal as FloatingPortal2,
|
|
1623
|
+
autoUpdate as autoUpdate2,
|
|
1624
|
+
flip as flip2,
|
|
1625
|
+
offset as offset2,
|
|
1626
|
+
size,
|
|
1627
|
+
useDismiss as useDismiss2,
|
|
1628
|
+
useFloating as useFloating2,
|
|
1629
|
+
useInteractions as useInteractions2,
|
|
1630
|
+
useListNavigation,
|
|
1631
|
+
useRole as useRole2
|
|
1632
|
+
} from "@floating-ui/react";
|
|
1633
|
+
import clsx23 from "clsx";
|
|
1634
|
+
import { jsx as jsx32, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1635
|
+
import { createElement } from "react";
|
|
1636
|
+
function Autocomplete({
|
|
1637
|
+
className,
|
|
1638
|
+
icon = true,
|
|
1639
|
+
color = "yellow",
|
|
1640
|
+
selectionSuffix,
|
|
1641
|
+
noSearchSuffix,
|
|
1642
|
+
placement = "bottom",
|
|
1643
|
+
placeholder = "Search...",
|
|
1644
|
+
selection = null,
|
|
1645
|
+
onChangeSelection,
|
|
1646
|
+
autocompleteOptionComponent,
|
|
1647
|
+
loading = false,
|
|
1648
|
+
clearSearchButton = false,
|
|
1649
|
+
searchValue,
|
|
1650
|
+
onChangeSearchValue,
|
|
1651
|
+
options,
|
|
1652
|
+
selectOnFocus = true
|
|
1653
|
+
}, inputRef) {
|
|
1654
|
+
const [isOpen, setIsOpen] = useState7(false);
|
|
1655
|
+
const [activeIndex, setActiveIndex] = useState7(null);
|
|
1656
|
+
const onChangeSearchValueStable = useEventCallback(onChangeSearchValue);
|
|
1657
|
+
const onChangeSelectionStable = useEventCallback(onChangeSelection);
|
|
1658
|
+
const OptionComponent = autocompleteOptionComponent ?? AutocompleteOption_default;
|
|
1659
|
+
const listRef = useRef13([]);
|
|
1660
|
+
const { refs, floatingStyles, context } = useFloating2({
|
|
1661
|
+
placement,
|
|
1662
|
+
open: isOpen,
|
|
1663
|
+
onOpenChange: setIsOpen,
|
|
1664
|
+
whileElementsMounted: autoUpdate2,
|
|
1665
|
+
middleware: [
|
|
1666
|
+
offset2(5),
|
|
1667
|
+
flip2({ padding: 10 }),
|
|
1668
|
+
size({
|
|
1669
|
+
apply({ rects, elements, availableHeight }) {
|
|
1670
|
+
Object.assign(elements.floating.style, {
|
|
1671
|
+
width: `${Math.max(130, rects.reference.width)}px`
|
|
1672
|
+
});
|
|
1673
|
+
const firstChild = elements.floating.firstElementChild;
|
|
1674
|
+
if (firstChild) {
|
|
1675
|
+
firstChild.style.maxHeight = `${Math.min(availableHeight, 288)}px`;
|
|
1676
|
+
}
|
|
1677
|
+
},
|
|
1678
|
+
padding: 10
|
|
1679
|
+
})
|
|
1680
|
+
]
|
|
1681
|
+
});
|
|
1682
|
+
const role = useRole2(context, { role: "listbox" });
|
|
1683
|
+
const dismiss = useDismiss2(context);
|
|
1684
|
+
const listNav = useListNavigation(context, {
|
|
1685
|
+
listRef,
|
|
1686
|
+
activeIndex,
|
|
1687
|
+
onNavigate: setActiveIndex,
|
|
1688
|
+
/* we want the real focus to stay on the input, so focus associated to active items is simulated */
|
|
1689
|
+
virtual: true,
|
|
1690
|
+
loop: true
|
|
1691
|
+
});
|
|
1692
|
+
const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions2([
|
|
1693
|
+
role,
|
|
1694
|
+
dismiss,
|
|
1695
|
+
listNav
|
|
1696
|
+
]);
|
|
1697
|
+
function handleChangeSearchValue(e) {
|
|
1698
|
+
const value = e.target.value;
|
|
1699
|
+
onChangeSearchValueStable(value, false);
|
|
1700
|
+
if (value !== searchValue && selection !== null) {
|
|
1701
|
+
onChangeSelectionStable(null);
|
|
1702
|
+
setActiveIndex(null);
|
|
1703
|
+
return;
|
|
1704
|
+
}
|
|
1705
|
+
if (value) {
|
|
1706
|
+
setIsOpen(true);
|
|
1707
|
+
setActiveIndex(listRef.current[0] ? 0 : null);
|
|
1708
|
+
} else {
|
|
1709
|
+
setIsOpen(false);
|
|
1710
|
+
setActiveIndex(null);
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1713
|
+
const handleSelect = useCallback9(
|
|
1714
|
+
(index) => {
|
|
1715
|
+
if (index === null) {
|
|
1716
|
+
onChangeSelectionStable(null);
|
|
1717
|
+
} else if (options[index]) {
|
|
1718
|
+
const newSelection = options[index];
|
|
1719
|
+
onChangeSelectionStable(newSelection);
|
|
1720
|
+
onChangeSearchValueStable(getOptionLabel(newSelection), true);
|
|
1721
|
+
}
|
|
1722
|
+
setActiveIndex(null);
|
|
1723
|
+
setIsOpen(false);
|
|
1724
|
+
},
|
|
1725
|
+
[options, onChangeSelectionStable, onChangeSearchValueStable]
|
|
1726
|
+
);
|
|
1727
|
+
const autocompleteContext = useMemo2(
|
|
1728
|
+
() => ({
|
|
1729
|
+
activeIndex,
|
|
1730
|
+
selection,
|
|
1731
|
+
getItemProps,
|
|
1732
|
+
handleSelect
|
|
1733
|
+
}),
|
|
1734
|
+
[activeIndex, selection, getItemProps, handleSelect]
|
|
1735
|
+
);
|
|
1736
|
+
return /* @__PURE__ */ jsxs15("div", { className, children: [
|
|
1737
|
+
/* @__PURE__ */ jsxs15("div", { className: clsx23(inputConfig.container), ref: refs.setReference, "data-color": color, children: [
|
|
1738
|
+
icon !== false && /* @__PURE__ */ jsxs15("div", { className: "flex-center relative", children: [
|
|
1739
|
+
loading && /* @__PURE__ */ jsx32(Loader, { size: "medium", color: "gray", className: "absolute top-0 left-0" }),
|
|
1740
|
+
icon === true ? /* @__PURE__ */ jsx32("span", { className: "w-8 h-8 flex-center", children: /* @__PURE__ */ jsx32("i", { className: "fe-search" }) }) : icon
|
|
1741
|
+
] }),
|
|
1742
|
+
/* @__PURE__ */ jsx32(
|
|
1743
|
+
"input",
|
|
1744
|
+
{
|
|
1745
|
+
spellCheck: "false",
|
|
1746
|
+
className: clsx23(inputConfig.input, icon === false && "pl-4"),
|
|
1747
|
+
ref: inputRef,
|
|
1748
|
+
type: "search",
|
|
1749
|
+
value: searchValue,
|
|
1750
|
+
placeholder,
|
|
1751
|
+
"aria-autocomplete": "list",
|
|
1752
|
+
...getReferenceProps({
|
|
1753
|
+
onFocus() {
|
|
1754
|
+
if (selectOnFocus) {
|
|
1755
|
+
document.activeElement?.select();
|
|
1756
|
+
}
|
|
1757
|
+
},
|
|
1758
|
+
onChange: handleChangeSearchValue,
|
|
1759
|
+
onMouseDown() {
|
|
1760
|
+
if (options.length === 0) {
|
|
1761
|
+
return;
|
|
1762
|
+
}
|
|
1763
|
+
setIsOpen((isOpen2) => !isOpen2);
|
|
1764
|
+
},
|
|
1765
|
+
onKeyDown(e) {
|
|
1766
|
+
if (e.key === "Enter" && activeIndex != null) {
|
|
1767
|
+
handleSelect(activeIndex);
|
|
1768
|
+
}
|
|
1769
|
+
}
|
|
1770
|
+
})
|
|
1771
|
+
}
|
|
1772
|
+
),
|
|
1773
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex-center relative", children: [
|
|
1774
|
+
selection && selectionSuffix,
|
|
1775
|
+
clearSearchButton && (searchValue.trim() !== "" || selection !== null) && /* @__PURE__ */ jsx32(
|
|
1776
|
+
Button_default,
|
|
1777
|
+
{
|
|
1778
|
+
withRipple: false,
|
|
1779
|
+
icon: true,
|
|
1780
|
+
color: "gray",
|
|
1781
|
+
variant: "text",
|
|
1782
|
+
onClick: () => {
|
|
1783
|
+
setIsOpen(false);
|
|
1784
|
+
onChangeSelectionStable(null);
|
|
1785
|
+
setActiveIndex(null);
|
|
1786
|
+
onChangeSearchValueStable("", true);
|
|
1787
|
+
},
|
|
1788
|
+
children: /* @__PURE__ */ jsx32("i", { className: "fe-cancel" })
|
|
1789
|
+
}
|
|
1790
|
+
),
|
|
1791
|
+
icon === false && loading && /* @__PURE__ */ jsx32(Loader, { size: "medium", color: "gray" }),
|
|
1792
|
+
!selection && searchValue === "" && noSearchSuffix
|
|
1793
|
+
] })
|
|
1794
|
+
] }),
|
|
1795
|
+
/* @__PURE__ */ jsx32(FloatingPortal2, { children: /* @__PURE__ */ jsx32(AutocompleteContext.Provider, { value: autocompleteContext, children: isOpen && /* @__PURE__ */ jsx32(
|
|
1796
|
+
FloatingFocusManager,
|
|
1797
|
+
{
|
|
1798
|
+
disabled: selectOnFocus,
|
|
1799
|
+
context,
|
|
1800
|
+
initialFocus: -1,
|
|
1801
|
+
visuallyHiddenDismiss: true,
|
|
1802
|
+
children: /* @__PURE__ */ jsx32(
|
|
1803
|
+
"div",
|
|
1804
|
+
{
|
|
1805
|
+
className: "z-dialog",
|
|
1806
|
+
ref: refs.setFloating,
|
|
1807
|
+
style: floatingStyles,
|
|
1808
|
+
...getFloatingProps(),
|
|
1809
|
+
children: /* @__PURE__ */ jsx32(
|
|
1810
|
+
Dialog,
|
|
1811
|
+
{
|
|
1812
|
+
placement: context.placement,
|
|
1813
|
+
className: "animate-fade-in-list overflow-auto",
|
|
1814
|
+
children: /* @__PURE__ */ jsx32(FloatingList, { elementsRef: listRef, children: options.map((option) => {
|
|
1815
|
+
return /* @__PURE__ */ createElement(OptionComponent, { ...option, key: getOptionValue(option) });
|
|
1816
|
+
}) })
|
|
1817
|
+
}
|
|
1818
|
+
)
|
|
1819
|
+
}
|
|
1820
|
+
)
|
|
1821
|
+
}
|
|
1822
|
+
) }) })
|
|
1823
|
+
] });
|
|
1824
|
+
}
|
|
1825
|
+
var Autocomplete_default = forwardRef10(Autocomplete);
|
|
1826
|
+
|
|
1827
|
+
// src/components/autocomplete/SimpleAutocomplete.tsx
|
|
1828
|
+
import { useLayoutEffect as useLayoutEffect2, useRef as useRef14, useState as useState8 } from "react";
|
|
1829
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
1830
|
+
function SimpleAutocomplete({
|
|
1831
|
+
options,
|
|
1832
|
+
selection = null,
|
|
1833
|
+
onChangeSelection,
|
|
1834
|
+
...rest
|
|
1835
|
+
}) {
|
|
1836
|
+
const onChangeSelectionStable = useEventCallback(onChangeSelection);
|
|
1837
|
+
const [searchValue, setSearchValue] = useState8(selection ? getOptionLabel(selection) : "");
|
|
1838
|
+
const searchValueRef = useRef14(searchValue);
|
|
1839
|
+
searchValueRef.current = searchValue;
|
|
1840
|
+
const inputRef = useRef14(null);
|
|
1841
|
+
useLayoutEffect2(() => {
|
|
1842
|
+
if (selection === null) {
|
|
1843
|
+
if (document.activeElement !== inputRef.current) {
|
|
1844
|
+
setSearchValue("");
|
|
1845
|
+
}
|
|
1846
|
+
return;
|
|
1847
|
+
}
|
|
1848
|
+
const selectionLabel = getOptionLabel(selection);
|
|
1849
|
+
if (searchValueRef.current !== getOptionLabel(selection)) {
|
|
1850
|
+
setSearchValue(selectionLabel);
|
|
1851
|
+
}
|
|
1852
|
+
}, [selection, setSearchValue]);
|
|
1853
|
+
const filteredOptions = selection !== null ? [] : options.filter((option) => {
|
|
1854
|
+
const optionLabel = getOptionLabel(option);
|
|
1855
|
+
return optionLabel.toLowerCase().startsWith(searchValue.toLowerCase());
|
|
1856
|
+
});
|
|
1857
|
+
return /* @__PURE__ */ jsx33(
|
|
1858
|
+
Autocomplete_default,
|
|
1859
|
+
{
|
|
1860
|
+
ref: inputRef,
|
|
1861
|
+
searchValue,
|
|
1862
|
+
onChangeSearchValue: setSearchValue,
|
|
1863
|
+
selection,
|
|
1864
|
+
onChangeSelection: onChangeSelectionStable,
|
|
1865
|
+
options: filteredOptions,
|
|
1866
|
+
...rest
|
|
1867
|
+
}
|
|
1868
|
+
);
|
|
1869
|
+
}
|
|
1870
|
+
|
|
1871
|
+
// src/components/autocomplete/LazyAutocomplete.tsx
|
|
1872
|
+
import { useCallback as useCallback10, useEffect as useEffect11, useLayoutEffect as useLayoutEffect3, useRef as useRef15, useState as useState9 } from "react";
|
|
1873
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
1874
|
+
function LazyAutocomplete({
|
|
1875
|
+
onChangeSearchValueCallback,
|
|
1876
|
+
debounce = 500,
|
|
1877
|
+
selection = null,
|
|
1878
|
+
onChangeSelection,
|
|
1879
|
+
...rest
|
|
1880
|
+
}) {
|
|
1881
|
+
const onChangeSelectionStable = useEventCallback(onChangeSelection);
|
|
1882
|
+
const [searchValue, searchValueDebounced, setSearchValue] = useStateDebounce(
|
|
1883
|
+
selection ? getOptionLabel(selection) : "",
|
|
1884
|
+
debounce
|
|
1885
|
+
);
|
|
1886
|
+
const searchValueRef = useRef15(searchValue);
|
|
1887
|
+
searchValueRef.current = searchValue;
|
|
1888
|
+
const inputRef = useRef15(null);
|
|
1889
|
+
const [loading, setLoading] = useState9(false);
|
|
1890
|
+
const [options, setOptions] = useState9([]);
|
|
1891
|
+
const handleChangeSelection = useCallback10(
|
|
1892
|
+
(selection2) => {
|
|
1893
|
+
onChangeSelectionStable(selection2);
|
|
1894
|
+
if (selection2) {
|
|
1895
|
+
setOptions([]);
|
|
1896
|
+
}
|
|
1897
|
+
},
|
|
1898
|
+
[onChangeSelectionStable]
|
|
1899
|
+
);
|
|
1900
|
+
useLayoutEffect3(() => {
|
|
1901
|
+
if (selection === null) {
|
|
1902
|
+
if (document.activeElement !== inputRef.current) {
|
|
1903
|
+
setSearchValue("");
|
|
1904
|
+
}
|
|
1905
|
+
return;
|
|
1906
|
+
}
|
|
1907
|
+
const selectionLabel = getOptionLabel(selection);
|
|
1908
|
+
if (searchValueRef.current !== selectionLabel) {
|
|
1909
|
+
setSearchValue(selectionLabel, true);
|
|
1910
|
+
}
|
|
1911
|
+
}, [selection, setSearchValue]);
|
|
1912
|
+
useEffect11(() => {
|
|
1913
|
+
let abort = false;
|
|
1914
|
+
if (selection) {
|
|
1915
|
+
return;
|
|
1916
|
+
}
|
|
1917
|
+
if (searchValueDebounced.trim() === "") {
|
|
1918
|
+
setOptions([]);
|
|
1919
|
+
return;
|
|
1920
|
+
}
|
|
1921
|
+
setLoading(true);
|
|
1922
|
+
onChangeSearchValueCallback(searchValueDebounced).then((newOptions) => {
|
|
1923
|
+
setLoading(false);
|
|
1924
|
+
if (!abort) {
|
|
1925
|
+
setOptions(newOptions);
|
|
1926
|
+
}
|
|
1927
|
+
}).catch(() => {
|
|
1928
|
+
setLoading(false);
|
|
1929
|
+
});
|
|
1930
|
+
return () => {
|
|
1931
|
+
setLoading(false);
|
|
1932
|
+
abort = true;
|
|
1933
|
+
};
|
|
1934
|
+
}, [selection, searchValueDebounced, onChangeSearchValueCallback]);
|
|
1935
|
+
return /* @__PURE__ */ jsx34(
|
|
1936
|
+
Autocomplete_default,
|
|
1937
|
+
{
|
|
1938
|
+
ref: inputRef,
|
|
1939
|
+
searchValue,
|
|
1940
|
+
onChangeSearchValue: (newValue, immediate) => {
|
|
1941
|
+
setSearchValue(newValue, immediate || newValue === "" ? true : false);
|
|
1942
|
+
},
|
|
1943
|
+
selection,
|
|
1944
|
+
onChangeSelection: handleChangeSelection,
|
|
1945
|
+
options,
|
|
1946
|
+
loading,
|
|
1947
|
+
...rest
|
|
1948
|
+
}
|
|
1949
|
+
);
|
|
1950
|
+
}
|
|
1951
|
+
|
|
1952
|
+
// src/components/context-menu/ContextMenu.tsx
|
|
1953
|
+
import {
|
|
1954
|
+
Children,
|
|
1955
|
+
cloneElement as cloneElement2,
|
|
1956
|
+
isValidElement as isValidElement3,
|
|
1957
|
+
useEffect as useEffect12,
|
|
1958
|
+
useRef as useRef16,
|
|
1959
|
+
useState as useState10
|
|
1960
|
+
} from "react";
|
|
1961
|
+
import {
|
|
1962
|
+
FloatingFocusManager as FloatingFocusManager2,
|
|
1963
|
+
FloatingPortal as FloatingPortal3,
|
|
1964
|
+
autoUpdate as autoUpdate3,
|
|
1965
|
+
flip as flip3,
|
|
1966
|
+
offset as offset3,
|
|
1967
|
+
shift as shift2,
|
|
1968
|
+
size as size2,
|
|
1969
|
+
useDismiss as useDismiss3,
|
|
1970
|
+
useFloating as useFloating3,
|
|
1971
|
+
useInteractions as useInteractions3,
|
|
1972
|
+
useListNavigation as useListNavigation2,
|
|
1973
|
+
useRole as useRole3,
|
|
1974
|
+
useTypeahead
|
|
1975
|
+
} from "@floating-ui/react";
|
|
1976
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
1977
|
+
function ContextMenu({ children, style, eventName = "contextmenu" }) {
|
|
1978
|
+
const [activeIndex, setActiveIndex] = useState10(null);
|
|
1979
|
+
const [isOpen, setIsOpen] = useState10(false);
|
|
1980
|
+
const isOpenDebounceRef = useRefDebounce(isOpen, 500);
|
|
1981
|
+
const contextEvent = useRef16(null);
|
|
1982
|
+
const listItemsRef = useRef16([]);
|
|
1983
|
+
const listContentRef = useRef16(
|
|
1984
|
+
Children.map(
|
|
1985
|
+
children,
|
|
1986
|
+
(child) => isValidElement3(child) ? child.props.label : null
|
|
1987
|
+
)
|
|
1988
|
+
);
|
|
1989
|
+
const { refs, floatingStyles, context } = useFloating3({
|
|
1990
|
+
open: isOpen,
|
|
1991
|
+
onOpenChange: setIsOpen,
|
|
1992
|
+
middleware: [
|
|
1993
|
+
offset3({ mainAxis: 5, alignmentAxis: 4 }),
|
|
1994
|
+
flip3(),
|
|
1995
|
+
size2({
|
|
1996
|
+
apply({ elements, availableHeight }) {
|
|
1997
|
+
const firstChild = elements.floating.firstElementChild;
|
|
1998
|
+
if (firstChild) {
|
|
1999
|
+
firstChild.style.maxHeight = `${Math.min(availableHeight, 300)}px`;
|
|
2000
|
+
}
|
|
2001
|
+
},
|
|
2002
|
+
padding: 10
|
|
2003
|
+
}),
|
|
2004
|
+
shift2({ padding: 10 })
|
|
2005
|
+
],
|
|
2006
|
+
/**
|
|
2007
|
+
* it is better to be less demanding on small screen sizes to see the content displayed correctly
|
|
2008
|
+
*/
|
|
2009
|
+
placement: window.matchMedia("(min-width: 700px)").matches ? "right-start" : void 0,
|
|
2010
|
+
strategy: "fixed",
|
|
2011
|
+
whileElementsMounted: autoUpdate3
|
|
2012
|
+
});
|
|
2013
|
+
const role = useRole3(context, { role: "menu" });
|
|
2014
|
+
const dismiss = useDismiss3(context);
|
|
2015
|
+
const listNavigation = useListNavigation2(context, {
|
|
2016
|
+
listRef: listItemsRef,
|
|
2017
|
+
onNavigate: setActiveIndex,
|
|
2018
|
+
activeIndex
|
|
2019
|
+
});
|
|
2020
|
+
const typeahead = useTypeahead(context, {
|
|
2021
|
+
enabled: isOpen,
|
|
2022
|
+
listRef: listContentRef,
|
|
2023
|
+
onMatch: setActiveIndex,
|
|
2024
|
+
activeIndex
|
|
2025
|
+
});
|
|
2026
|
+
const { getFloatingProps, getItemProps } = useInteractions3([
|
|
2027
|
+
role,
|
|
2028
|
+
dismiss,
|
|
2029
|
+
listNavigation,
|
|
2030
|
+
typeahead
|
|
2031
|
+
]);
|
|
2032
|
+
const onContextMenuStable = useEventCallback(function onContextMenu(e) {
|
|
2033
|
+
if (isOpenDebounceRef.current) {
|
|
2034
|
+
return;
|
|
2035
|
+
}
|
|
2036
|
+
e.preventDefault();
|
|
2037
|
+
const originalEvent = e instanceof MouseEvent ? e : e.detail.originalEvent;
|
|
2038
|
+
contextEvent.current = e;
|
|
2039
|
+
refs.setPositionReference({
|
|
2040
|
+
getBoundingClientRect() {
|
|
2041
|
+
return {
|
|
2042
|
+
width: 0,
|
|
2043
|
+
height: 0,
|
|
2044
|
+
x: originalEvent.clientX,
|
|
2045
|
+
y: originalEvent.clientY,
|
|
2046
|
+
top: originalEvent.clientY,
|
|
2047
|
+
right: originalEvent.clientX,
|
|
2048
|
+
bottom: originalEvent.clientY,
|
|
2049
|
+
left: originalEvent.clientX
|
|
2050
|
+
};
|
|
2051
|
+
}
|
|
2052
|
+
});
|
|
2053
|
+
setIsOpen(true);
|
|
2054
|
+
isOpenDebounceRef.current = true;
|
|
2055
|
+
});
|
|
2056
|
+
useEffect12(() => {
|
|
2057
|
+
document.addEventListener(eventName, onContextMenuStable);
|
|
2058
|
+
return () => {
|
|
2059
|
+
document.removeEventListener(eventName, onContextMenuStable);
|
|
2060
|
+
};
|
|
2061
|
+
}, [eventName, onContextMenuStable]);
|
|
2062
|
+
return /* @__PURE__ */ jsx35(FloatingPortal3, { children: isOpen && /* @__PURE__ */ jsx35(FloatingFocusManager2, { context, initialFocus: refs.floating, children: /* @__PURE__ */ jsx35(
|
|
2063
|
+
"div",
|
|
2064
|
+
{
|
|
2065
|
+
className: "z-dialog",
|
|
2066
|
+
ref: refs.setFloating,
|
|
2067
|
+
style: { ...floatingStyles, ...style },
|
|
2068
|
+
...getFloatingProps(),
|
|
2069
|
+
children: /* @__PURE__ */ jsx35(
|
|
2070
|
+
Dialog,
|
|
2071
|
+
{
|
|
2072
|
+
placement: context.placement,
|
|
2073
|
+
className: "animate-fade-in-list z-context-menu max-h-80 overflow-auto",
|
|
2074
|
+
children: Children.map(
|
|
2075
|
+
children,
|
|
2076
|
+
(child, index) => isValidElement3(child) && cloneElement2(
|
|
2077
|
+
child,
|
|
2078
|
+
getItemProps({
|
|
2079
|
+
tabIndex: activeIndex === index ? 0 : -1,
|
|
2080
|
+
ref(node) {
|
|
2081
|
+
listItemsRef.current[index] = node;
|
|
2082
|
+
},
|
|
2083
|
+
onClick() {
|
|
2084
|
+
child.props.onClick?.(contextEvent.current);
|
|
2085
|
+
setIsOpen(false);
|
|
2086
|
+
},
|
|
2087
|
+
onMouseUp() {
|
|
2088
|
+
child.props.onClick?.(contextEvent.current);
|
|
2089
|
+
setIsOpen(false);
|
|
2090
|
+
}
|
|
2091
|
+
})
|
|
2092
|
+
)
|
|
2093
|
+
)
|
|
2094
|
+
}
|
|
2095
|
+
)
|
|
2096
|
+
}
|
|
2097
|
+
) }) });
|
|
2098
|
+
}
|
|
2099
|
+
|
|
2100
|
+
// src/components/context-menu/ContextMenuItem.tsx
|
|
2101
|
+
import { forwardRef as forwardRef11 } from "react";
|
|
2102
|
+
import clsx24 from "clsx";
|
|
2103
|
+
import { jsx as jsx36, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2104
|
+
var ContextMenuItem = forwardRef11(
|
|
2105
|
+
({ label, disabled, icon, className, ...props }, ref) => {
|
|
2106
|
+
return /* @__PURE__ */ jsxs16(
|
|
2107
|
+
"button",
|
|
2108
|
+
{
|
|
2109
|
+
...props,
|
|
2110
|
+
className: clsx24(["option", className]),
|
|
2111
|
+
ref,
|
|
2112
|
+
role: "menuitem",
|
|
2113
|
+
disabled,
|
|
2114
|
+
children: [
|
|
2115
|
+
icon,
|
|
2116
|
+
/* @__PURE__ */ jsx36("span", { className: "content", children: label })
|
|
2117
|
+
]
|
|
2118
|
+
}
|
|
2119
|
+
);
|
|
2120
|
+
}
|
|
2121
|
+
);
|
|
2122
|
+
var ContextMenuItem_default = ContextMenuItem;
|
|
2123
|
+
|
|
2124
|
+
// src/components/dropdown-menu/DropdownMenu.tsx
|
|
2125
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
2126
|
+
function DropdownMenu({ children, ...options }) {
|
|
2127
|
+
const popover = useDropdownMenu(options);
|
|
2128
|
+
return /* @__PURE__ */ jsx37(DropdownMenuContext.Provider, { value: popover, children });
|
|
2129
|
+
}
|
|
2130
|
+
|
|
2131
|
+
// src/components/dropdown-menu/DropdownMenuContent.tsx
|
|
2132
|
+
import { forwardRef as forwardRef12 } from "react";
|
|
2133
|
+
import {
|
|
2134
|
+
FloatingFocusManager as FloatingFocusManager3,
|
|
2135
|
+
FloatingList as FloatingList2,
|
|
2136
|
+
FloatingPortal as FloatingPortal4,
|
|
2137
|
+
useMergeRefs as useMergeRefs3
|
|
2138
|
+
} from "@floating-ui/react";
|
|
2139
|
+
import clsx25 from "clsx";
|
|
2140
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
2141
|
+
var DropdownMenuContent = forwardRef12(
|
|
2142
|
+
({ style, children, ...props }, propRef) => {
|
|
2143
|
+
const context = useDropdownMenuContext();
|
|
2144
|
+
const floatingContext = context.context;
|
|
2145
|
+
const ref = useMergeRefs3([context.refs.setFloating, propRef]);
|
|
2146
|
+
if (!context.open) {
|
|
2147
|
+
return null;
|
|
2148
|
+
}
|
|
2149
|
+
return /* @__PURE__ */ jsx38(FloatingPortal4, { children: /* @__PURE__ */ jsx38(FloatingFocusManager3, { context: floatingContext, modal: context.modal, children: /* @__PURE__ */ jsx38(
|
|
2150
|
+
"div",
|
|
2151
|
+
{
|
|
2152
|
+
ref,
|
|
2153
|
+
style: { ...context.floatingStyles, ...style },
|
|
2154
|
+
...context.getFloatingProps(props),
|
|
2155
|
+
children: /* @__PURE__ */ jsx38(
|
|
2156
|
+
Dialog,
|
|
2157
|
+
{
|
|
2158
|
+
placement: context.placement,
|
|
2159
|
+
className: clsx25(`border-${context.color}-2`, "animate-fade-in-list"),
|
|
2160
|
+
children: /* @__PURE__ */ jsx38("div", { className: "box", children: /* @__PURE__ */ jsx38(FloatingList2, { elementsRef: context.elementsRef, labelsRef: context.labelsRef, children }) })
|
|
2161
|
+
}
|
|
2162
|
+
)
|
|
2163
|
+
}
|
|
2164
|
+
) }) });
|
|
2165
|
+
}
|
|
2166
|
+
);
|
|
2167
|
+
var DropdownMenuContent_default = DropdownMenuContent;
|
|
2168
|
+
|
|
2169
|
+
// src/components/dropdown-menu/DropdownMenuTrigger.tsx
|
|
2170
|
+
import { cloneElement as cloneElement3, forwardRef as forwardRef13, isValidElement as isValidElement4 } from "react";
|
|
2171
|
+
import { useMergeRefs as useMergeRefs4 } from "@floating-ui/react";
|
|
2172
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
2173
|
+
var DropdownMenuTrigger = forwardRef13(
|
|
2174
|
+
({ children, asChild = false, ...props }, propRef) => {
|
|
2175
|
+
const context = useDropdownMenuContext();
|
|
2176
|
+
const childrenRef = children.ref;
|
|
2177
|
+
const ref = useMergeRefs4([context.refs.setReference, propRef, childrenRef]);
|
|
2178
|
+
if (asChild && isValidElement4(children)) {
|
|
2179
|
+
return cloneElement3(
|
|
2180
|
+
children,
|
|
2181
|
+
context.getReferenceProps({
|
|
2182
|
+
ref,
|
|
2183
|
+
...props,
|
|
2184
|
+
...children.props,
|
|
2185
|
+
"data-state": context.open ? "open" : "closed"
|
|
2186
|
+
})
|
|
2187
|
+
);
|
|
2188
|
+
}
|
|
2189
|
+
return /* @__PURE__ */ jsx39(
|
|
2190
|
+
Button_default,
|
|
2191
|
+
{
|
|
2192
|
+
variant: "outlined",
|
|
2193
|
+
ref,
|
|
2194
|
+
"data-state": context.open ? "open" : "closed",
|
|
2195
|
+
...context.getReferenceProps(props),
|
|
2196
|
+
children
|
|
2197
|
+
}
|
|
2198
|
+
);
|
|
2199
|
+
}
|
|
2200
|
+
);
|
|
2201
|
+
var DropdownMenuTrigger_default = DropdownMenuTrigger;
|
|
2202
|
+
|
|
2203
|
+
// src/components/dropdown-menu/useDropdownMenu.tsx
|
|
2204
|
+
import { useCallback as useCallback11, useMemo as useMemo3, useRef as useRef17, useState as useState11 } from "react";
|
|
2205
|
+
import {
|
|
2206
|
+
autoUpdate as autoUpdate4,
|
|
2207
|
+
flip as flip4,
|
|
2208
|
+
offset as offset4,
|
|
2209
|
+
shift as shift3,
|
|
2210
|
+
useClick,
|
|
2211
|
+
useDismiss as useDismiss4,
|
|
2212
|
+
useFloating as useFloating4,
|
|
2213
|
+
useInteractions as useInteractions4,
|
|
2214
|
+
useListNavigation as useListNavigation3,
|
|
2215
|
+
useRole as useRole4,
|
|
2216
|
+
useTypeahead as useTypeahead2
|
|
2217
|
+
} from "@floating-ui/react";
|
|
2218
|
+
var arrowWidth2 = 12;
|
|
2219
|
+
function useDropdownMenu({
|
|
2220
|
+
initialOpen = false,
|
|
2221
|
+
placement = "bottom",
|
|
2222
|
+
open: controlledOpen,
|
|
2223
|
+
onOpen: setControlledOpen,
|
|
2224
|
+
color = "default",
|
|
2225
|
+
modal = false
|
|
2226
|
+
}) {
|
|
2227
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState11(initialOpen);
|
|
2228
|
+
const isUncontrolled = controlledOpen === null || controlledOpen === void 0;
|
|
2229
|
+
const open = isUncontrolled ? uncontrolledOpen : controlledOpen;
|
|
2230
|
+
const setOpen = isUncontrolled ? setUncontrolledOpen : setControlledOpen;
|
|
2231
|
+
const [activeIndex, setActiveIndex] = useState11(null);
|
|
2232
|
+
const elementsRef = useRef17([]);
|
|
2233
|
+
const labelsRef = useRef17([]);
|
|
2234
|
+
const offsetVal = 2 + arrowWidth2 / 2;
|
|
2235
|
+
const data = useFloating4({
|
|
2236
|
+
placement,
|
|
2237
|
+
open,
|
|
2238
|
+
onOpenChange: setOpen,
|
|
2239
|
+
whileElementsMounted: autoUpdate4,
|
|
2240
|
+
middleware: [
|
|
2241
|
+
offset4(offsetVal),
|
|
2242
|
+
flip4({
|
|
2243
|
+
// crossAxis: placement.includes('-'),
|
|
2244
|
+
// fallbackAxisSideDirection: "end",
|
|
2245
|
+
}),
|
|
2246
|
+
shift3({ padding: 5 })
|
|
2247
|
+
]
|
|
2248
|
+
});
|
|
2249
|
+
const { context } = data;
|
|
2250
|
+
const click = useClick(context, {
|
|
2251
|
+
// TODO verify if use case to disable it
|
|
2252
|
+
// enabled: isUncontrolled,
|
|
2253
|
+
});
|
|
2254
|
+
const dismiss = useDismiss4(context);
|
|
2255
|
+
const role = useRole4(context);
|
|
2256
|
+
const listNav = useListNavigation3(context, {
|
|
2257
|
+
listRef: elementsRef,
|
|
2258
|
+
activeIndex,
|
|
2259
|
+
onNavigate: setActiveIndex,
|
|
2260
|
+
loop: true
|
|
2261
|
+
});
|
|
2262
|
+
const handleSelect = useCallback11(() => {
|
|
2263
|
+
setOpen(false);
|
|
2264
|
+
}, [setOpen]);
|
|
2265
|
+
function handleTypeaheadMatch(index) {
|
|
2266
|
+
if (open) {
|
|
2267
|
+
setActiveIndex(index);
|
|
2268
|
+
} else {
|
|
2269
|
+
handleSelect();
|
|
2270
|
+
}
|
|
2271
|
+
}
|
|
2272
|
+
const typeahead = useTypeahead2(context, {
|
|
2273
|
+
listRef: labelsRef,
|
|
2274
|
+
activeIndex,
|
|
2275
|
+
onMatch: handleTypeaheadMatch
|
|
2276
|
+
});
|
|
2277
|
+
const interactions = useInteractions4([click, dismiss, role, listNav, typeahead]);
|
|
2278
|
+
return useMemo3(
|
|
2279
|
+
() => ({
|
|
2280
|
+
open,
|
|
2281
|
+
setOpen,
|
|
2282
|
+
...interactions,
|
|
2283
|
+
...data,
|
|
2284
|
+
elementsRef,
|
|
2285
|
+
labelsRef,
|
|
2286
|
+
color,
|
|
2287
|
+
modal,
|
|
2288
|
+
activeIndex,
|
|
2289
|
+
handleSelect
|
|
2290
|
+
}),
|
|
2291
|
+
[
|
|
2292
|
+
open,
|
|
2293
|
+
setOpen,
|
|
2294
|
+
interactions,
|
|
2295
|
+
data,
|
|
2296
|
+
color,
|
|
2297
|
+
modal,
|
|
2298
|
+
activeIndex,
|
|
2299
|
+
// getItemProps,
|
|
2300
|
+
handleSelect
|
|
2301
|
+
]
|
|
2302
|
+
);
|
|
2303
|
+
}
|
|
2304
|
+
|
|
2305
|
+
// src/components/dropdown-menu/useDropdownMenuContext.ts
|
|
2306
|
+
import { createContext as createContext4, useContext as useContext4 } from "react";
|
|
2307
|
+
var DropdownMenuContext = createContext4(null);
|
|
2308
|
+
function useDropdownMenuContext() {
|
|
2309
|
+
const context = useContext4(DropdownMenuContext);
|
|
2310
|
+
if (context === null) {
|
|
2311
|
+
throw new Error("DropdownMenu components must be wrapped in <DropdownMenu />");
|
|
2312
|
+
}
|
|
2313
|
+
return context;
|
|
2314
|
+
}
|
|
2315
|
+
|
|
2316
|
+
// src/components/dropdown-menu/DropdownMenuItem.tsx
|
|
2317
|
+
import { useListItem as useListItem2 } from "@floating-ui/react";
|
|
2318
|
+
import clsx26 from "clsx";
|
|
2319
|
+
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
2320
|
+
function DropdownMenuItem({ children, onClick, ...rest }) {
|
|
2321
|
+
const { activeIndex, getItemProps, handleSelect } = useDropdownMenuContext();
|
|
2322
|
+
const { ref, index } = useListItem2({ label: children?.toString() });
|
|
2323
|
+
const isActive = activeIndex === index;
|
|
2324
|
+
return /* @__PURE__ */ jsx40(
|
|
2325
|
+
"button",
|
|
2326
|
+
{
|
|
2327
|
+
className: clsx26("option", isActive && "bg-gray-1"),
|
|
2328
|
+
ref,
|
|
2329
|
+
role: "option",
|
|
2330
|
+
"aria-selected": isActive,
|
|
2331
|
+
tabIndex: isActive ? 0 : -1,
|
|
2332
|
+
...getItemProps({
|
|
2333
|
+
...rest,
|
|
2334
|
+
onClick: (e) => {
|
|
2335
|
+
onClick?.(e);
|
|
2336
|
+
handleSelect();
|
|
2337
|
+
}
|
|
2338
|
+
}),
|
|
2339
|
+
children
|
|
2340
|
+
}
|
|
2341
|
+
);
|
|
2342
|
+
}
|
|
2343
|
+
|
|
2344
|
+
// src/components/dropdown-menu-nested/DropdownMenuNested.tsx
|
|
2345
|
+
import { forwardRef as forwardRef15 } from "react";
|
|
2346
|
+
|
|
2347
|
+
// src/components/dropdown-menu-nested/MenuItemWithChildren.tsx
|
|
2348
|
+
import {
|
|
2349
|
+
FloatingFocusManager as FloatingFocusManager4,
|
|
2350
|
+
FloatingList as FloatingList3,
|
|
2351
|
+
FloatingNode,
|
|
2352
|
+
FloatingPortal as FloatingPortal5,
|
|
2353
|
+
autoUpdate as autoUpdate5,
|
|
2354
|
+
flip as flip5,
|
|
2355
|
+
offset as offset5,
|
|
2356
|
+
safePolygon,
|
|
2357
|
+
shift as shift4,
|
|
2358
|
+
useClick as useClick2,
|
|
2359
|
+
useDismiss as useDismiss5,
|
|
2360
|
+
useFloating as useFloating5,
|
|
2361
|
+
useFloatingNodeId,
|
|
2362
|
+
useFloatingParentNodeId,
|
|
2363
|
+
useFloatingTree,
|
|
2364
|
+
useHover as useHover2,
|
|
2365
|
+
useInteractions as useInteractions5,
|
|
2366
|
+
useListItem as useListItem3,
|
|
2367
|
+
useListNavigation as useListNavigation4,
|
|
2368
|
+
useMergeRefs as useMergeRefs5,
|
|
2369
|
+
useRole as useRole5,
|
|
2370
|
+
useTypeahead as useTypeahead3
|
|
2371
|
+
} from "@floating-ui/react";
|
|
2372
|
+
import { forwardRef as forwardRef14, useContext as useContext5, useEffect as useEffect13, useRef as useRef18, useState as useState12 } from "react";
|
|
2373
|
+
|
|
2374
|
+
// src/components/dropdown-menu-nested/MenuContext.ts
|
|
2375
|
+
import { createContext as createContext5 } from "react";
|
|
2376
|
+
var MenuContext = createContext5({
|
|
2377
|
+
getItemProps: () => ({}),
|
|
2378
|
+
activeIndex: null,
|
|
2379
|
+
setActiveIndex: () => {
|
|
2380
|
+
},
|
|
2381
|
+
setHasFocusInside: () => {
|
|
2382
|
+
},
|
|
2383
|
+
isOpen: false
|
|
2384
|
+
});
|
|
2385
|
+
|
|
2386
|
+
// src/components/dropdown-menu-nested/MenuItemWithChildren.tsx
|
|
2387
|
+
import clsx27 from "clsx";
|
|
2388
|
+
import { jsx as jsx41, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2389
|
+
var MenuItemWithChildren = forwardRef14(
|
|
2390
|
+
({ children, label, triggerComponent: TriggerComponent = Button_default, ...props }, forwardedRef) => {
|
|
2391
|
+
const [isOpen, setIsOpen] = useState12(false);
|
|
2392
|
+
const [hasFocusInside, setHasFocusInside] = useState12(false);
|
|
2393
|
+
const [activeIndex, setActiveIndex] = useState12(null);
|
|
2394
|
+
const elementsRef = useRef18([]);
|
|
2395
|
+
const labelsRef = useRef18([]);
|
|
2396
|
+
const parent = useContext5(MenuContext);
|
|
2397
|
+
const tree = useFloatingTree();
|
|
2398
|
+
const nodeId = useFloatingNodeId();
|
|
2399
|
+
const parentId = useFloatingParentNodeId();
|
|
2400
|
+
const item = useListItem3();
|
|
2401
|
+
const isNested = parentId != null;
|
|
2402
|
+
const { floatingStyles, refs, context } = useFloating5({
|
|
2403
|
+
nodeId,
|
|
2404
|
+
open: isOpen,
|
|
2405
|
+
onOpenChange: setIsOpen,
|
|
2406
|
+
placement: isNested ? "right-start" : "bottom-start",
|
|
2407
|
+
middleware: [
|
|
2408
|
+
offset5({ mainAxis: isNested ? -8 : 10, alignmentAxis: isNested ? 0 : 0 }),
|
|
2409
|
+
flip5(),
|
|
2410
|
+
shift4()
|
|
2411
|
+
],
|
|
2412
|
+
whileElementsMounted: autoUpdate5
|
|
2413
|
+
});
|
|
2414
|
+
const hover = useHover2(context, {
|
|
2415
|
+
enabled: isNested,
|
|
2416
|
+
delay: { open: 75 },
|
|
2417
|
+
handleClose: safePolygon({ blockPointerEvents: true })
|
|
2418
|
+
});
|
|
2419
|
+
const click = useClick2(context, {
|
|
2420
|
+
event: "mousedown",
|
|
2421
|
+
toggle: !isNested,
|
|
2422
|
+
ignoreMouse: isNested
|
|
2423
|
+
});
|
|
2424
|
+
const role = useRole5(context, { role: "menu" });
|
|
2425
|
+
const dismiss = useDismiss5(context, { bubbles: true });
|
|
2426
|
+
const listNavigation = useListNavigation4(context, {
|
|
2427
|
+
listRef: elementsRef,
|
|
2428
|
+
activeIndex,
|
|
2429
|
+
nested: isNested,
|
|
2430
|
+
onNavigate: setActiveIndex
|
|
2431
|
+
});
|
|
2432
|
+
const typeahead = useTypeahead3(context, {
|
|
2433
|
+
listRef: labelsRef,
|
|
2434
|
+
onMatch: isOpen ? setActiveIndex : void 0,
|
|
2435
|
+
activeIndex
|
|
2436
|
+
});
|
|
2437
|
+
const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions5([
|
|
2438
|
+
hover,
|
|
2439
|
+
click,
|
|
2440
|
+
role,
|
|
2441
|
+
dismiss,
|
|
2442
|
+
listNavigation,
|
|
2443
|
+
typeahead
|
|
2444
|
+
]);
|
|
2445
|
+
useEffect13(() => {
|
|
2446
|
+
if (!tree)
|
|
2447
|
+
return;
|
|
2448
|
+
function handleTreeClick() {
|
|
2449
|
+
setIsOpen(false);
|
|
2450
|
+
}
|
|
2451
|
+
function onSubMenuOpen(event) {
|
|
2452
|
+
if (event.nodeId !== nodeId && event.parentId === parentId) {
|
|
2453
|
+
setIsOpen(false);
|
|
2454
|
+
}
|
|
2455
|
+
}
|
|
2456
|
+
tree.events.on("click", handleTreeClick);
|
|
2457
|
+
tree.events.on("menuopen", onSubMenuOpen);
|
|
2458
|
+
return () => {
|
|
2459
|
+
tree.events.off("click", handleTreeClick);
|
|
2460
|
+
tree.events.off("menuopen", onSubMenuOpen);
|
|
2461
|
+
};
|
|
2462
|
+
}, [tree, nodeId, parentId]);
|
|
2463
|
+
useEffect13(() => {
|
|
2464
|
+
if (isOpen && tree) {
|
|
2465
|
+
tree.events.emit("menuopen", { parentId, nodeId });
|
|
2466
|
+
}
|
|
2467
|
+
}, [tree, isOpen, nodeId, parentId]);
|
|
2468
|
+
const ref = useMergeRefs5([refs.setReference, item.ref, forwardedRef]);
|
|
2469
|
+
return /* @__PURE__ */ jsxs17(FloatingNode, { id: nodeId, children: [
|
|
2470
|
+
isNested ? /* @__PURE__ */ jsxs17(
|
|
2471
|
+
"button",
|
|
2472
|
+
{
|
|
2473
|
+
ref,
|
|
2474
|
+
tabIndex: parent.activeIndex === item.index ? 0 : -1,
|
|
2475
|
+
role: "menuitem",
|
|
2476
|
+
"data-open": isOpen ? "" : void 0,
|
|
2477
|
+
"data-nested": "",
|
|
2478
|
+
"data-focus-inside": hasFocusInside ? "" : void 0,
|
|
2479
|
+
...getReferenceProps(
|
|
2480
|
+
parent.getItemProps({
|
|
2481
|
+
onFocus(event) {
|
|
2482
|
+
props.onFocus?.(event);
|
|
2483
|
+
setHasFocusInside(false);
|
|
2484
|
+
parent.setHasFocusInside(true);
|
|
2485
|
+
}
|
|
2486
|
+
})
|
|
2487
|
+
),
|
|
2488
|
+
className: clsx27(isNested && "option"),
|
|
2489
|
+
children: [
|
|
2490
|
+
/* @__PURE__ */ jsx41("span", { children: label }),
|
|
2491
|
+
/* @__PURE__ */ jsx41("span", { className: "ml-auto", children: /* @__PURE__ */ jsx41("i", { className: "fe-angle-right mr-0", "aria-hidden": true }) })
|
|
2492
|
+
]
|
|
2493
|
+
}
|
|
2494
|
+
) : /* @__PURE__ */ jsx41(
|
|
2495
|
+
TriggerComponent,
|
|
2496
|
+
{
|
|
2497
|
+
ref,
|
|
2498
|
+
"data-open": isOpen ? "" : void 0,
|
|
2499
|
+
"data-focus-inside": hasFocusInside ? "" : void 0,
|
|
2500
|
+
...props,
|
|
2501
|
+
...getReferenceProps(
|
|
2502
|
+
parent.getItemProps({
|
|
2503
|
+
onFocus(event) {
|
|
2504
|
+
props.onFocus?.(event);
|
|
2505
|
+
setHasFocusInside(false);
|
|
2506
|
+
parent.setHasFocusInside(true);
|
|
2507
|
+
}
|
|
2508
|
+
})
|
|
2509
|
+
),
|
|
2510
|
+
className: clsx27(
|
|
2511
|
+
isNested && "option",
|
|
2512
|
+
!isNested && !TriggerComponent && "ll-dropdown-menu-trigger"
|
|
2513
|
+
),
|
|
2514
|
+
children: label
|
|
2515
|
+
}
|
|
2516
|
+
),
|
|
2517
|
+
/* @__PURE__ */ jsx41(
|
|
2518
|
+
MenuContext.Provider,
|
|
2519
|
+
{
|
|
2520
|
+
value: { activeIndex, setActiveIndex, getItemProps, setHasFocusInside, isOpen },
|
|
2521
|
+
children: isOpen && /* @__PURE__ */ jsx41(FloatingPortal5, { children: /* @__PURE__ */ jsx41(
|
|
2522
|
+
FloatingFocusManager4,
|
|
2523
|
+
{
|
|
2524
|
+
context,
|
|
2525
|
+
modal: false,
|
|
2526
|
+
initialFocus: isNested ? -1 : 0,
|
|
2527
|
+
returnFocus: !isNested,
|
|
2528
|
+
children: /* @__PURE__ */ jsx41(FloatingList3, { elementsRef, labelsRef, children: /* @__PURE__ */ jsx41("div", { ref: refs.setFloating, style: floatingStyles, className: "outline-none", children: /* @__PURE__ */ jsx41(Dialog, { ...getFloatingProps(), children }) }) })
|
|
2529
|
+
}
|
|
2530
|
+
) })
|
|
2531
|
+
}
|
|
2532
|
+
)
|
|
2533
|
+
] });
|
|
2534
|
+
}
|
|
2535
|
+
);
|
|
2536
|
+
var MenuItemWithChildren_default = MenuItemWithChildren;
|
|
2537
|
+
|
|
2538
|
+
// src/components/dropdown-menu-nested/DropdownMenuNested.tsx
|
|
2539
|
+
import { FloatingTree } from "@floating-ui/react";
|
|
2540
|
+
import { jsx as jsx42 } from "react/jsx-runtime";
|
|
2541
|
+
var DropdownMenuNested = forwardRef15((props, ref) => {
|
|
2542
|
+
return /* @__PURE__ */ jsx42(FloatingTree, { children: /* @__PURE__ */ jsx42(MenuItemWithChildren_default, { ...props, ref }) });
|
|
2543
|
+
});
|
|
2544
|
+
var DropdownMenuNested_default = DropdownMenuNested;
|
|
2545
|
+
|
|
2546
|
+
// src/components/dropdown-menu-nested/MenuItem.tsx
|
|
2547
|
+
import { useFloatingTree as useFloatingTree2, useListItem as useListItem4, useMergeRefs as useMergeRefs6 } from "@floating-ui/react";
|
|
2548
|
+
import { forwardRef as forwardRef16, useContext as useContext6 } from "react";
|
|
2549
|
+
import { jsx as jsx43 } from "react/jsx-runtime";
|
|
2550
|
+
var MenuItem = forwardRef16(
|
|
2551
|
+
({ label, disabled, ...props }, forwardedRef) => {
|
|
2552
|
+
const menu = useContext6(MenuContext);
|
|
2553
|
+
const item = useListItem4({ label: disabled ? null : label });
|
|
2554
|
+
const tree = useFloatingTree2();
|
|
2555
|
+
const isActive = item.index === menu.activeIndex;
|
|
2556
|
+
return /* @__PURE__ */ jsx43(
|
|
2557
|
+
"button",
|
|
2558
|
+
{
|
|
2559
|
+
...props,
|
|
2560
|
+
ref: useMergeRefs6([item.ref, forwardedRef]),
|
|
2561
|
+
type: "button",
|
|
2562
|
+
role: "menuitem",
|
|
2563
|
+
className: "option",
|
|
2564
|
+
tabIndex: isActive ? 0 : -1,
|
|
2565
|
+
disabled,
|
|
2566
|
+
...menu.getItemProps({
|
|
2567
|
+
onClick(event) {
|
|
2568
|
+
props.onClick?.(event);
|
|
2569
|
+
tree?.events.emit("click");
|
|
2570
|
+
},
|
|
2571
|
+
onFocus(event) {
|
|
2572
|
+
props.onFocus?.(event);
|
|
2573
|
+
menu.setHasFocusInside(true);
|
|
2574
|
+
}
|
|
2575
|
+
}),
|
|
2576
|
+
children: label
|
|
2577
|
+
}
|
|
2578
|
+
);
|
|
2579
|
+
}
|
|
2580
|
+
);
|
|
2581
|
+
var MenuItem_default = MenuItem;
|
|
2582
|
+
|
|
2583
|
+
// src/components/modal/useModal.ts
|
|
2584
|
+
import { useMemo as useMemo4, useState as useState13 } from "react";
|
|
2585
|
+
import { useClick as useClick3, useDismiss as useDismiss6, useFloating as useFloating6, useInteractions as useInteractions6, useRole as useRole6 } from "@floating-ui/react";
|
|
2586
|
+
function useModal({
|
|
2587
|
+
initialOpen = false,
|
|
2588
|
+
open: controlledOpen,
|
|
2589
|
+
onOpen: setControlledOpen,
|
|
2590
|
+
color = "default"
|
|
2591
|
+
} = {}) {
|
|
2592
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState13(initialOpen);
|
|
2593
|
+
const [labelId, setLabelId] = useState13();
|
|
2594
|
+
const [descriptionId, setDescriptionId] = useState13();
|
|
2595
|
+
const isUncontrolled = controlledOpen === null || controlledOpen === void 0;
|
|
2596
|
+
const open = isUncontrolled ? uncontrolledOpen : controlledOpen;
|
|
2597
|
+
const setOpen = isUncontrolled ? setUncontrolledOpen : setControlledOpen;
|
|
2598
|
+
const data = useFloating6({
|
|
2599
|
+
open,
|
|
2600
|
+
onOpenChange: setOpen
|
|
2601
|
+
});
|
|
2602
|
+
const { context } = data;
|
|
2603
|
+
const click = useClick3(context);
|
|
2604
|
+
const dismiss = useDismiss6(context);
|
|
2605
|
+
const role = useRole6(context);
|
|
2606
|
+
const interactions = useInteractions6([click, dismiss, role]);
|
|
2607
|
+
return useMemo4(
|
|
2608
|
+
() => ({
|
|
2609
|
+
open,
|
|
2610
|
+
setOpen,
|
|
2611
|
+
...interactions,
|
|
2612
|
+
...data,
|
|
2613
|
+
color,
|
|
2614
|
+
labelId,
|
|
2615
|
+
descriptionId,
|
|
2616
|
+
setLabelId,
|
|
2617
|
+
setDescriptionId
|
|
2618
|
+
}),
|
|
2619
|
+
[open, setOpen, interactions, data, color, labelId, descriptionId]
|
|
2620
|
+
);
|
|
2621
|
+
}
|
|
2622
|
+
|
|
2623
|
+
// src/components/modal/useModalContext.ts
|
|
2624
|
+
import { createContext as createContext6, useContext as useContext7 } from "react";
|
|
2625
|
+
var ModalContext = createContext6(null);
|
|
2626
|
+
function useModalContext() {
|
|
2627
|
+
const context = useContext7(ModalContext);
|
|
2628
|
+
if (context === null) {
|
|
2629
|
+
throw new Error("Modal components must be wrapped in <Modal />");
|
|
2630
|
+
}
|
|
2631
|
+
return context;
|
|
2632
|
+
}
|
|
2633
|
+
|
|
2634
|
+
// src/components/modal/Modal.tsx
|
|
2635
|
+
import { jsx as jsx44 } from "react/jsx-runtime";
|
|
2636
|
+
function Modal({ children, ...options }) {
|
|
2637
|
+
const modal = useModal(options);
|
|
2638
|
+
return /* @__PURE__ */ jsx44(ModalContext.Provider, { value: modal, children });
|
|
2639
|
+
}
|
|
2640
|
+
|
|
2641
|
+
// src/components/modal/ModalContent.tsx
|
|
2642
|
+
import {
|
|
2643
|
+
FloatingFocusManager as FloatingFocusManager5,
|
|
2644
|
+
FloatingOverlay,
|
|
2645
|
+
FloatingPortal as FloatingPortal6,
|
|
2646
|
+
useMergeRefs as useMergeRefs7
|
|
2647
|
+
} from "@floating-ui/react";
|
|
2648
|
+
import { forwardRef as forwardRef17 } from "react";
|
|
2649
|
+
import clsx28 from "clsx";
|
|
2650
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
2651
|
+
var ModalContent = forwardRef17(
|
|
2652
|
+
({ style, children, ...props }, propRef) => {
|
|
2653
|
+
const context = useModalContext();
|
|
2654
|
+
const floatingContext = context.context;
|
|
2655
|
+
const ref = useMergeRefs7([context.refs.setFloating, propRef]);
|
|
2656
|
+
if (!context.open) {
|
|
2657
|
+
return null;
|
|
2658
|
+
}
|
|
2659
|
+
return /* @__PURE__ */ jsx45(FloatingPortal6, { children: /* @__PURE__ */ jsx45(
|
|
2660
|
+
FloatingOverlay,
|
|
2661
|
+
{
|
|
2662
|
+
className: clsx28(["flex-center bg-gray-7/40 z-overlay", "animate-fade-in-opacity"]),
|
|
2663
|
+
lockScroll: true,
|
|
2664
|
+
children: /* @__PURE__ */ jsx45(FloatingFocusManager5, { context: floatingContext, children: /* @__PURE__ */ jsx45(
|
|
2665
|
+
Dialog,
|
|
2666
|
+
{
|
|
2667
|
+
className: clsx28("w-96 max-w-full", `border-${context.color}-2`, "animate-fade-in"),
|
|
2668
|
+
ref,
|
|
2669
|
+
"aria-labelledby": context.labelId,
|
|
2670
|
+
"aria-describedby": context.descriptionId,
|
|
2671
|
+
style,
|
|
2672
|
+
...context.getFloatingProps(props),
|
|
2673
|
+
children
|
|
2674
|
+
}
|
|
2675
|
+
) })
|
|
2676
|
+
}
|
|
2677
|
+
) });
|
|
2678
|
+
}
|
|
2679
|
+
);
|
|
2680
|
+
var ModalContent_default = ModalContent;
|
|
2681
|
+
|
|
2682
|
+
// src/components/modal/ModalTrigger.tsx
|
|
2683
|
+
import { cloneElement as cloneElement4, forwardRef as forwardRef18, isValidElement as isValidElement5 } from "react";
|
|
2684
|
+
import { useMergeRefs as useMergeRefs8 } from "@floating-ui/react";
|
|
2685
|
+
import { jsx as jsx46 } from "react/jsx-runtime";
|
|
2686
|
+
var ModalTrigger = forwardRef18(
|
|
2687
|
+
({ children, asChild = false, ...props }, propRef) => {
|
|
2688
|
+
const context = useModalContext();
|
|
2689
|
+
const childrenRef = children.ref;
|
|
2690
|
+
const ref = useMergeRefs8([context.refs.setReference, propRef, childrenRef]);
|
|
2691
|
+
if (asChild && isValidElement5(children)) {
|
|
2692
|
+
return cloneElement4(
|
|
2693
|
+
children,
|
|
2694
|
+
context.getReferenceProps({
|
|
2695
|
+
ref,
|
|
2696
|
+
...props,
|
|
2697
|
+
...children.props,
|
|
2698
|
+
"data-state": context.open ? "open" : "closed"
|
|
2699
|
+
})
|
|
2700
|
+
);
|
|
2701
|
+
}
|
|
2702
|
+
return /* @__PURE__ */ jsx46(
|
|
2703
|
+
Button_default,
|
|
2704
|
+
{
|
|
2705
|
+
ref,
|
|
2706
|
+
"data-state": context.open ? "open" : "closed",
|
|
2707
|
+
...context.getReferenceProps(props),
|
|
2708
|
+
children
|
|
2709
|
+
}
|
|
2710
|
+
);
|
|
2711
|
+
}
|
|
2712
|
+
);
|
|
2713
|
+
var ModalTrigger_default = ModalTrigger;
|
|
2714
|
+
|
|
2715
|
+
// src/components/modal/Components.tsx
|
|
2716
|
+
import clsx29 from "clsx";
|
|
2717
|
+
import { Fragment, jsx as jsx47, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2718
|
+
function ModalHeader({
|
|
2719
|
+
children,
|
|
2720
|
+
className,
|
|
2721
|
+
closeButton = true,
|
|
2722
|
+
...props
|
|
2723
|
+
}) {
|
|
2724
|
+
const { setOpen } = useModalContext();
|
|
2725
|
+
return /* @__PURE__ */ jsxs18(Fragment, { children: [
|
|
2726
|
+
closeButton && /* @__PURE__ */ jsx47("div", { className: "p-1 float-right", children: /* @__PURE__ */ jsx47(Button_default, { icon: true, variant: "text", color: "gray", onClick: () => setOpen(false), children: /* @__PURE__ */ jsx47("i", { className: "fe-cancel" }) }) }),
|
|
2727
|
+
/* @__PURE__ */ jsx47("header", { className: clsx29("flex items-center px-2 pt-2", className), ...props, children: /* @__PURE__ */ jsx47("h4", { children }) })
|
|
2728
|
+
] });
|
|
2729
|
+
}
|
|
2730
|
+
function ModalDescription({ children, className, height, ...props }) {
|
|
2731
|
+
if (!height) {
|
|
2732
|
+
return /* @__PURE__ */ jsx47("div", { className: clsx29("p-2", className), ...props, children });
|
|
2733
|
+
}
|
|
2734
|
+
return /* @__PURE__ */ jsx47("div", { className: clsx29("py-2", className), ...props, children: /* @__PURE__ */ jsx47(Scroll, { style: { height: `${height}px` }, children }) });
|
|
2735
|
+
}
|
|
2736
|
+
function ModalFooter({ children, className, ...props }) {
|
|
2737
|
+
return /* @__PURE__ */ jsx47("footer", { className: clsx29("relative z-10 px-2 pb-2", className), ...props, children });
|
|
2738
|
+
}
|
|
2739
|
+
|
|
2740
|
+
// src/components/notification/NotificationsProvider.tsx
|
|
2741
|
+
import { useEffect as useEffect14, useRef as useRef19, useState as useState14 } from "react";
|
|
2742
|
+
import { createPortal } from "react-dom";
|
|
2743
|
+
import { Fragment as Fragment2, jsx as jsx48, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2744
|
+
import { createElement as createElement2 } from "react";
|
|
2745
|
+
function NotificationsProvider({ children }) {
|
|
2746
|
+
const [notifications, setNotifications] = useState14([]);
|
|
2747
|
+
const container = useRef19(null);
|
|
2748
|
+
if (!container.current) {
|
|
2749
|
+
container.current = document.createElement("div");
|
|
2750
|
+
container.current.id = Math.floor(Math.random() * 1e5).toString();
|
|
2751
|
+
container.current.classList.add("fixed", "bottom-0", "left-0", "right-0", "z-notification");
|
|
2752
|
+
document.body.append(container.current);
|
|
2753
|
+
}
|
|
2754
|
+
useEffect14(() => {
|
|
2755
|
+
return () => {
|
|
2756
|
+
container.current && container.current.remove();
|
|
2757
|
+
};
|
|
2758
|
+
}, []);
|
|
2759
|
+
const managerRef = useRef19();
|
|
2760
|
+
if (!managerRef.current) {
|
|
2761
|
+
managerRef.current = createNotificationsManager(setNotifications);
|
|
2762
|
+
}
|
|
2763
|
+
const manager = managerRef.current;
|
|
2764
|
+
return /* @__PURE__ */ jsxs19(Fragment2, { children: [
|
|
2765
|
+
/* @__PURE__ */ jsx48(NotificationsContext.Provider, { value: manager, children }),
|
|
2766
|
+
createPortal(
|
|
2767
|
+
/* snack-bar-inner */
|
|
2768
|
+
/* @__PURE__ */ jsx48("div", { className: "mb-4 mx-4 flex flex-col gap-4 items-center", children: notifications.map((props) => /* @__PURE__ */ createElement2(
|
|
2769
|
+
Snack,
|
|
2770
|
+
{
|
|
2771
|
+
...props,
|
|
2772
|
+
key: props.id,
|
|
2773
|
+
onRemove: () => manager.removeNotification(props.id)
|
|
2774
|
+
}
|
|
2775
|
+
)) }),
|
|
2776
|
+
container.current
|
|
2777
|
+
)
|
|
2778
|
+
] });
|
|
2779
|
+
}
|
|
2780
|
+
|
|
2781
|
+
// src/components/popover/Popover.tsx
|
|
2782
|
+
import { jsx as jsx49 } from "react/jsx-runtime";
|
|
2783
|
+
function Popover({ children, ...options }) {
|
|
2784
|
+
const popover = usePopover(options);
|
|
2785
|
+
return /* @__PURE__ */ jsx49(PopoverContext.Provider, { value: popover, children });
|
|
2786
|
+
}
|
|
2787
|
+
|
|
2788
|
+
// src/components/popover/PopoverContent.tsx
|
|
2789
|
+
import { forwardRef as forwardRef19 } from "react";
|
|
2790
|
+
import { FloatingFocusManager as FloatingFocusManager6, FloatingPortal as FloatingPortal7, useMergeRefs as useMergeRefs9 } from "@floating-ui/react";
|
|
2791
|
+
import clsx30 from "clsx";
|
|
2792
|
+
import { jsx as jsx50, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2793
|
+
var PopoverContent = forwardRef19(
|
|
2794
|
+
({ style, children, className, ...props }, propRef) => {
|
|
2795
|
+
const context = usePopoverContext();
|
|
2796
|
+
const floatingContext = context.context;
|
|
2797
|
+
const ref = useMergeRefs9([context.refs.setFloating, propRef]);
|
|
2798
|
+
if (!context.open) {
|
|
2799
|
+
return null;
|
|
2800
|
+
}
|
|
2801
|
+
return /* @__PURE__ */ jsx50(FloatingPortal7, { children: /* @__PURE__ */ jsx50(FloatingFocusManager6, { context: floatingContext, modal: context.modal, children: /* @__PURE__ */ jsx50(
|
|
2802
|
+
"div",
|
|
2803
|
+
{
|
|
2804
|
+
ref,
|
|
2805
|
+
style: { ...context.floatingStyles, ...style },
|
|
2806
|
+
"aria-labelledby": context.labelId,
|
|
2807
|
+
"aria-describedby": context.descriptionId,
|
|
2808
|
+
...context.getFloatingProps(props),
|
|
2809
|
+
children: /* @__PURE__ */ jsxs20(
|
|
2810
|
+
Dialog,
|
|
2811
|
+
{
|
|
2812
|
+
placement: context.placement,
|
|
2813
|
+
color: context.color,
|
|
2814
|
+
className: clsx30("animate-fade-in-list", className),
|
|
2815
|
+
children: [
|
|
2816
|
+
children,
|
|
2817
|
+
/* @__PURE__ */ jsx50(
|
|
2818
|
+
"div",
|
|
2819
|
+
{
|
|
2820
|
+
ref: context.arrowRef,
|
|
2821
|
+
style: computeArrowStyle(context),
|
|
2822
|
+
className: "p8n-arrow"
|
|
2823
|
+
}
|
|
2824
|
+
)
|
|
2825
|
+
]
|
|
2826
|
+
}
|
|
2827
|
+
)
|
|
2828
|
+
}
|
|
2829
|
+
) }) });
|
|
2830
|
+
}
|
|
2831
|
+
);
|
|
2832
|
+
var PopoverContent_default = PopoverContent;
|
|
2833
|
+
|
|
2834
|
+
// src/components/popover/PopoverTrigger.tsx
|
|
2835
|
+
import { cloneElement as cloneElement5, forwardRef as forwardRef20, isValidElement as isValidElement6 } from "react";
|
|
2836
|
+
import { useMergeRefs as useMergeRefs10 } from "@floating-ui/react";
|
|
2837
|
+
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
2838
|
+
var PopoverTrigger = forwardRef20(
|
|
2839
|
+
({ children, asChild = false, ...props }, propRef) => {
|
|
2840
|
+
const context = usePopoverContext();
|
|
2841
|
+
const childrenRef = children.ref;
|
|
2842
|
+
const ref = useMergeRefs10([context.refs.setReference, propRef, childrenRef]);
|
|
2843
|
+
if (asChild && isValidElement6(children)) {
|
|
2844
|
+
return cloneElement5(
|
|
2845
|
+
children,
|
|
2846
|
+
context.getReferenceProps({
|
|
2847
|
+
ref,
|
|
2848
|
+
...props,
|
|
2849
|
+
...children.props,
|
|
2850
|
+
"data-state": context.open ? "open" : "closed"
|
|
2851
|
+
})
|
|
2852
|
+
);
|
|
2853
|
+
}
|
|
2854
|
+
return /* @__PURE__ */ jsx51(
|
|
2855
|
+
Button_default,
|
|
2856
|
+
{
|
|
2857
|
+
variant: "outlined",
|
|
2858
|
+
ref,
|
|
2859
|
+
"data-state": context.open ? "open" : "closed",
|
|
2860
|
+
...context.getReferenceProps(props),
|
|
2861
|
+
children
|
|
2862
|
+
}
|
|
2863
|
+
);
|
|
2864
|
+
}
|
|
2865
|
+
);
|
|
2866
|
+
var PopoverTrigger_default = PopoverTrigger;
|
|
2867
|
+
|
|
2868
|
+
// src/components/popover/usePopover.tsx
|
|
2869
|
+
import { useMemo as useMemo5, useRef as useRef20, useState as useState15 } from "react";
|
|
2870
|
+
import {
|
|
2871
|
+
arrow as arrow2,
|
|
2872
|
+
autoUpdate as autoUpdate6,
|
|
2873
|
+
flip as flip6,
|
|
2874
|
+
offset as offset6,
|
|
2875
|
+
shift as shift5,
|
|
2876
|
+
useClick as useClick4,
|
|
2877
|
+
useDismiss as useDismiss7,
|
|
2878
|
+
useFloating as useFloating7,
|
|
2879
|
+
useInteractions as useInteractions7,
|
|
2880
|
+
useRole as useRole7
|
|
2881
|
+
} from "@floating-ui/react";
|
|
2882
|
+
var arrowWidth3 = 12;
|
|
2883
|
+
function usePopover({
|
|
2884
|
+
initialOpen = false,
|
|
2885
|
+
placement = "bottom",
|
|
2886
|
+
open: controlledOpen,
|
|
2887
|
+
onOpen: setControlledOpen,
|
|
2888
|
+
color,
|
|
2889
|
+
modal = false
|
|
2890
|
+
}) {
|
|
2891
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState15(initialOpen);
|
|
2892
|
+
const [labelId, setLabelId] = useState15();
|
|
2893
|
+
const [descriptionId, setDescriptionId] = useState15();
|
|
2894
|
+
const isUncontrolled = controlledOpen === null || controlledOpen === void 0;
|
|
2895
|
+
const open = isUncontrolled ? uncontrolledOpen : controlledOpen;
|
|
2896
|
+
const setOpen = isUncontrolled ? setUncontrolledOpen : setControlledOpen;
|
|
2897
|
+
const arrowRef = useRef20(null);
|
|
2898
|
+
const offsetVal = arrowWidth3 / 2;
|
|
2899
|
+
const data = useFloating7({
|
|
2900
|
+
placement,
|
|
2901
|
+
open,
|
|
2902
|
+
onOpenChange: setOpen,
|
|
2903
|
+
whileElementsMounted: autoUpdate6,
|
|
2904
|
+
middleware: [
|
|
2905
|
+
offset6(offsetVal),
|
|
2906
|
+
flip6(),
|
|
2907
|
+
shift5({ padding: 5 }),
|
|
2908
|
+
arrow2({
|
|
2909
|
+
element: arrowRef,
|
|
2910
|
+
padding: 12
|
|
2911
|
+
})
|
|
2912
|
+
]
|
|
2913
|
+
});
|
|
2914
|
+
const { context } = data;
|
|
2915
|
+
const click = useClick4(context, {
|
|
2916
|
+
// TODO verify if use case to disable it
|
|
2917
|
+
// enabled: isUncontrolled,
|
|
2918
|
+
});
|
|
2919
|
+
const dismiss = useDismiss7(context);
|
|
2920
|
+
const role = useRole7(context);
|
|
2921
|
+
const interactions = useInteractions7([click, dismiss, role]);
|
|
2922
|
+
return useMemo5(
|
|
2923
|
+
() => ({
|
|
2924
|
+
open,
|
|
2925
|
+
setOpen,
|
|
2926
|
+
...interactions,
|
|
2927
|
+
...data,
|
|
2928
|
+
arrowRef,
|
|
2929
|
+
color,
|
|
2930
|
+
modal,
|
|
2931
|
+
labelId,
|
|
2932
|
+
descriptionId,
|
|
2933
|
+
setLabelId,
|
|
2934
|
+
setDescriptionId
|
|
2935
|
+
}),
|
|
2936
|
+
[open, setOpen, interactions, data, color, modal, labelId, descriptionId]
|
|
2937
|
+
);
|
|
2938
|
+
}
|
|
2939
|
+
|
|
2940
|
+
// src/components/popover/usePopoverContext.ts
|
|
2941
|
+
import { createContext as createContext7, useContext as useContext8 } from "react";
|
|
2942
|
+
var PopoverContext = createContext7(null);
|
|
2943
|
+
function usePopoverContext() {
|
|
2944
|
+
const context = useContext8(PopoverContext);
|
|
2945
|
+
if (context === null) {
|
|
2946
|
+
throw new Error("Popover components must be wrapped in <Popover />");
|
|
2947
|
+
}
|
|
2948
|
+
return context;
|
|
2949
|
+
}
|
|
2950
|
+
|
|
2951
|
+
// src/components/popover/Components.tsx
|
|
2952
|
+
import clsx31 from "clsx";
|
|
2953
|
+
import { Fragment as Fragment3, jsx as jsx52, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2954
|
+
function PopoverHeader({
|
|
2955
|
+
children,
|
|
2956
|
+
closeButton = true,
|
|
2957
|
+
className,
|
|
2958
|
+
...props
|
|
2959
|
+
}) {
|
|
2960
|
+
const { setOpen } = usePopoverContext();
|
|
2961
|
+
return /* @__PURE__ */ jsxs21(Fragment3, { children: [
|
|
2962
|
+
closeButton && /* @__PURE__ */ jsx52("div", { className: "p-1 float-right", children: /* @__PURE__ */ jsx52(Button_default, { icon: true, variant: "text", color: "gray", onClick: () => setOpen(false), children: /* @__PURE__ */ jsx52("i", { className: "fe-cancel" }) }) }),
|
|
2963
|
+
/* @__PURE__ */ jsx52("header", { className: clsx31("flex items-center px-2 pt-2", className), ...props, children: /* @__PURE__ */ jsx52("h4", { children }) })
|
|
2964
|
+
] });
|
|
2965
|
+
}
|
|
2966
|
+
function PopoverDescription({ children, className, ...props }) {
|
|
2967
|
+
return /* @__PURE__ */ jsx52("div", { className: clsx31("p-2", className), ...props, children });
|
|
2968
|
+
}
|
|
2969
|
+
function PopoverFooter({ children, className, ...props }) {
|
|
2970
|
+
return /* @__PURE__ */ jsx52("footer", { className: clsx31("relative z-10 px-2 pb-2", className), ...props, children });
|
|
2971
|
+
}
|
|
2972
|
+
|
|
2973
|
+
// src/components/select/SelectOption.tsx
|
|
2974
|
+
import { useListItem as useListItem5 } from "@floating-ui/react";
|
|
2975
|
+
import clsx32 from "clsx";
|
|
2976
|
+
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
2977
|
+
function SelectOption({ label }) {
|
|
2978
|
+
const { activeIndex, selectedIndex, getItemProps, handleSelect } = useSelect();
|
|
2979
|
+
const { ref, index } = useListItem5({ label });
|
|
2980
|
+
const isActive = activeIndex === index;
|
|
2981
|
+
const isSelected = selectedIndex === index;
|
|
2982
|
+
return /* @__PURE__ */ jsx53(
|
|
2983
|
+
"button",
|
|
2984
|
+
{
|
|
2985
|
+
className: clsx32("option", isSelected && "bg-gray-2", isActive && "bg-gray-1"),
|
|
2986
|
+
ref,
|
|
2987
|
+
role: "option",
|
|
2988
|
+
"aria-selected": isActive && isSelected,
|
|
2989
|
+
tabIndex: isActive ? 0 : -1,
|
|
2990
|
+
...getItemProps({
|
|
2991
|
+
onClick: () => handleSelect(index)
|
|
2992
|
+
}),
|
|
2993
|
+
children: label
|
|
2994
|
+
}
|
|
2995
|
+
);
|
|
2996
|
+
}
|
|
2997
|
+
|
|
2998
|
+
// src/components/select/SelectSelection.tsx
|
|
2999
|
+
import { jsx as jsx54 } from "react/jsx-runtime";
|
|
3000
|
+
function SelectSelection({
|
|
3001
|
+
label,
|
|
3002
|
+
multiple = false
|
|
3003
|
+
}) {
|
|
3004
|
+
return multiple ? /* @__PURE__ */ jsx54(Badge, { className: "ml-1", children: label }) : /* @__PURE__ */ jsx54("span", { children: label });
|
|
3005
|
+
}
|
|
3006
|
+
|
|
3007
|
+
// src/components/select/Select.tsx
|
|
3008
|
+
import {
|
|
3009
|
+
forwardRef as forwardRef21,
|
|
3010
|
+
useCallback as useCallback12,
|
|
3011
|
+
useEffect as useEffect15,
|
|
3012
|
+
useMemo as useMemo6,
|
|
3013
|
+
useRef as useRef21,
|
|
3014
|
+
useState as useState16
|
|
3015
|
+
} from "react";
|
|
3016
|
+
import {
|
|
3017
|
+
FloatingFocusManager as FloatingFocusManager7,
|
|
3018
|
+
FloatingList as FloatingList4,
|
|
3019
|
+
FloatingPortal as FloatingPortal8,
|
|
3020
|
+
autoUpdate as autoUpdate7,
|
|
3021
|
+
flip as flip7,
|
|
3022
|
+
offset as offset7,
|
|
3023
|
+
size as size3,
|
|
3024
|
+
useClick as useClick5,
|
|
3025
|
+
useDismiss as useDismiss8,
|
|
3026
|
+
useFloating as useFloating8,
|
|
3027
|
+
useInteractions as useInteractions8,
|
|
3028
|
+
useListNavigation as useListNavigation5,
|
|
3029
|
+
useMergeRefs as useMergeRefs11,
|
|
3030
|
+
useRole as useRole8,
|
|
3031
|
+
useTypeahead as useTypeahead4
|
|
3032
|
+
} from "@floating-ui/react";
|
|
3033
|
+
|
|
3034
|
+
// src/components/select/useSelectContext.ts
|
|
3035
|
+
import { createContext as createContext8, useContext as useContext9 } from "react";
|
|
3036
|
+
var SelectContext = createContext8(null);
|
|
3037
|
+
function useSelect() {
|
|
3038
|
+
const context = useContext9(SelectContext);
|
|
3039
|
+
if (context === null) {
|
|
3040
|
+
throw new Error("Select components must be wrapped in <Select>");
|
|
3041
|
+
}
|
|
3042
|
+
return context;
|
|
3043
|
+
}
|
|
3044
|
+
|
|
3045
|
+
// src/components/select/Select.tsx
|
|
3046
|
+
import clsx33 from "clsx";
|
|
3047
|
+
import { jsx as jsx55, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3048
|
+
import { createElement as createElement3 } from "react";
|
|
3049
|
+
function defaultGetSearchableValue(matchReg, option) {
|
|
3050
|
+
return matchReg.test(option.label.toLowerCase().trim());
|
|
3051
|
+
}
|
|
3052
|
+
var Select = forwardRef21(
|
|
3053
|
+
({
|
|
3054
|
+
variant = "normal",
|
|
3055
|
+
disabled = false,
|
|
3056
|
+
showArrow = true,
|
|
3057
|
+
selectionClassName,
|
|
3058
|
+
width = "100%",
|
|
3059
|
+
floatingMinWidth = 130,
|
|
3060
|
+
placement = "bottom",
|
|
3061
|
+
searchable = false,
|
|
3062
|
+
required = true,
|
|
3063
|
+
value = null,
|
|
3064
|
+
onChange = null,
|
|
3065
|
+
placeholder = "Select ...",
|
|
3066
|
+
getSearchableValue,
|
|
3067
|
+
selectSelectionComponent: SelectSelectionCustomComponent,
|
|
3068
|
+
selectOptionComponent: SelectOptionCustomComponent,
|
|
3069
|
+
options = [],
|
|
3070
|
+
zIndex
|
|
3071
|
+
}, propRef) => {
|
|
3072
|
+
const isControlled = onChange !== null;
|
|
3073
|
+
const onChangeStable = useEventCallback(onChange);
|
|
3074
|
+
const [uncontrolledSelectedIndex, setUncontrolledSelectedIndex] = useState16(null);
|
|
3075
|
+
const [search, setSearch] = useState16("");
|
|
3076
|
+
const filteredOptions = useMemo6(
|
|
3077
|
+
() => options.filter((option) => {
|
|
3078
|
+
if (!searchable || search.trim() === "") {
|
|
3079
|
+
return true;
|
|
3080
|
+
}
|
|
3081
|
+
const fn = getSearchableValue ?? defaultGetSearchableValue;
|
|
3082
|
+
const matchReg = new RegExp(search.toLowerCase().trim());
|
|
3083
|
+
return fn(matchReg, option);
|
|
3084
|
+
}),
|
|
3085
|
+
[searchable, search, getSearchableValue, options]
|
|
3086
|
+
);
|
|
3087
|
+
let selectedIndex = null;
|
|
3088
|
+
if (isControlled) {
|
|
3089
|
+
if (value !== null) {
|
|
3090
|
+
const pos = filteredOptions.findIndex((o) => o.value === value);
|
|
3091
|
+
if (pos !== -1) {
|
|
3092
|
+
selectedIndex = pos;
|
|
3093
|
+
}
|
|
3094
|
+
}
|
|
3095
|
+
} else {
|
|
3096
|
+
selectedIndex = uncontrolledSelectedIndex;
|
|
3097
|
+
}
|
|
3098
|
+
const [isOpen, setIsOpen] = useState16(false);
|
|
3099
|
+
const [activeIndex, setActiveIndex] = useState16(null);
|
|
3100
|
+
const [searchHasFocus, setSearchHasFocus] = useState16(false);
|
|
3101
|
+
const SelectSelectionComponent = SelectSelectionCustomComponent ?? SelectSelection;
|
|
3102
|
+
function handleSearchChange(e) {
|
|
3103
|
+
setActiveIndex(null);
|
|
3104
|
+
setSearch(e.target.value);
|
|
3105
|
+
}
|
|
3106
|
+
const { refs, floatingStyles, context } = useFloating8({
|
|
3107
|
+
placement,
|
|
3108
|
+
open: isOpen,
|
|
3109
|
+
onOpenChange: setIsOpen,
|
|
3110
|
+
whileElementsMounted: autoUpdate7,
|
|
3111
|
+
middleware: [
|
|
3112
|
+
offset7(5),
|
|
3113
|
+
flip7({ padding: 10 }),
|
|
3114
|
+
size3({
|
|
3115
|
+
apply({ rects, elements, availableHeight }) {
|
|
3116
|
+
Object.assign(elements.floating.style, {
|
|
3117
|
+
width: `${Math.max(floatingMinWidth, rects.reference.width)}px`
|
|
3118
|
+
});
|
|
3119
|
+
const firstChild = elements.floating.firstElementChild;
|
|
3120
|
+
if (firstChild) {
|
|
3121
|
+
firstChild.style.maxHeight = `${Math.min(availableHeight, 300)}px`;
|
|
3122
|
+
}
|
|
3123
|
+
},
|
|
3124
|
+
padding: 10
|
|
3125
|
+
})
|
|
3126
|
+
]
|
|
3127
|
+
});
|
|
3128
|
+
const ref = useMergeRefs11([refs.setReference, propRef]);
|
|
3129
|
+
const listRef = useRef21([]);
|
|
3130
|
+
const labelsRef = useRef21([]);
|
|
3131
|
+
const isTypingRef = useRef21(false);
|
|
3132
|
+
const click = useClick5(context, { event: "mousedown" });
|
|
3133
|
+
const dismiss = useDismiss8(context);
|
|
3134
|
+
const role = useRole8(context, { role: "listbox" });
|
|
3135
|
+
const listNav = useListNavigation5(context, {
|
|
3136
|
+
listRef,
|
|
3137
|
+
activeIndex,
|
|
3138
|
+
focusItemOnHover: searchable ? false : true,
|
|
3139
|
+
selectedIndex,
|
|
3140
|
+
onNavigate: setActiveIndex,
|
|
3141
|
+
loop: true
|
|
3142
|
+
});
|
|
3143
|
+
const typeahead = useTypeahead4(context, {
|
|
3144
|
+
enabled: !searchHasFocus,
|
|
3145
|
+
listRef: labelsRef,
|
|
3146
|
+
activeIndex,
|
|
3147
|
+
selectedIndex,
|
|
3148
|
+
onMatch: isOpen ? setActiveIndex : void 0,
|
|
3149
|
+
onTypingChange(isTyping) {
|
|
3150
|
+
isTypingRef.current = isTyping;
|
|
3151
|
+
}
|
|
3152
|
+
});
|
|
3153
|
+
const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions8([
|
|
3154
|
+
listNav,
|
|
3155
|
+
typeahead,
|
|
3156
|
+
click,
|
|
3157
|
+
dismiss,
|
|
3158
|
+
role
|
|
3159
|
+
]);
|
|
3160
|
+
useEffect15(() => {
|
|
3161
|
+
if (SelectOptionCustomComponent) {
|
|
3162
|
+
return;
|
|
3163
|
+
}
|
|
3164
|
+
filteredOptions.map((option, i) => {
|
|
3165
|
+
labelsRef.current[i] = option.label;
|
|
3166
|
+
});
|
|
3167
|
+
}, [search, filteredOptions, SelectOptionCustomComponent]);
|
|
3168
|
+
const handleSelect = useCallback12(
|
|
3169
|
+
(index) => {
|
|
3170
|
+
setIsOpen(false);
|
|
3171
|
+
setSearch("");
|
|
3172
|
+
if (isControlled) {
|
|
3173
|
+
const event = {
|
|
3174
|
+
target: {
|
|
3175
|
+
value: index === null ? null : filteredOptions[index].value
|
|
3176
|
+
}
|
|
3177
|
+
};
|
|
3178
|
+
onChangeStable(event);
|
|
3179
|
+
} else {
|
|
3180
|
+
setUncontrolledSelectedIndex(index);
|
|
3181
|
+
}
|
|
3182
|
+
},
|
|
3183
|
+
[isControlled, onChangeStable, filteredOptions]
|
|
3184
|
+
);
|
|
3185
|
+
const selectContext = useMemo6(
|
|
3186
|
+
() => ({
|
|
3187
|
+
activeIndex,
|
|
3188
|
+
selectedIndex,
|
|
3189
|
+
getItemProps,
|
|
3190
|
+
handleSelect
|
|
3191
|
+
}),
|
|
3192
|
+
[activeIndex, selectedIndex, getItemProps, handleSelect]
|
|
3193
|
+
);
|
|
3194
|
+
const showCancelButton = !required && selectedIndex !== null;
|
|
3195
|
+
return /* @__PURE__ */ jsxs22("div", { children: [
|
|
3196
|
+
/* @__PURE__ */ jsxs22(
|
|
3197
|
+
"div",
|
|
3198
|
+
{
|
|
3199
|
+
className: clsx33(
|
|
3200
|
+
// "selection",
|
|
3201
|
+
"rounded-2xl outline outline-1 outline-offset-[-1px] hover:outline-gray-3 flex focus-full:outline-yellow-4 focus-full:outline-2 cursor-pointer",
|
|
3202
|
+
variant === "normal" ? "outline-gray-2" : "outline-transparent",
|
|
3203
|
+
selectionClassName,
|
|
3204
|
+
isOpen && "focus",
|
|
3205
|
+
disabled && "disabled"
|
|
3206
|
+
),
|
|
3207
|
+
ref,
|
|
3208
|
+
tabIndex: 0,
|
|
3209
|
+
style: {
|
|
3210
|
+
width: typeof width === "number" ? `${width}px` : width
|
|
3211
|
+
},
|
|
3212
|
+
...getReferenceProps(),
|
|
3213
|
+
children: [
|
|
3214
|
+
/* @__PURE__ */ jsx55("span", { className: clsx33("h-8 flex-1 flex items-center px-2"), children: selectedIndex !== null ? /* @__PURE__ */ createElement3(SelectSelectionComponent, { ...filteredOptions[selectedIndex], key: selectedIndex }) : placeholder }),
|
|
3215
|
+
showCancelButton && /* @__PURE__ */ jsx55(
|
|
3216
|
+
Button_default,
|
|
3217
|
+
{
|
|
3218
|
+
withRipple: false,
|
|
3219
|
+
icon: true,
|
|
3220
|
+
variant: "text",
|
|
3221
|
+
color: "gray",
|
|
3222
|
+
onMouseDown: (e) => {
|
|
3223
|
+
e.stopPropagation();
|
|
3224
|
+
},
|
|
3225
|
+
onClick: () => {
|
|
3226
|
+
handleSelect(null);
|
|
3227
|
+
},
|
|
3228
|
+
children: /* @__PURE__ */ jsx55("i", { className: "fe-cancel" })
|
|
3229
|
+
}
|
|
3230
|
+
),
|
|
3231
|
+
!showCancelButton && showArrow && /* @__PURE__ */ jsx55(Button_default, { color: "gray", withRipple: false, icon: true, variant: "text", focusable: false, children: /* @__PURE__ */ jsx55("i", { className: isOpen ? "fe-angle-up" : "fe-angle-down" }) })
|
|
3232
|
+
]
|
|
3233
|
+
}
|
|
3234
|
+
),
|
|
3235
|
+
/* @__PURE__ */ jsx55(FloatingPortal8, { children: /* @__PURE__ */ jsx55(SelectContext.Provider, { value: selectContext, children: isOpen && /* @__PURE__ */ jsx55(FloatingFocusManager7, { context, modal: false, children: /* @__PURE__ */ jsx55(
|
|
3236
|
+
"div",
|
|
3237
|
+
{
|
|
3238
|
+
className: "z-dialog outline-none",
|
|
3239
|
+
ref: refs.setFloating,
|
|
3240
|
+
style: {
|
|
3241
|
+
...floatingStyles,
|
|
3242
|
+
zIndex
|
|
3243
|
+
},
|
|
3244
|
+
...getFloatingProps(),
|
|
3245
|
+
children: /* @__PURE__ */ jsxs22(
|
|
3246
|
+
Dialog,
|
|
3247
|
+
{
|
|
3248
|
+
placement: context.placement,
|
|
3249
|
+
className: "animate-fade-in-list max-h-80 overflow-auto",
|
|
3250
|
+
children: [
|
|
3251
|
+
searchable && /* @__PURE__ */ jsx55("div", { className: "p-2", children: /* @__PURE__ */ jsx55(
|
|
3252
|
+
Input_default,
|
|
3253
|
+
{
|
|
3254
|
+
placeholder: "Search",
|
|
3255
|
+
tabIndex: selectedIndex === null ? 0 : -1,
|
|
3256
|
+
value: search,
|
|
3257
|
+
onChange: handleSearchChange,
|
|
3258
|
+
onFocus: () => setSearchHasFocus(true),
|
|
3259
|
+
onBlur: () => setSearchHasFocus(false)
|
|
3260
|
+
}
|
|
3261
|
+
) }),
|
|
3262
|
+
SelectOptionCustomComponent ? /* @__PURE__ */ jsx55(FloatingList4, { elementsRef: listRef, labelsRef, children: filteredOptions.map((option) => /* @__PURE__ */ createElement3(SelectOptionCustomComponent, { ...option, key: option.value })) }) : filteredOptions.map((option, index) => {
|
|
3263
|
+
const isActive = activeIndex === index;
|
|
3264
|
+
const isSelected = selectedIndex === index;
|
|
3265
|
+
return /* @__PURE__ */ jsx55(
|
|
3266
|
+
"button",
|
|
3267
|
+
{
|
|
3268
|
+
className: clsx33(
|
|
3269
|
+
"option",
|
|
3270
|
+
isSelected && "bg-gray-2",
|
|
3271
|
+
isActive && "bg-gray-1"
|
|
3272
|
+
),
|
|
3273
|
+
role: "option",
|
|
3274
|
+
"aria-selected": isActive && isSelected,
|
|
3275
|
+
tabIndex: isActive ? 0 : -1,
|
|
3276
|
+
ref: (node) => {
|
|
3277
|
+
listRef.current[index] = node;
|
|
3278
|
+
},
|
|
3279
|
+
...getItemProps({
|
|
3280
|
+
onClick: () => handleSelect(index)
|
|
3281
|
+
}),
|
|
3282
|
+
children: option.label
|
|
3283
|
+
},
|
|
3284
|
+
option.value
|
|
3285
|
+
);
|
|
3286
|
+
})
|
|
3287
|
+
]
|
|
3288
|
+
}
|
|
3289
|
+
)
|
|
3290
|
+
}
|
|
3291
|
+
) }) }) })
|
|
3292
|
+
] });
|
|
3293
|
+
}
|
|
3294
|
+
// see : React with Typescript -- Generics while using React.forwardRef
|
|
3295
|
+
// https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref
|
|
3296
|
+
);
|
|
3297
|
+
var Select_default = Select;
|
|
3298
|
+
|
|
3299
|
+
// src/components/steps/Step.tsx
|
|
3300
|
+
import clsx34 from "clsx";
|
|
3301
|
+
import { jsx as jsx56, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3302
|
+
function Step({
|
|
3303
|
+
status = "todo",
|
|
3304
|
+
className,
|
|
3305
|
+
children,
|
|
3306
|
+
markerClassName,
|
|
3307
|
+
contentClassName,
|
|
3308
|
+
align = "start",
|
|
3309
|
+
icon = null,
|
|
3310
|
+
...rest
|
|
3311
|
+
}) {
|
|
3312
|
+
return /* @__PURE__ */ jsxs23("li", { className: clsx34(["ll-step", `status-${status}`, `align-${align}`, className]), ...rest, children: [
|
|
3313
|
+
/* @__PURE__ */ jsx56("div", { className: "marker-container", children: /* @__PURE__ */ jsx56(
|
|
3314
|
+
"div",
|
|
3315
|
+
{
|
|
3316
|
+
className: clsx34([
|
|
3317
|
+
"marker",
|
|
3318
|
+
"relative z-[1] inline-flex items-center justify-center rounded-full ",
|
|
3319
|
+
["done", "current"].includes(status) && "active",
|
|
3320
|
+
markerClassName
|
|
3321
|
+
]),
|
|
3322
|
+
children: icon
|
|
3323
|
+
}
|
|
3324
|
+
) }),
|
|
3325
|
+
/* @__PURE__ */ jsx56("div", { className: clsx34(["content", contentClassName]), children })
|
|
3326
|
+
] });
|
|
3327
|
+
}
|
|
3328
|
+
|
|
3329
|
+
// src/components/steps/Steps.tsx
|
|
3330
|
+
import clsx35 from "clsx";
|
|
3331
|
+
import { jsx as jsx57 } from "react/jsx-runtime";
|
|
3332
|
+
function Steps({
|
|
3333
|
+
direction = "vertical",
|
|
3334
|
+
lineStyle = "solid",
|
|
3335
|
+
markerType = "circle",
|
|
3336
|
+
associateLineWithStep = true,
|
|
3337
|
+
className,
|
|
3338
|
+
...rest
|
|
3339
|
+
}) {
|
|
3340
|
+
return /* @__PURE__ */ jsx57(
|
|
3341
|
+
"ul",
|
|
3342
|
+
{
|
|
3343
|
+
...rest,
|
|
3344
|
+
className: clsx35(["ll-steps", className]),
|
|
3345
|
+
"data-global-line": (!associateLineWithStep).toString(),
|
|
3346
|
+
"data-direction": direction,
|
|
3347
|
+
"data-marker": markerType,
|
|
3348
|
+
style: {
|
|
3349
|
+
"--line-style": lineStyle,
|
|
3350
|
+
"--line-space": associateLineWithStep ? "4px" : "0px"
|
|
3351
|
+
// "--step-circle-radius": markerType === "circle" ? "18px" : "9px",
|
|
3352
|
+
}
|
|
3353
|
+
}
|
|
3354
|
+
);
|
|
3355
|
+
}
|
|
3356
|
+
|
|
3357
|
+
// src/components/steps/util.ts
|
|
3358
|
+
function getIndexLetter(index) {
|
|
3359
|
+
return String.fromCharCode(65 + index % 26);
|
|
3360
|
+
}
|
|
3361
|
+
|
|
3362
|
+
// src/components/sortable/Sortable.tsx
|
|
3363
|
+
import { useMemo as useMemo7 } from "react";
|
|
3364
|
+
import {
|
|
3365
|
+
ReactSortable
|
|
3366
|
+
} from "react-sortablejs";
|
|
3367
|
+
import { jsx as jsx58 } from "react/jsx-runtime";
|
|
3368
|
+
function Sortable({
|
|
3369
|
+
children,
|
|
3370
|
+
list,
|
|
3371
|
+
setList,
|
|
3372
|
+
...rest
|
|
3373
|
+
}) {
|
|
3374
|
+
const mutableList = useMemo7(() => {
|
|
3375
|
+
return list.map((item) => ({ ...item }));
|
|
3376
|
+
}, [list]);
|
|
3377
|
+
function handleList(updatedList, sortable, store) {
|
|
3378
|
+
if (!arrayEquals(
|
|
3379
|
+
updatedList.map((l) => l.id),
|
|
3380
|
+
mutableList.map((l) => l.id)
|
|
3381
|
+
)) {
|
|
3382
|
+
setList(updatedList, sortable, store);
|
|
3383
|
+
}
|
|
3384
|
+
}
|
|
3385
|
+
return /* @__PURE__ */ jsx58(ReactSortable, { list: mutableList, setList: handleList, ...rest, children });
|
|
3386
|
+
}
|
|
3387
|
+
|
|
3388
|
+
// src/tailwind/pentatrionTw.ts
|
|
3389
|
+
import plugin from "tailwindcss/plugin";
|
|
3390
|
+
|
|
3391
|
+
// src/tailwind/keyframes.ts
|
|
3392
|
+
var keyframes = {
|
|
3393
|
+
ripple: {
|
|
3394
|
+
to: {
|
|
3395
|
+
transform: "scale(4)",
|
|
3396
|
+
opacity: "0"
|
|
3397
|
+
}
|
|
3398
|
+
},
|
|
3399
|
+
"fade-in": {
|
|
3400
|
+
from: {
|
|
3401
|
+
transform: "scale(.8)",
|
|
3402
|
+
opacity: "0"
|
|
3403
|
+
},
|
|
3404
|
+
to: {
|
|
3405
|
+
transform: "scale(1)",
|
|
3406
|
+
opacity: "1"
|
|
3407
|
+
}
|
|
3408
|
+
},
|
|
3409
|
+
"fade-in-list": {
|
|
3410
|
+
from: {
|
|
3411
|
+
transform: "scaleY(.8)",
|
|
3412
|
+
opacity: "0"
|
|
3413
|
+
},
|
|
3414
|
+
to: {
|
|
3415
|
+
transform: "scaleY(1)",
|
|
3416
|
+
opacity: "1"
|
|
3417
|
+
}
|
|
3418
|
+
},
|
|
3419
|
+
"fade-out": {
|
|
3420
|
+
from: {
|
|
3421
|
+
transform: "scale(1)",
|
|
3422
|
+
opacity: "1"
|
|
3423
|
+
},
|
|
3424
|
+
to: {
|
|
3425
|
+
transform: "scale(.8)",
|
|
3426
|
+
opacity: "0"
|
|
3427
|
+
}
|
|
3428
|
+
},
|
|
3429
|
+
"fade-in-opacity": {
|
|
3430
|
+
from: {
|
|
3431
|
+
opacity: "0"
|
|
3432
|
+
},
|
|
3433
|
+
to: {
|
|
3434
|
+
opacity: "1"
|
|
3435
|
+
}
|
|
3436
|
+
},
|
|
3437
|
+
flash: {
|
|
3438
|
+
"0%": {
|
|
3439
|
+
opacity: "0"
|
|
3440
|
+
},
|
|
3441
|
+
"50%": {
|
|
3442
|
+
opacity: "1"
|
|
3443
|
+
},
|
|
3444
|
+
"100%": {
|
|
3445
|
+
opacity: "0"
|
|
3446
|
+
}
|
|
3447
|
+
},
|
|
3448
|
+
"loader-stroke": {
|
|
3449
|
+
from: {
|
|
3450
|
+
// check : packages/pentatrion-design/components/loader/Loader.tsx
|
|
3451
|
+
// for dashoffset value
|
|
3452
|
+
"stroke-dashoffset": "43.699"
|
|
3453
|
+
},
|
|
3454
|
+
to: {
|
|
3455
|
+
"stroke-dashoffset": "0"
|
|
3456
|
+
}
|
|
3457
|
+
}
|
|
3458
|
+
};
|
|
3459
|
+
|
|
3460
|
+
// src/tailwind/pentatrionTw.ts
|
|
3461
|
+
import defaultTheme from "tailwindcss/defaultTheme";
|
|
3462
|
+
var pentatrionTw_default = plugin(
|
|
3463
|
+
({ addVariant }) => {
|
|
3464
|
+
addVariant("active-full", ["&:active", "&.active"]);
|
|
3465
|
+
addVariant("focus-full", ["&:has(input:focus)", "&.focus", "&:focus"]);
|
|
3466
|
+
},
|
|
3467
|
+
{
|
|
3468
|
+
theme: {
|
|
3469
|
+
zIndex: {
|
|
3470
|
+
auto: "auto",
|
|
3471
|
+
0: "0",
|
|
3472
|
+
10: "10",
|
|
3473
|
+
20: "20",
|
|
3474
|
+
30: "30",
|
|
3475
|
+
40: "40",
|
|
3476
|
+
50: "50",
|
|
3477
|
+
dialog: "100",
|
|
3478
|
+
overlay: "100",
|
|
3479
|
+
tooltip: "100",
|
|
3480
|
+
"context-menu": "90",
|
|
3481
|
+
notification: "80"
|
|
3482
|
+
},
|
|
3483
|
+
transitionDuration: {
|
|
3484
|
+
...defaultTheme.transitionDuration,
|
|
3485
|
+
DEFAULT: "300ms"
|
|
3486
|
+
},
|
|
3487
|
+
colors: {
|
|
3488
|
+
transparent: "transparent",
|
|
3489
|
+
current: "currentColor",
|
|
3490
|
+
black: "rgb(var(--color-black) / <alpha-value>)",
|
|
3491
|
+
white: "rgb(var(--color-white) / <alpha-value>)",
|
|
3492
|
+
yellow: {
|
|
3493
|
+
1: "rgb(var(--color-yellow-1) / <alpha-value>)",
|
|
3494
|
+
2: "rgb(var(--color-yellow-2) / <alpha-value>)",
|
|
3495
|
+
3: "rgb(var(--color-yellow-3) / <alpha-value>)",
|
|
3496
|
+
4: "rgb(var(--color-yellow-4) / <alpha-value>)",
|
|
3497
|
+
5: "rgb(var(--color-yellow-5) / <alpha-value>)",
|
|
3498
|
+
// color of the text when bg is yellow 3
|
|
3499
|
+
text: "rgb(var(--color-yellow-text) / <alpha-value>)"
|
|
3500
|
+
},
|
|
3501
|
+
green: {
|
|
3502
|
+
1: "rgb(var(--color-green-1) / <alpha-value>)",
|
|
3503
|
+
2: "rgb(var(--color-green-2) / <alpha-value>)",
|
|
3504
|
+
3: "rgb(var(--color-green-3) / <alpha-value>)",
|
|
3505
|
+
4: "rgb(var(--color-green-4) / <alpha-value>)",
|
|
3506
|
+
5: "rgb(var(--color-green-5) / <alpha-value>)",
|
|
3507
|
+
// color of the text when bg is green
|
|
3508
|
+
text: "rgb(var(--color-green-text) / <alpha-value>)"
|
|
3509
|
+
},
|
|
3510
|
+
blue: {
|
|
3511
|
+
1: "rgb(var(--color-blue-1) / <alpha-value>)",
|
|
3512
|
+
2: "rgb(var(--color-blue-2) / <alpha-value>)",
|
|
3513
|
+
3: "rgb(var(--color-blue-3) / <alpha-value>)",
|
|
3514
|
+
4: "rgb(var(--color-blue-4) / <alpha-value>)",
|
|
3515
|
+
5: "rgb(var(--color-blue-5) / <alpha-value>)",
|
|
3516
|
+
// color of the text when bg is blue
|
|
3517
|
+
text: "rgb(var(--color-blue-text) / <alpha-value>)"
|
|
3518
|
+
},
|
|
3519
|
+
orange: {
|
|
3520
|
+
1: "rgb(var(--color-orange-1) / <alpha-value>)",
|
|
3521
|
+
2: "rgb(var(--color-orange-2) / <alpha-value>)",
|
|
3522
|
+
3: "rgb(var(--color-orange-3) / <alpha-value>)",
|
|
3523
|
+
4: "rgb(var(--color-orange-4) / <alpha-value>)",
|
|
3524
|
+
5: "rgb(var(--color-orange-5) / <alpha-value>)",
|
|
3525
|
+
// color of the text when bg is orange
|
|
3526
|
+
text: "rgb(var(--color-orange-text) / <alpha-value>)"
|
|
3527
|
+
},
|
|
3528
|
+
red: {
|
|
3529
|
+
1: "rgb(var(--color-red-1) / <alpha-value>)",
|
|
3530
|
+
2: "rgb(var(--color-red-2) / <alpha-value>)",
|
|
3531
|
+
3: "rgb(var(--color-red-3) / <alpha-value>)",
|
|
3532
|
+
4: "rgb(var(--color-red-4) / <alpha-value>)",
|
|
3533
|
+
5: "rgb(var(--color-red-5) / <alpha-value>)",
|
|
3534
|
+
// color of the text when bg is red
|
|
3535
|
+
text: "rgb(var(--color-red-text) / <alpha-value>)"
|
|
3536
|
+
},
|
|
3537
|
+
gray: {
|
|
3538
|
+
0: "rgb(var(--color-gray-0) / <alpha-value>)",
|
|
3539
|
+
1: "rgb(var(--color-gray-1) / <alpha-value>)",
|
|
3540
|
+
2: "rgb(var(--color-gray-2) / <alpha-value>)",
|
|
3541
|
+
3: "rgb(var(--color-gray-3) / <alpha-value>)",
|
|
3542
|
+
4: "rgb(var(--color-gray-4) / <alpha-value>)",
|
|
3543
|
+
5: "rgb(var(--color-gray-5) / <alpha-value>)",
|
|
3544
|
+
6: "rgb(var(--color-gray-6) / <alpha-value>)",
|
|
3545
|
+
7: "rgb(var(--color-gray-7) / <alpha-value>)",
|
|
3546
|
+
8: "rgb(var(--color-gray-8) / <alpha-value>)",
|
|
3547
|
+
// color of the text when bg is gray
|
|
3548
|
+
text: "rgb(var(--color-gray-text) / <alpha-value>)"
|
|
3549
|
+
}
|
|
3550
|
+
},
|
|
3551
|
+
boxShadow: {
|
|
3552
|
+
sm: "0 1px 2px 0 rgb(0 0 0 / 0.1)",
|
|
3553
|
+
DEFAULT: "0 1px 3px 0 rgb(0 0 0 / 0.15), 0 1px 2px -1px rgb(0 0 0 / 0.15)",
|
|
3554
|
+
md: "0 4px 6px -1px rgb(0 0 0 / 0.15), 0 2px 4px -2px rgb(0 0 0 / 0.15)",
|
|
3555
|
+
lg: "0 10px 15px -3px rgb(0 0 0 / 0.15), 0 4px 6px -2px rgb(0 0 0 / 0.15)",
|
|
3556
|
+
xl: "0 20px 25px -5px rgb(0 0 0 / 0.15), 0 8px 10px -6px rgb(0 0 0 / 0.15)",
|
|
3557
|
+
"2xl": "0 25px 50px -12px rgb(0 0 0 / 0.35)",
|
|
3558
|
+
inner: "inset 0 2px 4px 0 rgb(0 0 0 / 0.1)",
|
|
3559
|
+
dark: "0 0 0 1px rgb(var(--color-gray-2))",
|
|
3560
|
+
none: "none"
|
|
3561
|
+
},
|
|
3562
|
+
fontFamily: {
|
|
3563
|
+
sans: ["ui-sans-serif", "system-ui", "sans-serif"],
|
|
3564
|
+
fontello: ["fontello"],
|
|
3565
|
+
serif: defaultTheme.fontFamily.serif,
|
|
3566
|
+
mono: defaultTheme.fontFamily.mono
|
|
3567
|
+
},
|
|
3568
|
+
extend: {
|
|
3569
|
+
// https://github.com/tailwindlabs/tailwindcss/blob/master/stubs/config.full.js
|
|
3570
|
+
backgroundSize: {
|
|
3571
|
+
full: "100%"
|
|
3572
|
+
},
|
|
3573
|
+
dropShadow: {
|
|
3574
|
+
arrow: "0 1px 3px rgb(var(--color-gray-3))"
|
|
3575
|
+
},
|
|
3576
|
+
transitionProperty: {
|
|
3577
|
+
"color-shadow": "color, background-color, border-color, text-decoration-color, fill, stroke, box-shadow"
|
|
3578
|
+
},
|
|
3579
|
+
gridTemplateColumns: {
|
|
3580
|
+
"repeat-fill-300": "repeat(auto-fill, minmax(300px, 1fr))",
|
|
3581
|
+
"repeat-fill-160": "repeat(auto-fill, minmax(160px, 1fr))"
|
|
3582
|
+
},
|
|
3583
|
+
animation: {
|
|
3584
|
+
ripple: "ripple .9s linear",
|
|
3585
|
+
"fade-in": "fade-in 250ms ease both",
|
|
3586
|
+
"fade-in-list": "fade-in-list 150ms ease both",
|
|
3587
|
+
"fade-out": "fade-out 250ms ease both",
|
|
3588
|
+
"fade-in-opacity": "fade-in-opacity 250ms ease both",
|
|
3589
|
+
flash: "flash 1000ms ease both infinite",
|
|
3590
|
+
"loader-stroke": "loader-stroke 1s linear infinite"
|
|
3591
|
+
},
|
|
3592
|
+
fontSize: {
|
|
3593
|
+
"2xs": ["0.688rem", { lineHeight: "1rem" }]
|
|
3594
|
+
},
|
|
3595
|
+
keyframes
|
|
3596
|
+
}
|
|
3597
|
+
}
|
|
3598
|
+
}
|
|
3599
|
+
);
|
|
3600
|
+
export {
|
|
3601
|
+
Autocomplete_default as Autocomplete,
|
|
3602
|
+
AutocompleteOption_default as AutocompleteOption,
|
|
3603
|
+
Badge,
|
|
3604
|
+
Button_default as Button,
|
|
3605
|
+
ButtonGroup,
|
|
3606
|
+
Checkbox_default as Checkbox,
|
|
3607
|
+
Code,
|
|
3608
|
+
ContextMenu,
|
|
3609
|
+
ContextMenuItem_default as ContextMenuItem,
|
|
3610
|
+
Dialog,
|
|
3611
|
+
DropdownMenu,
|
|
3612
|
+
DropdownMenuContent_default as DropdownMenuContent,
|
|
3613
|
+
DropdownMenuContext,
|
|
3614
|
+
DropdownMenuItem,
|
|
3615
|
+
DropdownMenuNested_default as DropdownMenuNested,
|
|
3616
|
+
DropdownMenuTrigger_default as DropdownMenuTrigger,
|
|
3617
|
+
FetchError,
|
|
3618
|
+
Alert as Flash,
|
|
3619
|
+
Hightlight as Highlight,
|
|
3620
|
+
Href_default as Href,
|
|
3621
|
+
Input_default as Input,
|
|
3622
|
+
InputField_default as InputField,
|
|
3623
|
+
LazyAutocomplete,
|
|
3624
|
+
Loader,
|
|
3625
|
+
MenuItem_default as MenuItem,
|
|
3626
|
+
MenuItemWithChildren_default as MenuItemWithChildren,
|
|
3627
|
+
Modal,
|
|
3628
|
+
ModalContent_default as ModalContent,
|
|
3629
|
+
ModalContext,
|
|
3630
|
+
ModalDescription,
|
|
3631
|
+
ModalFooter,
|
|
3632
|
+
ModalHeader,
|
|
3633
|
+
ModalTrigger_default as ModalTrigger,
|
|
3634
|
+
NotificationsContext,
|
|
3635
|
+
NotificationsProvider,
|
|
3636
|
+
Popover,
|
|
3637
|
+
PopoverContent_default as PopoverContent,
|
|
3638
|
+
PopoverContext,
|
|
3639
|
+
PopoverDescription,
|
|
3640
|
+
PopoverFooter,
|
|
3641
|
+
PopoverHeader,
|
|
3642
|
+
PopoverTrigger_default as PopoverTrigger,
|
|
3643
|
+
Portal_default as Portal,
|
|
3644
|
+
RadioGroup,
|
|
3645
|
+
ResizeArea,
|
|
3646
|
+
Scroll,
|
|
3647
|
+
Select_default as Select,
|
|
3648
|
+
SelectContext,
|
|
3649
|
+
SelectOption,
|
|
3650
|
+
SelectSelection,
|
|
3651
|
+
SimpleAutocomplete,
|
|
3652
|
+
SimpleTooltip,
|
|
3653
|
+
Snack,
|
|
3654
|
+
Sortable,
|
|
3655
|
+
Step,
|
|
3656
|
+
Steps,
|
|
3657
|
+
Table,
|
|
3658
|
+
Table2 as TableBody,
|
|
3659
|
+
Table3 as TableCell,
|
|
3660
|
+
Table7 as TableFooter,
|
|
3661
|
+
Table4 as TableHeader,
|
|
3662
|
+
Table5 as TableHeaderCell,
|
|
3663
|
+
Table6 as TableRow,
|
|
3664
|
+
Tabs,
|
|
3665
|
+
Toggle_default as Toggle,
|
|
3666
|
+
Tooltip,
|
|
3667
|
+
TooltipContent_default as TooltipContent,
|
|
3668
|
+
TooltipContext,
|
|
3669
|
+
TooltipTrigger_default as TooltipTrigger,
|
|
3670
|
+
arrayEquals,
|
|
3671
|
+
buttonVariants,
|
|
3672
|
+
cardConfig,
|
|
3673
|
+
dialogVariants,
|
|
3674
|
+
fetchAPI,
|
|
3675
|
+
getIndexLetter,
|
|
3676
|
+
getOptionLabel,
|
|
3677
|
+
getOptionValue,
|
|
3678
|
+
inputConfig,
|
|
3679
|
+
isErrorLike,
|
|
3680
|
+
parseError,
|
|
3681
|
+
pentatrionTw_default as pentatrionTw,
|
|
3682
|
+
useAutocomplete,
|
|
3683
|
+
useCombinedRefs,
|
|
3684
|
+
useCopyToClipboard,
|
|
3685
|
+
useDebounce,
|
|
3686
|
+
useDropdownMenu,
|
|
3687
|
+
useDropdownMenuContext,
|
|
3688
|
+
useEventCallback,
|
|
3689
|
+
useEventListener,
|
|
3690
|
+
useFetch,
|
|
3691
|
+
useIsClosing,
|
|
3692
|
+
useIsMounted,
|
|
3693
|
+
useIsomorphicLayoutEffect,
|
|
3694
|
+
useModal,
|
|
3695
|
+
useModalContext,
|
|
3696
|
+
useNotifications,
|
|
3697
|
+
useOnClickOutside,
|
|
3698
|
+
usePopover,
|
|
3699
|
+
usePopoverContext,
|
|
3700
|
+
usePrevious,
|
|
3701
|
+
useRefDebounce,
|
|
3702
|
+
useRipple,
|
|
3703
|
+
useSelect,
|
|
3704
|
+
useStateDebounce,
|
|
3705
|
+
useTooltip,
|
|
3706
|
+
useTooltipContext
|
|
3707
|
+
};
|