@seanyeh77/ui 0.46.0 → 0.47.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/dist/bundle.js +16 -16
- package/dist/components/Badge/Badge.d.ts +4 -4
- package/dist/components/Badge/Badge.js +7 -1
- package/dist/components/Badge/Badge.js.map +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.js +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.js.map +1 -1
- package/dist/components/DataTable/DataTable.js +12 -3
- package/dist/components/DataTable/DataTable.js.map +1 -1
- package/dist/components/EmptyState/EmptyState.js +19 -1
- package/dist/components/EmptyState/EmptyState.js.map +1 -1
- package/dist/components/InlineCode/InlineCode.js +1 -1
- package/dist/components/InlineCode/InlineCode.js.map +1 -1
- package/dist/components/KpiCard/KpiCard.d.ts +2 -2
- package/dist/components/KpiCard/KpiCard.js +1 -1
- package/dist/components/KpiCard/KpiCard.js.map +1 -1
- package/dist/components/LayerGraph/LayerGraph.js +5 -5
- package/dist/components/LayerGraph/LayerGraph.js.map +1 -1
- package/dist/components/MultiSelect/MultiSelect.js +1 -0
- package/dist/components/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/components/SettingsLayout/SettingsLayout.js +3 -1
- package/dist/components/SettingsLayout/SettingsLayout.js.map +1 -1
- package/dist/components/TextField/TextField.d.ts +8 -2
- package/dist/components/TextField/TextField.js +59 -13
- package/dist/components/TextField/TextField.js.map +1 -1
- package/dist/css/Alert.css +9 -1
- package/dist/css/DataTable.css +27 -2
- package/dist/css/EmptyState.css +4 -4
- package/dist/css/EventTimeline.css +3 -1
- package/dist/css/LayerGraph.css +1 -1
- package/dist/css/LoadingBar.css +4 -1
- package/dist/css/MobileTabBar.css +6 -4
- package/dist/css/SettingsLayout.css +1 -0
- package/dist/css/Tabs.css +15 -2
- package/dist/css/base.css +86 -3
- package/dist/css/end.css +3 -1
- package/dist/i18n.js +1 -0
- package/dist/i18n.js.map +1 -1
- package/dist/icons/Icon.d.ts +2 -1
- package/dist/icons/Icon.js +4 -3
- package/dist/icons/Icon.js.map +1 -1
- package/dist/icons/store.d.ts +3 -1
- package/dist/icons/store.js +17 -12
- package/dist/icons/store.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/internal/util.js +4 -3
- package/dist/internal/util.js.map +1 -1
- package/dist/styles.css +248 -109
- package/dist/theme.d.ts +7 -0
- package/dist/theme.js +39 -15
- package/dist/theme.js.map +1 -1
- package/docs/Badge.md +2 -1
- package/docs/EmptyState.md +1 -1
- package/docs/EventTimeline.md +1 -1
- package/docs/Graph.md +1 -1
- package/docs/KpiCard.md +1 -1
- package/docs/LoadingBar.md +1 -1
- package/docs/MobileTabBar.md +1 -1
- package/docs/MultiSelect.md +1 -1
- package/docs/Tabs.md +10 -9
- package/docs/TextField.md +2 -0
- package/docs/agents.md +6 -6
- package/docs/theme.md +5 -2
- package/package.json +2 -2
|
@@ -3,9 +3,9 @@ import * as React from "react";
|
|
|
3
3
|
export type BadgeTone = 'neutral' | 'info' | 'success' | 'warning' | 'danger';
|
|
4
4
|
/** The five work states: draft, doing, review, done and fail. */
|
|
5
5
|
export type BadgeStatus = 'draft' | 'doing' | 'review' | 'done' | 'fail';
|
|
6
|
-
/** Every preset: the work states, closed for a state that ended without a result (已取消, 已停用),
|
|
7
|
-
* offline for monitoring. */
|
|
8
|
-
export type BadgePreset = BadgeStatus | 'closed' | 'online' | 'offline';
|
|
6
|
+
/** Every preset: the work states, closed for a state that ended without a result (已取消, 已停用), paused for one on
|
|
7
|
+
* hold that can resume (已暫停, 已停權), and online and offline for monitoring. */
|
|
8
|
+
export type BadgePreset = BadgeStatus | 'closed' | 'paused' | 'online' | 'offline';
|
|
9
9
|
interface BadgeBase {
|
|
10
10
|
/** Colour of the mark (and of the text for warning and danger). Default: the preset's, or 'neutral'. */
|
|
11
11
|
tone?: BadgeTone;
|
|
@@ -17,7 +17,7 @@ interface BadgeBase {
|
|
|
17
17
|
export type BadgeProps = BadgeBase & ({
|
|
18
18
|
/** A preset: its name, tone and mark. */
|
|
19
19
|
status: BadgePreset;
|
|
20
|
-
/** Default: the preset's name (草稿, 進行中, 審核中, 完成, 失敗, 已關閉, 在線, 離線). */
|
|
20
|
+
/** Default: the preset's name (草稿, 進行中, 審核中, 完成, 失敗, 已關閉, 已暫停, 在線, 離線). */
|
|
21
21
|
children?: React.ReactNode;
|
|
22
22
|
} | {
|
|
23
23
|
status?: undefined;
|
|
@@ -35,6 +35,11 @@ const STATUS = {
|
|
|
35
35
|
tone: "neutral",
|
|
36
36
|
mark: "dash"
|
|
37
37
|
},
|
|
38
|
+
paused: {
|
|
39
|
+
label: "已暫停",
|
|
40
|
+
tone: "warning",
|
|
41
|
+
mark: "pause"
|
|
42
|
+
},
|
|
38
43
|
online: {
|
|
39
44
|
label: "在線",
|
|
40
45
|
tone: "success",
|
|
@@ -64,7 +69,8 @@ const STROKE = {
|
|
|
64
69
|
bang: "M12 7.5v5.5M12 16.4v.2",
|
|
65
70
|
cross: "M9 9l6 6M15 9l-6 6",
|
|
66
71
|
dash: "M8.5 12h7",
|
|
67
|
-
slash: "M6.5 17.5l11-11"
|
|
72
|
+
slash: "M6.5 17.5l11-11",
|
|
73
|
+
pause: "M10 8.5v7M14 8.5v7"
|
|
68
74
|
};
|
|
69
75
|
/** The status of an item: a mark and text, no chip. The mark's shape carries the meaning too, never colour alone. */
|
|
70
76
|
function Badge({ status, tone, variant, children, className }) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.js","names":[],"sources":["../../../src/components/Badge/Badge.tsx"],"sourcesContent":["import type * as React from 'react';\nimport { tr } from '../../i18n';\nimport { cx } from '../../internal/util';\nimport { devWarn } from '../../internal/dev';\n\n/** The meaning of a status: its colour, and its mark's shape when no preset gives one. */\nexport type BadgeTone = 'neutral' | 'info' | 'success' | 'warning' | 'danger';\n\n/** The five work states: draft, doing, review, done and fail. */\nexport type BadgeStatus = 'draft' | 'doing' | 'review' | 'done' | 'fail';\n/** Every preset: the work states, closed for a state that ended without a result (已取消, 已停用),
|
|
1
|
+
{"version":3,"file":"Badge.js","names":[],"sources":["../../../src/components/Badge/Badge.tsx"],"sourcesContent":["import type * as React from 'react';\nimport { tr } from '../../i18n';\nimport { cx } from '../../internal/util';\nimport { devWarn } from '../../internal/dev';\n\n/** The meaning of a status: its colour, and its mark's shape when no preset gives one. */\nexport type BadgeTone = 'neutral' | 'info' | 'success' | 'warning' | 'danger';\n\n/** The five work states: draft, doing, review, done and fail. */\nexport type BadgeStatus = 'draft' | 'doing' | 'review' | 'done' | 'fail';\n/** Every preset: the work states, closed for a state that ended without a result (已取消, 已停用), paused for one on\n * hold that can resume (已暫停, 已停權), and online and offline for monitoring. */\nexport type BadgePreset = BadgeStatus | 'closed' | 'paused' | 'online' | 'offline';\n\ntype Mark = 'ring' | 'half' | 'quarter' | 'full' | 'bang' | 'cross' | 'dash' | 'slash' | 'pause';\n\nconst STATUS: Record<BadgePreset, { label: string; tone: BadgeTone; mark: Mark }> = {\n draft: { label: '草稿', tone: 'neutral', mark: 'ring' },\n doing: { label: '進行中', tone: 'info', mark: 'half' },\n review: { label: '審核中', tone: 'warning', mark: 'quarter' },\n done: { label: '完成', tone: 'success', mark: 'full' },\n fail: { label: '失敗', tone: 'danger', mark: 'cross' },\n closed: { label: '已關閉', tone: 'neutral', mark: 'dash' },\n paused: { label: '已暫停', tone: 'warning', mark: 'pause' },\n online: { label: '在線', tone: 'success', mark: 'full' },\n offline: { label: '離線', tone: 'neutral', mark: 'slash' },\n};\n\n/** The mark of a tone without a preset: the shape tells the meaning too, never colour alone. */\nconst TONE_MARK: Record<BadgeTone, Mark> = { neutral: 'ring', info: 'half', success: 'full', warning: 'bang', danger: 'cross' };\n\n/** Inside the 24 px ring (r 8): filled paths, then stroked ones. */\nconst FILL: Partial<Record<Mark, string>> = {\n half: 'M12 4a8 8 0 0 1 0 16z',\n quarter: 'M12 4a8 8 0 0 1 8 8h-8z',\n full: 'M12 4a8 8 0 1 1 0 16a8 8 0 1 1 0-16z',\n};\nconst STROKE: Partial<Record<Mark, string>> = {\n bang: 'M12 7.5v5.5M12 16.4v.2',\n cross: 'M9 9l6 6M15 9l-6 6',\n dash: 'M8.5 12h7',\n slash: 'M6.5 17.5l11-11',\n pause: 'M10 8.5v7M14 8.5v7',\n};\n\ninterface BadgeBase {\n /** Colour of the mark (and of the text for warning and danger). Default: the preset's, or 'neutral'. */\n tone?: BadgeTone;\n /** @deprecated Every Badge is now a mark and text without a chip; remove the prop. */\n variant?: 'chip' | 'dot';\n /** Extra class on the root element. */\n className?: string;\n}\n\nexport type BadgeProps = BadgeBase &\n (\n | {\n /** A preset: its name, tone and mark. */\n status: BadgePreset;\n /** Default: the preset's name (草稿, 進行中, 審核中, 完成, 失敗, 已關閉, 已暫停, 在線, 離線). */\n children?: React.ReactNode;\n }\n | {\n status?: undefined;\n /** The text; required without a preset. */\n children: React.ReactNode;\n }\n );\n\n/** The status of an item: a mark and text, no chip. The mark's shape carries the meaning too, never colour alone. */\nexport function Badge({ status, tone, variant, children, className }: BadgeProps) {\n devWarn(variant !== undefined, 'Badge', '`variant` is deprecated: every Badge is now a mark and text without a chip. Remove the prop.');\n const preset = status ? (STATUS[status] ?? STATUS.draft) : undefined;\n devWarn(\n !!status && !STATUS[status],\n 'Badge',\n `unknown status \"${String(status)}\"; it shows as 草稿. Use one of ${Object.keys(STATUS).join(', ')}, or give \\`tone\\` and text.`,\n );\n const t: BadgeTone = tone ?? preset?.tone ?? 'neutral';\n const mark: Mark = preset?.mark ?? TONE_MARK[t] ?? 'ring';\n devWarn(!preset && !children, 'Badge', 'a Badge without `status` has no text. Give it text as children, e.g. <Badge tone=\"success\">已付款</Badge>.');\n const key = status && STATUS[status] ? status : preset ? 'draft' : undefined;\n return (\n <span className={cx('ui-badge', 'is-' + t, key && 'ui-badge-' + key, className)}>\n <svg className=\"ui-badge-mark\" width={15} height={15} viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <circle cx={12} cy={12} r={8} fill=\"none\" stroke=\"currentColor\" strokeWidth={2.5} />\n {FILL[mark] ? <path d={FILL[mark]} fill=\"currentColor\" /> : null}\n {STROKE[mark] ? <path d={STROKE[mark]} fill=\"none\" stroke=\"currentColor\" strokeWidth={2.5} strokeLinecap=\"round\" /> : null}\n </svg>\n <span className=\"ui-badge-text\">{children || (preset ? tr(preset.label) : null)}</span>\n </span>\n );\n}\n"],"mappings":";;;;;;AAgBA,MAAM,SAA8E;CAClF,OAAO;EAAE,OAAO;EAAM,MAAM;EAAW,MAAM;CAAO;CACpD,OAAO;EAAE,OAAO;EAAO,MAAM;EAAQ,MAAM;CAAO;CAClD,QAAQ;EAAE,OAAO;EAAO,MAAM;EAAW,MAAM;CAAU;CACzD,MAAM;EAAE,OAAO;EAAM,MAAM;EAAW,MAAM;CAAO;CACnD,MAAM;EAAE,OAAO;EAAM,MAAM;EAAU,MAAM;CAAQ;CACnD,QAAQ;EAAE,OAAO;EAAO,MAAM;EAAW,MAAM;CAAO;CACtD,QAAQ;EAAE,OAAO;EAAO,MAAM;EAAW,MAAM;CAAQ;CACvD,QAAQ;EAAE,OAAO;EAAM,MAAM;EAAW,MAAM;CAAO;CACrD,SAAS;EAAE,OAAO;EAAM,MAAM;EAAW,MAAM;CAAQ;AACzD;;AAGA,MAAM,YAAqC;CAAE,SAAS;CAAQ,MAAM;CAAQ,SAAS;CAAQ,SAAS;CAAQ,QAAQ;AAAQ;;AAG9H,MAAM,OAAsC;CAC1C,MAAM;CACN,SAAS;CACT,MAAM;AACR;AACA,MAAM,SAAwC;CAC5C,MAAM;CACN,OAAO;CACP,MAAM;CACN,OAAO;CACP,OAAO;AACT;;AA2BA,SAAgB,MAAM,EAAE,QAAQ,MAAM,SAAS,UAAU,aAAyB;CAChF,QAAQ,YAAY,KAAA,GAAW,SAAS,8FAA8F;CACtI,MAAM,SAAS,SAAU,OAAO,WAAW,OAAO,QAAS,KAAA;CAC3D,QACE,CAAC,CAAC,UAAU,CAAC,OAAO,SACpB,SACA,mBAAmB,OAAO,MAAM,EAAE,gCAAgC,OAAO,KAAK,MAAM,CAAC,CAAC,KAAK,IAAI,EAAE,6BACnG;CACA,MAAM,IAAe,QAAQ,QAAQ,QAAQ;CAC7C,MAAM,OAAa,QAAQ,QAAQ,UAAU,MAAM;CACnD,QAAQ,CAAC,UAAU,CAAC,UAAU,SAAS,2GAAyG;CAChJ,MAAM,MAAM,UAAU,OAAO,UAAU,SAAS,SAAS,UAAU,KAAA;CACnE,OACE,qBAAC,QAAD;EAAM,WAAW,GAAG,YAAY,QAAQ,GAAG,OAAO,cAAc,KAAK,SAAS;EAA9E,UAAA,CACE,qBAAC,OAAD;GAAK,WAAU;GAAgB,OAAO;GAAI,QAAQ;GAAI,SAAQ;GAAY,eAAY;GAAtF,UAAA;IACE,oBAAC,UAAD;KAAQ,IAAI;KAAI,IAAI;KAAI,GAAG;KAAG,MAAK;KAAO,QAAO;KAAe,aAAa;IAAM,CAAA;IAClF,KAAK,QAAQ,oBAAC,QAAD;KAAM,GAAG,KAAK;KAAO,MAAK;IAAgB,CAAA,IAAI;IAC3D,OAAO,QAAQ,oBAAC,QAAD;KAAM,GAAG,OAAO;KAAO,MAAK;KAAO,QAAO;KAAe,aAAa;KAAK,eAAc;IAAS,CAAA,IAAI;GACnH;EACL,CAAA,GAAA,oBAAC,QAAD;GAAM,WAAU;GAAiB,UAAA,aAAa,SAAS,GAAG,OAAO,KAAK,IAAI;EAAY,CAAA,CAClF;;AAEV"}
|
|
@@ -14,6 +14,7 @@ function Breadcrumb({ items, className }) {
|
|
|
14
14
|
"aria-current": "page",
|
|
15
15
|
children: it.label
|
|
16
16
|
}) : it.href ? /* @__PURE__ */ jsx("a", {
|
|
17
|
+
className: "ui-crumb-link",
|
|
17
18
|
href: it.href,
|
|
18
19
|
children: it.label
|
|
19
20
|
}) : /* @__PURE__ */ jsx("span", { children: it.label }), last ? null : /* @__PURE__ */ jsx("span", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Breadcrumb.js","names":[],"sources":["../../../src/components/Breadcrumb/Breadcrumb.tsx"],"sourcesContent":["import { tr } from '../../i18n';\nimport { cx } from '../../internal/util';\n\nexport interface BreadcrumbItem {\n label: string;\n href?: string;\n}\n\nexport interface BreadcrumbProps {\n /** From the top level down; the last one is the current page. */\n items: BreadcrumbItem[];\n /** Extra class on the root element. */\n className?: string;\n}\n\n/** Where the page sits: links to each level, the current page last and not a link. */\nexport function Breadcrumb({ items, className }: BreadcrumbProps) {\n return (\n <nav className={cx('ui-crumb', className)} aria-label={tr('路徑')}>\n <ol>\n {items.map((it, i) => {\n const last = i === items.length - 1;\n return (\n <li key={i}>\n {last ? <span aria-current=\"page\">{it.label}</span
|
|
1
|
+
{"version":3,"file":"Breadcrumb.js","names":[],"sources":["../../../src/components/Breadcrumb/Breadcrumb.tsx"],"sourcesContent":["import { tr } from '../../i18n';\nimport { cx } from '../../internal/util';\n\nexport interface BreadcrumbItem {\n label: string;\n href?: string;\n}\n\nexport interface BreadcrumbProps {\n /** From the top level down; the last one is the current page. */\n items: BreadcrumbItem[];\n /** Extra class on the root element. */\n className?: string;\n}\n\n/** Where the page sits: links to each level, the current page last and not a link. */\nexport function Breadcrumb({ items, className }: BreadcrumbProps) {\n return (\n <nav className={cx('ui-crumb', className)} aria-label={tr('路徑')}>\n <ol>\n {items.map((it, i) => {\n const last = i === items.length - 1;\n return (\n <li key={i}>\n {last ? (\n <span aria-current=\"page\">{it.label}</span>\n ) : it.href ? (\n <a className=\"ui-crumb-link\" href={it.href}>\n {it.label}\n </a>\n ) : (\n <span>{it.label}</span>\n )}\n {last ? null : (\n <span className=\"ui-crumb-sep\" aria-hidden=\"true\">\n ›\n </span>\n )}\n </li>\n );\n })}\n </ol>\n </nav>\n );\n}\n"],"mappings":";;;;;;AAgBA,SAAgB,WAAW,EAAE,OAAO,aAA8B;CAChE,OACE,oBAAC,OAAD;EAAK,WAAW,GAAG,YAAY,SAAS;EAAG,cAAY,GAAG,IAAI;EAC5D,UAAA,oBAAC,MAAD,EAAA,UACG,MAAM,KAAK,IAAI,MAAM;GACpB,MAAM,OAAO,MAAM,MAAM,SAAS;GAClC,OACE,qBAAC,MAAD,EAAA,UAAA,CACG,OACC,oBAAC,QAAD;IAAM,gBAAa;IAAQ,UAAA,GAAG;GAAY,CAAA,IACxC,GAAG,OACL,oBAAC,KAAD;IAAG,WAAU;IAAgB,MAAM,GAAG;IACnC,UAAA,GAAG;GACH,CAAA,IAEH,oBAAC,QAAD,EAAA,UAAO,GAAG,MAAY,CAAA,GAEvB,OAAO,OACN,oBAAC,QAAD;IAAM,WAAU;IAAe,eAAY;IAAO,UAAA;GAE5C,CAAA,CAEN,EAAA,GAfK,CAeL;EAER,CAAC,EACC,CAAA;CACD,CAAA;AAET"}
|
|
@@ -614,7 +614,7 @@ function DataTable(p) {
|
|
|
614
614
|
const longCols = shownCols.filter((c) => c.long || c.fullText);
|
|
615
615
|
const expander = longCols.length > 0 && !narrow && (clipped !== false || longCols.some((c) => c.fullText) || visIds.some((id) => opened[id]));
|
|
616
616
|
const EXP = 40;
|
|
617
|
-
const mainKey =
|
|
617
|
+
const mainKey = shownCols.find((c) => !isShort(c) && !c.long && !c.mono && c.grow !== 0)?.key;
|
|
618
618
|
const grows = (c) => c.grow != null ? c.grow > 0 : c.long || c.key === mainKey;
|
|
619
619
|
const minOf = (c) => {
|
|
620
620
|
if (grows(c)) return Math.max(c.width || (isNum(c) ? 96 : 120), fit[c.key] || 0, roomy ? want[c.key] || 0 : 0);
|
|
@@ -1238,7 +1238,16 @@ function DataTable(p) {
|
|
|
1238
1238
|
"64%",
|
|
1239
1239
|
"48%"
|
|
1240
1240
|
];
|
|
1241
|
-
const
|
|
1241
|
+
const TYPICAL = {
|
|
1242
|
+
date: 128,
|
|
1243
|
+
dateTime: 184,
|
|
1244
|
+
datetime: 184,
|
|
1245
|
+
relative: 72,
|
|
1246
|
+
duration: 64,
|
|
1247
|
+
money: 96,
|
|
1248
|
+
percent: 56
|
|
1249
|
+
};
|
|
1250
|
+
const widthOf = (c, i) => c.key === mainKey ? MAIN[i % MAIN.length] : c.mobile === "status" ? 64 : TYPICAL[c.format ?? ""] ?? (isNum(c) ? 56 : c.mono ? 112 : c.long ? "80%" : "60%");
|
|
1242
1251
|
return [/* @__PURE__ */ jsx("div", {
|
|
1243
1252
|
role: "row",
|
|
1244
1253
|
className: "ui-visually-hidden",
|
|
@@ -1429,7 +1438,7 @@ function DataTable(p) {
|
|
|
1429
1438
|
})
|
|
1430
1439
|
});
|
|
1431
1440
|
};
|
|
1432
|
-
const footView = /* @__PURE__ */ jsx(Fragment, { children: pages > 1 ? /* @__PURE__ */ jsxs("div", {
|
|
1441
|
+
const footView = /* @__PURE__ */ jsx(Fragment, { children: pages > 1 && !p.loading ? /* @__PURE__ */ jsxs("div", {
|
|
1433
1442
|
className: "ui-dt-foot",
|
|
1434
1443
|
children: [/* @__PURE__ */ jsx("span", {
|
|
1435
1444
|
className: "ui-dt-range",
|