@robert-stackflow/oneui 0.1.0 → 0.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.
Files changed (77) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +28 -1
  3. package/components/AppShell.module.css +3 -3
  4. package/components/AppearanceSettings.js +1 -1
  5. package/components/Button.d.ts +9 -2
  6. package/components/Button.js +30 -7
  7. package/components/Button.module.css +16 -7
  8. package/components/Card.d.ts +2 -1
  9. package/components/Card.js +13 -3
  10. package/components/Card.module.css +19 -0
  11. package/components/Checkbox.module.css +3 -3
  12. package/components/Combobox.d.ts +4 -2
  13. package/components/Combobox.js +162 -76
  14. package/components/Combobox.module.css +5 -7
  15. package/components/Control.module.css +18 -5
  16. package/components/Dialog.d.ts +6 -1
  17. package/components/Dialog.js +19 -6
  18. package/components/Dialog.module.css +17 -0
  19. package/components/DialogVariants.d.ts +27 -0
  20. package/components/DialogVariants.js +161 -0
  21. package/components/DialogVariants.module.css +29 -0
  22. package/components/HierarchyPicker.module.css +35 -0
  23. package/components/IconButton.module.css +5 -2
  24. package/components/Indicator.module.css +1 -1
  25. package/components/Input.d.ts +2 -1
  26. package/components/Input.js +12 -4
  27. package/components/Input.module.css +18 -1
  28. package/components/LoadingState.d.ts +3 -1
  29. package/components/LoadingState.js +26 -15
  30. package/components/LoadingState.module.css +3 -0
  31. package/components/MenuItem.d.ts +2 -1
  32. package/components/MenuItem.js +2 -0
  33. package/components/MenuItem.module.css +9 -0
  34. package/components/MultiSelect.d.ts +2 -1
  35. package/components/MultiSelect.js +66 -2
  36. package/components/MultiSelect.module.css +38 -0
  37. package/components/NumberInput.js +1 -0
  38. package/components/OptionList.module.css +12 -0
  39. package/components/PasswordField.js +1 -0
  40. package/components/PinInput.js +1 -0
  41. package/components/Popover.d.ts +4 -1
  42. package/components/Popover.js +11 -5
  43. package/components/Popover.module.css +3 -0
  44. package/components/RadioGroup.module.css +2 -2
  45. package/components/SearchField.js +1 -0
  46. package/components/Select.js +1 -0
  47. package/components/Select.module.css +3 -0
  48. package/components/SelectionTag.d.ts +8 -0
  49. package/components/SelectionTag.js +39 -0
  50. package/components/SettingsLayout.d.ts +3 -1
  51. package/components/SettingsLayout.js +19 -3
  52. package/components/SettingsLayout.module.css +20 -0
  53. package/components/Switch.module.css +8 -5
  54. package/components/Table.d.ts +6 -2
  55. package/components/Table.js +14 -4
  56. package/components/TagInput.js +11 -23
  57. package/components/TagInput.module.css +1 -1
  58. package/components/ThemeProvider.js +17 -3
  59. package/components/TreeGuides.d.ts +9 -0
  60. package/components/TreeGuides.js +39 -0
  61. package/components/TreeGuides.module.css +45 -0
  62. package/components/TreeSelect.d.ts +3 -0
  63. package/components/TreeSelect.js +49 -21
  64. package/components/TreeTable.d.ts +15 -0
  65. package/components/TreeTable.js +151 -0
  66. package/components/TreeTable.module.css +53 -0
  67. package/components/VirtualPickerList.module.css +4 -0
  68. package/components/appearance.d.ts +1 -0
  69. package/components/appearance.js +15 -6
  70. package/components/hierarchy.d.ts +1 -0
  71. package/components/index.d.ts +3 -1
  72. package/components/index.js +6 -0
  73. package/components/usePopover.d.ts +2 -2
  74. package/package.json +30 -3
  75. package/styles/base.css +20 -3
  76. package/styles/blue.css +49 -35
  77. package/styles/minimal.css +1 -1
@@ -3,7 +3,12 @@
3
3
  flex-direction: column;
4
4
  gap: 7px;
5
5
  }
6
+ .inputTrigger {
7
+ min-width: 0;
8
+ width: 100%;
9
+ }
6
10
  .list {
11
+ composes: stack from "./OptionList.module.css";
7
12
  max-height: 240px;
8
13
  min-height: 40px;
9
14
  overflow: auto;
@@ -17,10 +22,3 @@
17
22
  color: var(--muted);
18
23
  font-size: 12px;
19
24
  }
20
- .empty button {
21
- border: 0;
22
- background: var(--hover);
23
- border-radius: 5px;
24
- padding: 4px 8px;
25
- color: var(--fg);
26
- }
@@ -13,11 +13,24 @@
13
13
  box-shadow var(--motion-hover),
14
14
  background-color var(--motion-hover);
15
15
  }
16
- .surface:hover:where(:not(:disabled):not([data-disabled="true"])) {
17
- border-color: color-mix(
18
- in srgb,
19
- var(--fg) var(--field-hover-strength),
20
- var(--surface)
16
+ .surface:hover:where(
17
+ :not(
18
+ :disabled,
19
+ [data-disabled="true"],
20
+ [aria-disabled="true"],
21
+ [readonly],
22
+ [aria-readonly="true"],
23
+ [data-readonly="true"],
24
+ [data-disabled="true"] *,
25
+ [aria-disabled="true"] *,
26
+ [data-readonly="true"] *,
27
+ fieldset:disabled *,
28
+ :has(input:disabled, textarea:disabled)
29
+ )
30
+ ) {
31
+ border-color: var(
32
+ --field-hover-border,
33
+ color-mix(in srgb, var(--fg) var(--field-hover-strength), var(--surface))
21
34
  );
22
35
  }
23
36
  .surface[data-focus="true"],
@@ -1,9 +1,14 @@
1
1
  import { type ReactNode } from "react";
2
- export declare function Dialog({ open: requestedOpen, onClose, title, children, footer, wide, }: {
2
+ export declare function Dialog({ open: requestedOpen, onClose, title, children, footer, wide, size, role, descriptionId, busy, variant, }: {
3
3
  open: boolean;
4
4
  onClose(): void;
5
5
  title: string;
6
6
  children: ReactNode;
7
7
  footer?: ReactNode;
8
8
  wide?: boolean;
9
+ size?: "small" | "medium" | "large";
10
+ role?: "dialog" | "alertdialog";
11
+ descriptionId?: string;
12
+ busy?: boolean;
13
+ variant?: "default" | "message" | "confirm" | "form";
9
14
  }): import("react").ReactPortal;
@@ -24,7 +24,12 @@ function Dialog({
24
24
  title,
25
25
  children,
26
26
  footer,
27
- wide = false
27
+ wide = false,
28
+ size = "medium",
29
+ role = "dialog",
30
+ descriptionId,
31
+ busy = false,
32
+ variant = "default"
28
33
  }) {
29
34
  const owner = useSurfacePortal(), open = requestedOpen && owner?.active !== false;
30
35
  const { ref, host, setRef } = useSurfaceHost();
@@ -50,8 +55,12 @@ function Dialog({
50
55
  previousFocus.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
51
56
  element.showModal();
52
57
  element.querySelector(
53
- 'input:not([disabled]):not([readonly]):not([type="hidden"]):not([type="file"]):not([type="checkbox"]):not([type="radio"]),textarea:not([disabled]),[role="combobox"]'
58
+ "[data-dialog-initial-focus]:not(:disabled)"
54
59
  )?.focus({ preventScroll: true });
60
+ if (!element.querySelector("[data-dialog-initial-focus]:not(:disabled)"))
61
+ element.querySelector(
62
+ 'input:not([disabled]):not([readonly]):not([type="hidden"]):not([type="file"]):not([type="checkbox"]):not([type="radio"]),textarea:not([disabled]),[role="combobox"]'
63
+ )?.focus({ preventScroll: true });
55
64
  }
56
65
  void surfaceMotion(element, "enter", "0 4px");
57
66
  return;
@@ -81,23 +90,27 @@ function Dialog({
81
90
  {
82
91
  ref: setRef,
83
92
  "aria-labelledby": titleId,
84
- className: `${s.dialog} ${wide ? s.wide : ""} ${closing ? s.closing : ""}`,
93
+ "aria-describedby": descriptionId,
94
+ "aria-busy": busy || void 0,
95
+ role,
96
+ "data-variant": variant,
97
+ className: `${s.dialog} ${wide || size === "large" ? s.wide : ""} ${size === "small" ? s.small : ""} ${closing ? s.closing : ""}`,
85
98
  onCancel: (e) => {
86
99
  e.preventDefault();
87
100
  e.stopPropagation();
88
- onClose();
101
+ if (!busy) onClose();
89
102
  },
90
103
  onMouseDown: (e) => {
91
104
  backdropDown.current = outside(e);
92
105
  },
93
106
  onClick: (e) => {
94
- if (backdropDown.current && outside(e)) onClose();
107
+ if (!busy && backdropDown.current && outside(e)) onClose();
95
108
  backdropDown.current = false;
96
109
  },
97
110
  children: [
98
111
  /* @__PURE__ */ jsxs("header", { className: s.dialogHeader, children: [
99
112
  /* @__PURE__ */ jsx("h2", { id: titleId, children: title }),
100
- /* @__PURE__ */ jsx(IconButton, { label: "\u5173\u95ED\u5F39\u7A97", onClick: onClose, children: /* @__PURE__ */ jsx(X, {}) })
113
+ /* @__PURE__ */ jsx(IconButton, { label: "\u5173\u95ED\u5F39\u7A97", onClick: onClose, disabled: busy, children: /* @__PURE__ */ jsx(X, {}) })
101
114
  ] }),
102
115
  /* @__PURE__ */ jsx("div", { className: s.dialogBody, children }),
103
116
  footer && /* @__PURE__ */ jsx("footer", { className: s.dialogFooter, children: footer })
@@ -43,6 +43,23 @@
43
43
  .wide {
44
44
  width: min(var(--dialog-wide-width), calc(100vw - 32px));
45
45
  }
46
+ .small {
47
+ width: min(420px, calc(100vw - 32px));
48
+ }
49
+ .dialog[data-variant="message"] .dialogHeader {
50
+ border: 0;
51
+ padding-bottom: 12px;
52
+ }
53
+ .dialog[data-variant="message"] .dialogBody {
54
+ padding-top: 0;
55
+ padding-bottom: 24px;
56
+ }
57
+ .dialog[data-variant="message"] .dialogFooter {
58
+ border: 0;
59
+ background: transparent;
60
+ padding-top: 0;
61
+ padding-bottom: 18px;
62
+ }
46
63
  .closing {
47
64
  pointer-events: none;
48
65
  }
@@ -0,0 +1,27 @@
1
+ import { type ReactNode } from "react";
2
+ import type { FormController } from "./useFormState";
3
+ type ShellProps = {
4
+ open: boolean;
5
+ onClose(): void;
6
+ title: string;
7
+ children: ReactNode;
8
+ };
9
+ type Result = void | boolean;
10
+ export declare function MessageDialog({ open, onClose, title, children, tone, closeLabel, }: ShellProps & {
11
+ tone?: "info" | "success" | "warning" | "error";
12
+ closeLabel?: string;
13
+ }): import("react").JSX.Element;
14
+ export declare function ConfirmDialog({ open, onClose, title, children, onConfirm, danger, confirmLabel, cancelLabel, }: ShellProps & {
15
+ onConfirm(): Result | Promise<Result>;
16
+ danger?: boolean;
17
+ confirmLabel?: string;
18
+ cancelLabel?: string;
19
+ }): import("react").JSX.Element;
20
+ export declare function FormDialog<T extends Record<string, unknown>>({ open, onClose, title, children, onSubmit, controller, submitLabel, cancelLabel, wide, }: ShellProps & {
21
+ controller: FormController<T>;
22
+ onSubmit(values: T): Result | Promise<Result>;
23
+ submitLabel?: string;
24
+ cancelLabel?: string;
25
+ wide?: boolean;
26
+ }): import("react").JSX.Element;
27
+ export {};
@@ -0,0 +1,161 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import {
3
+ useId,
4
+ useLayoutEffect,
5
+ useRef,
6
+ useState
7
+ } from "react";
8
+ import { Dialog } from "./Dialog.js";
9
+ import { Button } from "./Button.js";
10
+ import { Form } from "./Form.js";
11
+ import { Alert } from "./Alert.js";
12
+ import s from "./DialogVariants.module.css";
13
+ function useDialogAction(open, onClose) {
14
+ const [busy, setBusy] = useState(false), [error, setError] = useState(""), revision = useRef(0), close = useRef(onClose);
15
+ close.current = onClose;
16
+ useLayoutEffect(() => {
17
+ revision.current++;
18
+ setBusy(false);
19
+ setError("");
20
+ return () => {
21
+ revision.current++;
22
+ };
23
+ }, [open]);
24
+ const run = async (action) => {
25
+ if (busy) return;
26
+ const id = ++revision.current;
27
+ setBusy(true);
28
+ setError("");
29
+ try {
30
+ const result = await action();
31
+ if (id === revision.current && result !== false) close.current();
32
+ } catch (e) {
33
+ if (id === revision.current)
34
+ setError(e instanceof Error ? e.message : "\u64CD\u4F5C\u672A\u5B8C\u6210\uFF0C\u8BF7\u91CD\u8BD5");
35
+ } finally {
36
+ if (id === revision.current) setBusy(false);
37
+ }
38
+ };
39
+ return { busy, error, run };
40
+ }
41
+ function MessageDialog({
42
+ open,
43
+ onClose,
44
+ title,
45
+ children,
46
+ tone = "info",
47
+ closeLabel = "\u77E5\u9053\u4E86"
48
+ }) {
49
+ const id = useId();
50
+ return /* @__PURE__ */ jsx(
51
+ Dialog,
52
+ {
53
+ open,
54
+ onClose,
55
+ title,
56
+ size: "small",
57
+ variant: "message",
58
+ role: "alertdialog",
59
+ descriptionId: id,
60
+ footer: /* @__PURE__ */ jsx(Button, { variant: "primary", "data-dialog-initial-focus": true, onClick: onClose, children: closeLabel }),
61
+ children: /* @__PURE__ */ jsx("div", { id, "data-tone": tone, className: s.description, children })
62
+ }
63
+ );
64
+ }
65
+ function ConfirmDialog({
66
+ open,
67
+ onClose,
68
+ title,
69
+ children,
70
+ onConfirm,
71
+ danger = false,
72
+ confirmLabel = "\u786E\u8BA4",
73
+ cancelLabel = "\u53D6\u6D88"
74
+ }) {
75
+ const action = useDialogAction(open, onClose), id = useId();
76
+ return /* @__PURE__ */ jsxs(
77
+ Dialog,
78
+ {
79
+ open,
80
+ onClose,
81
+ title,
82
+ size: "small",
83
+ variant: "confirm",
84
+ role: "alertdialog",
85
+ descriptionId: id,
86
+ busy: action.busy,
87
+ footer: /* @__PURE__ */ jsxs(Fragment, { children: [
88
+ /* @__PURE__ */ jsx(
89
+ Button,
90
+ {
91
+ "data-dialog-initial-focus": true,
92
+ disabled: action.busy,
93
+ onClick: onClose,
94
+ children: cancelLabel
95
+ }
96
+ ),
97
+ /* @__PURE__ */ jsx(
98
+ Button,
99
+ {
100
+ variant: danger ? "danger" : "primary",
101
+ className: danger ? s.destructive : void 0,
102
+ loading: action.busy,
103
+ onClick: () => void action.run(onConfirm),
104
+ children: confirmLabel
105
+ }
106
+ )
107
+ ] }),
108
+ children: [
109
+ /* @__PURE__ */ jsx("div", { id, className: s.description, children }),
110
+ action.error && /* @__PURE__ */ jsx("div", { className: s.feedback, children: /* @__PURE__ */ jsx(Alert, { tone: "danger", icon: false, children: action.error }) })
111
+ ]
112
+ }
113
+ );
114
+ }
115
+ function FormDialog({
116
+ open,
117
+ onClose,
118
+ title,
119
+ children,
120
+ onSubmit,
121
+ controller,
122
+ submitLabel = "\u4FDD\u5B58",
123
+ cancelLabel = "\u53D6\u6D88",
124
+ wide = false
125
+ }) {
126
+ const action = useDialogAction(open, onClose), id = useId(), busy = action.busy || controller.isSubmitting;
127
+ return /* @__PURE__ */ jsx(
128
+ Dialog,
129
+ {
130
+ open,
131
+ onClose,
132
+ title,
133
+ variant: "form",
134
+ wide,
135
+ busy,
136
+ footer: /* @__PURE__ */ jsxs(Fragment, { children: [
137
+ /* @__PURE__ */ jsx(Button, { disabled: busy, onClick: onClose, children: cancelLabel }),
138
+ /* @__PURE__ */ jsx(Button, { type: "submit", form: id, variant: "primary", loading: busy, children: submitLabel })
139
+ ] }),
140
+ children: /* @__PURE__ */ jsxs(
141
+ Form,
142
+ {
143
+ id,
144
+ "aria-label": title,
145
+ className: s.fields,
146
+ controller,
147
+ onSubmit: (values) => action.run(() => onSubmit(values)),
148
+ children: [
149
+ children,
150
+ action.error && /* @__PURE__ */ jsx(Alert, { tone: "danger", icon: false, children: action.error })
151
+ ]
152
+ }
153
+ )
154
+ }
155
+ );
156
+ }
157
+ export {
158
+ ConfirmDialog,
159
+ FormDialog,
160
+ MessageDialog
161
+ };
@@ -0,0 +1,29 @@
1
+ .description {
2
+ padding-top: 2px;
3
+ min-width: 0;
4
+ color: var(--muted);
5
+ font-size: 13px;
6
+ line-height: 1.85;
7
+ overflow-wrap: anywhere;
8
+ }
9
+ .feedback {
10
+ margin-top: 16px;
11
+ }
12
+ .destructive {
13
+ background: var(--danger);
14
+ border-color: var(--danger);
15
+ color: var(--on-danger, #fff);
16
+ }
17
+ .destructive:hover:not(:disabled) {
18
+ background: color-mix(in srgb, var(--danger) 86%, var(--surface));
19
+ border-color: transparent;
20
+ }
21
+ .fields {
22
+ display: flex;
23
+ flex-direction: column;
24
+ gap: 20px;
25
+ border: 0;
26
+ padding: 0;
27
+ margin: 0;
28
+ min-width: 0;
29
+ }
@@ -7,6 +7,7 @@
7
7
  margin: 3px 3px 8px;
8
8
  }
9
9
  .tree {
10
+ composes: stack from "./OptionList.module.css";
10
11
  max-height: 292px;
11
12
  overflow: auto;
12
13
  padding: 2px;
@@ -90,6 +91,11 @@
90
91
  font-size: 11px;
91
92
  color: var(--muted);
92
93
  }
94
+ .footerActions {
95
+ display: flex;
96
+ align-items: center;
97
+ gap: 8px;
98
+ }
93
99
  .columns {
94
100
  display: flex;
95
101
  min-height: 240px;
@@ -98,6 +104,7 @@
98
104
  overscroll-behavior: contain;
99
105
  }
100
106
  .column {
107
+ composes: stack from "./OptionList.module.css";
101
108
  flex: 1 0 170px;
102
109
  min-width: 170px;
103
110
  max-height: 292px;
@@ -110,8 +117,36 @@
110
117
  var(--separator-color);
111
118
  }
112
119
  .treeRow {
120
+ position: relative;
113
121
  animation: rowIn 140ms var(--ease);
114
122
  }
123
+ .categoryRow {
124
+ --tree-elbow-gap: 6px;
125
+ --tree-stem-inset: 12px;
126
+ min-height: 42px;
127
+ }
128
+ .categoryRow[data-branch="true"] [data-menu-label] {
129
+ font-weight: 600;
130
+ }
131
+ .categoryRow [data-menu-icon] {
132
+ width: 26px;
133
+ height: 26px;
134
+ flex-basis: 26px;
135
+ border-radius: 7px;
136
+ background: var(--field);
137
+ border: 1px solid var(--line);
138
+ color: var(--muted);
139
+ }
140
+ .categoryRow[data-branch="true"] [data-menu-icon] {
141
+ background: var(--selected);
142
+ color: var(--accent);
143
+ }
144
+ .categoryRow [data-menu-trailing] > span {
145
+ border-radius: 999px;
146
+ }
147
+ .categoryRow .mixed {
148
+ border-radius: 999px;
149
+ }
115
150
  .treeRow[aria-disabled="true"] .expander {
116
151
  pointer-events: none;
117
152
  }
@@ -26,8 +26,11 @@
26
26
  min-width: 30px;
27
27
  }
28
28
  .iconButton[data-variant="primary"] {
29
- background: var(--accent);
30
- color: var(--on-accent);
29
+ background: var(--accent-fill, var(--accent));
30
+ color: var(--on-accent-fill, var(--on-accent));
31
+ }
32
+ .iconButton[data-variant="primary"]:hover:not(:disabled) {
33
+ background: var(--accent-fill-hover, var(--accent));
31
34
  }
32
35
  .iconButton[data-variant="secondary"] {
33
36
  border: 1px solid var(--border);
@@ -42,7 +42,7 @@
42
42
  color: var(--fg);
43
43
  }
44
44
  .indicator button[aria-current="page"] {
45
- color: var(--fg);
45
+ color: var(--navigation-active-color, var(--fg));
46
46
  }
47
47
  .indicator button:focus-visible {
48
48
  outline-offset: -2px;
@@ -1,7 +1,8 @@
1
1
  import type { ComponentPropsWithRef, ReactNode } from "react";
2
- export declare function Input({ label, error, hint, leading, ...props }: ComponentPropsWithRef<"input"> & {
2
+ export declare function Input({ label, error, hint, leading, trailing, ...props }: ComponentPropsWithRef<"input"> & {
3
3
  label?: string;
4
4
  error?: string;
5
5
  hint?: string;
6
6
  leading?: ReactNode;
7
+ trailing?: ReactNode;
7
8
  }): import("react").JSX.Element;
@@ -7,6 +7,7 @@ function Input({
7
7
  error,
8
8
  hint,
9
9
  leading,
10
+ trailing,
10
11
  ...props
11
12
  }) {
12
13
  const field = useFieldControl({ ...props, label, error, hint });
@@ -18,10 +19,17 @@ function Input({
18
19
  className: [s.input, props.className].filter(Boolean).join(" ")
19
20
  }
20
21
  );
21
- const content = leading ? /* @__PURE__ */ jsxs("div", { className: s.withIcon, children: [
22
- /* @__PURE__ */ jsx("span", { className: s.leading, children: leading }),
23
- control
24
- ] }) : control;
22
+ const content = leading || trailing ? /* @__PURE__ */ jsxs(
23
+ "div",
24
+ {
25
+ className: `${s.withIcon} ${leading ? s.hasLeading : ""} ${trailing ? s.hasTrailing : ""}`,
26
+ children: [
27
+ leading && /* @__PURE__ */ jsx("span", { className: s.leading, children: leading }),
28
+ control,
29
+ trailing && /* @__PURE__ */ jsx("span", { className: s.trailing, children: trailing })
30
+ ]
31
+ }
32
+ ) : control;
25
33
  return field.wrapped ? content : /* @__PURE__ */ jsx(FormField, { ...field, children: content });
26
34
  }
27
35
  export {
@@ -8,9 +8,26 @@
8
8
  width: 100%;
9
9
  min-width: 0;
10
10
  }
11
- .withIcon .input {
11
+ .hasLeading .input {
12
12
  padding-left: 38px;
13
13
  }
14
+ .hasTrailing .input {
15
+ padding-right: 36px;
16
+ }
17
+ .trailing {
18
+ position: absolute;
19
+ right: 10px;
20
+ top: 50%;
21
+ transform: translateY(-50%);
22
+ display: flex;
23
+ align-items: center;
24
+ color: var(--muted);
25
+ pointer-events: none;
26
+ }
27
+ .trailing > svg {
28
+ width: 16px;
29
+ height: 16px;
30
+ }
14
31
  .leading {
15
32
  position: absolute;
16
33
  left: 12px;
@@ -1,5 +1,7 @@
1
- export declare function LoadingState({ variant, label, progress, }: {
1
+ export declare function LoadingState({ variant, label, progress, showLabel, fullPage, }: {
2
2
  variant?: "spinner" | "dots" | "skeleton" | "progress";
3
3
  label?: string;
4
4
  progress?: number;
5
+ showLabel?: boolean;
6
+ fullPage?: boolean;
5
7
  }): import("react").JSX.Element;
@@ -6,23 +6,34 @@ import s from "./LoadingState.module.css";
6
6
  function LoadingState({
7
7
  variant = "spinner",
8
8
  label = "\u6B63\u5728\u52A0\u8F7D",
9
- progress
9
+ progress,
10
+ showLabel = true,
11
+ fullPage = false
10
12
  }) {
11
13
  if (variant === "skeleton") return /* @__PURE__ */ jsx(SkeletonRows, { label });
12
- return /* @__PURE__ */ jsxs("div", { className: s.loading, role: "status", "aria-label": label, children: [
13
- variant === "progress" ? /* @__PURE__ */ jsx(Progress, { value: progress ?? 0, label }) : /* @__PURE__ */ jsx(
14
- Spinner,
15
- {
16
- size: 24,
17
- variant: variant === "dots" ? "dots" : "ring",
18
- decorative: true
19
- }
20
- ),
21
- /* @__PURE__ */ jsxs("span", { children: [
22
- label,
23
- variant === "progress" && progress !== void 0 ? " " + Math.round(progress) + "%" : ""
24
- ] })
25
- ] });
14
+ return /* @__PURE__ */ jsxs(
15
+ "div",
16
+ {
17
+ className: s.loading,
18
+ role: "status",
19
+ "aria-label": label,
20
+ "data-full-page": fullPage || void 0,
21
+ children: [
22
+ variant === "progress" ? /* @__PURE__ */ jsx(Progress, { value: progress ?? 0, label }) : /* @__PURE__ */ jsx(
23
+ Spinner,
24
+ {
25
+ size: 24,
26
+ variant: variant === "dots" ? "dots" : "ring",
27
+ decorative: true
28
+ }
29
+ ),
30
+ showLabel && /* @__PURE__ */ jsxs("span", { children: [
31
+ label,
32
+ variant === "progress" && progress !== void 0 ? " " + Math.round(progress) + "%" : ""
33
+ ] })
34
+ ]
35
+ }
36
+ );
26
37
  }
27
38
  export {
28
39
  LoadingState
@@ -12,3 +12,6 @@
12
12
  .loading > div {
13
13
  width: min(260px, 100%);
14
14
  }
15
+ .loading[data-full-page="true"] {
16
+ min-height: calc(100dvh - 200px);
17
+ }
@@ -5,10 +5,11 @@ export type MenuItemProps = Omit<HTMLAttributes<HTMLElement>, "children" | "pref
5
5
  prefix?: ReactNode;
6
6
  shortcut?: string;
7
7
  trailing?: ReactNode;
8
+ meta?: ReactNode;
8
9
  selected?: boolean;
9
10
  active?: boolean;
10
11
  disabled?: boolean;
11
12
  selection?: "check" | "checkbox" | "radio";
12
13
  tone?: "default" | "danger";
13
14
  };
14
- export declare function MenuItem({ as, prefix, label, description, icon, reserveIcon, shortcut, trailing, selected, active, disabled, selection, tone, className, ...props }: MenuItemProps): import("react").JSX.Element;
15
+ export declare function MenuItem({ as, prefix, label, description, icon, reserveIcon, shortcut, trailing, meta, selected, active, disabled, selection, tone, className, ...props }: MenuItemProps): import("react").JSX.Element;
@@ -11,6 +11,7 @@ function MenuItem({
11
11
  reserveIcon = false,
12
12
  shortcut,
13
13
  trailing,
14
+ meta,
14
15
  selected = false,
15
16
  active = false,
16
17
  disabled = false,
@@ -31,6 +32,7 @@ function MenuItem({
31
32
  }
32
33
  ),
33
34
  shortcut && /* @__PURE__ */ jsx("kbd", { className: s.shortcut, children: shortcut }),
35
+ meta && /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: meta }),
34
36
  /* @__PURE__ */ jsx("span", { className: s.trailing, "data-menu-trailing": true, "aria-hidden": "true", children: trailing || (selection === "checkbox" ? /* @__PURE__ */ jsx("span", { className: s.checkbox, "data-checked": selected, children: selected && /* @__PURE__ */ jsx(Check, {}) }) : selection === "radio" ? /* @__PURE__ */ jsx("span", { className: s.radio, "data-checked": selected, children: /* @__PURE__ */ jsx("i", {}) }) : selection === "check" && selected ? /* @__PURE__ */ jsx(Check, { className: s.check }) : null) })
35
37
  ] });
36
38
  const common = {
@@ -104,6 +104,11 @@
104
104
  .shortcut {
105
105
  flex-shrink: 0;
106
106
  margin-left: auto;
107
+ padding: 0;
108
+ border: 0;
109
+ border-radius: 0;
110
+ background: transparent;
111
+ box-shadow: none;
107
112
  font-family: var(--ui-font);
108
113
  font-size: var(--menu-shortcut-font-size);
109
114
  font-weight: 400;
@@ -111,6 +116,10 @@
111
116
  font-variant-numeric: tabular-nums;
112
117
  color: var(--muted);
113
118
  white-space: nowrap;
119
+ text-align: right;
120
+ }
121
+ .shortcut ~ .trailing:empty {
122
+ display: none;
114
123
  }
115
124
  .check {
116
125
  color: var(--accent);
@@ -1,6 +1,6 @@
1
1
  import { type FieldOptions } from "./field";
2
2
  import type { SelectOption } from "./types";
3
- export declare function MultiSelect({ value, onChange, options, label, disabled, readOnly, required, name, id: controlId, error, hint, maxSelected, clearable, placeholder, ...aria }: FieldOptions & {
3
+ export declare function MultiSelect({ value, onChange, options, label, disabled, readOnly, required, name, id: controlId, error, hint, maxSelected, clearable, placeholder, display, ...aria }: FieldOptions & {
4
4
  value: string[];
5
5
  onChange(value: string[]): void;
6
6
  options: SelectOption[];
@@ -9,4 +9,5 @@ export declare function MultiSelect({ value, onChange, options, label, disabled,
9
9
  maxSelected?: number;
10
10
  clearable?: boolean;
11
11
  placeholder?: string;
12
+ display?: "summary" | "tags";
12
13
  }): import("react").JSX.Element;