@krak-stack/registry 0.10.0 → 0.10.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krak-stack/registry",
3
- "version": "0.10.0",
3
+ "version": "0.10.2",
4
4
  "description": "Tree-shakable KrakStack components and Effect services.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -85,9 +85,9 @@
85
85
  "types": "./dist/components/ui/app-switcher.d.ts",
86
86
  "import": "./dist/components/ui/app-switcher.js"
87
87
  },
88
- "./secret-value": {
89
- "types": "./dist/components/ui/secret-value.d.ts",
90
- "import": "./dist/components/ui/secret-value.js"
88
+ "./copy-value": {
89
+ "types": "./dist/components/ui/copy-value.d.ts",
90
+ "import": "./dist/components/ui/copy-value.js"
91
91
  },
92
92
  "./bulk-list-input": {
93
93
  "types": "./dist/components/ui/bulk-list-input.d.ts",
@@ -213,6 +213,10 @@
213
213
  "types": "./dist/lib/docs.server.d.ts",
214
214
  "import": "./dist/lib/docs.server.js"
215
215
  },
216
+ "./docs/integrations": {
217
+ "types": "./dist/lib/docs.integrations.server.d.ts",
218
+ "import": "./dist/lib/docs.integrations.server.js"
219
+ },
216
220
  "./documentation-toolkit": {
217
221
  "types": "./dist/lib/documentation-toolkit.d.ts",
218
222
  "import": "./dist/lib/documentation-toolkit.js"
@@ -420,8 +424,8 @@
420
424
  "cn": "^0.3.0",
421
425
  "drizzle-orm": "^1.0.0-rc.4-5d5b77c",
422
426
  "effect": "^4.1.0",
423
- "lucide-react": "^1.18.0",
424
427
  "libphonenumber-js": "^1.13.16",
428
+ "lucide-react": "^1.18.0",
425
429
  "motion": "^14.12.0",
426
430
  "react": "^19.2.0",
427
431
  "react-dom": "^19.2.0"
@@ -1,222 +0,0 @@
1
- // ../../src/components/ui/secret-value.tsx
2
- import { Eye, EyeOff } from "lucide-react";
3
- import { useEffect as useEffect2, useState as useState2 } from "react";
4
-
5
- // ../../src/components/ui/button.tsx
6
- import { Button as ButtonPrimitive } from "@base-ui/react/button";
7
- import { cva } from "class-variance-authority";
8
-
9
- // ../../src/lib/utils.ts
10
- import { cn } from "cn";
11
-
12
- // ../../src/components/ui/button.tsx
13
- import { jsx } from "react/jsx-runtime";
14
- var buttonVariants = cva("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 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", {
15
- variants: {
16
- variant: {
17
- default: "bg-primary text-primary-foreground hover:bg-primary/80",
18
- outline: "border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
19
- secondary: "bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
20
- ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
21
- destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
22
- link: "text-primary underline-offset-4 hover:underline"
23
- },
24
- size: {
25
- default: "h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
26
- xs: "h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
27
- sm: "h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",
28
- lg: "h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
29
- icon: "size-9",
30
- "icon-xs": "size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3",
31
- "icon-sm": "size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md",
32
- "icon-lg": "size-10"
33
- }
34
- },
35
- defaultVariants: {
36
- variant: "default",
37
- size: "default"
38
- }
39
- });
40
- function Button({
41
- className,
42
- variant = "default",
43
- size = "default",
44
- ...props
45
- }) {
46
- return /* @__PURE__ */ jsx(ButtonPrimitive, {
47
- "data-slot": "button",
48
- className: cn(buttonVariants({ variant, size, className })),
49
- ...props
50
- });
51
- }
52
-
53
- // ../../src/components/ui/copy-button.tsx
54
- import { Check, Copy, TriangleAlert } from "lucide-react";
55
- import { useEffect, useRef, useState } from "react";
56
- import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider";
57
- import { jsx as jsx2, jsxs } from "react/jsx-runtime";
58
- var messages = {
59
- en: { copy: "Copy", copied: "Copied", copyFailed: "Copy failed" },
60
- fr: { copy: "Copier", copied: "Copié", copyFailed: "Échec de la copie" }
61
- };
62
- var copyButtonMessages = (locale = "en", translations) => ({
63
- ...locale.startsWith("fr") ? messages.fr : messages.en,
64
- ...translations?.[locale.split("-")[0] ?? locale],
65
- ...translations?.[locale]
66
- });
67
- function CopyButton({
68
- value,
69
- valueDescription,
70
- copyVariant = "default",
71
- locale: localeOverride,
72
- messages,
73
- onCopied,
74
- onCopyError,
75
- resetDelay = 1500,
76
- disabled,
77
- size,
78
- "aria-label": ariaLabel,
79
- ...props
80
- }) {
81
- const locale = useKrakstackLocale(localeOverride);
82
- const [copyState, setCopyState] = useState("idle");
83
- const copyTimeout = useRef(undefined);
84
- const labels = copyButtonMessages(locale, messages);
85
- const accessibleLabel = ariaLabel ?? (valueDescription ? `${labels.copy} ${valueDescription}` : labels.copy);
86
- const isLarge = copyVariant === "large";
87
- const defaultSize = copyVariant === "sm" ? "icon-xs" : isLarge ? "sm" : "icon-sm";
88
- useEffect(() => {
89
- return () => {
90
- if (copyTimeout.current)
91
- clearTimeout(copyTimeout.current);
92
- };
93
- }, []);
94
- const resetCopyState = () => {
95
- if (copyTimeout.current)
96
- clearTimeout(copyTimeout.current);
97
- copyTimeout.current = setTimeout(() => setCopyState("idle"), resetDelay);
98
- };
99
- const copy = async () => {
100
- try {
101
- await navigator.clipboard.writeText(value);
102
- setCopyState("copied");
103
- onCopied?.();
104
- } catch (error) {
105
- setCopyState("failed");
106
- onCopyError?.(error instanceof Error ? error : new Error(labels.copyFailed, { cause: error }));
107
- }
108
- resetCopyState();
109
- };
110
- const status = copyState === "copied" ? valueDescription ? `${labels.copied}: ${valueDescription}` : labels.copied : copyState === "failed" ? valueDescription ? `${labels.copyFailed}: ${valueDescription}` : labels.copyFailed : "";
111
- return /* @__PURE__ */ jsxs(Button, {
112
- "aria-label": accessibleLabel,
113
- disabled,
114
- onClick: copy,
115
- size: size ?? defaultSize,
116
- ...props,
117
- children: [
118
- /* @__PURE__ */ jsx2("span", {
119
- "aria-live": "polite",
120
- className: "sr-only",
121
- role: "status",
122
- children: status
123
- }),
124
- copyState === "copied" ? /* @__PURE__ */ jsx2(Check, {
125
- "aria-hidden": "true"
126
- }) : null,
127
- copyState === "failed" ? /* @__PURE__ */ jsx2(TriangleAlert, {
128
- "aria-hidden": "true"
129
- }) : null,
130
- copyState === "idle" ? /* @__PURE__ */ jsx2(Copy, {
131
- "aria-hidden": "true"
132
- }) : null,
133
- isLarge ? /* @__PURE__ */ jsx2("span", {
134
- children: labels.copy
135
- }) : null
136
- ]
137
- });
138
- }
139
-
140
- // ../../src/components/ui/secret-value.tsx
141
- import { useKrakstackLocale as useKrakstackLocale2 } from "@krak-stack/registry/krakstack-provider";
142
- import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
143
- var labels = {
144
- en: { show: "Show", hide: "Hide", hidden: "Hidden value" },
145
- fr: { show: "Afficher", hide: "Masquer", hidden: "Valeur masquée" }
146
- };
147
- var SecretValue = ({
148
- value,
149
- label,
150
- disabled,
151
- copyable = true,
152
- autoHideDelay = 0,
153
- className,
154
- locale: override,
155
- messages,
156
- copyMessages
157
- }) => {
158
- const locale = useKrakstackLocale2(override);
159
- const copy = {
160
- ...locale.startsWith("fr") ? labels.fr : labels.en,
161
- ...messages?.[locale.split("-")[0] ?? locale],
162
- ...messages?.[locale]
163
- };
164
- const [revealedValue, setRevealedValue] = useState2(null);
165
- const [previous, setPrevious] = useState2({ value, disabled });
166
- if (previous.value !== value || previous.disabled !== disabled) {
167
- setPrevious({ value, disabled });
168
- setRevealedValue(null);
169
- }
170
- const revealed = !disabled && revealedValue === value;
171
- useEffect2(() => {
172
- if (!revealed || autoHideDelay <= 0)
173
- return;
174
- const timer = setTimeout(() => setRevealedValue(null), autoHideDelay);
175
- return () => clearTimeout(timer);
176
- }, [revealed, autoHideDelay, value]);
177
- return /* @__PURE__ */ jsxs2("div", {
178
- "data-slot": "secret-value",
179
- "data-state": revealed ? "revealed" : "hidden",
180
- "data-disabled": disabled || undefined,
181
- className: cn("flex min-w-0 items-center gap-2", className),
182
- children: [
183
- /* @__PURE__ */ jsx3("code", {
184
- "data-slot": "secret-value-content",
185
- className: "min-w-0 flex-1 text-sm break-all",
186
- "aria-label": revealed ? undefined : `${label}: ${copy.hidden}`,
187
- children: revealed ? value : /* @__PURE__ */ jsx3("span", {
188
- "aria-hidden": "true",
189
- children: "••••••••"
190
- })
191
- }),
192
- /* @__PURE__ */ jsx3(Button, {
193
- "data-component": "secret-value-toggle",
194
- type: "button",
195
- size: "icon-sm",
196
- variant: "ghost",
197
- disabled,
198
- "aria-label": `${revealed ? copy.hide : copy.show} ${label}`,
199
- "aria-pressed": revealed,
200
- onClick: () => setRevealedValue(revealed ? null : value),
201
- children: revealed ? /* @__PURE__ */ jsx3(EyeOff, {
202
- "aria-hidden": "true"
203
- }) : /* @__PURE__ */ jsx3(Eye, {
204
- "aria-hidden": "true"
205
- })
206
- }),
207
- copyable ? /* @__PURE__ */ jsx3(CopyButton, {
208
- "data-component": "secret-value-copy",
209
- type: "button",
210
- value,
211
- valueDescription: label,
212
- disabled,
213
- variant: "ghost",
214
- locale,
215
- messages: copyMessages
216
- }) : null
217
- ]
218
- });
219
- };
220
- export {
221
- SecretValue
222
- };