@g4rcez/components 2.2.9 → 2.3.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.map +1 -1
- 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.jsx +1 -1
- 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 +22 -24
- package/dist/components/display/calendar.d.ts.map +1 -1
- package/dist/components/display/calendar.jsx +5 -7
- package/dist/components/display/card.d.ts.map +1 -1
- package/dist/components/display/card.jsx +5 -5
- package/dist/components/display/empty.jsx +1 -1
- package/dist/components/display/notifications.d.ts.map +1 -1
- package/dist/components/display/notifications.jsx +35 -35
- package/dist/components/display/progress.d.ts.map +1 -1
- package/dist/components/display/progress.jsx +6 -8
- 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/floating/command-palette.d.ts.map +1 -1
- package/dist/components/floating/command-palette.jsx +40 -40
- package/dist/components/floating/dropdown.d.ts.map +1 -1
- package/dist/components/floating/dropdown.jsx +15 -15
- package/dist/components/floating/modal.d.ts.map +1 -1
- package/dist/components/floating/modal.jsx +73 -67
- 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 +38 -35
- package/dist/components/form/checkbox.jsx +2 -2
- 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 +2 -2
- package/dist/components/form/input-field.d.ts.map +1 -1
- package/dist/components/form/input-field.jsx +42 -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 +13 -13
- package/dist/components/form/slider.d.ts.map +1 -1
- package/dist/components/form/slider.jsx +10 -10
- package/dist/components/form/transfer-list.jsx +3 -3
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -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 +84 -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 +23 -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 +39 -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 +61 -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 +5 -5
- package/dist/config/context.d.ts.map +1 -1
- package/dist/config/default-translations.d.ts +10 -0
- package/dist/config/default-translations.d.ts.map +1 -1
- package/dist/config/default-translations.jsx +11 -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 +2 -2
- package/dist/hooks/use-form.d.ts.map +1 -1
- 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-resize-observer.d.ts.map +1 -1
- package/dist/hooks/use-translations.d.ts +10 -0
- package/dist/hooks/use-translations.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10121 -9704
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +14 -14
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/dom.d.ts.map +1 -1
- package/dist/lib/fns.d.ts.map +1 -1
- package/dist/lib/fns.js +2 -2
- package/dist/preset/src/styles/theme.types.d.ts.map +1 -1
- package/dist/styles/theme.types.d.ts.map +1 -1
- package/package.json +289 -289
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../../src/components/display/step.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAA2C,iBAAiB,EAA2C,MAAM,OAAO,CAAC;AAEnI,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAMpC,KAAK,gBAAgB,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,mBAAmB,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AA+BlH,KAAK,UAAU,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,CAAC;AAE/D,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,GAAG;
|
|
1
|
+
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../../src/components/display/step.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAA2C,iBAAiB,EAA2C,MAAM,OAAO,CAAC;AAEnI,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAMpC,KAAK,gBAAgB,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,mBAAmB,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AA+BlH,KAAK,UAAU,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,CAAC;AAE/D,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,GAAG;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AA2BF,eAAO,MAAM,cAAc,+BAAgC,CAAC;AAE5D,eAAO,MAAM,IAAI,GAAI,gEAAgE,SAAS,sBA6F7F,CAAC;AAEF,eAAO,MAAM,KAAK,GAAI,OAAO,iBAAiB,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,sBA0BrF,CAAC"}
|
|
@@ -11,17 +11,17 @@ const states = {
|
|
|
11
11
|
animate: { pathLength: 1, opacity: 1 },
|
|
12
12
|
};
|
|
13
13
|
const ErrorIcon = (props) => (<svg {...props} viewBox="0 0 24 24" fill="currentColor" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
<motion.path className="currentColor" initial={states.initial} animate={states.animate} transition={iconTransitions} d="M18 6 6 18"/>
|
|
15
|
+
<motion.path className="currentColor" initial={states.initial} animate={states.animate} transition={iconTransitions} d="m6 6 12 12"/>
|
|
16
|
+
</svg>);
|
|
17
17
|
const CheckIcon = (props) => (<svg {...props} fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={3}>
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
<motion.path d="M5 13l4 4L19 7" strokeLinecap="round" strokeLinejoin="round" animate={states.animate} initial={states.initial} transition={iconTransitions}/>
|
|
19
|
+
</svg>);
|
|
20
20
|
const variants = {
|
|
21
21
|
complete: { scale: 1.25 },
|
|
22
|
-
active: { scale: 1, transition: { delay: 0, duration: 0.3 } }
|
|
22
|
+
active: { scale: 1, transition: { delay: 0, duration: 0.3 } },
|
|
23
23
|
};
|
|
24
|
-
const transitions = { duration: 0.6, delay: 0.2, type: "tween", ease: "circOut"
|
|
24
|
+
const transitions = { duration: 0.6, delay: 0.2, type: "tween", ease: "circOut" };
|
|
25
25
|
const getCurrentStatus = (step, currentStep, status) => {
|
|
26
26
|
if (status === "error")
|
|
27
27
|
return "error";
|
|
@@ -65,12 +65,12 @@ export const Step = ({ step, currentStep, status, title, titleClassName, ...prop
|
|
|
65
65
|
return () => clearTimeout(timer);
|
|
66
66
|
}, [currentStep, context, step]);
|
|
67
67
|
const innerStatus = getCurrentStatus(step, visualCurrentStep, status);
|
|
68
|
-
const widthPerStep = context?.steps ? 100 /
|
|
68
|
+
const widthPerStep = context?.steps ? 100 / context?.steps : undefined;
|
|
69
69
|
return (<Fragment>
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
<div className={`hidden h-[2px] w-full bg-card-border first:hidden xl:block ${innerStatus === "active" || innerStatus === "complete" ? "bg-success" : ""}`}/>
|
|
71
|
+
<motion.button {...props} type="button" data-step={step} animate={innerStatus} className="relative flex w-auto items-center justify-center text-center">
|
|
72
|
+
<motion.div variants={variants} transition={transitions} className={`absolute inset-0 hidden rounded-full text-center xl:block ${innerStatus === "error" ? "bg-danger" : ""}`}/>
|
|
73
|
+
<motion.div initial={false} animate={innerStatus} transition={transition} className="relative flex aspect-square size-10 items-center justify-center rounded-full font-semibold" variants={{
|
|
74
74
|
error: {
|
|
75
75
|
color: parser("var(--danger-foreground)"),
|
|
76
76
|
borderColor: parser("var(--danger-hover)"),
|
|
@@ -95,17 +95,17 @@ export const Step = ({ step, currentStep, status, title, titleClassName, ...prop
|
|
|
95
95
|
backgroundColor: parser("var(--success-DEFAULT)"),
|
|
96
96
|
},
|
|
97
97
|
}}>
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
98
|
+
<div className="flex items-center justify-center">
|
|
99
|
+
{innerStatus === "complete" ? (<CheckIcon className="size-6 text-primary-foreground"/>) : innerStatus === "error" ? (<ErrorIcon className="size-6 text-danger-foreground"/>) : (<Fragment>
|
|
100
|
+
<span>{step}</span>
|
|
101
|
+
</Fragment>)}
|
|
102
|
+
</div>
|
|
103
|
+
</motion.div>
|
|
104
|
+
<header className="flex flex-col items-start justify-start px-2">
|
|
105
|
+
<h3 className={`flex h-full items-center whitespace-nowrap ${titleClassName}`}>{title}</h3>
|
|
106
|
+
</header>
|
|
107
|
+
</motion.button>
|
|
108
|
+
</Fragment>);
|
|
109
109
|
};
|
|
110
110
|
export const Steps = (props) => {
|
|
111
111
|
const previousStepRef = useRef(props.currentStep);
|
|
@@ -124,8 +124,8 @@ export const Steps = (props) => {
|
|
|
124
124
|
steps: React.Children.count(props.children),
|
|
125
125
|
};
|
|
126
126
|
return (<StepContext.Provider value={contextValue}>
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
<div className="relative flex w-full flex-col items-start justify-center gap-4 lg:flex-row lg:items-center lg:justify-between">
|
|
128
|
+
{props.children}
|
|
129
|
+
</div>
|
|
130
|
+
</StepContext.Provider>);
|
|
131
131
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../../src/components/display/tabs.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAA2B,iBAAiB,EAAiC,MAAM,OAAO,CAAC;AAMzG,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAQ,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEzC,MAAM,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IACzD,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC,CAAC;
|
|
1
|
+
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../../src/components/display/tabs.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAA2B,iBAAiB,EAAiC,MAAM,OAAO,CAAC;AAMzG,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAQ,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEzC,MAAM,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IACzD,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC,CAAC;AA+BF,eAAO,MAAM,IAAI,GAAI,OAAO,iBAAiB,CAAC,SAAS,CAAC,sBAsFvD,CAAC;AAIF,KAAK,cAAc,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEzD,MAAM,MAAM,QAAQ,GAAG,cAAc,GACjC,CACM;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAA;CAAE,GACpC;IACI,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;CAC9B,CACN,CAAC;AAEN,eAAO,MAAM,GAAG,GAAI,OAAO,iBAAiB,CAAC,QAAQ,CAAC,sBAGrD,CAAC"}
|
|
@@ -17,9 +17,7 @@ const getNElement = (elements, currentIndex, direction) => {
|
|
|
17
17
|
if (!isElementDisabled(element))
|
|
18
18
|
return element;
|
|
19
19
|
}
|
|
20
|
-
return direction === "backward"
|
|
21
|
-
? getNElement(elements, elements.length - 1, "backward")
|
|
22
|
-
: getNElement(elements, -1, "forward");
|
|
20
|
+
return direction === "backward" ? getNElement(elements, elements.length - 1, "backward") : getNElement(elements, -1, "forward");
|
|
23
21
|
};
|
|
24
22
|
const moveOn = (ul, direction) => {
|
|
25
23
|
const items = Array.from(ul.querySelectorAll("li"));
|
|
@@ -73,15 +71,15 @@ export const Tabs = (props) => {
|
|
|
73
71
|
}
|
|
74
72
|
};
|
|
75
73
|
return (<Context.Provider value={active}>
|
|
76
|
-
<Card className={props.className} container={css("pt-0 max-w-full w-full min-w-0", props.container)} header={<header className="overflow-x-auto
|
|
77
|
-
<div className="absolute bottom-0
|
|
74
|
+
<Card className={props.className} container={css("pt-0 max-w-full w-full min-w-0", props.container)} header={<header className="relative mb-2 overflow-x-auto">
|
|
75
|
+
<div className="absolute bottom-0 h-[1px] w-full bg-card-border"/>
|
|
78
76
|
<nav className="min-w-0">
|
|
79
|
-
<ul onKeyDown={onKeyDown} ref={ref} className="flex
|
|
77
|
+
<ul onKeyDown={onKeyDown} ref={ref} className="flex w-0 min-w-full flex-1 justify-start overflow-x-auto">
|
|
80
78
|
{items.map((x) => {
|
|
81
79
|
const inner = x.props;
|
|
82
80
|
const current = active === inner.id;
|
|
83
81
|
return (<li data-id={inner.id} data-active={current} key={`tab-header-${inner.id}`} aria-disabled={inner.disabled} className={css("relative w-fit border-b border-transparent transition-all", current ? "border-primary font-medium text-primary" : "", inner.disabled ? "aria-disabled:text-disabled" : "")}>
|
|
84
|
-
<Polymorph as="button" type="button" data-id={inner.id} aria-current="page" disabled={inner.disabled} onClick={inner.disabled ? undefined : onClick} className="block
|
|
82
|
+
<Polymorph as="button" type="button" data-id={inner.id} aria-current="page" disabled={inner.disabled} onClick={inner.disabled ? undefined : onClick} className="block w-full whitespace-nowrap px-10 py-4 disabled:cursor-not-allowed">
|
|
85
83
|
{inner.title}
|
|
86
84
|
</Polymorph>
|
|
87
85
|
</li>);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-palette.d.ts","sourceRoot":"","sources":["../../../src/components/floating/command-palette.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAc,WAAW,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAmE,MAAM,OAAO,CAAC;AAQxF,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAKpC,KAAK,SAAS,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAElC,KAAK,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,IAAI,CAAC,GAAG;
|
|
1
|
+
{"version":3,"file":"command-palette.d.ts","sourceRoot":"","sources":["../../../src/components/floating/command-palette.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAc,WAAW,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAmE,MAAM,OAAO,CAAC;AAQxF,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAKpC,KAAK,SAAS,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAElC,KAAK,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,IAAI,CAAC,GAAG;IACvD,IAAI,EAAE,CAAC,CAAC;IACR,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,IAAI,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IAC1B,OAAO,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,SAAS,KAAK,OAAO,CAAC,GAAG,OAAO,CAAC;CACvD,CAAC;AAEF,KAAK,IAAI,GAAG,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,SAAS,KAAK,MAAM,CAAC,CAAC;AAEpD,KAAK,mBAAmB,GAAG,WAAW,CAClC,UAAU,EACV;IACI,KAAK,EAAE,IAAI,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,CAAC,IAA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c,GAAI,OAAO,mBAAmB,sBA0LxD,CAAC"}
|
|
@@ -12,26 +12,26 @@ import { fzf } from "../../lib/fzf";
|
|
|
12
12
|
import { Shortcut } from "../display/shortcut";
|
|
13
13
|
import { SkeletonCell } from "../display/skeleton";
|
|
14
14
|
import { Modal } from "./modal";
|
|
15
|
-
const Group = (props) => (<span className="flex items-center
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
const Group = (props) => (<span className="flex h-full items-center text-left text-sm font-medium text-secondary">
|
|
16
|
+
{isReactFC(props.item.title) ? <props.item.title text={props.text}/> : props.item.title}
|
|
17
|
+
</span>);
|
|
18
18
|
const Item = forwardRef((props, ref) => {
|
|
19
19
|
const id = useId();
|
|
20
20
|
const active = props.active;
|
|
21
21
|
const item = props.item;
|
|
22
22
|
if (item.type === "group")
|
|
23
|
-
return (<div id={id} className="
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
return (<div id={id} className="h-10 px-2 pb-1 pt-2">
|
|
24
|
+
<Group text={props.text} item={item}/>
|
|
25
|
+
</div>);
|
|
26
26
|
if (item.type !== "shortcut")
|
|
27
27
|
return <Fragment />;
|
|
28
28
|
return (<button {...props} id={id} ref={ref} role="option" type="button" aria-selected={active} data-component="command-palette-item" className={css("flex h-10 items-center justify-between rounded-lg p-2 hover:bg-floating-hover", active ? "bg-floating-hover" : "")}>
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
<span className="flex items-center gap-2">
|
|
30
|
+
{item.Icon ? item.Icon : null}
|
|
31
|
+
<span>{isReactFC(item.title) ? <item.title text={props.text}/> : item.title}</span>
|
|
32
|
+
</span>
|
|
33
|
+
{item.shortcut ? <Shortcut value={item.shortcut}/> : null}
|
|
34
|
+
</button>);
|
|
35
35
|
});
|
|
36
36
|
const getFuzzyData = (commands, value) => {
|
|
37
37
|
if (value.length === 0)
|
|
@@ -92,7 +92,7 @@ export const CommandPalette = (props) => {
|
|
|
92
92
|
openOnArrowKeyDown: true,
|
|
93
93
|
scrollItemIntoView: false,
|
|
94
94
|
selectedIndex: activeIndex,
|
|
95
|
-
disabledIndices: n => {
|
|
95
|
+
disabledIndices: (n) => {
|
|
96
96
|
const item = fuzzy[n];
|
|
97
97
|
if (item)
|
|
98
98
|
return item.type === "group";
|
|
@@ -108,7 +108,7 @@ export const CommandPalette = (props) => {
|
|
|
108
108
|
return n;
|
|
109
109
|
return props.open ? (prev ?? 0) : null;
|
|
110
110
|
});
|
|
111
|
-
}
|
|
111
|
+
},
|
|
112
112
|
});
|
|
113
113
|
const { getItemProps, getReferenceProps, getFloatingProps } = useInteractions([listNav]);
|
|
114
114
|
const displayItems = text === ""
|
|
@@ -139,12 +139,12 @@ export const CommandPalette = (props) => {
|
|
|
139
139
|
}, [bindKey, commands, props, valueRef]);
|
|
140
140
|
const Icon = props.Icon ?? FilterIcon;
|
|
141
141
|
return (<Fragment>
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
142
|
+
<Modal {...getFloatingProps()} animated={false} closable={false} open={props.open} overlayClickClose ariaTitle="Command palette" bodyClassName="px-0 py-0 pt-0" data-component="command-palette" onChange={props.onChangeVisibility} className="container relative overflow-clip py-0 md:max-w-screen-sm lg:max-w-screen-md">
|
|
143
|
+
<header className="sticky top-0 isolate z-floating flex h-12 w-full items-center overflow-clip border-b border-floating-border bg-floating-background">
|
|
144
|
+
<div className="flex size-10 items-center justify-center">
|
|
145
|
+
{props.Icon ? <Icon Default={FilterIcon} text={text} size={16}/> : <FilterIcon size={16}/>}
|
|
146
|
+
</div>
|
|
147
|
+
<input {...getReferenceProps({
|
|
148
148
|
ref: root.refs.setReference,
|
|
149
149
|
onKeyDown: (e) => {
|
|
150
150
|
const item = Is.number(activeIndex) ? displayItems[activeIndex] : null;
|
|
@@ -160,17 +160,17 @@ export const CommandPalette = (props) => {
|
|
|
160
160
|
item.action({ event: e, text: text, setOpen: props.onChangeVisibility, setText });
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
|
-
}
|
|
164
|
-
})} autoFocus value={text} data-combikeysbypass="true" placeholder="Search for..." onChange={(e) => setText(e.target.value)} className="items-center
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
163
|
+
},
|
|
164
|
+
})} autoFocus value={text} data-combikeysbypass="true" placeholder="Search for..." onChange={(e) => setText(e.target.value)} className="h-12 w-full items-center bg-transparent px-2 py-2 pb-2 text-left text-lg outline-none"/>
|
|
165
|
+
</header>
|
|
166
|
+
{props.loading ? (<ul role="listbox" data-component="command-palette-list" className="my-2 flex max-h-96 w-full origin-[top_center] flex-col gap-1 overflow-y-auto px-2">
|
|
167
|
+
<div className="h-10 px-2 pb-1 pt-2">{translations.commandPaletteLoading}</div>
|
|
168
|
+
{loadingSkeleton.map((_, i) => (<li key={`${id}-${i}-skeleton-index`} className={css("flex h-10 items-center justify-between rounded-lg p-2 hover:bg-primary hover:text-primary-foreground")}>
|
|
169
|
+
{SkeletonCell}
|
|
170
|
+
</li>))}
|
|
171
|
+
</ul>) : (<div className="flex min-w-full flex-row flex-nowrap" data-component="command-palette-container">
|
|
172
|
+
<ul role="listbox" ref={scrollContainerRef} data-component="command-palette-list" className="my-2 flex h-fit max-h-96 w-full origin-[top_center] flex-col gap-1 overflow-y-auto px-2">
|
|
173
|
+
{displayItems.map((item, index) => (<Item {...getItemProps({
|
|
174
174
|
onMouseEnter: () => setActiveIndex(index),
|
|
175
175
|
ref(node) {
|
|
176
176
|
listRef.current[index] = node;
|
|
@@ -182,13 +182,13 @@ export const CommandPalette = (props) => {
|
|
|
182
182
|
item.action({ event: e, text: text, setOpen: props.onChangeVisibility, setText });
|
|
183
183
|
},
|
|
184
184
|
})} item={item} text={text} active={activeIndex === index} key={`${id}-${item.type}-${index}`}/>))}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
185
|
+
{displayItems.length === 1 ? (<div className={css("flex items-center justify-between rounded-lg p-2 text-secondary")}>
|
|
186
|
+
{translations.commandPaletteEmpty ?? props.emptyMessage}
|
|
187
|
+
</div>) : null}
|
|
188
|
+
</ul>
|
|
189
|
+
{props.Preview && Is.number(activeIndex) ? <props.Preview command={displayItems[activeIndex]} text={text}/> : null}
|
|
190
|
+
</div>)}
|
|
191
|
+
{props.footer ? (<footer className="flex h-8 items-center rounded-b-lg border-t border-floating-border p-2">{props.footer}</footer>) : null}
|
|
192
|
+
</Modal>
|
|
193
|
+
</Fragment>);
|
|
194
194
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown.d.ts","sourceRoot":"","sources":["../../../src/components/floating/dropdown.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,EAAY,iBAAiB,EAA+C,MAAM,OAAO,CAAC;AAExG,KAAK,aAAa,GAAG;
|
|
1
|
+
{"version":3,"file":"dropdown.d.ts","sourceRoot":"","sources":["../../../src/components/floating/dropdown.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,EAAY,iBAAiB,EAA+C,MAAM,OAAO,CAAC;AAExG,KAAK,aAAa,GAAG;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACxC,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,OAAO,EAAE,KAAK,CAAC,YAAY,GAAG,KAAK,CAAC,SAAS,CAAC;IAC9C,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,YAAY,GAAG,MAAM,CAAC;CACzD,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,OAAO,iBAAiB,CAAC,aAAa,CAAC,sBAqE/D,CAAC"}
|
|
@@ -35,19 +35,19 @@ export const Dropdown = (props) => {
|
|
|
35
35
|
const role = useRole(context, { role: "tooltip" });
|
|
36
36
|
const { getReferenceProps, getFloatingProps } = useInteractions([click, dismiss, role]);
|
|
37
37
|
return (<Fragment>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
38
|
+
<button ref={refs.setReference} {...getReferenceProps(props.buttonProps)} type="button">
|
|
39
|
+
{props.trigger}
|
|
40
|
+
</button>
|
|
41
|
+
{open && (<FloatingPortal preserveTabOrder id={`${headingId}-portal`}>
|
|
42
|
+
<FloatingFocusManager guards restoreFocus={true} returnFocus={true} visuallyHiddenDismiss context={context} modal={false}>
|
|
43
|
+
<div className="relative isolate z-floating min-w-96 rounded-lg border border-floating-border bg-floating-background p-4 shadow-shadow-floating" ref={refs.setFloating} aria-labelledby={headingId} style={floatingStyles} {...getFloatingProps()}>
|
|
44
|
+
<FloatingArrow ref={arrowRef} context={context} strokeWidth={0.1} className="fill-floating-background stroke-floating-border"/>
|
|
45
|
+
<header className="mb-2">
|
|
46
|
+
<h3 className="text-left text-2xl font-medium leading-snug tracking-wide">{props.title}</h3>
|
|
47
|
+
</header>
|
|
48
|
+
{props.children}
|
|
49
|
+
</div>
|
|
50
|
+
</FloatingFocusManager>
|
|
51
|
+
</FloatingPortal>)}
|
|
52
|
+
</Fragment>);
|
|
53
53
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../../src/components/floating/modal.tsx"],"names":[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,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,cAAc,CAAC;IACzB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,eAAe,EAAE,OAAO,CAAC;IACzB,IAAI,EAAE,QAAQ,CAAC;IACf,YAAY,EAAE,YAAY,EAAE,CAAC;IAC7B,OAAO,EAAE,KAAK,GAAG,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;CAClC,CAAC,CACT,CAAC;AAgFF,MAAM,MAAM,QAAQ,GAAG;IAAE,OAAO,EAAE,GAAG,CAAC;IAAC,QAAQ,EAAE,WAAW,GAAG,IAAI,CAAA;CAAE,CAAC;AAItE,KAAK,cAAc,GAAG,KAAK,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG;IACzC,OAAO,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;CACvD,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,cA8PZ,CAAC;AAET,KAAK,wBAAwB,GAAG;IAC5B,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,KAAK,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IACzB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,WAAW,CAAC,EAAE,KAAK,CAAC;IACpB,MAAM,CAAC,EAAE,wBAAwB,CAAC;IAClC,OAAO,CAAC,EAAE,wBAAwB,CAAC;CACtC,CAAC;AAaF,eAAO,MAAM,oBAAoB,GAAI,cAAc;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,sBAuD/E,CAAC"}
|
|
@@ -2,9 +2,9 @@
|
|
|
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 { AnimatePresence, 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, useState, useCallback } 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";
|
|
@@ -79,13 +79,13 @@ const Draggable = (props) => {
|
|
|
79
79
|
return props.value.set(value);
|
|
80
80
|
}
|
|
81
81
|
};
|
|
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
|
|
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
|
|
83
83
|
? "top-1 flex h-3 w-full justify-center py-2"
|
|
84
84
|
: props.position === "left"
|
|
85
85
|
? "right-5 top-1/2 h-10 w-2"
|
|
86
86
|
: "left-2 top-1/2 h-10 w-2")}>
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
{props.sheet ? <div className="h-2 w-1/4 rounded-lg bg-floating-border"/> : null}
|
|
88
|
+
</motion.button>);
|
|
89
89
|
};
|
|
90
90
|
const positions = { drawer: "right", sheet: "none", dialog: "none" };
|
|
91
91
|
const fetchPosition = (isDesktop, forceType, propsType, propsPosition) => {
|
|
@@ -129,7 +129,10 @@ export const Modal = forwardRef(({ open, title, footer, asChild, trigger, childr
|
|
|
129
129
|
sheetY.set(undefined);
|
|
130
130
|
}, [type, floatingSize, sheetY]);
|
|
131
131
|
const onClose = () => onChange(false);
|
|
132
|
-
useImperativeHandle(externalRef, () => ({ context: floating.context, floating: removeScrollRef.current }), [
|
|
132
|
+
useImperativeHandle(externalRef, () => ({ context: floating.context, floating: removeScrollRef.current }), [
|
|
133
|
+
floating.context,
|
|
134
|
+
removeScrollRef,
|
|
135
|
+
]);
|
|
133
136
|
const onDragHeader = (_, info) => {
|
|
134
137
|
const div = floating.refs.floating.current;
|
|
135
138
|
const rect = div.getBoundingClientRect();
|
|
@@ -145,35 +148,37 @@ export const Modal = forwardRef(({ open, title, footer, asChild, trigger, childr
|
|
|
145
148
|
onChange?.(false);
|
|
146
149
|
return setTimeout(() => floatingSize.set(undefined), 350);
|
|
147
150
|
};
|
|
148
|
-
const draggableMotionProps = type === "sheet"
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
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 };
|
|
163
168
|
const scrollInitial = useMotionValue(undefined);
|
|
164
169
|
const scroll = useMotionValue(undefined);
|
|
165
170
|
const Component = asChild ? Slot : motion.button;
|
|
166
171
|
return (<Fragment>
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
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/70", 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
|
|
177
182
|
? {
|
|
178
183
|
"aria-labelledby": headingId,
|
|
179
184
|
"aria-describedby": descriptionId,
|
|
@@ -183,20 +188,21 @@ export const Modal = forwardRef(({ open, title, footer, asChild, trigger, childr
|
|
|
183
188
|
ref: mergeRefs(floating.refs.setFloating, removeScrollRef),
|
|
184
189
|
className: css(variants({ position, type }), className, "isolate overscroll-contain"),
|
|
185
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 }}>
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
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 () => {
|
|
193
198
|
scroll.set(undefined);
|
|
194
199
|
scrollInitial.set(undefined);
|
|
195
200
|
if (isDragging.current) {
|
|
196
201
|
const currentY = sheetY.get() || 0;
|
|
197
202
|
const threshold = window.innerHeight * 0.2;
|
|
198
203
|
if (currentY > threshold) {
|
|
199
|
-
await animate(sheetY, window.innerHeight, { duration: 0.2, ease: "easeIn" })
|
|
204
|
+
await animate(sheetY, window.innerHeight, { duration: 0.2, ease: "easeIn" })
|
|
205
|
+
.finished;
|
|
200
206
|
onChange(false);
|
|
201
207
|
}
|
|
202
208
|
else {
|
|
@@ -229,22 +235,22 @@ export const Modal = forwardRef(({ open, title, footer, asChild, trigger, childr
|
|
|
229
235
|
}
|
|
230
236
|
scroll.set(y);
|
|
231
237
|
}}>
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
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>);
|
|
248
254
|
});
|
|
249
255
|
let confirmGlobal = async (options) => {
|
|
250
256
|
if (typeof window !== "undefined") {
|
|
@@ -278,16 +284,16 @@ export const ModalConfirmProvider = ({ children }) => {
|
|
|
278
284
|
resolve(value ?? false);
|
|
279
285
|
};
|
|
280
286
|
return (<ConfirmContext.Provider value={confirmAction}>
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
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>);
|
|
293
299
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/floating/tooltip.tsx"],"names":[],"mappings":"AACA,OA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,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"}
|