@alexgorbatchev/shadcn 0.0.0-stage → 0.0.12
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/LICENSE +21 -0
- package/README.md +349 -2
- package/THIRD_PARTY_NOTICES.md +105 -0
- package/dist/chunk-1j2hz3w9.js +16 -0
- package/dist/chunk-5wvvqege.js +259 -0
- package/dist/chunk-8a7dn9ps.js +93 -0
- package/dist/chunk-cp2m7y7v.js +26 -0
- package/dist/chunk-jpvw9xqy.js +4 -0
- package/dist/chunk-rajgnfbr.js +24 -0
- package/dist/chunk-rjjwytbx.js +12 -0
- package/dist/chunk-tnktkgvp.js +63 -0
- package/dist/chunk-z1fy613d.js +64 -0
- package/dist/components/Accordion.d.ts +12 -0
- package/dist/components/Alert.d.ts +15 -0
- package/dist/components/AlertDialog.d.ts +28 -0
- package/dist/components/AspectRatio.d.ts +5 -0
- package/dist/components/Attachment.d.ts +36 -0
- package/dist/components/Avatar.d.ts +19 -0
- package/dist/components/Badge.d.ts +15 -0
- package/dist/components/Breadcrumb.d.ts +18 -0
- package/dist/components/Bubble.d.ts +25 -0
- package/dist/components/Button.d.ts +13 -0
- package/dist/components/ButtonGroup.d.ts +14 -0
- package/dist/components/Card.d.ts +19 -0
- package/dist/components/Checkbox.d.ts +6 -0
- package/dist/components/Collapsible.d.ts +6 -0
- package/dist/components/Combobox.d.ts +39 -0
- package/dist/components/ConfirmationDialog.d.ts +11 -0
- package/dist/components/ContextMenu.d.ts +24 -0
- package/dist/components/DensityProvider.d.ts +7 -0
- package/dist/components/Dialog.d.ts +25 -0
- package/dist/components/DirectionProvider.d.ts +1 -0
- package/dist/components/DragDropPreview.d.ts +7 -0
- package/dist/components/DragDropProvider.d.ts +6 -0
- package/dist/components/DragSource.d.ts +10 -0
- package/dist/components/Drawer.d.ts +25 -0
- package/dist/components/DropTarget.d.ts +11 -0
- package/dist/components/DropdownMenu.d.ts +26 -0
- package/dist/components/Empty.d.ts +19 -0
- package/dist/components/EmptyState.d.ts +8 -0
- package/dist/components/Field.d.ts +36 -0
- package/dist/components/HoverCard.d.ts +8 -0
- package/dist/components/ImagePicker.d.ts +11 -0
- package/dist/components/InlineEdit.d.ts +14 -0
- package/dist/components/Input.d.ts +6 -0
- package/dist/components/InputGroup.d.ts +26 -0
- package/dist/components/Item.d.ts +32 -0
- package/dist/components/JsonViewer.d.ts +8 -0
- package/dist/components/Kbd.d.ts +7 -0
- package/dist/components/Label.d.ts +5 -0
- package/dist/components/Marker.d.ts +19 -0
- package/dist/components/Menubar.d.ts +29 -0
- package/dist/components/Message.d.ts +17 -0
- package/dist/components/NativeSelect.d.ts +11 -0
- package/dist/components/NavigationMenu.d.ts +21 -0
- package/dist/components/Pagination.d.ts +21 -0
- package/dist/components/Popover.d.ts +14 -0
- package/dist/components/Progress.d.ts +14 -0
- package/dist/components/RadioGroup.d.ts +9 -0
- package/dist/components/ScrollArea.d.ts +10 -0
- package/dist/components/Select.d.ts +25 -0
- package/dist/components/Separator.d.ts +8 -0
- package/dist/components/Sheet.d.ts +20 -0
- package/dist/components/Sidebar.d.ts +60 -0
- package/dist/components/Skeleton.d.ts +5 -0
- package/dist/components/Slider.d.ts +6 -0
- package/dist/components/Spinner.d.ts +5 -0
- package/dist/components/StarRating.d.ts +10 -0
- package/dist/components/Switch.d.ts +8 -0
- package/dist/components/Table.d.ts +28 -0
- package/dist/components/Tabs.d.ts +16 -0
- package/dist/components/Textarea.d.ts +5 -0
- package/dist/components/ThemeProvider.d.ts +9 -0
- package/dist/components/Toast.d.ts +18 -0
- package/dist/components/Toggle.d.ts +11 -0
- package/dist/components/ToggleGroup.d.ts +12 -0
- package/dist/components/Tooltip.d.ts +9 -0
- package/dist/components/calendar/Calendar.d.ts +6 -0
- package/dist/components/calendar/getCalendarClassNames.d.ts +3 -0
- package/dist/components/calendar/index.d.ts +1 -0
- package/dist/components/calendar/index.js +10 -0
- package/dist/components/calendar/types.d.ts +9 -0
- package/dist/components/carousel/Carousel.d.ts +9 -0
- package/dist/components/carousel/CarouselContext.d.ts +2 -0
- package/dist/components/carousel/hooks/useCarousel.d.ts +2 -0
- package/dist/components/carousel/index.d.ts +3 -0
- package/dist/components/carousel/index.js +207 -0
- package/dist/components/carousel/types.d.ts +23 -0
- package/dist/components/chart/Chart.d.ts +10 -0
- package/dist/components/chart/ChartContext.d.ts +2 -0
- package/dist/components/chart/ChartStyle.d.ts +3 -0
- package/dist/components/chart/getPayloadConfigFromPayload.d.ts +2 -0
- package/dist/components/chart/hooks/useChart.d.ts +2 -0
- package/dist/components/chart/index.d.ts +3 -0
- package/dist/components/chart/index.js +284 -0
- package/dist/components/chart/types.d.ts +50 -0
- package/dist/components/command/Command.d.ts +21 -0
- package/dist/components/command/index.d.ts +1 -0
- package/dist/components/command/index.js +142 -0
- package/dist/components/input-otp/InputOTP.d.ts +12 -0
- package/dist/components/input-otp/index.d.ts +1 -0
- package/dist/components/input-otp/index.js +303 -0
- package/dist/components/message-scroller/MessageScroller.d.ts +16 -0
- package/dist/components/message-scroller/hooks/useMessageScroller.d.ts +1 -0
- package/dist/components/message-scroller/hooks/useMessageScrollerScrollable.d.ts +1 -0
- package/dist/components/message-scroller/hooks/useMessageScrollerVisibility.d.ts +1 -0
- package/dist/components/message-scroller/index.d.ts +5 -0
- package/dist/components/message-scroller/index.js +600 -0
- package/dist/components/persian-calendar/PersianCalendar.d.ts +6 -0
- package/dist/components/persian-calendar/index.d.ts +1 -0
- package/dist/components/persian-calendar/index.js +36 -0
- package/dist/components/questionnaire/Questionnaire.d.ts +20 -0
- package/dist/components/questionnaire/index.d.ts +2 -0
- package/dist/components/questionnaire/index.js +747 -0
- package/dist/components/resizable/Resizable.d.ts +10 -0
- package/dist/components/resizable/SplitView.d.ts +12 -0
- package/dist/components/resizable/index.d.ts +2 -0
- package/dist/components/resizable/index.js +147 -0
- package/dist/components/sonner/Sonner.d.ts +7 -0
- package/dist/components/sonner/hooks/useSonner.d.ts +1 -0
- package/dist/components/sonner/index.d.ts +2 -0
- package/dist/components/sonner/index.js +1273 -0
- package/dist/density/DensityContext.d.ts +2 -0
- package/dist/density/types.d.ts +4 -0
- package/dist/drag-drop/DragDropContext.d.ts +2 -0
- package/dist/drag-drop/types.d.ts +45 -0
- package/dist/drawer/DrawerContext.d.ts +2 -0
- package/dist/drawer/types.d.ts +7 -0
- package/dist/fonts.css +1 -0
- package/dist/hooks/useComboboxAnchor.d.ts +2 -0
- package/dist/hooks/useDensity.d.ts +2 -0
- package/dist/hooks/useDragDrop.d.ts +2 -0
- package/dist/hooks/useDragSource.d.ts +2 -0
- package/dist/hooks/useDrawer.d.ts +2 -0
- package/dist/hooks/useDropTarget.d.ts +2 -0
- package/dist/hooks/useMediaQuery.d.ts +1 -0
- package/dist/hooks/useObjectURL.d.ts +1 -0
- package/dist/hooks/useSidebar.d.ts +2 -0
- package/dist/hooks/useTheme.d.ts +2 -0
- package/dist/hooks/useToastManager.d.ts +2 -0
- package/dist/index.d.ts +82 -0
- package/dist/index.js +4908 -0
- package/dist/menu/types.d.ts +14 -0
- package/dist/message/MessageContext.d.ts +2 -0
- package/dist/message/types.d.ts +7 -0
- package/dist/sidebar/SidebarContext.d.ts +2 -0
- package/dist/sidebar/types.d.ts +32 -0
- package/dist/theme/ThemeContext.d.ts +2 -0
- package/dist/theme/types.d.ts +8 -0
- package/dist/theme.css +454 -0
- package/dist/toggle-group/ToggleGroupContext.d.ts +2 -0
- package/dist/toggle-group/types.d.ts +5 -0
- package/dist/typeset.css +444 -0
- package/dist/utils/cn.d.ts +2 -0
- package/package.json +193 -4
- package/patches/@shadcn%2Freact@0.3.1.patch +35 -0
- package/patches/input-otp@1.5.0.patch +20 -0
- package/patches/sonner@2.0.8.patch +87 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn2
|
|
3
|
+
} from "../../chunk-cp2m7y7v.js";
|
|
4
|
+
import"../../chunk-rjjwytbx.js";
|
|
5
|
+
import"../../chunk-tnktkgvp.js";
|
|
6
|
+
import {
|
|
7
|
+
Dialog2,
|
|
8
|
+
DialogContent2,
|
|
9
|
+
DialogHeader2,
|
|
10
|
+
DialogTitle2,
|
|
11
|
+
DialogDescription2,
|
|
12
|
+
InputGroup2,
|
|
13
|
+
InputGroupAddon2,
|
|
14
|
+
InputGroupInput2
|
|
15
|
+
} from "../../chunk-5wvvqege.js";
|
|
16
|
+
|
|
17
|
+
// src/components/command/Command.tsx
|
|
18
|
+
import { Command as CommandPrimitive } from "cmdk";
|
|
19
|
+
import { CheckIcon, SearchIcon } from "lucide-react";
|
|
20
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
21
|
+
function Command({ density, className, ...props }) {
|
|
22
|
+
return /* @__PURE__ */ jsx(CommandPrimitive, {
|
|
23
|
+
"data-density": density,
|
|
24
|
+
"data-slot": "command",
|
|
25
|
+
className: cn2("flex size-full flex-col overflow-hidden bg-popover p-1 text-popover-foreground", className),
|
|
26
|
+
...props
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function CommandDialog({
|
|
30
|
+
title = "Command Palette",
|
|
31
|
+
description = "Search for a command to run.",
|
|
32
|
+
children,
|
|
33
|
+
density,
|
|
34
|
+
className,
|
|
35
|
+
showCloseButton = false,
|
|
36
|
+
...props
|
|
37
|
+
}) {
|
|
38
|
+
return /* @__PURE__ */ jsx(Dialog2, {
|
|
39
|
+
...props,
|
|
40
|
+
children: (state) => /* @__PURE__ */ jsxs(DialogContent2, {
|
|
41
|
+
density,
|
|
42
|
+
className: cn2("overflow-hidden p-0", showCloseButton && "[&_[data-slot=command-input-wrapper]]:pe-10", className),
|
|
43
|
+
showCloseButton,
|
|
44
|
+
children: [
|
|
45
|
+
/* @__PURE__ */ jsxs(DialogHeader2, {
|
|
46
|
+
className: "sr-only",
|
|
47
|
+
children: [
|
|
48
|
+
/* @__PURE__ */ jsx(DialogTitle2, {
|
|
49
|
+
children: title
|
|
50
|
+
}),
|
|
51
|
+
/* @__PURE__ */ jsx(DialogDescription2, {
|
|
52
|
+
children: description
|
|
53
|
+
})
|
|
54
|
+
]
|
|
55
|
+
}),
|
|
56
|
+
typeof children === "function" ? children(state) : children
|
|
57
|
+
]
|
|
58
|
+
})
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function CommandInput({ className, ...props }) {
|
|
62
|
+
return /* @__PURE__ */ jsx("div", {
|
|
63
|
+
"data-slot": "command-input-wrapper",
|
|
64
|
+
className: "p-1 pb-0",
|
|
65
|
+
children: /* @__PURE__ */ jsxs(InputGroup2, {
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ jsx(CommandPrimitive.Input, {
|
|
68
|
+
asChild: true,
|
|
69
|
+
"data-slot": "input-group-control",
|
|
70
|
+
className,
|
|
71
|
+
...props,
|
|
72
|
+
children: /* @__PURE__ */ jsx(InputGroupInput2, {})
|
|
73
|
+
}),
|
|
74
|
+
/* @__PURE__ */ jsx(InputGroupAddon2, {
|
|
75
|
+
children: /* @__PURE__ */ jsx(SearchIcon, {
|
|
76
|
+
"aria-hidden": "true"
|
|
77
|
+
})
|
|
78
|
+
})
|
|
79
|
+
]
|
|
80
|
+
})
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
function CommandList({ className, ...props }) {
|
|
84
|
+
return /* @__PURE__ */ jsx(CommandPrimitive.List, {
|
|
85
|
+
"data-slot": "command-list",
|
|
86
|
+
className: cn2("max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none", className),
|
|
87
|
+
...props
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function CommandEmpty({ className, ...props }) {
|
|
91
|
+
return /* @__PURE__ */ jsx(CommandPrimitive.Empty, {
|
|
92
|
+
"data-slot": "command-empty",
|
|
93
|
+
className: cn2("p-panel text-center text-sm", className),
|
|
94
|
+
...props
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
function CommandGroup({ className, ...props }) {
|
|
98
|
+
return /* @__PURE__ */ jsx(CommandPrimitive.Group, {
|
|
99
|
+
"data-slot": "command-group",
|
|
100
|
+
className: cn2("overflow-hidden p-1 [&_[cmdk-group-heading]]:px-control-x [&_[cmdk-group-heading]]:py-1 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground", className),
|
|
101
|
+
...props
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
function CommandSeparator({ className, ...props }) {
|
|
105
|
+
return /* @__PURE__ */ jsx(CommandPrimitive.Separator, {
|
|
106
|
+
"data-slot": "command-separator",
|
|
107
|
+
className: cn2("h-px bg-border", className),
|
|
108
|
+
...props
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
function CommandItem({ className, children, ...props }) {
|
|
112
|
+
return /* @__PURE__ */ jsxs(CommandPrimitive.Item, {
|
|
113
|
+
"data-slot": "command-item",
|
|
114
|
+
className: cn2("group/command-item relative flex min-h-control cursor-default items-center gap-control-gap px-control-x text-sm outline-none select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-muted data-[selected=true]:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:size-4", className),
|
|
115
|
+
...props,
|
|
116
|
+
children: [
|
|
117
|
+
children,
|
|
118
|
+
/* @__PURE__ */ jsx(CheckIcon, {
|
|
119
|
+
"aria-hidden": "true",
|
|
120
|
+
className: "ms-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100"
|
|
121
|
+
})
|
|
122
|
+
]
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function CommandShortcut({ className, ...props }) {
|
|
126
|
+
return /* @__PURE__ */ jsx("span", {
|
|
127
|
+
"data-slot": "command-shortcut",
|
|
128
|
+
className: cn2("ms-auto text-xs text-muted-foreground group-data-[selected=true]/command-item:text-foreground", className),
|
|
129
|
+
...props
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
export {
|
|
133
|
+
Command,
|
|
134
|
+
CommandDialog,
|
|
135
|
+
CommandEmpty,
|
|
136
|
+
CommandGroup,
|
|
137
|
+
CommandInput,
|
|
138
|
+
CommandItem,
|
|
139
|
+
CommandList,
|
|
140
|
+
CommandSeparator,
|
|
141
|
+
CommandShortcut
|
|
142
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ComponentProps, ReactElement } from "react";
|
|
2
|
+
import type { IDensityProps } from "../../density/types.js";
|
|
3
|
+
import { OTPInput } from "input-otp";
|
|
4
|
+
type InputOTPProps = ComponentProps<typeof OTPInput> & IDensityProps;
|
|
5
|
+
declare function InputOTP({ density, className, containerClassName, dir, ...props }: InputOTPProps): ReactElement;
|
|
6
|
+
declare function InputOTPGroup({ className, ...props }: ComponentProps<"div">): ReactElement;
|
|
7
|
+
type InputOTPSlotProps = ComponentProps<"div"> & {
|
|
8
|
+
index: number;
|
|
9
|
+
};
|
|
10
|
+
declare function InputOTPSlot({ index, className, ...props }: InputOTPSlotProps): ReactElement;
|
|
11
|
+
declare function InputOTPSeparator({ className, children, ...props }: ComponentProps<"div">): ReactElement;
|
|
12
|
+
export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator } from "./InputOTP.js";
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn2
|
|
3
|
+
} from "../../chunk-cp2m7y7v.js";
|
|
4
|
+
|
|
5
|
+
// src/components/input-otp/InputOTP.tsx
|
|
6
|
+
import { useContext } from "react";
|
|
7
|
+
|
|
8
|
+
// node_modules/input-otp/dist/index.mjs
|
|
9
|
+
import * as e from "react";
|
|
10
|
+
import * as Z from "react";
|
|
11
|
+
import * as h from "react";
|
|
12
|
+
var kt = Object.defineProperty;
|
|
13
|
+
var xt = Object.defineProperties;
|
|
14
|
+
var Gt = Object.getOwnPropertyDescriptors;
|
|
15
|
+
var U = Object.getOwnPropertySymbols;
|
|
16
|
+
var ht = Object.prototype.hasOwnProperty;
|
|
17
|
+
var St = Object.prototype.propertyIsEnumerable;
|
|
18
|
+
var Et = (o, r, t) => (r in o) ? kt(o, r, { enumerable: true, configurable: true, writable: true, value: t }) : o[r] = t;
|
|
19
|
+
var bt = (o, r) => {
|
|
20
|
+
for (var t in r || (r = {}))
|
|
21
|
+
ht.call(r, t) && Et(o, t, r[t]);
|
|
22
|
+
if (U)
|
|
23
|
+
for (var t of U(r))
|
|
24
|
+
St.call(r, t) && Et(o, t, r[t]);
|
|
25
|
+
return o;
|
|
26
|
+
};
|
|
27
|
+
var Pt = (o, r) => xt(o, Gt(r));
|
|
28
|
+
var wt = (o, r) => {
|
|
29
|
+
var t = {};
|
|
30
|
+
for (var u in o)
|
|
31
|
+
ht.call(o, u) && r.indexOf(u) < 0 && (t[u] = o[u]);
|
|
32
|
+
if (o != null && U)
|
|
33
|
+
for (var u of U(o))
|
|
34
|
+
r.indexOf(u) < 0 && St.call(o, u) && (t[u] = o[u]);
|
|
35
|
+
return t;
|
|
36
|
+
};
|
|
37
|
+
function _t(o) {
|
|
38
|
+
let r = setTimeout(o, 0), t = setTimeout(o, 10), u = setTimeout(o, 50);
|
|
39
|
+
return [r, t, u];
|
|
40
|
+
}
|
|
41
|
+
function Tt(o) {
|
|
42
|
+
let r = Z.useRef();
|
|
43
|
+
return Z.useEffect(() => {
|
|
44
|
+
r.current = o;
|
|
45
|
+
}), r.current;
|
|
46
|
+
}
|
|
47
|
+
var Ot = 18;
|
|
48
|
+
var nt = 40;
|
|
49
|
+
var Lt = `${nt}px`;
|
|
50
|
+
function Ct(o) {
|
|
51
|
+
let r = o.getBoundingClientRect().right, t = o;
|
|
52
|
+
for (;t; ) {
|
|
53
|
+
if (getComputedStyle(t).overflowX !== "visible")
|
|
54
|
+
return t.getBoundingClientRect().left + t.clientLeft + t.clientWidth - r;
|
|
55
|
+
t = t.parentElement;
|
|
56
|
+
}
|
|
57
|
+
return document.documentElement.clientWidth - r;
|
|
58
|
+
}
|
|
59
|
+
var jt = ["[data-lastpass-icon-root]", "com-1password-button", "[data-dashlanecreated]", '[style$="2147483647 !important;"]'].join(",");
|
|
60
|
+
function Mt({ containerRef: o, inputRef: r, pushPasswordManagerStrategy: t, isFocused: u }) {
|
|
61
|
+
let [w, T] = h.useState(false), [x, M] = h.useState(false), [V, I] = h.useState(false), q = h.useMemo(() => t === "none" ? false : (t === "increase-width" || t === "experimental-no-flickering") && w && x, [w, x, t]), y = h.useCallback(() => {
|
|
62
|
+
let m = o.current, S = r.current;
|
|
63
|
+
if (!m || !S || V || t === "none")
|
|
64
|
+
return;
|
|
65
|
+
let R = m, i = R.getBoundingClientRect().left + R.offsetWidth, G = R.getBoundingClientRect().top + R.offsetHeight / 2, ot = i - Ot, X = G;
|
|
66
|
+
document.querySelectorAll(jt).length === 0 && document.elementFromPoint(ot, X) === m || (M(Ct(m) >= nt), T(true), I(true));
|
|
67
|
+
}, [o, r, V, t]);
|
|
68
|
+
return h.useEffect(() => {
|
|
69
|
+
let m = o.current;
|
|
70
|
+
if (!m || t === "none")
|
|
71
|
+
return;
|
|
72
|
+
function S() {
|
|
73
|
+
M(Ct(m) >= nt);
|
|
74
|
+
}
|
|
75
|
+
S();
|
|
76
|
+
let R = setInterval(S, 1000);
|
|
77
|
+
return () => {
|
|
78
|
+
clearInterval(R);
|
|
79
|
+
};
|
|
80
|
+
}, [o, t]), h.useEffect(() => {
|
|
81
|
+
let m = u || document.activeElement === r.current;
|
|
82
|
+
if (t === "none" || !m)
|
|
83
|
+
return;
|
|
84
|
+
let S = setTimeout(y, 0), R = setTimeout(y, 2000), i = setTimeout(y, 5000), G = setTimeout(() => {
|
|
85
|
+
I(true);
|
|
86
|
+
}, 6000);
|
|
87
|
+
return () => {
|
|
88
|
+
clearTimeout(S), clearTimeout(R), clearTimeout(i), clearTimeout(G);
|
|
89
|
+
};
|
|
90
|
+
}, [r, u, t, y]), { hasPWMBadge: w, willPushPWMBadge: q, PWM_BADGE_SPACE_WIDTH: Lt };
|
|
91
|
+
}
|
|
92
|
+
var Nt = e.createContext({});
|
|
93
|
+
var $t = e.forwardRef((ot, G) => {
|
|
94
|
+
var X = ot, { defaultValue: initialDefaultValue, value: o, onChange: r, maxLength: t, textAlign: u = "left", pattern: w, placeholder: T, inputMode: x = "numeric", onComplete: M, pushPasswordManagerStrategy: V = "increase-width", pasteTransformer: I, containerClassName: q, noScriptCSSFallback: y = Ft, nonce: m, render: S, children: R } = X, i = wt(X, ["defaultValue", "value", "onChange", "maxLength", "textAlign", "pattern", "placeholder", "inputMode", "onComplete", "pushPasswordManagerStrategy", "pasteTransformer", "containerClassName", "noScriptCSSFallback", "nonce", "render", "children"]);
|
|
95
|
+
var z, ft, mt, pt, Rt;
|
|
96
|
+
let [rt, at] = e.useState(typeof initialDefaultValue == "string" ? initialDefaultValue : ""), l = o != null ? o : rt, D = Tt(l), O = e.useCallback((a) => {
|
|
97
|
+
r == null || r(a), at(a);
|
|
98
|
+
}, [r]), p = e.useMemo(() => w ? typeof w == "string" ? new RegExp(w) : w : null, [w]), d = e.useRef(null), K = e.useRef(null), J = e.useRef({ value: l, onChange: O, isIOS: typeof window != "undefined" && ((ft = (z = window == null ? undefined : window.CSS) == null ? undefined : z.supports) == null ? undefined : ft.call(z, "-webkit-touch-callout", "none")) }), Y = e.useRef({ prev: [(mt = d.current) == null ? undefined : mt.selectionStart, (pt = d.current) == null ? undefined : pt.selectionEnd, (Rt = d.current) == null ? undefined : Rt.selectionDirection] });
|
|
99
|
+
e.useImperativeHandle(G, () => d.current, []), e.useEffect(() => {
|
|
100
|
+
let a = d.current, n = K.current;
|
|
101
|
+
if (!a || !n)
|
|
102
|
+
return;
|
|
103
|
+
J.current.value !== a.value && J.current.onChange(a.value), Y.current.prev = [a.selectionStart, a.selectionEnd, a.selectionDirection];
|
|
104
|
+
function c() {
|
|
105
|
+
if (document.activeElement !== a) {
|
|
106
|
+
j(null), N(null);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
let { selectionStart: s, selectionEnd: P, selectionDirection: $, maxLength: v, value: B } = a, _ = Y.current.prev, g = -1, E = -1, C;
|
|
110
|
+
if (B.length !== 0 && s !== null && P !== null) {
|
|
111
|
+
let Bt = s === P, Wt = s === B.length && B.length < v;
|
|
112
|
+
if (Bt && !Wt) {
|
|
113
|
+
let W = s;
|
|
114
|
+
if (W === 0)
|
|
115
|
+
g = 0, E = 1, C = "forward";
|
|
116
|
+
else if (W === v)
|
|
117
|
+
g = W - 1, E = W, C = "backward";
|
|
118
|
+
else if (v > 1 && B.length > 1) {
|
|
119
|
+
let et = 0;
|
|
120
|
+
if (_[0] !== null && _[1] !== null) {
|
|
121
|
+
C = W < _[1] ? "backward" : "forward";
|
|
122
|
+
let At = _[0] === _[1] && _[0] < v;
|
|
123
|
+
C === "backward" && !At && (et = -1);
|
|
124
|
+
}
|
|
125
|
+
g = et + W, E = et + W + 1;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
g !== -1 && E !== -1 && g !== E && a.setSelectionRange(g, E, C);
|
|
129
|
+
}
|
|
130
|
+
let vt = g !== -1 ? g : s, gt = E !== -1 ? E : P, Ht = C != null ? C : $;
|
|
131
|
+
j(vt), N(gt), Y.current.prev = [vt, gt, Ht];
|
|
132
|
+
}
|
|
133
|
+
if (document.addEventListener("selectionchange", c, { capture: true }), c(), document.activeElement === a && Q(true), !document.getElementById("input-otp-style")) {
|
|
134
|
+
let s = document.createElement("style");
|
|
135
|
+
if (s.id = "input-otp-style", m && s.setAttribute("nonce", m), document.head.appendChild(s), s.sheet) {
|
|
136
|
+
let P = "background: transparent !important; color: transparent !important; border-color: transparent !important; opacity: 0 !important; box-shadow: none !important; -webkit-box-shadow: none !important; -webkit-text-fill-color: transparent !important;";
|
|
137
|
+
F(s.sheet, "[data-input-otp]::selection { background: transparent !important; color: transparent !important; }"), F(s.sheet, `[data-input-otp]:autofill { ${P} }`), F(s.sheet, `[data-input-otp]:-webkit-autofill { ${P} }`), F(s.sheet, "@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }"), F(s.sheet, "[data-input-otp] + * { pointer-events: all !important; }");
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
let b = () => {
|
|
141
|
+
n && n.style.setProperty("--root-height", `${a.clientHeight}px`);
|
|
142
|
+
};
|
|
143
|
+
b();
|
|
144
|
+
let f = typeof ResizeObserver == "undefined" ? null : new ResizeObserver(b);
|
|
145
|
+
return f == null || f.observe(a), () => {
|
|
146
|
+
document.removeEventListener("selectionchange", c, { capture: true }), f == null || f.disconnect();
|
|
147
|
+
};
|
|
148
|
+
}, []);
|
|
149
|
+
let [ct, it] = e.useState(false), [L, Q] = e.useState(false), [H, j] = e.useState(null), [A, N] = e.useState(null);
|
|
150
|
+
e.useEffect(() => {
|
|
151
|
+
let a = _t(() => {
|
|
152
|
+
var f, s, P, $;
|
|
153
|
+
(f = d.current) == null || f.dispatchEvent(new Event("input"));
|
|
154
|
+
let n = (s = d.current) == null ? undefined : s.selectionStart, c = (P = d.current) == null ? undefined : P.selectionEnd, b = ($ = d.current) == null ? undefined : $.selectionDirection;
|
|
155
|
+
n !== null && c !== null && (j(n), N(c), Y.current.prev = [n, c, b]);
|
|
156
|
+
});
|
|
157
|
+
return () => {
|
|
158
|
+
a.forEach((n) => clearTimeout(n));
|
|
159
|
+
};
|
|
160
|
+
}, [l, L]), e.useEffect(() => {
|
|
161
|
+
D !== undefined && l !== D && D.length < t && l.length === t && (M == null || M(l));
|
|
162
|
+
}, [t, M, D, l]);
|
|
163
|
+
let k = Mt({ containerRef: K, inputRef: d, pushPasswordManagerStrategy: V, isFocused: L }), st = e.useCallback((a) => {
|
|
164
|
+
let n = a.currentTarget.value.slice(0, t);
|
|
165
|
+
if (n.length > 0 && p && !p.test(n)) {
|
|
166
|
+
a.preventDefault();
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
typeof D == "string" && n.length < D.length && document.dispatchEvent(new Event("selectionchange")), O(n);
|
|
170
|
+
}, [t, O, D, p]), lt = e.useCallback(() => {
|
|
171
|
+
var a;
|
|
172
|
+
if (d.current) {
|
|
173
|
+
let n = Math.min(d.current.value.length, t - 1), c = d.current.value.length;
|
|
174
|
+
(a = d.current) == null || a.setSelectionRange(n, c), j(n), N(c);
|
|
175
|
+
}
|
|
176
|
+
Q(true);
|
|
177
|
+
}, [t]), ut = e.useCallback((a) => {
|
|
178
|
+
var g, E;
|
|
179
|
+
let n = d.current;
|
|
180
|
+
if (!I && (!J.current.isIOS || !a.clipboardData || !n))
|
|
181
|
+
return;
|
|
182
|
+
let c = a.clipboardData.getData("text/plain"), b = I ? I(c) : c;
|
|
183
|
+
a.preventDefault();
|
|
184
|
+
let f = (g = d.current) == null ? undefined : g.selectionStart, s = (E = d.current) == null ? undefined : E.selectionEnd, v = (f !== s ? l.slice(0, f) + b + l.slice(s) : l.slice(0, f) + b + l.slice(f)).slice(0, t);
|
|
185
|
+
if (v.length > 0 && p && !p.test(v))
|
|
186
|
+
return;
|
|
187
|
+
n.value = v, O(v);
|
|
188
|
+
let B = Math.min(v.length, t - 1), _ = v.length;
|
|
189
|
+
n.setSelectionRange(B, _), j(B), N(_);
|
|
190
|
+
}, [t, O, I, p, l]), It = e.useMemo(() => ({ position: "relative", cursor: i.disabled ? "default" : "text", userSelect: "none", WebkitUserSelect: "none", pointerEvents: "none" }), [i.disabled]), dt = e.useMemo(() => ({ position: "absolute", inset: 0, width: k.willPushPWMBadge ? `calc(100% + ${k.PWM_BADGE_SPACE_WIDTH})` : "100%", clipPath: k.willPushPWMBadge ? `inset(0 ${k.PWM_BADGE_SPACE_WIDTH} 0 0)` : undefined, height: "100%", display: "flex", textAlign: u, opacity: "1", color: "transparent", pointerEvents: "all", background: "transparent", caretColor: "transparent", border: "0 solid transparent", outline: "0 solid transparent", boxShadow: "none", lineHeight: "1", letterSpacing: "-.5em", fontSize: "var(--root-height, 16px)", fontFamily: "monospace", fontVariantNumeric: "tabular-nums" }), [k.PWM_BADGE_SPACE_WIDTH, k.willPushPWMBadge, u]), yt = e.useMemo(() => {
|
|
191
|
+
var a;
|
|
192
|
+
return e.createElement("input", Pt(bt({ autoComplete: i.autoComplete || "one-time-code" }, i), { "data-input-otp": true, "data-input-otp-placeholder-shown": l.length === 0 || undefined, "data-input-otp-mss": H, "data-input-otp-mse": A, inputMode: x, pattern: p == null ? undefined : p.source, "aria-placeholder": T, style: dt, maxLength: t, value: l, ref: d, spellCheck: (a = i.spellCheck) != null ? a : false, onPaste: (n) => {
|
|
193
|
+
var c;
|
|
194
|
+
ut(n), (c = i.onPaste) == null || c.call(i, n);
|
|
195
|
+
}, onChange: st, onMouseOver: (n) => {
|
|
196
|
+
var c;
|
|
197
|
+
it(true), (c = i.onMouseOver) == null || c.call(i, n);
|
|
198
|
+
}, onMouseLeave: (n) => {
|
|
199
|
+
var c;
|
|
200
|
+
it(false), (c = i.onMouseLeave) == null || c.call(i, n);
|
|
201
|
+
}, onFocus: (n) => {
|
|
202
|
+
var c;
|
|
203
|
+
lt(), (c = i.onFocus) == null || c.call(i, n);
|
|
204
|
+
}, onBlur: (n) => {
|
|
205
|
+
var c;
|
|
206
|
+
Q(false), (c = i.onBlur) == null || c.call(i, n);
|
|
207
|
+
} }));
|
|
208
|
+
}, [st, lt, ut, x, dt, t, A, H, T, i, p == null ? undefined : p.source, l]), tt = e.useMemo(() => ({ slots: Array.from({ length: t }).map((a, n) => {
|
|
209
|
+
var s;
|
|
210
|
+
let c = L && H !== null && A !== null && (H === A && n === H || n >= H && n < A), b = l[n] !== undefined ? l[n] : null, f = l[0] !== undefined ? null : (s = T == null ? undefined : T[n]) != null ? s : null;
|
|
211
|
+
return { char: b, placeholderChar: f, isActive: c, hasFakeCaret: c && b === null };
|
|
212
|
+
}), isFocused: L, isHovering: !i.disabled && ct }), [L, ct, t, A, H, T, i.disabled, l]), Dt = e.useMemo(() => S ? S(tt) : e.createElement(Nt.Provider, { value: tt }, R), [R, tt, S]);
|
|
213
|
+
return e.createElement(e.Fragment, null, y !== null && e.createElement("noscript", null, e.createElement("style", null, y)), e.createElement("div", { ref: K, "data-input-otp-container": true, translate: "no", style: It, className: q }, Dt, e.createElement("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" } }, yt)));
|
|
214
|
+
});
|
|
215
|
+
$t.displayName = "Input";
|
|
216
|
+
function F(o, r) {
|
|
217
|
+
try {
|
|
218
|
+
o.insertRule(r);
|
|
219
|
+
} catch (t) {
|
|
220
|
+
console.warn("input-otp could not insert CSS rule:", r);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
var Ft = `
|
|
224
|
+
[data-input-otp] {
|
|
225
|
+
--nojs-bg: white !important;
|
|
226
|
+
--nojs-fg: black !important;
|
|
227
|
+
|
|
228
|
+
background-color: var(--nojs-bg) !important;
|
|
229
|
+
color: var(--nojs-fg) !important;
|
|
230
|
+
caret-color: var(--nojs-fg) !important;
|
|
231
|
+
letter-spacing: .25em !important;
|
|
232
|
+
text-align: center !important;
|
|
233
|
+
border: 1px solid var(--nojs-fg) !important;
|
|
234
|
+
border-radius: 4px !important;
|
|
235
|
+
width: 100% !important;
|
|
236
|
+
}
|
|
237
|
+
@media (prefers-color-scheme: dark) {
|
|
238
|
+
[data-input-otp] {
|
|
239
|
+
--nojs-bg: black !important;
|
|
240
|
+
--nojs-fg: white !important;
|
|
241
|
+
}
|
|
242
|
+
}`;
|
|
243
|
+
|
|
244
|
+
// src/components/input-otp/InputOTP.tsx
|
|
245
|
+
import { MinusIcon } from "lucide-react";
|
|
246
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
247
|
+
function InputOTP({ density, className, containerClassName, dir, ...props }) {
|
|
248
|
+
return /* @__PURE__ */ jsx("div", {
|
|
249
|
+
"data-slot": "input-otp",
|
|
250
|
+
"data-density": density,
|
|
251
|
+
dir,
|
|
252
|
+
className: "inline-flex [&:has(input:disabled)]:opacity-50 [&:has(input[aria-invalid=true])_[data-slot=input-otp-slot]]:border-destructive [&:has(input[aria-invalid=true])_[data-active=true]]:ring-destructive",
|
|
253
|
+
children: /* @__PURE__ */ jsx($t, {
|
|
254
|
+
dir,
|
|
255
|
+
"data-slot": "input-otp-control",
|
|
256
|
+
containerClassName: cn2("flex items-center gap-control-gap", containerClassName),
|
|
257
|
+
spellCheck: false,
|
|
258
|
+
className: cn2("disabled:cursor-not-allowed", className),
|
|
259
|
+
...props
|
|
260
|
+
})
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
function InputOTPGroup({ className, ...props }) {
|
|
264
|
+
return /* @__PURE__ */ jsx("div", {
|
|
265
|
+
"data-slot": "input-otp-group",
|
|
266
|
+
className: cn2("flex items-center", className),
|
|
267
|
+
...props
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
function InputOTPSlot({ index, className, ...props }) {
|
|
271
|
+
const { char, placeholderChar, hasFakeCaret, isActive } = useContext(Nt).slots[index] ?? {};
|
|
272
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
273
|
+
"data-slot": "input-otp-slot",
|
|
274
|
+
"data-active": isActive,
|
|
275
|
+
"aria-hidden": "true",
|
|
276
|
+
className: cn2("relative flex size-control items-center justify-center border-y border-e border-input bg-input text-sm first:border-s data-[active=true]:border-ring data-[active=true]:ring-1 data-[active=true]:ring-ring", className),
|
|
277
|
+
...props,
|
|
278
|
+
children: [
|
|
279
|
+
char ?? /* @__PURE__ */ jsx("span", {
|
|
280
|
+
className: "text-muted-foreground",
|
|
281
|
+
children: placeholderChar
|
|
282
|
+
}),
|
|
283
|
+
hasFakeCaret && /* @__PURE__ */ jsx("div", {
|
|
284
|
+
className: "pointer-events-none absolute h-3 w-px animate-caret-blink bg-foreground motion-reduce:animate-none"
|
|
285
|
+
})
|
|
286
|
+
]
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
function InputOTPSeparator({ className, children, ...props }) {
|
|
290
|
+
return /* @__PURE__ */ jsx("div", {
|
|
291
|
+
"data-slot": "input-otp-separator",
|
|
292
|
+
"aria-hidden": "true",
|
|
293
|
+
className: cn2("flex items-center [&_svg]:size-4", className),
|
|
294
|
+
...props,
|
|
295
|
+
children: children ?? /* @__PURE__ */ jsx(MinusIcon, {})
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
export {
|
|
299
|
+
InputOTP,
|
|
300
|
+
InputOTPGroup,
|
|
301
|
+
InputOTPSeparator,
|
|
302
|
+
InputOTPSlot
|
|
303
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ComponentProps, ReactElement } from "react";
|
|
2
|
+
import type { IDensityProps } from "../../density/types.js";
|
|
3
|
+
import { MessageScroller as MessageScrollerPrimitive } from "@shadcn/react/message-scroller";
|
|
4
|
+
import { Button } from "../Button.js";
|
|
5
|
+
declare function MessageScrollerProvider(props: ComponentProps<typeof MessageScrollerPrimitive.Provider>): ReactElement;
|
|
6
|
+
type MessageScrollerProps = ComponentProps<typeof MessageScrollerPrimitive.Root> & IDensityProps;
|
|
7
|
+
declare function MessageScroller({ density, className, ...props }: MessageScrollerProps): ReactElement;
|
|
8
|
+
type MessageScrollerViewportProps = ComponentProps<typeof MessageScrollerPrimitive.Viewport> & IDensityProps;
|
|
9
|
+
declare function MessageScrollerViewport({ density, className, ...props }: MessageScrollerViewportProps): ReactElement;
|
|
10
|
+
type MessageScrollerContentProps = ComponentProps<typeof MessageScrollerPrimitive.Content> & IDensityProps;
|
|
11
|
+
declare function MessageScrollerContent({ density, className, ...props }: MessageScrollerContentProps): ReactElement;
|
|
12
|
+
type MessageScrollerItemProps = ComponentProps<typeof MessageScrollerPrimitive.Item> & IDensityProps;
|
|
13
|
+
declare function MessageScrollerItem({ density, className, scrollAnchor, ...props }: MessageScrollerItemProps): ReactElement;
|
|
14
|
+
type MessageScrollerButtonProps = ComponentProps<typeof MessageScrollerPrimitive.Button> & Pick<ComponentProps<typeof Button>, "variant" | "size"> & IDensityProps;
|
|
15
|
+
declare function MessageScrollerButton({ density, direction, behavior, className, children, render, variant, size, ...props }: MessageScrollerButtonProps): ReactElement;
|
|
16
|
+
export { MessageScrollerProvider, MessageScroller, MessageScrollerViewport, MessageScrollerContent, MessageScrollerItem, MessageScrollerButton, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useMessageScroller } from "@shadcn/react/message-scroller";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useMessageScrollerScrollable } from "@shadcn/react/message-scroller";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useMessageScrollerVisibility } from "@shadcn/react/message-scroller";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { MessageScrollerProvider, MessageScroller, MessageScrollerViewport, MessageScrollerContent, MessageScrollerItem, MessageScrollerButton, } from "./MessageScroller.js";
|
|
2
|
+
export { useMessageScroller } from "./hooks/useMessageScroller.js";
|
|
3
|
+
export { useMessageScrollerScrollable } from "./hooks/useMessageScrollerScrollable.js";
|
|
4
|
+
export { useMessageScrollerVisibility } from "./hooks/useMessageScrollerVisibility.js";
|
|
5
|
+
export type { MessageScrollerDefaultScrollPosition, MessageScrollerScrollAlign, MessageScrollerScrollOptions, MessageScrollerScrollable, MessageScrollerVisibilityState, } from "@shadcn/react/message-scroller";
|