@krak-stack/registry 0.1.61 → 0.2.1
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 +12 -0
- package/dist/components/ui/color-picker.d.ts +30 -0
- package/dist/components/ui/color-picker.js +384 -0
- package/dist/components/ui/data-table.js +26 -14
- package/dist/components/ui/effect-form.js +2 -2
- package/dist/components/ui/error-component.js +4 -12
- package/dist/components/ui/form.d.ts +126 -330
- package/dist/components/ui/google-map.js +38 -6
- package/dist/components/ui/sidebar-layout.js +10 -13
- package/dist/lib/docs.d.ts +2 -2
- package/dist/lib/docs.js +16 -19
- package/dist/lib/docs.server.js +5 -5
- package/dist/lib/documentation-toolkit.d.ts +2 -2
- package/dist/lib/documentation-toolkit.js +4 -4
- package/dist/lib/httpapi-adapter.d.ts +11 -3
- package/dist/lib/httpapi-adapter.js +40 -13
- package/dist/lib/httpapi-cli.d.ts +13 -4
- package/dist/lib/httpapi-cli.js +63 -21
- package/dist/lib/httpapi-toolkit.js +40 -13
- package/dist/lib/query.d.ts +4 -4
- package/dist/lib/query.js +2 -2
- package/dist/lib/webfetch-toolkit.js +1 -1
- package/dist/services/agent/index.js +1 -1
- package/dist/services/events/browser.js +32 -17
- package/dist/services/events/client/audit-log-table.js +26 -14
- 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 +22 -17
- package/dist/services/events/schema.d.ts +18 -10
- package/dist/services/events/schema.js +3 -3
- package/dist/services/file-extraction/schema.d.ts +3 -1
- 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 +8 -4
- package/dist/services/health/schema.d.ts +7 -7
- package/dist/services/notification/index.js +1 -1
- package/dist/services/notification/public.js +1 -1
- package/dist/services/notification/schema.d.ts +3 -1
- package/dist/services/opentelemetry/api.js +5 -3
- package/dist/services/opentelemetry/browser.js +2 -2
- package/dist/services/opentelemetry/index.js +2 -2
- package/dist/services/opentelemetry/processor.d.ts +3 -1
- package/dist/services/opentelemetry/web-vitals.js +10 -5
- package/dist/services/s3/schema.d.ts +3 -1
- 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 +3 -1
- package/dist/services/webhooks/client/delivery-table.js +26 -14
- package/dist/services/webhooks/http-client.js +1 -1
- package/dist/services/webhooks/index.js +14 -14
- package/dist/services/webhooks/receiver.d.ts +6 -2
- package/dist/services/webhooks/schema.d.ts +7 -5
- package/dist/services/webhooks/schema.js +2 -2
- package/package.json +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @krak-stack/registry
|
|
2
2
|
|
|
3
|
+
## 0.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Keep the color picker panel full-width inside its popup, with even padding and a HEX value centered beneath it. Prevent react-colorful's injected styles from overriding panel, hue slider, and pointer dimensions.
|
|
8
|
+
|
|
9
|
+
## 0.2.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 777c616: Add a localized ColorPicker with HEX entry, a live swatch, and a color-selection popover.
|
|
14
|
+
|
|
3
15
|
## 0.1.61
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -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,384 @@
|
|
|
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/input-group.tsx
|
|
70
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
71
|
+
function InputGroup({ className, ...props }) {
|
|
72
|
+
return /* @__PURE__ */ jsx3("div", {
|
|
73
|
+
"data-slot": "input-group",
|
|
74
|
+
role: "group",
|
|
75
|
+
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),
|
|
76
|
+
...props
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
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", {
|
|
80
|
+
variants: {
|
|
81
|
+
align: {
|
|
82
|
+
"inline-start": "order-first pl-2 has-[>button]:-ml-1 has-[>kbd]:ml-[-0.15rem]",
|
|
83
|
+
"inline-end": "order-last pr-2 has-[>button]:-mr-1 has-[>kbd]:mr-[-0.15rem]",
|
|
84
|
+
"block-start": "order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2",
|
|
85
|
+
"block-end": "order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
defaultVariants: { align: "inline-start" }
|
|
89
|
+
});
|
|
90
|
+
function InputGroupAddon({
|
|
91
|
+
className,
|
|
92
|
+
align = "inline-start",
|
|
93
|
+
...props
|
|
94
|
+
}) {
|
|
95
|
+
return /* @__PURE__ */ jsx3("div", {
|
|
96
|
+
role: "group",
|
|
97
|
+
"data-slot": "input-group-addon",
|
|
98
|
+
"data-align": align,
|
|
99
|
+
className: cn(inputGroupAddonVariants({ align }), className),
|
|
100
|
+
onClick: (event) => {
|
|
101
|
+
if (event.target instanceof HTMLElement && event.target.closest("button")) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
event.currentTarget.parentElement?.querySelector("input")?.focus();
|
|
105
|
+
},
|
|
106
|
+
...props
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
var inputGroupButtonVariants = cva2("flex items-center gap-2 text-sm shadow-none", {
|
|
110
|
+
variants: {
|
|
111
|
+
size: {
|
|
112
|
+
xs: "h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",
|
|
113
|
+
sm: "",
|
|
114
|
+
"icon-xs": "size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0",
|
|
115
|
+
"icon-sm": "size-8 p-0 has-[>svg]:p-0"
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
defaultVariants: { size: "xs" }
|
|
119
|
+
});
|
|
120
|
+
function InputGroupButton({
|
|
121
|
+
className,
|
|
122
|
+
type = "button",
|
|
123
|
+
variant = "ghost",
|
|
124
|
+
size = "xs",
|
|
125
|
+
...props
|
|
126
|
+
}) {
|
|
127
|
+
return /* @__PURE__ */ jsx3(Button, {
|
|
128
|
+
type,
|
|
129
|
+
"data-size": size,
|
|
130
|
+
variant,
|
|
131
|
+
className: cn(inputGroupButtonVariants({ size }), className),
|
|
132
|
+
...props
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
function InputGroupInput({
|
|
136
|
+
className,
|
|
137
|
+
...props
|
|
138
|
+
}) {
|
|
139
|
+
return /* @__PURE__ */ jsx3(Input, {
|
|
140
|
+
"data-slot": "input-group-control",
|
|
141
|
+
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),
|
|
142
|
+
...props
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// ../../src/components/ui/popover.tsx
|
|
147
|
+
import { Popover as PopoverPrimitive } from "@base-ui/react/popover";
|
|
148
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
149
|
+
function Popover({ ...props }) {
|
|
150
|
+
return /* @__PURE__ */ jsx4(PopoverPrimitive.Root, {
|
|
151
|
+
"data-slot": "popover",
|
|
152
|
+
...props
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
function PopoverTrigger({ ...props }) {
|
|
156
|
+
return /* @__PURE__ */ jsx4(PopoverPrimitive.Trigger, {
|
|
157
|
+
"data-slot": "popover-trigger",
|
|
158
|
+
...props
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
function PopoverContent({
|
|
162
|
+
className,
|
|
163
|
+
align = "center",
|
|
164
|
+
alignOffset = 0,
|
|
165
|
+
side = "bottom",
|
|
166
|
+
sideOffset = 4,
|
|
167
|
+
...props
|
|
168
|
+
}) {
|
|
169
|
+
return /* @__PURE__ */ jsx4(PopoverPrimitive.Portal, {
|
|
170
|
+
children: /* @__PURE__ */ jsx4(PopoverPrimitive.Positioner, {
|
|
171
|
+
align,
|
|
172
|
+
alignOffset,
|
|
173
|
+
side,
|
|
174
|
+
sideOffset,
|
|
175
|
+
className: "isolate z-50",
|
|
176
|
+
children: /* @__PURE__ */ jsx4(PopoverPrimitive.Popup, {
|
|
177
|
+
"data-slot": "popover-content",
|
|
178
|
+
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),
|
|
179
|
+
...props
|
|
180
|
+
})
|
|
181
|
+
})
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
function PopoverTitle({ className, ...props }) {
|
|
185
|
+
return /* @__PURE__ */ jsx4(PopoverPrimitive.Title, {
|
|
186
|
+
"data-slot": "popover-title",
|
|
187
|
+
className: cn("font-medium", className),
|
|
188
|
+
...props
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// ../../src/components/ui/color-picker.tsx
|
|
193
|
+
import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider";
|
|
194
|
+
import { jsx as jsx5, jsxs } from "react/jsx-runtime";
|
|
195
|
+
var HexColor = Schema.String.check(Schema.isPattern(/^#?(?:[\da-f]{3}|[\da-f]{6})$/i)).annotate({
|
|
196
|
+
identifier: "HexColor"
|
|
197
|
+
});
|
|
198
|
+
var normalizeHex = (value) => {
|
|
199
|
+
const trimmed = value.trim();
|
|
200
|
+
if (!Schema.is(HexColor)(trimmed))
|
|
201
|
+
return;
|
|
202
|
+
const hex = trimmed.replace(/^#/, "");
|
|
203
|
+
return `#${(hex.length === 3 ? hex.split("").map((digit) => digit + digit).join("") : hex).toUpperCase()}`;
|
|
204
|
+
};
|
|
205
|
+
var labels = {
|
|
206
|
+
en: {
|
|
207
|
+
input: "HEX color",
|
|
208
|
+
open: "Choose color",
|
|
209
|
+
saturation: "Saturation and brightness",
|
|
210
|
+
hue: "Hue",
|
|
211
|
+
saturationValue: "Saturation",
|
|
212
|
+
brightnessValue: "Brightness"
|
|
213
|
+
},
|
|
214
|
+
fr: {
|
|
215
|
+
input: "Couleur HEX",
|
|
216
|
+
open: "Choisir une couleur",
|
|
217
|
+
saturation: "Saturation et luminosité",
|
|
218
|
+
hue: "Teinte",
|
|
219
|
+
saturationValue: "Saturation",
|
|
220
|
+
brightnessValue: "Luminosité"
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
var ColorPanel = ({
|
|
224
|
+
color,
|
|
225
|
+
onChange,
|
|
226
|
+
copy
|
|
227
|
+
}) => {
|
|
228
|
+
const ref = useRef(null);
|
|
229
|
+
const valueText = useRef({ raw: "", localized: "" });
|
|
230
|
+
useEffect(() => {
|
|
231
|
+
const panel = ref.current;
|
|
232
|
+
if (!panel)
|
|
233
|
+
return;
|
|
234
|
+
const localize = () => {
|
|
235
|
+
const saturation = panel.querySelector(".react-colorful__saturation [role=slider]");
|
|
236
|
+
const hue = panel.querySelector(".react-colorful__hue [role=slider]");
|
|
237
|
+
saturation?.setAttribute("aria-label", copy.saturation);
|
|
238
|
+
hue?.setAttribute("aria-label", copy.hue);
|
|
239
|
+
const text = saturation?.getAttribute("aria-valuetext");
|
|
240
|
+
if (text) {
|
|
241
|
+
const raw = text === valueText.current.localized ? valueText.current.raw : text;
|
|
242
|
+
const localized = raw.replace("Saturation", copy.saturationValue).replace("Brightness", copy.brightnessValue);
|
|
243
|
+
valueText.current = { raw, localized };
|
|
244
|
+
if (localized !== text)
|
|
245
|
+
saturation?.setAttribute("aria-valuetext", localized);
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
localize();
|
|
249
|
+
const observer = new MutationObserver(localize);
|
|
250
|
+
observer.observe(panel, {
|
|
251
|
+
subtree: true,
|
|
252
|
+
attributes: true,
|
|
253
|
+
attributeFilter: ["aria-valuetext"]
|
|
254
|
+
});
|
|
255
|
+
return () => observer.disconnect();
|
|
256
|
+
}, [copy.saturation, copy.hue, copy.saturationValue, copy.brightnessValue]);
|
|
257
|
+
return /* @__PURE__ */ jsx5("div", {
|
|
258
|
+
ref,
|
|
259
|
+
className: "[&_.react-colorful__hue]:h-4! [&_.react-colorful__pointer]:size-5!",
|
|
260
|
+
children: /* @__PURE__ */ jsx5(HexColorPicker, {
|
|
261
|
+
color,
|
|
262
|
+
onChange,
|
|
263
|
+
style: { width: "100%", height: "12rem" }
|
|
264
|
+
})
|
|
265
|
+
});
|
|
266
|
+
};
|
|
267
|
+
var ColorPicker = ({
|
|
268
|
+
value,
|
|
269
|
+
defaultValue = "#2563EB",
|
|
270
|
+
onValueChange,
|
|
271
|
+
locale: localeOverride,
|
|
272
|
+
messages,
|
|
273
|
+
className,
|
|
274
|
+
disabled,
|
|
275
|
+
readOnly,
|
|
276
|
+
onBlur,
|
|
277
|
+
onKeyDown,
|
|
278
|
+
"aria-label": ariaLabel,
|
|
279
|
+
"aria-invalid": ariaInvalid,
|
|
280
|
+
...inputProps
|
|
281
|
+
}) => {
|
|
282
|
+
const locale = useKrakstackLocale(localeOverride);
|
|
283
|
+
const copy = {
|
|
284
|
+
...locale.startsWith("fr") ? labels.fr : labels.en,
|
|
285
|
+
...messages?.[locale.split("-")[0] ?? locale],
|
|
286
|
+
...messages?.[locale]
|
|
287
|
+
};
|
|
288
|
+
const [internalValue, setInternalValue] = useState(normalizeHex(defaultValue) ?? "#2563EB");
|
|
289
|
+
const color = normalizeHex(value ?? internalValue) ?? "#2563EB";
|
|
290
|
+
const [draft, setDraft] = useState(null);
|
|
291
|
+
const [previousValue, setPreviousValue] = useState(value);
|
|
292
|
+
const [open, setOpen] = useState(false);
|
|
293
|
+
if (previousValue !== value) {
|
|
294
|
+
setPreviousValue(value);
|
|
295
|
+
if (draft === null || normalizeHex(draft) !== normalizeHex(value ?? ""))
|
|
296
|
+
setDraft(null);
|
|
297
|
+
}
|
|
298
|
+
const commit = (next) => {
|
|
299
|
+
const normalized = normalizeHex(next);
|
|
300
|
+
if (!normalized)
|
|
301
|
+
return;
|
|
302
|
+
if (value === undefined)
|
|
303
|
+
setInternalValue(normalized);
|
|
304
|
+
if (normalized !== color)
|
|
305
|
+
onValueChange?.(normalized);
|
|
306
|
+
};
|
|
307
|
+
return /* @__PURE__ */ jsxs(Popover, {
|
|
308
|
+
open: open && !disabled && !readOnly,
|
|
309
|
+
onOpenChange: setOpen,
|
|
310
|
+
children: [
|
|
311
|
+
/* @__PURE__ */ jsxs(InputGroup, {
|
|
312
|
+
className,
|
|
313
|
+
"data-disabled": disabled || undefined,
|
|
314
|
+
children: [
|
|
315
|
+
/* @__PURE__ */ jsx5(InputGroupInput, {
|
|
316
|
+
...inputProps,
|
|
317
|
+
type: "text",
|
|
318
|
+
"aria-label": ariaLabel ?? copy.input,
|
|
319
|
+
"aria-invalid": ariaInvalid ?? (draft !== null && !normalizeHex(draft) ? true : undefined),
|
|
320
|
+
autoComplete: "off",
|
|
321
|
+
spellCheck: false,
|
|
322
|
+
disabled,
|
|
323
|
+
readOnly,
|
|
324
|
+
value: draft ?? color,
|
|
325
|
+
onChange: (event) => {
|
|
326
|
+
setDraft(event.target.value);
|
|
327
|
+
commit(event.target.value);
|
|
328
|
+
},
|
|
329
|
+
onBlur: (event) => {
|
|
330
|
+
setDraft(null);
|
|
331
|
+
onBlur?.(event);
|
|
332
|
+
},
|
|
333
|
+
onKeyDown: (event) => {
|
|
334
|
+
onKeyDown?.(event);
|
|
335
|
+
if (!event.defaultPrevented && (event.key === "Enter" || event.key === "Escape")) {
|
|
336
|
+
setDraft(null);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}),
|
|
340
|
+
/* @__PURE__ */ jsx5(InputGroupAddon, {
|
|
341
|
+
align: "inline-end",
|
|
342
|
+
children: /* @__PURE__ */ jsx5(PopoverTrigger, {
|
|
343
|
+
render: /* @__PURE__ */ jsx5(InputGroupButton, {
|
|
344
|
+
"aria-label": copy.open,
|
|
345
|
+
disabled: disabled || readOnly,
|
|
346
|
+
size: "icon-xs"
|
|
347
|
+
}),
|
|
348
|
+
children: /* @__PURE__ */ jsx5("span", {
|
|
349
|
+
"aria-hidden": "true",
|
|
350
|
+
className: "size-5 rounded-sm border border-black/15",
|
|
351
|
+
style: { backgroundColor: color }
|
|
352
|
+
})
|
|
353
|
+
})
|
|
354
|
+
})
|
|
355
|
+
]
|
|
356
|
+
}),
|
|
357
|
+
/* @__PURE__ */ jsxs(PopoverContent, {
|
|
358
|
+
align: "end",
|
|
359
|
+
className: "w-64 max-w-[calc(100vw-2rem)] gap-3 p-3",
|
|
360
|
+
children: [
|
|
361
|
+
/* @__PURE__ */ jsx5(PopoverTitle, {
|
|
362
|
+
className: "sr-only",
|
|
363
|
+
children: copy.open
|
|
364
|
+
}),
|
|
365
|
+
/* @__PURE__ */ jsx5(ColorPanel, {
|
|
366
|
+
color,
|
|
367
|
+
copy,
|
|
368
|
+
onChange: (next) => {
|
|
369
|
+
setDraft(null);
|
|
370
|
+
commit(next);
|
|
371
|
+
}
|
|
372
|
+
}),
|
|
373
|
+
/* @__PURE__ */ jsx5("output", {
|
|
374
|
+
className: "text-muted-foreground text-center font-mono text-xs",
|
|
375
|
+
children: color
|
|
376
|
+
})
|
|
377
|
+
]
|
|
378
|
+
})
|
|
379
|
+
]
|
|
380
|
+
});
|
|
381
|
+
};
|
|
382
|
+
export {
|
|
383
|
+
ColorPicker
|
|
384
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// ../../src/components/ui/data-table.tsx
|
|
2
2
|
import { useAtom, useAtomSet } from "@effect/atom-react";
|
|
3
3
|
import { BrowserKeyValueStore } from "@effect/platform-browser";
|
|
4
|
-
import { DateTime as DateTime2, Effect as Effect2, Option as Option2, Schema as Schema2, Stream } from "effect";
|
|
4
|
+
import { DateTime as DateTime2, Effect as Effect2, Formatter, Option as Option2, Schema as Schema2, Stream } from "effect";
|
|
5
5
|
import { Csv } from "effect/encoding";
|
|
6
6
|
import { AsyncResult, Atom } from "effect/reactivity";
|
|
7
7
|
import {
|
|
@@ -1161,11 +1161,11 @@ var ColumnFilters = Schema.declare(Schema.is(ColumnFiltersArray), {
|
|
|
1161
1161
|
toCodecStringTree: () => Schema.link()(Schema.fromJsonString(ColumnFiltersArray), SchemaTransformation.passthrough())
|
|
1162
1162
|
});
|
|
1163
1163
|
var Query = Schema.Struct({
|
|
1164
|
-
page: Schema.optional(Schema.Union([Schema.
|
|
1164
|
+
page: Schema.optional(Schema.Union([Schema.Finite, Schema.FiniteFromString]).check(Schema.isInt(), Schema.isGreaterThanOrEqualTo(0))).pipe(Schema.decodeTo(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)), {
|
|
1165
1165
|
decode: SchemaGetter.withDefault(Effect.succeed(0)),
|
|
1166
1166
|
encode: SchemaGetter.transformOptional(Option.filter((page) => page !== 0))
|
|
1167
1167
|
})),
|
|
1168
|
-
pageSize: Schema.optional(Schema.Union([Schema.
|
|
1168
|
+
pageSize: Schema.optional(Schema.Union([Schema.Finite, Schema.FiniteFromString]).check(Schema.isInt(), Schema.isBetween({ minimum: 1, maximum: 100 }))).pipe(Schema.decodeTo(Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 100 })), {
|
|
1169
1169
|
decode: SchemaGetter.withDefault(Effect.succeed(20)),
|
|
1170
1170
|
encode: SchemaGetter.transformOptional(Option.filter((pageSize) => pageSize !== 20))
|
|
1171
1171
|
})),
|
|
@@ -1206,7 +1206,7 @@ import { useKrakstackLocale as useKrakstackLocale3 } from "@krak-stack/registry/
|
|
|
1206
1206
|
import { jsx as jsx15, jsxs as jsxs9, Fragment } from "react/jsx-runtime";
|
|
1207
1207
|
var DataTablePersistedUiStateSchema = Schema2.Struct({
|
|
1208
1208
|
columnVisibility: Schema2.Record(Schema2.String, Schema2.Boolean),
|
|
1209
|
-
columnSizing: Schema2.Record(Schema2.String, Schema2.
|
|
1209
|
+
columnSizing: Schema2.Record(Schema2.String, Schema2.Finite),
|
|
1210
1210
|
grouping: Schema2.optionalKey(Schema2.Array(Schema2.String)),
|
|
1211
1211
|
view: Schema2.Literals(["table", "gallery"])
|
|
1212
1212
|
}).annotate({ identifier: "DataTablePersistedUiState" });
|
|
@@ -1486,6 +1486,14 @@ var formatNumberValue = (value, options = {}, defaultLocale = "en") => {
|
|
|
1486
1486
|
} = options;
|
|
1487
1487
|
return new Intl.NumberFormat(locale ?? defaultLocale, format).format(value);
|
|
1488
1488
|
};
|
|
1489
|
+
var scalarText = Schema2.is(Schema2.Union([
|
|
1490
|
+
Schema2.String,
|
|
1491
|
+
Schema2.Finite,
|
|
1492
|
+
Schema2.Boolean,
|
|
1493
|
+
Schema2.BigInt,
|
|
1494
|
+
Schema2.Symbol
|
|
1495
|
+
]));
|
|
1496
|
+
var dataTableValueText = (value) => value == null ? "" : scalarText(value) ? String(value) : Formatter.format(value);
|
|
1489
1497
|
var booleanLabel = (value, options) => value ? options?.trueLabel : options?.falseLabel;
|
|
1490
1498
|
var getDataTableExportValue = (row, column, locale = "en") => {
|
|
1491
1499
|
const value = row.values.get(column.id);
|
|
@@ -1517,7 +1525,7 @@ var filterDataTableRows = (rows, columns, globalFilter, locale = "en") => {
|
|
|
1517
1525
|
return rows.filter((row) => searchable.some((column) => {
|
|
1518
1526
|
const value = row.values.get(column.id);
|
|
1519
1527
|
const colDef = column.colDef;
|
|
1520
|
-
let text =
|
|
1528
|
+
let text = dataTableValueText(value);
|
|
1521
1529
|
if (colDef.type === "date" || colDef.type === "dateTime") {
|
|
1522
1530
|
const date = resolveDate(value, colDef.type);
|
|
1523
1531
|
text = date ? `${formatDateValue(date, colDef, locale)} ${dateIsoValue(date)}` : "";
|
|
@@ -1564,7 +1572,7 @@ var filterDataTableColumnRows = (rows, columns, filters) => {
|
|
|
1564
1572
|
}) : row.values.get(column.id);
|
|
1565
1573
|
switch (filter.kind) {
|
|
1566
1574
|
case "text": {
|
|
1567
|
-
const text =
|
|
1575
|
+
const text = dataTableValueText(value).toLocaleLowerCase();
|
|
1568
1576
|
const query = filter.value.toLocaleLowerCase();
|
|
1569
1577
|
switch (filter.operator) {
|
|
1570
1578
|
case "contains":
|
|
@@ -1591,7 +1599,7 @@ var filterDataTableColumnRows = (rows, columns, filters) => {
|
|
|
1591
1599
|
case "boolean":
|
|
1592
1600
|
return Option2.getOrUndefined(decodeBooleanValue(value)) === filter.value;
|
|
1593
1601
|
case "values": {
|
|
1594
|
-
const values = column.colDef.type === "list" ? column.colDef.typeOptions.getItems(row.data).map((item) => item.value ?? item.label) : [
|
|
1602
|
+
const values = column.colDef.type === "list" ? column.colDef.typeOptions.getItems(row.data).map((item) => item.value ?? item.label) : [dataTableValueText(value)];
|
|
1595
1603
|
return filter.values.some((selected) => values.includes(selected));
|
|
1596
1604
|
}
|
|
1597
1605
|
}
|
|
@@ -1638,7 +1646,7 @@ var sortDataTableRows = (rows, columns, sorting) => {
|
|
|
1638
1646
|
return sort.direction === "desc" ? -comparison : comparison;
|
|
1639
1647
|
continue;
|
|
1640
1648
|
}
|
|
1641
|
-
const comparison = column.colDef.comparator ? column.colDef.comparator(leftValue, rightValue, left.row.data, right.row.data) : Object.is(leftValue, rightValue) ? 0 : leftValue === null || leftValue === undefined ? 1 : rightValue === null || rightValue === undefined ? -1 : Schema2.is(Schema2.
|
|
1649
|
+
const comparison = column.colDef.comparator ? column.colDef.comparator(leftValue, rightValue, left.row.data, right.row.data) : Object.is(leftValue, rightValue) ? 0 : leftValue === null || leftValue === undefined ? 1 : rightValue === null || rightValue === undefined ? -1 : Schema2.is(Schema2.Finite)(leftValue) && Schema2.is(Schema2.Finite)(rightValue) ? leftValue - rightValue : dataTableValueText(leftValue).localeCompare(dataTableValueText(rightValue), undefined, { numeric: true, sensitivity: "base" });
|
|
1642
1650
|
if (comparison !== 0)
|
|
1643
1651
|
return sort.direction === "desc" ? -comparison : comparison;
|
|
1644
1652
|
}
|
|
@@ -1918,10 +1926,10 @@ var renderCell = (row, column, locale = "en", labels = dataTableMessages(locale)
|
|
|
1918
1926
|
totalCount: config.getTotalCount?.(row.data)
|
|
1919
1927
|
});
|
|
1920
1928
|
}
|
|
1921
|
-
return column.colDef.valueFormatter?.(params) ?? (value === null || value === undefined ? null :
|
|
1929
|
+
return column.colDef.valueFormatter?.(params) ?? (value === null || value === undefined ? null : dataTableValueText(value));
|
|
1922
1930
|
};
|
|
1923
1931
|
var nodeText = (node) => {
|
|
1924
|
-
if (Schema2.is(Schema2.String)(node) || Schema2.is(Schema2.
|
|
1932
|
+
if (Schema2.is(Schema2.String)(node) || Schema2.is(Schema2.Finite)(node))
|
|
1925
1933
|
return String(node);
|
|
1926
1934
|
if (!isValidElement(node))
|
|
1927
1935
|
return "";
|
|
@@ -2238,7 +2246,7 @@ var DataTableToolbar = ({
|
|
|
2238
2246
|
children: [
|
|
2239
2247
|
/* @__PURE__ */ jsxs9(MenubarItem, {
|
|
2240
2248
|
disabled: exporting || !exportRows.length,
|
|
2241
|
-
onClick: () => downloadCsv(exportColumns.map(columnLabel), exportRows.map((row) => exportColumns.map((column) =>
|
|
2249
|
+
onClick: () => downloadCsv(exportColumns.map(columnLabel), exportRows.map((row) => exportColumns.map((column) => dataTableValueText(getDataTableExportValue(row, column, store.config.locale) ?? ""))), features.export ? features.export.baseName : "table"),
|
|
2242
2250
|
children: [
|
|
2243
2251
|
/* @__PURE__ */ jsx15(FileText, {}),
|
|
2244
2252
|
labels.exportCsv
|
|
@@ -2417,8 +2425,8 @@ var FilterEditor = ({
|
|
|
2417
2425
|
to: secondary || undefined
|
|
2418
2426
|
});
|
|
2419
2427
|
else {
|
|
2420
|
-
const min = primary ? Schema2.
|
|
2421
|
-
const max = secondary ? Schema2.
|
|
2428
|
+
const min = primary ? Schema2.decodeOption(Schema2.FiniteFromString)(primary) : Option2.some(undefined);
|
|
2429
|
+
const max = secondary ? Schema2.decodeOption(Schema2.FiniteFromString)(secondary) : Option2.some(undefined);
|
|
2422
2430
|
if (Option2.isNone(min) || Option2.isNone(max)) {
|
|
2423
2431
|
setInvalid(true);
|
|
2424
2432
|
return;
|
|
@@ -3911,7 +3919,11 @@ var EditableDataTableListCell = ({
|
|
|
3911
3919
|
messages
|
|
3912
3920
|
}) => {
|
|
3913
3921
|
const [selected, setSelected] = useState([...items]);
|
|
3914
|
-
|
|
3922
|
+
const [previousItems, setPreviousItems] = useState(items);
|
|
3923
|
+
if (previousItems !== items) {
|
|
3924
|
+
setPreviousItems(items);
|
|
3925
|
+
setSelected([...items]);
|
|
3926
|
+
}
|
|
3915
3927
|
const selectedValues = new Set(selected.map((item) => item.value));
|
|
3916
3928
|
const available = options.filter((item) => !selectedValues.has(item.value));
|
|
3917
3929
|
const canAdd = !!onAdd && available.length > 0;
|
|
@@ -1334,8 +1334,8 @@ var effectFormMessages = (locale = "en", translations) => ({
|
|
|
1334
1334
|
var useEffectFormMessages = (locale, translations) => effectFormMessages(useKrakstackLocale3(locale), translations);
|
|
1335
1335
|
var SubmitErrorDetails = Schema2.Struct({
|
|
1336
1336
|
_tag: Schema2.optional(Schema2.String),
|
|
1337
|
-
status: Schema2.optional(Schema2.
|
|
1338
|
-
statusCode: Schema2.optional(Schema2.
|
|
1337
|
+
status: Schema2.optional(Schema2.Finite),
|
|
1338
|
+
statusCode: Schema2.optional(Schema2.Finite)
|
|
1339
1339
|
}).annotate({ identifier: "SubmitErrorDetails" });
|
|
1340
1340
|
var submitErrorStatuses = new Map([
|
|
1341
1341
|
["BadRequest", 400],
|
|
@@ -293,27 +293,19 @@ var ErrorComponent = ({
|
|
|
293
293
|
const errorName = standardError?.name ?? labels.errorLabel;
|
|
294
294
|
const errorMessage = standardError?.message.trim() || labels.description;
|
|
295
295
|
const reference = diagnostics?.reference ?? (standardError ? getErrorTraceId(standardError) : undefined);
|
|
296
|
-
const
|
|
296
|
+
const [reportedAt] = useState2(() => new Date().toISOString());
|
|
297
|
+
const report = [
|
|
297
298
|
`${labels.errorLabel}: ${errorName}`,
|
|
298
299
|
`${labels.messageLabel}: ${errorMessage}`,
|
|
299
300
|
"",
|
|
300
301
|
`${labels.pageLabel}: ${pathname}`,
|
|
301
|
-
`${labels.timeLabel}: ${
|
|
302
|
+
`${labels.timeLabel}: ${reportedAt}`,
|
|
302
303
|
`${labels.languageLabel}: ${locale}`,
|
|
303
304
|
...diagnostics?.app ? [`${labels.appLabel}: ${diagnostics.app}`] : [],
|
|
304
305
|
...diagnostics?.version ? [`${labels.versionLabel}: ${diagnostics.version}`] : [],
|
|
305
306
|
...reference ? [`${labels.referenceLabel}: ${reference}`] : []
|
|
306
307
|
].join(`
|
|
307
|
-
`)
|
|
308
|
-
errorName,
|
|
309
|
-
errorMessage,
|
|
310
|
-
pathname,
|
|
311
|
-
locale,
|
|
312
|
-
labels,
|
|
313
|
-
diagnostics?.app,
|
|
314
|
-
diagnostics?.version,
|
|
315
|
-
reference
|
|
316
|
-
]);
|
|
308
|
+
`);
|
|
317
309
|
const [copyResult, setCopyResult] = useState2(null);
|
|
318
310
|
const copyStatus = copyResult?.report === report ? copyResult.status : undefined;
|
|
319
311
|
return /* @__PURE__ */ jsx5("main", {
|