@k8o/arte-odyssey 10.5.0 → 10.6.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.
@@ -1,10 +1,19 @@
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;
15
+ onClose?: () => void;
16
+ closeLabel?: string;
8
17
  } & Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'role' | 'className' | 'style'>;
9
18
  declare const Alert: FC<Props>;
10
19
  //#endregion
@@ -1,5 +1,6 @@
1
1
  import { cn } from "../../../helpers/cn.mjs";
2
- import { AlertIcon } from "../../icons/lucide.mjs";
2
+ import { IconButton } from "../../buttons/icon-button/icon-button.mjs";
3
+ import { AlertIcon, CloseIcon } from "../../icons/lucide.mjs";
3
4
  import { jsx, jsxs } from "react/jsx-runtime";
4
5
  //#region src/components/feedback/alert/alert.tsx
5
6
  const STATUS_LABEL = {
@@ -8,29 +9,57 @@ const STATUS_LABEL = {
8
9
  warning: "警告",
9
10
  error: "エラー"
10
11
  };
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", {
12
+ const Alert = ({ tone, message, action, onClose, closeLabel = "閉じる", ...rest }) => {
13
+ const actionNode = action ? action.renderItem({ children: action.label }) : null;
14
+ const inlineAction = action ? /* @__PURE__ */ jsx("span", {
15
+ className: "ml-1",
16
+ children: actionNode
17
+ }) : null;
18
+ let messageContent;
19
+ if (Array.isArray(message) && message.length > 1) {
20
+ const list = /* @__PURE__ */ jsx("ul", {
21
+ className: "space-y-1",
22
+ children: message.map((msg) => /* @__PURE__ */ jsx("li", { children: msg }, msg))
23
+ });
24
+ messageContent = action ? /* @__PURE__ */ jsxs("div", { children: [list, /* @__PURE__ */ jsx("div", {
25
+ className: "mt-1",
26
+ children: actionNode
27
+ })] }) : list;
28
+ } else messageContent = /* @__PURE__ */ jsxs("p", {
28
29
  className: "font-bold",
29
- children: message[0]
30
- }) : /* @__PURE__ */ jsx("p", {
31
- className: "font-bold",
32
- children: message
33
- })]
34
- });
30
+ children: [Array.isArray(message) ? message[0] : message, inlineAction]
31
+ });
32
+ return /* @__PURE__ */ jsxs("div", {
33
+ ...rest,
34
+ 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"),
35
+ role: tone === "error" || tone === "warning" ? "alert" : "status",
36
+ children: [
37
+ /* @__PURE__ */ jsxs("span", {
38
+ className: cn("shrink-0", tone === "success" && "text-fg-success", tone === "info" && "text-fg-info", tone === "warning" && "text-fg-warning", tone === "error" && "text-fg-error"),
39
+ children: [/* @__PURE__ */ jsx(AlertIcon, {
40
+ size: "md",
41
+ status: tone
42
+ }), /* @__PURE__ */ jsx("span", {
43
+ className: "sr-only",
44
+ children: STATUS_LABEL[tone]
45
+ })]
46
+ }),
47
+ /* @__PURE__ */ jsx("div", {
48
+ className: "min-w-0 flex-1",
49
+ children: messageContent
50
+ }),
51
+ onClose ? /* @__PURE__ */ jsx("span", {
52
+ className: "shrink-0",
53
+ children: /* @__PURE__ */ jsx(IconButton, {
54
+ label: closeLabel,
55
+ onClick: onClose,
56
+ size: "sm",
57
+ tooltipDisabled: true,
58
+ children: /* @__PURE__ */ jsx(CloseIcon, { size: "sm" })
59
+ })
60
+ }) : null
61
+ ]
62
+ });
63
+ };
35
64
  //#endregion
36
65
  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";
@@ -223,10 +223,10 @@ declare const iconButtonProps: z.ZodObject<{
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,9 +366,9 @@ 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>;
@@ -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<{
@@ -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>;
@@ -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";
@@ -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.1",
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",