@robert-stackflow/oneui 0.6.40 → 0.6.41

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 (42) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +6 -0
  3. package/components/AccountItem.module.css +103 -103
  4. package/components/AppShell.module.css +223 -223
  5. package/components/Badge.module.css +30 -30
  6. package/components/BarChart.module.css +35 -35
  7. package/components/Breadcrumb.module.css +97 -97
  8. package/components/Button.module.css +120 -120
  9. package/components/Checkbox.module.css +95 -95
  10. package/components/Control.module.css +86 -86
  11. package/components/DataTable.module.css +75 -75
  12. package/components/Form.d.ts +5 -1
  13. package/components/Form.js +5 -1
  14. package/components/FormField.js +1 -0
  15. package/components/HierarchyPicker.module.css +185 -185
  16. package/components/Indicator.module.css +83 -83
  17. package/components/Layout.module.css +82 -82
  18. package/components/Markdown.module.css +227 -227
  19. package/components/NativeForm.d.ts +10 -0
  20. package/components/NativeForm.js +155 -0
  21. package/components/NavBar.module.css +130 -130
  22. package/components/Progress.module.css +33 -33
  23. package/components/RadioGroup.module.css +87 -87
  24. package/components/RangeSlider.module.css +141 -141
  25. package/components/ResizablePanel.module.css +101 -101
  26. package/components/ResourceCard.module.css +98 -98
  27. package/components/Slider.module.css +19 -19
  28. package/components/Steps.module.css +176 -176
  29. package/components/Tab.module.css +148 -148
  30. package/components/ThemePicker.module.css +178 -178
  31. package/components/TimeColumns.module.css +47 -47
  32. package/components/Timeline.module.css +202 -202
  33. package/components/TreeTable.module.css +57 -57
  34. package/components/UptimeChart.module.css +15 -15
  35. package/components/field.d.ts +1 -1
  36. package/components/field.js +2 -1
  37. package/components/form-validation.d.ts +4 -0
  38. package/components/form-validation.js +22 -0
  39. package/components/index.d.ts +4 -2
  40. package/components/index.js +9 -3
  41. package/package.json +1 -1
  42. package/styles/blue.css +270 -270
@@ -1,95 +1,95 @@
1
- .checkbox {
2
- display: inline-flex;
3
- align-items: center;
4
- gap: 9px;
5
- cursor: pointer;
6
- position: relative;
7
- user-select: none;
8
- }
9
- .checkbox input[type="checkbox"] {
10
- position: absolute;
11
- left: 0;
12
- width: 18px;
13
- height: 18px;
14
- margin: 0;
15
- opacity: 0;
16
- }
17
- .checkMark {
18
- width: 18px;
19
- height: 18px;
20
- flex-shrink: 0;
21
- border: 1px solid color-mix(in srgb, var(--fg) 25%, var(--surface));
22
- border-radius: 5px;
23
- background: var(--field);
24
- display: grid;
25
- place-items: center;
26
- pointer-events: none;
27
- transition:
28
- background-color var(--motion-hover),
29
- border-color var(--motion-hover),
30
- box-shadow var(--motion-hover),
31
- transform var(--motion-press);
32
- }
33
- .checkMark svg {
34
- width: 16px;
35
- height: 16px;
36
- fill: none;
37
- stroke: currentColor;
38
- stroke-width: 1.8;
39
- stroke-linecap: round;
40
- stroke-linejoin: round;
41
- }
42
- .checkMark path {
43
- stroke-dasharray: 1;
44
- stroke-dashoffset: 1;
45
- opacity: 0;
46
- transition:
47
- stroke-dashoffset var(--motion-panel) var(--ease),
48
- opacity var(--motion-hover);
49
- }
50
- .checkbox:hover input:not(:disabled) + .checkMark {
51
- border-color: var(--muted);
52
- }
53
- .checkbox:active input:not(:disabled) + .checkMark {
54
- transform: scale(0.92);
55
- }
56
- .checkbox input:checked + .checkMark {
57
- background: var(--accent-fill, var(--accent));
58
- color: var(--on-accent-fill, var(--on-accent));
59
- border-color: var(--accent-fill, var(--accent));
60
- }
61
- .checkbox input:checked + .checkMark path {
62
- stroke-dashoffset: 0;
63
- opacity: 1;
64
- }
65
- .checkbox input:focus-visible + .checkMark {
66
- box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-ink, var(--accent)) 14%, transparent);
67
- border-color: var(--accent-ink, var(--accent));
68
- }
69
- .checkbox[data-disabled="true"] {
70
- cursor: not-allowed;
71
- }
72
- .checkbox input:disabled ~ span {
73
- opacity: 0.4;
74
- }
75
-
76
- .checkbox[data-indeterminate="true"] .checkMark {
77
- background: var(--accent);
78
- border-color: var(--accent);
79
- color: var(--on-accent);
80
- }
81
- .checkbox[data-indeterminate="true"] .checkMark svg {
82
- opacity: 1;
83
- transform: scale(1);
84
- }
85
- .checkbox[data-indeterminate="true"] .checkMark path {
86
- stroke-dashoffset: 0;
87
- opacity: 1;
88
- }
89
-
90
- .checkbox input[aria-invalid="true"] + .checkMark {
91
- border-color: var(--danger);
92
- }
93
- .checkbox input[aria-invalid="true"]:focus-visible + .checkMark {
94
- box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger) 12%, transparent);
95
- }
1
+ .checkbox {
2
+ display: inline-flex;
3
+ align-items: center;
4
+ gap: 9px;
5
+ cursor: pointer;
6
+ position: relative;
7
+ user-select: none;
8
+ }
9
+ .checkbox input[type="checkbox"] {
10
+ position: absolute;
11
+ left: 0;
12
+ width: 18px;
13
+ height: 18px;
14
+ margin: 0;
15
+ opacity: 0;
16
+ }
17
+ .checkMark {
18
+ width: 18px;
19
+ height: 18px;
20
+ flex-shrink: 0;
21
+ border: 1px solid color-mix(in srgb, var(--fg) 25%, var(--surface));
22
+ border-radius: 5px;
23
+ background: var(--field);
24
+ display: grid;
25
+ place-items: center;
26
+ pointer-events: none;
27
+ transition:
28
+ background-color var(--motion-hover),
29
+ border-color var(--motion-hover),
30
+ box-shadow var(--motion-hover),
31
+ transform var(--motion-press);
32
+ }
33
+ .checkMark svg {
34
+ width: 16px;
35
+ height: 16px;
36
+ fill: none;
37
+ stroke: currentColor;
38
+ stroke-width: 1.8;
39
+ stroke-linecap: round;
40
+ stroke-linejoin: round;
41
+ }
42
+ .checkMark path {
43
+ stroke-dasharray: 1;
44
+ stroke-dashoffset: 1;
45
+ opacity: 0;
46
+ transition:
47
+ stroke-dashoffset var(--motion-panel) var(--ease),
48
+ opacity var(--motion-hover);
49
+ }
50
+ .checkbox:hover input:not(:disabled) + .checkMark {
51
+ border-color: var(--muted);
52
+ }
53
+ .checkbox:active input:not(:disabled) + .checkMark {
54
+ transform: scale(0.92);
55
+ }
56
+ .checkbox input:checked + .checkMark {
57
+ background: var(--accent-fill, var(--accent));
58
+ color: var(--on-accent-fill, var(--on-accent));
59
+ border-color: var(--accent-fill, var(--accent));
60
+ }
61
+ .checkbox input:checked + .checkMark path {
62
+ stroke-dashoffset: 0;
63
+ opacity: 1;
64
+ }
65
+ .checkbox input:focus-visible + .checkMark {
66
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-ink, var(--accent)) 14%, transparent);
67
+ border-color: var(--accent-ink, var(--accent));
68
+ }
69
+ .checkbox[data-disabled="true"] {
70
+ cursor: not-allowed;
71
+ }
72
+ .checkbox input:disabled ~ span {
73
+ opacity: 0.4;
74
+ }
75
+
76
+ .checkbox[data-indeterminate="true"] .checkMark {
77
+ background: var(--accent);
78
+ border-color: var(--accent);
79
+ color: var(--on-accent);
80
+ }
81
+ .checkbox[data-indeterminate="true"] .checkMark svg {
82
+ opacity: 1;
83
+ transform: scale(1);
84
+ }
85
+ .checkbox[data-indeterminate="true"] .checkMark path {
86
+ stroke-dashoffset: 0;
87
+ opacity: 1;
88
+ }
89
+
90
+ .checkbox input[aria-invalid="true"] + .checkMark {
91
+ border-color: var(--danger);
92
+ }
93
+ .checkbox input[aria-invalid="true"]:focus-visible + .checkMark {
94
+ box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger) 12%, transparent);
95
+ }
@@ -1,86 +1,86 @@
1
- .surface {
2
- height: var(--control-height);
3
- min-width: 0;
4
- border: 1px solid var(--control-border, var(--line));
5
- border-radius: var(--field-radius);
6
- background: var(--field);
7
- color: var(--fg);
8
- font-size: var(--field-font-size);
9
- line-height: var(--field-line-height);
10
- outline: none;
11
- transition:
12
- border-color var(--motion-hover),
13
- box-shadow var(--motion-hover),
14
- background-color var(--motion-hover);
15
- }
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))
34
- );
35
- }
36
- .surface[data-focus="true"],
37
- .surface:focus,
38
- .surface:focus-visible,
39
- .surface:focus-within,
40
- .surface[aria-expanded="true"] {
41
- outline: none;
42
- border-color: var(--field-focus-border);
43
- box-shadow: 0 0 0 var(--field-focus-width)
44
- color-mix(in srgb, var(--accent-ink, var(--accent)) var(--field-focus-strength), transparent);
45
- }
46
- .surface[aria-invalid="true"] {
47
- border-color: var(--danger);
48
- }
49
- .surface[aria-invalid="true"][data-focus="true"],
50
- .surface[aria-invalid="true"]:focus-within {
51
- box-shadow: 0 0 0 var(--field-focus-width)
52
- color-mix(in srgb, var(--danger) var(--field-focus-strength), transparent);
53
- }
54
- .surface:disabled,
55
- .surface[data-disabled="true"] {
56
- opacity: var(--field-disabled-opacity);
57
- cursor: not-allowed;
58
- }
59
- .surface[data-disabled="true"] input:disabled {
60
- opacity: 1;
61
- }
62
- .surface input {
63
- outline: none;
64
- color: inherit;
65
- font-family: inherit;
66
- line-height: inherit;
67
- }
68
- .surface input:focus-visible {
69
- outline: none;
70
- }
71
- .surface::placeholder,
72
- .surface input::placeholder {
73
- color: var(--placeholder);
74
- opacity: 1;
75
- }
76
- .surface[readonly],
77
- .surface[aria-readonly="true"],
78
- .surface:has(input[readonly]) {
79
- background: var(--field-readonly);
80
- }
81
- @media (max-width: 600px) {
82
- .surface:has(input),
83
- .surface:is(input, textarea) {
84
- font-size: 16px;
85
- }
86
- }
1
+ .surface {
2
+ height: var(--control-height);
3
+ min-width: 0;
4
+ border: 1px solid var(--control-border, var(--line));
5
+ border-radius: var(--field-radius);
6
+ background: var(--field);
7
+ color: var(--fg);
8
+ font-size: var(--field-font-size);
9
+ line-height: var(--field-line-height);
10
+ outline: none;
11
+ transition:
12
+ border-color var(--motion-hover),
13
+ box-shadow var(--motion-hover),
14
+ background-color var(--motion-hover);
15
+ }
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))
34
+ );
35
+ }
36
+ .surface[data-focus="true"],
37
+ .surface:focus,
38
+ .surface:focus-visible,
39
+ .surface:focus-within,
40
+ .surface[aria-expanded="true"] {
41
+ outline: none;
42
+ border-color: var(--field-focus-border);
43
+ box-shadow: 0 0 0 var(--field-focus-width)
44
+ color-mix(in srgb, var(--accent-ink, var(--accent)) var(--field-focus-strength), transparent);
45
+ }
46
+ .surface[aria-invalid="true"] {
47
+ border-color: var(--danger);
48
+ }
49
+ .surface[aria-invalid="true"][data-focus="true"],
50
+ .surface[aria-invalid="true"]:focus-within {
51
+ box-shadow: 0 0 0 var(--field-focus-width)
52
+ color-mix(in srgb, var(--danger) var(--field-focus-strength), transparent);
53
+ }
54
+ .surface:disabled,
55
+ .surface[data-disabled="true"] {
56
+ opacity: var(--field-disabled-opacity);
57
+ cursor: not-allowed;
58
+ }
59
+ .surface[data-disabled="true"] input:disabled {
60
+ opacity: 1;
61
+ }
62
+ .surface input {
63
+ outline: none;
64
+ color: inherit;
65
+ font-family: inherit;
66
+ line-height: inherit;
67
+ }
68
+ .surface input:focus-visible {
69
+ outline: none;
70
+ }
71
+ .surface::placeholder,
72
+ .surface input::placeholder {
73
+ color: var(--placeholder);
74
+ opacity: 1;
75
+ }
76
+ .surface[readonly],
77
+ .surface[aria-readonly="true"],
78
+ .surface:has(input[readonly]) {
79
+ background: var(--field-readonly);
80
+ }
81
+ @media (max-width: 600px) {
82
+ .surface:has(input),
83
+ .surface:is(input, textarea) {
84
+ font-size: 16px;
85
+ }
86
+ }
@@ -1,75 +1,75 @@
1
- .container {
2
- min-width: 0;
3
- }
4
- .toolbar {
5
- display: flex;
6
- justify-content: flex-end;
7
- align-items: center;
8
- gap: 8px;
9
- flex-wrap: wrap;
10
- margin-bottom: 12px;
11
- }
12
- .columnMenu {
13
- display: flex;
14
- flex-direction: column;
15
- }
16
- .scroll {
17
- composes: scroll from "./Table.module.css";
18
- }
19
- .table {
20
- composes: table from "./Table.module.css";
21
- }
22
- .heading {
23
- display: flex;
24
- align-items: center;
25
- justify-content: space-between;
26
- gap: 8px;
27
- }
28
- .sort,
29
- .filter {
30
- display: inline-flex;
31
- align-items: center;
32
- gap: 7px;
33
- border: 0;
34
- background: transparent;
35
- padding: 4px;
36
- border-radius: 5px;
37
- color: inherit;
38
- }
39
- .sort:hover,
40
- .filter:hover {
41
- background: var(--hover);
42
- color: var(--fg);
43
- }
44
- .sort svg,
45
- .filter svg {
46
- width: 14px;
47
- height: 14px;
48
- }
49
- .filter[data-active="true"] {
50
- color: var(--accent-ink, var(--accent));
51
- background: var(--selected);
52
- }
53
- .filterPanel {
54
- max-height: 300px;
55
- overflow: auto;
56
- }
57
- .selection {
58
- width: 44px;
59
- }
60
- .selection label > span:last-child {
61
- position: absolute;
62
- width: 1px;
63
- height: 1px;
64
- overflow: hidden;
65
- clip-path: inset(50%);
66
- }
67
-
68
- .filterReset {
69
- display: flex;
70
- justify-content: flex-end;
71
- margin-top: 6px;
72
- padding-top: 6px;
73
- border-top: var(--separator-width) var(--separator-style)
74
- var(--separator-color);
75
- }
1
+ .container {
2
+ min-width: 0;
3
+ }
4
+ .toolbar {
5
+ display: flex;
6
+ justify-content: flex-end;
7
+ align-items: center;
8
+ gap: 8px;
9
+ flex-wrap: wrap;
10
+ margin-bottom: 12px;
11
+ }
12
+ .columnMenu {
13
+ display: flex;
14
+ flex-direction: column;
15
+ }
16
+ .scroll {
17
+ composes: scroll from "./Table.module.css";
18
+ }
19
+ .table {
20
+ composes: table from "./Table.module.css";
21
+ }
22
+ .heading {
23
+ display: flex;
24
+ align-items: center;
25
+ justify-content: space-between;
26
+ gap: 8px;
27
+ }
28
+ .sort,
29
+ .filter {
30
+ display: inline-flex;
31
+ align-items: center;
32
+ gap: 7px;
33
+ border: 0;
34
+ background: transparent;
35
+ padding: 4px;
36
+ border-radius: 5px;
37
+ color: inherit;
38
+ }
39
+ .sort:hover,
40
+ .filter:hover {
41
+ background: var(--hover);
42
+ color: var(--fg);
43
+ }
44
+ .sort svg,
45
+ .filter svg {
46
+ width: 14px;
47
+ height: 14px;
48
+ }
49
+ .filter[data-active="true"] {
50
+ color: var(--accent-ink, var(--accent));
51
+ background: var(--selected);
52
+ }
53
+ .filterPanel {
54
+ max-height: 300px;
55
+ overflow: auto;
56
+ }
57
+ .selection {
58
+ width: 44px;
59
+ }
60
+ .selection label > span:last-child {
61
+ position: absolute;
62
+ width: 1px;
63
+ height: 1px;
64
+ overflow: hidden;
65
+ clip-path: inset(50%);
66
+ }
67
+
68
+ .filterReset {
69
+ display: flex;
70
+ justify-content: flex-end;
71
+ margin-top: 6px;
72
+ padding-top: 6px;
73
+ border-top: var(--separator-width) var(--separator-style)
74
+ var(--separator-color);
75
+ }
@@ -1,8 +1,12 @@
1
1
  import type { FormHTMLAttributes, ReactNode } from "react";
2
+ import { type NativeFormProps } from "./NativeForm";
3
+ export type { NativeFormProps } from "./NativeForm";
2
4
  import type { FormController } from "./useFormState";
3
5
  import { type FormLayoutOptions } from "./FormLayout";
4
- export declare function Form<T extends Record<string, unknown>>({ controller, onSubmit, children, layout, labelWidth, ...props }: Omit<FormHTMLAttributes<HTMLFormElement>, "onSubmit" | "onReset" | "children"> & FormLayoutOptions & {
6
+ declare function ControlledForm<T extends Record<string, unknown>>({ controller, onSubmit, children, layout, labelWidth, ...props }: Omit<FormHTMLAttributes<HTMLFormElement>, "onSubmit" | "onReset" | "children"> & FormLayoutOptions & {
5
7
  controller: FormController<T>;
6
8
  onSubmit(values: T): void | Promise<void>;
7
9
  children: ReactNode;
8
10
  }): import("react").JSX.Element;
11
+ export declare function Form<T extends Record<string, unknown>>(props: Parameters<typeof ControlledForm<T>>[0]): ReactNode;
12
+ export declare function Form(props: NativeFormProps): ReactNode;
@@ -1,8 +1,9 @@
1
1
  "use client";
2
2
  import { jsx } from "react/jsx-runtime";
3
+ import { NativeForm } from "./NativeForm.js";
3
4
  import s from "./Form.module.css";
4
5
  import { FormLayoutContext } from "./FormLayout.js";
5
- function Form({
6
+ function ControlledForm({
6
7
  controller,
7
8
  onSubmit,
8
9
  children,
@@ -25,6 +26,9 @@ function Form({
25
26
  }
26
27
  ) });
27
28
  }
29
+ function Form(props) {
30
+ return props.controller ? /* @__PURE__ */ jsx(ControlledForm, { ...props }) : /* @__PURE__ */ jsx(NativeForm, { ...props });
31
+ }
28
32
  export {
29
33
  Form
30
34
  };
@@ -39,6 +39,7 @@ function FormField({
39
39
  "div",
40
40
  {
41
41
  className: s.field,
42
+ "data-field-id": field.id,
42
43
  "data-invalid": !!field.error,
43
44
  "data-disabled": field.disabled || void 0,
44
45
  "data-layout": layout,