@orangecheck/app-design 0.6.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +4 -3
  2. package/dist/brand.js.map +1 -1
  3. package/dist/brand.mjs.map +1 -1
  4. package/dist/chrome.d.mts +49 -15
  5. package/dist/chrome.d.ts +49 -15
  6. package/dist/chrome.js +619 -55
  7. package/dist/chrome.js.map +1 -1
  8. package/dist/chrome.mjs +617 -57
  9. package/dist/chrome.mjs.map +1 -1
  10. package/dist/components.d.mts +231 -1
  11. package/dist/components.d.ts +231 -1
  12. package/dist/components.js +1187 -2
  13. package/dist/components.js.map +1 -1
  14. package/dist/components.mjs +1162 -5
  15. package/dist/components.mjs.map +1 -1
  16. package/dist/family.d.mts +2 -0
  17. package/dist/family.d.ts +2 -0
  18. package/dist/family.js +167 -0
  19. package/dist/family.js.map +1 -0
  20. package/dist/family.mjs +154 -0
  21. package/dist/family.mjs.map +1 -0
  22. package/dist/index-C6hDqOOS.d.mts +58 -0
  23. package/dist/index-C6hDqOOS.d.ts +58 -0
  24. package/dist/index.d.mts +5 -3
  25. package/dist/index.d.ts +5 -3
  26. package/dist/index.js +1619 -132
  27. package/dist/index.js.map +1 -1
  28. package/dist/index.mjs +1575 -134
  29. package/dist/index.mjs.map +1 -1
  30. package/dist/primitives.d.mts +52 -1
  31. package/dist/primitives.d.ts +52 -1
  32. package/dist/primitives.js +280 -3
  33. package/dist/primitives.js.map +1 -1
  34. package/dist/primitives.mjs +271 -6
  35. package/dist/primitives.mjs.map +1 -1
  36. package/dist/status-badge-BEOxeY9j.d.ts +13 -0
  37. package/dist/status-badge-DRwGhB0h.d.mts +13 -0
  38. package/dist/styles/fonts.css +1 -1
  39. package/dist/styles/tokens.css +4 -2
  40. package/dist/tokens.d.mts +3 -1
  41. package/dist/tokens.d.ts +3 -1
  42. package/dist/tokens.js +5 -3
  43. package/dist/tokens.js.map +1 -1
  44. package/dist/tokens.mjs +5 -3
  45. package/dist/tokens.mjs.map +1 -1
  46. package/package.json +9 -2
@@ -2,6 +2,7 @@ import * as react from 'react';
2
2
  import { ButtonHTMLAttributes, HTMLAttributes, ReactNode, ReactElement, InputHTMLAttributes, TextareaHTMLAttributes } from 'react';
3
3
  import * as class_variance_authority_types from 'class-variance-authority/types';
4
4
  import { VariantProps } from 'class-variance-authority';
5
+ export { S as Statement, a as Status, b as StatusBadge, c as StatusBadgeProps, s as statusWord } from './status-badge-DRwGhB0h.mjs';
5
6
  import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
6
7
  import * as LabelPrimitive from '@radix-ui/react-label';
7
8
  import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
@@ -16,6 +17,7 @@ import * as SeparatorPrimitive from '@radix-ui/react-separator';
16
17
  import { ToasterProps } from 'sonner';
17
18
  export { toast } from 'sonner';
18
19
  import { ClassValue } from 'clsx';
20
+ import './index-C6hDqOOS.mjs';
19
21
 
20
22
  declare const buttonVariants: (props?: ({
21
23
  variant?: "link" | "danger" | "brand" | "primary" | "secondary" | "ghost" | "onInk" | "onInkOutline" | null | undefined;
@@ -147,6 +149,55 @@ interface ScrollFadeProps extends HTMLAttributes<HTMLDivElement> {
147
149
  }
148
150
  declare function ScrollFade({ fade, className, innerClassName, children, ...props }: ScrollFadeProps): react.JSX.Element;
149
151
 
152
+ declare function Accordion({ single, children, className, }: {
153
+ single?: boolean;
154
+ children: ReactNode;
155
+ className?: string;
156
+ }): react.JSX.Element;
157
+ declare function AccordionItem({ title, children, defaultOpen, id, className, }: {
158
+ title: ReactNode;
159
+ children: ReactNode;
160
+ defaultOpen?: boolean;
161
+ id?: string;
162
+ className?: string;
163
+ }): react.JSX.Element;
164
+
165
+ interface ConfirmOptions {
166
+ title: ReactNode;
167
+ message?: ReactNode;
168
+ confirmLabel?: string;
169
+ cancelLabel?: string;
170
+ destructive?: boolean;
171
+ }
172
+ interface PromptOptions extends ConfirmOptions {
173
+ label?: ReactNode;
174
+ placeholder?: string;
175
+ defaultValue?: string;
176
+ hint?: ReactNode;
177
+ secret?: boolean;
178
+ minLength?: number;
179
+ validate?: (value: string) => string | null | undefined;
180
+ }
181
+ declare function confirm(options: ConfirmOptions): Promise<boolean>;
182
+ declare function prompt(options: PromptOptions): Promise<string | null>;
183
+ declare function DialogHost(): react.JSX.Element;
184
+
185
+ declare function Pagination({ pageIndex, pageSize, total, onPage, label, className, }: {
186
+ pageIndex: number;
187
+ pageSize: number;
188
+ total: number;
189
+ onPage: (pageIndex: number) => void;
190
+ label?: string;
191
+ className?: string;
192
+ }): react.JSX.Element | null;
193
+
194
+ declare function QrCode({ value, size, label, className, }: {
195
+ value: string;
196
+ size?: number;
197
+ label?: string;
198
+ className?: string;
199
+ }): react.JSX.Element;
200
+
150
201
  declare function cn(...inputs: ClassValue[]): string;
151
202
 
152
- export { Badge, type BadgeProps, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardNumeral, type CardProps, CardTitle, Checkbox, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, Field, type FieldProps, Input, Kbd, Label, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, RadioGroup, RadioGroupItem, ScrollFade, type ScrollFadeProps, Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetTitle, SheetTrigger, Skeleton, Spinner, StatusDot, StatusPill, Switch, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonVariants, cardVariants, cn, useTimedOut };
203
+ export { Accordion, AccordionItem, Badge, type BadgeProps, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardNumeral, type CardProps, CardTitle, Checkbox, type ConfirmOptions, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogHost, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, Field, type FieldProps, Input, Kbd, Label, Pagination, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, type PromptOptions, QrCode, RadioGroup, RadioGroupItem, ScrollFade, type ScrollFadeProps, Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetTitle, SheetTrigger, Skeleton, Spinner, StatusDot, StatusPill, Switch, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonVariants, cardVariants, cn, confirm, prompt, useTimedOut };
@@ -2,6 +2,7 @@ import * as react from 'react';
2
2
  import { ButtonHTMLAttributes, HTMLAttributes, ReactNode, ReactElement, InputHTMLAttributes, TextareaHTMLAttributes } from 'react';
3
3
  import * as class_variance_authority_types from 'class-variance-authority/types';
4
4
  import { VariantProps } from 'class-variance-authority';
5
+ export { S as Statement, a as Status, b as StatusBadge, c as StatusBadgeProps, s as statusWord } from './status-badge-BEOxeY9j.js';
5
6
  import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
6
7
  import * as LabelPrimitive from '@radix-ui/react-label';
7
8
  import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
@@ -16,6 +17,7 @@ import * as SeparatorPrimitive from '@radix-ui/react-separator';
16
17
  import { ToasterProps } from 'sonner';
17
18
  export { toast } from 'sonner';
18
19
  import { ClassValue } from 'clsx';
20
+ import './index-C6hDqOOS.js';
19
21
 
20
22
  declare const buttonVariants: (props?: ({
21
23
  variant?: "link" | "danger" | "brand" | "primary" | "secondary" | "ghost" | "onInk" | "onInkOutline" | null | undefined;
@@ -147,6 +149,55 @@ interface ScrollFadeProps extends HTMLAttributes<HTMLDivElement> {
147
149
  }
148
150
  declare function ScrollFade({ fade, className, innerClassName, children, ...props }: ScrollFadeProps): react.JSX.Element;
149
151
 
152
+ declare function Accordion({ single, children, className, }: {
153
+ single?: boolean;
154
+ children: ReactNode;
155
+ className?: string;
156
+ }): react.JSX.Element;
157
+ declare function AccordionItem({ title, children, defaultOpen, id, className, }: {
158
+ title: ReactNode;
159
+ children: ReactNode;
160
+ defaultOpen?: boolean;
161
+ id?: string;
162
+ className?: string;
163
+ }): react.JSX.Element;
164
+
165
+ interface ConfirmOptions {
166
+ title: ReactNode;
167
+ message?: ReactNode;
168
+ confirmLabel?: string;
169
+ cancelLabel?: string;
170
+ destructive?: boolean;
171
+ }
172
+ interface PromptOptions extends ConfirmOptions {
173
+ label?: ReactNode;
174
+ placeholder?: string;
175
+ defaultValue?: string;
176
+ hint?: ReactNode;
177
+ secret?: boolean;
178
+ minLength?: number;
179
+ validate?: (value: string) => string | null | undefined;
180
+ }
181
+ declare function confirm(options: ConfirmOptions): Promise<boolean>;
182
+ declare function prompt(options: PromptOptions): Promise<string | null>;
183
+ declare function DialogHost(): react.JSX.Element;
184
+
185
+ declare function Pagination({ pageIndex, pageSize, total, onPage, label, className, }: {
186
+ pageIndex: number;
187
+ pageSize: number;
188
+ total: number;
189
+ onPage: (pageIndex: number) => void;
190
+ label?: string;
191
+ className?: string;
192
+ }): react.JSX.Element | null;
193
+
194
+ declare function QrCode({ value, size, label, className, }: {
195
+ value: string;
196
+ size?: number;
197
+ label?: string;
198
+ className?: string;
199
+ }): react.JSX.Element;
200
+
150
201
  declare function cn(...inputs: ClassValue[]): string;
151
202
 
152
- export { Badge, type BadgeProps, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardNumeral, type CardProps, CardTitle, Checkbox, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, Field, type FieldProps, Input, Kbd, Label, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, RadioGroup, RadioGroupItem, ScrollFade, type ScrollFadeProps, Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetTitle, SheetTrigger, Skeleton, Spinner, StatusDot, StatusPill, Switch, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonVariants, cardVariants, cn, useTimedOut };
203
+ export { Accordion, AccordionItem, Badge, type BadgeProps, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardNumeral, type CardProps, CardTitle, Checkbox, type ConfirmOptions, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogHost, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, Field, type FieldProps, Input, Kbd, Label, Pagination, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, type PromptOptions, QrCode, RadioGroup, RadioGroupItem, ScrollFade, type ScrollFadeProps, Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetTitle, SheetTrigger, Skeleton, Spinner, StatusDot, StatusPill, Switch, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonVariants, cardVariants, cn, confirm, prompt, useTimedOut };
@@ -19,6 +19,9 @@ var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
19
19
  var PopoverPrimitive = require('@radix-ui/react-popover');
20
20
  var TooltipPrimitive = require('@radix-ui/react-tooltip');
21
21
  var TabsPrimitive = require('@radix-ui/react-tabs');
22
+ var QRCode = require('qrcode');
23
+
24
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
22
25
 
23
26
  function _interopNamespace(e) {
24
27
  if (e && e.__esModule) return e;
@@ -49,6 +52,7 @@ var DropdownMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(DropdownMe
49
52
  var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitive);
50
53
  var TooltipPrimitive__namespace = /*#__PURE__*/_interopNamespace(TooltipPrimitive);
51
54
  var TabsPrimitive__namespace = /*#__PURE__*/_interopNamespace(TabsPrimitive);
55
+ var QRCode__default = /*#__PURE__*/_interopDefault(QRCode);
52
56
 
53
57
  var merge = tailwindMerge.extendTailwindMerge({
54
58
  extend: {
@@ -237,13 +241,13 @@ var badgeVariants = classVarianceAuthority.cva(
237
241
  tone: {
238
242
  neutral: "border-border bg-card text-foreground",
239
243
  muted: "border-transparent bg-muted text-muted-foreground",
240
- brand: "border-transparent bg-[color-mix(in_oklab,var(--oca-orange)_12%,var(--card))] text-oca-accent-ink",
244
+ brand: "border-transparent bg-[color-mix(in_oklab,var(--oca-orange)_9%,var(--card))] text-oca-accent-ink",
241
245
  danger: "border-transparent bg-[color-mix(in_oklab,var(--destructive)_12%,var(--card))] text-destructive",
242
246
  // A good state is a neutral pill with a green dot, not a green pill.
243
247
  success: GOOD_DOT,
244
248
  // Aliases kept so older call sites keep compiling: attention is
245
249
  // the brand accent, information is neutral.
246
- warning: "border-transparent bg-[color-mix(in_oklab,var(--oca-orange)_12%,var(--card))] text-oca-accent-ink",
250
+ warning: "border-transparent bg-[color-mix(in_oklab,var(--oca-orange)_9%,var(--card))] text-oca-accent-ink",
247
251
  info: "border-border bg-card text-foreground",
248
252
  // Inverted in dark mode, where ink would sit on a card of nearly its own colour.
249
253
  ink: "border-transparent bg-oca-ink text-oca-ink-foreground dark:bg-foreground dark:text-background",
@@ -281,6 +285,30 @@ function StatusPill({
281
285
  }
282
286
  );
283
287
  }
288
+ var WORD = {
289
+ live: "Live",
290
+ testing: "In testing",
291
+ "not-yet": "Not yet",
292
+ paused: "Paused",
293
+ good: "Good",
294
+ caution: "Caution",
295
+ refused: "Refused"
296
+ };
297
+ var TONE = {
298
+ live: "success",
299
+ testing: "brand",
300
+ "not-yet": "muted",
301
+ paused: "muted",
302
+ good: "success",
303
+ caution: "brand",
304
+ refused: "danger"
305
+ };
306
+ function statusWord(status) {
307
+ return WORD[status];
308
+ }
309
+ function StatusBadge({ status, className, ...props }) {
310
+ return /* @__PURE__ */ jsxRuntime.jsx(Badge, { tone: TONE[status], "data-status": status, className: cn(className), ...props, children: WORD[status] });
311
+ }
284
312
  var cardVariants = classVarianceAuthority.cva("relative rounded-[1.25rem] border", {
285
313
  variants: {
286
314
  tone: {
@@ -464,7 +492,8 @@ var Switch = react.forwardRef(function Switch2({ className, ...props }, ref) {
464
492
  className: cn(
465
493
  "peer inline-flex h-6 w-11 shrink-0 items-center rounded-full border border-transparent bg-input p-0.5",
466
494
  "outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
467
- "data-[state=checked]:bg-brand disabled:cursor-not-allowed disabled:opacity-50",
495
+ // The deep orange: the track is the state, so it must clear 3:1 on a card.
496
+ "data-[state=checked]:bg-oca-orange-deep disabled:cursor-not-allowed disabled:opacity-50",
468
497
  className
469
498
  ),
470
499
  ...props,
@@ -756,11 +785,252 @@ var TabsTrigger = react.forwardRef(function TabsTrigger2({ className, ...props }
756
785
  var TabsContent = react.forwardRef(function TabsContent2({ className, ...props }, ref) {
757
786
  return /* @__PURE__ */ jsxRuntime.jsx(TabsPrimitive__namespace.Content, { ref, className: cn("mt-6 outline-none", className), ...props });
758
787
  });
788
+ var GroupName = react.createContext(void 0);
789
+ function Accordion({
790
+ single = false,
791
+ children,
792
+ className
793
+ }) {
794
+ const name = react.useId();
795
+ return /* @__PURE__ */ jsxRuntime.jsx(GroupName.Provider, { value: single ? name : void 0, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("divide-y divide-border overflow-hidden rounded-[1.25rem] border border-border bg-card", className), children }) });
796
+ }
797
+ function AccordionItem({
798
+ title,
799
+ children,
800
+ defaultOpen = false,
801
+ id,
802
+ className
803
+ }) {
804
+ const name = react.useContext(GroupName);
805
+ return /* @__PURE__ */ jsxRuntime.jsxs("details", { id, name, open: defaultOpen || void 0, className: cn("group scroll-mt-24", className), children: [
806
+ /* @__PURE__ */ jsxRuntime.jsxs(
807
+ "summary",
808
+ {
809
+ className: cn(
810
+ "flex min-h-14 cursor-pointer list-none items-center justify-between gap-4 px-5 py-4 text-[1rem] font-medium leading-snug md:px-6",
811
+ // Inside the card's clip, so the ring is drawn within the row.
812
+ "transition-colors hover:bg-accent/60 focus-visible:outline-offset-[-2px] [&::-webkit-details-marker]:hidden"
813
+ ),
814
+ children: [
815
+ title,
816
+ /* @__PURE__ */ jsxRuntime.jsx(
817
+ lucideReact.ChevronDown,
818
+ {
819
+ "aria-hidden": true,
820
+ className: "size-4 shrink-0 text-muted-foreground transition-transform duration-200 group-open:rotate-180"
821
+ }
822
+ )
823
+ ]
824
+ }
825
+ ),
826
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oca-body px-5 pb-5 text-[0.9375rem] md:px-6 md:pb-6", children })
827
+ ] });
828
+ }
829
+ var queue = [];
830
+ var asked = 0;
831
+ var hosts = 0;
832
+ var listeners = /* @__PURE__ */ new Set();
833
+ var emit = () => listeners.forEach((l) => l());
834
+ function ask(item) {
835
+ queue = [...queue, { ...item, id: ++asked }];
836
+ emit();
837
+ }
838
+ function done() {
839
+ queue = queue.slice(1);
840
+ emit();
841
+ }
842
+ function confirm(options) {
843
+ if (hosts === 0) {
844
+ console.error("confirm(): no <DialogHost /> is mounted, so nothing was asked; treating it as no.");
845
+ return Promise.resolve(false);
846
+ }
847
+ return new Promise((resolve) => ask({ id: 0, kind: "confirm", options, settle: resolve }));
848
+ }
849
+ function prompt(options) {
850
+ if (hosts === 0) {
851
+ console.error("prompt(): no <DialogHost /> is mounted, so nothing was asked; treating it as cancelled.");
852
+ return Promise.resolve(null);
853
+ }
854
+ return new Promise((resolve) => ask({ id: 0, kind: "prompt", options, settle: resolve }));
855
+ }
856
+ function subscribe(listener) {
857
+ listeners.add(listener);
858
+ hosts++;
859
+ return () => {
860
+ listeners.delete(listener);
861
+ hosts--;
862
+ };
863
+ }
864
+ var current = () => queue[0] ?? null;
865
+ var none = () => null;
866
+ function PromptBody({ ask: a }) {
867
+ const o = a.options;
868
+ const [value, setValue] = react.useState(o.defaultValue ?? "");
869
+ const [error, setError] = react.useState(null);
870
+ const submit = (e) => {
871
+ e.preventDefault();
872
+ if (o.minLength && value.length < o.minLength) {
873
+ setError(`At least ${o.minLength} characters.`);
874
+ return;
875
+ }
876
+ const refused = o.validate?.(value);
877
+ if (refused) {
878
+ setError(refused);
879
+ return;
880
+ }
881
+ a.settle(value);
882
+ done();
883
+ };
884
+ return /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: submit, noValidate: true, children: [
885
+ /* @__PURE__ */ jsxRuntime.jsx(Field, { label: o.label ?? "Your answer", hint: o.hint, error, children: /* @__PURE__ */ jsxRuntime.jsx(
886
+ Input,
887
+ {
888
+ autoFocus: true,
889
+ type: o.secret ? "password" : "text",
890
+ autoComplete: o.secret ? "new-password" : "off",
891
+ placeholder: o.placeholder,
892
+ value,
893
+ onChange: (e) => {
894
+ setValue(e.target.value);
895
+ setError(null);
896
+ }
897
+ }
898
+ ) }),
899
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogFooter, { children: [
900
+ /* @__PURE__ */ jsxRuntime.jsx(
901
+ Button,
902
+ {
903
+ variant: "secondary",
904
+ onClick: () => {
905
+ a.settle(null);
906
+ done();
907
+ },
908
+ children: o.cancelLabel ?? "Cancel"
909
+ }
910
+ ),
911
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { type: "submit", variant: o.destructive ? "danger" : "primary", children: o.confirmLabel ?? "Continue" })
912
+ ] })
913
+ ] });
914
+ }
915
+ function DialogHost() {
916
+ const a = react.useSyncExternalStore(subscribe, current, none);
917
+ const cancel = () => {
918
+ if (!a) return;
919
+ if (a.kind === "confirm") a.settle(false);
920
+ else a.settle(null);
921
+ done();
922
+ };
923
+ return /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: a !== null, onOpenChange: (open) => open ? void 0 : cancel(), children: a ? /* @__PURE__ */ jsxRuntime.jsxs(
924
+ DialogContent,
925
+ {
926
+ role: "alertdialog",
927
+ ...a.options.message ? {} : { "aria-describedby": void 0 },
928
+ className: "w-[min(92vw,28rem)]",
929
+ children: [
930
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { children: [
931
+ /* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { children: a.options.title }),
932
+ a.options.message ? /* @__PURE__ */ jsxRuntime.jsx(DialogDescription, { children: a.options.message }) : null
933
+ ] }),
934
+ a.kind === "prompt" ? (
935
+ // Keyed by the ask, so a second prompt starts empty.
936
+ /* @__PURE__ */ jsxRuntime.jsx(PromptBody, { ask: a }, a.id)
937
+ ) : /* @__PURE__ */ jsxRuntime.jsxs(DialogFooter, { children: [
938
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "secondary", onClick: cancel, children: a.options.cancelLabel ?? "Cancel" }),
939
+ /* @__PURE__ */ jsxRuntime.jsx(
940
+ Button,
941
+ {
942
+ variant: a.options.destructive ? "danger" : "primary",
943
+ onClick: () => {
944
+ a.settle(true);
945
+ done();
946
+ },
947
+ children: a.options.confirmLabel ?? "Continue"
948
+ }
949
+ )
950
+ ] })
951
+ ]
952
+ }
953
+ ) : null });
954
+ }
955
+ var N = new Intl.NumberFormat("en-US");
956
+ function Pagination({
957
+ pageIndex,
958
+ pageSize,
959
+ total,
960
+ onPage,
961
+ label = "Pages",
962
+ className
963
+ }) {
964
+ const pages = Math.max(1, Math.ceil(total / pageSize));
965
+ const index = Math.min(Math.max(0, pageIndex), pages - 1);
966
+ if (index !== pageIndex && typeof process !== "undefined" && process.env.NODE_ENV !== "production") {
967
+ console.warn(`Pagination: pageIndex ${pageIndex} is outside 0\u2013${pages - 1}; it counts from 0.`);
968
+ }
969
+ if (total <= pageSize) return null;
970
+ const from = index * pageSize + 1;
971
+ const to = Math.min(total, (index + 1) * pageSize);
972
+ return /* @__PURE__ */ jsxRuntime.jsxs("nav", { "aria-label": label, className: cn("flex items-center justify-between gap-4", className), children: [
973
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { "aria-live": "polite", className: "oca-tabular text-[0.875rem] text-muted-foreground", children: [
974
+ N.format(from),
975
+ "\u2013",
976
+ N.format(to),
977
+ " of ",
978
+ N.format(total)
979
+ ] }),
980
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
981
+ /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "secondary", size: "sm", disabled: index === 0, onClick: () => onPage(index - 1), className: "pl-3", children: [
982
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { "aria-hidden": true }),
983
+ "Previous"
984
+ ] }),
985
+ /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "secondary", size: "sm", disabled: index >= pages - 1, onClick: () => onPage(index + 1), className: "pr-3", children: [
986
+ "Next",
987
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { "aria-hidden": true })
988
+ ] })
989
+ ] })
990
+ ] });
991
+ }
992
+ function QrCode({
993
+ value,
994
+ size = 200,
995
+ label,
996
+ className
997
+ }) {
998
+ const matrix = react.useMemo(() => {
999
+ try {
1000
+ return QRCode__default.default.create(value, { errorCorrectionLevel: "M" }).modules;
1001
+ } catch {
1002
+ return null;
1003
+ }
1004
+ }, [value]);
1005
+ const path = react.useMemo(() => {
1006
+ if (!matrix) return "";
1007
+ let d = "";
1008
+ for (let y = 0; y < matrix.size; y++) {
1009
+ for (let x = 0; x < matrix.size; x++) {
1010
+ if (matrix.get(y, x)) d += `M${x} ${y}h1v1h-1z`;
1011
+ }
1012
+ }
1013
+ return d;
1014
+ }, [matrix]);
1015
+ const short = value.length > 28 ? `${value.slice(0, 28)}\u2026` : value;
1016
+ return /* @__PURE__ */ jsxRuntime.jsx(
1017
+ "div",
1018
+ {
1019
+ role: "img",
1020
+ "aria-label": matrix ? label ?? `QR code for ${short}` : "Too long for a QR code",
1021
+ className: cn("inline-block shrink-0 rounded-2xl bg-white p-3 ring-1 ring-border", className),
1022
+ style: { width: size, height: size },
1023
+ children: matrix ? /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: `0 0 ${matrix.size} ${matrix.size}`, shapeRendering: "crispEdges", "aria-hidden": true, className: "block size-full", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: path, fill: "#0a0a0a" }) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { "aria-hidden": true, className: "flex size-full items-center justify-center text-center text-[0.8125rem] text-[#54585e]", children: "Too long for a QR code" })
1024
+ }
1025
+ );
1026
+ }
759
1027
 
760
1028
  Object.defineProperty(exports, "toast", {
761
1029
  enumerable: true,
762
1030
  get: function () { return sonner.toast; }
763
1031
  });
1032
+ exports.Accordion = Accordion;
1033
+ exports.AccordionItem = AccordionItem;
764
1034
  exports.Badge = Badge;
765
1035
  exports.Button = Button;
766
1036
  exports.Card = Card;
@@ -777,6 +1047,7 @@ exports.DialogContent = DialogContent;
777
1047
  exports.DialogDescription = DialogDescription;
778
1048
  exports.DialogFooter = DialogFooter;
779
1049
  exports.DialogHeader = DialogHeader;
1050
+ exports.DialogHost = DialogHost;
780
1051
  exports.DialogTitle = DialogTitle;
781
1052
  exports.DialogTrigger = DialogTrigger;
782
1053
  exports.DropdownMenu = DropdownMenu;
@@ -790,10 +1061,12 @@ exports.Field = Field;
790
1061
  exports.Input = Input;
791
1062
  exports.Kbd = Kbd;
792
1063
  exports.Label = Label;
1064
+ exports.Pagination = Pagination;
793
1065
  exports.Popover = Popover;
794
1066
  exports.PopoverAnchor = PopoverAnchor;
795
1067
  exports.PopoverContent = PopoverContent;
796
1068
  exports.PopoverTrigger = PopoverTrigger;
1069
+ exports.QrCode = QrCode;
797
1070
  exports.RadioGroup = RadioGroup;
798
1071
  exports.RadioGroupItem = RadioGroupItem;
799
1072
  exports.ScrollFade = ScrollFade;
@@ -812,6 +1085,7 @@ exports.SheetTitle = SheetTitle;
812
1085
  exports.SheetTrigger = SheetTrigger;
813
1086
  exports.Skeleton = Skeleton;
814
1087
  exports.Spinner = Spinner;
1088
+ exports.StatusBadge = StatusBadge;
815
1089
  exports.StatusDot = StatusDot;
816
1090
  exports.StatusPill = StatusPill;
817
1091
  exports.Switch = Switch;
@@ -829,6 +1103,9 @@ exports.badgeVariants = badgeVariants;
829
1103
  exports.buttonVariants = buttonVariants;
830
1104
  exports.cardVariants = cardVariants;
831
1105
  exports.cn = cn;
1106
+ exports.confirm = confirm;
1107
+ exports.prompt = prompt;
1108
+ exports.statusWord = statusWord;
832
1109
  exports.useTimedOut = useTimedOut;
833
1110
  //# sourceMappingURL=primitives.js.map
834
1111
  //# sourceMappingURL=primitives.js.map