@krak-stack/registry 0.8.3 → 0.10.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.
Files changed (45) hide show
  1. package/CHANGELOG.md +16 -5
  2. package/dist/components/ui/animated-list.js +5 -0
  3. package/dist/components/ui/app-switcher.d.ts +2 -1
  4. package/dist/components/ui/app-switcher.js +5 -1
  5. package/dist/components/ui/async-action-button.d.ts +2 -1
  6. package/dist/components/ui/async-action-button.js +3 -1
  7. package/dist/components/ui/bulk-list-input.d.ts +2 -1
  8. package/dist/components/ui/bulk-list-input.js +6 -1
  9. package/dist/components/ui/calendar.d.ts +10 -0
  10. package/dist/components/ui/choice-cards.d.ts +1 -0
  11. package/dist/components/ui/choice-cards.js +7 -1
  12. package/dist/components/ui/color-picker.d.ts +2 -1
  13. package/dist/components/ui/color-picker.js +4 -1
  14. package/dist/components/ui/cron-expression-editor.d.ts +3 -1
  15. package/dist/components/ui/cron-expression-editor.js +13 -3
  16. package/dist/components/ui/danger-confirmation.d.ts +1 -0
  17. package/dist/components/ui/danger-confirmation.js +5 -1
  18. package/dist/components/ui/date-picker.d.ts +33 -0
  19. package/dist/components/ui/date-picker.js +470 -0
  20. package/dist/components/ui/date-picker.schema.d.ts +9 -0
  21. package/dist/components/ui/editable-text.js +8 -1
  22. package/dist/components/ui/form.d.ts +5 -5
  23. package/dist/components/ui/image-crop-editor.js +10 -1
  24. package/dist/components/ui/phone-number-input.d.ts +3 -1
  25. package/dist/components/ui/phone-number-input.js +53 -13
  26. package/dist/components/ui/phone-number-input.schema.d.ts +7 -0
  27. package/dist/components/ui/{copy-value.d.ts → secret-value.d.ts} +4 -6
  28. package/dist/components/ui/secret-value.js +222 -0
  29. package/dist/components/ui/select-with-custom-input.d.ts +36 -0
  30. package/dist/components/ui/select-with-custom-input.js +275 -0
  31. package/dist/components/ui/sidebar-layout.js +1 -0
  32. package/dist/components/ui/stepper.js +8 -0
  33. package/dist/components/ui/time-picker.d.ts +41 -0
  34. package/dist/components/ui/time-picker.js +488 -0
  35. package/dist/components/ui/time-picker.schema.d.ts +14 -0
  36. package/dist/components/ui/timezone-select.d.ts +2 -1
  37. package/dist/components/ui/timezone-select.js +5 -1
  38. package/dist/components/ui/toast.d.ts +18 -0
  39. package/dist/components/ui/toast.js +121 -0
  40. package/dist/components/ui/unsaved-changes-guard.d.ts +2 -1
  41. package/dist/components/ui/unsaved-changes-guard.js +4 -1
  42. package/dist/components/ui/upload-attachment.js +3 -0
  43. package/dist/lib/docs.js +1 -0
  44. package/package.json +23 -5
  45. package/dist/components/ui/copy-value.js +0 -319
@@ -0,0 +1,275 @@
1
+ // ../../src/components/ui/select-with-custom-input.tsx
2
+ import { useId, useRef } from "react";
3
+
4
+ // ../../src/components/ui/input.tsx
5
+ import { Input as InputPrimitive } from "@base-ui/react/input";
6
+
7
+ // ../../src/lib/utils.ts
8
+ import { cn } from "cn";
9
+
10
+ // ../../src/components/ui/input.tsx
11
+ import { jsx } from "react/jsx-runtime";
12
+ function Input({ className, type, ...props }) {
13
+ return /* @__PURE__ */ jsx(InputPrimitive, {
14
+ type,
15
+ "data-slot": "input",
16
+ className: cn("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40", className),
17
+ ...props
18
+ });
19
+ }
20
+
21
+ // ../../src/components/ui/select.tsx
22
+ import { Select as SelectPrimitive } from "@base-ui/react/select";
23
+ import { ChevronDownIcon, CheckIcon, ChevronUpIcon } from "lucide-react";
24
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
25
+ "use client";
26
+ var Select = SelectPrimitive.Root;
27
+ function SelectValue({ className, ...props }) {
28
+ return /* @__PURE__ */ jsx2(SelectPrimitive.Value, {
29
+ "data-slot": "select-value",
30
+ className: cn("flex flex-1 text-left", className),
31
+ ...props
32
+ });
33
+ }
34
+ function SelectTrigger({
35
+ className,
36
+ size = "default",
37
+ children,
38
+ ...props
39
+ }) {
40
+ return /* @__PURE__ */ jsxs(SelectPrimitive.Trigger, {
41
+ "data-slot": "select-trigger",
42
+ "data-size": size,
43
+ className: cn("flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
44
+ ...props,
45
+ children: [
46
+ children,
47
+ /* @__PURE__ */ jsx2(SelectPrimitive.Icon, {
48
+ render: /* @__PURE__ */ jsx2(ChevronDownIcon, {
49
+ className: "text-muted-foreground pointer-events-none size-4"
50
+ })
51
+ })
52
+ ]
53
+ });
54
+ }
55
+ function SelectContent({
56
+ className,
57
+ children,
58
+ side = "bottom",
59
+ sideOffset = 4,
60
+ align = "center",
61
+ alignOffset = 0,
62
+ alignItemWithTrigger = true,
63
+ ...props
64
+ }) {
65
+ return /* @__PURE__ */ jsx2(SelectPrimitive.Portal, {
66
+ children: /* @__PURE__ */ jsx2(SelectPrimitive.Positioner, {
67
+ side,
68
+ sideOffset,
69
+ align,
70
+ alignOffset,
71
+ alignItemWithTrigger,
72
+ className: "isolate z-50",
73
+ children: /* @__PURE__ */ jsxs(SelectPrimitive.Popup, {
74
+ "data-slot": "select-content",
75
+ "data-align-trigger": alignItemWithTrigger,
76
+ className: cn("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
77
+ ...props,
78
+ children: [
79
+ /* @__PURE__ */ jsx2(SelectScrollUpButton, {}),
80
+ /* @__PURE__ */ jsx2(SelectPrimitive.List, {
81
+ children
82
+ }),
83
+ /* @__PURE__ */ jsx2(SelectScrollDownButton, {})
84
+ ]
85
+ })
86
+ })
87
+ });
88
+ }
89
+ function SelectItem({
90
+ className,
91
+ children,
92
+ ...props
93
+ }) {
94
+ return /* @__PURE__ */ jsxs(SelectPrimitive.Item, {
95
+ "data-slot": "select-item",
96
+ className: cn("relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", className),
97
+ ...props,
98
+ children: [
99
+ /* @__PURE__ */ jsx2(SelectPrimitive.ItemText, {
100
+ className: "flex flex-1 shrink-0 gap-2 whitespace-nowrap",
101
+ children
102
+ }),
103
+ /* @__PURE__ */ jsx2(SelectPrimitive.ItemIndicator, {
104
+ render: /* @__PURE__ */ jsx2("span", {
105
+ className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center"
106
+ }),
107
+ children: /* @__PURE__ */ jsx2(CheckIcon, {
108
+ className: "pointer-events-none"
109
+ })
110
+ })
111
+ ]
112
+ });
113
+ }
114
+ function SelectScrollUpButton({
115
+ className,
116
+ ...props
117
+ }) {
118
+ return /* @__PURE__ */ jsx2(SelectPrimitive.ScrollUpArrow, {
119
+ "data-slot": "select-scroll-up-button",
120
+ className: cn("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4", className),
121
+ ...props,
122
+ children: /* @__PURE__ */ jsx2(ChevronUpIcon, {})
123
+ });
124
+ }
125
+ function SelectScrollDownButton({
126
+ className,
127
+ ...props
128
+ }) {
129
+ return /* @__PURE__ */ jsx2(SelectPrimitive.ScrollDownArrow, {
130
+ "data-slot": "select-scroll-down-button",
131
+ className: cn("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4", className),
132
+ ...props,
133
+ children: /* @__PURE__ */ jsx2(ChevronDownIcon, {})
134
+ });
135
+ }
136
+
137
+ // ../../src/components/ui/select-with-custom-input.tsx
138
+ import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider";
139
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
140
+ "use client";
141
+ var SelectWithCustomInput = ({
142
+ label,
143
+ options,
144
+ value,
145
+ onValueChange,
146
+ name,
147
+ customName,
148
+ required,
149
+ disabled,
150
+ readOnly,
151
+ placeholder,
152
+ description,
153
+ error,
154
+ locale,
155
+ className,
156
+ triggerClassName,
157
+ contentClassName,
158
+ inputClassName
159
+ }) => {
160
+ const id = useId();
161
+ const language = useKrakstackLocale(locale);
162
+ const selected = options.find((option) => option.value === value?.option);
163
+ const input = useRef(null);
164
+ const focusInput = useRef(false);
165
+ const describedBy = [description && `${id}-description`, error && `${id}-error`].filter(Boolean).join(" ") || undefined;
166
+ return /* @__PURE__ */ jsxs2("div", {
167
+ "data-slot": "select-with-custom-input",
168
+ "data-state": selected?.input ? "custom" : "preset",
169
+ className: cn("grid min-w-0 gap-2", className),
170
+ children: [
171
+ /* @__PURE__ */ jsx3("label", {
172
+ htmlFor: id,
173
+ "data-slot": "select-with-custom-input-label",
174
+ className: "text-sm font-medium",
175
+ children: label
176
+ }),
177
+ /* @__PURE__ */ jsxs2(Select, {
178
+ items: options,
179
+ value: value?.option ?? null,
180
+ name,
181
+ required,
182
+ disabled,
183
+ readOnly,
184
+ onValueChange: (next) => {
185
+ const option = options.find((option) => option.value === next);
186
+ if (disabled || readOnly || option?.disabled)
187
+ return;
188
+ if (!option) {
189
+ onValueChange(null);
190
+ return;
191
+ }
192
+ if (option.value === value?.option)
193
+ return;
194
+ focusInput.current = Boolean(option.input);
195
+ onValueChange(option.input ? { option: option.value, customValue: "" } : { option: option.value });
196
+ },
197
+ children: [
198
+ /* @__PURE__ */ jsx3(SelectTrigger, {
199
+ id,
200
+ "data-component": "select-with-custom-input-trigger",
201
+ "aria-invalid": Boolean(error),
202
+ "aria-describedby": describedBy,
203
+ className: cn("w-full min-w-0", triggerClassName),
204
+ children: /* @__PURE__ */ jsx3(SelectValue, {
205
+ placeholder: placeholder ?? (language.startsWith("fr") ? "Sélectionner une option" : "Select an option")
206
+ })
207
+ }),
208
+ /* @__PURE__ */ jsx3(SelectContent, {
209
+ "data-component": "select-with-custom-input-content",
210
+ className: contentClassName,
211
+ finalFocus: () => {
212
+ const target = focusInput.current ? input.current : null;
213
+ focusInput.current = false;
214
+ return target ?? true;
215
+ },
216
+ children: options.map((option) => /* @__PURE__ */ jsx3(SelectItem, {
217
+ value: option.value,
218
+ disabled: option.disabled,
219
+ children: option.label
220
+ }, option.value))
221
+ })
222
+ ]
223
+ }),
224
+ selected?.input ? /* @__PURE__ */ jsxs2("div", {
225
+ "data-slot": "select-with-custom-input-field",
226
+ className: "grid gap-2",
227
+ children: [
228
+ /* @__PURE__ */ jsx3("label", {
229
+ htmlFor: `${id}-custom`,
230
+ className: "text-sm font-medium",
231
+ children: selected.input.label
232
+ }),
233
+ /* @__PURE__ */ jsx3(Input, {
234
+ ref: input,
235
+ id: `${id}-custom`,
236
+ "data-component": "select-with-custom-input-text",
237
+ name: customName ?? (name ? `${name}Custom` : undefined),
238
+ value: value?.customValue ?? "",
239
+ disabled,
240
+ readOnly,
241
+ required: selected.input.required,
242
+ maxLength: selected.input.maxLength,
243
+ placeholder: selected.input.placeholder,
244
+ "aria-invalid": Boolean(error),
245
+ "aria-describedby": describedBy,
246
+ className: inputClassName,
247
+ onChange: (event) => {
248
+ if (!disabled && !readOnly)
249
+ onValueChange({
250
+ option: selected.value,
251
+ customValue: event.target.value
252
+ });
253
+ }
254
+ })
255
+ ]
256
+ }) : null,
257
+ description ? /* @__PURE__ */ jsx3("p", {
258
+ id: `${id}-description`,
259
+ "data-slot": "select-with-custom-input-description",
260
+ className: "text-muted-foreground text-xs",
261
+ children: description
262
+ }) : null,
263
+ error ? /* @__PURE__ */ jsx3("p", {
264
+ id: `${id}-error`,
265
+ "data-slot": "select-with-custom-input-error",
266
+ role: "alert",
267
+ className: "text-destructive text-sm",
268
+ children: error
269
+ }) : null
270
+ ]
271
+ });
272
+ };
273
+ export {
274
+ SelectWithCustomInput
275
+ };
@@ -638,6 +638,7 @@ function AppSidebar({ collapsible, footer, groups, header }) {
638
638
  });
639
639
  return /* @__PURE__ */ jsx5(SidebarMenuItem, {
640
640
  children: /* @__PURE__ */ jsxs4(SidebarMenuButton, {
641
+ className: "h-auto min-h-8",
641
642
  onClick: closeMobileSidebar,
642
643
  render,
643
644
  tooltip: item.label(),
@@ -63,6 +63,7 @@ var Stepper = ({
63
63
  children: labels.progress(currentIndex + 1, steps.length)
64
64
  }),
65
65
  /* @__PURE__ */ jsx("ol", {
66
+ "data-slot": "stepper-list",
66
67
  className: cn("flex gap-2", variant === "underline" && "flex-wrap gap-x-6 gap-y-1", variant === "underline" && orientation === "horizontal" && "justify-center", orientation === "vertical" && "flex-col", orientation === "responsive" && "lg:flex-col"),
67
68
  children: steps.map((step, index) => {
68
69
  const active = step.id === currentStep;
@@ -70,9 +71,11 @@ var Stepper = ({
70
71
  const content = /* @__PURE__ */ jsxs(Fragment, {
71
72
  children: [
72
73
  variant === "segmented" ? /* @__PURE__ */ jsx("span", {
74
+ "data-slot": "stepper-indicator",
73
75
  "aria-hidden": "true",
74
76
  className: cn("bg-muted block h-1.5 w-full rounded-full motion-safe:transition-colors motion-safe:duration-150", state === "completed" && "bg-primary/50", active && "bg-primary", state === "error" && "bg-destructive")
75
77
  }) : variant === "labelled" ? /* @__PURE__ */ jsx("span", {
78
+ "data-slot": "stepper-indicator",
76
79
  "aria-hidden": "true",
77
80
  className: cn("flex size-8 shrink-0 items-center justify-center rounded-full border text-xs font-medium motion-safe:transition-colors motion-safe:duration-150 [&_svg]:size-4", state === "completed" && "border-primary/30 bg-primary/10 text-primary", active && "border-primary bg-primary text-primary-foreground", state === "error" && "border-destructive text-destructive"),
78
81
  children: state === "error" ? /* @__PURE__ */ jsx(CircleAlert, {}) : state === "completed" && !active ? /* @__PURE__ */ jsx(Check, {}) : step.icon ?? index + 1
@@ -81,10 +84,12 @@ var Stepper = ({
81
84
  className: cn("min-w-0 break-words", variant === "segmented" && "sr-only", orientation === "responsive" && variant === "labelled" && "sr-only lg:not-sr-only"),
82
85
  children: [
83
86
  /* @__PURE__ */ jsx("span", {
87
+ "data-slot": "stepper-label",
84
88
  className: "block",
85
89
  children: step.label
86
90
  }),
87
91
  step.description ? /* @__PURE__ */ jsx("span", {
92
+ "data-slot": "stepper-description",
88
93
  className: "text-muted-foreground block text-xs font-normal",
89
94
  children: step.description
90
95
  }) : null,
@@ -105,9 +110,11 @@ var Stepper = ({
105
110
  });
106
111
  const itemClassName = cn("text-muted-foreground flex min-h-11 w-full min-w-0 items-center rounded-md text-sm", variant === "labelled" && orientation === "horizontal" ? "flex-col gap-2 text-center sm:flex-row sm:gap-3 sm:text-left" : "gap-3 text-left", variant === "labelled" && "px-2 py-2", orientation === "responsive" && "justify-center lg:justify-start", variant === "underline" && "w-auto justify-start rounded-none border-b-2 border-transparent py-3 text-left motion-safe:transition-colors motion-safe:duration-150", variant === "underline" && active && "border-foreground", active && "text-foreground font-medium", state === "error" && "text-destructive");
107
112
  return /* @__PURE__ */ jsx("li", {
113
+ "data-slot": "stepper-item",
108
114
  "data-state": state,
109
115
  className: cn("min-w-0", variant !== "underline" && "flex-1"),
110
116
  children: onStepSelect ? /* @__PURE__ */ jsx("button", {
117
+ "data-slot": "stepper-trigger",
111
118
  type: "button",
112
119
  "aria-current": active ? "step" : undefined,
113
120
  "aria-disabled": step.disabled || undefined,
@@ -119,6 +126,7 @@ var Stepper = ({
119
126
  },
120
127
  children: content
121
128
  }) : /* @__PURE__ */ jsx("div", {
129
+ "data-slot": "stepper-trigger",
122
130
  "aria-current": active ? "step" : undefined,
123
131
  className: itemClassName,
124
132
  children: content
@@ -0,0 +1,41 @@
1
+ export { TimeOnlySchema, MinuteStepSchema, getTimePickerState, parseTimeOnly, Time12HourSchema, parse12HourTime, } from "./time-picker.schema.js";
2
+ export type TimePickerMessages = {
3
+ label: string;
4
+ open: string;
5
+ clear: string;
6
+ hours: string;
7
+ minutes: string;
8
+ period: string;
9
+ done: string;
10
+ invalid: string;
11
+ invalid12: string;
12
+ outOfRange: string;
13
+ invalidRange: string;
14
+ offStep: string;
15
+ };
16
+ export type TimePickerProps = {
17
+ /** HH:mm, or an empty/incomplete draft while typing. */
18
+ value: string;
19
+ onValueChange: (value: string) => void;
20
+ min?: string;
21
+ max?: string;
22
+ /** Allowed minute values start at 00 in each hour; integer from 1 to 60. */
23
+ minuteStep?: number;
24
+ /** Display and entry format. Values and bounds always use 24-hour HH:mm. */
25
+ hourCycle?: 12 | 24;
26
+ label?: string;
27
+ name?: string;
28
+ required?: boolean;
29
+ disabled?: boolean;
30
+ readOnly?: boolean;
31
+ clearable?: boolean;
32
+ description?: string;
33
+ locale?: string;
34
+ messages?: Partial<Record<string, Partial<TimePickerMessages>>>;
35
+ className?: string;
36
+ inputClassName?: string;
37
+ contentClassName?: string;
38
+ columnClassName?: string;
39
+ optionClassName?: string;
40
+ };
41
+ export declare const TimePicker: ({ value, onValueChange, min, max, minuteStep, hourCycle, label, name, required, disabled, readOnly, clearable, description, locale: override, messages, className, inputClassName, contentClassName, columnClassName, optionClassName, }: TimePickerProps) => import("react").JSX.Element;