@techsio/ui-kit 0.0.0
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 +165 -0
- package/dist/atoms/badge.js +66 -0
- package/dist/atoms/button.js +275 -0
- package/dist/atoms/error-text.js +38 -0
- package/dist/atoms/extra-text.js +27 -0
- package/dist/atoms/icon.js +42 -0
- package/dist/atoms/image.js +11 -0
- package/dist/atoms/input.js +83 -0
- package/dist/atoms/label.js +43 -0
- package/dist/atoms/link-button.js +51 -0
- package/dist/atoms/link.js +23 -0
- package/dist/atoms/numeric-input.js +221 -0
- package/dist/atoms/rating.js +117 -0
- package/dist/atoms/textarea.js +81 -0
- package/dist/atoms/tooltip.js +119 -0
- package/dist/molecules/accordion.js +245 -0
- package/dist/molecules/breadcrumb.js +168 -0
- package/dist/molecules/carousel.js +333 -0
- package/dist/molecules/checkbox.js +92 -0
- package/dist/molecules/color-select.js +159 -0
- package/dist/molecules/combobox.js +253 -0
- package/dist/molecules/dialog.js +313 -0
- package/dist/molecules/form-checkbox.js +59 -0
- package/dist/molecules/form-input.js +55 -0
- package/dist/molecules/form-numeric-input.js +47 -0
- package/dist/molecules/form-textarea.js +54 -0
- package/dist/molecules/menu.js +302 -0
- package/dist/molecules/pagination.js +184 -0
- package/dist/molecules/popover.js +152 -0
- package/dist/molecules/product-card.js +194 -0
- package/dist/molecules/search-form.js +106 -0
- package/dist/molecules/select.js +217 -0
- package/dist/molecules/slider.js +249 -0
- package/dist/molecules/steps.js +178 -0
- package/dist/molecules/switch.js +109 -0
- package/dist/molecules/tabs.js +211 -0
- package/dist/molecules/toast.js +126 -0
- package/dist/molecules/tree-view.js +451 -0
- package/dist/organisms/footer.js +209 -0
- package/dist/organisms/header.js +245 -0
- package/dist/organisms/table.js +233 -0
- package/dist/src/atoms/badge.d.ts +59 -0
- package/dist/src/atoms/badge.d.ts.map +1 -0
- package/dist/src/atoms/button.d.ts +97 -0
- package/dist/src/atoms/button.d.ts.map +1 -0
- package/dist/src/atoms/error-text.d.ts +29 -0
- package/dist/src/atoms/error-text.d.ts.map +1 -0
- package/dist/src/atoms/extra-text.d.ts +27 -0
- package/dist/src/atoms/extra-text.d.ts.map +1 -0
- package/dist/src/atoms/icon.d.ts +65 -0
- package/dist/src/atoms/icon.d.ts.map +1 -0
- package/dist/src/atoms/image.d.ts +17 -0
- package/dist/src/atoms/image.d.ts.map +1 -0
- package/dist/src/atoms/input.d.ts +78 -0
- package/dist/src/atoms/input.d.ts.map +1 -0
- package/dist/src/atoms/label.d.ts +41 -0
- package/dist/src/atoms/label.d.ts.map +1 -0
- package/dist/src/atoms/link-button.d.ts +129 -0
- package/dist/src/atoms/link-button.d.ts.map +1 -0
- package/dist/src/atoms/link.d.ts +17 -0
- package/dist/src/atoms/link.d.ts.map +1 -0
- package/dist/src/atoms/numeric-input.d.ts +64 -0
- package/dist/src/atoms/numeric-input.d.ts.map +1 -0
- package/dist/src/atoms/rating.d.ts +108 -0
- package/dist/src/atoms/rating.d.ts.map +1 -0
- package/dist/src/atoms/textarea.d.ts +81 -0
- package/dist/src/atoms/textarea.d.ts.map +1 -0
- package/dist/src/atoms/tooltip.d.ts +88 -0
- package/dist/src/atoms/tooltip.d.ts.map +1 -0
- package/dist/src/molecules/accordion.d.ts +182 -0
- package/dist/src/molecules/accordion.d.ts.map +1 -0
- package/dist/src/molecules/breadcrumb.d.ts +117 -0
- package/dist/src/molecules/breadcrumb.d.ts.map +1 -0
- package/dist/src/molecules/carousel.d.ts +261 -0
- package/dist/src/molecules/carousel.d.ts.map +1 -0
- package/dist/src/molecules/checkbox.d.ts +19 -0
- package/dist/src/molecules/checkbox.d.ts.map +1 -0
- package/dist/src/molecules/color-select.d.ts +20 -0
- package/dist/src/molecules/color-select.d.ts.map +1 -0
- package/dist/src/molecules/combobox.d.ts +141 -0
- package/dist/src/molecules/combobox.d.ts.map +1 -0
- package/dist/src/molecules/dialog.d.ts +234 -0
- package/dist/src/molecules/dialog.d.ts.map +1 -0
- package/dist/src/molecules/form-checkbox.d.ts +15 -0
- package/dist/src/molecules/form-checkbox.d.ts.map +1 -0
- package/dist/src/molecules/form-input.d.ts +14 -0
- package/dist/src/molecules/form-input.d.ts.map +1 -0
- package/dist/src/molecules/form-numeric-input.d.ts +14 -0
- package/dist/src/molecules/form-numeric-input.d.ts.map +1 -0
- package/dist/src/molecules/form-textarea.d.ts +14 -0
- package/dist/src/molecules/form-textarea.d.ts.map +1 -0
- package/dist/src/molecules/menu.d.ts +153 -0
- package/dist/src/molecules/menu.d.ts.map +1 -0
- package/dist/src/molecules/pagination.d.ts +123 -0
- package/dist/src/molecules/pagination.d.ts.map +1 -0
- package/dist/src/molecules/popover.d.ts +124 -0
- package/dist/src/molecules/popover.d.ts.map +1 -0
- package/dist/src/molecules/product-card.d.ts +160 -0
- package/dist/src/molecules/product-card.d.ts.map +1 -0
- package/dist/src/molecules/search-form.d.ts +39 -0
- package/dist/src/molecules/search-form.d.ts.map +1 -0
- package/dist/src/molecules/select.d.ts +126 -0
- package/dist/src/molecules/select.d.ts.map +1 -0
- package/dist/src/molecules/slider.d.ts +120 -0
- package/dist/src/molecules/slider.d.ts.map +1 -0
- package/dist/src/molecules/steps.d.ts +96 -0
- package/dist/src/molecules/steps.d.ts.map +1 -0
- package/dist/src/molecules/switch.d.ts +71 -0
- package/dist/src/molecules/switch.d.ts.map +1 -0
- package/dist/src/molecules/tabs.d.ts +207 -0
- package/dist/src/molecules/tabs.d.ts.map +1 -0
- package/dist/src/molecules/toast.d.ts +83 -0
- package/dist/src/molecules/toast.d.ts.map +1 -0
- package/dist/src/molecules/tree-view.d.ts +202 -0
- package/dist/src/molecules/tree-view.d.ts.map +1 -0
- package/dist/src/organisms/footer.d.ts +254 -0
- package/dist/src/organisms/footer.d.ts.map +1 -0
- package/dist/src/organisms/header.d.ts +186 -0
- package/dist/src/organisms/header.d.ts.map +1 -0
- package/dist/src/organisms/table.d.ts +250 -0
- package/dist/src/organisms/table.d.ts.map +1 -0
- package/dist/src/templates/accordion.d.ts +15 -0
- package/dist/src/templates/accordion.d.ts.map +1 -0
- package/dist/src/templates/carousel.d.ts +13 -0
- package/dist/src/templates/carousel.d.ts.map +1 -0
- package/dist/src/templates/numeric-input.d.ts +14 -0
- package/dist/src/templates/numeric-input.d.ts.map +1 -0
- package/dist/src/templates/product-card.d.ts +33 -0
- package/dist/src/templates/product-card.d.ts.map +1 -0
- package/dist/src/templates/tabs.d.ts +16 -0
- package/dist/src/templates/tabs.d.ts.map +1 -0
- package/dist/src/types/zag.d.ts +19 -0
- package/dist/src/types/zag.d.ts.map +1 -0
- package/dist/src/utils.d.ts +4 -0
- package/dist/src/utils.d.ts.map +1 -0
- package/dist/templates/accordion.js +37 -0
- package/dist/templates/carousel.js +55 -0
- package/dist/templates/numeric-input.js +49 -0
- package/dist/templates/product-card.js +92 -0
- package/dist/templates/tabs.js +34 -0
- package/dist/types/zag.js +0 -0
- package/dist/utils.js +20 -0
- package/package.json +126 -0
- package/src/tokens/_base.css +25 -0
- package/src/tokens/_colors.css +5 -0
- package/src/tokens/_layout.css +34 -0
- package/src/tokens/_semantic.css +360 -0
- package/src/tokens/_spacing.css +22 -0
- package/src/tokens/_typography.css +17 -0
- package/src/tokens/components/atoms/_badge.css +61 -0
- package/src/tokens/components/atoms/_button.css +215 -0
- package/src/tokens/components/atoms/_icon.css +122 -0
- package/src/tokens/components/atoms/_input.css +125 -0
- package/src/tokens/components/atoms/_numeric-input.css +57 -0
- package/src/tokens/components/atoms/_rating.css +33 -0
- package/src/tokens/components/atoms/_textarea.css +93 -0
- package/src/tokens/components/atoms/_tooltip.css +21 -0
- package/src/tokens/components/components.css +32 -0
- package/src/tokens/components/molecules/_accordion.css +85 -0
- package/src/tokens/components/molecules/_breadcrumb.css +44 -0
- package/src/tokens/components/molecules/_carousel.css +72 -0
- package/src/tokens/components/molecules/_checkbox.css +29 -0
- package/src/tokens/components/molecules/_color-select.css +61 -0
- package/src/tokens/components/molecules/_combobox.css +116 -0
- package/src/tokens/components/molecules/_dialog.css +75 -0
- package/src/tokens/components/molecules/_menu.css +48 -0
- package/src/tokens/components/molecules/_pagination.css +75 -0
- package/src/tokens/components/molecules/_popover.css +39 -0
- package/src/tokens/components/molecules/_product-card.css +85 -0
- package/src/tokens/components/molecules/_search-form.css +10 -0
- package/src/tokens/components/molecules/_select.css +88 -0
- package/src/tokens/components/molecules/_slider.css +75 -0
- package/src/tokens/components/molecules/_steps.css +54 -0
- package/src/tokens/components/molecules/_switch.css +62 -0
- package/src/tokens/components/molecules/_tabs.css +69 -0
- package/src/tokens/components/molecules/_toast.css +77 -0
- package/src/tokens/components/molecules/_tree-view.css +80 -0
- package/src/tokens/components/molecules/index.css +2 -0
- package/src/tokens/components/organisms/_footer.css +90 -0
- package/src/tokens/components/organisms/_header.css +86 -0
- package/src/tokens/components/organisms/_table.css +63 -0
- package/src/tokens/index.css +67 -0
- package/src/tokens/tokens-only.css +66 -0
package/README.md
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# Web Revolution UI Library – Design System README
|
|
2
|
+
|
|
3
|
+
Welcome to the Web Revolution UI Library! This guide explains our design system’s fundamentals, folder structure, theming, and customization rules. Follow these guidelines to keep our system consistent, flexible, and easy to maintain.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Overview
|
|
8
|
+
|
|
9
|
+
Our design system is built with **Tailwind CSS v4** and React. It uses a **multi-layered design token approach** to control all colors, spacing, typography, and other visual aspects. We maintain one shared UI library, and we allow brand-specific customizations via a dedicated `brands` folder inside the library.
|
|
10
|
+
|
|
11
|
+
**Key Points:**
|
|
12
|
+
|
|
13
|
+
- **Multi-layered design tokens:** We separate tokens into three layers: global, semantic, and component.
|
|
14
|
+
- **Single UI library:** All shared components live in one library (e.g. `ui`).
|
|
15
|
+
- **Centralized CSS Variables:** All design tokens (CSS variables) are defined in one central place.
|
|
16
|
+
- **Hybrid Structure:** Our UI library is organized into atoms, molecules, and domain-based organisms. Basic components (like buttons) are atoms or molecules; only composite, domain-specific components go into organisms.
|
|
17
|
+
- **Clear Boundaries:** For example, a button is an atom or molecule. We never export a button from an organism.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 2. Design Tokens
|
|
22
|
+
|
|
23
|
+
### Multi-Layered Tokens
|
|
24
|
+
|
|
25
|
+
1. **Global Tokens:**
|
|
26
|
+
- These are the raw design values (like our base color palette, spacing scales, etc.).
|
|
27
|
+
- They are defined in our central tokens files (e.g. `_colors.css`, `_spacing.css`).
|
|
28
|
+
2. **Semantic Tokens:**
|
|
29
|
+
- These give meaning to global tokens by mapping them to their design role.
|
|
30
|
+
- For example, `-color-brand-primary` maps to a global blue value.
|
|
31
|
+
- All components will use semantic tokens rather than raw values.
|
|
32
|
+
3. **Component Tokens:**
|
|
33
|
+
- These are defined for each component and act as a layer between the component and semantic tokens.
|
|
34
|
+
- For example, a Button component uses `-button-bg` which is set to `var(--color-brand-primary)`.
|
|
35
|
+
- **Important:** All component tokens are defined centrally, not near the component code.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## 3. Folder Structure
|
|
40
|
+
|
|
41
|
+
Our UI library follows a hybrid approach with three main parts:
|
|
42
|
+
|
|
43
|
+
### A. Basic Components (Atoms & Molecules)
|
|
44
|
+
|
|
45
|
+
- **Atoms:**
|
|
46
|
+
Small, reusable components such as buttons, inputs, icons, etc.
|
|
47
|
+
- **Molecules:**
|
|
48
|
+
Simple combinations of atoms like form groups or card headers.
|
|
49
|
+
|
|
50
|
+
These live in folders such as:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
ui/atoms/
|
|
54
|
+
ui/molecules/
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### B. Domain-Based Organisms
|
|
59
|
+
|
|
60
|
+
- **Organisms:**
|
|
61
|
+
Larger, composite components that are specific to a business domain (e.g. cart, checkout, navigation).**Note:** Organisms should not export basic building blocks like buttons. If you need a button, use the atom or molecule from the appropriate folder.
|
|
62
|
+
|
|
63
|
+
Organisms are organized by domain:
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
ui/organisms/cart/
|
|
67
|
+
ui/organisms/checkout/
|
|
68
|
+
ui/organisms/navigation/
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### C. Brand Customizations
|
|
73
|
+
|
|
74
|
+
- **Brands Folder:**
|
|
75
|
+
Custom, brand-specific overrides live in a dedicated folder. For example, if a brand needs a special Header, its custom component will live under:
|
|
76
|
+
This keeps the shared UI library clean while allowing brands to override only what they need.
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
ui/brands/customer-a/
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
> Note: Always use kebab-case for folder and component filenames. For example, use customer-a instead of customerA.
|
|
85
|
+
>
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## 4. Theming and CSS Variables
|
|
90
|
+
|
|
91
|
+
### Centralized Tokens
|
|
92
|
+
|
|
93
|
+
- **All CSS Variables:**
|
|
94
|
+
We define all our design tokens in one central set of CSS files (e.g. in the `tokens/` directory). Do not scatter token definitions next to component code.
|
|
95
|
+
- **Optional Default Theme:**
|
|
96
|
+
We support a “default theme” file that you can import if you want to start with predefined values. However, the core system is theme-agnostic: our self-referencing palette contains only semantic tokens. If you want the default look, import the default theme; otherwise, you can define your own theme based on the semantic tokens.
|
|
97
|
+
- **Using Tailwind’s `@theme`:**
|
|
98
|
+
Our CSS token files use Tailwind’s `@theme` block to generate CSS variables, ensuring consistency with our Tailwind utilities.
|
|
99
|
+
|
|
100
|
+
### How Overrides Work
|
|
101
|
+
|
|
102
|
+
- Brand-specific override files (e.g. `ui/brands/customer-a/theme.css`) can override any semantic token.
|
|
103
|
+
- In your app’s main CSS, import the global tokens first, then the brand override file. This cascade ensures that the brand’s values override the defaults.
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## 5. Development Guidelines
|
|
108
|
+
|
|
109
|
+
### Component Development
|
|
110
|
+
|
|
111
|
+
- **Use Tokens Exclusively:**
|
|
112
|
+
Always use component tokens (e.g. `-button-bg`) in your styles. Do not use semantic tokens directly in component code.
|
|
113
|
+
- **Keep It Simple:**
|
|
114
|
+
Build your atoms and molecules first. Organisms are domain-specific composites and should use the shared atoms/molecules.
|
|
115
|
+
- **Export Only Where Appropriate:**
|
|
116
|
+
For example, if a component is basic (like a Button), it belongs in atoms or molecules. Never export a Button from an organism.
|
|
117
|
+
|
|
118
|
+
### Brand Customizations
|
|
119
|
+
|
|
120
|
+
- **Custom Components:**
|
|
121
|
+
If a customer needs a completely custom component, add it to the `brands/` folder. Do not modify the core shared components.
|
|
122
|
+
- **Override Process:**
|
|
123
|
+
When overriding, create a file in the brand folder and map the semantic tokens to the custom values. This way, the core remains untouched.
|
|
124
|
+
|
|
125
|
+
### Documentation
|
|
126
|
+
|
|
127
|
+
- We use **Storybook** for our component documentation and previews (for now). We may add other documentation tools later.
|
|
128
|
+
- Our documentation explains all tokens, component usage, and override guidelines. Please refer to Storybook for live examples and further details.
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## 6. Quick Reference
|
|
133
|
+
|
|
134
|
+
- **Design Tokens:**
|
|
135
|
+
- Global Tokens: Defined in `tokens/_*.css` files.
|
|
136
|
+
- Semantic Tokens: Map global tokens to design roles (e.g. `-color-brand-primary`).
|
|
137
|
+
- Component Tokens: Defined centrally; used in component styling (e.g. `-button-bg`).
|
|
138
|
+
- **Folder Organization:**
|
|
139
|
+
- **Atoms/Molecules:** `ui/atoms/` and `ui/molecules/`
|
|
140
|
+
- **Organisms:** Domain-based (e.g. `ui/organisms/cart/`)
|
|
141
|
+
- **Brands:** Overrides and customizations (e.g. `ui/brands/customer-a/`)
|
|
142
|
+
- **Theming:**
|
|
143
|
+
|
|
144
|
+
Import tokens first, then any default or brand-specific theme overrides in your main CSS file.
|
|
145
|
+
|
|
146
|
+
- **Guidelines:**
|
|
147
|
+
- Always use the token system.
|
|
148
|
+
- Never mix token definitions with component code.
|
|
149
|
+
- Keep overrides in dedicated brand folders.
|
|
150
|
+
- Basic components (e.g., Button) belong only in atoms/molecules.
|
|
151
|
+
|
|
152
|
+
## 7. Publishing and releases
|
|
153
|
+
|
|
154
|
+
- Build + publint: `pnpm -C libs/ui build` runs `rsbuild-plugin-publint` after the build; if exports/entrypoints are wrong, this command fails.
|
|
155
|
+
- Exports only, no barrel: import from explicit subpaths (e.g. `@techsio/ui-kit/atoms/button`, `@techsio/ui-kit/templates/accordion`, `@techsio/ui-kit/utils`). The package root is intentionally not exported.
|
|
156
|
+
- Automated releases: `libs/ui/release.config.mjs` uses semantic-release (tag format `ui-kit-v<version>`) to bump versions, update changelog, and publish to npm. While we are <1.0.0, `BREAKING CHANGE` commits are forced to “minor” bumps to stay in 0.x; remove that release rule when stabilizing for 1.0.0+ to restore SemVer majors.
|
|
157
|
+
- Security posture: releases are restricted to GitHub Actions (`GITHUB_ACTIONS` required), npm publishes use provenance (`NPM_CONFIG_PROVENANCE=true`), and tokens live only in Actions secrets (`GH_TOKEN`, `NPM_TOKEN`). Keep secrets in a protected environment for extra safety.
|
|
158
|
+
- CI workflow: `.github/workflows/ui-release.yml` builds `libs/ui` and runs semantic-release on `master`/`main` with `GH_TOKEN` and `NPM_TOKEN` secrets.
|
|
159
|
+
- Local dry run: `pnpm -C libs/ui semantic-release --dry-run`.
|
|
160
|
+
- Commit format: follow Conventional Commits (`feat:`, `fix:`, `chore:`, `BREAKING CHANGE:`) so semantic-release can infer the correct version bump.
|
|
161
|
+
- Required CI secrets: `GH_TOKEN` (repo write) and `NPM_TOKEN` (publish).
|
|
162
|
+
|
|
163
|
+
## 8. Conclusion
|
|
164
|
+
|
|
165
|
+
This README serves as the single source of truth for building and maintaining our design system. By adhering to these guidelines, you ensure that our UI remains consistent, flexible, and scalable across multiple brands. If you have any questions or suggestions, please reach out to the design system team.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { tv } from "../utils.js";
|
|
3
|
+
const badgeVariants = tv({
|
|
4
|
+
base: [
|
|
5
|
+
'inline-flex items-center justify-center',
|
|
6
|
+
'p-badge',
|
|
7
|
+
'rounded-badge border-badge-border',
|
|
8
|
+
'text-badge-size font-badge',
|
|
9
|
+
'border-(length:--border-width-badge-dynamic)'
|
|
10
|
+
],
|
|
11
|
+
variants: {
|
|
12
|
+
variant: {
|
|
13
|
+
primary: [
|
|
14
|
+
'bg-badge-bg-primary text-badge-fg-primary border-badge-border-primary'
|
|
15
|
+
],
|
|
16
|
+
secondary: [
|
|
17
|
+
'bg-badge-bg-secondary text-badge-fg-secondary border-badge-border-secondary'
|
|
18
|
+
],
|
|
19
|
+
tertiary: [
|
|
20
|
+
'bg-badge-bg-tertiary text-badge-fg-tertiary border-badge-border-tertiary'
|
|
21
|
+
],
|
|
22
|
+
discount: [
|
|
23
|
+
'bg-badge-bg-discount text-badge-fg-discount border-badge-border-discount'
|
|
24
|
+
],
|
|
25
|
+
info: [
|
|
26
|
+
'bg-badge-bg-info text-badge-fg-info border-badge-border-info'
|
|
27
|
+
],
|
|
28
|
+
success: [
|
|
29
|
+
'bg-badge-bg-success text-badge-fg-success border-badge-border-success'
|
|
30
|
+
],
|
|
31
|
+
warning: [
|
|
32
|
+
'bg-badge-bg-warning text-badge-fg-warning border-badge-border-warning'
|
|
33
|
+
],
|
|
34
|
+
danger: [
|
|
35
|
+
'bg-badge-bg-danger text-badge-fg-danger border-badge-border-danger'
|
|
36
|
+
],
|
|
37
|
+
outline: [
|
|
38
|
+
'bg-badge-bg-outline text-badge-fg-outline border-badge-border-outline'
|
|
39
|
+
],
|
|
40
|
+
dynamic: []
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
defaultVariants: {
|
|
44
|
+
variant: 'info'
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
function Badge({ variant, className, children, style, ...props }) {
|
|
48
|
+
const isDynamic = 'dynamic' === variant;
|
|
49
|
+
const { bgColor, fgColor, borderColor, ...restProps } = props;
|
|
50
|
+
const dynamicStyles = isDynamic ? {
|
|
51
|
+
...style,
|
|
52
|
+
'background-color': bgColor,
|
|
53
|
+
color: fgColor,
|
|
54
|
+
'border-color': borderColor
|
|
55
|
+
} : style;
|
|
56
|
+
return /*#__PURE__*/ jsx("span", {
|
|
57
|
+
className: badgeVariants({
|
|
58
|
+
variant,
|
|
59
|
+
className
|
|
60
|
+
}),
|
|
61
|
+
style: dynamicStyles,
|
|
62
|
+
...restProps,
|
|
63
|
+
children: children
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
export { Badge };
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { tv } from "../utils.js";
|
|
3
|
+
import { Icon } from "./icon.js";
|
|
4
|
+
const buttonVariants = tv({
|
|
5
|
+
base: [
|
|
6
|
+
'relative',
|
|
7
|
+
'inline-flex items-baseline justify-center cursor-pointer',
|
|
8
|
+
'font-medium',
|
|
9
|
+
'transition-all duration-200',
|
|
10
|
+
'focus:outline-none',
|
|
11
|
+
'focus-visible:ring',
|
|
12
|
+
'focus-visible:ring-button-ring',
|
|
13
|
+
'disabled:text-button-fg-disabled disabled:pointer-events-none'
|
|
14
|
+
],
|
|
15
|
+
variants: {
|
|
16
|
+
variant: {
|
|
17
|
+
primary: '',
|
|
18
|
+
secondary: '',
|
|
19
|
+
tertiary: '',
|
|
20
|
+
danger: '',
|
|
21
|
+
warning: ''
|
|
22
|
+
},
|
|
23
|
+
theme: {
|
|
24
|
+
solid: 'disabled:bg-button-bg-disabled',
|
|
25
|
+
light: 'disabled:bg-button-bg-disabled',
|
|
26
|
+
borderless: 'bg-button-bg-borderless hover:bg-button-bg-borderless-hover active:bg-button-bg-borderless-active',
|
|
27
|
+
outlined: 'border disabled:border-button-border-disabled',
|
|
28
|
+
unstyled: ''
|
|
29
|
+
},
|
|
30
|
+
uppercase: {
|
|
31
|
+
true: 'uppercase'
|
|
32
|
+
},
|
|
33
|
+
size: {
|
|
34
|
+
sm: 'p-button-sm text-button-sm rounded-button-sm gap-button-sm',
|
|
35
|
+
md: 'p-button-md text-button-md rounded-button-md gap-button-md',
|
|
36
|
+
lg: 'p-button-lg text-button-lg rounded-button-lg gap-button-lg',
|
|
37
|
+
current: 'text-inherit gap-button-md'
|
|
38
|
+
},
|
|
39
|
+
block: {
|
|
40
|
+
true: 'w-full'
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
compoundVariants: [
|
|
44
|
+
{
|
|
45
|
+
variant: 'primary',
|
|
46
|
+
theme: 'solid',
|
|
47
|
+
className: [
|
|
48
|
+
'bg-button-bg-primary',
|
|
49
|
+
'hover:bg-button-bg-primary-hover',
|
|
50
|
+
'active:bg-button-bg-primary-active',
|
|
51
|
+
'text-button-fg-primary'
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
variant: 'secondary',
|
|
56
|
+
theme: 'solid',
|
|
57
|
+
className: [
|
|
58
|
+
'bg-button-bg-secondary',
|
|
59
|
+
'hover:bg-button-bg-secondary-hover',
|
|
60
|
+
'active:bg-button-bg-secondary-active',
|
|
61
|
+
'text-button-fg-secondary'
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
variant: 'tertiary',
|
|
66
|
+
theme: 'solid',
|
|
67
|
+
className: [
|
|
68
|
+
'bg-button-bg-tertiary',
|
|
69
|
+
'hover:bg-button-bg-tertiary-hover',
|
|
70
|
+
'active:bg-button-bg-tertiary-active',
|
|
71
|
+
'text-button-fg-tertiary'
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
variant: 'warning',
|
|
76
|
+
theme: 'solid',
|
|
77
|
+
className: [
|
|
78
|
+
'bg-button-bg-warning',
|
|
79
|
+
'hover:bg-button-bg-warning-hover',
|
|
80
|
+
'active:bg-button-bg-warning-active',
|
|
81
|
+
'text-button-fg-warning'
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
variant: 'danger',
|
|
86
|
+
theme: 'solid',
|
|
87
|
+
className: [
|
|
88
|
+
'bg-button-bg-danger',
|
|
89
|
+
'hover:bg-button-bg-danger-hover',
|
|
90
|
+
'active:bg-button-bg-danger-active',
|
|
91
|
+
'text-button-fg-danger'
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
variant: 'primary',
|
|
96
|
+
theme: 'light',
|
|
97
|
+
className: [
|
|
98
|
+
'bg-button-bg-primary-light',
|
|
99
|
+
'hover:bg-button-bg-primary-light-hover',
|
|
100
|
+
'active:bg-button-bg-primary-light-active',
|
|
101
|
+
'text-button-fg-primary-light'
|
|
102
|
+
]
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
variant: 'secondary',
|
|
106
|
+
theme: 'light',
|
|
107
|
+
className: [
|
|
108
|
+
'bg-button-bg-secondary-light',
|
|
109
|
+
'hover:bg-button-bg-secondary-light-hover',
|
|
110
|
+
'active:bg-button-bg-secondary-light-active',
|
|
111
|
+
'text-button-fg-secondary-light'
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
variant: 'tertiary',
|
|
116
|
+
theme: 'light',
|
|
117
|
+
className: [
|
|
118
|
+
'bg-button-bg-tertiary-light',
|
|
119
|
+
'hover:bg-button-bg-tertiary-light-hover',
|
|
120
|
+
'active:bg-button-bg-tertiary-light-active',
|
|
121
|
+
'text-button-fg-tertiary-light'
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
variant: 'warning',
|
|
126
|
+
theme: 'light',
|
|
127
|
+
className: [
|
|
128
|
+
'bg-button-bg-warning-light',
|
|
129
|
+
'hover:bg-button-bg-warning-light-hover',
|
|
130
|
+
'active:bg-button-bg-warning-light-active',
|
|
131
|
+
'text-button-fg-warning-light'
|
|
132
|
+
]
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
variant: 'danger',
|
|
136
|
+
theme: 'light',
|
|
137
|
+
className: [
|
|
138
|
+
'bg-button-bg-danger-light',
|
|
139
|
+
'hover:bg-button-bg-danger-light-hover',
|
|
140
|
+
'active:bg-button-bg-danger-light-active',
|
|
141
|
+
'text-button-fg-danger-light'
|
|
142
|
+
]
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
variant: 'primary',
|
|
146
|
+
theme: 'outlined',
|
|
147
|
+
className: [
|
|
148
|
+
'border-button-border-primary',
|
|
149
|
+
'hover:bg-button-bg-outlined-primary-hover',
|
|
150
|
+
'active:bg-button-bg-outlined-primary-active',
|
|
151
|
+
'text-button-fg-outlined-primary'
|
|
152
|
+
]
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
variant: 'secondary',
|
|
156
|
+
theme: 'outlined',
|
|
157
|
+
className: [
|
|
158
|
+
'border-button-border-secondary',
|
|
159
|
+
'hover:bg-button-bg-outlined-secondary-hover',
|
|
160
|
+
'active:bg-button-bg-outlined-secondary-active',
|
|
161
|
+
'text-button-fg-outlined-secondary'
|
|
162
|
+
]
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
variant: 'tertiary',
|
|
166
|
+
theme: 'outlined',
|
|
167
|
+
className: [
|
|
168
|
+
'border-button-border-tertiary',
|
|
169
|
+
'hover:bg-button-bg-outlined-tertiary-hover',
|
|
170
|
+
'active:bg-button-bg-outlined-tertiary-active',
|
|
171
|
+
'text-button-fg-outlined-tertiary'
|
|
172
|
+
]
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
variant: 'warning',
|
|
176
|
+
theme: 'outlined',
|
|
177
|
+
className: [
|
|
178
|
+
'border-button-border-warning',
|
|
179
|
+
'hover:bg-button-bg-outlined-warning-hover',
|
|
180
|
+
'active:bg-button-bg-outlined-warning-active',
|
|
181
|
+
'text-button-fg-outlined-warning'
|
|
182
|
+
]
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
variant: 'danger',
|
|
186
|
+
theme: 'outlined',
|
|
187
|
+
className: [
|
|
188
|
+
'border-button-border-danger',
|
|
189
|
+
'hover:bg-button-bg-outlined-danger-hover',
|
|
190
|
+
'active:bg-button-bg-outlined-danger-active',
|
|
191
|
+
'text-button-fg-outlined-danger'
|
|
192
|
+
]
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
variant: 'primary',
|
|
196
|
+
theme: 'borderless',
|
|
197
|
+
className: [
|
|
198
|
+
'text-button-fg-primary-borderless'
|
|
199
|
+
]
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
variant: 'secondary',
|
|
203
|
+
theme: 'borderless',
|
|
204
|
+
className: [
|
|
205
|
+
'text-button-fg-secondary-borderless'
|
|
206
|
+
]
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
variant: 'tertiary',
|
|
210
|
+
theme: 'borderless',
|
|
211
|
+
className: [
|
|
212
|
+
'text-button-fg-tertiary-borderless'
|
|
213
|
+
]
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
variant: 'warning',
|
|
217
|
+
theme: 'borderless',
|
|
218
|
+
className: [
|
|
219
|
+
'text-button-fg-warning-borderless'
|
|
220
|
+
]
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
variant: 'danger',
|
|
224
|
+
theme: 'borderless',
|
|
225
|
+
className: [
|
|
226
|
+
'text-button-fg-danger-borderless'
|
|
227
|
+
]
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
theme: 'outlined',
|
|
231
|
+
size: 'sm',
|
|
232
|
+
className: 'border-(length:--border-button-width-sm)'
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
theme: 'outlined',
|
|
236
|
+
size: 'md',
|
|
237
|
+
className: 'border-(length:--border-button-width-md)'
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
theme: 'outlined',
|
|
241
|
+
size: 'lg',
|
|
242
|
+
className: 'border-(length:--border-button-width-lg)'
|
|
243
|
+
}
|
|
244
|
+
],
|
|
245
|
+
defaultVariants: {
|
|
246
|
+
variant: 'primary',
|
|
247
|
+
theme: 'solid',
|
|
248
|
+
size: 'md',
|
|
249
|
+
light: false
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
function Button({ variant, theme, size, block, isLoading, icon, iconPosition = 'left', uppercase = false, children, className, ...props }) {
|
|
253
|
+
return /*#__PURE__*/ jsxs("button", {
|
|
254
|
+
className: buttonVariants({
|
|
255
|
+
variant,
|
|
256
|
+
theme,
|
|
257
|
+
size,
|
|
258
|
+
block,
|
|
259
|
+
uppercase,
|
|
260
|
+
className
|
|
261
|
+
}),
|
|
262
|
+
disabled: isLoading,
|
|
263
|
+
...props,
|
|
264
|
+
children: [
|
|
265
|
+
icon && 'left' === iconPosition && /*#__PURE__*/ jsx(Icon, {
|
|
266
|
+
icon: icon
|
|
267
|
+
}),
|
|
268
|
+
children,
|
|
269
|
+
icon && 'right' === iconPosition && /*#__PURE__*/ jsx(Icon, {
|
|
270
|
+
icon: icon
|
|
271
|
+
})
|
|
272
|
+
]
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { tv } from "../utils.js";
|
|
3
|
+
import { Icon } from "./icon.js";
|
|
4
|
+
const errorVariants = tv({
|
|
5
|
+
base: [
|
|
6
|
+
'text-error-fg',
|
|
7
|
+
'flex items-center gap-1'
|
|
8
|
+
],
|
|
9
|
+
variants: {
|
|
10
|
+
size: {
|
|
11
|
+
sm: 'text-error-sm',
|
|
12
|
+
md: 'text-error-md',
|
|
13
|
+
lg: 'text-error-lg'
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
defaultVariants: {
|
|
17
|
+
size: 'md'
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
function ErrorText({ className, showIcon, children, ref, size, ...props }) {
|
|
21
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
22
|
+
ref: ref,
|
|
23
|
+
className: errorVariants({
|
|
24
|
+
size,
|
|
25
|
+
className
|
|
26
|
+
}),
|
|
27
|
+
...props,
|
|
28
|
+
children: [
|
|
29
|
+
showIcon && /*#__PURE__*/ jsx(Icon, {
|
|
30
|
+
icon: "token-icon-error"
|
|
31
|
+
}),
|
|
32
|
+
/*#__PURE__*/ jsx("span", {
|
|
33
|
+
children: children
|
|
34
|
+
})
|
|
35
|
+
]
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
export { ErrorText };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { tv } from "../utils.js";
|
|
3
|
+
const extraTextVariants = tv({
|
|
4
|
+
base: [
|
|
5
|
+
'text-helper-fg'
|
|
6
|
+
],
|
|
7
|
+
variants: {
|
|
8
|
+
size: {
|
|
9
|
+
sm: 'text-helper-sm',
|
|
10
|
+
md: 'text-helper-md',
|
|
11
|
+
lg: 'text-helper-lg'
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: {
|
|
15
|
+
size: 'md'
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
function ExtraText({ children, size, ...props }) {
|
|
19
|
+
return /*#__PURE__*/ jsx("span", {
|
|
20
|
+
className: extraTextVariants({
|
|
21
|
+
size
|
|
22
|
+
}),
|
|
23
|
+
...props,
|
|
24
|
+
children: children
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export { ExtraText };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { tv } from "../utils.js";
|
|
3
|
+
const iconVariants = tv({
|
|
4
|
+
base: [
|
|
5
|
+
'inline-block flex-shrink-0 align-middle leading-none self-center'
|
|
6
|
+
],
|
|
7
|
+
variants: {
|
|
8
|
+
size: {
|
|
9
|
+
current: '',
|
|
10
|
+
xs: 'text-icon-xs',
|
|
11
|
+
sm: 'text-icon-sm',
|
|
12
|
+
md: 'text-icon-md',
|
|
13
|
+
lg: 'text-icon-lg',
|
|
14
|
+
xl: 'text-icon-xl',
|
|
15
|
+
'2xl': 'text-icon-2xl'
|
|
16
|
+
},
|
|
17
|
+
color: {
|
|
18
|
+
current: 'text-current',
|
|
19
|
+
primary: 'text-primary',
|
|
20
|
+
secondary: 'text-secondary',
|
|
21
|
+
danger: 'text-danger',
|
|
22
|
+
success: 'text-success',
|
|
23
|
+
warning: 'text-warning'
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
defaultVariants: {
|
|
27
|
+
size: 'current',
|
|
28
|
+
color: 'current'
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
function Icon({ icon, size, color, className, ...props }) {
|
|
32
|
+
return /*#__PURE__*/ jsx("span", {
|
|
33
|
+
className: `${iconVariants({
|
|
34
|
+
size,
|
|
35
|
+
color,
|
|
36
|
+
className
|
|
37
|
+
})} ${icon}`,
|
|
38
|
+
"aria-hidden": "true",
|
|
39
|
+
...props
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
export { Icon };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
function Image({ as, src, alt, className, ...props }) {
|
|
3
|
+
const Component = as || 'img';
|
|
4
|
+
return /*#__PURE__*/ jsx(Component, {
|
|
5
|
+
src: src,
|
|
6
|
+
alt: alt,
|
|
7
|
+
className: className,
|
|
8
|
+
...props
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
export { Image };
|