@mks2508/mks-ui 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +96 -60
- package/dist/components/animate-ui/primitives/animate/slot.js +1 -1
- package/dist/components/animate-ui/primitives/base/accordion.js +132 -0
- package/dist/components/animate-ui/primitives/base/alert-dialog.js +132 -0
- package/dist/components/animate-ui/primitives/base/checkbox.js +101 -0
- package/dist/components/animate-ui/primitives/base/dialog.js +132 -0
- package/dist/components/animate-ui/primitives/base/menu.js +266 -0
- package/dist/components/animate-ui/primitives/base/popover.js +109 -0
- package/dist/components/animate-ui/primitives/base/progress.d.ts +14 -14
- package/dist/components/animate-ui/primitives/base/progress.js +63 -0
- package/dist/components/animate-ui/primitives/base/switch.js +1 -1
- package/dist/components/animate-ui/primitives/base/tabs.js +1 -1
- package/dist/components/animate-ui/primitives/base/tooltip.js +116 -0
- package/dist/components/animate-ui/primitives/effects/auto-height.js +1 -1
- package/dist/components/animate-ui/primitives/effects/highlight.js +2 -2
- package/dist/components/animate-ui/primitives/texts/counting-number.js +78 -0
- package/dist/components/ui/accordion.d.ts +9 -0
- package/dist/components/ui/accordion.d.ts.map +1 -0
- package/dist/components/ui/accordion.js +1 -0
- package/dist/components/ui/alert-dialog.d.ts +8 -20
- package/dist/components/ui/alert-dialog.d.ts.map +1 -1
- package/dist/components/ui/alert-dialog.js +1 -99
- package/dist/components/ui/auto-height.d.ts +9 -0
- package/dist/components/ui/auto-height.d.ts.map +1 -0
- package/dist/components/ui/auto-height.js +1 -0
- package/dist/components/ui/badge/badge.styles.d.ts +1 -1
- package/dist/components/ui/button/button.js +1 -1
- package/dist/components/ui/button/button.styles.d.ts +2 -2
- package/dist/components/ui/card.js +1 -1
- package/dist/components/ui/checkbox.d.ts +9 -0
- package/dist/components/ui/checkbox.d.ts.map +1 -0
- package/dist/components/ui/checkbox.js +1 -0
- package/dist/components/ui/corner-bracket.d.ts +34 -0
- package/dist/components/ui/corner-bracket.d.ts.map +1 -0
- package/dist/components/ui/{devenv-bracket.js → corner-bracket.js} +13 -9
- package/dist/components/ui/counting-number.d.ts +9 -0
- package/dist/components/ui/counting-number.d.ts.map +1 -0
- package/dist/components/ui/counting-number.js +1 -0
- package/dist/components/ui/dialog.d.ts +9 -0
- package/dist/components/ui/dialog.d.ts.map +1 -0
- package/dist/components/ui/dialog.js +1 -0
- package/dist/components/ui/field.js +1 -1
- package/dist/components/ui/highlight.d.ts +9 -0
- package/dist/components/ui/highlight.d.ts.map +1 -0
- package/dist/components/ui/highlight.js +1 -0
- package/dist/components/ui/index.d.ts +14 -3
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +32 -9
- package/dist/components/ui/input-group.js +1 -1
- package/dist/components/ui/menu.d.ts +9 -0
- package/dist/components/ui/menu.d.ts.map +1 -0
- package/dist/components/ui/menu.js +1 -0
- package/dist/components/ui/popover.d.ts +9 -0
- package/dist/components/ui/popover.d.ts.map +1 -0
- package/dist/components/ui/popover.js +1 -0
- package/dist/components/ui/progress.d.ts +9 -0
- package/dist/components/ui/progress.d.ts.map +1 -0
- package/dist/components/ui/progress.js +1 -0
- package/dist/components/ui/slot.d.ts +9 -0
- package/dist/components/ui/slot.d.ts.map +1 -0
- package/dist/components/ui/slot.js +1 -0
- package/dist/components/ui/tooltip.d.ts +9 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -0
- package/dist/components/ui/tooltip.js +1 -0
- package/dist/hooks/index.d.ts +10 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/use-data-state.js +42 -0
- package/dist/hooks/use-is-in-view.js +20 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -7
- package/package.json +4 -8
- package/src/components/ui/accordion.tsx +9 -0
- package/src/components/ui/alert-dialog.tsx +9 -177
- package/src/components/ui/auto-height.tsx +9 -0
- package/src/components/ui/checkbox.tsx +9 -0
- package/src/components/ui/{devenv-bracket.tsx → corner-bracket.tsx} +12 -8
- package/src/components/ui/counting-number.tsx +9 -0
- package/src/components/ui/dialog.tsx +9 -0
- package/src/components/ui/highlight.tsx +9 -0
- package/src/components/ui/index.ts +20 -5
- package/src/components/ui/menu.tsx +9 -0
- package/src/components/ui/popover.tsx +9 -0
- package/src/components/ui/progress.tsx +9 -0
- package/src/components/ui/slot.tsx +9 -0
- package/src/components/ui/tooltip.tsx +9 -0
- package/src/hooks/index.ts +10 -0
- package/src/index.ts +6 -3
- package/dist/components/ui/devenv-bracket.d.ts +0 -30
- package/dist/components/ui/devenv-bracket.d.ts.map +0 -1
- /package/dist/components/ui/morphing-popover/{morphing-popover.module-yxDDcJHZ.css → morphing-popover.module-CE9GIgKo.css} +0 -0
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { getStrictContext } from "../../../../lib/get-strict-context.js";
|
|
4
|
+
import { useControlledState } from "../../../../hooks/use-controlled-state.js";
|
|
5
|
+
import { Highlight, HighlightItem } from "../effects/highlight.js";
|
|
6
|
+
import { useDataState } from "../../../../hooks/use-data-state.js";
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
9
|
+
import { jsx } from "react/jsx-runtime";
|
|
10
|
+
import { Menu } from "@base-ui-components/react/menu";
|
|
11
|
+
|
|
12
|
+
//#region src/components/animate-ui/primitives/base/menu.tsx
|
|
13
|
+
const [MenuActiveValueProvider, useMenuActiveValue] = getStrictContext("MenuActiveValueContext");
|
|
14
|
+
const [MenuProvider, useMenu] = getStrictContext("MenuContext");
|
|
15
|
+
function Menu$1(props) {
|
|
16
|
+
const [isOpen, setIsOpen] = useControlledState({
|
|
17
|
+
value: props?.open,
|
|
18
|
+
defaultValue: props?.defaultOpen,
|
|
19
|
+
onChange: props?.onOpenChange
|
|
20
|
+
});
|
|
21
|
+
const [highlightedValue, setHighlightedValue] = React.useState(null);
|
|
22
|
+
return /* @__PURE__ */ jsx(MenuActiveValueProvider, {
|
|
23
|
+
value: {
|
|
24
|
+
highlightedValue,
|
|
25
|
+
setHighlightedValue
|
|
26
|
+
},
|
|
27
|
+
children: /* @__PURE__ */ jsx(MenuProvider, {
|
|
28
|
+
value: {
|
|
29
|
+
isOpen,
|
|
30
|
+
setIsOpen
|
|
31
|
+
},
|
|
32
|
+
children: /* @__PURE__ */ jsx(Menu.Root, {
|
|
33
|
+
"data-slot": "menu",
|
|
34
|
+
...props,
|
|
35
|
+
onOpenChange: setIsOpen
|
|
36
|
+
})
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function MenuTrigger(props) {
|
|
41
|
+
return /* @__PURE__ */ jsx(Menu.Trigger, {
|
|
42
|
+
"data-slot": "menu-trigger",
|
|
43
|
+
...props
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function MenuPortal(props) {
|
|
47
|
+
const { isOpen } = useMenu();
|
|
48
|
+
return /* @__PURE__ */ jsx(AnimatePresence, { children: isOpen && /* @__PURE__ */ jsx(Menu.Portal, {
|
|
49
|
+
keepMounted: true,
|
|
50
|
+
"data-slot": "menu-portal",
|
|
51
|
+
...props
|
|
52
|
+
}) });
|
|
53
|
+
}
|
|
54
|
+
function MenuGroup(props) {
|
|
55
|
+
return /* @__PURE__ */ jsx(Menu.Group, {
|
|
56
|
+
"data-slot": "menu-group",
|
|
57
|
+
...props
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function MenuGroupLabel(props) {
|
|
61
|
+
return /* @__PURE__ */ jsx(Menu.GroupLabel, {
|
|
62
|
+
"data-slot": "menu-group-label",
|
|
63
|
+
...props
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function MenuSubmenu(props) {
|
|
67
|
+
const [isOpen, setIsOpen] = useControlledState({
|
|
68
|
+
value: props?.open,
|
|
69
|
+
defaultValue: props?.defaultOpen,
|
|
70
|
+
onChange: props?.onOpenChange
|
|
71
|
+
});
|
|
72
|
+
return /* @__PURE__ */ jsx(MenuProvider, {
|
|
73
|
+
value: {
|
|
74
|
+
isOpen,
|
|
75
|
+
setIsOpen
|
|
76
|
+
},
|
|
77
|
+
children: /* @__PURE__ */ jsx(Menu.SubmenuRoot, {
|
|
78
|
+
"data-slot": "menu-submenu",
|
|
79
|
+
...props,
|
|
80
|
+
onOpenChange: setIsOpen
|
|
81
|
+
})
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function MenuSubmenuTrigger({ label, id, nativeButton, ...props }) {
|
|
85
|
+
const { setHighlightedValue } = useMenuActiveValue();
|
|
86
|
+
const [, highlightedRef] = useDataState("highlighted", void 0, (value) => {
|
|
87
|
+
if (value === true) {
|
|
88
|
+
const el = highlightedRef.current;
|
|
89
|
+
const v = el?.dataset.value || el?.id || null;
|
|
90
|
+
if (v) setHighlightedValue(v);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
return /* @__PURE__ */ jsx(Menu.SubmenuTrigger, {
|
|
94
|
+
ref: highlightedRef,
|
|
95
|
+
label,
|
|
96
|
+
id,
|
|
97
|
+
nativeButton,
|
|
98
|
+
"data-slot": "menu-submenu-trigger",
|
|
99
|
+
...props
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function MenuHighlight({ transition = {
|
|
103
|
+
type: "spring",
|
|
104
|
+
stiffness: 350,
|
|
105
|
+
damping: 35
|
|
106
|
+
}, ...props }) {
|
|
107
|
+
const { highlightedValue } = useMenuActiveValue();
|
|
108
|
+
return /* @__PURE__ */ jsx(Highlight, {
|
|
109
|
+
"data-slot": "menu-highlight",
|
|
110
|
+
click: false,
|
|
111
|
+
controlledItems: true,
|
|
112
|
+
transition,
|
|
113
|
+
value: highlightedValue,
|
|
114
|
+
...props
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
function MenuHighlightItem(props) {
|
|
118
|
+
return /* @__PURE__ */ jsx(HighlightItem, {
|
|
119
|
+
"data-slot": "menu-highlight-item",
|
|
120
|
+
...props
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
function MenuPositioner(props) {
|
|
124
|
+
return /* @__PURE__ */ jsx(Menu.Positioner, {
|
|
125
|
+
"data-slot": "menu-positioner",
|
|
126
|
+
...props
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
function MenuPopup({ finalFocus, id, transition = { duration: .2 }, style, ...props }) {
|
|
130
|
+
return /* @__PURE__ */ jsx(Menu.Popup, {
|
|
131
|
+
finalFocus,
|
|
132
|
+
id,
|
|
133
|
+
render: /* @__PURE__ */ jsx(motion.div, {
|
|
134
|
+
"data-slot": "menu-popup",
|
|
135
|
+
initial: {
|
|
136
|
+
opacity: 0,
|
|
137
|
+
scale: .95
|
|
138
|
+
},
|
|
139
|
+
animate: {
|
|
140
|
+
opacity: 1,
|
|
141
|
+
scale: 1
|
|
142
|
+
},
|
|
143
|
+
exit: {
|
|
144
|
+
opacity: 0,
|
|
145
|
+
scale: .95
|
|
146
|
+
},
|
|
147
|
+
transition,
|
|
148
|
+
style: {
|
|
149
|
+
willChange: "opacity, transform",
|
|
150
|
+
...style
|
|
151
|
+
},
|
|
152
|
+
...props
|
|
153
|
+
}, "menu-popup")
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
function MenuItem({ disabled, label, closeOnClick, nativeButton, id, ...props }) {
|
|
157
|
+
const { setHighlightedValue } = useMenuActiveValue();
|
|
158
|
+
const [, highlightedRef] = useDataState("highlighted", void 0, (value) => {
|
|
159
|
+
if (value === true) {
|
|
160
|
+
const el = highlightedRef.current;
|
|
161
|
+
const v = el?.dataset.value || el?.id || null;
|
|
162
|
+
if (v) setHighlightedValue(v);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
return /* @__PURE__ */ jsx(Menu.Item, {
|
|
166
|
+
ref: highlightedRef,
|
|
167
|
+
label,
|
|
168
|
+
closeOnClick,
|
|
169
|
+
nativeButton,
|
|
170
|
+
disabled,
|
|
171
|
+
id,
|
|
172
|
+
"data-slot": "menu-item",
|
|
173
|
+
...props
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
function MenuCheckboxItem({ label, defaultChecked, checked, onCheckedChange, disabled, closeOnClick, nativeButton, id, ...props }) {
|
|
177
|
+
const { setHighlightedValue } = useMenuActiveValue();
|
|
178
|
+
const [, highlightedRef] = useDataState("highlighted", void 0, (value) => {
|
|
179
|
+
if (value === true) {
|
|
180
|
+
const el = highlightedRef.current;
|
|
181
|
+
const v = el?.dataset.value || el?.id || null;
|
|
182
|
+
if (v) setHighlightedValue(v);
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
return /* @__PURE__ */ jsx(Menu.CheckboxItem, {
|
|
186
|
+
ref: highlightedRef,
|
|
187
|
+
label,
|
|
188
|
+
checked,
|
|
189
|
+
defaultChecked,
|
|
190
|
+
onCheckedChange,
|
|
191
|
+
disabled,
|
|
192
|
+
closeOnClick,
|
|
193
|
+
nativeButton,
|
|
194
|
+
id,
|
|
195
|
+
"data-slot": "menu-checkbox-item",
|
|
196
|
+
...props
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
function MenuCheckboxItemIndicator({ keepMounted, ...props }) {
|
|
200
|
+
return /* @__PURE__ */ jsx(Menu.CheckboxItemIndicator, {
|
|
201
|
+
"data-slot": "menu-checkbox-item-indicator",
|
|
202
|
+
keepMounted,
|
|
203
|
+
render: /* @__PURE__ */ jsx(motion.div, {
|
|
204
|
+
"data-slot": "menu-checkbox-item-indicator",
|
|
205
|
+
...props
|
|
206
|
+
})
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
function MenuRadioGroup(props) {
|
|
210
|
+
return /* @__PURE__ */ jsx(Menu.RadioGroup, {
|
|
211
|
+
"data-slot": "menu-radio-group",
|
|
212
|
+
...props
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
function MenuRadioItem({ value, disabled, label, closeOnClick, nativeButton, id, ...props }) {
|
|
216
|
+
const { setHighlightedValue } = useMenuActiveValue();
|
|
217
|
+
const [, highlightedRef] = useDataState("highlighted", void 0, (value) => {
|
|
218
|
+
if (value === true) {
|
|
219
|
+
const el = highlightedRef.current;
|
|
220
|
+
const v = el?.dataset.value || el?.id || null;
|
|
221
|
+
if (v) setHighlightedValue(v);
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
return /* @__PURE__ */ jsx(Menu.RadioItem, {
|
|
225
|
+
ref: highlightedRef,
|
|
226
|
+
value,
|
|
227
|
+
disabled,
|
|
228
|
+
label,
|
|
229
|
+
closeOnClick,
|
|
230
|
+
nativeButton,
|
|
231
|
+
id,
|
|
232
|
+
"data-slot": "menu-radio-item",
|
|
233
|
+
...props
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
function MenuRadioItemIndicator({ keepMounted, ...props }) {
|
|
237
|
+
return /* @__PURE__ */ jsx(Menu.RadioItemIndicator, {
|
|
238
|
+
"data-slot": "menu-radio-item-indicator",
|
|
239
|
+
keepMounted,
|
|
240
|
+
render: /* @__PURE__ */ jsx(motion.div, {
|
|
241
|
+
"data-slot": "menu-radio-item-indicator",
|
|
242
|
+
...props
|
|
243
|
+
})
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
function MenuShortcut(props) {
|
|
247
|
+
return /* @__PURE__ */ jsx("span", {
|
|
248
|
+
"data-slot": "menu-shortcut",
|
|
249
|
+
...props
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
function MenuArrow(props) {
|
|
253
|
+
return /* @__PURE__ */ jsx(Menu.Arrow, {
|
|
254
|
+
"data-slot": "menu-arrow",
|
|
255
|
+
...props
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
function MenuSeparator(props) {
|
|
259
|
+
return /* @__PURE__ */ jsx(Menu.Separator, {
|
|
260
|
+
"data-slot": "menu-separator",
|
|
261
|
+
...props
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
//#endregion
|
|
266
|
+
export { Menu$1 as Menu, MenuArrow, MenuCheckboxItem, MenuCheckboxItemIndicator, MenuGroup, MenuGroupLabel, MenuHighlight, MenuHighlightItem, MenuItem, MenuPopup, MenuPortal, MenuPositioner, MenuRadioGroup, MenuRadioItem, MenuRadioItemIndicator, MenuSeparator, MenuShortcut, MenuSubmenu, MenuSubmenuTrigger, MenuTrigger, useMenu, useMenuActiveValue };
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { getStrictContext } from "../../../../lib/get-strict-context.js";
|
|
4
|
+
import { useControlledState } from "../../../../hooks/use-controlled-state.js";
|
|
5
|
+
import "react";
|
|
6
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
import { Popover } from "@base-ui-components/react/popover";
|
|
9
|
+
|
|
10
|
+
//#region src/components/animate-ui/primitives/base/popover.tsx
|
|
11
|
+
const [PopoverProvider, usePopover] = getStrictContext("PopoverContext");
|
|
12
|
+
function Popover$1(props) {
|
|
13
|
+
const [isOpen, setIsOpen] = useControlledState({
|
|
14
|
+
value: props?.open,
|
|
15
|
+
defaultValue: props?.defaultOpen,
|
|
16
|
+
onChange: props?.onOpenChange
|
|
17
|
+
});
|
|
18
|
+
return /* @__PURE__ */ jsx(PopoverProvider, {
|
|
19
|
+
value: {
|
|
20
|
+
isOpen,
|
|
21
|
+
setIsOpen
|
|
22
|
+
},
|
|
23
|
+
children: /* @__PURE__ */ jsx(Popover.Root, {
|
|
24
|
+
"data-slot": "popover",
|
|
25
|
+
...props,
|
|
26
|
+
onOpenChange: setIsOpen
|
|
27
|
+
})
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function PopoverTrigger(props) {
|
|
31
|
+
return /* @__PURE__ */ jsx(Popover.Trigger, {
|
|
32
|
+
"data-slot": "popover-trigger",
|
|
33
|
+
...props
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function PopoverPortal(props) {
|
|
37
|
+
const { isOpen } = usePopover();
|
|
38
|
+
return /* @__PURE__ */ jsx(AnimatePresence, { children: isOpen && /* @__PURE__ */ jsx(Popover.Portal, {
|
|
39
|
+
keepMounted: true,
|
|
40
|
+
"data-slot": "popover-portal",
|
|
41
|
+
...props
|
|
42
|
+
}) });
|
|
43
|
+
}
|
|
44
|
+
function PopoverPositioner(props) {
|
|
45
|
+
return /* @__PURE__ */ jsx(Popover.Positioner, {
|
|
46
|
+
"data-slot": "popover-positioner",
|
|
47
|
+
...props
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function PopoverPopup({ initialFocus, finalFocus, transition = {
|
|
51
|
+
type: "spring",
|
|
52
|
+
stiffness: 300,
|
|
53
|
+
damping: 25
|
|
54
|
+
}, ...props }) {
|
|
55
|
+
return /* @__PURE__ */ jsx(Popover.Popup, {
|
|
56
|
+
initialFocus,
|
|
57
|
+
finalFocus,
|
|
58
|
+
render: /* @__PURE__ */ jsx(motion.div, {
|
|
59
|
+
"data-slot": "popover-popup",
|
|
60
|
+
initial: {
|
|
61
|
+
opacity: 0,
|
|
62
|
+
scale: .5
|
|
63
|
+
},
|
|
64
|
+
animate: {
|
|
65
|
+
opacity: 1,
|
|
66
|
+
scale: 1
|
|
67
|
+
},
|
|
68
|
+
exit: {
|
|
69
|
+
opacity: 0,
|
|
70
|
+
scale: .5
|
|
71
|
+
},
|
|
72
|
+
transition,
|
|
73
|
+
...props
|
|
74
|
+
}, "popover-popup")
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
function PopoverBackdrop(props) {
|
|
78
|
+
return /* @__PURE__ */ jsx(Popover.Backdrop, {
|
|
79
|
+
"data-slot": "popover-backdrop",
|
|
80
|
+
...props
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
function PopoverArrow(props) {
|
|
84
|
+
return /* @__PURE__ */ jsx(Popover.Arrow, {
|
|
85
|
+
"data-slot": "popover-arrow",
|
|
86
|
+
...props
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function PopoverTitle(props) {
|
|
90
|
+
return /* @__PURE__ */ jsx(Popover.Title, {
|
|
91
|
+
"data-slot": "popover-title",
|
|
92
|
+
...props
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
function PopoverDescription(props) {
|
|
96
|
+
return /* @__PURE__ */ jsx(Popover.Description, {
|
|
97
|
+
"data-slot": "popover-description",
|
|
98
|
+
...props
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
function PopoverClose(props) {
|
|
102
|
+
return /* @__PURE__ */ jsx(Popover.Close, {
|
|
103
|
+
"data-slot": "popover-close",
|
|
104
|
+
...props
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
//#endregion
|
|
109
|
+
export { Popover$1 as Popover, PopoverArrow, PopoverBackdrop, PopoverClose, PopoverDescription, PopoverPopup, PopoverPortal, PopoverPositioner, PopoverTitle, PopoverTrigger, usePopover };
|
|
@@ -9,25 +9,28 @@ type ProgressProps = React.ComponentProps<typeof ProgressPrimitives.Root>;
|
|
|
9
9
|
declare const Progress: (props: ProgressProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
type ProgressIndicatorProps = React.ComponentProps<typeof MotionProgressIndicator>;
|
|
11
11
|
declare const MotionProgressIndicator: React.ComponentType<Omit<{
|
|
12
|
+
ref?: React.Ref<HTMLDivElement> | undefined;
|
|
13
|
+
onChange?: ((event: import("node_modules/@base-ui-components/react/esm/utils/types").BaseUIEvent<React.ChangeEvent<HTMLDivElement, Element>>) => void) | undefined;
|
|
14
|
+
slot?: string | undefined;
|
|
15
|
+
title?: string | undefined;
|
|
12
16
|
className?: string | ((state: import("@base-ui-components/react/progress").ProgressRootState) => string | undefined) | undefined;
|
|
17
|
+
key?: React.Key | null | undefined;
|
|
13
18
|
suppressContentEditableWarning?: boolean | undefined;
|
|
14
19
|
suppressHydrationWarning?: boolean | undefined;
|
|
15
20
|
accessKey?: string | undefined;
|
|
16
|
-
autoCapitalize?: (string & {}) | "
|
|
21
|
+
autoCapitalize?: (string & {}) | "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined;
|
|
17
22
|
autoFocus?: boolean | undefined;
|
|
18
23
|
contentEditable?: "inherit" | (boolean | "true" | "false") | "plaintext-only" | undefined;
|
|
19
24
|
contextMenu?: string | undefined;
|
|
20
25
|
dir?: string | undefined;
|
|
21
26
|
draggable?: (boolean | "true" | "false") | undefined;
|
|
22
|
-
enterKeyHint?: "search" | "
|
|
27
|
+
enterKeyHint?: "search" | "enter" | "done" | "go" | "next" | "previous" | "send" | undefined;
|
|
23
28
|
hidden?: boolean | undefined;
|
|
24
29
|
id?: string | undefined;
|
|
25
30
|
lang?: string | undefined;
|
|
26
31
|
nonce?: string | undefined;
|
|
27
|
-
slot?: string | undefined;
|
|
28
32
|
spellCheck?: (boolean | "true" | "false") | undefined;
|
|
29
33
|
tabIndex?: number | undefined;
|
|
30
|
-
title?: string | undefined;
|
|
31
34
|
translate?: "yes" | "no" | undefined;
|
|
32
35
|
radioGroup?: string | undefined;
|
|
33
36
|
role?: React.AriaRole | undefined;
|
|
@@ -53,16 +56,16 @@ declare const MotionProgressIndicator: React.ComponentType<Omit<{
|
|
|
53
56
|
security?: string | undefined;
|
|
54
57
|
unselectable?: "off" | "on" | undefined;
|
|
55
58
|
popover?: "" | "auto" | "manual" | "hint" | undefined;
|
|
56
|
-
popoverTargetAction?: "
|
|
59
|
+
popoverTargetAction?: "toggle" | "show" | "hide" | undefined;
|
|
57
60
|
popoverTarget?: string | undefined;
|
|
58
61
|
inert?: boolean | undefined;
|
|
59
|
-
inputMode?: "search" | "
|
|
62
|
+
inputMode?: "search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
|
|
60
63
|
is?: string | undefined;
|
|
61
64
|
exportparts?: string | undefined;
|
|
62
65
|
part?: string | undefined;
|
|
63
66
|
"aria-activedescendant"?: string | undefined;
|
|
64
67
|
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
65
|
-
"aria-autocomplete"?: "none" | "
|
|
68
|
+
"aria-autocomplete"?: "none" | "list" | "inline" | "both" | undefined;
|
|
66
69
|
"aria-braillelabel"?: string | undefined;
|
|
67
70
|
"aria-brailleroledescription"?: string | undefined;
|
|
68
71
|
"aria-busy"?: (boolean | "true" | "false") | undefined;
|
|
@@ -72,17 +75,17 @@ declare const MotionProgressIndicator: React.ComponentType<Omit<{
|
|
|
72
75
|
"aria-colindextext"?: string | undefined;
|
|
73
76
|
"aria-colspan"?: number | undefined;
|
|
74
77
|
"aria-controls"?: string | undefined;
|
|
75
|
-
"aria-current"?: boolean | "
|
|
78
|
+
"aria-current"?: boolean | "time" | "true" | "false" | "page" | "step" | "location" | "date" | undefined;
|
|
76
79
|
"aria-describedby"?: string | undefined;
|
|
77
80
|
"aria-description"?: string | undefined;
|
|
78
81
|
"aria-details"?: string | undefined;
|
|
79
82
|
"aria-disabled"?: (boolean | "true" | "false") | undefined;
|
|
80
|
-
"aria-dropeffect"?: "link" | "none" | "copy" | "
|
|
83
|
+
"aria-dropeffect"?: "link" | "none" | "copy" | "execute" | "move" | "popup" | undefined;
|
|
81
84
|
"aria-errormessage"?: string | undefined;
|
|
82
85
|
"aria-expanded"?: (boolean | "true" | "false") | undefined;
|
|
83
86
|
"aria-flowto"?: string | undefined;
|
|
84
87
|
"aria-grabbed"?: (boolean | "true" | "false") | undefined;
|
|
85
|
-
"aria-haspopup"?: boolean | "
|
|
88
|
+
"aria-haspopup"?: boolean | "dialog" | "menu" | "true" | "false" | "grid" | "listbox" | "tree" | undefined;
|
|
86
89
|
"aria-hidden"?: (boolean | "true" | "false") | undefined;
|
|
87
90
|
"aria-invalid"?: boolean | "true" | "false" | "grammar" | "spelling" | undefined;
|
|
88
91
|
"aria-keyshortcuts"?: string | undefined;
|
|
@@ -99,7 +102,7 @@ declare const MotionProgressIndicator: React.ComponentType<Omit<{
|
|
|
99
102
|
"aria-posinset"?: number | undefined;
|
|
100
103
|
"aria-pressed"?: boolean | "true" | "false" | "mixed" | undefined;
|
|
101
104
|
"aria-readonly"?: (boolean | "true" | "false") | undefined;
|
|
102
|
-
"aria-relevant"?: "
|
|
105
|
+
"aria-relevant"?: "text" | "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
|
|
103
106
|
"aria-required"?: (boolean | "true" | "false") | undefined;
|
|
104
107
|
"aria-roledescription"?: string | undefined;
|
|
105
108
|
"aria-rowcount"?: number | undefined;
|
|
@@ -132,7 +135,6 @@ declare const MotionProgressIndicator: React.ComponentType<Omit<{
|
|
|
132
135
|
onFocusCapture?: ((event: import("node_modules/@base-ui-components/react/esm/utils/types").BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined;
|
|
133
136
|
onBlur?: ((event: import("node_modules/@base-ui-components/react/esm/utils/types").BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined;
|
|
134
137
|
onBlurCapture?: ((event: import("node_modules/@base-ui-components/react/esm/utils/types").BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined;
|
|
135
|
-
onChange?: ((event: import("node_modules/@base-ui-components/react/esm/utils/types").BaseUIEvent<React.ChangeEvent<HTMLDivElement, Element>>) => void) | undefined;
|
|
136
138
|
onChangeCapture?: ((event: import("node_modules/@base-ui-components/react/esm/utils/types").BaseUIEvent<React.ChangeEvent<HTMLDivElement, Element>>) => void) | undefined;
|
|
137
139
|
onBeforeInput?: ((event: import("node_modules/@base-ui-components/react/esm/utils/types").BaseUIEvent<React.InputEvent<HTMLDivElement>>) => void) | undefined;
|
|
138
140
|
onBeforeInputCapture?: ((event: import("node_modules/@base-ui-components/react/esm/utils/types").BaseUIEvent<React.InputEvent<HTMLDivElement>>) => void) | undefined;
|
|
@@ -281,8 +283,6 @@ declare const MotionProgressIndicator: React.ComponentType<Omit<{
|
|
|
281
283
|
onTransitionStart?: ((event: import("node_modules/@base-ui-components/react/esm/utils/types").BaseUIEvent<React.TransitionEvent<HTMLDivElement>>) => void) | undefined;
|
|
282
284
|
onTransitionStartCapture?: ((event: import("node_modules/@base-ui-components/react/esm/utils/types").BaseUIEvent<React.TransitionEvent<HTMLDivElement>>) => void) | undefined;
|
|
283
285
|
render?: React.ReactElement<Record<string, unknown>, string | React.JSXElementConstructor<any>> | import("node_modules/@base-ui-components/react/esm/utils/types").ComponentRenderFn<import("node_modules/@base-ui-components/react/esm/utils/types").HTMLProps<any>, import("@base-ui-components/react/progress").ProgressRootState> | undefined;
|
|
284
|
-
ref?: React.Ref<HTMLDivElement> | undefined;
|
|
285
|
-
key?: React.Key | null | undefined;
|
|
286
286
|
} & import("framer-motion").MotionProps, "children"> & {
|
|
287
287
|
children?: React.ReactNode | import("motion-dom").MotionValue<number> | import("motion-dom").MotionValue<string>;
|
|
288
288
|
}>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { getStrictContext } from "../../../../lib/get-strict-context.js";
|
|
4
|
+
import { CountingNumber } from "../texts/counting-number.js";
|
|
5
|
+
import "react";
|
|
6
|
+
import { motion } from "motion/react";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
import { Progress } from "@base-ui-components/react/progress";
|
|
9
|
+
|
|
10
|
+
//#region src/components/animate-ui/primitives/base/progress.tsx
|
|
11
|
+
const [ProgressProvider, useProgress] = getStrictContext("ProgressContext");
|
|
12
|
+
const Progress$1 = (props) => {
|
|
13
|
+
return /* @__PURE__ */ jsx(ProgressProvider, {
|
|
14
|
+
value: { value: props.value ?? 0 },
|
|
15
|
+
children: /* @__PURE__ */ jsx(Progress.Root, {
|
|
16
|
+
"data-slot": "progress",
|
|
17
|
+
...props
|
|
18
|
+
})
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
const MotionProgressIndicator = motion.create(Progress.Indicator);
|
|
22
|
+
function ProgressIndicator({ transition = {
|
|
23
|
+
type: "spring",
|
|
24
|
+
stiffness: 100,
|
|
25
|
+
damping: 30
|
|
26
|
+
}, ...props }) {
|
|
27
|
+
const { value } = useProgress();
|
|
28
|
+
return /* @__PURE__ */ jsx(MotionProgressIndicator, {
|
|
29
|
+
"data-slot": "progress-indicator",
|
|
30
|
+
animate: { width: `${value}%` },
|
|
31
|
+
transition,
|
|
32
|
+
...props
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function ProgressTrack(props) {
|
|
36
|
+
return /* @__PURE__ */ jsx(Progress.Track, {
|
|
37
|
+
"data-slot": "progress-track",
|
|
38
|
+
...props
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function ProgressLabel(props) {
|
|
42
|
+
return /* @__PURE__ */ jsx(Progress.Label, {
|
|
43
|
+
"data-slot": "progress-label",
|
|
44
|
+
...props
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function ProgressValue({ transition = {
|
|
48
|
+
stiffness: 80,
|
|
49
|
+
damping: 20
|
|
50
|
+
}, ...props }) {
|
|
51
|
+
const { value } = useProgress();
|
|
52
|
+
return /* @__PURE__ */ jsx(Progress.Value, {
|
|
53
|
+
"data-slot": "progress-value",
|
|
54
|
+
render: /* @__PURE__ */ jsx(CountingNumber, {
|
|
55
|
+
number: value ?? 0,
|
|
56
|
+
transition,
|
|
57
|
+
...props
|
|
58
|
+
})
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
//#endregion
|
|
63
|
+
export { Progress$1 as Progress, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue, useProgress };
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
import { getStrictContext } from "../../../../lib/get-strict-context.js";
|
|
4
4
|
import { useControlledState } from "../../../../hooks/use-controlled-state.js";
|
|
5
5
|
import * as React from "react";
|
|
6
|
+
import { motion } from "motion/react";
|
|
6
7
|
import { jsx } from "react/jsx-runtime";
|
|
7
8
|
import { Switch } from "@base-ui-components/react/switch";
|
|
8
|
-
import { motion } from "motion/react";
|
|
9
9
|
|
|
10
10
|
//#region src/components/animate-ui/primitives/base/switch.tsx
|
|
11
11
|
const [SwitchProvider, useSwitch] = getStrictContext("SwitchContext");
|
|
@@ -5,8 +5,8 @@ import { useControlledState } from "../../../../hooks/use-controlled-state.js";
|
|
|
5
5
|
import { Highlight, HighlightItem } from "../effects/highlight.js";
|
|
6
6
|
import { AutoHeight } from "../effects/auto-height.js";
|
|
7
7
|
import * as React from "react";
|
|
8
|
-
import { jsx } from "react/jsx-runtime";
|
|
9
8
|
import { AnimatePresence, motion } from "motion/react";
|
|
9
|
+
import { jsx } from "react/jsx-runtime";
|
|
10
10
|
import { Tabs } from "@base-ui-components/react/tabs";
|
|
11
11
|
|
|
12
12
|
//#region src/components/animate-ui/primitives/base/tabs.tsx
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { getStrictContext } from "../../../../lib/get-strict-context.js";
|
|
4
|
+
import { useControlledState } from "../../../../hooks/use-controlled-state.js";
|
|
5
|
+
import "react";
|
|
6
|
+
import { AnimatePresence, motion, useMotionValue, useSpring } from "motion/react";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
import { Tooltip } from "@base-ui-components/react/tooltip";
|
|
9
|
+
|
|
10
|
+
//#region src/components/animate-ui/primitives/base/tooltip.tsx
|
|
11
|
+
const [LocalTooltipProvider, useTooltip] = getStrictContext("TooltipContext");
|
|
12
|
+
function TooltipProvider(props) {
|
|
13
|
+
return /* @__PURE__ */ jsx(Tooltip.Provider, {
|
|
14
|
+
"data-slot": "tooltip-provider",
|
|
15
|
+
...props
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function Tooltip$1({ followCursor = false, followCursorSpringOptions = {
|
|
19
|
+
stiffness: 200,
|
|
20
|
+
damping: 17
|
|
21
|
+
}, ...props }) {
|
|
22
|
+
const [isOpen, setIsOpen] = useControlledState({
|
|
23
|
+
value: props?.open,
|
|
24
|
+
defaultValue: props?.defaultOpen,
|
|
25
|
+
onChange: props?.onOpenChange
|
|
26
|
+
});
|
|
27
|
+
return /* @__PURE__ */ jsx(LocalTooltipProvider, {
|
|
28
|
+
value: {
|
|
29
|
+
isOpen,
|
|
30
|
+
setIsOpen,
|
|
31
|
+
x: useMotionValue(0),
|
|
32
|
+
y: useMotionValue(0),
|
|
33
|
+
followCursor,
|
|
34
|
+
followCursorSpringOptions
|
|
35
|
+
},
|
|
36
|
+
children: /* @__PURE__ */ jsx(Tooltip.Root, {
|
|
37
|
+
"data-slot": "tooltip",
|
|
38
|
+
...props,
|
|
39
|
+
onOpenChange: setIsOpen
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function TooltipTrigger({ onMouseMove, ...props }) {
|
|
44
|
+
const { x, y, followCursor } = useTooltip();
|
|
45
|
+
const handleMouseMove = (event) => {
|
|
46
|
+
onMouseMove?.(event);
|
|
47
|
+
const target = event.currentTarget.getBoundingClientRect();
|
|
48
|
+
if (followCursor === "x" || followCursor === true) {
|
|
49
|
+
const offsetXFromCenter = (event.clientX - target.left - target.width / 2) / 2;
|
|
50
|
+
x.set(offsetXFromCenter);
|
|
51
|
+
}
|
|
52
|
+
if (followCursor === "y" || followCursor === true) {
|
|
53
|
+
const offsetYFromCenter = (event.clientY - target.top - target.height / 2) / 2;
|
|
54
|
+
y.set(offsetYFromCenter);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
return /* @__PURE__ */ jsx(Tooltip.Trigger, {
|
|
58
|
+
"data-slot": "tooltip-trigger",
|
|
59
|
+
onMouseMove: handleMouseMove,
|
|
60
|
+
...props
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function TooltipPortal(props) {
|
|
64
|
+
const { isOpen } = useTooltip();
|
|
65
|
+
return /* @__PURE__ */ jsx(AnimatePresence, { children: isOpen && /* @__PURE__ */ jsx(Tooltip.Portal, {
|
|
66
|
+
keepMounted: true,
|
|
67
|
+
"data-slot": "tooltip-portal",
|
|
68
|
+
...props
|
|
69
|
+
}) });
|
|
70
|
+
}
|
|
71
|
+
function TooltipPositioner(props) {
|
|
72
|
+
return /* @__PURE__ */ jsx(Tooltip.Positioner, {
|
|
73
|
+
"data-slot": "tooltip-positioner",
|
|
74
|
+
...props
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
function TooltipPopup({ transition = {
|
|
78
|
+
type: "spring",
|
|
79
|
+
stiffness: 300,
|
|
80
|
+
damping: 25
|
|
81
|
+
}, style, ...props }) {
|
|
82
|
+
const { x, y, followCursor, followCursorSpringOptions } = useTooltip();
|
|
83
|
+
const translateX = useSpring(x, followCursorSpringOptions);
|
|
84
|
+
const translateY = useSpring(y, followCursorSpringOptions);
|
|
85
|
+
return /* @__PURE__ */ jsx(Tooltip.Popup, { render: /* @__PURE__ */ jsx(motion.div, {
|
|
86
|
+
"data-slot": "tooltip-popup",
|
|
87
|
+
initial: {
|
|
88
|
+
opacity: 0,
|
|
89
|
+
scale: .5
|
|
90
|
+
},
|
|
91
|
+
animate: {
|
|
92
|
+
opacity: 1,
|
|
93
|
+
scale: 1
|
|
94
|
+
},
|
|
95
|
+
exit: {
|
|
96
|
+
opacity: 0,
|
|
97
|
+
scale: .5
|
|
98
|
+
},
|
|
99
|
+
transition,
|
|
100
|
+
style: {
|
|
101
|
+
x: followCursor === "x" || followCursor === true ? translateX : void 0,
|
|
102
|
+
y: followCursor === "y" || followCursor === true ? translateY : void 0,
|
|
103
|
+
...style
|
|
104
|
+
},
|
|
105
|
+
...props
|
|
106
|
+
}, "tooltip-popup") });
|
|
107
|
+
}
|
|
108
|
+
function TooltipArrow(props) {
|
|
109
|
+
return /* @__PURE__ */ jsx(Tooltip.Arrow, {
|
|
110
|
+
"data-slot": "tooltip-arrow",
|
|
111
|
+
...props
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
//#endregion
|
|
116
|
+
export { Tooltip$1 as Tooltip, TooltipArrow, TooltipPopup, TooltipPortal, TooltipPositioner, TooltipProvider, TooltipTrigger, useTooltip };
|