@robert-stackflow/oneui 0.6.7 → 0.6.16

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.
Files changed (114) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/README.md +255 -188
  3. package/components/AccountItem.module.css +103 -103
  4. package/components/Alert.d.ts +2 -9
  5. package/components/Alert.js +2 -40
  6. package/components/AppShell.d.ts +7 -7
  7. package/components/AppShell.js +37 -33
  8. package/components/AppShell.module.css +223 -271
  9. package/components/AppearanceSettings.js +25 -32
  10. package/components/Badge.module.css +30 -30
  11. package/components/Banner.d.ts +17 -0
  12. package/components/Banner.js +99 -0
  13. package/components/Banner.module.css +143 -0
  14. package/components/BarChart.module.css +35 -34
  15. package/components/Breadcrumb.module.css +97 -97
  16. package/components/Button.module.css +120 -120
  17. package/components/Cascader.js +1 -0
  18. package/components/CharacterPicker.js +2 -0
  19. package/components/Checkbox.module.css +95 -95
  20. package/components/Combobox.js +1 -0
  21. package/components/Combobox.module.css +6 -1
  22. package/components/CommandPalette.js +2 -2
  23. package/components/ContributionCalendar.module.css +121 -121
  24. package/components/Control.module.css +86 -86
  25. package/components/DataTable.d.ts +3 -2
  26. package/components/DataTable.js +92 -66
  27. package/components/DataTable.module.css +3 -31
  28. package/components/DatePicker.js +1 -0
  29. package/components/DateRangePicker.js +1 -0
  30. package/components/Dialog.d.ts +3 -1
  31. package/components/Dialog.js +11 -4
  32. package/components/Dialog.module.css +139 -97
  33. package/components/DialogVariants.d.ts +2 -1
  34. package/components/DialogVariants.js +35 -7
  35. package/components/HierarchyPicker.module.css +185 -181
  36. package/components/IconPicker.js +2 -0
  37. package/components/Indicator.module.css +83 -83
  38. package/components/Layout.module.css +82 -82
  39. package/components/Markdown.d.ts +13 -0
  40. package/components/Markdown.js +164 -0
  41. package/components/Markdown.module.css +227 -0
  42. package/components/MenuItem.module.css +172 -172
  43. package/components/MultiSelect.js +1 -0
  44. package/components/MultiSelect.module.css +2 -0
  45. package/components/NavBar.d.ts +20 -0
  46. package/components/NavBar.js +197 -0
  47. package/components/NavBar.module.css +130 -0
  48. package/components/NavigationSurface.module.css +27 -0
  49. package/components/Picker.module.css +7 -0
  50. package/components/Popover.d.ts +6 -1
  51. package/components/Popover.js +39 -13
  52. package/components/Popover.module.css +8 -0
  53. package/components/Progress.module.css +33 -33
  54. package/components/RadioGroup.module.css +87 -87
  55. package/components/RangeSlider.module.css +141 -141
  56. package/components/ResizablePanel.module.css +101 -101
  57. package/components/ResourceCard.module.css +98 -98
  58. package/components/SelectSettingRow.d.ts +7 -0
  59. package/components/SelectSettingRow.js +58 -0
  60. package/components/SettingRow.d.ts +9 -3
  61. package/components/SettingRow.js +32 -8
  62. package/components/SettingRow.module.css +17 -0
  63. package/components/SettingsLayout.d.ts +15 -3
  64. package/components/SettingsLayout.js +46 -29
  65. package/components/SideBar.d.ts +9 -0
  66. package/components/SideBar.js +30 -0
  67. package/components/SidebarNavigation.d.ts +24 -3
  68. package/components/SidebarNavigation.js +274 -47
  69. package/components/SidebarNavigation.module.css +352 -130
  70. package/components/Slider.module.css +19 -19
  71. package/components/Steps.module.css +176 -176
  72. package/components/Switch.d.ts +3 -1
  73. package/components/Switch.js +5 -1
  74. package/components/Switch.module.css +59 -59
  75. package/components/SwitchSettingRow.d.ts +7 -0
  76. package/components/SwitchSettingRow.js +45 -0
  77. package/components/Tab.module.css +148 -148
  78. package/components/Table.d.ts +8 -1
  79. package/components/Table.js +34 -17
  80. package/components/Table.module.css +87 -48
  81. package/components/TableMarkup.d.ts +2 -1
  82. package/components/TableMarkup.js +18 -1
  83. package/components/TableOfContents.d.ts +22 -0
  84. package/components/TableOfContents.js +462 -0
  85. package/components/TableOfContents.module.css +252 -0
  86. package/components/TextAreaSettingRow.d.ts +9 -0
  87. package/components/TextAreaSettingRow.js +47 -0
  88. package/components/TextSettingRow.d.ts +9 -0
  89. package/components/TextSettingRow.js +45 -0
  90. package/components/ThemePicker.module.css +178 -178
  91. package/components/ThemeProvider.js +2 -0
  92. package/components/TimeColumns.module.css +47 -47
  93. package/components/Timeline.module.css +202 -202
  94. package/components/Toast.d.ts +8 -1
  95. package/components/Toast.js +49 -17
  96. package/components/Toast.module.css +25 -0
  97. package/components/ToastProvider.d.ts +4 -1
  98. package/components/ToastProvider.js +67 -12
  99. package/components/TreeSelect.js +1 -0
  100. package/components/TreeTable.d.ts +3 -3
  101. package/components/TreeTable.js +12 -2
  102. package/components/TreeTable.module.css +57 -53
  103. package/components/createToaster.d.ts +2 -1
  104. package/components/createToaster.js +28 -14
  105. package/components/index.d.ts +18 -1
  106. package/components/index.js +24 -0
  107. package/components/motion.d.ts +1 -0
  108. package/components/motion.js +18 -6
  109. package/components/settingRowControl.d.ts +7 -0
  110. package/components/settingRowControl.js +15 -0
  111. package/package.json +57 -3
  112. package/styles/base.css +206 -206
  113. package/styles/blue.css +270 -268
  114. package/styles/minimal.css +4 -25
@@ -0,0 +1,17 @@
1
+ import { type ReactNode } from "react";
2
+ export type BannerProps = {
3
+ tone?: "info" | "success" | "warning" | "danger" | "neutral";
4
+ variant?: "soft" | "outline" | "filled";
5
+ title?: ReactNode;
6
+ children?: ReactNode;
7
+ icon?: boolean | ReactNode;
8
+ action?: ReactNode;
9
+ onClose?(): void;
10
+ compact?: boolean;
11
+ details?: ReactNode;
12
+ expanded?: boolean;
13
+ defaultExpanded?: boolean;
14
+ onExpandedChange?(expanded: boolean): void;
15
+ className?: string;
16
+ };
17
+ export declare function Banner({ tone, variant, title, children, icon, action, onClose, compact, details, expanded, defaultExpanded, onExpandedChange, className, }: BannerProps): import("react").JSX.Element;
@@ -0,0 +1,99 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useId, useState } from "react";
3
+ import {
4
+ Info,
5
+ CircleCheck,
6
+ TriangleAlert,
7
+ CircleX,
8
+ X,
9
+ ChevronDown
10
+ } from "lucide-react";
11
+ import { IconButton } from "./IconButton.js";
12
+ import { Button } from "./Button.js";
13
+ import s from "./Banner.module.css";
14
+ function Banner({
15
+ tone = "info",
16
+ variant = "soft",
17
+ title,
18
+ children,
19
+ icon = true,
20
+ action,
21
+ onClose,
22
+ compact = false,
23
+ details,
24
+ expanded,
25
+ defaultExpanded = false,
26
+ onExpandedChange,
27
+ className = ""
28
+ }) {
29
+ const [internal, setInternal] = useState(defaultExpanded);
30
+ const open = expanded ?? internal;
31
+ const id = useId();
32
+ const Icon = tone === "success" ? CircleCheck : tone === "warning" ? TriangleAlert : tone === "danger" ? CircleX : Info;
33
+ const color = tone === "success" ? "var(--success)" : tone === "warning" ? "var(--warning)" : tone === "danger" ? "var(--danger)" : tone === "neutral" ? "var(--muted)" : "var(--accent-ink, var(--accent))";
34
+ return /* @__PURE__ */ jsxs(
35
+ "div",
36
+ {
37
+ className: `${s.banner} ${className}`,
38
+ "data-tone": tone,
39
+ "data-variant": variant,
40
+ "data-compact": compact,
41
+ "data-has-icon": !!icon,
42
+ role: tone === "danger" ? "alert" : "status",
43
+ style: { "--banner-color": color },
44
+ children: [
45
+ /* @__PURE__ */ jsxs("div", { className: s.main, children: [
46
+ icon && /* @__PURE__ */ jsx("span", { className: s.icon, "aria-hidden": "true", children: icon === true ? /* @__PURE__ */ jsx(Icon, {}) : icon }),
47
+ /* @__PURE__ */ jsxs("div", { className: s.content, children: [
48
+ /* @__PURE__ */ jsxs("div", { className: s.copy, children: [
49
+ title != null && /* @__PURE__ */ jsx("div", { className: s.title, children: title }),
50
+ children != null && /* @__PURE__ */ jsx("div", { className: s.description, children })
51
+ ] }),
52
+ (action || details != null) && /* @__PURE__ */ jsxs("div", { className: s.tools, children: [
53
+ action && /* @__PURE__ */ jsx("div", { className: s.action, children: action }),
54
+ details != null && /* @__PURE__ */ jsxs(
55
+ Button,
56
+ {
57
+ className: s.detailsToggle,
58
+ variant: "link",
59
+ "aria-expanded": open,
60
+ "aria-controls": id,
61
+ onClick: () => {
62
+ if (expanded === void 0) setInternal(!open);
63
+ onExpandedChange?.(!open);
64
+ },
65
+ children: [
66
+ open ? "\u6536\u8D77\u8BE6\u60C5" : "\u67E5\u770B\u8BE6\u60C5",
67
+ /* @__PURE__ */ jsx(
68
+ ChevronDown,
69
+ {
70
+ size: 14,
71
+ className: s.chevron,
72
+ "data-open": open
73
+ }
74
+ )
75
+ ]
76
+ }
77
+ )
78
+ ] })
79
+ ] }),
80
+ onClose && /* @__PURE__ */ jsx(IconButton, { size: "small", label: "\u5173\u95ED\u63D0\u793A", onClick: onClose, children: /* @__PURE__ */ jsx(X, { size: 15 }) })
81
+ ] }),
82
+ details != null && /* @__PURE__ */ jsx(
83
+ "div",
84
+ {
85
+ id,
86
+ className: s.details,
87
+ "data-open": open,
88
+ "aria-hidden": !open,
89
+ inert: !open,
90
+ children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("div", { className: s.detailCopy, children: details }) })
91
+ }
92
+ )
93
+ ]
94
+ }
95
+ );
96
+ }
97
+ export {
98
+ Banner
99
+ };
@@ -0,0 +1,143 @@
1
+ .banner {
2
+ text-align: start;
3
+ min-width: 0;
4
+ padding: 16px 18px;
5
+ color: var(--fg);
6
+ --banner-ink: color-mix(in srgb, var(--banner-color) 80%, var(--fg));
7
+ border: 1px solid transparent;
8
+ border-radius: var(--radius);
9
+ background: color-mix(in srgb, var(--banner-color) 6%, var(--surface));
10
+ }
11
+ .banner[data-variant="outline"] {
12
+ border-color: var(--line);
13
+ background: var(--surface);
14
+ }
15
+ .banner[data-variant="filled"] {
16
+ background: color-mix(in srgb, var(--banner-color) 13%, var(--surface));
17
+ }
18
+ .main {
19
+ display: flex;
20
+ align-items: flex-start;
21
+ gap: 12px;
22
+ min-width: 0;
23
+ }
24
+ .icon {
25
+ display: grid;
26
+ place-items: center;
27
+ flex: 0 0 32px;
28
+ height: 32px;
29
+ border-radius: 9px;
30
+ color: var(--banner-ink);
31
+ background: color-mix(in srgb, var(--banner-color) 10%, transparent);
32
+ }
33
+ .icon > svg {
34
+ width: 18px;
35
+ height: 18px;
36
+ stroke-width: 1.7;
37
+ }
38
+ .content {
39
+ flex: 1;
40
+ min-width: 0;
41
+ padding-top: 3px;
42
+ }
43
+ .tools {
44
+ display: flex;
45
+ align-items: center;
46
+ flex-wrap: wrap;
47
+ gap: 10px 16px;
48
+ margin-top: 12px;
49
+ }
50
+ .copy {
51
+ min-width: 0;
52
+ font-size: 13px;
53
+ line-height: 1.65;
54
+ overflow-wrap: anywhere;
55
+ }
56
+ .title {
57
+ color: var(--banner-ink);
58
+ font-weight: 600;
59
+ line-height: 1.6;
60
+ }
61
+ .description {
62
+ color: color-mix(in srgb, var(--fg) 76%, var(--muted));
63
+ }
64
+ .title + .description {
65
+ margin-top: 4px;
66
+ }
67
+ .tools > .detailsToggle {
68
+ min-height: 24px;
69
+ height: auto;
70
+ padding: 0;
71
+ border: 0;
72
+ background: transparent;
73
+ color: var(--muted);
74
+ font-size: 12px;
75
+ }
76
+ .tools > .detailsToggle:hover {
77
+ color: var(--fg);
78
+ text-decoration: underline;
79
+ text-underline-offset: 3px;
80
+ }
81
+ .action {
82
+ display: flex;
83
+ align-items: center;
84
+ gap: 8px;
85
+ flex-wrap: wrap;
86
+ }
87
+ .main > button {
88
+ flex-shrink: 0;
89
+ margin-top: 2px;
90
+ color: var(--muted);
91
+ }
92
+ .detailsToggle .chevron {
93
+ width: 14px;
94
+ height: 14px;
95
+ }
96
+ .chevron {
97
+ transition: transform var(--motion-chevron) var(--ease);
98
+ }
99
+ .chevron[data-open="true"] {
100
+ transform: rotate(180deg);
101
+ }
102
+ .details {
103
+ composes: grid from "./Accordion.module.css";
104
+ }
105
+ .detailCopy {
106
+ padding-top: 12px;
107
+ margin-top: 14px;
108
+ border-top: 1px solid color-mix(in srgb, var(--banner-color) 10%, var(--line));
109
+ font-size: 12px;
110
+ line-height: 1.75;
111
+ color: var(--muted);
112
+ overflow-wrap: anywhere;
113
+ }
114
+ .banner[data-has-icon="true"] .detailCopy {
115
+ margin-left: 44px;
116
+ }
117
+ .banner[data-compact="true"] {
118
+ padding: 11px 14px;
119
+ }
120
+ .banner[data-compact="true"] .icon {
121
+ flex-basis: 20px;
122
+ height: 24px;
123
+ border-radius: 0;
124
+ background: transparent;
125
+ }
126
+ .banner[data-compact="true"] .content {
127
+ padding-top: 1px;
128
+ }
129
+ .banner[data-compact="true"][data-has-icon="true"] .detailCopy {
130
+ margin-left: 32px;
131
+ }
132
+ @media (max-width: 540px) {
133
+ .banner {
134
+ padding: 14px;
135
+ }
136
+
137
+ .banner[data-has-icon="true"] .detailCopy {
138
+ margin-left: 0;
139
+ }
140
+ }
141
+ @media (prefers-reduced-motion: reduce) {
142
+ .details, .chevron { transition: none; }
143
+ }
@@ -1,34 +1,35 @@
1
- .chart {
2
- height: 166px;
3
- display: flex;
4
- align-items: flex-end;
5
- gap: 5px;
6
- border-bottom: 1px solid var(--line);
7
- }
8
- .chart > span {
9
- flex: 1;
10
- min-width: 0;
11
- height: 100%;
12
- }
13
- .column {
14
- min-width: 0;
15
- display: flex;
16
- flex-direction: column;
17
- justify-content: flex-end;
18
- align-items: center;
19
- height: 100%;
20
- gap: 9px;
21
- }
22
- .bar {
23
- width: 75%;
24
- background: var(--accent);
25
- opacity: 0.8;
26
- border-radius: 4px 4px 0 0;
27
- }
28
- .column > span {
29
- font-size: 9px;
30
- color: var(--muted);
31
- white-space: nowrap;
32
- height: 16px;
33
- padding-bottom: 3px;
34
- }
1
+ .chart {
2
+ height: 166px;
3
+ display: flex;
4
+ align-items: flex-end;
5
+ gap: 5px;
6
+ border-bottom: 1px solid var(--line);
7
+ }
8
+ .chart > span {
9
+ flex: 1;
10
+ min-width: 0;
11
+ height: 100%;
12
+ }
13
+ .column {
14
+ width: 100%;
15
+ min-width: 0;
16
+ display: flex;
17
+ flex-direction: column;
18
+ justify-content: flex-end;
19
+ align-items: center;
20
+ height: 100%;
21
+ gap: 9px;
22
+ }
23
+ .bar {
24
+ width: 75%;
25
+ background: var(--accent-ink, var(--accent));
26
+ opacity: 0.8;
27
+ border-radius: 4px 4px 0 0;
28
+ }
29
+ .column > span {
30
+ font-size: 9px;
31
+ color: var(--muted);
32
+ white-space: nowrap;
33
+ height: 16px;
34
+ padding-bottom: 3px;
35
+ }
@@ -1,97 +1,97 @@
1
- .breadcrumb {
2
- min-width: 0;
3
- max-width: 100%;
4
- }
5
- .breadcrumb ol {
6
- display: flex;
7
- align-items: center;
8
- flex-wrap: wrap;
9
- gap: 2px;
10
- list-style: none;
11
- margin: 0;
12
- padding: 0;
13
- min-width: 0;
14
- }
15
- .breadcrumb li {
16
- display: flex;
17
- align-items: center;
18
- gap: 2px;
19
- min-width: 0;
20
- max-width: 100%;
21
- }
22
- .crumb {
23
- display: inline-flex;
24
- align-items: center;
25
- gap: 6px;
26
- min-width: 0;
27
- max-width: min(240px, 100%);
28
- min-height: var(--control-small);
29
- padding: 4px 6px;
30
- border: 0;
31
- border-radius: max(4px, calc(var(--radius) - 3px));
32
- font-size: 12px;
33
- line-height: 20px;
34
- color: var(--muted);
35
- background: transparent;
36
- text-decoration: none;
37
- transition:
38
- background var(--motion-hover),
39
- color var(--motion-hover);
40
- }
41
- .crumb:is(a, button):hover {
42
- color: var(--fg);
43
- background: var(--hover);
44
- }
45
- .crumb[aria-expanded="true"] {
46
- color: var(--fg);
47
- background: var(--selected);
48
- }
49
- .crumb[aria-current="page"] {
50
- color: var(--fg);
51
- }
52
- .crumb[aria-disabled="true"] {
53
- opacity: 0.42;
54
- }
55
- .crumb:focus-visible {
56
- outline-offset: 1px;
57
- }
58
- .text {
59
- min-width: 0;
60
- overflow: hidden;
61
- text-overflow: ellipsis;
62
- white-space: nowrap;
63
- }
64
- .icon {
65
- display: inline-flex;
66
- flex: none;
67
- align-items: center;
68
- }
69
- .icon > svg,
70
- .crumb > svg {
71
- width: 14px;
72
- height: 14px;
73
- }
74
- .separator {
75
- width: 13px;
76
- height: 13px;
77
- color: var(--muted);
78
- opacity: 0.6;
79
- }
80
- .menu {
81
- display: flex;
82
- flex-direction: column;
83
- gap: var(--menu-item-spacing);
84
- }
85
- .menuLink {
86
- display: block;
87
- border-radius: max(4px, calc(var(--radius) - 3px));
88
- color: inherit;
89
- text-decoration: none;
90
- }
91
- .menuLink:focus-visible {
92
- outline: none;
93
- }
94
- .menuLink:focus-visible [data-menu-item] {
95
- background: var(--hover);
96
- box-shadow: inset 0 0 0 1px var(--accent);
97
- }
1
+ .breadcrumb {
2
+ min-width: 0;
3
+ max-width: 100%;
4
+ }
5
+ .breadcrumb ol {
6
+ display: flex;
7
+ align-items: center;
8
+ flex-wrap: wrap;
9
+ gap: 2px;
10
+ list-style: none;
11
+ margin: 0;
12
+ padding: 0;
13
+ min-width: 0;
14
+ }
15
+ .breadcrumb li {
16
+ display: flex;
17
+ align-items: center;
18
+ gap: 2px;
19
+ min-width: 0;
20
+ max-width: 100%;
21
+ }
22
+ .crumb {
23
+ display: inline-flex;
24
+ align-items: center;
25
+ gap: 6px;
26
+ min-width: 0;
27
+ max-width: min(240px, 100%);
28
+ min-height: var(--control-small);
29
+ padding: 4px 6px;
30
+ border: 0;
31
+ border-radius: max(4px, calc(var(--radius) - 3px));
32
+ font-size: 12px;
33
+ line-height: 20px;
34
+ color: var(--muted);
35
+ background: transparent;
36
+ text-decoration: none;
37
+ transition:
38
+ background var(--motion-hover),
39
+ color var(--motion-hover);
40
+ }
41
+ .crumb:is(a, button):hover {
42
+ color: var(--fg);
43
+ background: var(--hover);
44
+ }
45
+ .crumb[aria-expanded="true"] {
46
+ color: var(--fg);
47
+ background: var(--selected);
48
+ }
49
+ .crumb[aria-current="page"] {
50
+ color: var(--fg);
51
+ }
52
+ .crumb[aria-disabled="true"] {
53
+ opacity: 0.42;
54
+ }
55
+ .crumb:focus-visible {
56
+ outline-offset: 1px;
57
+ }
58
+ .text {
59
+ min-width: 0;
60
+ overflow: hidden;
61
+ text-overflow: ellipsis;
62
+ white-space: nowrap;
63
+ }
64
+ .icon {
65
+ display: inline-flex;
66
+ flex: none;
67
+ align-items: center;
68
+ }
69
+ .icon > svg,
70
+ .crumb > svg {
71
+ width: 14px;
72
+ height: 14px;
73
+ }
74
+ .separator {
75
+ width: 13px;
76
+ height: 13px;
77
+ color: var(--muted);
78
+ opacity: 0.6;
79
+ }
80
+ .menu {
81
+ display: flex;
82
+ flex-direction: column;
83
+ gap: var(--menu-item-spacing);
84
+ }
85
+ .menuLink {
86
+ display: block;
87
+ border-radius: max(4px, calc(var(--radius) - 3px));
88
+ color: inherit;
89
+ text-decoration: none;
90
+ }
91
+ .menuLink:focus-visible {
92
+ outline: none;
93
+ }
94
+ .menuLink:focus-visible [data-menu-item] {
95
+ background: var(--hover);
96
+ box-shadow: inset 0 0 0 1px var(--accent-ink, var(--accent));
97
+ }