@theroutingcompany/components 0.0.23-alpha.1 → 0.0.24-alpha.1
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 +35 -3
- package/dist/trc-components.es.js +26 -18
- package/dist/trc-components.es.js.map +1 -1
- package/dist/trc-components.umd.js +22 -17
- package/dist/trc-components.umd.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +56 -55
- package/types/components/Drawer/Drawer.d.ts +35 -0
package/README.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
View the [StoryBook](https://6392297e45ccab79e466ee19-iytnzjepcr.chromatic.com/).
|
|
4
4
|
|
|
5
|
+
## Publishing
|
|
6
|
+
|
|
7
|
+
### Public
|
|
8
|
+
|
|
9
|
+
1. Bump version number `npm version patch --no-git-tag-version`
|
|
10
|
+
2. `npm publish --access public`.
|
|
11
|
+
* Usually adding `--dry-run` first is a good idea for double checking if the version number is correct.
|
|
12
|
+
3. Enter the 2FA code for npm
|
|
13
|
+
|
|
14
|
+
### Prerelease
|
|
15
|
+
|
|
16
|
+
1. Add alpha tag to version number with `npm version prerelease --preid alpha --no-git-tag-version`
|
|
17
|
+
2. `npm publish --tag alpha.x --access public`.
|
|
18
|
+
* Usually adding `--dry-run` first is a good idea for double checking if the version number is correct.
|
|
19
|
+
3. Enter the 2FA code for npm
|
|
20
|
+
|
|
5
21
|
## UI Libraries
|
|
6
22
|
|
|
7
23
|
The component library is built on the following 'component primitives' UI libraries, low-level unstyled building blocks.
|
|
@@ -10,7 +26,7 @@ The component library is built on the following 'component primitives' UI librar
|
|
|
10
26
|
- [RadixUI](https://www.radix-ui.com/docs/primitives/overview/introduction)
|
|
11
27
|
|
|
12
28
|
They are similar in spirit but take a slightly different approach. Radix follows a component-based approach, while react-aria takes a hook-based approach.
|
|
13
|
-
The divide is roughly Radix for 'structural' elements, think [popovers](https://www.radix-ui.com/docs/primitives/components/popover), [accordion](https://www.radix-ui.com/docs/primitives/components/accordion) and react-aria for some input components and components Radix lacks, like [breadcrumbs](https://react-spectrum.adobe.com/react-aria/useBreadcrumbs.html).
|
|
29
|
+
The divide is roughly Radix for 'structural' elements, think [popovers](https://www.radix-ui.com/docs/primitives/components/popover), [accordion](https://www.radix-ui.com/docs/primitives/components/accordion) and react-aria for some input components and other components Radix lacks, like [breadcrumbs](https://react-spectrum.adobe.com/react-aria/useBreadcrumbs.html).
|
|
14
30
|
It may seem weird at first sight that two component libraries are used but they are low-level enough not to get in each others way.
|
|
15
31
|
|
|
16
32
|
## Styling
|
|
@@ -211,7 +227,7 @@ See [The styled-components Happy Path](https://www.joshwcomeau.com/css/styled-co
|
|
|
211
227
|
### Merge props
|
|
212
228
|
|
|
213
229
|
Use the [`mergeProps`](https://react-spectrum.adobe.com/react-aria/mergeProps.html) function from `@react-aria/util` to merge props correctly.
|
|
214
|
-
For example, Radix adds events handlers to buttons inside
|
|
230
|
+
For example, Radix adds events handlers to buttons inside `*Trigger` components with an `asChild` prop, `mergeProps` ensures there are chained instead of overwritten which enables functionality to be composed.
|
|
215
231
|
|
|
216
232
|
### Forward refs
|
|
217
233
|
|
|
@@ -290,7 +306,7 @@ Exact types for props (for editor autocomplete) is a necessity, not a nice-to-ha
|
|
|
290
306
|
</cite>
|
|
291
307
|
</figcaption>
|
|
292
308
|
</figure>
|
|
293
|
-
|
|
309
|
+
|
|
294
310
|
|
|
295
311
|
- ❌ `type Variant = string;`
|
|
296
312
|
- ✅ `type Variant = 'primary' | 'secondary' | 'danger' | 'inverse';`
|
|
@@ -309,6 +325,22 @@ Two ways we can solve this
|
|
|
309
325
|
1. Filter spread props. Reject all non-DOM props using a utility. Note react-aria has a util names `filterDOMProps` despite its name it does not filter DOM props (I think it's a legacy util).
|
|
310
326
|
2. Be more explicit. Write out all the props to forward and types explicitly.
|
|
311
327
|
|
|
328
|
+
Note, Radix often required spreading on to the underlying DOM node
|
|
329
|
+
|
|
330
|
+
<figure>
|
|
331
|
+
<blockquote>
|
|
332
|
+
<em>Your component must spread props</em>.
|
|
333
|
+
When Radix clones your component, it will pass its own props and event handlers to make it functional and accessible.
|
|
334
|
+
If your component doesn't support those props, it will break.
|
|
335
|
+
This is done by spreading all of the props onto the underlying DOM node.
|
|
336
|
+
</blockquote>
|
|
337
|
+
<figcaption>
|
|
338
|
+
<cite>
|
|
339
|
+
<a href="https://www.radix-ui.com/docs/primitives/guides/composition#your-component-must-spread-props">Composing with your own React components</a>
|
|
340
|
+
</cite>
|
|
341
|
+
</figcaption>
|
|
342
|
+
</figure>
|
|
343
|
+
|
|
312
344
|
## Configurable Components Should Have Sane Defaults & Not Blow Up Without Props
|
|
313
345
|
|
|
314
346
|
> **Warning**
|
|
@@ -2425,7 +2425,10 @@ const X_ = "DialogTitleWarning", [Q_, GR] = Ix(X_, {
|
|
|
2425
2425
|
z-index: 5;
|
|
2426
2426
|
box-shadow: ${m.elevation_static_high};
|
|
2427
2427
|
border-radius: ${m.border_radius_400};
|
|
2428
|
-
|
|
2428
|
+
|
|
2429
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
2430
|
+
animation: ${w2} 150ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
2431
|
+
}
|
|
2429
2432
|
`, S2 = O(pp)`
|
|
2430
2433
|
${yp}
|
|
2431
2434
|
width: ${(e) => vp[e.size ?? "medium"]};
|
|
@@ -2962,7 +2965,10 @@ const A2 = {
|
|
|
2962
2965
|
"ease-out": "cubic-bezier(0, 0, 0.2, 1)",
|
|
2963
2966
|
"ease-in-out": "cubic-bezier(0.4, 0, 0.2, 1)"
|
|
2964
2967
|
}
|
|
2965
|
-
}, z2 = new Map(Object.entries(Zn.spacing)), Da = (e) => (t) =>
|
|
2968
|
+
}, z2 = new Map(Object.entries(Zn.spacing)), Da = (e) => (t) => (
|
|
2969
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
2970
|
+
e.has(t) ? e.get(t) : t
|
|
2971
|
+
), Ye = Da(z2), K2 = Object.entries(
|
|
2966
2972
|
Zn.elevation.interactive
|
|
2967
2973
|
).map(([e, t]) => [`interactive_${e}`, t]), L2 = Object.entries(Zn.elevation.interactive).map(
|
|
2968
2974
|
([e, t]) => [`static_${e}`, t]
|
|
@@ -21789,7 +21795,7 @@ var GT = /([[\].#*$><+~=|^:(),"'`\s])/g, of = typeof CSS < "u" && CSS.escape, Nc
|
|
|
21789
21795
|
var i = this.rules.toString(n);
|
|
21790
21796
|
return i ? this.query + " {" + a + i + a + "}" : "";
|
|
21791
21797
|
}, e;
|
|
21792
|
-
}(), JT = /@media|@supports\s+/, XT = {
|
|
21798
|
+
}(), JT = /@container|@media|@supports\s+/, XT = {
|
|
21793
21799
|
onCreateRule: function(t, r, n) {
|
|
21794
21800
|
return JT.test(t) ? new ZT(t, r, n) : null;
|
|
21795
21801
|
}
|
|
@@ -22343,7 +22349,7 @@ var SE = _y(function() {
|
|
|
22343
22349
|
}, e;
|
|
22344
22350
|
}(), EE = 0, CE = /* @__PURE__ */ function() {
|
|
22345
22351
|
function e(r) {
|
|
22346
|
-
this.id = EE++, this.version = "10.
|
|
22352
|
+
this.id = EE++, this.version = "10.10.0", this.plugins = new mE(), this.options = {
|
|
22347
22353
|
id: {
|
|
22348
22354
|
minify: !1
|
|
22349
22355
|
},
|
|
@@ -25975,26 +25981,28 @@ const SR = F1, kR = dR, TR = bR, ER = yR, CR = K1, RR = L1, Yc = 25, IR = Ze`
|
|
|
25975
25981
|
line-height: 1;
|
|
25976
25982
|
}
|
|
25977
25983
|
|
|
25978
|
-
|
|
25979
|
-
|
|
25980
|
-
|
|
25984
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
25985
|
+
&[data-state~='open'] {
|
|
25986
|
+
animation: ${AR} 150ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
25987
|
+
}
|
|
25988
|
+
|
|
25989
|
+
&[data-state~='closed'] {
|
|
25990
|
+
animation: ${IR} 100ms ease-in;
|
|
25991
|
+
}
|
|
25981
25992
|
|
|
25982
|
-
|
|
25983
|
-
|
|
25993
|
+
&[data-swipe='cancel'] {
|
|
25994
|
+
transform: translateX(0);
|
|
25995
|
+
transition: transform 200ms ease-out;
|
|
25996
|
+
}
|
|
25997
|
+
|
|
25998
|
+
&[data-swipe='end'] {
|
|
25999
|
+
animation: ${OR} 100ms ease-out;
|
|
26000
|
+
}
|
|
25984
26001
|
}
|
|
25985
26002
|
|
|
25986
26003
|
&[data-swipe='move'] {
|
|
25987
26004
|
transform: translateX(var(--radix-toast-swipe-move-x));
|
|
25988
26005
|
}
|
|
25989
|
-
|
|
25990
|
-
&[data-swipe='cancel'] {
|
|
25991
|
-
transform: translateX(0);
|
|
25992
|
-
transition: transform 200ms ease-out;
|
|
25993
|
-
}
|
|
25994
|
-
|
|
25995
|
-
&[data-swipe='end'] {
|
|
25996
|
-
animation: ${OR} 100ms ease-out;
|
|
25997
|
-
}
|
|
25998
26006
|
`;
|
|
25999
26007
|
function rA({
|
|
26000
26008
|
children: e,
|