@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.
- package/README.md +68 -0
- package/dist/trc-components.es.js +10519 -0
- package/dist/trc-components.es.js.map +1 -0
- package/dist/trc-components.umd.js +1430 -0
- package/dist/trc-components.umd.js.map +1 -0
- package/package.json +109 -0
- package/types/components/AccessibleIcon/AccessibleIcon.d.ts +3 -0
- package/types/components/AlertDialog/AlertDialog.d.ts +18 -0
- package/types/components/Box/Box.d.ts +12 -0
- package/types/components/Breadcrumbs/Breadcrumbs.d.ts +16 -0
- package/types/components/Button/Button.d.ts +55 -0
- package/types/components/Button/ButtonBase.d.ts +1 -0
- package/types/components/Button/HighEmphasisButton/HighEmphasisButton.d.ts +6 -0
- package/types/components/Button/LowEmphasisButton/LowEmphasisButton.d.ts +5 -0
- package/types/components/Button/MediumEmphasisButton/MediumEmphasisButton.d.ts +5 -0
- package/types/components/Checkbox/Checkbox.d.ts +7 -0
- package/types/components/Dialog/Dialog.d.ts +24 -0
- package/types/components/Fieldset/Fieldset.d.ts +9 -0
- package/types/components/FormControl/FormControl.d.ts +19 -0
- package/types/components/FormControl/useFormInput.d.ts +9 -0
- package/types/components/Grid/Grid.d.ts +0 -0
- package/types/components/Heading/Heading.d.ts +10 -0
- package/types/components/IconButton/IconButton.d.ts +21 -0
- package/types/components/Input/CreditCardInput/CreditCardInput.d.ts +1 -0
- package/types/components/Input/InputBase.d.ts +9 -0
- package/types/components/Input/NumberInput/NumberInput.d.ts +32 -0
- package/types/components/Input/PasswordInput/PasswordInput.d.ts +0 -0
- package/types/components/Input/PhoneInput/PhoneInput.d.ts +0 -0
- package/types/components/Input/TextArea/TextArea.d.ts +8 -0
- package/types/components/Input/TextInput/TextInput.d.ts +27 -0
- package/types/components/Input/URLInput/URLInput.d.ts +0 -0
- package/types/components/Label/Label.d.ts +9 -0
- package/types/components/Page/Page.d.ts +4 -0
- package/types/components/Popover/Popover.d.ts +8 -0
- package/types/components/RadioGroup/RadioGroup.d.ts +6 -0
- package/types/components/SegmentControl/SegmentControl.d.ts +8 -0
- package/types/components/Select/Select.d.ts +23 -0
- package/types/components/Stack/Stack.d.ts +0 -0
- package/types/components/Switch/Switch.d.ts +4 -0
- package/types/components/Text/Text.d.ts +39 -0
- package/types/components/Title/Title.d.ts +9 -0
- package/types/components/Toast/Toast.d.ts +16 -0
- package/types/components/Tooltip/IconTooltip.d.ts +8 -0
- package/types/components/Tooltip/Tooltip.d.ts +8 -0
- package/types/components/index.d.ts +21 -0
- package/types/helpers/index.d.ts +1 -0
- package/types/helpers/typeHelpers.d.ts +24 -0
- 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/)
|