@linyao.tw/ui 1.0.0 → 1.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/README.md +9 -1
- package/dist/components/date-time/calendar.js +8 -6
- package/dist/components/date-time/calendar.js.map +1 -1
- package/dist/components/date-time/date-field.js +10 -8
- package/dist/components/date-time/date-field.js.map +1 -1
- package/dist/components/date-time/date-picker.js +8 -6
- package/dist/components/date-time/date-picker.js.map +1 -1
- package/dist/components/date-time/date-range-picker.js +8 -6
- package/dist/components/date-time/date-range-picker.js.map +1 -1
- package/dist/components/date-time/index.js +1 -1
- package/dist/components/date-time/shared.d.ts +0 -1
- package/dist/components/date-time/shared.js +7 -9
- package/dist/components/date-time/shared.js.map +1 -1
- package/dist/components/date-time/time-field.js +8 -6
- package/dist/components/date-time/time-field.js.map +1 -1
- package/dist/components/feedback/alert.js +35 -34
- package/dist/components/feedback/alert.js.map +1 -1
- package/dist/components/feedback/banner.js +15 -14
- package/dist/components/feedback/banner.js.map +1 -1
- package/dist/components/feedback/empty-state.d.ts +2 -1
- package/dist/components/feedback/empty-state.js +31 -31
- package/dist/components/feedback/empty-state.js.map +1 -1
- package/dist/components/feedback/feedback.types.d.ts +0 -1
- package/dist/components/feedback/feedback.types.js +3 -5
- package/dist/components/feedback/feedback.types.js.map +1 -1
- package/dist/components/feedback/index.d.ts +8 -8
- package/dist/components/feedback/meter.js +21 -21
- package/dist/components/feedback/meter.js.map +1 -1
- package/dist/components/feedback/progress.js +21 -21
- package/dist/components/feedback/progress.js.map +1 -1
- package/dist/components/feedback/skeleton.js +11 -11
- package/dist/components/feedback/skeleton.js.map +1 -1
- package/dist/components/feedback/spinner.js +25 -25
- package/dist/components/feedback/spinner.js.map +1 -1
- package/dist/components/feedback/toast.js +23 -21
- package/dist/components/feedback/toast.js.map +1 -1
- package/dist/components/forms/{CodeField.d.ts → code-field.d.ts} +1 -1
- package/dist/components/forms/code-field.js +66 -0
- package/dist/components/forms/code-field.js.map +1 -0
- package/dist/components/forms/{FileUpload.d.ts → file-upload.d.ts} +1 -1
- package/dist/components/forms/{FileUpload.js → file-upload.js} +128 -111
- package/dist/components/forms/file-upload.js.map +1 -0
- package/dist/components/forms/index.d.ts +6 -6
- package/dist/components/forms/{Input.js → input.js} +4 -3
- package/dist/components/forms/input.js.map +1 -0
- package/dist/components/forms/internal.d.ts +0 -2
- package/dist/components/forms/internal.js +22 -25
- package/dist/components/forms/internal.js.map +1 -1
- package/dist/components/forms/number-field.js +74 -0
- package/dist/components/forms/number-field.js.map +1 -0
- package/dist/components/forms/otp-field.js +58 -0
- package/dist/components/forms/otp-field.js.map +1 -0
- package/dist/components/forms/{TextField.d.ts → text-field.d.ts} +5 -0
- package/dist/components/forms/text-field.js +201 -0
- package/dist/components/forms/text-field.js.map +1 -0
- package/dist/components/foundations/{Avatar.js → avatar.js} +13 -10
- package/dist/components/foundations/avatar.js.map +1 -0
- package/dist/components/foundations/{Badge.d.ts → badge.d.ts} +1 -1
- package/dist/components/foundations/{Badge.js → badge.js} +4 -3
- package/dist/components/foundations/badge.js.map +1 -0
- package/dist/components/foundations/{Button.js → button.js} +4 -3
- package/dist/components/foundations/button.js.map +1 -0
- package/dist/components/foundations/{Card.d.ts → card.d.ts} +9 -2
- package/dist/components/foundations/{Card.js → card.js} +6 -5
- package/dist/components/foundations/card.js.map +1 -0
- package/dist/components/foundations/{IconButton.d.ts → icon-button.d.ts} +2 -8
- package/dist/components/foundations/{IconButton.js → icon-button.js} +5 -4
- package/dist/components/foundations/icon-button.js.map +1 -0
- package/dist/components/foundations/index.d.ts +9 -9
- package/dist/components/foundations/{Link.d.ts → link.d.ts} +1 -1
- package/dist/components/foundations/link.js +47 -0
- package/dist/components/foundations/link.js.map +1 -0
- package/dist/components/foundations/{ListCell.d.ts → list-cell.d.ts} +1 -8
- package/dist/components/foundations/{ListCell.js → list-cell.js} +4 -3
- package/dist/components/foundations/list-cell.js.map +1 -0
- package/dist/components/foundations/{SectionHeading.d.ts → section-heading.d.ts} +5 -2
- package/dist/components/foundations/{SectionHeading.js → section-heading.js} +4 -3
- package/dist/components/foundations/section-heading.js.map +1 -0
- package/dist/components/foundations/{Separator.js → separator.js} +4 -3
- package/dist/components/foundations/separator.js.map +1 -0
- package/dist/components/navigation-data/breadcrumb-pagination.js +89 -81
- package/dist/components/navigation-data/breadcrumb-pagination.js.map +1 -1
- package/dist/components/navigation-data/command-palette.d.ts +26 -0
- package/dist/components/navigation-data/command-palette.js +101 -72
- package/dist/components/navigation-data/command-palette.js.map +1 -1
- package/dist/components/navigation-data/header-tab-bar.js +50 -46
- package/dist/components/navigation-data/header-tab-bar.js.map +1 -1
- package/dist/components/navigation-data/index.d.ts +7 -7
- package/dist/components/navigation-data/menubar-toolbar.js +2 -1
- package/dist/components/navigation-data/menubar-toolbar.js.map +1 -1
- package/dist/components/navigation-data/navigation-menu.js +2 -1
- package/dist/components/navigation-data/navigation-menu.js.map +1 -1
- package/dist/components/navigation-data/scroll-area.js +2 -1
- package/dist/components/navigation-data/scroll-area.js.map +1 -1
- package/dist/components/navigation-data/table-collection.d.ts +12 -3
- package/dist/components/navigation-data/table-collection.js +12 -9
- package/dist/components/navigation-data/table-collection.js.map +1 -1
- package/dist/components/overlays/dialog.d.ts +23 -3
- package/dist/components/overlays/dialog.js +138 -130
- package/dist/components/overlays/dialog.js.map +1 -1
- package/dist/components/overlays/disclosure.js +2 -1
- package/dist/components/overlays/disclosure.js.map +1 -1
- package/dist/components/overlays/drawer.d.ts +9 -2
- package/dist/components/overlays/drawer.js +158 -151
- package/dist/components/overlays/drawer.js.map +1 -1
- package/dist/components/overlays/floating.js +116 -113
- package/dist/components/overlays/floating.js.map +1 -1
- package/dist/components/overlays/index.d.ts +4 -4
- package/dist/components/selection/combobox.js +94 -93
- package/dist/components/selection/combobox.js.map +1 -1
- package/dist/components/selection/controls.d.ts +4 -1
- package/dist/components/selection/controls.js +141 -118
- package/dist/components/selection/controls.js.map +1 -1
- package/dist/components/selection/menu.js +121 -121
- package/dist/components/selection/menu.js.map +1 -1
- package/dist/components/selection/select.js +108 -107
- package/dist/components/selection/select.js.map +1 -1
- package/dist/fonts.css +13 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +39 -33
- package/dist/internal/accessible-name.d.ts +12 -0
- package/dist/internal/class-names.d.ts +12 -0
- package/dist/{components/selection/classnames.js → internal/class-names.js} +4 -3
- package/dist/internal/class-names.js.map +1 -0
- package/dist/internal/index.d.ts +3 -0
- package/dist/{components/foundations/shared.d.ts → internal/render.d.ts} +2 -1
- package/dist/intl/index.d.ts +3 -0
- package/dist/intl/linyao-provider.d.ts +38 -0
- package/dist/intl/linyao-provider.js +27 -0
- package/dist/intl/linyao-provider.js.map +1 -0
- package/dist/intl/messages.d.ts +48 -0
- package/dist/intl/messages.js +81 -0
- package/dist/intl/messages.js.map +1 -0
- package/dist/intl/provider.d.ts +18 -0
- package/dist/intl/provider.js +31 -0
- package/dist/intl/provider.js.map +1 -0
- package/dist/styles.css +1 -1
- package/package.json +6 -4
- package/dist/components/feedback/feedback.module.js +0 -42
- package/dist/components/feedback/feedback.module.js.map +0 -1
- package/dist/components/forms/CodeField.js +0 -63
- package/dist/components/forms/CodeField.js.map +0 -1
- package/dist/components/forms/FileUpload.js.map +0 -1
- package/dist/components/forms/Input.js.map +0 -1
- package/dist/components/forms/NumberField.js +0 -71
- package/dist/components/forms/NumberField.js.map +0 -1
- package/dist/components/forms/OTPField.js +0 -54
- package/dist/components/forms/OTPField.js.map +0 -1
- package/dist/components/forms/TextField.js +0 -199
- package/dist/components/forms/TextField.js.map +0 -1
- package/dist/components/foundations/Avatar.js.map +0 -1
- package/dist/components/foundations/Badge.js.map +0 -1
- package/dist/components/foundations/Button.js.map +0 -1
- package/dist/components/foundations/Card.js.map +0 -1
- package/dist/components/foundations/IconButton.js.map +0 -1
- package/dist/components/foundations/Link.js +0 -40
- package/dist/components/foundations/Link.js.map +0 -1
- package/dist/components/foundations/ListCell.js.map +0 -1
- package/dist/components/foundations/SectionHeading.js.map +0 -1
- package/dist/components/foundations/Separator.js.map +0 -1
- package/dist/components/foundations/shared.js +0 -8
- package/dist/components/foundations/shared.js.map +0 -1
- package/dist/components/navigation-data/utils.d.ts +0 -2
- package/dist/components/navigation-data/utils.js +0 -11
- package/dist/components/navigation-data/utils.js.map +0 -1
- package/dist/components/overlays/class-names.d.ts +0 -6
- package/dist/components/overlays/class-names.js +0 -11
- package/dist/components/overlays/class-names.js.map +0 -1
- package/dist/components/selection/classnames.d.ts +0 -4
- package/dist/components/selection/classnames.js.map +0 -1
- package/dist/components/selection/selection.module.js +0 -51
- package/dist/components/selection/selection.module.js.map +0 -1
- /package/dist/components/forms/{Input.d.ts → input.d.ts} +0 -0
- /package/dist/components/forms/{NumberField.d.ts → number-field.d.ts} +0 -0
- /package/dist/components/forms/{OTPField.d.ts → otp-field.d.ts} +0 -0
- /package/dist/components/foundations/{Avatar.d.ts → avatar.d.ts} +0 -0
- /package/dist/components/foundations/{Button.d.ts → button.d.ts} +0 -0
- /package/dist/components/foundations/{Separator.d.ts → separator.d.ts} +0 -0
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx as e } from "../../internal/class-names.js";
|
|
3
|
+
import { getLiveRegionProps as t } from "./feedback.types.js";
|
|
4
|
+
import { forwardRef as n } from "react";
|
|
5
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
5
6
|
//#region src/components/feedback/banner.tsx
|
|
6
|
-
var
|
|
7
|
-
let
|
|
8
|
-
return /* @__PURE__ */
|
|
9
|
-
ref:
|
|
10
|
-
className:
|
|
11
|
-
"data-status":
|
|
12
|
-
role:
|
|
13
|
-
"aria-live":
|
|
14
|
-
...
|
|
7
|
+
var i = n(function({ "aria-live": n, className: i, live: a = "off", role: o, status: s = "neutral", ...c }, l) {
|
|
8
|
+
let u = t(a);
|
|
9
|
+
return /* @__PURE__ */ r("div", {
|
|
10
|
+
ref: l,
|
|
11
|
+
className: e("lyds-feedback-panel", "lyds-banner", i),
|
|
12
|
+
"data-status": s,
|
|
13
|
+
role: o ?? u.role,
|
|
14
|
+
"aria-live": n ?? u["aria-live"],
|
|
15
|
+
...c
|
|
15
16
|
});
|
|
16
17
|
});
|
|
17
18
|
//#endregion
|
|
18
|
-
export {
|
|
19
|
+
export { i as Banner };
|
|
19
20
|
|
|
20
21
|
//# sourceMappingURL=banner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banner.js","names":[],"sources":["../../../src/components/feedback/banner.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes } from \"react\";\n\nimport
|
|
1
|
+
{"version":3,"file":"banner.js","names":[],"sources":["../../../src/components/feedback/banner.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes } from \"react\";\n\nimport { cx } from \"@/internal\";\nimport { getLiveRegionProps, type FeedbackLiveMode, type FeedbackStatus } from \"./feedback.types\";\nexport interface BannerProps extends HTMLAttributes<HTMLDivElement> {\n\tstatus?: FeedbackStatus;\n\t/** 僅在 Banner 動態出現時使用 `polite` 或 `assertive`。 */\n\tlive?: FeedbackLiveMode;\n}\n\nexport const Banner = forwardRef<HTMLDivElement, BannerProps>(function Banner({ \"aria-live\": ariaLive, className, live = \"off\", role, status = \"neutral\", ...props }, ref) {\n\tconst liveRegionProps = getLiveRegionProps(live);\n\n\treturn (\n\t\t<div\n\t\t\tref={ref}\n\t\t\tclassName={cx(\"lyds-feedback-panel\", \"lyds-banner\", className)}\n\t\t\tdata-status={status}\n\t\t\trole={role ?? liveRegionProps.role}\n\t\t\taria-live={ariaLive ?? liveRegionProps[\"aria-live\"]}\n\t\t\t{...props}\n\t\t/>\n\t);\n});\n"],"mappings":";;;;;;AAUA,IAAa,IAAS,EAAwC,SAAgB,EAAE,aAAa,GAAU,cAAW,UAAO,OAAO,SAAM,YAAS,WAAW,GAAG,KAAS,GAAK;CAC1K,IAAM,IAAkB,EAAmB,CAAI;CAE/C,OACC,kBAAC,OAAD;EACM;EACL,WAAW,EAAG,uBAAuB,eAAe,CAAS;EAC7D,eAAa;EACb,MAAM,KAAQ,EAAgB;EAC9B,aAAW,KAAY,EAAgB;EACvC,GAAI;CACJ,CAAA;AAEH,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { HeadingLevel } from '../foundations/section-heading.js';
|
|
2
3
|
import { FeedbackStatus } from './feedback.types.js';
|
|
3
4
|
export interface EmptyStateProps extends Omit<HTMLAttributes<HTMLDivElement>, "title"> {
|
|
4
5
|
actions?: ReactNode;
|
|
5
6
|
description?: ReactNode;
|
|
6
7
|
eyebrow?: ReactNode;
|
|
7
|
-
headingLevel?:
|
|
8
|
+
headingLevel?: HeadingLevel;
|
|
8
9
|
icon?: ReactNode;
|
|
9
10
|
status?: FeedbackStatus;
|
|
10
11
|
title: ReactNode;
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { createElement as
|
|
4
|
-
import { jsx as
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx as e } from "../../internal/class-names.js";
|
|
3
|
+
import { createElement as t, forwardRef as n } from "react";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
5
|
//#region src/components/feedback/empty-state.tsx
|
|
6
|
-
var
|
|
7
|
-
return /* @__PURE__ */
|
|
8
|
-
ref:
|
|
9
|
-
className:
|
|
10
|
-
"data-status":
|
|
11
|
-
...
|
|
12
|
-
children: [/* @__PURE__ */
|
|
13
|
-
className:
|
|
6
|
+
var a = n(function({ actions: n, className: a, description: o, eyebrow: s, headingLevel: c = 2, icon: l, status: u = "neutral", title: d, ...f }, p) {
|
|
7
|
+
return /* @__PURE__ */ i("div", {
|
|
8
|
+
ref: p,
|
|
9
|
+
className: e("lyds-empty-state", a),
|
|
10
|
+
"data-status": u,
|
|
11
|
+
...f,
|
|
12
|
+
children: [/* @__PURE__ */ i("div", {
|
|
13
|
+
className: "lyds-empty-state__rail",
|
|
14
14
|
"aria-hidden": "true",
|
|
15
15
|
children: [
|
|
16
|
-
/* @__PURE__ */
|
|
17
|
-
/* @__PURE__ */
|
|
18
|
-
/* @__PURE__ */
|
|
16
|
+
/* @__PURE__ */ r("span", {}),
|
|
17
|
+
/* @__PURE__ */ r("span", {}),
|
|
18
|
+
/* @__PURE__ */ r("span", {})
|
|
19
19
|
]
|
|
20
|
-
}), /* @__PURE__ */
|
|
21
|
-
className:
|
|
20
|
+
}), /* @__PURE__ */ i("div", {
|
|
21
|
+
className: "lyds-empty-state__body",
|
|
22
22
|
children: [
|
|
23
|
-
|
|
24
|
-
className:
|
|
23
|
+
l ? /* @__PURE__ */ r("div", {
|
|
24
|
+
className: "lyds-empty-state__icon",
|
|
25
25
|
"aria-hidden": "true",
|
|
26
|
-
children:
|
|
26
|
+
children: l
|
|
27
27
|
}) : null,
|
|
28
|
-
|
|
29
|
-
className:
|
|
30
|
-
children: c
|
|
31
|
-
}) : null,
|
|
32
|
-
n(`h${l}`, { className: e.emptyStateTitle }, f),
|
|
33
|
-
s ? /* @__PURE__ */ i("p", {
|
|
34
|
-
className: e.emptyStateDescription,
|
|
28
|
+
s ? /* @__PURE__ */ r("div", {
|
|
29
|
+
className: "lyds-empty-state__eyebrow",
|
|
35
30
|
children: s
|
|
36
31
|
}) : null,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
32
|
+
t(`h${c}`, { className: "lyds-empty-state__title" }, d),
|
|
33
|
+
o ? /* @__PURE__ */ r("p", {
|
|
34
|
+
className: "lyds-empty-state__description",
|
|
35
|
+
children: o
|
|
36
|
+
}) : null,
|
|
37
|
+
n ? /* @__PURE__ */ r("div", {
|
|
38
|
+
className: "lyds-empty-state__actions",
|
|
39
|
+
children: n
|
|
40
40
|
}) : null
|
|
41
41
|
]
|
|
42
42
|
})]
|
|
43
43
|
});
|
|
44
44
|
});
|
|
45
45
|
//#endregion
|
|
46
|
-
export {
|
|
46
|
+
export { a as EmptyState };
|
|
47
47
|
|
|
48
48
|
//# sourceMappingURL=empty-state.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empty-state.js","names":[],"sources":["../../../src/components/feedback/empty-state.tsx"],"sourcesContent":["import { createElement, forwardRef, type HTMLAttributes, type ReactNode } from \"react\";\n\nimport
|
|
1
|
+
{"version":3,"file":"empty-state.js","names":[],"sources":["../../../src/components/feedback/empty-state.tsx"],"sourcesContent":["import { createElement, forwardRef, type HTMLAttributes, type ReactNode } from \"react\";\n\nimport type { HeadingLevel } from \"@/components/foundations/section-heading\";\nimport { cx } from \"@/internal\";\nimport { type FeedbackStatus } from \"./feedback.types\";\nexport interface EmptyStateProps extends Omit<HTMLAttributes<HTMLDivElement>, \"title\"> {\n\tactions?: ReactNode;\n\tdescription?: ReactNode;\n\teyebrow?: ReactNode;\n\theadingLevel?: HeadingLevel;\n\ticon?: ReactNode;\n\tstatus?: FeedbackStatus;\n\ttitle: ReactNode;\n}\n\nexport const EmptyState = forwardRef<HTMLDivElement, EmptyStateProps>(function EmptyState(\n\t{ actions, className, description, eyebrow, headingLevel = 2, icon, status = \"neutral\", title, ...props },\n\tref\n) {\n\treturn (\n\t\t<div ref={ref} className={cx(\"lyds-empty-state\", className)} data-status={status} {...props}>\n\t\t\t<div className={\"lyds-empty-state__rail\"} aria-hidden=\"true\">\n\t\t\t\t<span />\n\t\t\t\t<span />\n\t\t\t\t<span />\n\t\t\t</div>\n\t\t\t<div className={\"lyds-empty-state__body\"}>\n\t\t\t\t{icon ? (\n\t\t\t\t\t<div className={\"lyds-empty-state__icon\"} aria-hidden=\"true\">\n\t\t\t\t\t\t{icon}\n\t\t\t\t\t</div>\n\t\t\t\t) : null}\n\t\t\t\t{eyebrow ? <div className={\"lyds-empty-state__eyebrow\"}>{eyebrow}</div> : null}\n\t\t\t\t{createElement(`h${headingLevel}`, { className: \"lyds-empty-state__title\" }, title)}\n\t\t\t\t{description ? <p className={\"lyds-empty-state__description\"}>{description}</p> : null}\n\t\t\t\t{actions ? <div className={\"lyds-empty-state__actions\"}>{actions}</div> : null}\n\t\t\t</div>\n\t\t</div>\n\t);\n});\n"],"mappings":";;;;;AAeA,IAAa,IAAa,EAA4C,SACrE,EAAE,YAAS,cAAW,gBAAa,YAAS,kBAAe,GAAG,SAAM,YAAS,WAAW,UAAO,GAAG,KAClG,GACC;CACD,OACC,kBAAC,OAAD;EAAU;EAAK,WAAW,EAAG,oBAAoB,CAAS;EAAG,eAAa;EAAQ,GAAI;EAAtF,UAAA,CACC,kBAAC,OAAD;GAAK,WAAW;GAA0B,eAAY;GAAtD,UAAA;IACC,kBAAC,QAAD,CAAO,CAAA;IACP,kBAAC,QAAD,CAAO,CAAA;IACP,kBAAC,QAAD,CAAO,CAAA;GACH;EACL,CAAA,GAAA,kBAAC,OAAD;GAAK,WAAW;GAAhB,UAAA;IACE,IACA,kBAAC,OAAD;KAAK,WAAW;KAA0B,eAAY;KACpD,UAAA;IACG,CAAA,IACF;IACH,IAAU,kBAAC,OAAD;KAAK,WAAW;KAA8B,UAAA;IAAa,CAAA,IAAI;IACzE,EAAc,IAAI,KAAgB,EAAE,WAAW,0BAA0B,GAAG,CAAK;IACjF,IAAc,kBAAC,KAAD;KAAG,WAAW;KAAkC,UAAA;IAAe,CAAA,IAAI;IACjF,IAAU,kBAAC,OAAD;KAAK,WAAW;KAA8B,UAAA;IAAa,CAAA,IAAI;GACtE;EACD,CAAA,CAAA;;AAEP,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export declare const FEEDBACK_STATUSES: readonly ["neutral", "info", "success", "warning", "danger"];
|
|
2
2
|
export type FeedbackStatus = (typeof FEEDBACK_STATUSES)[number];
|
|
3
3
|
export type FeedbackLiveMode = "off" | "polite" | "assertive";
|
|
4
|
-
export declare function mergeClassNames(...classNames: Array<string | undefined>): string;
|
|
5
4
|
export declare function getLiveRegionProps(live: FeedbackLiveMode): {
|
|
6
5
|
"aria-live"?: "polite" | "assertive";
|
|
7
6
|
role?: "status" | "alert";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
//#region src/components/feedback/feedback.types.ts
|
|
2
3
|
var e = [
|
|
3
4
|
"neutral",
|
|
@@ -6,10 +7,7 @@ var e = [
|
|
|
6
7
|
"warning",
|
|
7
8
|
"danger"
|
|
8
9
|
];
|
|
9
|
-
function t(
|
|
10
|
-
return e.filter(Boolean).join(" ");
|
|
11
|
-
}
|
|
12
|
-
function n(e) {
|
|
10
|
+
function t(e) {
|
|
13
11
|
return e === "assertive" ? {
|
|
14
12
|
"aria-live": "assertive",
|
|
15
13
|
role: "alert"
|
|
@@ -19,6 +17,6 @@ function n(e) {
|
|
|
19
17
|
} : {};
|
|
20
18
|
}
|
|
21
19
|
//#endregion
|
|
22
|
-
export { e as FEEDBACK_STATUSES,
|
|
20
|
+
export { e as FEEDBACK_STATUSES, t as getLiveRegionProps };
|
|
23
21
|
|
|
24
22
|
//# sourceMappingURL=feedback.types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feedback.types.js","names":[],"sources":["../../../src/components/feedback/feedback.types.ts"],"sourcesContent":["export const FEEDBACK_STATUSES = [\"neutral\", \"info\", \"success\", \"warning\", \"danger\"] as const;\n\nexport type FeedbackStatus = (typeof FEEDBACK_STATUSES)[number];\n\nexport type FeedbackLiveMode = \"off\" | \"polite\" | \"assertive\";\n\nexport function
|
|
1
|
+
{"version":3,"file":"feedback.types.js","names":[],"sources":["../../../src/components/feedback/feedback.types.ts"],"sourcesContent":["export const FEEDBACK_STATUSES = [\"neutral\", \"info\", \"success\", \"warning\", \"danger\"] as const;\n\nexport type FeedbackStatus = (typeof FEEDBACK_STATUSES)[number];\n\nexport type FeedbackLiveMode = \"off\" | \"polite\" | \"assertive\";\n\nexport function getLiveRegionProps(live: FeedbackLiveMode): {\n\t\"aria-live\"?: \"polite\" | \"assertive\";\n\trole?: \"status\" | \"alert\";\n} {\n\tif (live === \"assertive\") {\n\t\treturn { \"aria-live\": \"assertive\", role: \"alert\" };\n\t}\n\n\tif (live === \"polite\") {\n\t\treturn { \"aria-live\": \"polite\", role: \"status\" };\n\t}\n\n\treturn {};\n}\n"],"mappings":";;AAAA,IAAa,IAAoB;CAAC;CAAW;CAAQ;CAAW;CAAW;AAAQ;AAMnF,SAAgB,EAAmB,GAGjC;CASD,OARI,MAAS,cACL;EAAE,aAAa;EAAa,MAAM;CAAQ,IAG9C,MAAS,WACL;EAAE,aAAa;EAAU,MAAM;CAAS,IAGzC,CAAC;AACT"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
1
|
+
export { Alert, AlertActions, AlertContent, AlertDescription, AlertTitle, AlertView, type AlertProps } from './alert.js';
|
|
2
|
+
export { Banner, type BannerProps } from './banner.js';
|
|
3
|
+
export { EmptyState, type EmptyStateProps } from './empty-state.js';
|
|
4
4
|
export { FEEDBACK_STATUSES, type FeedbackLiveMode, type FeedbackStatus } from './feedback.types.js';
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
5
|
+
export { Meter, type MeterProps } from './meter.js';
|
|
6
|
+
export { Progress, type ProgressProps } from './progress.js';
|
|
7
|
+
export { Skeleton, type SkeletonProps } from './skeleton.js';
|
|
8
|
+
export { Loader, Spinner, type LoaderProps, type SpinnerProps } from './spinner.js';
|
|
9
|
+
export { ToastProvider, ToastRoot, ToastViewport, createToastManager, useToastManager, type ToastData, type ToastManager, type ToastObject, type ToastProviderProps, type ToastRootProps, type ToastViewportProps } from './toast.js';
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { jsx as
|
|
5
|
-
import { Meter as
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx as e } from "../../internal/class-names.js";
|
|
3
|
+
import { forwardRef as t } from "react";
|
|
4
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
5
|
+
import { Meter as i } from "@base-ui/react/meter";
|
|
6
6
|
//#region src/components/feedback/meter.tsx
|
|
7
|
-
var
|
|
8
|
-
return /* @__PURE__ */ i
|
|
9
|
-
ref:
|
|
10
|
-
className:
|
|
11
|
-
"data-status":
|
|
12
|
-
...
|
|
13
|
-
children: [/* @__PURE__ */
|
|
14
|
-
className:
|
|
15
|
-
children: [/* @__PURE__ */
|
|
16
|
-
className:
|
|
17
|
-
children:
|
|
18
|
-
}),
|
|
19
|
-
}), /* @__PURE__ */
|
|
20
|
-
className:
|
|
21
|
-
children: /* @__PURE__ */
|
|
7
|
+
var a = t(function({ className: t, indicatorClassName: a, label: o, showValue: s = !0, status: c = "neutral", trackClassName: l, ...u }, d) {
|
|
8
|
+
return /* @__PURE__ */ r(i.Root, {
|
|
9
|
+
ref: d,
|
|
10
|
+
className: e("lyds-range", t),
|
|
11
|
+
"data-status": c,
|
|
12
|
+
...u,
|
|
13
|
+
children: [/* @__PURE__ */ r("div", {
|
|
14
|
+
className: "lyds-range__header",
|
|
15
|
+
children: [/* @__PURE__ */ n(i.Label, {
|
|
16
|
+
className: "lyds-range__label",
|
|
17
|
+
children: o
|
|
18
|
+
}), s ? /* @__PURE__ */ n(i.Value, { className: "lyds-range__value" }) : null]
|
|
19
|
+
}), /* @__PURE__ */ n(i.Track, {
|
|
20
|
+
className: e("lyds-range__track", l),
|
|
21
|
+
children: /* @__PURE__ */ n(i.Indicator, { className: e("lyds-range__indicator", a) })
|
|
22
22
|
})]
|
|
23
23
|
});
|
|
24
24
|
});
|
|
25
25
|
//#endregion
|
|
26
|
-
export {
|
|
26
|
+
export { a as Meter };
|
|
27
27
|
|
|
28
28
|
//# sourceMappingURL=meter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meter.js","names":[],"sources":["../../../src/components/feedback/meter.tsx"],"sourcesContent":["import { Meter as BaseMeter } from \"@base-ui/react/meter\";\nimport { forwardRef, type ReactNode } from \"react\";\n\nimport
|
|
1
|
+
{"version":3,"file":"meter.js","names":[],"sources":["../../../src/components/feedback/meter.tsx"],"sourcesContent":["import { Meter as BaseMeter } from \"@base-ui/react/meter\";\nimport { forwardRef, type ReactNode } from \"react\";\n\nimport { cx } from \"@/internal\";\nimport { type FeedbackStatus } from \"./feedback.types\";\nexport interface MeterProps extends Omit<BaseMeter.Root.Props, \"children\" | \"className\"> {\n\tlabel: ReactNode;\n\tclassName?: string;\n\ttrackClassName?: string;\n\tindicatorClassName?: string;\n\tstatus?: FeedbackStatus;\n\tshowValue?: boolean;\n}\n\nexport const Meter = forwardRef<HTMLDivElement, MeterProps>(function Meter({ className, indicatorClassName, label, showValue = true, status = \"neutral\", trackClassName, ...props }, ref) {\n\treturn (\n\t\t<BaseMeter.Root ref={ref} className={cx(\"lyds-range\", className)} data-status={status} {...props}>\n\t\t\t<div className={\"lyds-range__header\"}>\n\t\t\t\t<BaseMeter.Label className={\"lyds-range__label\"}>{label}</BaseMeter.Label>\n\t\t\t\t{showValue ? <BaseMeter.Value className={\"lyds-range__value\"} /> : null}\n\t\t\t</div>\n\t\t\t<BaseMeter.Track className={cx(\"lyds-range__track\", trackClassName)}>\n\t\t\t\t<BaseMeter.Indicator className={cx(\"lyds-range__indicator\", indicatorClassName)} />\n\t\t\t</BaseMeter.Track>\n\t\t</BaseMeter.Root>\n\t);\n});\n"],"mappings":";;;;;;AAcA,IAAa,IAAQ,EAAuC,SAAe,EAAE,cAAW,uBAAoB,UAAO,eAAY,IAAM,YAAS,WAAW,mBAAgB,GAAG,KAAS,GAAK;CACzL,OACC,kBAAC,EAAU,MAAX;EAAqB;EAAK,WAAW,EAAG,cAAc,CAAS;EAAG,eAAa;EAAQ,GAAI;EAA3F,UAAA,CACC,kBAAC,OAAD;GAAK,WAAW;GAAhB,UAAA,CACC,kBAAC,EAAU,OAAX;IAAiB,WAAW;IAAsB,UAAA;GAAuB,CAAA,GACxE,IAAY,kBAAC,EAAU,OAAX,EAAiB,WAAW,oBAAsB,CAAA,IAAI,IAC/D;EACL,CAAA,GAAA,kBAAC,EAAU,OAAX;GAAiB,WAAW,EAAG,qBAAqB,CAAc;GACjE,UAAA,kBAAC,EAAU,WAAX,EAAqB,WAAW,EAAG,yBAAyB,CAAkB,EAAI,CAAA;EAClE,CAAA,CACF;;AAElB,CAAC"}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { jsx as
|
|
5
|
-
import { Progress as
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx as e } from "../../internal/class-names.js";
|
|
3
|
+
import { forwardRef as t } from "react";
|
|
4
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
5
|
+
import { Progress as i } from "@base-ui/react/progress";
|
|
6
6
|
//#region src/components/feedback/progress.tsx
|
|
7
|
-
var
|
|
8
|
-
return /* @__PURE__ */ i
|
|
9
|
-
ref:
|
|
10
|
-
className:
|
|
11
|
-
"data-status":
|
|
12
|
-
...
|
|
13
|
-
children: [/* @__PURE__ */
|
|
14
|
-
className:
|
|
15
|
-
children: [/* @__PURE__ */
|
|
16
|
-
className:
|
|
17
|
-
children:
|
|
18
|
-
}),
|
|
19
|
-
}), /* @__PURE__ */
|
|
20
|
-
className:
|
|
21
|
-
children: /* @__PURE__ */
|
|
7
|
+
var a = t(function({ className: t, indicatorClassName: a, label: o, showValue: s = !0, status: c = "neutral", trackClassName: l, ...u }, d) {
|
|
8
|
+
return /* @__PURE__ */ r(i.Root, {
|
|
9
|
+
ref: d,
|
|
10
|
+
className: e("lyds-range", t),
|
|
11
|
+
"data-status": c,
|
|
12
|
+
...u,
|
|
13
|
+
children: [/* @__PURE__ */ r("div", {
|
|
14
|
+
className: "lyds-range__header",
|
|
15
|
+
children: [/* @__PURE__ */ n(i.Label, {
|
|
16
|
+
className: "lyds-range__label",
|
|
17
|
+
children: o
|
|
18
|
+
}), s ? /* @__PURE__ */ n(i.Value, { className: "lyds-range__value" }) : null]
|
|
19
|
+
}), /* @__PURE__ */ n(i.Track, {
|
|
20
|
+
className: e("lyds-range__track", l),
|
|
21
|
+
children: /* @__PURE__ */ n(i.Indicator, { className: e("lyds-range__indicator", a) })
|
|
22
22
|
})]
|
|
23
23
|
});
|
|
24
24
|
});
|
|
25
25
|
//#endregion
|
|
26
|
-
export {
|
|
26
|
+
export { a as Progress };
|
|
27
27
|
|
|
28
28
|
//# sourceMappingURL=progress.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress.js","names":[],"sources":["../../../src/components/feedback/progress.tsx"],"sourcesContent":["import { Progress as BaseProgress } from \"@base-ui/react/progress\";\nimport { forwardRef, type ReactNode } from \"react\";\n\nimport
|
|
1
|
+
{"version":3,"file":"progress.js","names":[],"sources":["../../../src/components/feedback/progress.tsx"],"sourcesContent":["import { Progress as BaseProgress } from \"@base-ui/react/progress\";\nimport { forwardRef, type ReactNode } from \"react\";\n\nimport { cx } from \"@/internal\";\nimport { type FeedbackStatus } from \"./feedback.types\";\nexport interface ProgressProps extends Omit<BaseProgress.Root.Props, \"children\" | \"className\"> {\n\tlabel: ReactNode;\n\tclassName?: string;\n\ttrackClassName?: string;\n\tindicatorClassName?: string;\n\tstatus?: FeedbackStatus;\n\tshowValue?: boolean;\n}\n\nexport const Progress = forwardRef<HTMLDivElement, ProgressProps>(function Progress({ className, indicatorClassName, label, showValue = true, status = \"neutral\", trackClassName, ...props }, ref) {\n\treturn (\n\t\t<BaseProgress.Root ref={ref} className={cx(\"lyds-range\", className)} data-status={status} {...props}>\n\t\t\t<div className={\"lyds-range__header\"}>\n\t\t\t\t<BaseProgress.Label className={\"lyds-range__label\"}>{label}</BaseProgress.Label>\n\t\t\t\t{showValue ? <BaseProgress.Value className={\"lyds-range__value\"} /> : null}\n\t\t\t</div>\n\t\t\t<BaseProgress.Track className={cx(\"lyds-range__track\", trackClassName)}>\n\t\t\t\t<BaseProgress.Indicator className={cx(\"lyds-range__indicator\", indicatorClassName)} />\n\t\t\t</BaseProgress.Track>\n\t\t</BaseProgress.Root>\n\t);\n});\n"],"mappings":";;;;;;AAcA,IAAa,IAAW,EAA0C,SAAkB,EAAE,cAAW,uBAAoB,UAAO,eAAY,IAAM,YAAS,WAAW,mBAAgB,GAAG,KAAS,GAAK;CAClM,OACC,kBAAC,EAAa,MAAd;EAAwB;EAAK,WAAW,EAAG,cAAc,CAAS;EAAG,eAAa;EAAQ,GAAI;EAA9F,UAAA,CACC,kBAAC,OAAD;GAAK,WAAW;GAAhB,UAAA,CACC,kBAAC,EAAa,OAAd;IAAoB,WAAW;IAAsB,UAAA;GAA0B,CAAA,GAC9E,IAAY,kBAAC,EAAa,OAAd,EAAoB,WAAW,oBAAsB,CAAA,IAAI,IAClE;EACL,CAAA,GAAA,kBAAC,EAAa,OAAd;GAAoB,WAAW,EAAG,qBAAqB,CAAc;GACpE,UAAA,kBAAC,EAAa,WAAd,EAAwB,WAAW,EAAG,yBAAyB,CAAkB,EAAI,CAAA;EAClE,CAAA,CACF;;AAErB,CAAC"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { jsx as
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx as e } from "../../internal/class-names.js";
|
|
3
|
+
import { forwardRef as t } from "react";
|
|
4
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
5
5
|
//#region src/components/feedback/skeleton.tsx
|
|
6
|
-
var
|
|
7
|
-
return /* @__PURE__ */
|
|
8
|
-
ref:
|
|
6
|
+
var r = t(function({ className: t, shape: r = "text", ...i }, a) {
|
|
7
|
+
return /* @__PURE__ */ n("span", {
|
|
8
|
+
ref: a,
|
|
9
9
|
"aria-hidden": "true",
|
|
10
|
-
className:
|
|
11
|
-
"data-shape":
|
|
12
|
-
...
|
|
10
|
+
className: e("lyds-skeleton", t),
|
|
11
|
+
"data-shape": r,
|
|
12
|
+
...i
|
|
13
13
|
});
|
|
14
14
|
});
|
|
15
15
|
//#endregion
|
|
16
|
-
export {
|
|
16
|
+
export { r as Skeleton };
|
|
17
17
|
|
|
18
18
|
//# sourceMappingURL=skeleton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skeleton.js","names":[],"sources":["../../../src/components/feedback/skeleton.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes } from \"react\";\n\nimport
|
|
1
|
+
{"version":3,"file":"skeleton.js","names":[],"sources":["../../../src/components/feedback/skeleton.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes } from \"react\";\n\nimport { cx } from \"@/internal\";\nexport interface SkeletonProps extends Omit<HTMLAttributes<HTMLSpanElement>, \"aria-hidden\" | \"children\"> {\n\tshape?: \"text\" | \"rectangular\" | \"circular\";\n}\n\nexport const Skeleton = forwardRef<HTMLSpanElement, SkeletonProps>(function Skeleton({ className, shape = \"text\", ...props }, ref) {\n\treturn <span ref={ref} aria-hidden=\"true\" className={cx(\"lyds-skeleton\", className)} data-shape={shape} {...props} />;\n});\n"],"mappings":";;;;;AAOA,IAAa,IAAW,EAA2C,SAAkB,EAAE,cAAW,WAAQ,QAAQ,GAAG,KAAS,GAAK;CAClI,OAAO,kBAAC,QAAD;EAAW;EAAK,eAAY;EAAO,WAAW,EAAG,iBAAiB,CAAS;EAAG,cAAY;EAAO,GAAI;CAAQ,CAAA;AACrH,CAAC"}
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { jsx as
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx as e } from "../../internal/class-names.js";
|
|
3
|
+
import { forwardRef as t } from "react";
|
|
4
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
5
5
|
//#region src/components/feedback/spinner.tsx
|
|
6
|
-
var
|
|
7
|
-
return /* @__PURE__ */
|
|
8
|
-
ref:
|
|
9
|
-
"aria-hidden":
|
|
10
|
-
"aria-label":
|
|
11
|
-
className:
|
|
12
|
-
"data-size":
|
|
13
|
-
"data-status":
|
|
14
|
-
role:
|
|
15
|
-
...
|
|
6
|
+
var i = t(function({ className: t, decorative: r = !1, label: i, size: a = "md", status: o = "neutral", ...s }, c) {
|
|
7
|
+
return /* @__PURE__ */ n("span", {
|
|
8
|
+
ref: c,
|
|
9
|
+
"aria-hidden": r ? "true" : void 0,
|
|
10
|
+
"aria-label": r ? void 0 : i,
|
|
11
|
+
className: e("lyds-spinner", t),
|
|
12
|
+
"data-size": a,
|
|
13
|
+
"data-status": o,
|
|
14
|
+
role: r ? void 0 : "status",
|
|
15
|
+
...s
|
|
16
16
|
});
|
|
17
|
-
}),
|
|
18
|
-
return /* @__PURE__ */
|
|
19
|
-
ref:
|
|
17
|
+
}), a = t(function({ className: t, label: a, size: o = "md", status: s = "neutral", ...c }, l) {
|
|
18
|
+
return /* @__PURE__ */ r("div", {
|
|
19
|
+
ref: l,
|
|
20
20
|
"aria-live": "polite",
|
|
21
|
-
className:
|
|
22
|
-
"data-status":
|
|
21
|
+
className: e("lyds-loader", t),
|
|
22
|
+
"data-status": s,
|
|
23
23
|
role: "status",
|
|
24
|
-
...
|
|
25
|
-
children: [/* @__PURE__ */
|
|
24
|
+
...c,
|
|
25
|
+
children: [/* @__PURE__ */ n(i, {
|
|
26
26
|
decorative: !0,
|
|
27
|
-
size:
|
|
28
|
-
status:
|
|
29
|
-
}), /* @__PURE__ */
|
|
27
|
+
size: o,
|
|
28
|
+
status: s
|
|
29
|
+
}), /* @__PURE__ */ n("span", { children: a })]
|
|
30
30
|
});
|
|
31
31
|
});
|
|
32
32
|
//#endregion
|
|
33
|
-
export {
|
|
33
|
+
export { a as Loader, i as Spinner };
|
|
34
34
|
|
|
35
35
|
//# sourceMappingURL=spinner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spinner.js","names":[],"sources":["../../../src/components/feedback/spinner.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes, type ReactNode } from \"react\";\n\nimport
|
|
1
|
+
{"version":3,"file":"spinner.js","names":[],"sources":["../../../src/components/feedback/spinner.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes, type ReactNode } from \"react\";\n\nimport { cx } from \"@/internal\";\nimport { type FeedbackStatus } from \"./feedback.types\";\ntype SpinnerAccessibilityProps =\n\t| {\n\t\t\t/** 附近已有載入說明文字時,對輔助科技隱藏 Spinner。 */\n\t\t\tdecorative: true;\n\t\t\tlabel?: never;\n\t }\n\t| {\n\t\t\tdecorative?: false;\n\t\t\t/** 由狀態區域播報的無障礙名稱。 */\n\t\t\tlabel: string;\n\t };\n\nexport type SpinnerProps = Omit<HTMLAttributes<HTMLSpanElement>, \"aria-hidden\" | \"aria-label\" | \"children\" | \"role\"> &\n\tSpinnerAccessibilityProps & {\n\t\tsize?: \"sm\" | \"md\" | \"lg\";\n\t\tstatus?: FeedbackStatus;\n\t};\n\nexport const Spinner = forwardRef<HTMLSpanElement, SpinnerProps>(function Spinner({ className, decorative = false, label, size = \"md\", status = \"neutral\", ...props }, ref) {\n\treturn (\n\t\t<span\n\t\t\tref={ref}\n\t\t\taria-hidden={decorative ? \"true\" : undefined}\n\t\t\taria-label={decorative ? undefined : label}\n\t\t\tclassName={cx(\"lyds-spinner\", className)}\n\t\t\tdata-size={size}\n\t\t\tdata-status={status}\n\t\t\trole={decorative ? undefined : \"status\"}\n\t\t\t{...props}\n\t\t/>\n\t);\n});\n\nexport interface LoaderProps extends Omit<HTMLAttributes<HTMLDivElement>, \"children\"> {\n\tlabel: ReactNode;\n\tsize?: \"sm\" | \"md\" | \"lg\";\n\tstatus?: FeedbackStatus;\n}\n\nexport const Loader = forwardRef<HTMLDivElement, LoaderProps>(function Loader({ className, label, size = \"md\", status = \"neutral\", ...props }, ref) {\n\treturn (\n\t\t<div ref={ref} aria-live=\"polite\" className={cx(\"lyds-loader\", className)} data-status={status} role=\"status\" {...props}>\n\t\t\t<Spinner decorative size={size} status={status} />\n\t\t\t<span>{label}</span>\n\t\t</div>\n\t);\n});\n"],"mappings":";;;;;AAsBA,IAAa,IAAU,EAA0C,SAAiB,EAAE,cAAW,gBAAa,IAAO,UAAO,UAAO,MAAM,YAAS,WAAW,GAAG,KAAS,GAAK;CAC3K,OACC,kBAAC,QAAD;EACM;EACL,eAAa,IAAa,SAAS,KAAA;EACnC,cAAY,IAAa,KAAA,IAAY;EACrC,WAAW,EAAG,gBAAgB,CAAS;EACvC,aAAW;EACX,eAAa;EACb,MAAM,IAAa,KAAA,IAAY;EAC/B,GAAI;CACJ,CAAA;AAEH,CAAC,GAQY,IAAS,EAAwC,SAAgB,EAAE,cAAW,UAAO,UAAO,MAAM,YAAS,WAAW,GAAG,KAAS,GAAK;CACnJ,OACC,kBAAC,OAAD;EAAU;EAAK,aAAU;EAAS,WAAW,EAAG,eAAe,CAAS;EAAG,eAAa;EAAQ,MAAK;EAAS,GAAI;EAAlH,UAAA,CACC,kBAAC,GAAD;GAAS,YAAA;GAAiB;GAAc;EAAS,CAAA,GACjD,kBAAC,QAAD,EAAA,UAAO,EAAY,CAAA,CACf;;AAEP,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx as e } from "../../internal/class-names.js";
|
|
3
|
+
import { FEEDBACK_STATUSES as t } from "./feedback.types.js";
|
|
4
|
+
import { useMessages as n } from "../../intl/provider.js";
|
|
3
5
|
import { Fragment as r, createElement as i, forwardRef as a } from "react";
|
|
4
6
|
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
5
7
|
import { Toast as c } from "@base-ui/react/toast";
|
|
@@ -16,30 +18,30 @@ function p(e) {
|
|
|
16
18
|
let t = e.data?.status;
|
|
17
19
|
return typeof t == "string" && u.has(t) ? t : e.type && u.has(e.type) ? e.type : "neutral";
|
|
18
20
|
}
|
|
19
|
-
var m = a(function({ className: t, closeLabel: r
|
|
20
|
-
let d = i.actionProps,
|
|
21
|
+
var m = a(function({ className: t, closeLabel: r, toast: i, ...a }, u) {
|
|
22
|
+
let d = n(), f = i.actionProps, m = f?.className, h = p(i);
|
|
21
23
|
return /* @__PURE__ */ s(c.Root, {
|
|
22
24
|
ref: u,
|
|
23
|
-
className:
|
|
24
|
-
"data-status":
|
|
25
|
+
className: e("lyds-toast", t),
|
|
26
|
+
"data-status": h,
|
|
25
27
|
toast: i,
|
|
26
28
|
...a,
|
|
27
29
|
children: [
|
|
28
30
|
/* @__PURE__ */ o("span", {
|
|
29
31
|
"aria-hidden": "true",
|
|
30
|
-
className:
|
|
32
|
+
className: "lyds-toast__signal"
|
|
31
33
|
}),
|
|
32
34
|
/* @__PURE__ */ s(c.Content, {
|
|
33
|
-
className:
|
|
34
|
-
children: [i.title ? /* @__PURE__ */ o(c.Title, { className:
|
|
35
|
+
className: "lyds-toast__content",
|
|
36
|
+
children: [i.title ? /* @__PURE__ */ o(c.Title, { className: "lyds-toast__title" }) : null, i.description ? /* @__PURE__ */ o(c.Description, { className: "lyds-toast__description" }) : null]
|
|
35
37
|
}),
|
|
36
|
-
|
|
37
|
-
...
|
|
38
|
-
className:
|
|
38
|
+
f ? /* @__PURE__ */ o(c.Action, {
|
|
39
|
+
...f,
|
|
40
|
+
className: e("lyds-toast__action", m)
|
|
39
41
|
}) : null,
|
|
40
42
|
/* @__PURE__ */ o(c.Close, {
|
|
41
|
-
"aria-label": r,
|
|
42
|
-
className:
|
|
43
|
+
"aria-label": r ?? d.toastClose,
|
|
44
|
+
className: "lyds-toast__close",
|
|
43
45
|
children: /* @__PURE__ */ o(l, {
|
|
44
46
|
"aria-hidden": "true",
|
|
45
47
|
weight: "bold"
|
|
@@ -47,14 +49,14 @@ var m = a(function({ className: t, closeLabel: r = "關閉通知", toast: i, ...
|
|
|
47
49
|
})
|
|
48
50
|
]
|
|
49
51
|
});
|
|
50
|
-
}), h = a(function({ className: t, closeLabel:
|
|
51
|
-
let
|
|
52
|
+
}), h = a(function({ className: t, closeLabel: n, renderToast: a, ...s }, l) {
|
|
53
|
+
let u = c.useToastManager();
|
|
52
54
|
return /* @__PURE__ */ o(c.Portal, { children: /* @__PURE__ */ o(c.Viewport, {
|
|
53
|
-
ref:
|
|
54
|
-
className:
|
|
55
|
-
...
|
|
56
|
-
children:
|
|
57
|
-
...
|
|
55
|
+
ref: l,
|
|
56
|
+
className: e("lyds-toast__viewport", t),
|
|
57
|
+
...s,
|
|
58
|
+
children: u.toasts.map((e) => a ? /* @__PURE__ */ o(r, { children: a(e) }, e.id) : /* @__PURE__ */ i(m, {
|
|
59
|
+
...n === void 0 ? {} : { closeLabel: n },
|
|
58
60
|
key: e.id,
|
|
59
61
|
toast: e
|
|
60
62
|
}))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast.js","names":[],"sources":["../../../src/components/feedback/toast.tsx"],"sourcesContent":["import { Toast as BaseToast } from \"@base-ui/react/toast\";\nimport { XIcon } from \"@phosphor-icons/react/dist/csr/X\";\nimport { Fragment, forwardRef, type ComponentPropsWithoutRef, type ForwardedRef, type ReactElement, type ReactNode, type RefAttributes } from \"react\";\n\nimport
|
|
1
|
+
{"version":3,"file":"toast.js","names":[],"sources":["../../../src/components/feedback/toast.tsx"],"sourcesContent":["import { Toast as BaseToast } from \"@base-ui/react/toast\";\nimport { XIcon } from \"@phosphor-icons/react/dist/csr/X\";\nimport { Fragment, forwardRef, type ComponentPropsWithoutRef, type ForwardedRef, type ReactElement, type ReactNode, type RefAttributes } from \"react\";\n\nimport { cx } from \"@/internal\";\nimport { useMessages } from \"@/intl\";\nimport { FEEDBACK_STATUSES, type FeedbackStatus } from \"./feedback.types\";\nconst feedbackStatusSet: ReadonlySet<string> = new Set(FEEDBACK_STATUSES);\n\nexport interface ToastData extends Record<string, unknown> {\n\tstatus?: FeedbackStatus;\n}\n\nexport type ToastObject<Data extends object = ToastData> = BaseToast.Root.ToastObject<Data>;\nexport type ToastManager<Data extends object = ToastData> = ReturnType<typeof BaseToast.createToastManager<Data>>;\n\nexport function createToastManager<Data extends object = ToastData>(): ToastManager<Data> {\n\treturn BaseToast.createToastManager<Data>();\n}\n\nexport function useToastManager<Data extends object = ToastData>() {\n\treturn BaseToast.useToastManager<Data>();\n}\n\nfunction getToastStatus<Data extends object>(toast: ToastObject<Data>): FeedbackStatus {\n\tconst status = (toast.data as { status?: unknown } | undefined)?.status;\n\tif (typeof status === \"string\" && feedbackStatusSet.has(status)) {\n\t\treturn status as FeedbackStatus;\n\t}\n\n\tif (toast.type && feedbackStatusSet.has(toast.type)) {\n\t\treturn toast.type as FeedbackStatus;\n\t}\n\n\treturn \"neutral\";\n}\n\nexport interface ToastRootProps<Data extends object = ToastData> extends Omit<BaseToast.Root.Props, \"className\" | \"toast\"> {\n\tclassName?: string;\n\tcloseLabel?: string;\n\ttoast: ToastObject<Data>;\n}\n\ntype ToastRootComponent = <Data extends object = ToastData>(props: ToastRootProps<Data> & RefAttributes<HTMLDivElement>) => ReactElement;\n\nexport const ToastRoot = forwardRef(function ToastRoot<Data extends object = ToastData>({ className, closeLabel, toast, ...props }: ToastRootProps<Data>, ref: ForwardedRef<HTMLDivElement>) {\n\tconst messages = useMessages();\n\tconst actionProps = toast.actionProps;\n\tconst actionClassName = actionProps?.className;\n\tconst status = getToastStatus(toast);\n\n\treturn (\n\t\t<BaseToast.Root ref={ref} className={cx(\"lyds-toast\", className)} data-status={status} toast={toast} {...props}>\n\t\t\t<span aria-hidden=\"true\" className={\"lyds-toast__signal\"} />\n\t\t\t<BaseToast.Content className={\"lyds-toast__content\"}>\n\t\t\t\t{toast.title ? <BaseToast.Title className={\"lyds-toast__title\"} /> : null}\n\t\t\t\t{toast.description ? <BaseToast.Description className={\"lyds-toast__description\"} /> : null}\n\t\t\t</BaseToast.Content>\n\t\t\t{actionProps ? <BaseToast.Action {...actionProps} className={cx(\"lyds-toast__action\", actionClassName)} /> : null}\n\t\t\t<BaseToast.Close aria-label={closeLabel ?? messages.toastClose} className={\"lyds-toast__close\"}>\n\t\t\t\t<XIcon aria-hidden=\"true\" weight=\"bold\" />\n\t\t\t</BaseToast.Close>\n\t\t</BaseToast.Root>\n\t);\n}) as ToastRootComponent;\n\nexport interface ToastViewportProps<Data extends object = ToastData> extends Omit<ComponentPropsWithoutRef<typeof BaseToast.Viewport>, \"children\" | \"className\"> {\n\tclassName?: string;\n\tcloseLabel?: string;\n\trenderToast?: (toast: ToastObject<Data>) => ReactNode;\n}\n\ntype ToastViewportComponent = <Data extends object = ToastData>(props: ToastViewportProps<Data> & RefAttributes<HTMLDivElement>) => ReactElement;\n\nexport const ToastViewport = forwardRef(function ToastViewport<Data extends object = ToastData>(\n\t{ className, closeLabel, renderToast, ...props }: ToastViewportProps<Data>,\n\tref: ForwardedRef<HTMLDivElement>\n) {\n\tconst toast = BaseToast.useToastManager<Data>();\n\n\treturn (\n\t\t<BaseToast.Portal>\n\t\t\t<BaseToast.Viewport ref={ref} className={cx(\"lyds-toast__viewport\", className)} {...props}>\n\t\t\t\t{toast.toasts.map(toastObject =>\n\t\t\t\t\trenderToast ? (\n\t\t\t\t\t\t<Fragment key={toastObject.id}>{renderToast(toastObject)}</Fragment>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<ToastRoot {...(closeLabel === undefined ? {} : { closeLabel })} key={toastObject.id} toast={toastObject} />\n\t\t\t\t\t)\n\t\t\t\t)}\n\t\t\t</BaseToast.Viewport>\n\t\t</BaseToast.Portal>\n\t);\n}) as ToastViewportComponent;\n\nexport interface ToastProviderProps<Data extends object = ToastData> extends Omit<BaseToast.Provider.Props, \"toastManager\"> {\n\tcloseLabel?: string;\n\trenderToast?: ToastViewportProps<Data>[\"renderToast\"];\n\ttoastManager?: ToastManager<Data>;\n\tviewport?: boolean;\n\tviewportProps?: Omit<ToastViewportProps<Data>, \"closeLabel\" | \"renderToast\">;\n}\n\nexport function ToastProvider<Data extends object = ToastData>({ children, closeLabel, renderToast, viewport = true, viewportProps, ...props }: ToastProviderProps<Data>) {\n\treturn (\n\t\t<BaseToast.Provider {...props}>\n\t\t\t{children}\n\t\t\t{viewport ? <ToastViewport {...viewportProps} {...(closeLabel === undefined ? {} : { closeLabel })} {...(renderToast === undefined ? {} : { renderToast })} /> : null}\n\t\t</BaseToast.Provider>\n\t);\n}\n"],"mappings":";;;;;;;;;AAOA,IAAM,IAAyC,IAAI,IAAI,CAAiB;AASxE,SAAgB,IAA0E;CACzF,OAAO,EAAU,mBAAyB;AAC3C;AAEA,SAAgB,IAAmD;CAClE,OAAO,EAAU,gBAAsB;AACxC;AAEA,SAAS,EAAoC,GAA0C;CACtF,IAAM,IAAU,EAAM,MAA2C;CASjE,OARI,OAAO,KAAW,YAAY,EAAkB,IAAI,CAAM,IACtD,IAGJ,EAAM,QAAQ,EAAkB,IAAI,EAAM,IAAI,IAC1C,EAAM,OAGP;AACR;AAUA,IAAa,IAAY,EAAW,SAAoD,EAAE,cAAW,eAAY,UAAO,GAAG,KAA+B,GAAmC;CAC5L,IAAM,IAAW,EAAY,GACvB,IAAc,EAAM,aACpB,IAAkB,GAAa,WAC/B,IAAS,EAAe,CAAK;CAEnC,OACC,kBAAC,EAAU,MAAX;EAAqB;EAAK,WAAW,EAAG,cAAc,CAAS;EAAG,eAAa;EAAe;EAAO,GAAI;EAAzG,UAAA;GACC,kBAAC,QAAD;IAAM,eAAY;IAAO,WAAW;GAAuB,CAAA;GAC3D,kBAAC,EAAU,SAAX;IAAmB,WAAW;IAA9B,UAAA,CACE,EAAM,QAAQ,kBAAC,EAAU,OAAX,EAAiB,WAAW,oBAAsB,CAAA,IAAI,MACpE,EAAM,cAAc,kBAAC,EAAU,aAAX,EAAuB,WAAW,0BAA4B,CAAA,IAAI,IACrE;;GAClB,IAAc,kBAAC,EAAU,QAAX;IAAkB,GAAI;IAAa,WAAW,EAAG,sBAAsB,CAAe;GAAI,CAAA,IAAI;GAC7G,kBAAC,EAAU,OAAX;IAAiB,cAAY,KAAc,EAAS;IAAY,WAAW;IAC1E,UAAA,kBAAC,GAAD;KAAO,eAAY;KAAO,QAAO;IAAQ,CAAA;GACzB,CAAA;EACF;;AAElB,CAAC,GAUY,IAAgB,EAAW,SACvC,EAAE,cAAW,eAAY,gBAAa,GAAG,KACzC,GACC;CACD,IAAM,IAAQ,EAAU,gBAAsB;CAE9C,OACC,kBAAC,EAAU,QAAX,EAAA,UACC,kBAAC,EAAU,UAAX;EAAyB;EAAK,WAAW,EAAG,wBAAwB,CAAS;EAAG,GAAI;EAClF,UAAA,EAAM,OAAO,KAAI,MACjB,IACC,kBAAC,GAAD,EAAA,UAAgC,EAAY,CAAW,EAAY,GAApD,EAAY,EAAwC,IAEnE,kBAAC,GAAD;GAAW,GAAK,MAAe,KAAA,IAAY,CAAC,IAAI,EAAE,cAAW;GAAI,KAAK,EAAY;GAAI,OAAO;EAAc,CAAA,CAE7G;CACmB,CAAA,EACH,CAAA;AAEpB,CAAC;AAUD,SAAgB,EAA+C,EAAE,aAAU,eAAY,gBAAa,cAAW,IAAM,kBAAe,GAAG,KAAmC;CACzK,OACC,kBAAC,EAAU,UAAX;EAAoB,GAAI;EAAxB,UAAA,CACE,GACA,IAAW,kBAAC,GAAD;GAAe,GAAI;GAAe,GAAK,MAAe,KAAA,IAAY,CAAC,IAAI,EAAE,cAAW;GAAI,GAAK,MAAgB,KAAA,IAAY,CAAC,IAAI,EAAE,eAAY;EAAK,CAAA,IAAI,IAC9I;;AAEtB"}
|