@theroutingcompany/components 0.0.23 → 0.0.24-alpha.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.
package/README.md CHANGED
@@ -2,6 +2,24 @@
2
2
 
3
3
  View the [StoryBook](https://6392297e45ccab79e466ee19-iytnzjepcr.chromatic.com/).
4
4
 
5
+ ## Publishing
6
+
7
+ First double check if everything that needs to exported is added to the `components/index.js` or `helpers/index.js`.
8
+
9
+ ### Public
10
+
11
+ 1. Bump version number `npm version patch --no-git-tag-version`
12
+ 2. `npm publish --access public`.
13
+ * Usually adding `--dry-run` first is a good idea for double checking if the version number is correct.
14
+ 3. Enter the 2FA code for npm
15
+
16
+ ### Prerelease
17
+
18
+ 1. Add alpha tag to version number with `npm version prerelease --preid alpha --no-git-tag-version`
19
+ 2. `npm publish --tag alpha.[NUMBER] --access public` where `[NUMBER]` is replaced with the alpha number.
20
+ * Usually adding `--dry-run` first is a good idea for double checking if the version number is correct.
21
+ 3. Enter the 2FA code for npm
22
+
5
23
  ## UI Libraries
6
24
 
7
25
  The component library is built on the following 'component primitives' UI libraries, low-level unstyled building blocks.
@@ -10,7 +28,7 @@ The component library is built on the following 'component primitives' UI librar
10
28
  - [RadixUI](https://www.radix-ui.com/docs/primitives/overview/introduction)
11
29
 
12
30
  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).
31
+ 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
32
  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
33
 
16
34
  ## Styling
@@ -211,7 +229,7 @@ See [The styled-components Happy Path](https://www.joshwcomeau.com/css/styled-co
211
229
  ### Merge props
212
230
 
213
231
  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 a `*Trigger` components with an `asChild` prop, `mergeProps` ensures there are chained instead of overwritten which enables functionality to be composed.
232
+ 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
233
 
216
234
  ### Forward refs
217
235
 
@@ -290,7 +308,7 @@ Exact types for props (for editor autocomplete) is a necessity, not a nice-to-ha
290
308
  </cite>
291
309
  </figcaption>
292
310
  </figure>
293
- </figure>
311
+
294
312
 
295
313
  - ❌ `type Variant = string;`
296
314
  - ✅ `type Variant = 'primary' | 'secondary' | 'danger' | 'inverse';`
@@ -309,6 +327,22 @@ Two ways we can solve this
309
327
  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
328
  2. Be more explicit. Write out all the props to forward and types explicitly.
311
329
 
330
+ Note, Radix often required spreading on to the underlying DOM node
331
+
332
+ <figure>
333
+ <blockquote>
334
+ <em>Your component must spread props</em>.
335
+ When Radix clones your component, it will pass its own props and event handlers to make it functional and accessible.
336
+ If your component doesn't support those props, it will break.
337
+ This is done by spreading all of the props onto the underlying DOM node.
338
+ </blockquote>
339
+ <figcaption>
340
+ <cite>
341
+ <a href="https://www.radix-ui.com/docs/primitives/guides/composition#your-component-must-spread-props">Composing with your own React components</a>
342
+ </cite>
343
+ </figcaption>
344
+ </figure>
345
+
312
346
  ## Configurable Components Should Have Sane Defaults & Not Blow Up Without Props
313
347
 
314
348
  > **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
- animation: ${w2} 150ms cubic-bezier(0.16, 1, 0.3, 1);
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) => e.has(t) ? e.get(t) : t, Ye = Da(z2), K2 = Object.entries(
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.9.2", this.plugins = new mE(), this.options = {
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
- &[data-state~='open'] {
25979
- animation: ${AR} 150ms cubic-bezier(0.16, 1, 0.3, 1);
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
- &[data-state~='closed'] {
25983
- animation: ${IR} 100ms ease-in;
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,