@k8o/arte-odyssey 10.5.0 → 10.6.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.
@@ -1,10 +1,17 @@
1
1
  import { Status } from "../../../types/variables.mjs";
2
- import { FC, HTMLAttributes } from "react";
2
+ import { FC, HTMLAttributes, ReactNode } from "react";
3
3
 
4
4
  //#region src/components/feedback/alert/alert.d.ts
5
+ type AlertAction = {
6
+ label: string;
7
+ renderItem: (props: {
8
+ children: ReactNode;
9
+ }) => ReactNode;
10
+ };
5
11
  type Props = {
6
12
  tone: Status;
7
13
  message: string | string[];
14
+ action?: AlertAction;
8
15
  } & Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'role' | 'className' | 'style'>;
9
16
  declare const Alert: FC<Props>;
10
17
  //#endregion
@@ -8,29 +8,41 @@ const STATUS_LABEL = {
8
8
  warning: "警告",
9
9
  error: "エラー"
10
10
  };
11
- const Alert = ({ tone, message, ...rest }) => /* @__PURE__ */ jsxs("div", {
12
- ...rest,
13
- className: cn("flex items-center gap-3 rounded-lg p-4", tone === "success" && "bg-bg-success", tone === "info" && "bg-bg-info", tone === "warning" && "bg-bg-warning", tone === "error" && "bg-bg-error"),
14
- role: tone === "error" || tone === "warning" ? "alert" : "status",
15
- children: [/* @__PURE__ */ jsxs("span", {
16
- className: cn(tone === "success" && "text-fg-success", tone === "info" && "text-fg-info", tone === "warning" && "text-fg-warning", tone === "error" && "text-fg-error"),
17
- children: [/* @__PURE__ */ jsx(AlertIcon, {
18
- size: "md",
19
- status: tone
20
- }), /* @__PURE__ */ jsx("span", {
21
- className: "sr-only",
22
- children: STATUS_LABEL[tone]
23
- })]
24
- }), Array.isArray(message) ? message.length > 1 ? /* @__PURE__ */ jsx("ul", {
25
- className: "space-y-1",
26
- children: message.map((msg) => /* @__PURE__ */ jsx("li", { children: msg }, msg))
27
- }) : /* @__PURE__ */ jsx("p", {
11
+ const Alert = ({ tone, message, action, ...rest }) => {
12
+ const actionNode = action ? action.renderItem({ children: action.label }) : null;
13
+ const inlineAction = action ? /* @__PURE__ */ jsx("span", {
14
+ className: "ml-1",
15
+ children: actionNode
16
+ }) : null;
17
+ let messageContent;
18
+ if (Array.isArray(message) && message.length > 1) {
19
+ const list = /* @__PURE__ */ jsx("ul", {
20
+ className: "space-y-1",
21
+ children: message.map((msg) => /* @__PURE__ */ jsx("li", { children: msg }, msg))
22
+ });
23
+ messageContent = action ? /* @__PURE__ */ jsxs("div", { children: [list, /* @__PURE__ */ jsx("div", {
24
+ className: "mt-1",
25
+ children: actionNode
26
+ })] }) : list;
27
+ } else messageContent = /* @__PURE__ */ jsxs("p", {
28
28
  className: "font-bold",
29
- children: message[0]
30
- }) : /* @__PURE__ */ jsx("p", {
31
- className: "font-bold",
32
- children: message
33
- })]
34
- });
29
+ children: [Array.isArray(message) ? message[0] : message, inlineAction]
30
+ });
31
+ return /* @__PURE__ */ jsxs("div", {
32
+ ...rest,
33
+ className: cn("flex items-center gap-3 rounded-lg p-4", tone === "success" && "bg-bg-success", tone === "info" && "bg-bg-info", tone === "warning" && "bg-bg-warning", tone === "error" && "bg-bg-error"),
34
+ role: tone === "error" || tone === "warning" ? "alert" : "status",
35
+ children: [/* @__PURE__ */ jsxs("span", {
36
+ className: cn(tone === "success" && "text-fg-success", tone === "info" && "text-fg-info", tone === "warning" && "text-fg-warning", tone === "error" && "text-fg-error"),
37
+ children: [/* @__PURE__ */ jsx(AlertIcon, {
38
+ size: "md",
39
+ status: tone
40
+ }), /* @__PURE__ */ jsx("span", {
41
+ className: "sr-only",
42
+ children: STATUS_LABEL[tone]
43
+ })]
44
+ }), messageContent]
45
+ });
46
+ };
35
47
  //#endregion
36
48
  export { Alert };
@@ -3,7 +3,7 @@ declare const CheckboxGroup: import("react").FC<{
3
3
  invalid?: boolean;
4
4
  required?: boolean;
5
5
  name: string;
6
- } & Omit<import("react").FieldsetHTMLAttributes<HTMLFieldSetElement>, "className" | "style" | "name" | "defaultValue" | "onChange"> & {
6
+ } & Omit<import("react").FieldsetHTMLAttributes<HTMLFieldSetElement>, "className" | "style" | "defaultValue" | "onChange" | "name"> & {
7
7
  children?: import("react").ReactNode | undefined;
8
8
  } & ({
9
9
  value: string[];
@@ -18,7 +18,7 @@ declare const CheckboxGroup: import("react").FC<{
18
18
  invalid?: boolean;
19
19
  required?: boolean;
20
20
  name: string;
21
- } & Omit<import("react").FieldsetHTMLAttributes<HTMLFieldSetElement>, "className" | "style" | "name" | "defaultValue" | "onChange"> & {
21
+ } & Omit<import("react").FieldsetHTMLAttributes<HTMLFieldSetElement>, "className" | "style" | "defaultValue" | "onChange" | "name"> & {
22
22
  children?: import("react").ReactNode | undefined;
23
23
  } & ({
24
24
  value: string[];
@@ -33,7 +33,7 @@ declare const CheckboxGroup: import("react").FC<{
33
33
  Item: import("react").FC<{
34
34
  itemValue?: string;
35
35
  label: string;
36
- } & Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "value" | "type" | "className" | "style" | "checked" | "defaultChecked" | "children" | "onChange"> & ({
36
+ } & Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "children" | "className" | "style" | "defaultChecked" | "onChange" | "type" | "value" | "checked"> & ({
37
37
  value: boolean;
38
38
  onChange: (checked: boolean, event: import("react").ChangeEvent<HTMLInputElement>) => void;
39
39
  defaultChecked?: never;
@@ -39,10 +39,10 @@ declare const buttonProps: z.ZodObject<{
39
39
  href: z.ZodOptional<z.ZodString>;
40
40
  }, z.core.$strip>;
41
41
  declare const iconName: z.ZodEnum<{
42
- link: "link";
43
- check: "check";
44
42
  form: "form";
45
43
  list: "list";
44
+ link: "link";
45
+ check: "check";
46
46
  plus: "plus";
47
47
  minus: "minus";
48
48
  close: "close";
@@ -94,10 +94,10 @@ declare const iconName: z.ZodEnum<{
94
94
  }>;
95
95
  declare const iconProps: z.ZodObject<{
96
96
  name: z.ZodEnum<{
97
- link: "link";
98
- check: "check";
99
97
  form: "form";
100
98
  list: "list";
99
+ link: "link";
100
+ check: "check";
101
101
  plus: "plus";
102
102
  minus: "minus";
103
103
  close: "close";
@@ -155,10 +155,10 @@ declare const iconProps: z.ZodObject<{
155
155
  }, z.core.$strip>;
156
156
  declare const iconButtonProps: z.ZodObject<{
157
157
  icon: z.ZodEnum<{
158
- link: "link";
159
- check: "check";
160
158
  form: "form";
161
159
  list: "list";
160
+ link: "link";
161
+ check: "check";
162
162
  plus: "plus";
163
163
  minus: "minus";
164
164
  close: "close";
@@ -215,18 +215,18 @@ declare const iconButtonProps: z.ZodObject<{
215
215
  lg: "lg";
216
216
  }>>;
217
217
  color: z.ZodOptional<z.ZodEnum<{
218
- transparent: "transparent";
219
218
  primary: "primary";
220
219
  secondary: "secondary";
220
+ transparent: "transparent";
221
221
  base: "base";
222
222
  }>>;
223
223
  }, z.core.$strip>;
224
224
  declare const chevronIconProps: z.ZodObject<{
225
225
  direction: z.ZodEnum<{
226
+ left: "left";
227
+ right: "right";
226
228
  up: "up";
227
229
  down: "down";
228
- right: "right";
229
- left: "left";
230
230
  }>;
231
231
  size: z.ZodOptional<z.ZodEnum<{
232
232
  sm: "sm";
@@ -237,9 +237,9 @@ declare const chevronIconProps: z.ZodObject<{
237
237
  declare const statusIconProps: z.ZodObject<{
238
238
  status: z.ZodEnum<{
239
239
  success: "success";
240
- error: "error";
241
240
  info: "info";
242
241
  warning: "warning";
242
+ error: "error";
243
243
  }>;
244
244
  size: z.ZodOptional<z.ZodEnum<{
245
245
  sm: "sm";
@@ -251,9 +251,9 @@ declare const badgeProps: z.ZodObject<{
251
251
  text: z.ZodString;
252
252
  tone: z.ZodOptional<z.ZodEnum<{
253
253
  success: "success";
254
- error: "error";
255
254
  info: "info";
256
255
  warning: "warning";
256
+ error: "error";
257
257
  neutral: "neutral";
258
258
  }>>;
259
259
  variant: z.ZodOptional<z.ZodEnum<{
@@ -304,8 +304,8 @@ declare const tableProps: z.ZodObject<{
304
304
  columns: z.ZodArray<z.ZodObject<{
305
305
  label: z.ZodString;
306
306
  align: z.ZodOptional<z.ZodEnum<{
307
- right: "right";
308
307
  left: "left";
308
+ right: "right";
309
309
  center: "center";
310
310
  }>>;
311
311
  }, z.core.$strip>>;
@@ -330,9 +330,9 @@ declare const cardProps: z.ZodObject<{
330
330
  declare const alertProps: z.ZodObject<{
331
331
  tone: z.ZodEnum<{
332
332
  success: "success";
333
- error: "error";
334
333
  info: "info";
335
334
  warning: "warning";
335
+ error: "error";
336
336
  }>;
337
337
  message: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
338
338
  }, z.core.$strip>;
@@ -366,16 +366,16 @@ declare const toastProps: z.ZodObject<{
366
366
  triggerLabel: z.ZodString;
367
367
  tone: z.ZodEnum<{
368
368
  success: "success";
369
- error: "error";
370
369
  info: "info";
371
370
  warning: "warning";
371
+ error: "error";
372
372
  }>;
373
373
  message: z.ZodString;
374
374
  }, z.core.$strip>;
375
375
  declare const separatorProps: z.ZodObject<{
376
376
  orientation: z.ZodOptional<z.ZodEnum<{
377
- horizontal: "horizontal";
378
377
  vertical: "vertical";
378
+ horizontal: "horizontal";
379
379
  }>>;
380
380
  color: z.ZodOptional<z.ZodEnum<{
381
381
  base: "base";
@@ -389,18 +389,18 @@ declare const stackProps: z.ZodObject<{
389
389
  column: "column";
390
390
  }>>;
391
391
  gap: z.ZodOptional<z.ZodEnum<{
392
+ none: "none";
392
393
  sm: "sm";
393
394
  md: "md";
394
395
  lg: "lg";
395
396
  xl: "xl";
396
- none: "none";
397
397
  }>>;
398
398
  padding: z.ZodOptional<z.ZodEnum<{
399
+ none: "none";
399
400
  sm: "sm";
400
401
  md: "md";
401
402
  lg: "lg";
402
403
  xl: "xl";
403
- none: "none";
404
404
  }>>;
405
405
  align: z.ZodOptional<z.ZodEnum<{
406
406
  start: "start";
@@ -419,11 +419,11 @@ declare const gridProps: z.ZodObject<{
419
419
  cols: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<6>, z.ZodLiteral<"auto-fill">, z.ZodLiteral<"auto-fit">]>>;
420
420
  minItemSize: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<24>, z.ZodLiteral<32>, z.ZodLiteral<40>, z.ZodLiteral<48>, z.ZodLiteral<64>, z.ZodLiteral<80>]>>;
421
421
  gap: z.ZodOptional<z.ZodEnum<{
422
+ none: "none";
422
423
  sm: "sm";
423
424
  md: "md";
424
425
  lg: "lg";
425
426
  xl: "xl";
426
- none: "none";
427
427
  }>>;
428
428
  }, z.core.$strip>;
429
429
  declare const scrollLinkedProps: z.ZodObject<{}, z.core.$strip>;
@@ -616,10 +616,10 @@ declare const modalProps: z.ZodObject<{
616
616
  triggerLabel: z.ZodString;
617
617
  title: z.ZodString;
618
618
  type: z.ZodOptional<z.ZodEnum<{
619
- right: "right";
619
+ bottom: "bottom";
620
620
  left: "left";
621
+ right: "right";
621
622
  center: "center";
622
- bottom: "bottom";
623
623
  }>>;
624
624
  }, z.core.$strip>;
625
625
  declare const dialogProps: z.ZodObject<{
@@ -630,8 +630,8 @@ declare const drawerProps: z.ZodObject<{
630
630
  triggerLabel: z.ZodString;
631
631
  title: z.ZodString;
632
632
  side: z.ZodOptional<z.ZodEnum<{
633
- right: "right";
634
633
  left: "left";
634
+ right: "right";
635
635
  }>>;
636
636
  }, z.core.$strip>;
637
637
  declare const popoverProps: z.ZodObject<{
@@ -42,18 +42,18 @@ declare const catalog: import("@json-render/core").Catalog<{
42
42
  column: "column";
43
43
  }>>;
44
44
  gap: z.ZodOptional<z.ZodEnum<{
45
+ none: "none";
45
46
  sm: "sm";
46
47
  md: "md";
47
48
  lg: "lg";
48
49
  xl: "xl";
49
- none: "none";
50
50
  }>>;
51
51
  padding: z.ZodOptional<z.ZodEnum<{
52
+ none: "none";
52
53
  sm: "sm";
53
54
  md: "md";
54
55
  lg: "lg";
55
56
  xl: "xl";
56
- none: "none";
57
57
  }>>;
58
58
  align: z.ZodOptional<z.ZodEnum<{
59
59
  start: "start";
@@ -76,11 +76,11 @@ declare const catalog: import("@json-render/core").Catalog<{
76
76
  cols: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<6>, z.ZodLiteral<"auto-fill">, z.ZodLiteral<"auto-fit">]>>;
77
77
  minItemSize: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<24>, z.ZodLiteral<32>, z.ZodLiteral<40>, z.ZodLiteral<48>, z.ZodLiteral<64>, z.ZodLiteral<80>]>>;
78
78
  gap: z.ZodOptional<z.ZodEnum<{
79
+ none: "none";
79
80
  sm: "sm";
80
81
  md: "md";
81
82
  lg: "lg";
82
83
  xl: "xl";
83
- none: "none";
84
84
  }>>;
85
85
  }, z.core.$strip>;
86
86
  slots: string[];
@@ -134,9 +134,9 @@ declare const catalog: import("@json-render/core").Catalog<{
134
134
  text: z.ZodString;
135
135
  tone: z.ZodOptional<z.ZodEnum<{
136
136
  success: "success";
137
- error: "error";
138
137
  info: "info";
139
138
  warning: "warning";
139
+ error: "error";
140
140
  neutral: "neutral";
141
141
  }>>;
142
142
  variant: z.ZodOptional<z.ZodEnum<{
@@ -170,9 +170,9 @@ declare const catalog: import("@json-render/core").Catalog<{
170
170
  props: z.ZodObject<{
171
171
  tone: z.ZodEnum<{
172
172
  success: "success";
173
- error: "error";
174
173
  info: "info";
175
174
  warning: "warning";
175
+ error: "error";
176
176
  }>;
177
177
  message: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
178
178
  }, z.core.$strip>;
@@ -192,8 +192,8 @@ declare const catalog: import("@json-render/core").Catalog<{
192
192
  Separator: {
193
193
  props: z.ZodObject<{
194
194
  orientation: z.ZodOptional<z.ZodEnum<{
195
- horizontal: "horizontal";
196
195
  vertical: "vertical";
196
+ horizontal: "horizontal";
197
197
  }>>;
198
198
  color: z.ZodOptional<z.ZodEnum<{
199
199
  base: "base";
@@ -288,8 +288,8 @@ declare const catalog: import("@json-render/core").Catalog<{
288
288
  columns: z.ZodArray<z.ZodObject<{
289
289
  label: z.ZodString;
290
290
  align: z.ZodOptional<z.ZodEnum<{
291
- right: "right";
292
291
  left: "left";
292
+ right: "right";
293
293
  center: "center";
294
294
  }>>;
295
295
  }, z.core.$strip>>;
@@ -352,10 +352,10 @@ declare const catalog: import("@json-render/core").Catalog<{
352
352
  Icon: {
353
353
  props: z.ZodObject<{
354
354
  name: z.ZodEnum<{
355
- link: "link";
356
- check: "check";
357
355
  form: "form";
358
356
  list: "list";
357
+ link: "link";
358
+ check: "check";
359
359
  plus: "plus";
360
360
  minus: "minus";
361
361
  close: "close";
@@ -416,10 +416,10 @@ declare const catalog: import("@json-render/core").Catalog<{
416
416
  ChevronIcon: {
417
417
  props: z.ZodObject<{
418
418
  direction: z.ZodEnum<{
419
+ left: "left";
420
+ right: "right";
419
421
  up: "up";
420
422
  down: "down";
421
- right: "right";
422
- left: "left";
423
423
  }>;
424
424
  size: z.ZodOptional<z.ZodEnum<{
425
425
  sm: "sm";
@@ -433,9 +433,9 @@ declare const catalog: import("@json-render/core").Catalog<{
433
433
  props: z.ZodObject<{
434
434
  status: z.ZodEnum<{
435
435
  success: "success";
436
- error: "error";
437
436
  info: "info";
438
437
  warning: "warning";
438
+ error: "error";
439
439
  }>;
440
440
  size: z.ZodOptional<z.ZodEnum<{
441
441
  sm: "sm";
@@ -448,10 +448,10 @@ declare const catalog: import("@json-render/core").Catalog<{
448
448
  IconButton: {
449
449
  props: z.ZodObject<{
450
450
  icon: z.ZodEnum<{
451
- link: "link";
452
- check: "check";
453
451
  form: "form";
454
452
  list: "list";
453
+ link: "link";
454
+ check: "check";
455
455
  plus: "plus";
456
456
  minus: "minus";
457
457
  close: "close";
@@ -508,9 +508,9 @@ declare const catalog: import("@json-render/core").Catalog<{
508
508
  lg: "lg";
509
509
  }>>;
510
510
  color: z.ZodOptional<z.ZodEnum<{
511
- transparent: "transparent";
512
511
  primary: "primary";
513
512
  secondary: "secondary";
513
+ transparent: "transparent";
514
514
  base: "base";
515
515
  }>>;
516
516
  }, z.core.$strip>;
@@ -628,10 +628,10 @@ declare const catalog: import("@json-render/core").Catalog<{
628
628
  triggerLabel: z.ZodString;
629
629
  title: z.ZodString;
630
630
  type: z.ZodOptional<z.ZodEnum<{
631
- right: "right";
631
+ bottom: "bottom";
632
632
  left: "left";
633
+ right: "right";
633
634
  center: "center";
634
- bottom: "bottom";
635
635
  }>>;
636
636
  }, z.core.$strip>;
637
637
  slots: string[];
@@ -650,8 +650,8 @@ declare const catalog: import("@json-render/core").Catalog<{
650
650
  triggerLabel: z.ZodString;
651
651
  title: z.ZodString;
652
652
  side: z.ZodOptional<z.ZodEnum<{
653
- right: "right";
654
653
  left: "left";
654
+ right: "right";
655
655
  }>>;
656
656
  }, z.core.$strip>;
657
657
  slots: string[];
@@ -685,9 +685,9 @@ declare const catalog: import("@json-render/core").Catalog<{
685
685
  triggerLabel: z.ZodString;
686
686
  tone: z.ZodEnum<{
687
687
  success: "success";
688
- error: "error";
689
688
  info: "info";
690
689
  warning: "warning";
690
+ error: "error";
691
691
  }>;
692
692
  message: z.ZodString;
693
693
  }, z.core.$strip>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@k8o/arte-odyssey",
3
- "version": "10.5.0",
3
+ "version": "10.6.0",
4
4
  "description": "k8o's React UI library with built-in generative UI adapters (json-render & OpenUI) for LLM-driven, on-brand interfaces",
5
5
  "keywords": [
6
6
  "ai",