@remix-run/ui 0.1.2 → 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.
- package/README.md +9 -7
- package/dist/animation/spring.d.ts +6 -35
- package/dist/animation/spring.js +9 -8
- package/dist/animation/spring.js.map +1 -1
- package/dist/components/accordion/accordion.d.ts +6 -6
- package/dist/components/accordion/accordion.js.map +1 -1
- package/dist/components/breadcrumbs/breadcrumbs.d.ts +1 -1
- package/dist/components/button/button.d.ts +4 -4
- package/dist/components/button/button.js +3 -1
- package/dist/components/button/button.js.map +1 -1
- package/dist/components/combobox/combobox.d.ts +10 -10
- package/dist/components/combobox/combobox.js.map +1 -1
- package/dist/components/listbox/listbox.d.ts +3 -3
- package/dist/components/listbox/listbox.js.map +1 -1
- package/dist/components/menu/menu.d.ts +12 -12
- package/dist/components/menu/menu.js.map +1 -1
- package/dist/components/popover/popover.d.ts +5 -5
- package/dist/components/popover/popover.js.map +1 -1
- package/dist/components/select/select.d.ts +10 -10
- package/dist/components/select/select.js.map +1 -1
- package/dist/components/tabs/tabs.d.ts +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/interactions/keydown/keydown.d.ts +1 -1
- package/dist/interactions/outside-click/outside-click-mixin.d.ts +2 -1
- package/dist/interactions/typeahead/typeahead-mixin.d.ts +3 -1
- package/dist/runtime/component.d.ts +18 -15
- package/dist/runtime/component.js +14 -5
- package/dist/runtime/component.js.map +1 -1
- package/dist/runtime/core/attributes.d.ts +3 -1
- package/dist/runtime/core/attributes.js +19 -1
- package/dist/runtime/core/attributes.js.map +1 -1
- package/dist/runtime/core/props.js +6 -5
- package/dist/runtime/core/props.js.map +1 -1
- package/dist/runtime/dom.d.ts +16 -9
- package/dist/runtime/jsx.d.ts +1 -1
- package/dist/runtime/mixins/link-mixin.d.ts +5 -1
- package/dist/runtime/mixins/link-mixin.js.map +1 -1
- package/dist/runtime/mixins/mixin.d.ts +2 -1
- package/dist/runtime/mixins/mixin.js.map +1 -1
- package/dist/runtime/mixins/ref-mixin.d.ts +2 -1
- package/dist/runtime/mixins/ref-mixin.js.map +1 -1
- package/dist/runtime/reconcile.d.ts +1 -1
- package/dist/runtime/reconcile.js +19 -5
- package/dist/runtime/reconcile.js.map +1 -1
- package/dist/runtime/scheduler.d.ts +10 -10
- package/dist/runtime/scheduler.js +1 -1
- package/dist/runtime/scheduler.js.map +1 -1
- package/dist/runtime/svg-attributes.js +1 -0
- package/dist/runtime/svg-attributes.js.map +1 -1
- package/dist/runtime/to-vnode.js +2 -2
- package/dist/runtime/to-vnode.js.map +1 -1
- package/dist/runtime/vnode.d.ts +6 -1
- package/dist/runtime/vnode.js +4 -0
- package/dist/runtime/vnode.js.map +1 -1
- package/dist/server/stream.d.ts +2 -0
- package/dist/server/stream.js +79 -9
- package/dist/server/stream.js.map +1 -1
- package/dist/style/css-mixin.d.ts +2 -1
- package/dist/style/css-mixin.js.map +1 -1
- package/dist/style/index.d.ts +1 -1
- package/dist/style/stylesheet.d.ts +13 -13
- package/dist/style/stylesheet.js.map +1 -1
- package/dist/theme/contract.d.ts +24 -222
- package/dist/theme/contract.js +2 -2
- package/dist/theme/contract.js.map +1 -1
- package/dist/theme/glyph-contract.d.ts +1 -3
- package/dist/theme/glyph-contract.js.map +1 -1
- package/dist/theme/presets/rmx-01/index.d.ts +4 -2
- package/dist/theme/presets/rmx-01/index.js.map +1 -1
- package/dist/utils/scroll-lock.d.ts +3 -3
- package/dist/utils/scroll-lock.js.map +1 -1
- package/package.json +3 -3
- package/src/animation/README.md +7 -5
- package/src/animation/spring.ts +21 -9
- package/src/components/accordion/accordion.tsx +7 -5
- package/src/components/anchor/anchor.ts +1 -1
- package/src/components/breadcrumbs/breadcrumbs.tsx +1 -1
- package/src/components/button/button.tsx +30 -18
- package/src/components/combobox/README.md +1 -1
- package/src/components/combobox/combobox.tsx +30 -12
- package/src/components/glyph/glyph.tsx +2 -2
- package/src/components/listbox/listbox.ts +88 -83
- package/src/components/menu/menu.tsx +27 -15
- package/src/components/popover/popover.ts +90 -79
- package/src/components/select/select.tsx +26 -9
- package/src/index.ts +1 -0
- package/src/runtime/component.ts +34 -12
- package/src/runtime/core/attributes.ts +21 -0
- package/src/runtime/core/props.ts +6 -4
- package/src/runtime/dom.ts +16 -9
- package/src/runtime/jsx.ts +1 -1
- package/src/runtime/mixins/link-mixin.ts +88 -86
- package/src/runtime/mixins/mixin.ts +9 -1
- package/src/runtime/mixins/ref-mixin.ts +4 -5
- package/src/runtime/reconcile.ts +23 -14
- package/src/runtime/scheduler.ts +20 -20
- package/src/runtime/svg-attributes.ts +1 -0
- package/src/runtime/to-vnode.ts +2 -2
- package/src/runtime/vnode.ts +10 -0
- package/src/server/README.md +4 -2
- package/src/server/stream.ts +77 -8
- package/src/style/css-mixin.ts +6 -1
- package/src/style/index.ts +1 -2
- package/src/style/stylesheet.ts +14 -2
- package/src/theme/contract.ts +37 -5
- package/src/theme/glyph-contract.ts +3 -1
- package/src/theme/presets/rmx-01/index.ts +4 -2
- package/src/utils/scroll-lock.ts +7 -3
package/dist/theme/contract.d.ts
CHANGED
|
@@ -2,124 +2,39 @@ import type { css, Handle, MixinDescriptor, RemixElement } from '@remix-run/ui';
|
|
|
2
2
|
export interface ThemeVariableTree {
|
|
3
3
|
[key: string]: string | ThemeVariableTree;
|
|
4
4
|
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
readonly radius: {
|
|
17
|
-
readonly none: "--rmx-radius-none";
|
|
18
|
-
readonly sm: "--rmx-radius-sm";
|
|
19
|
-
readonly md: "--rmx-radius-md";
|
|
20
|
-
readonly lg: "--rmx-radius-lg";
|
|
21
|
-
readonly xl: "--rmx-radius-xl";
|
|
22
|
-
readonly full: "--rmx-radius-full";
|
|
23
|
-
};
|
|
24
|
-
readonly fontFamily: {
|
|
25
|
-
readonly sans: "--rmx-font-family-sans";
|
|
26
|
-
readonly mono: "--rmx-font-family-mono";
|
|
27
|
-
};
|
|
28
|
-
readonly fontSize: {
|
|
29
|
-
readonly xxxs: "--rmx-font-size-xxxs";
|
|
30
|
-
readonly xxs: "--rmx-font-size-xxs";
|
|
31
|
-
readonly xs: "--rmx-font-size-xs";
|
|
32
|
-
readonly sm: "--rmx-font-size-sm";
|
|
33
|
-
readonly md: "--rmx-font-size-md";
|
|
34
|
-
readonly lg: "--rmx-font-size-lg";
|
|
35
|
-
readonly xl: "--rmx-font-size-xl";
|
|
36
|
-
readonly xxl: "--rmx-font-size-xxl";
|
|
37
|
-
};
|
|
38
|
-
readonly lineHeight: {
|
|
39
|
-
readonly tight: "--rmx-line-height-tight";
|
|
40
|
-
readonly normal: "--rmx-line-height-normal";
|
|
41
|
-
readonly relaxed: "--rmx-line-height-relaxed";
|
|
42
|
-
};
|
|
43
|
-
readonly letterSpacing: {
|
|
44
|
-
readonly tight: "--rmx-letter-spacing-tight";
|
|
45
|
-
readonly normal: "--rmx-letter-spacing-normal";
|
|
46
|
-
readonly meta: "--rmx-letter-spacing-meta";
|
|
47
|
-
readonly wide: "--rmx-letter-spacing-wide";
|
|
48
|
-
};
|
|
49
|
-
readonly fontWeight: {
|
|
50
|
-
readonly normal: "--rmx-font-weight-normal";
|
|
51
|
-
readonly medium: "--rmx-font-weight-medium";
|
|
52
|
-
readonly semibold: "--rmx-font-weight-semibold";
|
|
53
|
-
readonly bold: "--rmx-font-weight-bold";
|
|
54
|
-
};
|
|
5
|
+
type ThemeVariableGroup<key extends string> = Readonly<Record<key, string>>;
|
|
6
|
+
type ThemeActionVariableGroup = ThemeVariableGroup<'background' | 'backgroundHover' | 'backgroundActive' | 'foreground' | 'border'>;
|
|
7
|
+
type ThemeVariableNames = {
|
|
8
|
+
readonly space: ThemeVariableGroup<'none' | 'px' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl'>;
|
|
9
|
+
readonly radius: ThemeVariableGroup<'none' | 'sm' | 'md' | 'lg' | 'xl' | 'full'>;
|
|
10
|
+
readonly fontFamily: ThemeVariableGroup<'sans' | 'mono'>;
|
|
11
|
+
readonly fontSize: ThemeVariableGroup<'xxxs' | 'xxs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl'>;
|
|
12
|
+
readonly lineHeight: ThemeVariableGroup<'tight' | 'normal' | 'relaxed'>;
|
|
13
|
+
readonly letterSpacing: ThemeVariableGroup<'tight' | 'normal' | 'meta' | 'wide'>;
|
|
14
|
+
readonly fontWeight: ThemeVariableGroup<'normal' | 'medium' | 'semibold' | 'bold'>;
|
|
55
15
|
readonly control: {
|
|
56
|
-
readonly height:
|
|
57
|
-
readonly sm: "--rmx-control-height-sm";
|
|
58
|
-
readonly md: "--rmx-control-height-md";
|
|
59
|
-
readonly lg: "--rmx-control-height-lg";
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
readonly surface: {
|
|
63
|
-
readonly lvl0: "--rmx-surface-lvl0";
|
|
64
|
-
readonly lvl1: "--rmx-surface-lvl1";
|
|
65
|
-
readonly lvl2: "--rmx-surface-lvl2";
|
|
66
|
-
readonly lvl3: "--rmx-surface-lvl3";
|
|
67
|
-
readonly lvl4: "--rmx-surface-lvl4";
|
|
68
|
-
};
|
|
69
|
-
readonly shadow: {
|
|
70
|
-
readonly xs: "--rmx-shadow-xs";
|
|
71
|
-
readonly sm: "--rmx-shadow-sm";
|
|
72
|
-
readonly md: "--rmx-shadow-md";
|
|
73
|
-
readonly lg: "--rmx-shadow-lg";
|
|
74
|
-
readonly xl: "--rmx-shadow-xl";
|
|
16
|
+
readonly height: ThemeVariableGroup<'sm' | 'md' | 'lg'>;
|
|
75
17
|
};
|
|
18
|
+
readonly surface: ThemeVariableGroup<'lvl0' | 'lvl1' | 'lvl2' | 'lvl3' | 'lvl4'>;
|
|
19
|
+
readonly shadow: ThemeVariableGroup<'xs' | 'sm' | 'md' | 'lg' | 'xl'>;
|
|
76
20
|
readonly colors: {
|
|
77
|
-
readonly text:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
readonly link: "--rmx-color-text-link";
|
|
82
|
-
};
|
|
83
|
-
readonly border: {
|
|
84
|
-
readonly subtle: "--rmx-color-border-subtle";
|
|
85
|
-
readonly default: "--rmx-color-border-default";
|
|
86
|
-
readonly strong: "--rmx-color-border-strong";
|
|
87
|
-
};
|
|
88
|
-
readonly focus: {
|
|
89
|
-
readonly ring: "--rmx-color-focus-ring";
|
|
90
|
-
};
|
|
91
|
-
readonly overlay: {
|
|
92
|
-
readonly scrim: "--rmx-color-overlay-scrim";
|
|
93
|
-
};
|
|
21
|
+
readonly text: ThemeVariableGroup<'primary' | 'secondary' | 'muted' | 'link'>;
|
|
22
|
+
readonly border: ThemeVariableGroup<'subtle' | 'default' | 'strong'>;
|
|
23
|
+
readonly focus: ThemeVariableGroup<'ring'>;
|
|
24
|
+
readonly overlay: ThemeVariableGroup<'scrim'>;
|
|
94
25
|
readonly action: {
|
|
95
|
-
readonly primary:
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
readonly backgroundActive: "--rmx-color-action-primary-background-active";
|
|
99
|
-
readonly foreground: "--rmx-color-action-primary-foreground";
|
|
100
|
-
readonly border: "--rmx-color-action-primary-border";
|
|
101
|
-
};
|
|
102
|
-
readonly secondary: {
|
|
103
|
-
readonly background: "--rmx-color-action-secondary-background";
|
|
104
|
-
readonly backgroundHover: "--rmx-color-action-secondary-background-hover";
|
|
105
|
-
readonly backgroundActive: "--rmx-color-action-secondary-background-active";
|
|
106
|
-
readonly foreground: "--rmx-color-action-secondary-foreground";
|
|
107
|
-
readonly border: "--rmx-color-action-secondary-border";
|
|
108
|
-
};
|
|
109
|
-
readonly danger: {
|
|
110
|
-
readonly background: "--rmx-color-action-danger-background";
|
|
111
|
-
readonly backgroundHover: "--rmx-color-action-danger-background-hover";
|
|
112
|
-
readonly backgroundActive: "--rmx-color-action-danger-background-active";
|
|
113
|
-
readonly foreground: "--rmx-color-action-danger-foreground";
|
|
114
|
-
readonly border: "--rmx-color-action-danger-border";
|
|
115
|
-
};
|
|
26
|
+
readonly primary: ThemeActionVariableGroup;
|
|
27
|
+
readonly secondary: ThemeActionVariableGroup;
|
|
28
|
+
readonly danger: ThemeActionVariableGroup;
|
|
116
29
|
};
|
|
117
30
|
};
|
|
118
31
|
};
|
|
32
|
+
export declare const themeVariableNames: ThemeVariableNames;
|
|
119
33
|
type MapLeaves<source, leaf> = source extends string ? leaf : {
|
|
120
34
|
[key in keyof source]: MapLeaves<source[key], leaf>;
|
|
121
35
|
};
|
|
122
36
|
export type ThemeValue = string | number;
|
|
37
|
+
export type ThemeContract = MapLeaves<ThemeVariableNames, string>;
|
|
123
38
|
export type ThemeValues = MapLeaves<typeof themeVariableNames, ThemeValue>;
|
|
124
39
|
export type ThemeVars = Readonly<Record<string, string>>;
|
|
125
40
|
export type CreateThemeOptions = {
|
|
@@ -137,123 +52,10 @@ export type ThemeComponent = ThemeRenderer & {
|
|
|
137
52
|
values: ThemeValues;
|
|
138
53
|
vars: ThemeVars;
|
|
139
54
|
};
|
|
140
|
-
export declare const theme:
|
|
141
|
-
readonly space: {
|
|
142
|
-
readonly none: string;
|
|
143
|
-
readonly px: string;
|
|
144
|
-
readonly xs: string;
|
|
145
|
-
readonly sm: string;
|
|
146
|
-
readonly md: string;
|
|
147
|
-
readonly lg: string;
|
|
148
|
-
readonly xl: string;
|
|
149
|
-
readonly xxl: string;
|
|
150
|
-
};
|
|
151
|
-
readonly radius: {
|
|
152
|
-
readonly none: string;
|
|
153
|
-
readonly sm: string;
|
|
154
|
-
readonly md: string;
|
|
155
|
-
readonly lg: string;
|
|
156
|
-
readonly xl: string;
|
|
157
|
-
readonly full: string;
|
|
158
|
-
};
|
|
159
|
-
readonly fontFamily: {
|
|
160
|
-
readonly sans: string;
|
|
161
|
-
readonly mono: string;
|
|
162
|
-
};
|
|
163
|
-
readonly fontSize: {
|
|
164
|
-
readonly xxxs: string;
|
|
165
|
-
readonly xxs: string;
|
|
166
|
-
readonly xs: string;
|
|
167
|
-
readonly sm: string;
|
|
168
|
-
readonly md: string;
|
|
169
|
-
readonly lg: string;
|
|
170
|
-
readonly xl: string;
|
|
171
|
-
readonly xxl: string;
|
|
172
|
-
};
|
|
173
|
-
readonly lineHeight: {
|
|
174
|
-
readonly tight: string;
|
|
175
|
-
readonly normal: string;
|
|
176
|
-
readonly relaxed: string;
|
|
177
|
-
};
|
|
178
|
-
readonly letterSpacing: {
|
|
179
|
-
readonly tight: string;
|
|
180
|
-
readonly normal: string;
|
|
181
|
-
readonly meta: string;
|
|
182
|
-
readonly wide: string;
|
|
183
|
-
};
|
|
184
|
-
readonly fontWeight: {
|
|
185
|
-
readonly normal: string;
|
|
186
|
-
readonly medium: string;
|
|
187
|
-
readonly semibold: string;
|
|
188
|
-
readonly bold: string;
|
|
189
|
-
};
|
|
190
|
-
readonly control: {
|
|
191
|
-
readonly height: {
|
|
192
|
-
readonly sm: string;
|
|
193
|
-
readonly md: string;
|
|
194
|
-
readonly lg: string;
|
|
195
|
-
};
|
|
196
|
-
};
|
|
197
|
-
readonly surface: {
|
|
198
|
-
readonly lvl0: string;
|
|
199
|
-
readonly lvl1: string;
|
|
200
|
-
readonly lvl2: string;
|
|
201
|
-
readonly lvl3: string;
|
|
202
|
-
readonly lvl4: string;
|
|
203
|
-
};
|
|
204
|
-
readonly shadow: {
|
|
205
|
-
readonly xs: string;
|
|
206
|
-
readonly sm: string;
|
|
207
|
-
readonly md: string;
|
|
208
|
-
readonly lg: string;
|
|
209
|
-
readonly xl: string;
|
|
210
|
-
};
|
|
211
|
-
readonly colors: {
|
|
212
|
-
readonly text: {
|
|
213
|
-
readonly primary: string;
|
|
214
|
-
readonly secondary: string;
|
|
215
|
-
readonly muted: string;
|
|
216
|
-
readonly link: string;
|
|
217
|
-
};
|
|
218
|
-
readonly border: {
|
|
219
|
-
readonly subtle: string;
|
|
220
|
-
readonly default: string;
|
|
221
|
-
readonly strong: string;
|
|
222
|
-
};
|
|
223
|
-
readonly focus: {
|
|
224
|
-
readonly ring: string;
|
|
225
|
-
};
|
|
226
|
-
readonly overlay: {
|
|
227
|
-
readonly scrim: string;
|
|
228
|
-
};
|
|
229
|
-
readonly action: {
|
|
230
|
-
readonly primary: {
|
|
231
|
-
readonly background: string;
|
|
232
|
-
readonly backgroundHover: string;
|
|
233
|
-
readonly backgroundActive: string;
|
|
234
|
-
readonly foreground: string;
|
|
235
|
-
readonly border: string;
|
|
236
|
-
};
|
|
237
|
-
readonly secondary: {
|
|
238
|
-
readonly background: string;
|
|
239
|
-
readonly backgroundHover: string;
|
|
240
|
-
readonly backgroundActive: string;
|
|
241
|
-
readonly foreground: string;
|
|
242
|
-
readonly border: string;
|
|
243
|
-
};
|
|
244
|
-
readonly danger: {
|
|
245
|
-
readonly background: string;
|
|
246
|
-
readonly backgroundHover: string;
|
|
247
|
-
readonly backgroundActive: string;
|
|
248
|
-
readonly foreground: string;
|
|
249
|
-
readonly border: string;
|
|
250
|
-
};
|
|
251
|
-
};
|
|
252
|
-
};
|
|
253
|
-
};
|
|
55
|
+
export declare const theme: ThemeContract;
|
|
254
56
|
export type ThemeUtility = ReturnType<typeof css>;
|
|
255
57
|
type ThemeMixLeaf = MixinDescriptor<any, any, any>;
|
|
256
58
|
type PreviousThemeMixDepth = [0, 0, 1, 2, 3, 4];
|
|
257
59
|
type NestedThemeMix<value, depth extends number = 4> = depth extends 0 ? value | ReadonlyArray<value> : value | ReadonlyArray<NestedThemeMix<value, PreviousThemeMixDepth[depth]>>;
|
|
258
60
|
export type ThemeMix = NestedThemeMix<ThemeMixLeaf>;
|
|
259
|
-
export {
|
|
61
|
+
export {};
|
package/dist/theme/contract.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const themeVariableNamesSource = {
|
|
2
2
|
space: {
|
|
3
3
|
none: '--rmx-space-none',
|
|
4
4
|
px: '--rmx-space-px',
|
|
@@ -112,8 +112,8 @@ const themeVariableNames = {
|
|
|
112
112
|
},
|
|
113
113
|
},
|
|
114
114
|
};
|
|
115
|
+
export const themeVariableNames = themeVariableNamesSource;
|
|
115
116
|
export const theme = createThemeContract(themeVariableNames);
|
|
116
|
-
export { themeVariableNames };
|
|
117
117
|
function createThemeContract(tree) {
|
|
118
118
|
return mapTreeLeaves(tree, (variableName) => `var(${variableName})`);
|
|
119
119
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../src/theme/contract.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../src/theme/contract.ts"],"names":[],"mappings":"AAqCA,MAAM,wBAAwB,GAAuB;IACnD,KAAK,EAAE;QACL,IAAI,EAAE,kBAAkB;QACxB,EAAE,EAAE,gBAAgB;QACpB,EAAE,EAAE,gBAAgB;QACpB,EAAE,EAAE,gBAAgB;QACpB,EAAE,EAAE,gBAAgB;QACpB,EAAE,EAAE,gBAAgB;QACpB,EAAE,EAAE,gBAAgB;QACpB,GAAG,EAAE,iBAAiB;KACvB;IACD,MAAM,EAAE;QACN,IAAI,EAAE,mBAAmB;QACzB,EAAE,EAAE,iBAAiB;QACrB,EAAE,EAAE,iBAAiB;QACrB,EAAE,EAAE,iBAAiB;QACrB,EAAE,EAAE,iBAAiB;QACrB,IAAI,EAAE,mBAAmB;KAC1B;IACD,UAAU,EAAE;QACV,IAAI,EAAE,wBAAwB;QAC9B,IAAI,EAAE,wBAAwB;KAC/B;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,sBAAsB;QAC5B,GAAG,EAAE,qBAAqB;QAC1B,EAAE,EAAE,oBAAoB;QACxB,EAAE,EAAE,oBAAoB;QACxB,EAAE,EAAE,oBAAoB;QACxB,EAAE,EAAE,oBAAoB;QACxB,EAAE,EAAE,oBAAoB;QACxB,GAAG,EAAE,qBAAqB;KAC3B;IACD,UA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only<Record<GlyphName, {
|
|
9
9
|
id: string;
|
|
10
10
|
}>>;
|
|
11
|
-
export declare const glyphContract:
|
|
12
|
-
id: string;
|
|
13
|
-
}>>>;
|
|
11
|
+
export declare const glyphContract: GlyphContract;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glyph-contract.js","sourceRoot":"","sources":["../../src/theme/glyph-contract.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,KAAK;IACL,OAAO;IACP,OAAO;IACP,aAAa;IACb,iBAAiB;IACjB,WAAW;IACX,cAAc;IACd,OAAO;IACP,MAAM;IACN,MAAM;IACN,QAAQ;IACR,MAAM;IACN,MAAM;IACN,MAAM;IACN,QAAQ;IACR,SAAS;IACT,OAAO;CACC,CAAA;AAYV,MAAM,uBAAuB,GAAG,WAAW,CAAA;AAE3C,MAAM,CAAC,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"glyph-contract.js","sourceRoot":"","sources":["../../src/theme/glyph-contract.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,KAAK;IACL,OAAO;IACP,OAAO;IACP,aAAa;IACb,iBAAiB;IACjB,WAAW;IACX,cAAc;IACd,OAAO;IACP,MAAM;IACN,MAAM;IACN,QAAQ;IACR,MAAM;IACN,MAAM;IACN,MAAM;IACN,QAAQ;IACR,SAAS;IACT,OAAO;CACC,CAAA;AAYV,MAAM,uBAAuB,GAAG,WAAW,CAAA;AAE3C,MAAM,CAAC,MAAM,aAAa,GAAkB,MAAM,CAAC,MAAM,CACvD,mBAAmB,CAAC,uBAAuB,CAAC,CAC7C,CAAA;AAED,SAAS,cAAc,CAAC,QAAgB;IACtC,OAAO,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,GAAG,QAAQ,IAAI,IAAI,EAAE,CAAC,CAAC,CAGhF,CAAA;AACH,CAAC;AAED,SAAS,mBAAmB,CAAC,QAAgB;IAC3C,IAAI,GAAG,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAA;IAElC,OAAO,MAAM,CAAC,MAAM,CAClB,MAAM,CAAC,WAAW,CAChB,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;QACvB,IAAI;QACJ;YACE,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC;SACd;KACF,CAAC,CACc,CACnB,CAAA;AACH,CAAC"}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { GlyphSheetComponent } from '../../../components/glyph/glyph.tsx';
|
|
2
|
+
import type { ThemeComponent } from '../../contract.ts';
|
|
3
|
+
export declare const RMX_01: ThemeComponent;
|
|
4
|
+
export declare const RMX_01_GLYPHS: GlyphSheetComponent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/theme/presets/rmx-01/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAqC,CAAA;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/theme/presets/rmx-01/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAqC,CAAA;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAI9C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAc,CAAA;AAE1C,MAAM,CAAC,MAAM,MAAM,GAAmB,WAAW,CAAC;IAChD,KAAK,EAAE;QACL,IAAI,EAAE,KAAK;QACX,EAAE,EAAE,KAAK;QACT,EAAE,EAAE,KAAK;QACT,EAAE,EAAE,KAAK;QACT,EAAE,EAAE,MAAM;QACV,EAAE,EAAE,MAAM;QACV,EAAE,EAAE,MAAM;QACV,GAAG,EA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EAAE,SAAS;YAClB,SAAS,EAAE,SAAS;YACpB,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,SAAS;SAChB;QACD,MAAM,EAAE;YACN,MAAM,EAAE,SAAS;YACjB,OAAO,EAAE,SAAS;YAClB,MAAM,EAAE,SAAS;SAClB;QACD,KAAK,EAAE;YACL,IAAI,EAAE,SAAS;SAChB;QACD,OAAO,EAAE;YACP,KAAK,EAAE,mBAAmB;SAC3B;QACD,MAAM,EAAE;YACN,OAAO,EAAE;gBACP,UAAU,EAAE,SAAS;gBACrB,eAAe,EAAE,SAAS;gBAC1B,gBAAgB,EAAE,SAAS;gBAC3B,UAAU,EAAE,yBAAyB;gBACrC,MAAM,EAAE,SAAS;aAClB;YACD,SAAS,EAAE;gBACT,UAAU,EAAE,SAAS;gBACrB,eAAe,EAAE,SAAS;gBAC1B,gBAAgB,EAAE,SAAS;gBAC3B,UAAU,EAAE,SAAS;gBACrB,MAAM,EAAE,SAAS;aAClB;YACD,MAAM,EAAE;gBACN,UAAU,EAAE,SAAS;gBACrB,eAAe,EAAE,SAAS;gBAC1B,gBAAgB,EAAE,SAAS;gBAC3B,UAAU,EAAE,yBAAyB;gBACrC,MAAM,EAAE,SAAS;aAClB;SACF;KACF;CACF,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,aAAa,GAAwB,gBAAgB,CAAC,WAAW,CAAC,CAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { type ElementProps } from '@remix-run/ui';
|
|
2
|
-
export declare function lockScroll(targetDocument?: Document): () => void;
|
|
3
|
-
export declare const lockScrollOnToggle: <
|
|
1
|
+
import { type ElementProps, type MixinFactory } from '@remix-run/ui';
|
|
2
|
+
export declare function lockScroll(targetDocument?: Document | undefined): () => void;
|
|
3
|
+
export declare const lockScrollOnToggle: MixinFactory<HTMLElement, [], ElementProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scroll-lock.js","sourceRoot":"","sources":["../../src/utils/scro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AG,GAAG,EAAE,GAAE,CAAC,CAAA;IACzB,CAAC,CAAC,CAAA;IAEF,OAAO,GAAG,EAAE,CAAC;QACX,EAAE,CAAC,cAAc,EAAE,CAAC,KAAK,EAAE,EAAE;YAC3B,YAAY,EAAE,CAAA;YACd,YAAY,GAAG,GAAG,EAAE,GAAE,CAAC,CAAA;YAEvB,IAAI,KAAK,CAAC,QAAQ,KAAK,MAAM,EAAE,CAAC;gBAC9B,OAAM;YACR,CAAC;YAED,YAAY,GAAG,UAAU,CAAE,KAAK,CAAC,aAA6B,CAAC,aAAa,CAAC,CAAA;QAC/E,CAAC,CAAC;KACH,CAAA;AACH,CAAC,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remix-run/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "UI tokens, mixins, and glyphs for Remix components",
|
|
5
5
|
"author": "Ryan Florence <rpflorence@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -104,8 +104,8 @@
|
|
|
104
104
|
"@typescript/native-preview": "7.0.0-dev.20251125.1",
|
|
105
105
|
"playwright": "^1.59.0",
|
|
106
106
|
"typescript": "^5.9.3",
|
|
107
|
-
"@remix-run/assert": "0.2.
|
|
108
|
-
"@remix-run/test": "0.4.
|
|
107
|
+
"@remix-run/assert": "0.2.1",
|
|
108
|
+
"@remix-run/test": "0.4.1"
|
|
109
109
|
},
|
|
110
110
|
"dependencies": {
|
|
111
111
|
"@types/dom-navigation": "^1.0.7"
|
package/src/animation/README.md
CHANGED
|
@@ -52,12 +52,13 @@ function Toast() {
|
|
|
52
52
|
`animateExit` keeps a removed keyed element in the DOM long enough to animate from its natural styles to the provided keyframe.
|
|
53
53
|
|
|
54
54
|
```tsx
|
|
55
|
+
import type { Handle } from 'remix/ui'
|
|
55
56
|
import { animateExit } from 'remix/ui/animation'
|
|
56
57
|
|
|
57
|
-
function Item(
|
|
58
|
+
function Item(handle: Handle<{ id: string; label: string }>) {
|
|
58
59
|
return () => (
|
|
59
60
|
<li
|
|
60
|
-
key={id}
|
|
61
|
+
key={handle.props.id}
|
|
61
62
|
mix={[
|
|
62
63
|
animateExit({
|
|
63
64
|
opacity: 0,
|
|
@@ -67,7 +68,7 @@ function Item({ id, label }: { id: string; label: string }) {
|
|
|
67
68
|
}),
|
|
68
69
|
]}
|
|
69
70
|
>
|
|
70
|
-
{label}
|
|
71
|
+
{handle.props.label}
|
|
71
72
|
</li>
|
|
72
73
|
)
|
|
73
74
|
}
|
|
@@ -105,12 +106,13 @@ Exit animations can reclaim a removed keyed node if the same keyed element is re
|
|
|
105
106
|
`animateLayout` animates layout changes with a FLIP-style transform projection. Use it on elements whose position or size can change between renders.
|
|
106
107
|
|
|
107
108
|
```tsx
|
|
109
|
+
import type { Handle } from 'remix/ui'
|
|
108
110
|
import { animateLayout, spring } from 'remix/ui/animation'
|
|
109
111
|
|
|
110
|
-
function Card(
|
|
112
|
+
function Card(handle: Handle<{ expanded: boolean }>) {
|
|
111
113
|
return () => (
|
|
112
114
|
<section
|
|
113
|
-
class={expanded ? 'card expanded' : 'card'}
|
|
115
|
+
class={handle.props.expanded ? 'card expanded' : 'card'}
|
|
114
116
|
mix={[
|
|
115
117
|
animateLayout({
|
|
116
118
|
...spring('smooth'),
|
package/src/animation/spring.ts
CHANGED
|
@@ -38,6 +38,17 @@ export interface SpringIterator extends IterableIterator<number> {
|
|
|
38
38
|
toString(): string
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
export interface SpringFunction {
|
|
42
|
+
(preset: SpringPreset, overrides?: Omit<SpringOptions, 'bounce'>): SpringIterator
|
|
43
|
+
(options?: SpringOptions): SpringIterator
|
|
44
|
+
transition(
|
|
45
|
+
property: string | string[],
|
|
46
|
+
presetOrOptions?: SpringPreset | SpringOptions,
|
|
47
|
+
overrides?: Omit<SpringOptions, 'bounce'>,
|
|
48
|
+
): string
|
|
49
|
+
presets: Record<SpringPreset, { duration: number; bounce: number }>
|
|
50
|
+
}
|
|
51
|
+
|
|
41
52
|
const presets: Record<SpringPreset, { duration: number; bounce: number }> = {
|
|
42
53
|
smooth: { duration: 400, bounce: -0.3 },
|
|
43
54
|
snappy: { duration: 200, bounce: 0 },
|
|
@@ -74,7 +85,7 @@ const frameMs = 1000 / 60 // ~16.67ms per frame
|
|
|
74
85
|
* @param overrides Optional preset overrides.
|
|
75
86
|
* @returns A spring iterator.
|
|
76
87
|
*/
|
|
77
|
-
|
|
88
|
+
function createSpring(
|
|
78
89
|
preset: SpringPreset,
|
|
79
90
|
overrides?: Omit<SpringOptions, 'bounce'>,
|
|
80
91
|
): SpringIterator
|
|
@@ -84,8 +95,8 @@ export function spring(
|
|
|
84
95
|
* @param options Spring parameters.
|
|
85
96
|
* @returns A spring iterator.
|
|
86
97
|
*/
|
|
87
|
-
|
|
88
|
-
|
|
98
|
+
function createSpring(options?: SpringOptions): SpringIterator
|
|
99
|
+
function createSpring(
|
|
89
100
|
presetOrOptions?: SpringPreset | SpringOptions,
|
|
90
101
|
overrides?: Omit<SpringOptions, 'bounce'>,
|
|
91
102
|
): SpringIterator {
|
|
@@ -119,23 +130,24 @@ export function spring(
|
|
|
119
130
|
return iter as unknown as SpringIterator
|
|
120
131
|
}
|
|
121
132
|
|
|
122
|
-
|
|
123
|
-
spring.transition = function transition(
|
|
133
|
+
function transition(
|
|
124
134
|
property: string | string[],
|
|
125
135
|
presetOrOptions?: SpringPreset | SpringOptions,
|
|
126
136
|
overrides?: Omit<SpringOptions, 'bounce'>,
|
|
127
137
|
): string {
|
|
128
138
|
let s =
|
|
129
139
|
typeof presetOrOptions === 'string'
|
|
130
|
-
?
|
|
131
|
-
:
|
|
140
|
+
? createSpring(presetOrOptions, overrides)
|
|
141
|
+
: createSpring(presetOrOptions)
|
|
132
142
|
|
|
133
143
|
let properties = Array.isArray(property) ? property : [property]
|
|
134
144
|
return properties.map((p) => `${p} ${s}`).join(', ')
|
|
135
145
|
}
|
|
136
146
|
|
|
137
|
-
|
|
138
|
-
|
|
147
|
+
export const spring: SpringFunction = Object.assign(createSpring, {
|
|
148
|
+
transition,
|
|
149
|
+
presets,
|
|
150
|
+
})
|
|
139
151
|
|
|
140
152
|
function resolveOptions(
|
|
141
153
|
presetOrOptions?: SpringPreset | SpringOptions,
|
|
@@ -230,7 +230,7 @@ function isMultipleProps(props: AccordionProps | null): props is AccordionMultip
|
|
|
230
230
|
return props?.type === 'multiple'
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
-
function AccordionImpl(handle: Handle<AccordionProps, AccordionContext>) {
|
|
233
|
+
function AccordionImpl(handle: Handle<AccordionProps, AccordionContext>): () => RemixNode {
|
|
234
234
|
let rootNode: HTMLElement | null = null
|
|
235
235
|
let registeredItems: RegisteredItem[] = []
|
|
236
236
|
let uncontrolledSingleValue: string | null = null
|
|
@@ -418,13 +418,15 @@ function AccordionImpl(handle: Handle<AccordionProps, AccordionContext>) {
|
|
|
418
418
|
export function onAccordionChange<target extends HTMLElement>(
|
|
419
419
|
handler: AccordionChangeHandler<target>,
|
|
420
420
|
captureBoolean?: boolean,
|
|
421
|
-
) {
|
|
421
|
+
): ReturnType<typeof on<target, typeof ACCORDION_CHANGE_EVENT>> {
|
|
422
422
|
return on(ACCORDION_CHANGE_EVENT, handler, captureBoolean)
|
|
423
423
|
}
|
|
424
424
|
|
|
425
425
|
export const Accordion = AccordionImpl
|
|
426
426
|
|
|
427
|
-
export function AccordionItem(
|
|
427
|
+
export function AccordionItem(
|
|
428
|
+
handle: Handle<AccordionItemProps, AccordionItemContext>,
|
|
429
|
+
): () => RemixNode {
|
|
428
430
|
let triggerNode: HTMLButtonElement | null = null
|
|
429
431
|
let triggerId = `${handle.id}-trigger`
|
|
430
432
|
let panelId = `${handle.id}-panel`
|
|
@@ -468,7 +470,7 @@ export function AccordionItem(handle: Handle<AccordionItemProps, AccordionItemCo
|
|
|
468
470
|
}
|
|
469
471
|
}
|
|
470
472
|
|
|
471
|
-
export function AccordionTrigger(handle: Handle<AccordionTriggerProps>) {
|
|
473
|
+
export function AccordionTrigger(handle: Handle<AccordionTriggerProps>): () => RemixNode {
|
|
472
474
|
return () => {
|
|
473
475
|
let accordion = handle.context.get(Accordion)
|
|
474
476
|
let item = handle.context.get(AccordionItem)
|
|
@@ -539,7 +541,7 @@ export function AccordionTrigger(handle: Handle<AccordionTriggerProps>) {
|
|
|
539
541
|
}
|
|
540
542
|
}
|
|
541
543
|
|
|
542
|
-
export function AccordionContent(handle: Handle<AccordionContentProps>) {
|
|
544
|
+
export function AccordionContent(handle: Handle<AccordionContentProps>): () => RemixNode {
|
|
543
545
|
return () => {
|
|
544
546
|
let item = handle.context.get(AccordionItem)
|
|
545
547
|
let { children, mix, ...panelProps } = handle.props
|
|
@@ -72,7 +72,7 @@ const textCss = css({
|
|
|
72
72
|
whiteSpace: 'nowrap',
|
|
73
73
|
})
|
|
74
74
|
|
|
75
|
-
export function Breadcrumbs(handle: Handle<BreadcrumbsProps>) {
|
|
75
|
+
export function Breadcrumbs(handle: Handle<BreadcrumbsProps>): () => RemixNode {
|
|
76
76
|
return () => {
|
|
77
77
|
let { 'aria-label': ariaLabel, items, separator, mix, ...navProps } = handle.props
|
|
78
78
|
let currentIndex = items.findIndex((item) => item.current)
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { attrs, createElement, createMixin, css } from '@remix-run/ui'
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
CSSMixinDescriptor,
|
|
4
|
+
ElementProps,
|
|
5
|
+
Handle,
|
|
6
|
+
MixinDescriptor,
|
|
7
|
+
MixinFactory,
|
|
8
|
+
Props,
|
|
9
|
+
RemixNode,
|
|
10
|
+
} from '@remix-run/ui'
|
|
3
11
|
|
|
4
12
|
import { theme } from '../../theme/theme.ts'
|
|
5
13
|
|
|
@@ -74,22 +82,26 @@ const buttonIconCss: CSSMixinDescriptor = css({
|
|
|
74
82
|
},
|
|
75
83
|
})
|
|
76
84
|
|
|
77
|
-
const buttonIconAttrsCss = attrs({
|
|
85
|
+
const buttonIconAttrsCss: MixinDescriptor<Element, [Partial<ElementProps>], ElementProps> = attrs({
|
|
86
|
+
'aria-hidden': true,
|
|
87
|
+
})
|
|
78
88
|
|
|
79
|
-
const buttonDefaultsMixin
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
89
|
+
const buttonDefaultsMixin: MixinFactory<Element, [], ElementProps> = createMixin<
|
|
90
|
+
Element,
|
|
91
|
+
[],
|
|
92
|
+
ElementProps
|
|
93
|
+
>((handle, hostType) => (props) => {
|
|
94
|
+
if (hostType !== 'button' || props.type !== undefined) {
|
|
95
|
+
return handle.element
|
|
96
|
+
}
|
|
84
97
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
)
|
|
98
|
+
return createElement(handle.element as unknown as string, {
|
|
99
|
+
...props,
|
|
100
|
+
type: 'button',
|
|
101
|
+
})
|
|
102
|
+
})
|
|
91
103
|
|
|
92
|
-
const buttonDefaultsCss = buttonDefaultsMixin()
|
|
104
|
+
const buttonDefaultsCss: MixinDescriptor<Element, [], ElementProps> = buttonDefaultsMixin()
|
|
93
105
|
|
|
94
106
|
/**
|
|
95
107
|
* Base button styling with the default `type="button"` behavior for `<button>`
|
|
@@ -121,7 +133,7 @@ export const labelStyle = buttonLabelCss
|
|
|
121
133
|
*
|
|
122
134
|
* @category mixin
|
|
123
135
|
*/
|
|
124
|
-
export const primaryStyle = createButtonCss(theme.colors.action.primary)
|
|
136
|
+
export const primaryStyle: CSSMixinDescriptor = createButtonCss(theme.colors.action.primary)
|
|
125
137
|
|
|
126
138
|
/**
|
|
127
139
|
* Secondary visual treatment for buttons. Combine with {@link baseStyle} when
|
|
@@ -129,7 +141,7 @@ export const primaryStyle = createButtonCss(theme.colors.action.primary)
|
|
|
129
141
|
*
|
|
130
142
|
* @category mixin
|
|
131
143
|
*/
|
|
132
|
-
export const secondaryStyle = createButtonCss(theme.colors.action.secondary)
|
|
144
|
+
export const secondaryStyle: CSSMixinDescriptor = createButtonCss(theme.colors.action.secondary)
|
|
133
145
|
|
|
134
146
|
/**
|
|
135
147
|
* Ghost visual treatment for buttons — transparent background with a hover
|
|
@@ -146,7 +158,7 @@ export const ghostStyle = ghostButtonToneCss
|
|
|
146
158
|
*
|
|
147
159
|
* @category mixin
|
|
148
160
|
*/
|
|
149
|
-
export const dangerStyle = createButtonCss(theme.colors.action.danger)
|
|
161
|
+
export const dangerStyle: CSSMixinDescriptor = createButtonCss(theme.colors.action.danger)
|
|
150
162
|
|
|
151
163
|
const toneStyleByTone = {
|
|
152
164
|
primary: primaryStyle,
|
|
@@ -203,7 +215,7 @@ export type ButtonProps = Omit<Props<'button'>, 'children'> & {
|
|
|
203
215
|
* </Button>
|
|
204
216
|
* ```
|
|
205
217
|
*/
|
|
206
|
-
export function Button(handle: Handle<ButtonProps>) {
|
|
218
|
+
export function Button(handle: Handle<ButtonProps>): () => RemixNode {
|
|
207
219
|
return () => {
|
|
208
220
|
let { children, endIcon, mix, startIcon, tone = 'secondary', ...buttonProps } = handle.props
|
|
209
221
|
|