@ecopages/radiant-ui 0.1.0-beta.0 → 0.1.0-beta.2

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 (75) hide show
  1. package/README.md +4 -2
  2. package/dist/components/ui/alert/alert.css +56 -23
  3. package/dist/components/ui/breadcrumb/breadcrumb.css +85 -36
  4. package/dist/components/ui/carousel/carousel.css +465 -166
  5. package/dist/components/ui/checkbox/checkbox.css +196 -49
  6. package/dist/components/ui/combobox/combobox.css +213 -60
  7. package/dist/components/ui/dialog/dialog.css +176 -49
  8. package/dist/components/ui/disclosure/disclosure.css +228 -100
  9. package/dist/components/ui/feed/feed.css +30 -10
  10. package/dist/components/ui/field/field.css +18 -22
  11. package/dist/components/ui/form/form.css +7 -8
  12. package/dist/components/ui/grid/grid.css +172 -43
  13. package/dist/components/ui/input/input.css +126 -30
  14. package/dist/components/ui/label/label.css +20 -6
  15. package/dist/components/ui/listbox/listbox.css +137 -19
  16. package/dist/components/ui/menu-button/index.js +1 -1
  17. package/dist/components/ui/menu-button/index.js.map +4 -4
  18. package/dist/components/ui/menu-button/menu-button.css +158 -38
  19. package/dist/components/ui/menu-button/menu-button.script.d.ts +7 -7
  20. package/dist/components/ui/menubar/index.js +1 -1
  21. package/dist/components/ui/menubar/index.js.map +2 -2
  22. package/dist/components/ui/menubar/menubar.css +207 -39
  23. package/dist/components/ui/meter/meter.css +50 -13
  24. package/dist/components/ui/navigation-menu/navigation-menu.css +281 -85
  25. package/dist/components/ui/radio-group/radio-group.css +179 -40
  26. package/dist/components/ui/shared/floating-position.d.ts +37 -0
  27. package/dist/components/ui/shared/floating-position.test.d.ts +1 -0
  28. package/dist/components/ui/shared/placement.d.ts +2 -0
  29. package/dist/components/ui/sidebar/sidebar.css +407 -189
  30. package/dist/components/ui/slider/slider.css +220 -47
  31. package/dist/components/ui/spinbutton/spinbutton.css +65 -15
  32. package/dist/components/ui/switch/switch.css +164 -43
  33. package/dist/components/ui/tabs/tabs.css +145 -24
  34. package/dist/components/ui/textarea/textarea.css +128 -31
  35. package/dist/components/ui/toast/toast.css +388 -255
  36. package/dist/components/ui/toolbar/toolbar.css +118 -11
  37. package/dist/components/ui/tooltip/index.js +1 -1
  38. package/dist/components/ui/tooltip/index.js.map +4 -4
  39. package/dist/components/ui/tooltip/tooltip.css +119 -21
  40. package/dist/components/ui/tooltip/tooltip.script.d.ts +6 -6
  41. package/dist/components/ui/tree/tree.css +180 -49
  42. package/dist/components/ui/treegrid/treegrid.css +190 -72
  43. package/dist/components/ui/window-splitter/window-splitter.css +144 -31
  44. package/dist/index.js +1 -1
  45. package/dist/index.js.map +4 -4
  46. package/dist/styles/components/button.css +299 -113
  47. package/dist/styles/radiant-ui-core.css +828 -7
  48. package/dist/styles/radiant-ui.css +1497 -8
  49. package/dist/styles/styles.css +5830 -36
  50. package/dist/styles/tailwind.css +1607 -27
  51. package/dist/styles/themes/aurora.css +637 -15
  52. package/dist/styles/themes/default-compact-soft.css +580 -15
  53. package/dist/styles/themes/default.css +641 -2
  54. package/dist/styles/themes/glacier.css +637 -15
  55. package/dist/styles/tokens/colors/aurora.css +1 -73
  56. package/dist/styles/tokens/colors/basalt.css +1 -36
  57. package/dist/styles/tokens/colors/glacier.css +1 -45
  58. package/dist/styles/tokens/colors/palettes.css +1 -3
  59. package/dist/styles/tokens/elevation/default.css +11 -19
  60. package/dist/styles/tokens/elevation/flat.css +11 -19
  61. package/dist/styles/tokens/motion/default.css +6 -17
  62. package/dist/styles/tokens/motion/snappy.css +6 -17
  63. package/dist/styles/tokens/presets/colors/index.css +446 -4
  64. package/dist/styles/tokens/radius/default.css +17 -31
  65. package/dist/styles/tokens/radius/edgy.css +17 -32
  66. package/dist/styles/tokens/radius/sharp.css +20 -2
  67. package/dist/styles/tokens/radius/soft.css +17 -31
  68. package/dist/styles/tokens/semantic.css +445 -79
  69. package/dist/styles/tokens/spacing/compact.css +16 -21
  70. package/dist/styles/tokens/spacing/default.css +16 -21
  71. package/dist/styles/tokens/spacing/scale-bridge.css +1 -17
  72. package/dist/styles/tokens/spacing/wide.css +16 -21
  73. package/dist/styles/tokens/system.css +21 -33
  74. package/dist/styles/tokens/typography/default.css +23 -33
  75. package/package.json +5 -6
@@ -1,47 +1,176 @@
1
- @reference '../../../styles/radiant-ui.css';
2
-
1
+ /*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
2
+ @layer properties;
3
3
  rui-grid {
4
- @apply block;
4
+ display: block;
5
5
  }
6
-
7
6
  @layer components {
8
- .rui-grid {
9
- @apply w-full overflow-hidden rounded-container border border-border text-sm shadow-sm;
10
- display: table;
11
- border-collapse: separate;
12
- border-spacing: 0;
13
- }
14
-
15
- .rui-grid__row {
16
- display: table-row;
17
- }
18
-
19
- .rui-grid__row:not(:first-child):hover .rui-grid__cell {
20
- @apply bg-surface/60;
21
- }
22
-
23
- .rui-grid__cell {
24
- display: table-cell;
25
- @apply border-b border-r border-border bg-background px-control-x py-2.5 align-middle text-on-background;
26
- }
27
-
28
- .rui-grid__row .rui-grid__cell:last-child {
29
- @apply border-r-0;
30
- }
31
-
32
- .rui-grid__row:last-child .rui-grid__cell {
33
- @apply border-b-0;
34
- }
35
-
36
- .rui-grid__row:first-child .rui-grid__cell {
37
- @apply bg-surface font-semibold text-on-background;
38
- }
39
-
40
- .rui-grid__cell a {
41
- @apply font-medium text-link no-underline underline-offset-2 hover:underline;
42
- }
43
-
44
- .rui-grid__cell:focus-visible {
45
- @apply relative z-dropdown outline-none ring-2 ring-inset ring-focus-ring;
46
- }
7
+ .rui-grid {
8
+ width: 100%;
9
+ overflow: hidden;
10
+ border-radius: var(--radius-container, var(--radius-container));
11
+ border-style: var(--tw-border-style);
12
+ border-width: 1px;
13
+ border-color: var(--color-border, var(--border));
14
+ font-size: var(--text-sm, var(--text-sm));
15
+ line-height: var(--tw-leading, var(--text-sm--line-height, calc(1.25 / 0.875)));
16
+ --tw-shadow: var(--shadow-control);
17
+ box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
18
+ display: table;
19
+ border-collapse: separate;
20
+ border-spacing: 0;
21
+ }
22
+ .rui-grid__row {
23
+ display: table-row;
24
+ }
25
+ .rui-grid__row:not(:first-child):hover .rui-grid__cell {
26
+ background-color: var(--color-surface, var(--surface));
27
+ @supports (color: color-mix(in lab, red, red)) {
28
+ background-color: color-mix(in oklab, var(--color-surface, var(--surface)) 60%, transparent);
29
+ }
30
+ }
31
+ .rui-grid__cell {
32
+ display: table-cell;
33
+ border-right-style: var(--tw-border-style);
34
+ border-right-width: 1px;
35
+ border-bottom-style: var(--tw-border-style);
36
+ border-bottom-width: 1px;
37
+ border-color: var(--color-border, var(--border));
38
+ background-color: var(--color-background, var(--background));
39
+ padding-inline: var(--spacing-control-x, var(--space-control-x));
40
+ padding-block: calc(var(--spacing, 0.25rem) * 2.5);
41
+ vertical-align: middle;
42
+ color: var(--color-on-background, var(--on-background));
43
+ }
44
+ .rui-grid__row .rui-grid__cell:last-child {
45
+ border-right-style: var(--tw-border-style);
46
+ border-right-width: 0px;
47
+ }
48
+ .rui-grid__row:last-child .rui-grid__cell {
49
+ border-bottom-style: var(--tw-border-style);
50
+ border-bottom-width: 0px;
51
+ }
52
+ .rui-grid__row:first-child .rui-grid__cell {
53
+ background-color: var(--color-surface, var(--surface));
54
+ --tw-font-weight: var(--font-weight-semibold, var(--weight-semibold));
55
+ font-weight: var(--font-weight-semibold, var(--weight-semibold));
56
+ color: var(--color-on-background, var(--on-background));
57
+ }
58
+ .rui-grid__cell a {
59
+ --tw-font-weight: var(--font-weight-medium, var(--weight-medium));
60
+ font-weight: var(--font-weight-medium, var(--weight-medium));
61
+ color: var(--color-link, var(--link));
62
+ text-decoration-line: none;
63
+ text-underline-offset: 2px;
64
+ &:hover {
65
+ @media (hover: hover) {
66
+ text-decoration-line: underline;
67
+ }
68
+ }
69
+ }
70
+ .rui-grid__cell:focus-visible {
71
+ position: relative;
72
+ z-index: var(--z-index-dropdown, var(--z-dropdown));
73
+ --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
74
+ box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
75
+ --tw-ring-color: var(--color-focus-ring, var(--focus-ring));
76
+ --tw-outline-style: none;
77
+ outline-style: none;
78
+ --tw-ring-inset: inset;
79
+ }
80
+ }
81
+ @property --tw-border-style {
82
+ syntax: "*";
83
+ inherits: false;
84
+ initial-value: solid;
85
+ }
86
+ @property --tw-shadow {
87
+ syntax: "*";
88
+ inherits: false;
89
+ initial-value: 0 0 #0000;
90
+ }
91
+ @property --tw-shadow-color {
92
+ syntax: "*";
93
+ inherits: false;
94
+ }
95
+ @property --tw-shadow-alpha {
96
+ syntax: "<percentage>";
97
+ inherits: false;
98
+ initial-value: 100%;
99
+ }
100
+ @property --tw-inset-shadow {
101
+ syntax: "*";
102
+ inherits: false;
103
+ initial-value: 0 0 #0000;
104
+ }
105
+ @property --tw-inset-shadow-color {
106
+ syntax: "*";
107
+ inherits: false;
108
+ }
109
+ @property --tw-inset-shadow-alpha {
110
+ syntax: "<percentage>";
111
+ inherits: false;
112
+ initial-value: 100%;
113
+ }
114
+ @property --tw-ring-color {
115
+ syntax: "*";
116
+ inherits: false;
117
+ }
118
+ @property --tw-ring-shadow {
119
+ syntax: "*";
120
+ inherits: false;
121
+ initial-value: 0 0 #0000;
122
+ }
123
+ @property --tw-inset-ring-color {
124
+ syntax: "*";
125
+ inherits: false;
126
+ }
127
+ @property --tw-inset-ring-shadow {
128
+ syntax: "*";
129
+ inherits: false;
130
+ initial-value: 0 0 #0000;
131
+ }
132
+ @property --tw-ring-inset {
133
+ syntax: "*";
134
+ inherits: false;
135
+ }
136
+ @property --tw-ring-offset-width {
137
+ syntax: "<length>";
138
+ inherits: false;
139
+ initial-value: 0px;
140
+ }
141
+ @property --tw-ring-offset-color {
142
+ syntax: "*";
143
+ inherits: false;
144
+ initial-value: #fff;
145
+ }
146
+ @property --tw-ring-offset-shadow {
147
+ syntax: "*";
148
+ inherits: false;
149
+ initial-value: 0 0 #0000;
150
+ }
151
+ @property --tw-font-weight {
152
+ syntax: "*";
153
+ inherits: false;
154
+ }
155
+ @layer properties {
156
+ @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
157
+ *, ::before, ::after, ::backdrop {
158
+ --tw-border-style: solid;
159
+ --tw-shadow: 0 0 #0000;
160
+ --tw-shadow-color: initial;
161
+ --tw-shadow-alpha: 100%;
162
+ --tw-inset-shadow: 0 0 #0000;
163
+ --tw-inset-shadow-color: initial;
164
+ --tw-inset-shadow-alpha: 100%;
165
+ --tw-ring-color: initial;
166
+ --tw-ring-shadow: 0 0 #0000;
167
+ --tw-inset-ring-color: initial;
168
+ --tw-inset-ring-shadow: 0 0 #0000;
169
+ --tw-ring-inset: initial;
170
+ --tw-ring-offset-width: 0px;
171
+ --tw-ring-offset-color: #fff;
172
+ --tw-ring-offset-shadow: 0 0 #0000;
173
+ --tw-font-weight: initial;
174
+ }
175
+ }
47
176
  }
@@ -1,32 +1,128 @@
1
- @reference '../../../styles/radiant-ui.css';
2
-
1
+ /*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
2
+ @layer properties;
3
3
  @layer components {
4
- .rui-input {
5
- @apply w-full border border-border bg-background text-on-background outline-none;
6
- border-radius: var(--radius-control);
7
- padding-inline: var(--space-control-x);
8
- padding-block: var(--space-control-y);
9
- font-size: var(--text-control, 0.875rem);
10
- transition-duration: var(--duration-normal);
11
- }
12
-
13
- .rui-input:focus-visible {
14
- @apply ring-2 ring-focus-ring;
15
- }
16
-
17
- .rui-input:disabled {
18
- @apply cursor-not-allowed opacity-disabled;
19
- }
20
-
21
- .rui-input[aria-invalid='true'] {
22
- @apply border-error;
23
- }
24
-
25
- .rui-input--sm {
26
- padding-block: calc(var(--space-control-y) * 0.75);
27
- }
28
-
29
- .rui-input--lg {
30
- padding-block: calc(var(--space-control-y) * 1.25);
31
- }
4
+ .rui-input {
5
+ width: 100%;
6
+ border-style: var(--tw-border-style);
7
+ border-width: 1px;
8
+ border-color: var(--color-border, var(--border));
9
+ background-color: var(--color-background, var(--background));
10
+ color: var(--color-on-background, var(--on-background));
11
+ --tw-outline-style: none;
12
+ outline-style: none;
13
+ border-radius: var(--radius-control);
14
+ padding-inline: var(--space-control-x);
15
+ padding-block: var(--space-control-y);
16
+ font-size: var(--text-control, 0.875rem);
17
+ transition-duration: var(--duration-normal);
18
+ }
19
+ .rui-input:focus-visible {
20
+ --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
21
+ box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
22
+ --tw-ring-color: var(--color-focus-ring, var(--focus-ring));
23
+ }
24
+ .rui-input:disabled {
25
+ cursor: not-allowed;
26
+ opacity: var(--opacity-disabled, var(--opacity-disabled));
27
+ }
28
+ .rui-input[aria-invalid='true'] {
29
+ border-color: var(--color-error, var(--error));
30
+ }
31
+ .rui-input--sm {
32
+ padding-block: calc(var(--space-control-y) * 0.75);
33
+ }
34
+ .rui-input--lg {
35
+ padding-block: calc(var(--space-control-y) * 1.25);
36
+ }
37
+ }
38
+ @property --tw-border-style {
39
+ syntax: "*";
40
+ inherits: false;
41
+ initial-value: solid;
42
+ }
43
+ @property --tw-shadow {
44
+ syntax: "*";
45
+ inherits: false;
46
+ initial-value: 0 0 #0000;
47
+ }
48
+ @property --tw-shadow-color {
49
+ syntax: "*";
50
+ inherits: false;
51
+ }
52
+ @property --tw-shadow-alpha {
53
+ syntax: "<percentage>";
54
+ inherits: false;
55
+ initial-value: 100%;
56
+ }
57
+ @property --tw-inset-shadow {
58
+ syntax: "*";
59
+ inherits: false;
60
+ initial-value: 0 0 #0000;
61
+ }
62
+ @property --tw-inset-shadow-color {
63
+ syntax: "*";
64
+ inherits: false;
65
+ }
66
+ @property --tw-inset-shadow-alpha {
67
+ syntax: "<percentage>";
68
+ inherits: false;
69
+ initial-value: 100%;
70
+ }
71
+ @property --tw-ring-color {
72
+ syntax: "*";
73
+ inherits: false;
74
+ }
75
+ @property --tw-ring-shadow {
76
+ syntax: "*";
77
+ inherits: false;
78
+ initial-value: 0 0 #0000;
79
+ }
80
+ @property --tw-inset-ring-color {
81
+ syntax: "*";
82
+ inherits: false;
83
+ }
84
+ @property --tw-inset-ring-shadow {
85
+ syntax: "*";
86
+ inherits: false;
87
+ initial-value: 0 0 #0000;
88
+ }
89
+ @property --tw-ring-inset {
90
+ syntax: "*";
91
+ inherits: false;
92
+ }
93
+ @property --tw-ring-offset-width {
94
+ syntax: "<length>";
95
+ inherits: false;
96
+ initial-value: 0px;
97
+ }
98
+ @property --tw-ring-offset-color {
99
+ syntax: "*";
100
+ inherits: false;
101
+ initial-value: #fff;
102
+ }
103
+ @property --tw-ring-offset-shadow {
104
+ syntax: "*";
105
+ inherits: false;
106
+ initial-value: 0 0 #0000;
107
+ }
108
+ @layer properties {
109
+ @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
110
+ *, ::before, ::after, ::backdrop {
111
+ --tw-border-style: solid;
112
+ --tw-shadow: 0 0 #0000;
113
+ --tw-shadow-color: initial;
114
+ --tw-shadow-alpha: 100%;
115
+ --tw-inset-shadow: 0 0 #0000;
116
+ --tw-inset-shadow-color: initial;
117
+ --tw-inset-shadow-alpha: 100%;
118
+ --tw-ring-color: initial;
119
+ --tw-ring-shadow: 0 0 #0000;
120
+ --tw-inset-ring-color: initial;
121
+ --tw-inset-ring-shadow: 0 0 #0000;
122
+ --tw-ring-inset: initial;
123
+ --tw-ring-offset-width: 0px;
124
+ --tw-ring-offset-color: #fff;
125
+ --tw-ring-offset-shadow: 0 0 #0000;
126
+ }
127
+ }
32
128
  }
@@ -1,8 +1,22 @@
1
- @reference '../../../styles/radiant-ui.css';
2
-
1
+ /*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
2
+ @layer properties;
3
3
  @layer components {
4
- .rui-label {
5
- @apply block font-medium text-on-background;
6
- font-size: var(--text-control, 0.875rem);
7
- }
4
+ .rui-label {
5
+ display: block;
6
+ --tw-font-weight: var(--font-weight-medium, var(--weight-medium));
7
+ font-weight: var(--font-weight-medium, var(--weight-medium));
8
+ color: var(--color-on-background, var(--on-background));
9
+ font-size: var(--text-control, 0.875rem);
10
+ }
11
+ }
12
+ @property --tw-font-weight {
13
+ syntax: "*";
14
+ inherits: false;
15
+ }
16
+ @layer properties {
17
+ @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
18
+ *, ::before, ::after, ::backdrop {
19
+ --tw-font-weight: initial;
20
+ }
21
+ }
8
22
  }
@@ -1,23 +1,141 @@
1
- @reference '../../../styles/radiant-ui.css';
2
-
1
+ /*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
2
+ @layer properties;
3
3
  rui-listbox {
4
- @apply block;
4
+ display: block;
5
5
  }
6
-
7
6
  @layer components {
8
- .rui-listbox {
9
- @apply max-h-60 overflow-auto rounded-container border border-border bg-background p-1 rui-sheen;
10
- }
11
-
12
- .rui-listbox__option {
13
- @apply cursor-pointer rounded-control px-3 py-2 text-sm;
14
- }
15
-
16
- .rui-listbox__option[aria-selected='true'] {
17
- @apply bg-primary text-on-primary rui-sheen;
18
- }
19
-
20
- .rui-listbox__option:focus-visible {
21
- @apply outline-none ring-2 ring-focus-ring;
22
- }
7
+ .rui-listbox {
8
+ max-height: calc(var(--spacing, 0.25rem) * 60);
9
+ overflow: auto;
10
+ border-radius: var(--radius-container, var(--radius-container));
11
+ border-style: var(--tw-border-style);
12
+ border-width: 1px;
13
+ border-color: var(--color-border, var(--border));
14
+ background-color: var(--color-background, var(--background));
15
+ @media (forced-colors: active) {
16
+ background-image: none;
17
+ }
18
+ background-image: var(--sheen-image);
19
+ @media (forced-colors: active) {
20
+ background-image: none;
21
+ }
22
+ padding: var(--spacing-1, var(--space-1));
23
+ }
24
+ .rui-listbox__option {
25
+ cursor: pointer;
26
+ border-radius: var(--radius-control, var(--radius-control));
27
+ padding-inline: var(--spacing-3, var(--space-3));
28
+ padding-block: var(--spacing-2, var(--space-2));
29
+ font-size: var(--text-sm, var(--text-sm));
30
+ line-height: var(--tw-leading, var(--text-sm--line-height, calc(1.25 / 0.875)));
31
+ }
32
+ .rui-listbox__option[aria-selected='true'] {
33
+ background-color: var(--color-primary, var(--primary));
34
+ @media (forced-colors: active) {
35
+ background-image: none;
36
+ }
37
+ background-image: var(--sheen-image);
38
+ @media (forced-colors: active) {
39
+ background-image: none;
40
+ }
41
+ color: var(--color-on-primary, var(--on-primary));
42
+ }
43
+ .rui-listbox__option:focus-visible {
44
+ --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
45
+ box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
46
+ --tw-ring-color: var(--color-focus-ring, var(--focus-ring));
47
+ --tw-outline-style: none;
48
+ outline-style: none;
49
+ }
50
+ }
51
+ @property --tw-border-style {
52
+ syntax: "*";
53
+ inherits: false;
54
+ initial-value: solid;
55
+ }
56
+ @property --tw-shadow {
57
+ syntax: "*";
58
+ inherits: false;
59
+ initial-value: 0 0 #0000;
60
+ }
61
+ @property --tw-shadow-color {
62
+ syntax: "*";
63
+ inherits: false;
64
+ }
65
+ @property --tw-shadow-alpha {
66
+ syntax: "<percentage>";
67
+ inherits: false;
68
+ initial-value: 100%;
69
+ }
70
+ @property --tw-inset-shadow {
71
+ syntax: "*";
72
+ inherits: false;
73
+ initial-value: 0 0 #0000;
74
+ }
75
+ @property --tw-inset-shadow-color {
76
+ syntax: "*";
77
+ inherits: false;
78
+ }
79
+ @property --tw-inset-shadow-alpha {
80
+ syntax: "<percentage>";
81
+ inherits: false;
82
+ initial-value: 100%;
83
+ }
84
+ @property --tw-ring-color {
85
+ syntax: "*";
86
+ inherits: false;
87
+ }
88
+ @property --tw-ring-shadow {
89
+ syntax: "*";
90
+ inherits: false;
91
+ initial-value: 0 0 #0000;
92
+ }
93
+ @property --tw-inset-ring-color {
94
+ syntax: "*";
95
+ inherits: false;
96
+ }
97
+ @property --tw-inset-ring-shadow {
98
+ syntax: "*";
99
+ inherits: false;
100
+ initial-value: 0 0 #0000;
101
+ }
102
+ @property --tw-ring-inset {
103
+ syntax: "*";
104
+ inherits: false;
105
+ }
106
+ @property --tw-ring-offset-width {
107
+ syntax: "<length>";
108
+ inherits: false;
109
+ initial-value: 0px;
110
+ }
111
+ @property --tw-ring-offset-color {
112
+ syntax: "*";
113
+ inherits: false;
114
+ initial-value: #fff;
115
+ }
116
+ @property --tw-ring-offset-shadow {
117
+ syntax: "*";
118
+ inherits: false;
119
+ initial-value: 0 0 #0000;
120
+ }
121
+ @layer properties {
122
+ @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
123
+ *, ::before, ::after, ::backdrop {
124
+ --tw-border-style: solid;
125
+ --tw-shadow: 0 0 #0000;
126
+ --tw-shadow-color: initial;
127
+ --tw-shadow-alpha: 100%;
128
+ --tw-inset-shadow: 0 0 #0000;
129
+ --tw-inset-shadow-color: initial;
130
+ --tw-inset-shadow-alpha: 100%;
131
+ --tw-ring-color: initial;
132
+ --tw-ring-shadow: 0 0 #0000;
133
+ --tw-inset-ring-color: initial;
134
+ --tw-inset-ring-shadow: 0 0 #0000;
135
+ --tw-ring-inset: initial;
136
+ --tw-ring-offset-width: 0px;
137
+ --tw-ring-offset-color: #fff;
138
+ --tw-ring-offset-shadow: 0 0 #0000;
139
+ }
140
+ }
23
141
  }
@@ -1,2 +1,2 @@
1
- import{RadiantElement as f,bound as u,customElement as h,event as l,onEvent as o,onUpdated as b,prop as p,query as c}from"@ecopages/radiant";import{autoUpdate as T,computePosition as v,flip as R,offset as E,shift as y}from"@floating-ui/dom";var s=@h("rui-menu-button")class extends f{@p({type:Boolean,reflect:!0,defaultValue:!1})open;@p({type:String,defaultValue:"bottom-start"})placement;@c({ref:"trigger"})triggerTarget;@c({ref:"menu"})menuTarget;@l({name:"rui-change",bubbles:!0,composed:!0})changeEvent;@l({name:"rui-close",bubbles:!0,composed:!0})closeEvent;cleanup=null;menuId=`rui-menu-${Math.random().toString(36).slice(2,9)}`;connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this.syncOpenState())}disconnectedCallback(){this.teardownFloating(),super.disconnectedCallback()}getItems(){return Array.from(this.menuTarget?.querySelectorAll('[role="menuitem"]')??[]).filter(e=>e.getAttribute("aria-disabled")!=="true")}teardownFloating(){this.cleanup?.(),this.cleanup=null}@u updatePosition(){!this.triggerTarget||!this.menuTarget||!this.open||v(this.triggerTarget,this.menuTarget,{placement:this.placement,middleware:[E(6),R(),y({padding:8})]}).then(({x:e,y:t})=>{Object.assign(this.menuTarget.style,{left:`${e}px`,top:`${t}px`})})}pendingFocus=null;@u@b(["open","placement"])syncOpenState(){if(!this.triggerTarget||!this.menuTarget)return;this.menuTarget.id=this.menuId,this.triggerTarget.setAttribute("aria-controls",this.menuId),this.triggerTarget.setAttribute("aria-haspopup","menu"),this.triggerTarget.setAttribute("aria-expanded",String(this.open)),this.menuTarget.hidden=!this.open,this.open?(this.teardownFloating(),this.cleanup=T(this.triggerTarget,this.menuTarget,this.updatePosition),this.updatePosition()):this.teardownFloating();let e=this.pendingFocus;if(this.pendingFocus=null,!!e){if(e==="first"&&this.getItems()[0]?.focus(),e==="last"){let t=this.getItems();t[t.length-1]?.focus()}e==="trigger"&&this.triggerTarget?.focus()}}setOpen(e,t=null){let n=this.open;this.pendingFocus=t,this.open=e,n&&!e&&this.closeEvent.emit(),n===e&&this.syncOpenState()}@o({document:!0,type:"click"})onDocumentClick(e){if(!this.open)return;let t=e.target;this.triggerTarget?.contains(t)||this.menuTarget?.contains(t)||this.setOpen(!1)}@o({ref:"trigger",type:"click"})onTriggerClick(){this.setOpen(!this.open,this.open?null:"first")}@o({ref:"trigger",type:"keydown"})onTriggerKeydown(e){switch(e.key){case"ArrowDown":case"Enter":case" ":e.preventDefault(),this.setOpen(!0,"first");break;case"ArrowUp":e.preventDefault(),this.setOpen(!0,"last");break;default:break}}@o({ref:"menu",type:"keydown"})onMenuKeydown(e){let t=this.getItems(),n=document.activeElement,a=n?t.indexOf(n):-1;switch(e.key){case"ArrowDown":{e.preventDefault(),t[(a+1)%t.length]?.focus();break}case"ArrowUp":{e.preventDefault(),t[(a-1+t.length)%t.length]?.focus();break}case"Home":e.preventDefault(),t[0]?.focus();break;case"End":e.preventDefault(),t[t.length-1]?.focus();break;case"Escape":e.preventDefault(),this.setOpen(!1,"trigger");break;case"Tab":this.setOpen(!1);break;case"Enter":case" ":n&&t.includes(n)&&(e.preventDefault(),this.activateItem(n));break;default:break}}@o({selector:'[role="menuitem"]',type:"click"})onItemClick(e){let t=e.target.closest('[role="menuitem"]');!t||!this.contains(t)||this.activateItem(t)}activateItem(e){let t=e.getAttribute("data-value")||e.textContent?.trim()||"";this.changeEvent.emit({value:t}),this.setOpen(!1,"trigger")}render(){return React.createElement("div",{class:"rui-menu-button"},React.createElement("button",{type:"button","data-ref":"trigger",class:"rui-button rui-button--primary rui-button--md rui-menu-button__trigger","aria-haspopup":"menu","aria-expanded":"false"},React.createElement("slot",{name:"trigger"}),React.createElement("span",{class:"rui-menu-button__chevron","aria-hidden":"true"})),React.createElement("div",{"data-ref":"menu",class:"rui-menu-button__menu",role:"menu",hidden:!0},React.createElement("slot",null)))}};var A=Symbol.for("@ecopages/storybook-radiant.viewElement"),m=Symbol.for("@ecopages/storybook-radiant.scriptModule"),d=Symbol.for("@ecopages/storybook-radiant.scriptExport");function M(r,e){r[A]=e;let t=e[m];t&&(r[m]=t,r[d]=e[d]??e.name)}function g(r,e){let t=(n=>e(n));return M(t,r),t}import"./menu-button.css";var I=g(s,({slot:r,open:e,placement:t,trigger:n,items:a})=>React.createElement("rui-menu-button",{slot:r,open:e,placement:t},React.createElement("span",{slot:"trigger"},n),a.map(i=>React.createElement("button",{type:"button",class:"rui-menu-button__item",role:"menuitem","data-value":i.value,"aria-disabled":i.disabled?"true":void 0,tabindex:-1},i.label))));export{I as RuiMenuButton,s as RuiMenuButtonElement};
1
+ import{RadiantElement as O,bound as D,customElement as _,event as v,onEvent as l,onUpdated as L,prop as y,query as R}from"@ecopages/radiant";var A={top:"bottom",bottom:"top",left:"right",right:"left"},S=8;function F(e){let t=e.indexOf("-");if(t===-1)return{side:e,align:"center"};let n=e.slice(0,t),r=e.slice(t+1);return{side:n,align:r==="start"||r==="end"?r:"center"}}function h(e){return e==="top"||e==="bottom"?"y":"x"}function g(e,t,n,r,i){let{width:o,height:a}=t,s=0,u=0;switch(n){case"top":u=e.top-a-i;break;case"bottom":u=e.bottom+i;break;case"left":s=e.left-o-i;break;case"right":s=e.right+i;break}return h(n)==="y"?r==="start"?s=e.left:r==="end"?s=e.right-o:s=e.left+(e.width-o)/2:r==="start"?u=e.top:r==="end"?u=e.bottom-a:u=e.top+(e.height-a)/2,{x:s,y:u}}function C(e,t,n,r){let{padding:i,width:o,height:a}=r;return n==="top"?Math.max(0,i-e.y):n==="bottom"?Math.max(0,e.y+t.height-(a-i)):n==="left"?Math.max(0,i-e.x):Math.max(0,e.x+t.width-(o-i))}function f(e,t,n,r){let{padding:i,width:o,height:a}=r;return n==="top"?e.top-i-t.height:n==="bottom"?a-i-t.height-e.bottom:n==="left"?e.left-i-t.width:o-i-t.width-e.right}function I(e,t,n,r){let{padding:i,width:o,height:a}=r;if(h(n)==="y"){let u=Math.max(i,o-i-t.width);return{x:Math.min(Math.max(e.x,i),u),y:e.y}}let s=Math.max(i,a-i-t.height);return{x:e.x,y:Math.min(Math.max(e.y,i),s)}}function P(e,t,n,r,i={width:typeof window>"u"?0:window.innerWidth,height:typeof window>"u"?0:window.innerHeight,padding:S}){let{side:o,align:a}=F(n),s=g(e,t,o,a,r),u=C(s,t,o,i),m=o,c=s;if(u>0){let d=A[o],x=g(e,t,d,a,r),M=f(e,t,o,i);f(e,t,d,i)>M&&(m=d,c=x)}return I(c,t,m,i)}function k(e,t,n,r){let i=P(e.getBoundingClientRect(),{width:t.offsetWidth,height:t.offsetHeight},n,r);Object.assign(t.style,{position:"fixed",left:`${i.x}px`,top:`${i.y}px`,right:"auto",bottom:"auto",visibility:"visible"})}function b({anchor:e,floating:t,getPlacement:n,gap:r}){let i=()=>{t.hidden||k(e,t,n(),r)};i(),window.addEventListener("resize",i),window.addEventListener("scroll",i,!0);let o=new ResizeObserver(i);return o.observe(e),o.observe(t),()=>{window.removeEventListener("resize",i),window.removeEventListener("scroll",i,!0),o.disconnect()}}var V=6,p=@_("rui-menu-button")class extends O{@y({type:Boolean,reflect:!0,defaultValue:!1})open;@y({type:String,defaultValue:"bottom-start"})placement;@R({ref:"trigger"})triggerTarget;@R({ref:"menu"})menuTarget;@v({name:"rui-change",bubbles:!0,composed:!0})changeEvent;@v({name:"rui-close",bubbles:!0,composed:!0})closeEvent;menuId=`rui-menu-${Math.random().toString(36).slice(2,9)}`;cleanupFloating=null;pendingFocus=null;connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this.syncOpenState())}disconnectedCallback(){this.teardownFloating(),super.disconnectedCallback()}getItems(){return Array.from(this.menuTarget?.querySelectorAll('[role="menuitem"]')??[]).filter(t=>t.getAttribute("aria-disabled")!=="true")}teardownFloating(){this.cleanupFloating?.(),this.cleanupFloating=null}attachFloating(){!this.triggerTarget||!this.menuTarget||(this.teardownFloating(),this.cleanupFloating=b({anchor:this.triggerTarget,floating:this.menuTarget,getPlacement:()=>this.placement,gap:V}))}@D@L(["open","placement"])syncOpenState(){if(!this.triggerTarget||!this.menuTarget)return;this.menuTarget.id=this.menuId,this.triggerTarget.setAttribute("aria-controls",this.menuId),this.triggerTarget.setAttribute("aria-haspopup","menu"),this.triggerTarget.setAttribute("aria-expanded",String(this.open)),this.menuTarget.hidden=!this.open,this.open?this.attachFloating():this.teardownFloating();let t=this.pendingFocus;if(this.pendingFocus=null,!!t){if(t==="first"&&this.getItems()[0]?.focus(),t==="last"){let n=this.getItems();n[n.length-1]?.focus()}t==="trigger"&&this.triggerTarget?.focus()}}setOpen(t,n=null){let r=this.open;this.pendingFocus=n,this.open=t,r&&!t&&this.closeEvent.emit(),r===t&&this.syncOpenState()}@l({document:!0,type:"click"})onDocumentClick(t){if(!this.open)return;let n=t.target;this.triggerTarget?.contains(n)||this.menuTarget?.contains(n)||this.setOpen(!1)}@l({ref:"trigger",type:"click"})onTriggerClick(){this.setOpen(!this.open,this.open?null:"first")}@l({ref:"trigger",type:"keydown"})onTriggerKeydown(t){switch(t.key){case"ArrowDown":case"Enter":case" ":t.preventDefault(),this.setOpen(!0,"first");break;case"ArrowUp":t.preventDefault(),this.setOpen(!0,"last");break;default:break}}@l({ref:"menu",type:"keydown"})onMenuKeydown(t){let n=this.getItems(),r=document.activeElement,i=r?n.indexOf(r):-1;switch(t.key){case"ArrowDown":{t.preventDefault(),n[(i+1)%n.length]?.focus();break}case"ArrowUp":{t.preventDefault(),n[(i-1+n.length)%n.length]?.focus();break}case"Home":t.preventDefault(),n[0]?.focus();break;case"End":t.preventDefault(),n[n.length-1]?.focus();break;case"Escape":t.preventDefault(),this.setOpen(!1,"trigger");break;case"Tab":this.setOpen(!1);break;case"Enter":case" ":r&&n.includes(r)&&(t.preventDefault(),this.activateItem(r));break;default:break}}@l({selector:'[role="menuitem"]',type:"click"})onItemClick(t){let n=t.target.closest('[role="menuitem"]');!n||!this.contains(n)||this.activateItem(n)}activateItem(t){let n=t.getAttribute("data-value")||t.textContent?.trim()||"";this.changeEvent.emit({value:n}),this.setOpen(!1,"trigger")}render(){return React.createElement("div",{class:"rui-menu-button"},React.createElement("button",{type:"button","data-ref":"trigger",class:"rui-button rui-button--primary rui-button--md rui-menu-button__trigger","aria-haspopup":"menu","aria-expanded":"false"},React.createElement("slot",{name:"trigger"}),React.createElement("span",{class:"rui-menu-button__chevron","aria-hidden":"true"})),React.createElement("div",{"data-ref":"menu",class:"rui-menu-button__menu rui-floating",role:"menu",hidden:!0},React.createElement("slot",null)))}};var B=Symbol.for("@ecopages/storybook-radiant.viewElement"),T=Symbol.for("@ecopages/storybook-radiant.scriptModule"),E=Symbol.for("@ecopages/storybook-radiant.scriptExport");function H(e,t){e[B]=t;let n=t[T];n&&(e[T]=n,e[E]=t[E]??t.name)}function w(e,t){let n=(r=>t(r));return H(n,e),n}import"./menu-button.css";var N=w(p,({slot:e,open:t,placement:n,trigger:r,items:i})=>React.createElement("rui-menu-button",{slot:e,open:t,placement:n},React.createElement("span",{slot:"trigger"},r),i.map(o=>React.createElement("button",{type:"button",class:"rui-menu-button__item",role:"menuitem","data-value":o.value,"aria-disabled":o.disabled?"true":void 0,tabindex:-1},o.label))));export{N as RuiMenuButton,p as RuiMenuButtonElement};
2
2
  //# sourceMappingURL=index.js.map