@udixio/mcp 0.3.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 +127 -0
- package/dist/bundled/components-index.json +369 -0
- package/dist/bundled/doc-src/components/Code.astro +14 -0
- package/dist/bundled/doc-src/components/ComponentPreview.astro +218 -0
- package/dist/bundled/doc-src/data/components/button.overview.mdx +152 -0
- package/dist/bundled/doc-src/data/components/card.overview.mdx +91 -0
- package/dist/bundled/doc-src/data/components/carousel.overview.mdx +108 -0
- package/dist/bundled/doc-src/data/components/checkbox.overview.mdx +172 -0
- package/dist/bundled/doc-src/data/components/chip.overview.mdx +216 -0
- package/dist/bundled/doc-src/data/components/date-picker.overview.mdx +102 -0
- package/dist/bundled/doc-src/data/components/divider.overview.mdx +54 -0
- package/dist/bundled/doc-src/data/components/fab-menu.overview.mdx +69 -0
- package/dist/bundled/doc-src/data/components/fab.overview.mdx +80 -0
- package/dist/bundled/doc-src/data/components/icon-button.overview.mdx +155 -0
- package/dist/bundled/doc-src/data/components/navigation-rail.overview.mdx +142 -0
- package/dist/bundled/doc-src/data/components/progress-indicator.overview.mdx +49 -0
- package/dist/bundled/doc-src/data/components/slider.overview.mdx +64 -0
- package/dist/bundled/doc-src/data/components/snackbar.overview.mdx +37 -0
- package/dist/bundled/doc-src/data/components/switch.overview.mdx +41 -0
- package/dist/bundled/doc-src/data/components/tabs.overview.mdx +171 -0
- package/dist/bundled/doc-src/data/components/temp.md +506 -0
- package/dist/bundled/doc-src/data/components/text-field.overview.mdx +90 -0
- package/dist/bundled/doc-src/data/components/tooltip.overview.mdx +159 -0
- package/dist/bundled/doc-src/data/pages/mcp.mdx +92 -0
- package/dist/bundled/doc-src/layouts/components.astro +87 -0
- package/dist/bundled/doc-src/layouts/layout.astro +55 -0
- package/dist/bundled/doc-src/pages/404.astro +18 -0
- package/dist/bundled/doc-src/pages/[...url].astro +34 -0
- package/dist/bundled/doc-src/pages/animations.astro +322 -0
- package/dist/bundled/doc-src/pages/components/[component]/api.astro +89 -0
- package/dist/bundled/doc-src/pages/components/[component]/index.astro +5 -0
- package/dist/bundled/doc-src/pages/components/[component]/overview.astro +37 -0
- package/dist/bundled/doc-src/pages/components/index.astro +130 -0
- package/dist/bundled/doc-src/pages/index.astro +5 -0
- package/dist/bundled/doc-src/pages/search.astro +12 -0
- package/dist/bundled/doc-src/pages/themes.astro +86 -0
- package/dist/bundled/theme.json +359 -0
- package/dist/cli.mjs +450 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +5 -0
- package/dist/lib/cli.d.ts +3 -0
- package/dist/lib/cli.d.ts.map +1 -0
- package/dist/lib/loaders/components.d.ts +6 -0
- package/dist/lib/loaders/components.d.ts.map +1 -0
- package/dist/lib/loaders/docs.d.ts +11 -0
- package/dist/lib/loaders/docs.d.ts.map +1 -0
- package/dist/lib/loaders/theme.d.ts +37 -0
- package/dist/lib/loaders/theme.d.ts.map +1 -0
- package/dist/lib/main.d.ts +3 -0
- package/dist/lib/main.d.ts.map +1 -0
- package/dist/lib/mcp.d.ts +3 -0
- package/dist/lib/mcp.d.ts.map +1 -0
- package/package.json +61 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
---
|
|
2
|
+
---
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
import { CodePreview } from '@/components/CodePreview.js';
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
Checkboxes allow users to select one or more items from a set.
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
import { Checkbox } from "@udixio/ui-react"
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Select one or more options in a list
|
|
19
|
+
|
|
20
|
+
```jsx
|
|
21
|
+
function Example() {
|
|
22
|
+
const [selected, setSelected] = React.useState({
|
|
23
|
+
news: true,
|
|
24
|
+
design: false,
|
|
25
|
+
dev: false,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<ul className="space-y-2">
|
|
30
|
+
<li className="flex items-center gap-3">
|
|
31
|
+
<Checkbox
|
|
32
|
+
id="opt-news"
|
|
33
|
+
name="topics"
|
|
34
|
+
value="news"
|
|
35
|
+
checked={selected.news}
|
|
36
|
+
onChange={(e) =>
|
|
37
|
+
setSelected((prev) => ({ ...prev, news: e.target.checked }))
|
|
38
|
+
}
|
|
39
|
+
/>
|
|
40
|
+
<label htmlFor="opt-news">News</label>
|
|
41
|
+
</li>
|
|
42
|
+
<li className="flex items-center gap-3">
|
|
43
|
+
<Checkbox
|
|
44
|
+
id="opt-design"
|
|
45
|
+
name="topics"
|
|
46
|
+
value="design"
|
|
47
|
+
checked={selected.design}
|
|
48
|
+
onChange={(e) =>
|
|
49
|
+
setSelected((prev) => ({ ...prev, design: e.target.checked }))
|
|
50
|
+
}
|
|
51
|
+
/>
|
|
52
|
+
<label htmlFor="opt-design">Design</label>
|
|
53
|
+
</li>
|
|
54
|
+
<li className="flex items-center gap-3">
|
|
55
|
+
<Checkbox
|
|
56
|
+
id="opt-dev"
|
|
57
|
+
name="topics"
|
|
58
|
+
value="dev"
|
|
59
|
+
checked={selected.dev}
|
|
60
|
+
onChange={(e) =>
|
|
61
|
+
setSelected((prev) => ({ ...prev, dev: e.target.checked }))
|
|
62
|
+
}
|
|
63
|
+
/>
|
|
64
|
+
<label htmlFor="opt-dev">Development</label>
|
|
65
|
+
</li>
|
|
66
|
+
</ul>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Present a list with sub-selections
|
|
72
|
+
|
|
73
|
+
Use `indeterminate` for a parent checkbox when only some children are selected.
|
|
74
|
+
|
|
75
|
+
```jsx
|
|
76
|
+
function Example() {
|
|
77
|
+
const [children, setChildren] = React.useState({
|
|
78
|
+
email: true,
|
|
79
|
+
sms: false,
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
const allChecked = children.email && children.sms;
|
|
83
|
+
const isIndeterminate = (children.email || children.sms) && !allChecked;
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<div className="space-y-2">
|
|
87
|
+
<div className="flex items-center gap-3">
|
|
88
|
+
<Checkbox
|
|
89
|
+
id="notif-all"
|
|
90
|
+
checked={allChecked}
|
|
91
|
+
indeterminate={isIndeterminate}
|
|
92
|
+
onChange={(e) =>
|
|
93
|
+
setChildren({
|
|
94
|
+
email: e.target.checked,
|
|
95
|
+
sms: e.target.checked,
|
|
96
|
+
})
|
|
97
|
+
}
|
|
98
|
+
/>
|
|
99
|
+
<label htmlFor="notif-all">Notifications</label>
|
|
100
|
+
</div>
|
|
101
|
+
<div className="ml-6 space-y-2">
|
|
102
|
+
<div className="flex items-center gap-3">
|
|
103
|
+
<Checkbox
|
|
104
|
+
id="notif-email"
|
|
105
|
+
checked={children.email}
|
|
106
|
+
onChange={(e) =>
|
|
107
|
+
setChildren((prev) => ({ ...prev, email: e.target.checked }))
|
|
108
|
+
}
|
|
109
|
+
/>
|
|
110
|
+
<label htmlFor="notif-email">Email</label>
|
|
111
|
+
</div>
|
|
112
|
+
<div className="flex items-center gap-3">
|
|
113
|
+
<Checkbox
|
|
114
|
+
id="notif-sms"
|
|
115
|
+
checked={children.sms}
|
|
116
|
+
onChange={(e) =>
|
|
117
|
+
setChildren((prev) => ({ ...prev, sms: e.target.checked }))
|
|
118
|
+
}
|
|
119
|
+
/>
|
|
120
|
+
<label htmlFor="notif-sms">SMS</label>
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Enable or disable a desktop option
|
|
129
|
+
|
|
130
|
+
```jsx
|
|
131
|
+
<div className="flex items-center gap-3">
|
|
132
|
+
<Checkbox id="launch-startup" defaultChecked />
|
|
133
|
+
<label htmlFor="launch-startup">Launch on system startup</label>
|
|
134
|
+
</div>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Visually group similar options
|
|
138
|
+
|
|
139
|
+
```jsx
|
|
140
|
+
<div className="space-y-4">
|
|
141
|
+
<div>
|
|
142
|
+
<div className="text-xs uppercase tracking-wide text-muted-foreground">
|
|
143
|
+
Privacy
|
|
144
|
+
</div>
|
|
145
|
+
<div className="mt-2 space-y-2">
|
|
146
|
+
<div className="flex items-center gap-3">
|
|
147
|
+
<Checkbox id="privacy-ads" />
|
|
148
|
+
<label htmlFor="privacy-ads">Personalized ads</label>
|
|
149
|
+
</div>
|
|
150
|
+
<div className="flex items-center gap-3">
|
|
151
|
+
<Checkbox id="privacy-analytics" defaultChecked />
|
|
152
|
+
<label htmlFor="privacy-analytics">Analytics sharing</label>
|
|
153
|
+
</div>
|
|
154
|
+
</div>
|
|
155
|
+
</div>
|
|
156
|
+
<div>
|
|
157
|
+
<div className="text-xs uppercase tracking-wide text-muted-foreground">
|
|
158
|
+
Emails
|
|
159
|
+
</div>
|
|
160
|
+
<div className="mt-2 space-y-2">
|
|
161
|
+
<div className="flex items-center gap-3">
|
|
162
|
+
<Checkbox id="email-product" defaultChecked />
|
|
163
|
+
<label htmlFor="email-product">Product updates</label>
|
|
164
|
+
</div>
|
|
165
|
+
<div className="flex items-center gap-3">
|
|
166
|
+
<Checkbox id="email-marketing" />
|
|
167
|
+
<label htmlFor="email-marketing">Marketing tips</label>
|
|
168
|
+
</div>
|
|
169
|
+
</div>
|
|
170
|
+
</div>
|
|
171
|
+
</div>
|
|
172
|
+
```
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
---
|
|
2
|
+
---
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
import { CodePreview } from '@/components/CodePreview.js';
|
|
28
|
+
import { faPlus } from '@fortawesome/free-solid-svg-icons';
|
|
29
|
+
|
|
30
|
+
## Chip — aperçu et usage
|
|
31
|
+
|
|
32
|
+
Les Chips sont de petits composants interactifs qui représentent une action, un choix ou une entrée compacte. Ils suivent les principes de Material 3 et se déclinent en quatre grands types d’usage :
|
|
33
|
+
|
|
34
|
+
- Assist (déclenche une action rapide, proche d’un bouton)
|
|
35
|
+
- Filter (sélection on/off ou multi‑sélection)
|
|
36
|
+
- Input (représente une valeur saisie par l’utilisateur, ex. un tag)
|
|
37
|
+
- Suggestion (propose des options contextuelles)
|
|
38
|
+
|
|
39
|
+
Cette page explique comment utiliser `Chip` dans Udixio, avec des exemples pratiques. Le code du composant pourra évoluer, mais les concepts et bonnes pratiques restent valables.
|
|
40
|
+
|
|
41
|
+
## Installation et import
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
import { Chip } from "@udixio/ui-react"
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Exemple minimal
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
<Chip label="Option" />
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Vous pouvez aussi fournir le texte via les enfants :
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
<Chip>Option</Chip>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Types d’usage
|
|
60
|
+
|
|
61
|
+
### Assist chip (action rapide)
|
|
62
|
+
|
|
63
|
+
Un assist chip déclenche une action immédiate : ouvrir une vue, copier un texte, appliquer un filtre temporaire, etc.
|
|
64
|
+
|
|
65
|
+
<CodePreview
|
|
66
|
+
client:load
|
|
67
|
+
code={`
|
|
68
|
+
<Chip label="Nouveau" icon={faPlus} onClick={() => console.log('nouveau')} />
|
|
69
|
+
`}
|
|
70
|
+
scope={{ faPlus }}
|
|
71
|
+
/>
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
### Filter chip (sélection)
|
|
75
|
+
|
|
76
|
+
Rendez un chip sélectionnable avec `onToggle`. Contrôlez l’état via `activated` si nécessaire.
|
|
77
|
+
|
|
78
|
+
```jsx
|
|
79
|
+
function Filters() {
|
|
80
|
+
const [selected, setSelected] = React.useState({ jazz: false, rock: true });
|
|
81
|
+
return (
|
|
82
|
+
<div className="flex flex-wrap gap-3">
|
|
83
|
+
<Chip
|
|
84
|
+
variant="outlined"
|
|
85
|
+
activated={selected.jazz}
|
|
86
|
+
onToggle={(v) => setSelected((s) => ({ ...s, jazz: v }))}
|
|
87
|
+
>Jazz</Chip>
|
|
88
|
+
<Chip
|
|
89
|
+
variant="outlined"
|
|
90
|
+
activated={selected.rock}
|
|
91
|
+
onToggle={(v) => setSelected((s) => ({ ...s, rock: v }))}
|
|
92
|
+
>Rock</Chip>
|
|
93
|
+
</div>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Suggestion chip (proposition)
|
|
99
|
+
|
|
100
|
+
Présentez des suggestions contextuelles (réponses rapides, filtres de recherche). Gardez des libellés courts (idéalement ≤ 20 caractères).
|
|
101
|
+
|
|
102
|
+
Cas standard (fond neutre) :
|
|
103
|
+
|
|
104
|
+
```jsx
|
|
105
|
+
<div className="flex flex-wrap gap-2">
|
|
106
|
+
<Chip variant="outlined">Près de moi</Chip>
|
|
107
|
+
<Chip variant="outlined">Ouvert maintenant</Chip>
|
|
108
|
+
<Chip variant="outlined">4★ et +</Chip>
|
|
109
|
+
</div>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Sur image ou fond chargé, utilisez `elevated` pour améliorer le contraste :
|
|
113
|
+
|
|
114
|
+
```jsx
|
|
115
|
+
<div class={"relative"}>
|
|
116
|
+
<img src="https://images.unsplash.com/photo-1520975916090-3105956dac38?q=80&w=1200&auto=format&fit=crop" alt="Image" className="max-w-sm"/>
|
|
117
|
+
<div className="flex flex-wrap gap-2 absolute bottom-4 left-2">
|
|
118
|
+
<Chip variant="elevated">Près de moi</Chip>
|
|
119
|
+
<Chip variant="elevated">Ouvert</Chip>
|
|
120
|
+
<Chip variant="elevated">4★ et +</Chip>
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Input chip (valeur saisie)
|
|
126
|
+
|
|
127
|
+
Représente des entrées d’utilisateur (ex. tags). L’ajout/retrait est géré par votre logique applicative.
|
|
128
|
+
|
|
129
|
+
```jsx
|
|
130
|
+
function Inputs() {
|
|
131
|
+
const [tags, setTags] = React.useState(["React", "TypeScript", "Next.js", "Tailwind"]);
|
|
132
|
+
const onRemove = (tag) => setTags((arr) => arr.filter((t) => t !== tag));
|
|
133
|
+
return (
|
|
134
|
+
<div className="flex flex-wrap gap-2">
|
|
135
|
+
{tags.map((t) => (
|
|
136
|
+
<Chip key={t} variant="outlined" label={t} onRemove={() => onRemove(t)} />
|
|
137
|
+
))}
|
|
138
|
+
</div>
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Icône
|
|
144
|
+
|
|
145
|
+
Vous pouvez afficher une icône (FontAwesome) dans le chip.
|
|
146
|
+
|
|
147
|
+
<CodePreview
|
|
148
|
+
client:load
|
|
149
|
+
code={`
|
|
150
|
+
<div className="flex gap-3">
|
|
151
|
+
<Chip label="Ajouter" icon={faPlus} />
|
|
152
|
+
</div>
|
|
153
|
+
`}
|
|
154
|
+
scope={{ faPlus }}
|
|
155
|
+
/>
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
## Lien ou action
|
|
159
|
+
|
|
160
|
+
Si `href` est fourni, le composant peut se comporter comme un lien. Sinon, il agit comme un contrôle interactif (click/toggle).
|
|
161
|
+
|
|
162
|
+
```jsx
|
|
163
|
+
<div className="flex gap-3">
|
|
164
|
+
<Chip onClick={() => console.log('clic')}>Action</Chip>
|
|
165
|
+
<Chip href="https://udixio.dev">Lien</Chip>
|
|
166
|
+
</div>
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
## États et accessibilité
|
|
171
|
+
|
|
172
|
+
- `disabled` rend le chip inactif.
|
|
173
|
+
- Les chips commutables (`onToggle`) exposent `aria-pressed` automatiquement.
|
|
174
|
+
- Conservez une cible tactile d’au moins 48 dp et un contraste suffisant selon le thème.
|
|
175
|
+
|
|
176
|
+
```jsx
|
|
177
|
+
<div className="flex flex-wrap gap-3">
|
|
178
|
+
<Chip disabled variant="outlined">Indisponible</Chip>
|
|
179
|
+
</div>
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Chips (liste)
|
|
183
|
+
|
|
184
|
+
Le composant conteneur `Chips` ne supporte pas le mode `children`. Il rend exclusivement une liste à partir de `items` et notifie les changements via `onItemsChange`.
|
|
185
|
+
|
|
186
|
+
Note: vous n'avez pas besoin de fournir un `id` pour chaque item — `Chips` assigne automatiquement des identifiants internes stables pour les clés de rendu.
|
|
187
|
+
|
|
188
|
+
Exemple contrôlé:
|
|
189
|
+
|
|
190
|
+
```jsx
|
|
191
|
+
function Contacts() {
|
|
192
|
+
const [items, setItems] = React.useState([
|
|
193
|
+
{ label: 'Alice Dupont', draggable: true },
|
|
194
|
+
{ label: 'Bob Martin' },
|
|
195
|
+
{ label: 'Clara Lopez' },
|
|
196
|
+
]);
|
|
197
|
+
|
|
198
|
+
return (
|
|
199
|
+
<div className="border border-outline px-4 py-3 rounded-md w-full max-w-xl space-y-3">
|
|
200
|
+
<Chips
|
|
201
|
+
items={items}
|
|
202
|
+
onItemsChange={setItems}
|
|
203
|
+
/>
|
|
204
|
+
</div>
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Édition (variant="input")
|
|
210
|
+
|
|
211
|
+
- Double‑clic (ou F2/Enter quand le chip a le focus et n’est pas togglable) met un chip en édition directement.
|
|
212
|
+
- Cliquer dans une zone vide du conteneur ajoute un nouveau chip à la fin et l’ouvre immédiatement en édition.
|
|
213
|
+
- L’édition est inline via `contenteditable` (pas de champ d’entrée séparé). Appuyez sur Enter pour valider, Échap pour annuler, ou sortez du focus pour valider.
|
|
214
|
+
- Si vous validez une étiquette vide (ou annulez une création vide), le chip est retiré.
|
|
215
|
+
- Les raccourcis existants demeurent: Enter/Espace pour `onToggle`, Retour/Suppr pour `onRemove` quand le chip est sélectionné et non en édition.
|
|
216
|
+
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
---
|
|
3
|
+
|
|
4
|
+
import { CodePreview } from '@/components/CodePreview.js';
|
|
5
|
+
|
|
6
|
+
## Usage
|
|
7
|
+
|
|
8
|
+
DatePicker allow users to select a date or a range of dates.
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
import { DatePicker } from "@udixio/ui-react"
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Basic usage
|
|
15
|
+
|
|
16
|
+
```jsx
|
|
17
|
+
function Example() {
|
|
18
|
+
const [date, setDate] = React.useState(new Date());
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<div className="flex flex-col items-center">
|
|
22
|
+
<DatePicker value={date} onChange={setDate} />
|
|
23
|
+
<p className="mt-4 text-body-medium">
|
|
24
|
+
Selected: {date.toLocaleDateString()}
|
|
25
|
+
</p>
|
|
26
|
+
</div>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Select a range
|
|
32
|
+
|
|
33
|
+
Use `mode="range"` to select a date range.
|
|
34
|
+
|
|
35
|
+
```jsx
|
|
36
|
+
function Example() {
|
|
37
|
+
const [range, setRange] = React.useState([
|
|
38
|
+
new Date(2023, 5, 1),
|
|
39
|
+
new Date(2023, 5, 10),
|
|
40
|
+
]);
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<div className="flex flex-col items-center">
|
|
44
|
+
<DatePicker mode="range" value={range} onChange={setRange} />
|
|
45
|
+
<p className="mt-4 text-body-medium text-center">
|
|
46
|
+
Start: {range[0]?.toLocaleDateString() || '-'} <br />
|
|
47
|
+
End: {range[1]?.toLocaleDateString() || '-'}
|
|
48
|
+
</p>
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Uncontrolled
|
|
55
|
+
|
|
56
|
+
You can use `defaultValue` for uncontrolled usage.
|
|
57
|
+
|
|
58
|
+
```jsx
|
|
59
|
+
<DatePicker
|
|
60
|
+
defaultValue={new Date(2023, 5, 15)}
|
|
61
|
+
onChange={(date) => console.log('Selected:', date)}
|
|
62
|
+
/>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Min and Max dates
|
|
66
|
+
|
|
67
|
+
Limit the selectable range.
|
|
68
|
+
|
|
69
|
+
```jsx
|
|
70
|
+
<DatePicker
|
|
71
|
+
minDate={new Date(2023, 0, 1)}
|
|
72
|
+
maxDate={new Date(2023, 11, 31)}
|
|
73
|
+
defaultValue={new Date(2023, 5, 1)}
|
|
74
|
+
/>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Disable specific dates
|
|
78
|
+
|
|
79
|
+
Disable weekends for example.
|
|
80
|
+
|
|
81
|
+
```jsx
|
|
82
|
+
<DatePicker
|
|
83
|
+
shouldDisableDate={(date) => {
|
|
84
|
+
const day = date.getDay();
|
|
85
|
+
return day === 0 || day === 6; // Disable Sunday and Saturday
|
|
86
|
+
}}
|
|
87
|
+
defaultValue={new Date()}
|
|
88
|
+
/>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Localization
|
|
92
|
+
|
|
93
|
+
Use `locale` to format the calendar.
|
|
94
|
+
|
|
95
|
+
```jsx
|
|
96
|
+
<div className="flex flex-wrap gap-8">
|
|
97
|
+
{/* Default (English) */}
|
|
98
|
+
<DatePicker locale="en-US" defaultValue={new Date()} />
|
|
99
|
+
{/* French (Monday start) */}
|
|
100
|
+
<DatePicker locale="fr-FR" weekStartDay={1} defaultValue={new Date()} />
|
|
101
|
+
</div>
|
|
102
|
+
```
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
---
|
|
3
|
+
|
|
4
|
+
## Usage
|
|
5
|
+
|
|
6
|
+
Use Divider to separate content sections.
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
import { Divider } from "@udixio/ui-react"
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
<Divider />
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Orientation
|
|
17
|
+
|
|
18
|
+
Use `orientation` to switch between horizontal and vertical.
|
|
19
|
+
|
|
20
|
+
```jsx
|
|
21
|
+
<div className="flex items-center gap-4">
|
|
22
|
+
<div>
|
|
23
|
+
<p>Section A</p>
|
|
24
|
+
<Divider />
|
|
25
|
+
<p>Section B</p>
|
|
26
|
+
</div>
|
|
27
|
+
<Divider orientation="vertical" className="h-12" />
|
|
28
|
+
<div>
|
|
29
|
+
<p>Section C</p>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Spacing and sizing
|
|
35
|
+
|
|
36
|
+
Control spacing and length with your utility classes.
|
|
37
|
+
|
|
38
|
+
```jsx
|
|
39
|
+
<div className="space-y-6">
|
|
40
|
+
<div>
|
|
41
|
+
<p className="mb-2">Tight spacing</p>
|
|
42
|
+
<Divider className="my-1" />
|
|
43
|
+
</div>
|
|
44
|
+
<div>
|
|
45
|
+
<p className="mb-2">Wide spacing</p>
|
|
46
|
+
<Divider className="my-6" />
|
|
47
|
+
</div>
|
|
48
|
+
<div className="flex items-center gap-4">
|
|
49
|
+
<span>Left</span>
|
|
50
|
+
<Divider orientation="vertical" className="h-8" />
|
|
51
|
+
<span>Right</span>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
```
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
---
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
import { CodePreview } from '@/components/CodePreview.js';
|
|
17
|
+
import { faPlus } from '@fortawesome/free-solid-svg-icons';
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
Floating Action Button (Fab) represents the primary action on a screen. Import it from @udixio/ui-react.
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
import { Fab } from "@udixio/ui-react"
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
<CodePreview client:load
|
|
28
|
+
code={`
|
|
29
|
+
<div className="flex items-end gap-4 h-96">
|
|
30
|
+
<FabMenu size="large" label="Create" icon={faPlus} >
|
|
31
|
+
<Button variant="filled">Filled</Button>
|
|
32
|
+
<Button variant="elevated">Elevated</Button>
|
|
33
|
+
<Button variant="tonal">Tonal</Button>
|
|
34
|
+
<Button variant="outlined">Outlined</Button>
|
|
35
|
+
<Button variant="text">Text</Button>
|
|
36
|
+
</FabMenu>
|
|
37
|
+
</div>`}
|
|
38
|
+
scope={{ faPlus }}
|
|
39
|
+
/>
|
|
40
|
+
|
|
41
|
+
<CodePreview client:load
|
|
42
|
+
code={`
|
|
43
|
+
<div className="flex items-end gap-4 h-96">
|
|
44
|
+
<FabMenu extended variant="secondary" size="large" label="Create" icon={faPlus} >
|
|
45
|
+
<Button variant="filled">Filled</Button>
|
|
46
|
+
<Button variant="elevated">Elevated</Button>
|
|
47
|
+
<Button variant="tonal">Tonal</Button>
|
|
48
|
+
<Button variant="outlined">Outlined</Button>
|
|
49
|
+
<Button variant="text">Text</Button>
|
|
50
|
+
</FabMenu>
|
|
51
|
+
</div>`}
|
|
52
|
+
scope={{ faPlus }}
|
|
53
|
+
/>
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
<CodePreview client:load
|
|
57
|
+
code={`
|
|
58
|
+
<div className="flex items-end gap-4 h-96">
|
|
59
|
+
<FabMenu variant="tertiary" size="large" label="Create" icon={faPlus} >
|
|
60
|
+
<Button variant="filled">Filled</Button>
|
|
61
|
+
<Button variant="elevated">Elevated</Button>
|
|
62
|
+
<Button variant="tonal">Tonal</Button>
|
|
63
|
+
<Button variant="outlined">Outlined</Button>
|
|
64
|
+
<Button variant="text">Text</Button>
|
|
65
|
+
</FabMenu>
|
|
66
|
+
</div>`}
|
|
67
|
+
scope={{ faPlus }}
|
|
68
|
+
/>
|
|
69
|
+
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
---
|
|
2
|
+
---
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
import { CodePreview } from '@/components/CodePreview.js';
|
|
7
|
+
import { faPen, faPlus, faShare } from '@fortawesome/free-solid-svg-icons';
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
Floating Action Button (Fab) represents the primary action on a screen. Import it from @udixio/ui-react.
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
import { Fab } from "@udixio/ui-react"
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
<CodePreview client:load
|
|
18
|
+
code={`
|
|
19
|
+
<div className="flex items-end gap-4">
|
|
20
|
+
<Fab label="Create" icon={faPlus} />
|
|
21
|
+
<Fab label="Create" icon={faPlus} isExtended />
|
|
22
|
+
</div>`}
|
|
23
|
+
scope={{ faPlus }}
|
|
24
|
+
/>
|
|
25
|
+
|
|
26
|
+
## Variants
|
|
27
|
+
|
|
28
|
+
- primary (default)
|
|
29
|
+
- secondary
|
|
30
|
+
- tertiary
|
|
31
|
+
- surface
|
|
32
|
+
|
|
33
|
+
<CodePreview client:load
|
|
34
|
+
code={`
|
|
35
|
+
<div className="flex items-end gap-4">
|
|
36
|
+
<Fab label="Primary" icon={faPlus} variant="primary" />
|
|
37
|
+
<Fab label="Secondary" icon={faPlus} variant="secondary" />
|
|
38
|
+
<Fab label="Tertiary" icon={faPlus} variant="tertiary" />
|
|
39
|
+
<Fab label="Surface" icon={faPlus} variant="surface" />
|
|
40
|
+
</div>`}
|
|
41
|
+
scope={{ faPlus }}
|
|
42
|
+
/>
|
|
43
|
+
|
|
44
|
+
## Sizes
|
|
45
|
+
|
|
46
|
+
Available sizes: small, medium (default), large.
|
|
47
|
+
|
|
48
|
+
<CodePreview client:load
|
|
49
|
+
code={`
|
|
50
|
+
<div className="flex items-end gap-4">
|
|
51
|
+
<Fab label="Edit" icon={faPen} size="small" />
|
|
52
|
+
<Fab label="Edit" icon={faPen} size="medium" />
|
|
53
|
+
<Fab label="Edit" icon={faPen} size="large" />
|
|
54
|
+
</div>`}
|
|
55
|
+
scope={{ faPen }}
|
|
56
|
+
/>
|
|
57
|
+
|
|
58
|
+
## Extended vs. regular
|
|
59
|
+
|
|
60
|
+
Use `isExtended` to show the label next to the icon.
|
|
61
|
+
|
|
62
|
+
<CodePreview client:load
|
|
63
|
+
code={`
|
|
64
|
+
<div className="flex items-end gap-4">
|
|
65
|
+
<Fab label="Share" icon={faShare} />
|
|
66
|
+
<Fab label="Share" icon={faShare} isExtended />
|
|
67
|
+
</div>`}
|
|
68
|
+
scope={{ faShare }}
|
|
69
|
+
/>
|
|
70
|
+
|
|
71
|
+
## Link or action
|
|
72
|
+
|
|
73
|
+
If `href` is provided, the component renders an anchor; otherwise it renders a button. The `label` is used as aria-label for the non-extended Fab.
|
|
74
|
+
|
|
75
|
+
<CodePreview client:load
|
|
76
|
+
code={`
|
|
77
|
+
<Fab label="Create" icon={faPlus} href="https://udixio.dev" />
|
|
78
|
+
`}
|
|
79
|
+
scope={{ faPlus }}
|
|
80
|
+
/>
|