@stordata/design-system 0.1.20260629080514
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 +66 -0
- package/dist/DSButton-BXD09god.js +8907 -0
- package/dist/DSProvider-DSGQ7C7X.js +59 -0
- package/dist/design-system.css +2 -0
- package/dist/lib/App/index.d.ts +1 -0
- package/dist/lib/App/index.js +491 -0
- package/dist/lib/DSAccordion/index.d.ts +20 -0
- package/dist/lib/DSAccordion/index.js +2 -0
- package/dist/lib/DSButton/index.d.ts +20 -0
- package/dist/lib/DSButton/index.js +2 -0
- package/dist/lib/DSCard/index.d.ts +14 -0
- package/dist/lib/DSCard/index.js +2 -0
- package/dist/lib/DSCheckbox/index.d.ts +17 -0
- package/dist/lib/DSCheckbox/index.js +2 -0
- package/dist/lib/DSCommonProps.d.ts +3 -0
- package/dist/lib/DSIcon/index.d.ts +14 -0
- package/dist/lib/DSIcon/index.js +2 -0
- package/dist/lib/DSInput/index.d.ts +50 -0
- package/dist/lib/DSInput/index.js +2 -0
- package/dist/lib/DSProvider/index.d.ts +19 -0
- package/dist/lib/DSProvider/index.js +2 -0
- package/dist/lib/DSRadio/index.d.ts +15 -0
- package/dist/lib/DSRadio/index.js +2 -0
- package/dist/lib/DSRadioGroup/index.d.ts +16 -0
- package/dist/lib/DSRadioGroup/index.js +2 -0
- package/dist/lib/DSSegmentedButton/index.d.ts +16 -0
- package/dist/lib/DSSegmentedButton/index.js +2 -0
- package/dist/lib/DSSelect/index.d.ts +18 -0
- package/dist/lib/DSSelect/index.js +2 -0
- package/dist/lib/DSSwitch/index.d.ts +16 -0
- package/dist/lib/DSSwitch/index.js +2 -0
- package/dist/lib/DSTypography/index.d.ts +12 -0
- package/dist/lib/DSTypography/index.js +2 -0
- package/package.json +107 -0
package/README.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Design System
|
|
2
|
+
|
|
3
|
+
Source of truth: https://zeroheight.com/239aea73f
|
|
4
|
+
|
|
5
|
+
## Conventions
|
|
6
|
+
|
|
7
|
+
### Implementation
|
|
8
|
+
|
|
9
|
+
A component should either
|
|
10
|
+
* Render a native HTML element, or
|
|
11
|
+
* Render a component provided by BaseUI
|
|
12
|
+
|
|
13
|
+
All components support the `render` prop from BaseUI. This prop is either forwarded to the root component, when rendering a
|
|
14
|
+
BaseUI component, or used through the `useRender` hook when rendering a native HTML element, allowing further customization.
|
|
15
|
+
|
|
16
|
+
All components support a set of common properties:
|
|
17
|
+
* id
|
|
18
|
+
* className
|
|
19
|
+
* style
|
|
20
|
+
* ref (a React ref)
|
|
21
|
+
|
|
22
|
+
When implementing a new component, you should
|
|
23
|
+
* Write a TypeScript interface for the component props, extending the common properties and `HTMLAttributes<T>` (or a sub-interface) to inherit default HTML props.
|
|
24
|
+
* Use the `useMergeProps` to merge default properties coming from the theme with the properties passed to the component.
|
|
25
|
+
* Add a section to the `Theme` interface for the default props of your new component, and choose default values.
|
|
26
|
+
|
|
27
|
+
#### Props
|
|
28
|
+
|
|
29
|
+
Except for component-specific props (like `variant`, `size`, etc.), all components should support spread props on the root element.
|
|
30
|
+
This is automatically handled by `useRender` when rendering a native HTML element, but needs to be manually done for BaseUI components.
|
|
31
|
+
This allows all native HTML props (like `style`, `onClick`, etc.) to be forwarded.
|
|
32
|
+
|
|
33
|
+
#### Refs
|
|
34
|
+
|
|
35
|
+
All components accept a `ref` that should always be used. Either
|
|
36
|
+
* Forwarded to a BaseUI component (all of them accept refs), or
|
|
37
|
+
* Given to `useRender` hook when rendering a native HTML element. See https://base-ui.com/react/utils/use-render#merging-refs
|
|
38
|
+
|
|
39
|
+
### Styling
|
|
40
|
+
|
|
41
|
+
Styling is done using a CSS module per component.
|
|
42
|
+
All CSS modules should always start with a root class, typically `.<component name>` that is applied to the root element of the component.
|
|
43
|
+
|
|
44
|
+
When typing common styling properties, such as `color` or `size`, please always define a TypeScript type for the property,
|
|
45
|
+
and use it in the component props interface. If the same set of values as the common ones is supported, you can use a type alias.
|
|
46
|
+
|
|
47
|
+
For instance
|
|
48
|
+
```typescript
|
|
49
|
+
export type DSMyComponentSize = ComponentSize;
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
#### Sizing
|
|
53
|
+
|
|
54
|
+
When applicable, components should support a `size` property that can be set to small, medium or large. The default size is medium.
|
|
55
|
+
In the component's CSS module, `.small`, `.medium` and `.large` classes should be defined to apply the appropriate styles for each size.
|
|
56
|
+
When rendering the component, use the `classNames` utility to apply the appropriate size class based on the `size` property.
|
|
57
|
+
|
|
58
|
+
:bulb: It's OK to only support a subset of the available sizes.
|
|
59
|
+
|
|
60
|
+
#### Variants
|
|
61
|
+
|
|
62
|
+
When applicable, components should support a `variant` property that can be set to primary, secondary or tertiary. The default variant is primary.
|
|
63
|
+
In the component's CSS module, `.primary`, `.secondary` and `.tertiary` classes should be defined to apply the appropriate styles for each variant.
|
|
64
|
+
When rendering the component, use the `classNames` utility to apply the appropriate variant class based on the `variant` property.
|
|
65
|
+
|
|
66
|
+
:bulb: It's OK to only support a subset of the available variants.
|