rizzo-css 0.0.66 → 0.0.68
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 +3 -3
- package/bin/rizzo-css.js +6 -6
- package/dist/rizzo.min.css +10 -3
- package/package.json +1 -1
- package/scaffold/astro/Calendar.astro +183 -0
- package/scaffold/astro/Carousel.astro +125 -0
- package/scaffold/astro/Footer.astro +1 -1
- package/scaffold/astro/base/README-RIZZO.md +1 -1
- package/scaffold/astro/variants/full/README-RIZZO.md +1 -1
- package/scaffold/svelte/Button.svelte +1 -1
- package/scaffold/svelte/Calendar.svelte +121 -0
- package/scaffold/svelte/Carousel.svelte +86 -0
- package/scaffold/svelte/base/README-RIZZO.md +1 -1
- package/scaffold/svelte/index.ts +2 -0
- package/scaffold/svelte/variants/full/README-RIZZO.md +1 -1
- package/scaffold/vanilla/README-RIZZO.md +2 -2
- package/scaffold/vanilla/components/accordion.html +12 -0
- package/scaffold/vanilla/components/alert-dialog.html +12 -0
- package/scaffold/vanilla/components/alert.html +12 -0
- package/scaffold/vanilla/components/aspect-ratio.html +12 -0
- package/scaffold/vanilla/components/avatar.html +12 -0
- package/scaffold/vanilla/components/back-to-top.html +12 -0
- package/scaffold/vanilla/components/badge.html +12 -0
- package/scaffold/vanilla/components/breadcrumb.html +12 -0
- package/scaffold/vanilla/components/button-group.html +12 -0
- package/scaffold/vanilla/components/button.html +12 -0
- package/scaffold/vanilla/components/calendar.html +764 -0
- package/scaffold/vanilla/components/cards.html +12 -0
- package/scaffold/vanilla/components/carousel.html +764 -0
- package/scaffold/vanilla/components/collapsible.html +12 -0
- package/scaffold/vanilla/components/context-menu.html +12 -0
- package/scaffold/vanilla/components/copy-to-clipboard.html +12 -0
- package/scaffold/vanilla/components/dashboard.html +12 -0
- package/scaffold/vanilla/components/divider.html +12 -0
- package/scaffold/vanilla/components/docs-sidebar.html +12 -0
- package/scaffold/vanilla/components/dropdown.html +12 -0
- package/scaffold/vanilla/components/empty.html +12 -0
- package/scaffold/vanilla/components/font-switcher.html +12 -0
- package/scaffold/vanilla/components/footer.html +12 -0
- package/scaffold/vanilla/components/forms.html +12 -0
- package/scaffold/vanilla/components/hover-card.html +12 -0
- package/scaffold/vanilla/components/icons.html +12 -0
- package/scaffold/vanilla/components/index.html +14 -0
- package/scaffold/vanilla/components/input-group.html +12 -0
- package/scaffold/vanilla/components/kbd.html +12 -0
- package/scaffold/vanilla/components/label.html +12 -0
- package/scaffold/vanilla/components/modal.html +12 -0
- package/scaffold/vanilla/components/navbar.html +12 -0
- package/scaffold/vanilla/components/pagination.html +12 -0
- package/scaffold/vanilla/components/popover.html +12 -0
- package/scaffold/vanilla/components/progress-bar.html +12 -0
- package/scaffold/vanilla/components/resizable.html +12 -0
- package/scaffold/vanilla/components/scroll-area.html +12 -0
- package/scaffold/vanilla/components/search.html +12 -0
- package/scaffold/vanilla/components/separator.html +12 -0
- package/scaffold/vanilla/components/settings.html +12 -0
- package/scaffold/vanilla/components/sheet.html +12 -0
- package/scaffold/vanilla/components/skeleton.html +12 -0
- package/scaffold/vanilla/components/slider.html +12 -0
- package/scaffold/vanilla/components/sound-effects.html +12 -0
- package/scaffold/vanilla/components/spinner.html +12 -0
- package/scaffold/vanilla/components/switch.html +12 -0
- package/scaffold/vanilla/components/table.html +12 -0
- package/scaffold/vanilla/components/tabs.html +12 -0
- package/scaffold/vanilla/components/theme-switcher.html +12 -0
- package/scaffold/vanilla/components/toast.html +12 -0
- package/scaffold/vanilla/components/toggle-group.html +12 -0
- package/scaffold/vanilla/components/toggle.html +12 -0
- package/scaffold/vanilla/components/tooltip.html +12 -0
- package/scaffold/vanilla/index.html +12 -0
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
Design system · Vanilla · Astro · Svelte
|
|
16
16
|
</pre>
|
|
17
17
|
|
|
18
|
-
Astro project with Rizzo CSS. Scaffolded with `npx rizzo-css init` when you chose **Create new** and Astro, then **Landing**, **Docs**, **Dashboard**, or **Full**. **Full** = clone of the docs site. **Landing** / **Docs** / **Dashboard** = base + component picker (all
|
|
18
|
+
Astro project with Rizzo CSS. Scaffolded with `npx rizzo-css init` when you chose **Create new** and Astro, then **Landing**, **Docs**, **Dashboard**, or **Full**. **Full** = clone of the docs site. **Landing** / **Docs** / **Dashboard** = base + component picker (all 52 or pick). Same template choice for **Add to existing** (`npx rizzo-css add`).
|
|
19
19
|
|
|
20
20
|
## Setup
|
|
21
21
|
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
Design system · Vanilla · Astro · Svelte
|
|
16
16
|
</pre>
|
|
17
17
|
|
|
18
|
-
Astro project with Rizzo CSS. Scaffolded with `npx rizzo-css init` when you chose **Create new** and Astro, then **Full** template. **Full** = clone of the Rizzo docs site (no component picker). **Landing** / **Docs** / **Dashboard** = base + component picker (all
|
|
18
|
+
Astro project with Rizzo CSS. Scaffolded with `npx rizzo-css init` when you chose **Create new** and Astro, then **Full** template. **Full** = clone of the Rizzo docs site (no component picker). **Landing** / **Docs** / **Dashboard** = base + component picker (all 52 or pick). Same template choice for **Add to existing** (`npx rizzo-css add`).
|
|
19
19
|
|
|
20
20
|
## Setup
|
|
21
21
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
|
|
4
|
-
type Variant = 'default' | 'primary' | 'success' | 'warning' | 'error' | 'info' | 'outline';
|
|
4
|
+
type Variant = 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'info' | 'outline' | 'ghost';
|
|
5
5
|
interface Props {
|
|
6
6
|
variant?: Variant;
|
|
7
7
|
disabled?: boolean;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
const MONTHS = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
|
|
3
|
+
const WEEKDAYS = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
id?: string;
|
|
7
|
+
initialMonth?: string;
|
|
8
|
+
selected?: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
class?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let {
|
|
14
|
+
id: calendarId,
|
|
15
|
+
initialMonth,
|
|
16
|
+
selected,
|
|
17
|
+
label = 'Calendar',
|
|
18
|
+
class: className = '',
|
|
19
|
+
onSelect,
|
|
20
|
+
}: Props & { onSelect?: (date: string) => void } = $props();
|
|
21
|
+
|
|
22
|
+
const id = $derived(calendarId ?? `calendar-${Math.random().toString(36).slice(2, 9)}`);
|
|
23
|
+
const now = new Date();
|
|
24
|
+
|
|
25
|
+
function parseInitial(): { year: number; month: number } {
|
|
26
|
+
if (!initialMonth) return { year: now.getFullYear(), month: now.getMonth() };
|
|
27
|
+
const [y, m] = initialMonth.split('-').map(Number);
|
|
28
|
+
if (!y || !m || m < 1 || m > 12) return { year: now.getFullYear(), month: now.getMonth() };
|
|
29
|
+
return { year: y, month: m - 1 };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
let view = $state(parseInitial());
|
|
33
|
+
|
|
34
|
+
function toYYYYMMDD(year: number, month: number, day: number): string {
|
|
35
|
+
return `${year}-${String(month + 1).padStart(2, '0')}-${String(day).padStart(2, '0')}`;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function getMonthGrid(year: number, month: number): { day: number; year: number; month: number; currentMonth: boolean }[][] {
|
|
39
|
+
const first = new Date(year, month, 1);
|
|
40
|
+
const last = new Date(year, month + 1, 0);
|
|
41
|
+
const startDay = first.getDay();
|
|
42
|
+
const daysInMonth = last.getDate();
|
|
43
|
+
const weeks: { day: number; year: number; month: number; currentMonth: boolean }[][] = [];
|
|
44
|
+
let week: { day: number; year: number; month: number; currentMonth: boolean }[] = [];
|
|
45
|
+
const prevMonth = month === 0 ? 11 : month - 1;
|
|
46
|
+
const prevYear = month === 0 ? year - 1 : year;
|
|
47
|
+
const prevLast = new Date(prevYear, prevMonth + 1, 0).getDate();
|
|
48
|
+
for (let i = 0; i < startDay; i++) {
|
|
49
|
+
week.push({ day: prevLast - startDay + i + 1, year: prevYear, month: prevMonth, currentMonth: false });
|
|
50
|
+
}
|
|
51
|
+
for (let d = 1; d <= daysInMonth; d++) {
|
|
52
|
+
week.push({ day: d, year, month, currentMonth: true });
|
|
53
|
+
if (week.length === 7) {
|
|
54
|
+
weeks.push(week);
|
|
55
|
+
week = [];
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const nextMonth = month === 11 ? 0 : month + 1;
|
|
59
|
+
const nextYear = month === 11 ? year + 1 : year;
|
|
60
|
+
for (let i = 1; week.length < 7; i++) {
|
|
61
|
+
week.push({ day: i, year: nextYear, month: nextMonth, currentMonth: false });
|
|
62
|
+
}
|
|
63
|
+
weeks.push(week);
|
|
64
|
+
return weeks;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const todayStr = $derived(toYYYYMMDD(now.getFullYear(), now.getMonth(), now.getDate()));
|
|
68
|
+
const weeks = $derived(getMonthGrid(view.year, view.month));
|
|
69
|
+
const monthLabel = $derived(`${MONTHS[view.month]} ${view.year}`);
|
|
70
|
+
|
|
71
|
+
function prevMonth() {
|
|
72
|
+
view = view.month === 0 ? { year: view.year - 1, month: 11 } : { year: view.year, month: view.month - 1 };
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function nextMonth() {
|
|
76
|
+
view = view.month === 11 ? { year: view.year + 1, month: 0 } : { year: view.year, month: view.month + 1 };
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function select(dateStr: string) {
|
|
80
|
+
onSelect?.(dateStr);
|
|
81
|
+
}
|
|
82
|
+
</script>
|
|
83
|
+
|
|
84
|
+
<div class="calendar {className}" {id} role="group" aria-label={label} data-calendar>
|
|
85
|
+
<div class="calendar__header">
|
|
86
|
+
<button type="button" class="calendar__prev" aria-label="Previous month" onclick={prevMonth}>
|
|
87
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg>
|
|
88
|
+
</button>
|
|
89
|
+
<div class="calendar__month" aria-live="polite">{monthLabel}</div>
|
|
90
|
+
<button type="button" class="calendar__next" aria-label="Next month" onclick={nextMonth}>
|
|
91
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 18 6-6-6-6"/></svg>
|
|
92
|
+
</button>
|
|
93
|
+
</div>
|
|
94
|
+
<div class="calendar__grid" role="grid" aria-label={monthLabel}>
|
|
95
|
+
<div class="calendar__row" role="row">
|
|
96
|
+
{#each WEEKDAYS as day}
|
|
97
|
+
<div class="calendar__weekday" role="columnheader" aria-label={day}>{day}</div>
|
|
98
|
+
{/each}
|
|
99
|
+
</div>
|
|
100
|
+
{#each weeks as week}
|
|
101
|
+
<div class="calendar__row" role="row">
|
|
102
|
+
{#each week as cell}
|
|
103
|
+
{@const dateStr = toYYYYMMDD(cell.year, cell.month, cell.day)}
|
|
104
|
+
<div role="gridcell">
|
|
105
|
+
<button
|
|
106
|
+
type="button"
|
|
107
|
+
class="calendar__day
|
|
108
|
+
{!cell.currentMonth ? ' calendar__day--other-month' : ''}
|
|
109
|
+
{dateStr === todayStr ? ' calendar__day--today' : ''}
|
|
110
|
+
{(selected ?? '') === dateStr ? ' calendar__day--selected' : ''}"
|
|
111
|
+
aria-label="Choose {MONTHS[cell.month]} {cell.day}, {cell.year}"
|
|
112
|
+
onclick={() => select(dateStr)}
|
|
113
|
+
>
|
|
114
|
+
{cell.day}
|
|
115
|
+
</button>
|
|
116
|
+
</div>
|
|
117
|
+
{/each}
|
|
118
|
+
</div>
|
|
119
|
+
{/each}
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
id?: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
showIndicators?: boolean;
|
|
8
|
+
class?: string;
|
|
9
|
+
children?: Snippet;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
let {
|
|
13
|
+
id: carouselId,
|
|
14
|
+
label = 'Carousel',
|
|
15
|
+
showIndicators = true,
|
|
16
|
+
class: className = '',
|
|
17
|
+
children,
|
|
18
|
+
}: Props = $props();
|
|
19
|
+
|
|
20
|
+
const id = $derived(carouselId ?? `carousel-${Math.random().toString(36).slice(2, 9)}`);
|
|
21
|
+
let viewportEl: HTMLDivElement;
|
|
22
|
+
let trackEl: HTMLDivElement;
|
|
23
|
+
let index = $state(0);
|
|
24
|
+
let total = $state(0);
|
|
25
|
+
|
|
26
|
+
$effect(() => {
|
|
27
|
+
if (!trackEl) return;
|
|
28
|
+
const slides = trackEl.querySelectorAll('.carousel__slide');
|
|
29
|
+
total = slides.length;
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
$effect(() => {
|
|
33
|
+
if (!viewportEl || !trackEl || total === 0) return;
|
|
34
|
+
const w = viewportEl.offsetWidth;
|
|
35
|
+
trackEl.style.transform = `translateX(${-index * w}px)`;
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
function goTo(i: number) {
|
|
39
|
+
index = Math.max(0, Math.min(i, total - 1));
|
|
40
|
+
}
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<div class="carousel {className}" {id} role="region" aria-roledescription="carousel" aria-label={label} data-carousel>
|
|
44
|
+
<div class="carousel__viewport" bind:this={viewportEl} data-carousel-viewport>
|
|
45
|
+
<div class="carousel__track" bind:this={trackEl} data-carousel-track>
|
|
46
|
+
{@render children?.()}
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
<div class="carousel__controls">
|
|
51
|
+
<button
|
|
52
|
+
type="button"
|
|
53
|
+
class="carousel__prev"
|
|
54
|
+
aria-label="Previous slide"
|
|
55
|
+
onclick={() => goTo(index - 1)}
|
|
56
|
+
disabled={index === 0}
|
|
57
|
+
>
|
|
58
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg>
|
|
59
|
+
</button>
|
|
60
|
+
|
|
61
|
+
{#if showIndicators && total > 0}
|
|
62
|
+
<div class="carousel__indicators" role="tablist" aria-label="Slide indicators">
|
|
63
|
+
{#each Array(total) as _, i}
|
|
64
|
+
<button
|
|
65
|
+
type="button"
|
|
66
|
+
role="tab"
|
|
67
|
+
aria-label="Slide {i + 1}"
|
|
68
|
+
aria-selected={i === index}
|
|
69
|
+
class="carousel__indicator"
|
|
70
|
+
onclick={() => goTo(i)}
|
|
71
|
+
/>
|
|
72
|
+
{/each}
|
|
73
|
+
</div>
|
|
74
|
+
{/if}
|
|
75
|
+
|
|
76
|
+
<button
|
|
77
|
+
type="button"
|
|
78
|
+
class="carousel__next"
|
|
79
|
+
aria-label="Next slide"
|
|
80
|
+
onclick={() => goTo(index + 1)}
|
|
81
|
+
disabled={index >= total - 1}
|
|
82
|
+
>
|
|
83
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 18 6-6-6-6"/></svg>
|
|
84
|
+
</button>
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
Design system · Vanilla · Astro · Svelte
|
|
16
16
|
</pre>
|
|
17
17
|
|
|
18
|
-
SvelteKit project with Rizzo CSS. Scaffolded with `npx rizzo-css init` when you chose **Create new** and Svelte, then **Landing**, **Docs**, **Dashboard**, or **Full**. **Full** = clone of the docs site. **Landing** / **Docs** / **Dashboard** = base + component picker (all
|
|
18
|
+
SvelteKit project with Rizzo CSS. Scaffolded with `npx rizzo-css init` when you chose **Create new** and Svelte, then **Landing**, **Docs**, **Dashboard**, or **Full**. **Full** = clone of the docs site. **Landing** / **Docs** / **Dashboard** = base + component picker (all 52 or pick). Same template choice for **Add to existing** (`npx rizzo-css add`).
|
|
19
19
|
|
|
20
20
|
## Setup
|
|
21
21
|
|
package/scaffold/svelte/index.ts
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
export { default as Button } from './Button.svelte';
|
|
6
6
|
export { default as Badge } from './Badge.svelte';
|
|
7
7
|
export { default as Card } from './Card.svelte';
|
|
8
|
+
export { default as Calendar } from './Calendar.svelte';
|
|
9
|
+
export { default as Carousel } from './Carousel.svelte';
|
|
8
10
|
export { default as Dashboard } from './Dashboard.svelte';
|
|
9
11
|
export { default as Divider } from './Divider.svelte';
|
|
10
12
|
export { default as Footer } from './Footer.svelte';
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
Design system · Vanilla · Astro · Svelte
|
|
16
16
|
</pre>
|
|
17
17
|
|
|
18
|
-
SvelteKit project with Rizzo CSS. Scaffolded with `npx rizzo-css init` when you chose **Create new** and Svelte, then **Full** template. **Full** = clone of the Rizzo docs site (no component picker). **Landing** / **Docs** / **Dashboard** = base + component picker (all
|
|
18
|
+
SvelteKit project with Rizzo CSS. Scaffolded with `npx rizzo-css init` when you chose **Create new** and Svelte, then **Full** template. **Full** = clone of the Rizzo docs site (no component picker). **Landing** / **Docs** / **Dashboard** = base + component picker (all 52 or pick). Same template choice for **Add to existing** (`npx rizzo-css add`).
|
|
19
19
|
|
|
20
20
|
## Setup
|
|
21
21
|
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
Design system · Vanilla · Astro · Svelte
|
|
16
16
|
</pre>
|
|
17
17
|
|
|
18
|
-
This project was scaffolded with `npx rizzo-css init` when you chose **Create new project** and Vanilla JS, then **Landing**, **Docs**, **Dashboard**, or **Full**. **Full** = clone of the docs site. **Landing** / **Docs** / **Dashboard** = CSS, fonts, icons, sfx + component picker (all
|
|
18
|
+
This project was scaffolded with `npx rizzo-css init` when you chose **Create new project** and Vanilla JS, then **Landing**, **Docs**, **Dashboard**, or **Full**. **Full** = clone of the docs site. **Landing** / **Docs** / **Dashboard** = CSS, fonts, icons, sfx + component picker (all 52 or pick); Landing adds hero/features; Docs adds sidebar + sample doc; Dashboard adds sidebar + stats/table. **Add to existing project** (or `npx rizzo-css add`) uses the **same template choice**; you must add the stylesheet `<link>` yourself (CLI prints the exact tag).
|
|
19
19
|
|
|
20
20
|
## First-time setup
|
|
21
21
|
|
|
@@ -28,7 +28,7 @@ If you prefer to load CSS from a CDN instead of the local file, replace the `<li
|
|
|
28
28
|
- `<link rel="stylesheet" href="https://unpkg.com/rizzo-css@latest/dist/rizzo.min.css" />`
|
|
29
29
|
- Or jsDelivr: `https://cdn.jsdelivr.net/npm/rizzo-css@latest/dist/rizzo.min.css`
|
|
30
30
|
|
|
31
|
-
(Replace `@latest` with a specific version, e.g. `@0.0.
|
|
31
|
+
(Replace `@latest` with a specific version, e.g. `@0.0.68`, in production.)
|
|
32
32
|
|
|
33
33
|
The CLI replaces placeholders in `index.html` (e.g. `{{DATA_THEME}}`, `{{TITLE}}`) when you run `rizzo-css init`. The theme selected during init is used on first load when you have no saved preference in the browser.
|
|
34
34
|
|