@g4rcez/components 3.0.0-0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/core/button.d.ts +2 -8
- package/dist/components/core/button.d.ts.map +1 -1
- package/dist/components/core/button.jsx +11 -18
- package/dist/components/core/polymorph.d.ts.map +1 -1
- package/dist/components/core/slot.d.ts +1 -1
- package/dist/components/core/slot.d.ts.map +1 -1
- package/dist/components/core/slot.jsx +28 -35
- package/dist/components/core/tag.d.ts +1 -1
- package/dist/components/core/tag.d.ts.map +1 -1
- package/dist/components/core/tag.jsx +3 -3
- package/dist/components/core/typography.d.ts.map +1 -1
- package/dist/components/core/typography.jsx +16 -20
- package/dist/components/display/alert.d.ts.map +1 -1
- package/dist/components/display/alert.jsx +19 -17
- package/dist/components/display/calendar.d.ts.map +1 -1
- package/dist/components/display/calendar.jsx +6 -8
- package/dist/components/display/card.d.ts.map +1 -1
- package/dist/components/display/card.jsx +6 -6
- package/dist/components/display/empty.jsx +1 -1
- package/dist/components/display/notifications.d.ts +2 -0
- package/dist/components/display/notifications.d.ts.map +1 -1
- package/dist/components/display/notifications.jsx +76 -48
- package/dist/components/display/progress.d.ts.map +1 -1
- package/dist/components/display/progress.jsx +7 -9
- package/dist/components/display/shortcut.jsx +1 -1
- package/dist/components/display/skeleton.d.ts.map +1 -1
- package/dist/components/display/skeleton.jsx +3 -5
- package/dist/components/display/step.d.ts.map +1 -1
- package/dist/components/display/step.jsx +27 -27
- package/dist/components/display/tabs.d.ts.map +1 -1
- package/dist/components/display/tabs.jsx +5 -7
- package/dist/components/display/timeline.jsx +1 -1
- package/dist/components/floating/command-palette.d.ts +1 -0
- package/dist/components/floating/command-palette.d.ts.map +1 -1
- package/dist/components/floating/command-palette.jsx +92 -70
- package/dist/components/floating/dropdown.d.ts.map +1 -1
- package/dist/components/floating/dropdown.jsx +15 -15
- package/dist/components/floating/menu.d.ts +2 -2
- package/dist/components/floating/menu.jsx +2 -2
- package/dist/components/floating/modal.d.ts +20 -53
- package/dist/components/floating/modal.d.ts.map +1 -1
- package/dist/components/floating/modal.jsx +109 -51
- package/dist/components/floating/tooltip.d.ts.map +1 -1
- package/dist/components/floating/tooltip.jsx +2 -8
- package/dist/components/floating/wizard.d.ts +1 -1
- package/dist/components/floating/wizard.d.ts.map +1 -1
- package/dist/components/floating/wizard.jsx +50 -53
- package/dist/components/form/autocomplete.d.ts.map +1 -1
- package/dist/components/form/autocomplete.jsx +42 -38
- package/dist/components/form/checkbox.jsx +3 -3
- package/dist/components/form/date-picker.d.ts.map +1 -1
- package/dist/components/form/date-picker.jsx +14 -14
- package/dist/components/form/file-upload.jsx +13 -13
- package/dist/components/form/free-text.d.ts.map +1 -1
- package/dist/components/form/free-text.jsx +3 -3
- package/dist/components/form/input-field.d.ts +3 -2
- package/dist/components/form/input-field.d.ts.map +1 -1
- package/dist/components/form/input-field.jsx +43 -41
- package/dist/components/form/multi-select.d.ts.map +1 -1
- package/dist/components/form/multi-select.jsx +56 -56
- package/dist/components/form/select.d.ts.map +1 -1
- package/dist/components/form/select.jsx +3 -3
- package/dist/components/form/slider.d.ts.map +1 -1
- package/dist/components/form/slider.jsx +10 -10
- package/dist/components/form/switch.jsx +2 -2
- package/dist/components/form/transfer-list.jsx +3 -3
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +2 -0
- package/dist/components/page-calendar/calendar-header.d.ts +16 -0
- package/dist/components/page-calendar/calendar-header.d.ts.map +1 -0
- package/dist/components/page-calendar/calendar-header.jsx +81 -0
- package/dist/components/page-calendar/day-view.d.ts +12 -0
- package/dist/components/page-calendar/day-view.d.ts.map +1 -0
- package/dist/components/page-calendar/day-view.jsx +87 -0
- package/dist/components/page-calendar/event-pill.d.ts +9 -0
- package/dist/components/page-calendar/event-pill.d.ts.map +1 -0
- package/dist/components/page-calendar/event-pill.jsx +25 -0
- package/dist/components/page-calendar/index.d.ts +4 -0
- package/dist/components/page-calendar/index.d.ts.map +1 -0
- package/dist/components/page-calendar/index.js +2 -0
- package/dist/components/page-calendar/month-view.d.ts +11 -0
- package/dist/components/page-calendar/month-view.d.ts.map +1 -0
- package/dist/components/page-calendar/month-view.jsx +47 -0
- package/dist/components/page-calendar/page-calendar.d.ts +18 -0
- package/dist/components/page-calendar/page-calendar.d.ts.map +1 -0
- package/dist/components/page-calendar/page-calendar.jsx +41 -0
- package/dist/components/page-calendar/page-calendar.types.d.ts +18 -0
- package/dist/components/page-calendar/page-calendar.types.d.ts.map +1 -0
- package/dist/components/page-calendar/page-calendar.types.js +1 -0
- package/dist/components/page-calendar/page-calendar.utils.d.ts +18 -0
- package/dist/components/page-calendar/page-calendar.utils.d.ts.map +1 -0
- package/dist/components/page-calendar/page-calendar.utils.js +71 -0
- package/dist/components/page-calendar/week-view.d.ts +11 -0
- package/dist/components/page-calendar/week-view.d.ts.map +1 -0
- package/dist/components/page-calendar/week-view.jsx +64 -0
- package/dist/components/table/filter.jsx +4 -4
- package/dist/components/table/index.d.ts.map +1 -1
- package/dist/components/table/index.jsx +10 -10
- package/dist/components/table/inner-table.d.ts.map +1 -1
- package/dist/components/table/inner-table.jsx +18 -18
- package/dist/components/table/metadata.d.ts.map +1 -1
- package/dist/components/table/metadata.jsx +29 -30
- package/dist/components/table/pagination.jsx +1 -1
- package/dist/components/table/row.d.ts.map +1 -1
- package/dist/components/table/row.jsx +17 -17
- package/dist/components/table/sort.jsx +1 -1
- package/dist/components/table/table-lib.d.ts.map +1 -1
- package/dist/components/table/table-lib.js +1 -2
- package/dist/components/table/thead.d.ts.map +1 -1
- package/dist/components/table/thead.jsx +6 -6
- package/dist/config/context.d.ts.map +1 -1
- package/dist/config/default-translations.d.ts +17 -0
- package/dist/config/default-translations.d.ts.map +1 -1
- package/dist/config/default-translations.jsx +18 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/hooks/use-components-provider.d.ts.map +1 -1
- package/dist/hooks/use-components-provider.jsx +4 -1
- package/dist/hooks/use-form.d.ts +11 -11
- package/dist/hooks/use-form.d.ts.map +1 -1
- package/dist/hooks/use-form.js +1 -0
- package/dist/hooks/use-input-id.d.ts.map +1 -1
- package/dist/hooks/use-is-coarse-device.js +1 -1
- package/dist/hooks/use-preferences.d.ts.map +1 -1
- package/dist/hooks/use-previous.d.ts.map +1 -1
- package/dist/hooks/use-previous.js +1 -0
- package/dist/hooks/use-reactive.d.ts.map +1 -1
- package/dist/hooks/use-reactive.js +1 -0
- package/dist/hooks/use-resize-observer.d.ts.map +1 -1
- package/dist/hooks/use-stable-ref.d.ts.map +1 -1
- package/dist/hooks/use-stable-ref.js +1 -0
- package/dist/hooks/use-swipe.d.ts.map +1 -1
- package/dist/hooks/use-swipe.js +1 -0
- package/dist/hooks/use-translations.d.ts +17 -0
- package/dist/hooks/use-translations.d.ts.map +1 -1
- package/dist/index.css +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13689 -12344
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +24 -17
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/dom.d.ts +1 -0
- package/dist/lib/dom.d.ts.map +1 -1
- package/dist/lib/dom.js +20 -2
- package/dist/lib/fns.d.ts.map +1 -1
- package/dist/lib/fns.js +2 -2
- package/dist/preset/plugin.tailwind.d.ts +9 -0
- package/dist/preset/plugin.tailwind.d.ts.map +1 -0
- package/dist/preset/plugin.tailwind.js +27 -0
- package/dist/preset/preset.tailwind.d.ts +8 -0
- package/dist/preset/preset.tailwind.d.ts.map +1 -0
- package/dist/preset/preset.tailwind.js +54 -0
- package/dist/preset/src/styles/common.d.ts +2 -14
- package/dist/preset/src/styles/common.d.ts.map +1 -1
- package/dist/preset/src/styles/common.js +1 -0
- package/dist/preset/src/styles/dark.d.ts.map +1 -1
- package/dist/preset/src/styles/dark.js +119 -114
- package/dist/preset/src/styles/light.d.ts.map +1 -1
- package/dist/preset/src/styles/light.js +111 -106
- package/dist/preset/src/styles/theme.types.d.ts +17 -8
- package/dist/preset/src/styles/theme.types.d.ts.map +1 -1
- package/dist/styles/common.d.ts +2 -14
- package/dist/styles/common.d.ts.map +1 -1
- package/dist/styles/common.js +1 -0
- package/dist/styles/dark.d.ts.map +1 -1
- package/dist/styles/dark.js +119 -114
- package/dist/styles/light.d.ts.map +1 -1
- package/dist/styles/light.js +111 -106
- package/dist/styles/theme.types.d.ts +17 -8
- package/dist/styles/theme.types.d.ts.map +1 -1
- package/package.json +299 -301
- package/dist/preset/tailwindcssv4.d.ts +0 -3
- package/dist/preset/tailwindcssv4.d.ts.map +0 -1
- package/dist/preset/tailwindcssv4.js +0 -75
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
import { FloatingFocusManager, FloatingOverlay, FloatingPortal, useClick, useDismiss, useFloating, useInteractions, useRole, } from "@floating-ui/react";
|
|
3
3
|
import { cva } from "class-variance-authority";
|
|
4
4
|
import { XIcon } from "lucide-react";
|
|
5
|
-
import { motion, MotionConfig, useMotionValue, animate } from "motion/react";
|
|
5
|
+
import { AnimatePresence, motion, MotionConfig, useMotionValue, animate, } from "motion/react";
|
|
6
6
|
import { Slot } from "../core/slot";
|
|
7
|
-
import React, { forwardRef, Fragment, useEffect, useId, useImperativeHandle, useRef } from "react";
|
|
7
|
+
import React, { forwardRef, Fragment, useEffect, useId, useImperativeHandle, useRef, useState, useCallback, } from "react";
|
|
8
8
|
import { useMediaQuery } from "../../hooks/use-media-query";
|
|
9
9
|
import { css, mergeRefs } from "../../lib/dom";
|
|
10
10
|
import { useFloatingRef } from "../../hooks/use-floating-ref";
|
|
11
|
+
import { Button } from "../core/button";
|
|
12
|
+
const ConfirmContext = React.createContext(async () => false);
|
|
13
|
+
export const useConfirm = () => React.useContext(ConfirmContext);
|
|
11
14
|
const animationDuration = "500ms";
|
|
12
15
|
const drawerLeft = {
|
|
13
16
|
exit: { x: ["0%", "-30%"], opacity: 0, animationDuration },
|
|
@@ -76,13 +79,13 @@ const Draggable = (props) => {
|
|
|
76
79
|
return props.value.set(value);
|
|
77
80
|
}
|
|
78
81
|
};
|
|
79
|
-
return (<motion.button draggable dragListener dragMomentum type="button" animate={false} dragElastic={0} dragPropagation initial={false} onDrag={onDrag} dragSnapToOrigin dragDirectionLock drag={props.sheet ? "y" : "x"} dragConstraints={dragConstraints} whileDrag={{ cursor: "grabbing" }} className={css("absolute
|
|
82
|
+
return (<motion.button draggable dragListener dragMomentum type="button" animate={false} dragElastic={0} dragPropagation initial={false} onDrag={onDrag} dragSnapToOrigin dragDirectionLock drag={props.sheet ? "y" : "x"} dragConstraints={dragConstraints} whileDrag={{ cursor: "grabbing" }} className={css("absolute isolate z-calendar rounded-lg", props.sheet ? "cursor-row-resize" : "cursor-col-resize bg-floating-border", props.sheet
|
|
80
83
|
? "top-1 flex h-3 w-full justify-center py-2"
|
|
81
84
|
: props.position === "left"
|
|
82
85
|
? "right-5 top-1/2 h-10 w-2"
|
|
83
86
|
: "left-2 top-1/2 h-10 w-2")}>
|
|
84
|
-
|
|
85
|
-
|
|
87
|
+
{props.sheet ? <div className="h-2 w-1/4 rounded-lg bg-floating-border"/> : null}
|
|
88
|
+
</motion.button>);
|
|
86
89
|
};
|
|
87
90
|
const positions = { drawer: "right", sheet: "none", dialog: "none" };
|
|
88
91
|
const fetchPosition = (isDesktop, forceType, propsType, propsPosition) => {
|
|
@@ -126,7 +129,10 @@ export const Modal = forwardRef(({ open, title, footer, asChild, trigger, childr
|
|
|
126
129
|
sheetY.set(undefined);
|
|
127
130
|
}, [type, floatingSize, sheetY]);
|
|
128
131
|
const onClose = () => onChange(false);
|
|
129
|
-
useImperativeHandle(externalRef, () => ({ context: floating.context, floating: removeScrollRef.current }), [
|
|
132
|
+
useImperativeHandle(externalRef, () => ({ context: floating.context, floating: removeScrollRef.current }), [
|
|
133
|
+
floating.context,
|
|
134
|
+
removeScrollRef,
|
|
135
|
+
]);
|
|
130
136
|
const onDragHeader = (_, info) => {
|
|
131
137
|
const div = floating.refs.floating.current;
|
|
132
138
|
const rect = div.getBoundingClientRect();
|
|
@@ -142,33 +148,37 @@ export const Modal = forwardRef(({ open, title, footer, asChild, trigger, childr
|
|
|
142
148
|
onChange?.(false);
|
|
143
149
|
return setTimeout(() => floatingSize.set(undefined), 350);
|
|
144
150
|
};
|
|
145
|
-
const draggableMotionProps = type === "sheet"
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
151
|
+
const draggableMotionProps = type === "sheet"
|
|
152
|
+
? {
|
|
153
|
+
drag: "y",
|
|
154
|
+
animate: false,
|
|
155
|
+
dragElastic: 0,
|
|
156
|
+
initial: false,
|
|
157
|
+
dragConstraints,
|
|
158
|
+
draggable: true,
|
|
159
|
+
dragListener: true,
|
|
160
|
+
dragMomentum: true,
|
|
161
|
+
onDrag: onDragHeader,
|
|
162
|
+
dragPropagation: true,
|
|
163
|
+
dragSnapToOrigin: true,
|
|
164
|
+
dragDirectionLock: true,
|
|
165
|
+
whileDrag: { cursor: "grabbing" },
|
|
166
|
+
}
|
|
167
|
+
: { animate: animated, initial: false };
|
|
160
168
|
const scrollInitial = useMotionValue(undefined);
|
|
161
169
|
const scroll = useMotionValue(undefined);
|
|
162
170
|
const Component = asChild ? Slot : motion.button;
|
|
163
171
|
return (<Fragment>
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
+
{trigger ? (<Component ref={floating.refs.setReference} {...interactions.getReferenceProps()} layoutId={layoutId} type="button">
|
|
173
|
+
{Trigger}
|
|
174
|
+
</Component>) : null}
|
|
175
|
+
<MotionConfig reducedMotion={animated ? "user" : "always"}>
|
|
176
|
+
<FloatingPortal preserveTabOrder root={root}>
|
|
177
|
+
<AnimatePresence mode="wait" propagate>
|
|
178
|
+
{open ? (<FloatingOverlay lockScroll className={css("inset-0 isolate z-overlay flex h-[100dvh] !overflow-clip bg-floating-overlay/80", type === "drawer" ? "" : "items-start justify-center pt-10 lg:p-10", overlayClassName)}>
|
|
179
|
+
<FloatingFocusManager guards modal closeOnFocusOut={closeOnFocusOut} context={floating.context}>
|
|
180
|
+
<AnimatePresence propagate>
|
|
181
|
+
<motion.div {...props} {...(title
|
|
172
182
|
? {
|
|
173
183
|
"aria-labelledby": headingId,
|
|
174
184
|
"aria-describedby": descriptionId,
|
|
@@ -178,20 +188,21 @@ export const Modal = forwardRef(({ open, title, footer, asChild, trigger, childr
|
|
|
178
188
|
ref: mergeRefs(floating.refs.setFloating, removeScrollRef),
|
|
179
189
|
className: css(variants({ position, type }), className, "isolate overscroll-contain"),
|
|
180
190
|
})} exit="exit" layout={true} animate="enter" initial="initial" layoutId={layoutId} variants={animation} data-component="modal" style={type === "drawer" ? { width: floatingSize } : { height: floatingSize, y: sheetY }}>
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
191
|
+
{useResizer && resizer ? (<Draggable onChange={onChange} value={floatingSize} sheet={type === "sheet"} position={position} parent={floating.refs.floating}/>) : null}
|
|
192
|
+
{title ? (<motion.header {...draggableMotionProps} className="relative isolate w-full">
|
|
193
|
+
{title ? (<h2 id={headingId} className="block select-text border-b border-floating-border px-8 pb-2 text-3xl font-medium leading-relaxed">
|
|
194
|
+
{title}
|
|
195
|
+
</h2>) : null}
|
|
196
|
+
</motion.header>) : null}
|
|
197
|
+
<motion.section ref={innerContent} data-component="modal-body" className={css("flex-1 select-text overflow-y-auto px-8 py-1", bodyClassName)} onTouchEnd={async () => {
|
|
188
198
|
scroll.set(undefined);
|
|
189
199
|
scrollInitial.set(undefined);
|
|
190
200
|
if (isDragging.current) {
|
|
191
201
|
const currentY = sheetY.get() || 0;
|
|
192
202
|
const threshold = window.innerHeight * 0.2;
|
|
193
203
|
if (currentY > threshold) {
|
|
194
|
-
await animate(sheetY, window.innerHeight, { duration: 0.2, ease: "easeIn" })
|
|
204
|
+
await animate(sheetY, window.innerHeight, { duration: 0.2, ease: "easeIn" })
|
|
205
|
+
.finished;
|
|
195
206
|
onChange(false);
|
|
196
207
|
}
|
|
197
208
|
else {
|
|
@@ -224,18 +235,65 @@ export const Modal = forwardRef(({ open, title, footer, asChild, trigger, childr
|
|
|
224
235
|
}
|
|
225
236
|
scroll.set(y);
|
|
226
237
|
}}>
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
238
|
+
{children}
|
|
239
|
+
</motion.section>
|
|
240
|
+
{footer ? (<footer className="w-full select-text border-t border-floating-border px-8 pt-4">{footer}</footer>) : null}
|
|
241
|
+
{closable ? (<nav className="absolute right-4 top-1 z-floating">
|
|
242
|
+
<button type="button" onClick={onClose} className="p-1 opacity-70 transition-colors hover:text-danger hover:opacity-100 focus:text-danger">
|
|
243
|
+
<XIcon />
|
|
244
|
+
</button>
|
|
245
|
+
</nav>) : null}
|
|
246
|
+
</motion.div>
|
|
247
|
+
</AnimatePresence>
|
|
248
|
+
</FloatingFocusManager>
|
|
249
|
+
</FloatingOverlay>) : null}
|
|
250
|
+
</AnimatePresence>
|
|
251
|
+
</FloatingPortal>
|
|
252
|
+
</MotionConfig>
|
|
253
|
+
</Fragment>);
|
|
241
254
|
});
|
|
255
|
+
let confirmGlobal = async (options) => {
|
|
256
|
+
if (typeof window !== "undefined") {
|
|
257
|
+
console.warn("ConfirmationProvider is not mounted");
|
|
258
|
+
}
|
|
259
|
+
return false;
|
|
260
|
+
};
|
|
261
|
+
Modal.confirm = (options) => confirmGlobal(options);
|
|
262
|
+
export const ModalConfirmProvider = ({ children }) => {
|
|
263
|
+
const [open, setOpen] = useState(false);
|
|
264
|
+
const [options, setOptions] = useState({});
|
|
265
|
+
const [resolve, setResolve] = useState(() => { });
|
|
266
|
+
const confirmAction = useCallback((opts) => {
|
|
267
|
+
setOptions(opts);
|
|
268
|
+
setOpen(true);
|
|
269
|
+
return new Promise((res) => {
|
|
270
|
+
setResolve(() => res);
|
|
271
|
+
});
|
|
272
|
+
}, []);
|
|
273
|
+
useEffect(() => {
|
|
274
|
+
confirmGlobal = confirmAction;
|
|
275
|
+
}, [confirmAction]);
|
|
276
|
+
const onConfirm = () => {
|
|
277
|
+
setOpen(false);
|
|
278
|
+
const value = options.confirm?.value ?? true;
|
|
279
|
+
resolve(value ?? true);
|
|
280
|
+
};
|
|
281
|
+
const onCancel = () => {
|
|
282
|
+
setOpen(false);
|
|
283
|
+
const value = options.cancel?.value ?? false;
|
|
284
|
+
resolve(value ?? false);
|
|
285
|
+
};
|
|
286
|
+
return (<ConfirmContext.Provider value={confirmAction}>
|
|
287
|
+
{children}
|
|
288
|
+
<Modal open={open} type="dialog" closable={false} onChange={setOpen} overlayClickClose={false} title={options.title || "Confirmation"} className="container max-w-dialog lg:max-w-96" footer={<div className="flex justify-end gap-2">
|
|
289
|
+
<Button theme={options.cancel?.theme || "ghost-muted"} onClick={onCancel}>
|
|
290
|
+
{options.cancel?.text || "Cancel"}
|
|
291
|
+
</Button>
|
|
292
|
+
<Button theme={options.confirm?.theme || "primary"} onClick={onConfirm}>
|
|
293
|
+
{options.confirm?.text || "Confirm"}
|
|
294
|
+
</Button>
|
|
295
|
+
</div>}>
|
|
296
|
+
<div className="py-2 text-foreground">{options.description}</div>
|
|
297
|
+
</Modal>
|
|
298
|
+
</ConfirmContext.Provider>);
|
|
299
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/floating/tooltip.tsx"],"names":[],"mappings":"AACA,OAAO,EAQH,KAAK,SAAS,EAWjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAA4D,MAAM,OAAO,CAAC;AACjF,OAAO,EAAa,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAI9E,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEnD,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,MAAM,IAAI,gBAAgB,CAC7E;IACI,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;CACnC,EACD,CAAC,CACJ,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,CAAC,CAAC,SAAS,aAAa,GAAG,MAAM,EAAE,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/floating/tooltip.tsx"],"names":[],"mappings":"AACA,OAAO,EAQH,KAAK,SAAS,EAWjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAA4D,MAAM,OAAO,CAAC;AACjF,OAAO,EAAa,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAI9E,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEnD,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,MAAM,IAAI,gBAAgB,CAC7E;IACI,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;CACnC,EACD,CAAC,CACJ,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,CAAC,CAAC,SAAS,aAAa,GAAG,MAAM,EAAE,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,YAmF9E,CAAC"}
|
|
@@ -18,13 +18,7 @@ export const Tooltip = forwardRef(function Tooltip({ as, open, title, children,
|
|
|
18
18
|
open: innerOpen,
|
|
19
19
|
whileElementsMounted: autoUpdate,
|
|
20
20
|
onOpenChange: open ? undefined : toggleBoth,
|
|
21
|
-
middleware: [
|
|
22
|
-
shift(),
|
|
23
|
-
offset(5),
|
|
24
|
-
autoPlacement(),
|
|
25
|
-
arrow({ padding: 5, element: arrowRef }),
|
|
26
|
-
flip({ fallbackAxisSideDirection: "start" }),
|
|
27
|
-
],
|
|
21
|
+
middleware: [shift(), offset(5), autoPlacement(), arrow({ padding: 5, element: arrowRef }), flip({ fallbackAxisSideDirection: "start" })],
|
|
28
22
|
});
|
|
29
23
|
const dismiss = useDismiss(context, { enabled });
|
|
30
24
|
const role = useRole(context, { role: "tooltip", enabled });
|
|
@@ -55,7 +49,7 @@ export const Tooltip = forwardRef(function Tooltip({ as, open, title, children,
|
|
|
55
49
|
{title}
|
|
56
50
|
</Component>
|
|
57
51
|
{innerOpen && (<FloatingPortal>
|
|
58
|
-
<Polymorph {...getFloatingProps()} ref={refs.setFloating} style={floatingStyles} className="
|
|
52
|
+
<Polymorph {...getFloatingProps()} ref={refs.setFloating} style={floatingStyles} className="isolate z-tooltip rounded-lg border border-tooltip-border bg-tooltip-background p-3 text-tooltip-foreground shadow-shadow-floating">
|
|
59
53
|
<FloatingArrow ref={arrowRef} context={context} strokeWidth={0.1} className="fill-tooltip-background stroke-tooltip-border"/>
|
|
60
54
|
{children}
|
|
61
55
|
</Polymorph>
|
|
@@ -22,5 +22,5 @@ export type WizardProps = {
|
|
|
22
22
|
previous?: string;
|
|
23
23
|
};
|
|
24
24
|
};
|
|
25
|
-
export declare const Wizard: ({ steps, active, onClose, onFinish, onChange, labels: labelsProp
|
|
25
|
+
export declare const Wizard: ({ steps, active, onClose, onFinish, onChange, labels: labelsProp }: WizardProps) => React.JSX.Element | null;
|
|
26
26
|
//# sourceMappingURL=wizard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wizard.d.ts","sourceRoot":"","sources":["../../../src/components/floating/wizard.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"wizard.d.ts","sourceRoot":"","sources":["../../../src/components/floating/wizard.tsx"],"names":[],"mappings":"AACA,OAAO,EAOH,SAAS,EAKZ,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAgF,MAAM,OAAO,CAAC;AAOrG,MAAM,MAAM,UAAU,GAAG;IACrB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,OAAO,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;CAC/D,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,MAAM,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACjF,CAAC;AAiBF,eAAO,MAAM,MAAM,GAAI,oEAAiG,WAAW,6BAgLlI,CAAC"}
|
|
@@ -13,15 +13,15 @@ const getRect = (element) => {
|
|
|
13
13
|
return element.getBoundingClientRect();
|
|
14
14
|
};
|
|
15
15
|
const resolveElement = (element) => {
|
|
16
|
-
if (typeof element ===
|
|
16
|
+
if (typeof element === "string") {
|
|
17
17
|
return document.querySelector(element);
|
|
18
18
|
}
|
|
19
|
-
if (
|
|
19
|
+
if ("current" in element) {
|
|
20
20
|
return element.current;
|
|
21
21
|
}
|
|
22
22
|
return element;
|
|
23
23
|
};
|
|
24
|
-
export const Wizard = ({ steps, active = false, onClose = noop, onFinish = noop, onChange = noop, labels: labelsProp
|
|
24
|
+
export const Wizard = ({ steps, active = false, onClose = noop, onFinish = noop, onChange = noop, labels: labelsProp }) => {
|
|
25
25
|
const translation = useTranslations();
|
|
26
26
|
const [index, setIndex] = useState(0);
|
|
27
27
|
const currentStep = steps[index];
|
|
@@ -40,14 +40,9 @@ export const Wizard = ({ steps, active = false, onClose = noop, onFinish = noop,
|
|
|
40
40
|
open: active && isOverlayReady,
|
|
41
41
|
placement: currentStep?.side || "bottom",
|
|
42
42
|
whileElementsMounted: autoUpdate,
|
|
43
|
-
middleware: [
|
|
44
|
-
offset(10),
|
|
45
|
-
flip(),
|
|
46
|
-
shift(),
|
|
47
|
-
arrow({ element: arrowRef }),
|
|
48
|
-
],
|
|
43
|
+
middleware: [offset(10), flip(), shift(), arrow({ element: arrowRef })],
|
|
49
44
|
});
|
|
50
|
-
const { getFloatingProps } = useInteractions([useRole(context)
|
|
45
|
+
const { getFloatingProps } = useInteractions([useRole(context)]);
|
|
51
46
|
useEffect(() => {
|
|
52
47
|
if (active) {
|
|
53
48
|
setIndex(0);
|
|
@@ -114,51 +109,53 @@ export const Wizard = ({ steps, active = false, onClose = noop, onFinish = noop,
|
|
|
114
109
|
const hasNext = index < steps.length - 1;
|
|
115
110
|
const hasPrevious = index > 0;
|
|
116
111
|
return (<FloatingPortal>
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
112
|
+
<div className="pointer-events-none fixed inset-0 z-wizard">
|
|
113
|
+
<svg className="absolute inset-0 h-full w-full fill-current text-floating-overlay/70" xmlns="http://www.w3.org/2000/svg">
|
|
114
|
+
<defs>
|
|
115
|
+
<mask id="driver-mask">
|
|
116
|
+
<rect x="0" y="0" width="100%" height="100%" fill="white"/>
|
|
117
|
+
<motion.rect rx="4" fill="black" initial={false} onAnimationComplete={() => setIsOverlayReady(true)} transition={{ type: "spring", duration: 0.5, ease: "easeInOut" }} animate={{
|
|
123
118
|
x: rect.left - 5,
|
|
124
119
|
y: rect.top - 5,
|
|
125
120
|
width: rect.width + 10,
|
|
126
|
-
height: rect.height + 10
|
|
121
|
+
height: rect.height + 10,
|
|
127
122
|
}}/>
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
123
|
+
</mask>
|
|
124
|
+
</defs>
|
|
125
|
+
<rect x="0" y="0" width="100%" height="100%" mask="url(#driver-mask)" className="pointer-events-auto"/>
|
|
126
|
+
</svg>
|
|
127
|
+
<AnimatePresence mode="wait">
|
|
128
|
+
{currentStep && isOverlayReady && (<div {...getFloatingProps()} ref={refs.setFloating} style={element
|
|
129
|
+
? floatingStyles
|
|
130
|
+
: {
|
|
131
|
+
position: "fixed",
|
|
132
|
+
top: "50%",
|
|
133
|
+
left: "50%",
|
|
134
|
+
transform: "translate(-50%, -50%)",
|
|
135
|
+
}} className="pointer-events-auto outline-none">
|
|
136
|
+
<motion.div transition={{ duration: 0.2 }} exit={{ opacity: 0, scale: 0.9 }} animate={{ opacity: 1, scale: 1 }} initial={{ opacity: 0, scale: 0.9 }} className="flex w-80 max-w-sm flex-col gap-3 rounded-lg border border-floating-border bg-floating-background p-4 shadow-lg">
|
|
137
|
+
{element && (<FloatingArrow ref={arrowRef} context={context} className="fill-floating-background stroke-floating-border"/>)}
|
|
138
|
+
{currentStep.title && <h3>{currentStep.title}</h3>}
|
|
139
|
+
{currentStep.description && <Fragment>{currentStep.description}</Fragment>}
|
|
140
|
+
<div className="mt-2 flex items-center justify-between border-t border-floating-border pt-2">
|
|
141
|
+
<Button theme="raw" size="small" onClick={onClose} className="text-xs text-muted-foreground hover:text-foreground">
|
|
142
|
+
{labels.skip}
|
|
143
|
+
</Button>
|
|
144
|
+
<div className="flex gap-2">
|
|
145
|
+
{hasPrevious && (<Button size="small" theme="ghost-muted" onClick={handlePrevious}>
|
|
146
|
+
{labels.previous}
|
|
147
|
+
</Button>)}
|
|
148
|
+
<Button size="small" onClick={handleNext}>
|
|
149
|
+
{hasNext ? labels.next : labels.finish}
|
|
150
|
+
</Button>
|
|
151
|
+
</div>
|
|
152
|
+
</div>
|
|
153
|
+
<div className="absolute right-2 top-2 text-xs text-muted-foreground">
|
|
154
|
+
{index + 1} / {steps.length}
|
|
155
|
+
</div>
|
|
156
|
+
</motion.div>
|
|
157
|
+
</div>)}
|
|
158
|
+
</AnimatePresence>
|
|
159
|
+
</div>
|
|
160
|
+
</FloatingPortal>);
|
|
164
161
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete.d.ts","sourceRoot":"","sources":["../../../src/components/form/autocomplete.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAoF,MAAM,OAAO,CAAC;AASzG,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAc,eAAe,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,MAAM,MAAM,qBAAqB,GAAG,WAAW,GAAG;IAAE,MAAM,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,CAAA;CAAE,CAAC;AAErF,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,GAAG;
|
|
1
|
+
{"version":3,"file":"autocomplete.d.ts","sourceRoot":"","sources":["../../../src/components/form/autocomplete.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAoF,MAAM,OAAO,CAAC;AASzG,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAc,eAAe,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,MAAM,MAAM,qBAAqB,GAAG,WAAW,GAAG;IAAE,MAAM,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,CAAA;CAAE,CAAC;AAErF,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,GAAG;IACtE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,EAAE,qBAAqB,EAAE,CAAC;CACpC,CAAC;AA6BF,eAAO,MAAM,YAAY,yGA+WxB,CAAC"}
|
|
@@ -15,15 +15,15 @@ import { InputField } from "./input-field";
|
|
|
15
15
|
const Frag = (props) => <Fragment>{props.children}</Fragment>;
|
|
16
16
|
const transitionStyles = {
|
|
17
17
|
duration: 200,
|
|
18
|
-
initial: { transform: "scaleY(0)", opacity: 0.2 },
|
|
19
18
|
open: { transform: "scaleY(1)", opacity: 1 },
|
|
20
19
|
close: { transform: "scaleY(0)", opacity: 0 },
|
|
20
|
+
initial: { transform: "scaleY(0)", opacity: 0.2 },
|
|
21
21
|
};
|
|
22
22
|
const emptyRef = [];
|
|
23
23
|
const List = forwardRef(function VirtualList(props, ref) {
|
|
24
|
-
return (<motion.ul {...props} ref={ref} className="
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
return (<motion.ul {...props} ref={ref} className="max-h-96 w-full overscroll-contain rounded-lg">
|
|
25
|
+
<AnimatePresence>{props.children}</AnimatePresence>
|
|
26
|
+
</motion.ul>);
|
|
27
27
|
});
|
|
28
28
|
const Item = forwardRef(function VirtualItem({ item, context, ...props }, ref) {
|
|
29
29
|
return <motion.li {...props} ref={ref} className="first:rounded-t-lg last:rounded-t-lg"/>;
|
|
@@ -56,7 +56,10 @@ export const Autocomplete = forwardRef(({ left, error, right, loading, options,
|
|
|
56
56
|
: options;
|
|
57
57
|
const openDropdown = () => flushSync(() => setOpen(true));
|
|
58
58
|
const list = shadow
|
|
59
|
-
? fzf(innerOptions, "value", [
|
|
59
|
+
? fzf(innerOptions, "value", [
|
|
60
|
+
{ key: "value", value: shadow },
|
|
61
|
+
{ key: "label", value: shadow },
|
|
62
|
+
])
|
|
60
63
|
: innerOptions;
|
|
61
64
|
const setClosed = () => {
|
|
62
65
|
setOpen(false);
|
|
@@ -70,10 +73,11 @@ export const Autocomplete = forwardRef(({ left, error, right, loading, options,
|
|
|
70
73
|
open,
|
|
71
74
|
transform: true,
|
|
72
75
|
onOpenChange: setOpen,
|
|
76
|
+
placement: "bottom-start",
|
|
73
77
|
whileElementsMounted: autoUpdate,
|
|
74
78
|
middleware: [
|
|
75
79
|
offset(4),
|
|
76
|
-
autoPlacement({ allowedPlacements: [
|
|
80
|
+
autoPlacement({ allowedPlacements: ["top-start", "bottom-start"], alignment: "start" }),
|
|
77
81
|
size({
|
|
78
82
|
padding: 10,
|
|
79
83
|
elementContext: "reference",
|
|
@@ -83,7 +87,7 @@ export const Autocomplete = forwardRef(({ left, error, right, loading, options,
|
|
|
83
87
|
const DEFAULT_SIZE = getRemainingSize(refs.reference.current, window.innerHeight);
|
|
84
88
|
const maxH = Math.min(fullSize < MIN_SIZE ? DEFAULT_SIZE : fullSize, DEFAULT_SIZE, args.availableHeight);
|
|
85
89
|
const size = displayList.length === 0 ? MIN_SIZE : Math.min(maxH, DEFAULT_SIZE, fullSize);
|
|
86
|
-
const mw = `${fieldset.current
|
|
90
|
+
const mw = `${fieldset.current?.getBoundingClientRect().width || DEFAULT_SIZE}px`;
|
|
87
91
|
Object.assign(args.elements.floating.style, { width: mw, maxWidth: mw, height: size });
|
|
88
92
|
},
|
|
89
93
|
}),
|
|
@@ -176,19 +180,19 @@ export const Autocomplete = forwardRef(({ left, error, right, loading, options,
|
|
|
176
180
|
const shadowId = `${id}-shadow`;
|
|
177
181
|
const isEmpty = displayList.length === 0;
|
|
178
182
|
const isTopPlacement = placement === "top" || placement === "top-start";
|
|
179
|
-
return (<InputField {...props} left={left} error={error} ref={fieldset} form={props.form} loading={loading} name={props.name} feedback={open &&
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
183
|
+
return (<InputField {...props} left={left} error={error} ref={fieldset} form={props.form} loading={loading} name={props.name} feedback={open && isTopPlacement ? props.title : feedback} hideLeft={hideLeft} required={required} title={props.title} container={container} rightLabel={rightLabel} interactive={interactive} id={shadowId} optionalText={optionalText} componentName="autocomplete" labelClassName={labelClassName} placeholder={props.placeholder} right={<span className="flex items-center gap-0.5">
|
|
184
|
+
{right}
|
|
185
|
+
<button type="button" className="p-2 transition-colors link:text-primary md:p-1" onClick={onCaretDownClick}>
|
|
186
|
+
<ChevronDown size={20}/>
|
|
187
|
+
<span className="sr-only">{translation.inputCaretDown}</span>
|
|
188
|
+
</button>
|
|
189
|
+
{value ? (<button type="button" onClick={onClose} className="p-2 transition-colors link:text-danger md:p-1">
|
|
190
|
+
<svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
191
|
+
<path d="M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z" fill="currentColor" fillRule="evenodd" clipRule="evenodd"/>
|
|
192
|
+
</svg>
|
|
193
|
+
</button>) : null}
|
|
194
|
+
</span>}>
|
|
195
|
+
<input data-shadow="true" {...getReferenceProps({
|
|
192
196
|
...props,
|
|
193
197
|
onFocus,
|
|
194
198
|
pattern,
|
|
@@ -229,14 +233,14 @@ export const Autocomplete = forwardRef(({ left, error, right, loading, options,
|
|
|
229
233
|
}
|
|
230
234
|
}
|
|
231
235
|
},
|
|
232
|
-
})} data-value={value} data-error={!!error} data-name={id} data-target={id} required={required} value={open ? shadow : options.length === 0 ? "" : label || value} aria-autocomplete="list" autoComplete="off" className={css("input placeholder-input-mask group h-input-height w-full flex-1", "rounded-md bg-transparent px-input-x py-input-y text-foreground", "outline-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
236
|
+
})} data-value={value} data-error={!!error} data-name={id} data-target={id} required={required} value={open ? shadow : options.length === 0 ? "" : label || value} aria-autocomplete="list" autoComplete="off" className={css("input placeholder-input-mask group h-input-height w-full flex-1", "rounded-md bg-transparent px-input-x py-input-y text-foreground", "outline-none transition-colors focus:ring-2 focus:ring-inset focus:ring-primary", "group-error:text-danger group-error:placeholder-input-mask-error", "text-base group-focus-within:border-primary group-hover:border-primary", props.className)}/>
|
|
237
|
+
<input id={id} name={id} type="hidden" data-origin={id} ref={externalRef} required={required} defaultValue={props.value || value || undefined}/>
|
|
238
|
+
<FloatingPortal preserveTabOrder>
|
|
239
|
+
{open ? (<FloatingFocusManager modal guards returnFocus={false} context={context} initialFocus={-1} visuallyHiddenDismiss>
|
|
240
|
+
<motion.div {...getFloatingProps({
|
|
237
241
|
ref: mergeRefs(removeScrollRef, refs.setFloating),
|
|
238
242
|
style: { ...transitions.styles, left: x, top: y ?? 0, position: strategy, height: "auto" },
|
|
239
|
-
})} initial={false} data-floating="true" animate={{ height: isEmpty ? "auto" : h }} className={css("
|
|
243
|
+
})} initial={false} data-floating="true" animate={{ height: isEmpty ? "auto" : h }} className={css("shadow-floating isolate z-floating m-0 max-h-80 origin-[top_center] list-none overscroll-contain rounded-b-lg rounded-t-lg border border-floating-border bg-floating-background p-0 text-foreground ease-in-out", isTopPlacement ? "origin-[bottom_center]" : "origin-[top_center]")} onAnimationComplete={() => {
|
|
240
244
|
if (!open)
|
|
241
245
|
return setH(0);
|
|
242
246
|
const ul = refs.floating.current;
|
|
@@ -244,12 +248,12 @@ export const Autocomplete = forwardRef(({ left, error, right, loading, options,
|
|
|
244
248
|
const sum = (li ? li.getBoundingClientRect().height : MIN_SIZE) * displayList.length;
|
|
245
249
|
return flushSync(() => setH(sum + 2));
|
|
246
250
|
}}>
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
251
|
+
{isEmpty ? (<div role="option" className="w-full border-b border-tooltip-border">
|
|
252
|
+
<span className="flex w-full justify-between p-2 text-left text-disabled">
|
|
253
|
+
{emptyMessage || translation.autocompleteEmpty}
|
|
254
|
+
</span>
|
|
255
|
+
</div>) : null}
|
|
256
|
+
<Virtuoso overscan={40} ref={virtuoso} hidden={isEmpty} data={displayList} style={{ height: h }} defaultItemHeight={MIN_SIZE} components={components} scrollerRef={(e) => void (scroller.current = e)} className="border-floating max-h-full overscroll-contain rounded-lg bg-floating-background p-0 text-foreground" itemContent={(i, option) => {
|
|
253
257
|
const Label = option.Render ?? Frag;
|
|
254
258
|
const active = value === option.value || value === option.label;
|
|
255
259
|
const selected = index === i;
|
|
@@ -265,11 +269,11 @@ export const Autocomplete = forwardRef(({ left, error, right, loading, options,
|
|
|
265
269
|
onClick: () => onSelect(option, i),
|
|
266
270
|
className: `cursor-pointer min-h-10 hover:bg-floating-hover w-full p-2 text-left ${active ? "bg-primary-hover text-primary-foreground" : ""} ${selected ? "bg-floating-hover text-floating-foreground" : ""}`,
|
|
267
271
|
})}>
|
|
268
|
-
|
|
269
|
-
|
|
272
|
+
<Label {...props} label={option.label} value={option.value} children={children}/>
|
|
273
|
+
</button>);
|
|
270
274
|
}}/>
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
+
</motion.div>
|
|
276
|
+
</FloatingFocusManager>) : null}
|
|
277
|
+
</FloatingPortal>
|
|
278
|
+
</InputField>);
|
|
275
279
|
});
|
|
@@ -3,10 +3,10 @@ import { css } from "../../lib/dom";
|
|
|
3
3
|
export const Checkbox = forwardRef(({ children, asTask = false, labelClassName, loading, error, className = "", size, container, ...props }, ref) => {
|
|
4
4
|
const d = props.disabled || loading;
|
|
5
5
|
return (<label aria-disabled={d} data-disabled={d} data-task={asTask} data-component="checkbox" className={css("group flex w-fit flex-wrap items-center font-normal data-[disabled=true]:cursor-not-allowed", asTask ? "group-checkbox-checked:line-through" : "", container)}>
|
|
6
|
-
<input {...props} ref={ref} disabled={d} type="checkbox" data-task={asTask} className={css("form-checkbox mr-2 inline-block size-4 appearance-none rounded
|
|
6
|
+
<input {...props} ref={ref} disabled={d} type="checkbox" data-task={asTask} className={css("form-checkbox mr-2 inline-block size-4 appearance-none rounded border-card-border bg-origin-border text-primary focus:ring-primary disabled:opacity-70 group-aria-disabled:cursor-not-allowed", className)}/>
|
|
7
7
|
{children}
|
|
8
8
|
<span data-name="checkbox-label" className={css("min-w-full flex-1 text-xs text-danger empty:mt-0 empty:hidden", labelClassName)}>
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
{error}
|
|
10
|
+
</span>
|
|
11
11
|
</label>);
|
|
12
12
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../../src/components/form/date-picker.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAoE,MAAM,OAAO,CAAC;AAIzF,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAY,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAE9D,OAAO,EAAS,UAAU,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,MAAM,eAAe,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../../src/components/form/date-picker.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAoE,MAAM,OAAO,CAAC;AAIzF,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAY,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAE9D,OAAO,EAAS,UAAU,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,MAAM,eAAe,GAAG,IAAI,CAC9B,QAAQ,CACJ,UAAU,EACV,aAAa,GAAG;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B,CACJ,EACD,UAAU,CACb,CAAC;AAkDF,eAAO,MAAM,UAAU,uGAoItB,CAAC"}
|