@vkzstudio/muza-ui 1.5.2 → 1.6.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/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Button/Button.js +42 -40
- package/dist/components/Button/Button.stories.d.ts.map +1 -1
- package/dist/components/Carousel/Carousel.d.ts +99 -2
- package/dist/components/Carousel/Carousel.d.ts.map +1 -1
- package/dist/components/Carousel/Carousel.js +208 -151
- package/dist/components/Carousel/Carousel.stories.d.ts +2 -0
- package/dist/components/Carousel/Carousel.stories.d.ts.map +1 -1
- package/dist/components/Carousel/index.js +3 -2
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +22 -3
- package/dist/components/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.js +131 -105
- package/dist/components/DropdownMenu/DropdownMenu.stories.d.ts +3 -2
- package/dist/components/DropdownMenu/DropdownMenu.stories.d.ts.map +1 -1
- package/dist/components/MarketNav/MarketNav.examples.d.ts.map +1 -1
- package/dist/components/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/dist/components/MultiSelect/MultiSelect.js +28 -29
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Select/Select.js +74 -100
- package/dist/components/Select/Select.stories.d.ts.map +1 -1
- package/dist/components/Select/SelectTrigger.d.ts +54 -0
- package/dist/components/Select/SelectTrigger.d.ts.map +1 -0
- package/dist/components/Select/SelectTrigger.js +57 -0
- package/dist/components/Select/SelectTrigger.stories.d.ts +11 -0
- package/dist/components/Select/SelectTrigger.stories.d.ts.map +1 -0
- package/dist/components/Select/index.d.ts +2 -0
- package/dist/components/Select/index.d.ts.map +1 -1
- package/dist/components/Select/index.js +6 -2
- package/dist/components/Select/utils.d.ts +10 -1
- package/dist/components/Select/utils.d.ts.map +1 -1
- package/dist/components/Select/utils.js +3 -5
- package/dist/components/UniversalFooter/UniversalFooter.js +1 -1
- package/dist/components/WebCheckoutNav/WebCheckoutNav.examples.d.ts.map +1 -1
- package/dist/index.js +354 -349
- package/dist/muza-ui.css +1 -1
- package/llms-full.md +133 -2
- package/llms.txt +2 -0
- package/package.json +2 -1
package/llms-full.md
CHANGED
|
@@ -44,8 +44,8 @@ NEVER create new UI components that duplicate Muza UI functionality. Check avail
|
|
|
44
44
|
|
|
45
45
|
**Complete Component List (57 components)**
|
|
46
46
|
|
|
47
|
-
**Form & Input (
|
|
48
|
-
Button, ButtonArrow, Input, PasswordInput, Textarea, Checkbox, Radio, Switch, Toggle, ToggleCheckButton, ToggleGroup, Select, MultiSelect, Searchbar, FileUpload, TextEditor, Slider
|
|
47
|
+
**Form & Input (18)**:
|
|
48
|
+
Button, ButtonArrow, Input, PasswordInput, Textarea, Checkbox, Radio, Switch, Toggle, ToggleCheckButton, ToggleGroup, Select, SelectTrigger, MultiSelect, Searchbar, FileUpload, TextEditor, Slider
|
|
49
49
|
|
|
50
50
|
**Layout & Structure (7)**:
|
|
51
51
|
Accordion, Card, Flex, Sheet, Typography, Dialog, Skeleton
|
|
@@ -176,6 +176,25 @@ import {
|
|
|
176
176
|
|
|
177
177
|
Sub-components: `DropdownMenu`, `DropdownMenuTrigger`, `DropdownMenuPortal`, `DropdownMenuContent`, `DropdownMenuItem`, `DropdownMenuCheckboxItem`, `DropdownMenuRadioGroup`, `DropdownMenuRadioItem`, `DropdownMenuSeparator`, `DropdownMenuButtonItem`
|
|
178
178
|
|
|
179
|
+
**Navigation entries must be links.** Use `asChild` on `DropdownMenuItem` so the item
|
|
180
|
+
renders as a real anchor instead of a div with an `onSelect` handler:
|
|
181
|
+
|
|
182
|
+
```tsx
|
|
183
|
+
<DropdownMenuItem asChild icon={<HeartBold />}>
|
|
184
|
+
<Link href="/profile/favorite">Favorites</Link>
|
|
185
|
+
</DropdownMenuItem>
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
This produces a single `<a role="menuitem">` carrying the item styling, with the icon
|
|
189
|
+
inside it. Do NOT use `onSelect={() => router.push('/x')}` for navigation — it throws
|
|
190
|
+
away middle-click, Ctrl+click, "open link in new tab", "copy link address", the hover
|
|
191
|
+
URL preview, link semantics for screen readers and framework prefetching.
|
|
192
|
+
|
|
193
|
+
`icon`, `isActive` and `description` all still render, and keyboard navigation,
|
|
194
|
+
typeahead and `onSelect` are unchanged. `asChild` works the same way on
|
|
195
|
+
`DropdownMenuCheckboxItem` and `DropdownMenuRadioItem`, though a navigating child makes
|
|
196
|
+
little sense for those.
|
|
197
|
+
|
|
179
198
|
#### Accordion
|
|
180
199
|
|
|
181
200
|
```tsx
|
|
@@ -222,6 +241,69 @@ import { Popover, PopoverContent, PopoverTrigger } from '@vkzstudio/muza-ui'
|
|
|
222
241
|
</Popover>
|
|
223
242
|
```
|
|
224
243
|
|
|
244
|
+
#### Carousel
|
|
245
|
+
|
|
246
|
+
Built on [Embla Carousel](https://www.embla-carousel.com/). `CarouselItem` is full-width by default — override `basis-*` for multi-slide layouts.
|
|
247
|
+
|
|
248
|
+
```tsx
|
|
249
|
+
import {
|
|
250
|
+
Carousel,
|
|
251
|
+
CarouselContent,
|
|
252
|
+
CarouselDots,
|
|
253
|
+
CarouselItem,
|
|
254
|
+
CarouselNext,
|
|
255
|
+
CarouselPrevious,
|
|
256
|
+
} from '@vkzstudio/muza-ui'
|
|
257
|
+
|
|
258
|
+
;<Carousel align="start" options={{ loop: true }}>
|
|
259
|
+
<CarouselContent>
|
|
260
|
+
<CarouselItem className="basis-1/2 md:basis-1/3">Slide 1</CarouselItem>
|
|
261
|
+
<CarouselItem className="basis-1/2 md:basis-1/3">Slide 2</CarouselItem>
|
|
262
|
+
</CarouselContent>
|
|
263
|
+
<CarouselPrevious />
|
|
264
|
+
<CarouselNext />
|
|
265
|
+
<CarouselDots />
|
|
266
|
+
</Carousel>
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
**Autoplay** — set `autoplay` for a self-running carousel. Do NOT install `embla-carousel-autoplay` or hand-roll a timer in your app; the library owns this.
|
|
270
|
+
|
|
271
|
+
```tsx
|
|
272
|
+
// Advances every 5000ms by default; pair with loop for a seamless wrap
|
|
273
|
+
<Carousel autoplay options={{ loop: true }}>...</Carousel>
|
|
274
|
+
|
|
275
|
+
// Custom interval
|
|
276
|
+
<Carousel autoplay autoplayDelay={3000}>...</Carousel>
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
- Pauses on hover (mouse only) and while dragging; resumes on mouse leave, once the slide settles, or after a plain tap.
|
|
280
|
+
- Never runs under `prefers-reduced-motion: reduce`, or with a single slide.
|
|
281
|
+
- `autoplay` appends Embla's `Autoplay` plugin to `plugins`, so your own plugins keep working. Passing your own `Autoplay({ ... })` instance via `plugins` takes precedence — `autoplay` steps aside rather than adding a second timer.
|
|
282
|
+
|
|
283
|
+
**Custom controls** — `useCarousel()` exposes the carousel's state and controls to any descendant, so you don't need `setApi` + local state for a counter, progress bar, or bespoke dot strip. It throws outside a `<Carousel>`.
|
|
284
|
+
|
|
285
|
+
```tsx
|
|
286
|
+
import { useCarousel } from '@vkzstudio/muza-ui'
|
|
287
|
+
|
|
288
|
+
const SlideCounter = () => {
|
|
289
|
+
const { selectedIndex, slidesCount } = useCarousel()
|
|
290
|
+
return (
|
|
291
|
+
<span>
|
|
292
|
+
{selectedIndex + 1} / {slidesCount}
|
|
293
|
+
</span>
|
|
294
|
+
)
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
;<Carousel>
|
|
298
|
+
<CarouselContent>...</CarouselContent>
|
|
299
|
+
<SlideCounter /> {/* must be inside <Carousel> */}
|
|
300
|
+
</Carousel>
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
Returns `api`, `carouselRef`, `scrollPrev`, `scrollNext`, `scrollTo(index)`, `canScrollPrev`, `canScrollNext`, `selectedIndex`, `slidesCount`, plus the root's `options` / `orientation` / `plugins`.
|
|
304
|
+
|
|
305
|
+
Other props: `orientation` (`'horizontal' | 'vertical'`), `align`, `options` (Embla options), `plugins` (Embla plugins), `setApi` (imperative Embla API).
|
|
306
|
+
|
|
225
307
|
### 5. Complex Component APIs
|
|
226
308
|
|
|
227
309
|
#### DatePicker
|
|
@@ -274,6 +356,53 @@ import { Select } from '@vkzstudio/muza-ui'
|
|
|
274
356
|
/>
|
|
275
357
|
```
|
|
276
358
|
|
|
359
|
+
#### SelectTrigger (styling a menu trigger)
|
|
360
|
+
|
|
361
|
+
`Select` is a value picker with combobox/listbox semantics. When the design calls for
|
|
362
|
+
the select pill but the control is really a **menu** — an account dropdown, a filter
|
|
363
|
+
menu, a navigation dropdown — use `SelectTrigger`, the exact button `Select` renders,
|
|
364
|
+
exported on its own. Do not hand-copy the `comp-select-*` tokens into your own
|
|
365
|
+
`<button>`; that silently drifts whenever Select is restyled.
|
|
366
|
+
|
|
367
|
+
```tsx
|
|
368
|
+
import {
|
|
369
|
+
DropdownMenu,
|
|
370
|
+
DropdownMenuContent,
|
|
371
|
+
DropdownMenuItem,
|
|
372
|
+
DropdownMenuTrigger,
|
|
373
|
+
SelectTrigger,
|
|
374
|
+
} from '@vkzstudio/muza-ui'
|
|
375
|
+
|
|
376
|
+
;<DropdownMenu>
|
|
377
|
+
<DropdownMenuTrigger asChild>
|
|
378
|
+
<SelectTrigger size="sm" className="max-w-comp-market-nav-select-max-w">
|
|
379
|
+
{userName}
|
|
380
|
+
</SelectTrigger>
|
|
381
|
+
</DropdownMenuTrigger>
|
|
382
|
+
<DropdownMenuContent align="end" sideOffset={8}>
|
|
383
|
+
<DropdownMenuItem icon={<UserBold />}>My profile</DropdownMenuItem>
|
|
384
|
+
<DropdownMenuItem icon={<Logout2Outline />}>Log out</DropdownMenuItem>
|
|
385
|
+
</DropdownMenuContent>
|
|
386
|
+
</DropdownMenu>
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
Key points:
|
|
390
|
+
|
|
391
|
+
- **Stateless — no `open` prop.** The expanded border and the chevron rotation come
|
|
392
|
+
from `data-state="open"`, which Radix sets on the trigger in `Select`,
|
|
393
|
+
`DropdownMenu`, `Popover` and friends. Do not keep a local `menuOpen` state for
|
|
394
|
+
styling.
|
|
395
|
+
- **`asChild` works.** It is a `forwardRef` over a single `<button>` and spreads every
|
|
396
|
+
remaining prop, so Radix's ref, handlers, `aria-expanded`, `aria-haspopup` and
|
|
397
|
+
`data-state` all land on it.
|
|
398
|
+
- **It owns the chevron and truncation.** A `string` or `number` child is rendered in
|
|
399
|
+
the standard truncated label style; pass a node for full control.
|
|
400
|
+
- `className` is merged with `cn`, so `max-w-*` and friends work.
|
|
401
|
+
- Props: `size` (`'xs' | 'sm' | 'base' | 'lg'`), `error`, `disabled`, `prefix`,
|
|
402
|
+
`hasDescription`, plus all native `<button>` attributes.
|
|
403
|
+
- `triggerWrapperVariants` is also exported as an escape hatch for cases that cannot
|
|
404
|
+
use the component, but prefer the component.
|
|
405
|
+
|
|
277
406
|
#### toast() (imperative API)
|
|
278
407
|
|
|
279
408
|
Toast uses an imperative function, not a declarative component:
|
|
@@ -517,6 +646,8 @@ interface CustomButtonProps extends ButtonProps {
|
|
|
517
646
|
- Mix different UI libraries (Material-UI, Ant Design, etc.) with Muza UI
|
|
518
647
|
- Create custom toast/notification systems
|
|
519
648
|
- Use `<Alert variant="error">` - use `<Alert type="error">` instead
|
|
649
|
+
- Copy `comp-select-*` classes into your own trigger button - use `SelectTrigger`
|
|
650
|
+
- Use `<Select>` for a menu of actions - it is a combobox; use `SelectTrigger` inside `DropdownMenuTrigger asChild`
|
|
520
651
|
|
|
521
652
|
## DO
|
|
522
653
|
|
package/llms.txt
CHANGED
|
@@ -21,6 +21,8 @@ import '@vkzstudio/muza-ui/styles'
|
|
|
21
21
|
|
|
22
22
|
See llms-full.md for component APIs, compound component patterns, and react-hook-form integration.
|
|
23
23
|
|
|
24
|
+
Some components own behaviour you should not re-implement in an app — e.g. `Carousel` has built-in autoplay (`autoplay` / `autoplayDelay`, with hover/drag pausing and `prefers-reduced-motion` support), so don't install `embla-carousel-autoplay` or hand-roll a timer.
|
|
25
|
+
|
|
24
26
|
## Component Categories (57 total)
|
|
25
27
|
|
|
26
28
|
**Form & Input (17)**: Button, ButtonArrow, Input, PasswordInput, Textarea, Checkbox, Radio, Switch, Toggle, ToggleCheckButton, ToggleGroup, Select, MultiSelect, Searchbar, FileUpload, TextEditor, Slider
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vkzstudio/muza-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "React component library built with Vite, shadcn/ui, and Tailwind CSS",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -103,6 +103,7 @@
|
|
|
103
103
|
"clsx": "^2.1.0",
|
|
104
104
|
"color": "^5.0.2",
|
|
105
105
|
"date-fns": "^4.1.0",
|
|
106
|
+
"embla-carousel-autoplay": "^8.6.0",
|
|
106
107
|
"embla-carousel-react": "^8.6.0",
|
|
107
108
|
"framer-motion": "^12.29.0",
|
|
108
109
|
"input-otp": "^1.4.2",
|