@krak-stack/registry 0.1.60 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/components/ui/app-brand.js +17 -17
- package/dist/components/ui/code-block.js +6 -6
- package/dist/components/ui/color-picker.d.ts +30 -0
- package/dist/components/ui/color-picker.js +386 -0
- package/dist/components/ui/copy-button.js +4 -4
- package/dist/components/ui/data-table.js +468 -455
- package/dist/components/ui/editing-locale-switcher.js +10 -10
- package/dist/components/ui/effect-form.js +186 -185
- package/dist/components/ui/error-component.js +10 -18
- package/dist/components/ui/file-picker.js +2 -2
- package/dist/components/ui/form.d.ts +131 -335
- package/dist/components/ui/form.js +137 -136
- package/dist/components/ui/google-map.js +38 -6
- package/dist/components/ui/icon-input.js +48 -45
- package/dist/components/ui/krakstack-provider.js +2 -2
- package/dist/components/ui/locale-switcher.js +4 -4
- package/dist/components/ui/pagination.js +2 -2
- package/dist/components/ui/search-menu.js +2 -2
- package/dist/components/ui/sidebar-layout.js +82 -80
- package/dist/components/ui/theme-switcher.js +6 -6
- package/dist/components/ui/virtualized-combobox.js +34 -31
- package/dist/lib/docs.d.ts +2 -2
- package/dist/lib/docs.js +187 -185
- package/dist/lib/docs.server.js +45 -23
- package/dist/lib/documentation-toolkit.d.ts +2 -2
- package/dist/lib/documentation-toolkit.js +45 -23
- package/dist/lib/httpapi-adapter.d.ts +11 -3
- package/dist/lib/httpapi-adapter.js +42 -15
- package/dist/lib/httpapi-cli.d.ts +13 -4
- package/dist/lib/httpapi-cli.js +70 -28
- package/dist/lib/httpapi-toolkit.js +40 -13
- package/dist/lib/query.d.ts +4 -4
- package/dist/lib/query.js +13 -13
- package/dist/lib/seo.js +2 -2
- package/dist/lib/webfetch-toolkit.js +7 -7
- package/dist/oxlint/anti-slop/index.js +2 -2
- package/dist/services/agent/client/index.js +155 -153
- package/dist/services/agent/index.js +3 -3
- package/dist/services/agent/schema.js +5 -5
- package/dist/services/events/browser.js +38 -23
- package/dist/services/events/client/audit-log-table.js +472 -459
- package/dist/services/events/client/tracking-notice.js +9 -4
- package/dist/services/events/index.d.ts +3 -1
- package/dist/services/events/index.js +79 -74
- package/dist/services/events/migrations.js +2 -2
- package/dist/services/events/record.js +2 -2
- package/dist/services/events/schema.d.ts +18 -10
- package/dist/services/events/schema.js +42 -42
- package/dist/services/file-extraction/index.js +4 -4
- package/dist/services/file-extraction/schema.d.ts +3 -1
- package/dist/services/file-extraction/schema.js +2 -2
- package/dist/services/health/api.builder.d.ts +8 -8
- package/dist/services/health/api.group.d.ts +8 -8
- package/dist/services/health/index.d.ts +10 -6
- package/dist/services/health/index.js +17 -13
- package/dist/services/health/schema.d.ts +7 -7
- package/dist/services/notification/channels/ses/index.js +2 -2
- package/dist/services/notification/channels/ses/schema.js +2 -2
- package/dist/services/notification/client/index.js +5 -5
- package/dist/services/notification/index.js +3 -3
- package/dist/services/notification/persistence/drizzle.js +2 -2
- package/dist/services/notification/persistence/index.js +15 -15
- package/dist/services/notification/persistence/schema.js +12 -12
- package/dist/services/notification/public.js +8 -8
- package/dist/services/notification/schema.d.ts +3 -1
- package/dist/services/notification/schema.js +2 -2
- package/dist/services/opentelemetry/api.js +7 -5
- package/dist/services/opentelemetry/browser.js +9 -9
- package/dist/services/opentelemetry/index.js +2 -2
- package/dist/services/opentelemetry/processor.d.ts +3 -1
- package/dist/services/opentelemetry/web-vitals.js +12 -7
- package/dist/services/s3/index.js +2 -2
- package/dist/services/s3/schema.d.ts +3 -1
- package/dist/services/s3/schema.js +2 -2
- package/dist/services/speech/api.js +3 -1
- package/dist/services/speech/index.js +15 -8
- package/dist/services/speech/schema.d.ts +3 -1
- package/dist/services/speech/schema.js +12 -10
- package/dist/services/webhooks/client/delivery-table.d.ts +62 -0
- package/dist/services/webhooks/client/delivery-table.js +4711 -0
- package/dist/services/webhooks/http-client.d.ts +1 -0
- package/dist/services/webhooks/http-client.js +17 -5
- package/dist/services/webhooks/index.d.ts +2 -0
- package/dist/services/webhooks/index.js +249 -114
- package/dist/services/webhooks/migrations.d.ts +3 -0
- package/dist/services/webhooks/migrations.js +21 -2
- package/dist/services/webhooks/receiver.d.ts +45 -0
- package/dist/services/webhooks/schema.d.ts +15 -5
- package/dist/services/webhooks/schema.js +41 -21
- package/dist/services/webhooks/url.d.ts +5 -0
- package/dist/services/webhooks/url.js +18 -2
- package/package.json +10 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @krak-stack/registry
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 777c616: Add a localized ColorPicker with HEX entry, a live swatch, and a color-selection popover.
|
|
8
|
+
|
|
9
|
+
## 0.1.61
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 9ea9e42: Sign the stable webhook-id header with the timestamp and raw body, and use it automatically for transactional receiver deduplication. Remove the receiver eventId extraction callback. This changes the signature protocol; senders and receivers must upgrade together. Legacy timestamp/body signatures are rejected.
|
|
14
|
+
|
|
15
|
+
- 7fcaf6f: Add WebhooksReceiver with HMAC verification, timestamp checks, schema validation, and transactional receipt deduplication. Receiver-only applications migrate only receipt storage and do not start outbound workers.
|
|
16
|
+
- 9ea9e42: Add `@krak-stack/registry/webhooks/client` with a shared delivery activity table, failed-attempt status, retry details, JSON inspection, localized labels, and application-owned links.
|
|
17
|
+
|
|
3
18
|
## 0.1.60
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -53,38 +53,38 @@ function AppBrand(brandProps) {
|
|
|
53
53
|
].filter(Boolean).join(" ");
|
|
54
54
|
if (isStaticBrand(brandProps)) {
|
|
55
55
|
const {
|
|
56
|
-
className:
|
|
57
|
-
label:
|
|
58
|
-
subtitle:
|
|
59
|
-
icon:
|
|
60
|
-
imageSrc:
|
|
61
|
-
variant:
|
|
56
|
+
className: _className2,
|
|
57
|
+
label: _label2,
|
|
58
|
+
subtitle: _subtitle2,
|
|
59
|
+
icon: _icon2,
|
|
60
|
+
imageSrc: _imageSrc2,
|
|
61
|
+
variant: _variant2,
|
|
62
62
|
to: _to,
|
|
63
|
-
href:
|
|
64
|
-
...
|
|
63
|
+
href: _href2,
|
|
64
|
+
...props2
|
|
65
65
|
} = brandProps;
|
|
66
66
|
return /* @__PURE__ */ jsx("div", {
|
|
67
67
|
className: brandClassName,
|
|
68
|
-
...
|
|
68
|
+
...props2,
|
|
69
69
|
children: content
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
if (isAnchorBrand(brandProps)) {
|
|
73
73
|
const {
|
|
74
|
-
className:
|
|
75
|
-
label:
|
|
76
|
-
subtitle:
|
|
77
|
-
icon:
|
|
78
|
-
imageSrc:
|
|
79
|
-
variant:
|
|
74
|
+
className: _className2,
|
|
75
|
+
label: _label2,
|
|
76
|
+
subtitle: _subtitle2,
|
|
77
|
+
icon: _icon2,
|
|
78
|
+
imageSrc: _imageSrc2,
|
|
79
|
+
variant: _variant2,
|
|
80
80
|
to: _to,
|
|
81
81
|
href,
|
|
82
|
-
...
|
|
82
|
+
...props2
|
|
83
83
|
} = brandProps;
|
|
84
84
|
return /* @__PURE__ */ jsx("a", {
|
|
85
85
|
className: brandClassName,
|
|
86
86
|
href,
|
|
87
|
-
...
|
|
87
|
+
...props2,
|
|
88
88
|
children: content
|
|
89
89
|
});
|
|
90
90
|
}
|
|
@@ -65,7 +65,7 @@ function CopyButton({
|
|
|
65
65
|
valueDescription,
|
|
66
66
|
copyVariant = "default",
|
|
67
67
|
locale: localeOverride,
|
|
68
|
-
messages,
|
|
68
|
+
messages: messages2,
|
|
69
69
|
onCopied,
|
|
70
70
|
onCopyError,
|
|
71
71
|
resetDelay = 1500,
|
|
@@ -77,7 +77,7 @@ function CopyButton({
|
|
|
77
77
|
const locale = useKrakstackLocale(localeOverride);
|
|
78
78
|
const [copyState, setCopyState] = useState("idle");
|
|
79
79
|
const copyTimeout = useRef(undefined);
|
|
80
|
-
const labels = copyButtonMessages(locale,
|
|
80
|
+
const labels = copyButtonMessages(locale, messages2);
|
|
81
81
|
const accessibleLabel = ariaLabel ?? (valueDescription ? `${labels.copy} ${valueDescription}` : labels.copy);
|
|
82
82
|
const isLarge = copyVariant === "large";
|
|
83
83
|
const defaultSize = copyVariant === "sm" ? "icon-xs" : isLarge ? "sm" : "icon-sm";
|
|
@@ -179,12 +179,12 @@ function CodeBlock({
|
|
|
179
179
|
code,
|
|
180
180
|
language = "text",
|
|
181
181
|
locale: localeOverride,
|
|
182
|
-
messages
|
|
182
|
+
messages: messages3
|
|
183
183
|
}) {
|
|
184
184
|
const locale = useKrakstackLocale2(localeOverride);
|
|
185
185
|
const normalizedLanguage = language.toLowerCase() || "text";
|
|
186
186
|
const highlighted = highlight(code, { lang: normalizedLanguage });
|
|
187
|
-
const labels = codeBlockMessages(locale,
|
|
187
|
+
const labels = codeBlockMessages(locale, messages3);
|
|
188
188
|
return /* @__PURE__ */ jsxs2("div", {
|
|
189
189
|
className: "not-prose bg-muted overflow-hidden rounded-md border text-[var(--th-token)]",
|
|
190
190
|
"data-code-theme": true,
|
|
@@ -216,6 +216,6 @@ function CodeBlock({
|
|
|
216
216
|
});
|
|
217
217
|
}
|
|
218
218
|
export {
|
|
219
|
-
|
|
220
|
-
|
|
219
|
+
codeBlockMessages,
|
|
220
|
+
CodeBlock
|
|
221
221
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type ComponentProps } from "react";
|
|
2
|
+
declare const labels: {
|
|
3
|
+
en: {
|
|
4
|
+
input: string;
|
|
5
|
+
open: string;
|
|
6
|
+
saturation: string;
|
|
7
|
+
hue: string;
|
|
8
|
+
saturationValue: string;
|
|
9
|
+
brightnessValue: string;
|
|
10
|
+
};
|
|
11
|
+
fr: {
|
|
12
|
+
input: string;
|
|
13
|
+
open: string;
|
|
14
|
+
saturation: string;
|
|
15
|
+
hue: string;
|
|
16
|
+
saturationValue: string;
|
|
17
|
+
brightnessValue: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export type ColorPickerMessages = Record<keyof typeof labels.en, string>;
|
|
21
|
+
export type ColorPickerMessageTranslations = Partial<Record<string, Partial<ColorPickerMessages>>>;
|
|
22
|
+
export type ColorPickerProps = Omit<ComponentProps<"input">, "value" | "defaultValue" | "onChange" | "type" | "size"> & {
|
|
23
|
+
value?: string;
|
|
24
|
+
defaultValue?: string;
|
|
25
|
+
onValueChange?: (value: string) => void;
|
|
26
|
+
locale?: string;
|
|
27
|
+
messages?: ColorPickerMessageTranslations;
|
|
28
|
+
};
|
|
29
|
+
export declare const ColorPicker: ({ value, defaultValue, onValueChange, locale: localeOverride, messages, className, disabled, readOnly, onBlur, onKeyDown, "aria-label": ariaLabel, "aria-invalid": ariaInvalid, ...inputProps }: ColorPickerProps) => import("react").JSX.Element;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
// ../../src/components/ui/color-picker.tsx
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
import { HexColorPicker } from "react-colorful";
|
|
5
|
+
|
|
6
|
+
// ../../src/components/ui/input-group.tsx
|
|
7
|
+
import { cva as cva2 } from "class-variance-authority";
|
|
8
|
+
|
|
9
|
+
// ../../src/components/ui/button.tsx
|
|
10
|
+
import { Button as ButtonPrimitive } from "@base-ui/react/button";
|
|
11
|
+
import { cva } from "class-variance-authority";
|
|
12
|
+
|
|
13
|
+
// ../../src/lib/utils.ts
|
|
14
|
+
import { cn } from "cn";
|
|
15
|
+
|
|
16
|
+
// ../../src/components/ui/button.tsx
|
|
17
|
+
import { jsx } from "react/jsx-runtime";
|
|
18
|
+
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", {
|
|
19
|
+
variants: {
|
|
20
|
+
variant: {
|
|
21
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/80",
|
|
22
|
+
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",
|
|
23
|
+
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",
|
|
24
|
+
ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
|
|
25
|
+
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",
|
|
26
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
27
|
+
},
|
|
28
|
+
size: {
|
|
29
|
+
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",
|
|
30
|
+
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",
|
|
31
|
+
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",
|
|
32
|
+
lg: "h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
33
|
+
icon: "size-9",
|
|
34
|
+
"icon-xs": "size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3",
|
|
35
|
+
"icon-sm": "size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md",
|
|
36
|
+
"icon-lg": "size-10"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
defaultVariants: {
|
|
40
|
+
variant: "default",
|
|
41
|
+
size: "default"
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
function Button({
|
|
45
|
+
className,
|
|
46
|
+
variant = "default",
|
|
47
|
+
size = "default",
|
|
48
|
+
...props
|
|
49
|
+
}) {
|
|
50
|
+
return /* @__PURE__ */ jsx(ButtonPrimitive, {
|
|
51
|
+
"data-slot": "button",
|
|
52
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
53
|
+
...props
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// ../../src/components/ui/input.tsx
|
|
58
|
+
import { Input as InputPrimitive } from "@base-ui/react/input";
|
|
59
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
60
|
+
function Input({ className, type, ...props }) {
|
|
61
|
+
return /* @__PURE__ */ jsx2(InputPrimitive, {
|
|
62
|
+
type,
|
|
63
|
+
"data-slot": "input",
|
|
64
|
+
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),
|
|
65
|
+
...props
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// ../../src/components/ui/textarea.tsx
|
|
70
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
71
|
+
|
|
72
|
+
// ../../src/components/ui/input-group.tsx
|
|
73
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
74
|
+
function InputGroup({ className, ...props }) {
|
|
75
|
+
return /* @__PURE__ */ jsx4("div", {
|
|
76
|
+
"data-slot": "input-group",
|
|
77
|
+
role: "group",
|
|
78
|
+
className: cn("group/input-group relative flex h-9 w-full min-w-0 items-center rounded-md border border-input shadow-xs transition-[color,box-shadow] outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5", className),
|
|
79
|
+
...props
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
var inputGroupAddonVariants = cva2("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4", {
|
|
83
|
+
variants: {
|
|
84
|
+
align: {
|
|
85
|
+
"inline-start": "order-first pl-2 has-[>button]:-ml-1 has-[>kbd]:ml-[-0.15rem]",
|
|
86
|
+
"inline-end": "order-last pr-2 has-[>button]:-mr-1 has-[>kbd]:mr-[-0.15rem]",
|
|
87
|
+
"block-start": "order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2",
|
|
88
|
+
"block-end": "order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
defaultVariants: { align: "inline-start" }
|
|
92
|
+
});
|
|
93
|
+
function InputGroupAddon({
|
|
94
|
+
className,
|
|
95
|
+
align = "inline-start",
|
|
96
|
+
...props
|
|
97
|
+
}) {
|
|
98
|
+
return /* @__PURE__ */ jsx4("div", {
|
|
99
|
+
role: "group",
|
|
100
|
+
"data-slot": "input-group-addon",
|
|
101
|
+
"data-align": align,
|
|
102
|
+
className: cn(inputGroupAddonVariants({ align }), className),
|
|
103
|
+
onClick: (event) => {
|
|
104
|
+
if (event.target instanceof HTMLElement && event.target.closest("button")) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
event.currentTarget.parentElement?.querySelector("input")?.focus();
|
|
108
|
+
},
|
|
109
|
+
...props
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
var inputGroupButtonVariants = cva2("flex items-center gap-2 text-sm shadow-none", {
|
|
113
|
+
variants: {
|
|
114
|
+
size: {
|
|
115
|
+
xs: "h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",
|
|
116
|
+
sm: "",
|
|
117
|
+
"icon-xs": "size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0",
|
|
118
|
+
"icon-sm": "size-8 p-0 has-[>svg]:p-0"
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
defaultVariants: { size: "xs" }
|
|
122
|
+
});
|
|
123
|
+
function InputGroupButton({
|
|
124
|
+
className,
|
|
125
|
+
type = "button",
|
|
126
|
+
variant = "ghost",
|
|
127
|
+
size = "xs",
|
|
128
|
+
...props
|
|
129
|
+
}) {
|
|
130
|
+
return /* @__PURE__ */ jsx4(Button, {
|
|
131
|
+
type,
|
|
132
|
+
"data-size": size,
|
|
133
|
+
variant,
|
|
134
|
+
className: cn(inputGroupButtonVariants({ size }), className),
|
|
135
|
+
...props
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
function InputGroupInput({
|
|
139
|
+
className,
|
|
140
|
+
...props
|
|
141
|
+
}) {
|
|
142
|
+
return /* @__PURE__ */ jsx4(Input, {
|
|
143
|
+
"data-slot": "input-group-control",
|
|
144
|
+
className: cn("flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent", className),
|
|
145
|
+
...props
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// ../../src/components/ui/popover.tsx
|
|
150
|
+
import { Popover as PopoverPrimitive } from "@base-ui/react/popover";
|
|
151
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
152
|
+
function Popover({ ...props }) {
|
|
153
|
+
return /* @__PURE__ */ jsx5(PopoverPrimitive.Root, {
|
|
154
|
+
"data-slot": "popover",
|
|
155
|
+
...props
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
function PopoverTrigger({ ...props }) {
|
|
159
|
+
return /* @__PURE__ */ jsx5(PopoverPrimitive.Trigger, {
|
|
160
|
+
"data-slot": "popover-trigger",
|
|
161
|
+
...props
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
function PopoverContent({
|
|
165
|
+
className,
|
|
166
|
+
align = "center",
|
|
167
|
+
alignOffset = 0,
|
|
168
|
+
side = "bottom",
|
|
169
|
+
sideOffset = 4,
|
|
170
|
+
...props
|
|
171
|
+
}) {
|
|
172
|
+
return /* @__PURE__ */ jsx5(PopoverPrimitive.Portal, {
|
|
173
|
+
children: /* @__PURE__ */ jsx5(PopoverPrimitive.Positioner, {
|
|
174
|
+
align,
|
|
175
|
+
alignOffset,
|
|
176
|
+
side,
|
|
177
|
+
sideOffset,
|
|
178
|
+
className: "isolate z-50",
|
|
179
|
+
children: /* @__PURE__ */ jsx5(PopoverPrimitive.Popup, {
|
|
180
|
+
"data-slot": "popover-content",
|
|
181
|
+
className: cn("z-50 flex w-72 origin-(--transform-origin) flex-col gap-4 rounded-md bg-popover p-4 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 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),
|
|
182
|
+
...props
|
|
183
|
+
})
|
|
184
|
+
})
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
function PopoverTitle({ className, ...props }) {
|
|
188
|
+
return /* @__PURE__ */ jsx5(PopoverPrimitive.Title, {
|
|
189
|
+
"data-slot": "popover-title",
|
|
190
|
+
className: cn("font-medium", className),
|
|
191
|
+
...props
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// ../../src/components/ui/color-picker.tsx
|
|
196
|
+
import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider";
|
|
197
|
+
import { jsx as jsx6, jsxs } from "react/jsx-runtime";
|
|
198
|
+
var HexColor = Schema.String.check(Schema.isPattern(/^#?(?:[\da-f]{3}|[\da-f]{6})$/i)).annotate({
|
|
199
|
+
identifier: "HexColor"
|
|
200
|
+
});
|
|
201
|
+
var normalizeHex = (value) => {
|
|
202
|
+
const trimmed = value.trim();
|
|
203
|
+
if (!Schema.is(HexColor)(trimmed))
|
|
204
|
+
return;
|
|
205
|
+
const hex = trimmed.replace(/^#/, "");
|
|
206
|
+
return `#${(hex.length === 3 ? hex.split("").map((digit) => digit + digit).join("") : hex).toUpperCase()}`;
|
|
207
|
+
};
|
|
208
|
+
var labels = {
|
|
209
|
+
en: {
|
|
210
|
+
input: "HEX color",
|
|
211
|
+
open: "Choose color",
|
|
212
|
+
saturation: "Saturation and brightness",
|
|
213
|
+
hue: "Hue",
|
|
214
|
+
saturationValue: "Saturation",
|
|
215
|
+
brightnessValue: "Brightness"
|
|
216
|
+
},
|
|
217
|
+
fr: {
|
|
218
|
+
input: "Couleur HEX",
|
|
219
|
+
open: "Choisir une couleur",
|
|
220
|
+
saturation: "Saturation et luminosité",
|
|
221
|
+
hue: "Teinte",
|
|
222
|
+
saturationValue: "Saturation",
|
|
223
|
+
brightnessValue: "Luminosité"
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
var ColorPanel = ({
|
|
227
|
+
color,
|
|
228
|
+
onChange,
|
|
229
|
+
copy
|
|
230
|
+
}) => {
|
|
231
|
+
const ref = useRef(null);
|
|
232
|
+
const valueText = useRef({ raw: "", localized: "" });
|
|
233
|
+
useEffect(() => {
|
|
234
|
+
const panel = ref.current;
|
|
235
|
+
if (!panel)
|
|
236
|
+
return;
|
|
237
|
+
const localize = () => {
|
|
238
|
+
const saturation = panel.querySelector(".react-colorful__saturation [role=slider]");
|
|
239
|
+
const hue = panel.querySelector(".react-colorful__hue [role=slider]");
|
|
240
|
+
saturation?.setAttribute("aria-label", copy.saturation);
|
|
241
|
+
hue?.setAttribute("aria-label", copy.hue);
|
|
242
|
+
const text = saturation?.getAttribute("aria-valuetext");
|
|
243
|
+
if (text) {
|
|
244
|
+
const raw = text === valueText.current.localized ? valueText.current.raw : text;
|
|
245
|
+
const localized = raw.replace("Saturation", copy.saturationValue).replace("Brightness", copy.brightnessValue);
|
|
246
|
+
valueText.current = { raw, localized };
|
|
247
|
+
if (localized !== text)
|
|
248
|
+
saturation?.setAttribute("aria-valuetext", localized);
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
localize();
|
|
252
|
+
const observer = new MutationObserver(localize);
|
|
253
|
+
observer.observe(panel, {
|
|
254
|
+
subtree: true,
|
|
255
|
+
attributes: true,
|
|
256
|
+
attributeFilter: ["aria-valuetext"]
|
|
257
|
+
});
|
|
258
|
+
return () => observer.disconnect();
|
|
259
|
+
}, [copy.saturation, copy.hue, copy.saturationValue, copy.brightnessValue]);
|
|
260
|
+
return /* @__PURE__ */ jsx6("div", {
|
|
261
|
+
ref,
|
|
262
|
+
className: "[&_.react-colorful]:h-48 [&_.react-colorful]:w-full [&_.react-colorful__hue]:h-4 [&_.react-colorful__pointer]:size-5",
|
|
263
|
+
children: /* @__PURE__ */ jsx6(HexColorPicker, {
|
|
264
|
+
color,
|
|
265
|
+
onChange
|
|
266
|
+
})
|
|
267
|
+
});
|
|
268
|
+
};
|
|
269
|
+
var ColorPicker = ({
|
|
270
|
+
value,
|
|
271
|
+
defaultValue = "#2563EB",
|
|
272
|
+
onValueChange,
|
|
273
|
+
locale: localeOverride,
|
|
274
|
+
messages,
|
|
275
|
+
className,
|
|
276
|
+
disabled,
|
|
277
|
+
readOnly,
|
|
278
|
+
onBlur,
|
|
279
|
+
onKeyDown,
|
|
280
|
+
"aria-label": ariaLabel,
|
|
281
|
+
"aria-invalid": ariaInvalid,
|
|
282
|
+
...inputProps
|
|
283
|
+
}) => {
|
|
284
|
+
const locale = useKrakstackLocale(localeOverride);
|
|
285
|
+
const copy = {
|
|
286
|
+
...locale.startsWith("fr") ? labels.fr : labels.en,
|
|
287
|
+
...messages?.[locale.split("-")[0] ?? locale],
|
|
288
|
+
...messages?.[locale]
|
|
289
|
+
};
|
|
290
|
+
const [internalValue, setInternalValue] = useState(normalizeHex(defaultValue) ?? "#2563EB");
|
|
291
|
+
const color = normalizeHex(value ?? internalValue) ?? "#2563EB";
|
|
292
|
+
const [draft, setDraft] = useState(null);
|
|
293
|
+
const [previousValue, setPreviousValue] = useState(value);
|
|
294
|
+
const [open, setOpen] = useState(false);
|
|
295
|
+
if (previousValue !== value) {
|
|
296
|
+
setPreviousValue(value);
|
|
297
|
+
if (draft === null || normalizeHex(draft) !== normalizeHex(value ?? ""))
|
|
298
|
+
setDraft(null);
|
|
299
|
+
}
|
|
300
|
+
const commit = (next) => {
|
|
301
|
+
const normalized = normalizeHex(next);
|
|
302
|
+
if (!normalized)
|
|
303
|
+
return;
|
|
304
|
+
if (value === undefined)
|
|
305
|
+
setInternalValue(normalized);
|
|
306
|
+
if (normalized !== color)
|
|
307
|
+
onValueChange?.(normalized);
|
|
308
|
+
};
|
|
309
|
+
return /* @__PURE__ */ jsxs(Popover, {
|
|
310
|
+
open: open && !disabled && !readOnly,
|
|
311
|
+
onOpenChange: setOpen,
|
|
312
|
+
children: [
|
|
313
|
+
/* @__PURE__ */ jsxs(InputGroup, {
|
|
314
|
+
className,
|
|
315
|
+
"data-disabled": disabled || undefined,
|
|
316
|
+
children: [
|
|
317
|
+
/* @__PURE__ */ jsx6(InputGroupInput, {
|
|
318
|
+
...inputProps,
|
|
319
|
+
type: "text",
|
|
320
|
+
"aria-label": ariaLabel ?? copy.input,
|
|
321
|
+
"aria-invalid": ariaInvalid ?? (draft !== null && !normalizeHex(draft) ? true : undefined),
|
|
322
|
+
autoComplete: "off",
|
|
323
|
+
spellCheck: false,
|
|
324
|
+
disabled,
|
|
325
|
+
readOnly,
|
|
326
|
+
value: draft ?? color,
|
|
327
|
+
onChange: (event) => {
|
|
328
|
+
setDraft(event.target.value);
|
|
329
|
+
commit(event.target.value);
|
|
330
|
+
},
|
|
331
|
+
onBlur: (event) => {
|
|
332
|
+
setDraft(null);
|
|
333
|
+
onBlur?.(event);
|
|
334
|
+
},
|
|
335
|
+
onKeyDown: (event) => {
|
|
336
|
+
onKeyDown?.(event);
|
|
337
|
+
if (!event.defaultPrevented && (event.key === "Enter" || event.key === "Escape")) {
|
|
338
|
+
setDraft(null);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}),
|
|
342
|
+
/* @__PURE__ */ jsx6(InputGroupAddon, {
|
|
343
|
+
align: "inline-end",
|
|
344
|
+
children: /* @__PURE__ */ jsx6(PopoverTrigger, {
|
|
345
|
+
render: /* @__PURE__ */ jsx6(InputGroupButton, {
|
|
346
|
+
"aria-label": copy.open,
|
|
347
|
+
disabled: disabled || readOnly,
|
|
348
|
+
size: "icon-xs"
|
|
349
|
+
}),
|
|
350
|
+
children: /* @__PURE__ */ jsx6("span", {
|
|
351
|
+
"aria-hidden": "true",
|
|
352
|
+
className: "size-5 rounded-sm border border-black/15",
|
|
353
|
+
style: { backgroundColor: color }
|
|
354
|
+
})
|
|
355
|
+
})
|
|
356
|
+
})
|
|
357
|
+
]
|
|
358
|
+
}),
|
|
359
|
+
/* @__PURE__ */ jsxs(PopoverContent, {
|
|
360
|
+
align: "end",
|
|
361
|
+
className: "w-64 max-w-[calc(100vw-2rem)] gap-3 p-3",
|
|
362
|
+
children: [
|
|
363
|
+
/* @__PURE__ */ jsx6(PopoverTitle, {
|
|
364
|
+
className: "sr-only",
|
|
365
|
+
children: copy.open
|
|
366
|
+
}),
|
|
367
|
+
/* @__PURE__ */ jsx6(ColorPanel, {
|
|
368
|
+
color,
|
|
369
|
+
copy,
|
|
370
|
+
onChange: (next) => {
|
|
371
|
+
setDraft(null);
|
|
372
|
+
commit(next);
|
|
373
|
+
}
|
|
374
|
+
}),
|
|
375
|
+
/* @__PURE__ */ jsx6("output", {
|
|
376
|
+
className: "text-muted-foreground text-center font-mono text-xs",
|
|
377
|
+
children: color
|
|
378
|
+
})
|
|
379
|
+
]
|
|
380
|
+
})
|
|
381
|
+
]
|
|
382
|
+
});
|
|
383
|
+
};
|
|
384
|
+
export {
|
|
385
|
+
ColorPicker
|
|
386
|
+
};
|
|
@@ -65,7 +65,7 @@ function CopyButton({
|
|
|
65
65
|
valueDescription,
|
|
66
66
|
copyVariant = "default",
|
|
67
67
|
locale: localeOverride,
|
|
68
|
-
messages,
|
|
68
|
+
messages: messages2,
|
|
69
69
|
onCopied,
|
|
70
70
|
onCopyError,
|
|
71
71
|
resetDelay = 1500,
|
|
@@ -77,7 +77,7 @@ function CopyButton({
|
|
|
77
77
|
const locale = useKrakstackLocale(localeOverride);
|
|
78
78
|
const [copyState, setCopyState] = useState("idle");
|
|
79
79
|
const copyTimeout = useRef(undefined);
|
|
80
|
-
const labels = copyButtonMessages(locale,
|
|
80
|
+
const labels = copyButtonMessages(locale, messages2);
|
|
81
81
|
const accessibleLabel = ariaLabel ?? (valueDescription ? `${labels.copy} ${valueDescription}` : labels.copy);
|
|
82
82
|
const isLarge = copyVariant === "large";
|
|
83
83
|
const defaultSize = copyVariant === "sm" ? "icon-xs" : isLarge ? "sm" : "icon-sm";
|
|
@@ -133,6 +133,6 @@ function CopyButton({
|
|
|
133
133
|
});
|
|
134
134
|
}
|
|
135
135
|
export {
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
copyButtonMessages,
|
|
137
|
+
CopyButton
|
|
138
138
|
};
|