@theroutingcompany/components 0.0.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.
Files changed (48) hide show
  1. package/README.md +68 -0
  2. package/dist/trc-components.es.js +10519 -0
  3. package/dist/trc-components.es.js.map +1 -0
  4. package/dist/trc-components.umd.js +1430 -0
  5. package/dist/trc-components.umd.js.map +1 -0
  6. package/package.json +109 -0
  7. package/types/components/AccessibleIcon/AccessibleIcon.d.ts +3 -0
  8. package/types/components/AlertDialog/AlertDialog.d.ts +18 -0
  9. package/types/components/Box/Box.d.ts +12 -0
  10. package/types/components/Breadcrumbs/Breadcrumbs.d.ts +16 -0
  11. package/types/components/Button/Button.d.ts +55 -0
  12. package/types/components/Button/ButtonBase.d.ts +1 -0
  13. package/types/components/Button/HighEmphasisButton/HighEmphasisButton.d.ts +6 -0
  14. package/types/components/Button/LowEmphasisButton/LowEmphasisButton.d.ts +5 -0
  15. package/types/components/Button/MediumEmphasisButton/MediumEmphasisButton.d.ts +5 -0
  16. package/types/components/Checkbox/Checkbox.d.ts +7 -0
  17. package/types/components/Dialog/Dialog.d.ts +24 -0
  18. package/types/components/Fieldset/Fieldset.d.ts +9 -0
  19. package/types/components/FormControl/FormControl.d.ts +19 -0
  20. package/types/components/FormControl/useFormInput.d.ts +9 -0
  21. package/types/components/Grid/Grid.d.ts +0 -0
  22. package/types/components/Heading/Heading.d.ts +10 -0
  23. package/types/components/IconButton/IconButton.d.ts +21 -0
  24. package/types/components/Input/CreditCardInput/CreditCardInput.d.ts +1 -0
  25. package/types/components/Input/InputBase.d.ts +9 -0
  26. package/types/components/Input/NumberInput/NumberInput.d.ts +32 -0
  27. package/types/components/Input/PasswordInput/PasswordInput.d.ts +0 -0
  28. package/types/components/Input/PhoneInput/PhoneInput.d.ts +0 -0
  29. package/types/components/Input/TextArea/TextArea.d.ts +8 -0
  30. package/types/components/Input/TextInput/TextInput.d.ts +27 -0
  31. package/types/components/Input/URLInput/URLInput.d.ts +0 -0
  32. package/types/components/Label/Label.d.ts +9 -0
  33. package/types/components/Page/Page.d.ts +4 -0
  34. package/types/components/Popover/Popover.d.ts +8 -0
  35. package/types/components/RadioGroup/RadioGroup.d.ts +6 -0
  36. package/types/components/SegmentControl/SegmentControl.d.ts +8 -0
  37. package/types/components/Select/Select.d.ts +23 -0
  38. package/types/components/Stack/Stack.d.ts +0 -0
  39. package/types/components/Switch/Switch.d.ts +4 -0
  40. package/types/components/Text/Text.d.ts +39 -0
  41. package/types/components/Title/Title.d.ts +9 -0
  42. package/types/components/Toast/Toast.d.ts +16 -0
  43. package/types/components/Tooltip/IconTooltip.d.ts +8 -0
  44. package/types/components/Tooltip/Tooltip.d.ts +8 -0
  45. package/types/components/index.d.ts +21 -0
  46. package/types/helpers/index.d.ts +1 -0
  47. package/types/helpers/typeHelpers.d.ts +24 -0
  48. package/types/index.d.ts +2 -0
package/README.md ADDED
@@ -0,0 +1,68 @@
1
+ # TRC TREX Component Library
2
+
3
+ ## UI Libraries
4
+
5
+ The component library is built on the following 'component primitives' UI libraries, low-level unstyled building blocks.
6
+
7
+ - [react-aria](https://react-spectrum.adobe.com/react-aria/why.html)
8
+ - [RadixUI](https://www.radix-ui.com/docs/primitives/overview/introduction)
9
+
10
+ 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.
11
+ 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).
12
+ 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.
13
+
14
+ ## Styling
15
+
16
+ Styling is done with [styled-components](https://styled-components.com/), a CSS-in-JS library.
17
+
18
+ The approach is roughly:
19
+
20
+ 1. A "base" styled component with shared styles: `ButtonBase`
21
+ 2. Each variant in the [Figma designs](https://www.figma.com/file/xfnqeuF8FgoqhJSUs5GTsK/PDS-Components-Desktop?node-id=16%3A7&t=22cWETfRERKj9wkP-0) is a styled component 'extending' the base component: ` const PrimaryButton = styled(ButtonBase)`` `
22
+
23
+ - All variant are placed in an object (a map but not a `Map()`)
24
+ - The exported takes a `variant` prop and uses it to get the right styled component from the object map
25
+
26
+ ## Guiding Principles
27
+
28
+ https://www.gabe.pizza/notes-on-component-libraries/
29
+
30
+ - For content, prefer composition over props
31
+
32
+ - ✅ `<Text variant="body">Some text</Text>`
33
+ - ❌ `<Text variant="body" text="Some text" />`
34
+
35
+ - Don't rename
36
+
37
+ TODO Expand
38
+
39
+ ## Examples
40
+
41
+ - [the component gallery](https://component.gallery/) "Designed to be a reference for anyone building component-based user interfaces, The Component Gallery is an up-to-date repository of interface components based on examples from the world of design systems."
42
+ - [Storybook showcase](https://storybook.js.org/showcase)
43
+ - [Primer: React implementation of GitHub's Primer Design System](https://primer.style/react/)
44
+ - [Paste: The Design System for building Twilio customer experiences](https://paste.twilio.design/)
45
+ - [Spectrum: Adobe’s design system.](https://react-spectrum.adobe.com/react-spectrum/)
46
+ - [Evergreen: Segment’s design system](https://evergreen.segment.com/)
47
+ - [awesome-react-design-systems](https://github.com/jbranchaud/awesome-react-design-systems)
48
+
49
+ ## Reading
50
+
51
+ - [The styled-components Happy Path](https://www.joshwcomeau.com/css/styled-components/)
52
+ - [CSS Variables for React Devs](https://www.joshwcomeau.com/css/css-variables-for-react-devs/)
53
+
54
+ - [You Don’t Need A UI Framework](https://www.smashingmagazine.com/2022/05/you-dont-need-ui-framework/)
55
+
56
+ ###
57
+
58
+ - [Vadim Demedes Design system tips](https://twitter.com/i/events/1577907596966641665)
59
+ - [https://www.robinrendle.com/notes/the-difference-between-correct-ness-and-useful-ness-in-a-design-system/](https://www.robinrendle.com/notes/the-difference-between-correct-ness-and-useful-ness-in-a-design-system/)
60
+
61
+ - [Apple Developer: Layout - Foundations - Human Interface Guidelines](https://developer.apple.com/design/human-interface-guidelines/foundations/layout/)
62
+
63
+ - https://jonambas.com/posts/lessons-learned
64
+ - [https://jonambas.com/posts/component-api-standards](https://jonambas.com/posts/component-api-standards)
65
+
66
+ #### TypeScript
67
+
68
+ - [TypeScript + React: Typing Generic forwardRefs](https://fettblog.eu/typescript-react-generic-forward-refs/)