shapes-ui 0.4.2 → 0.5.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/.github/ISSUE_TEMPLATE/bug_report.yml +47 -0
- package/.github/ISSUE_TEMPLATE/config.yml +1 -0
- package/.github/ISSUE_TEMPLATE/feature_request.yml +31 -0
- package/.github/pull_request_template.md +14 -0
- package/.github/workflows/pr-preview.yml +68 -0
- package/.github/workflows/release.yml +8 -0
- package/CHANGELOG.md +19 -0
- package/CODE_OF_CONDUCT.md +41 -0
- package/CONTRIBUTING.md +52 -0
- package/README.md +5 -0
- package/SECURITY.md +0 -0
- package/content/components/field.mdx +2 -2
- package/content/components/fieldset.mdx +1 -1
- package/content/components/radio.mdx +20 -0
- package/content/components/select.mdx +30 -0
- package/content/components/slider.mdx +48 -0
- package/content/components/switch.mdx +26 -0
- package/content/components/tabs.mdx +32 -0
- package/content/components/toast.mdx +60 -0
- package/content/components/toggle.mdx +34 -2
- package/content/components/toolbar.mdx +26 -0
- package/content/components/tooltip.mdx +25 -0
- package/content-collections.ts +1 -1
- package/examples/__index.tsx +186 -0
- package/examples/checkbox-demo.tsx +1 -1
- package/examples/checkbox-form.tsx +3 -3
- package/examples/field-custom-control.tsx +33 -9
- package/examples/form-demo.tsx +5 -10
- package/examples/menu-advanced.tsx +1 -3
- package/examples/menu-align.tsx +19 -16
- package/examples/menu-checkbox.tsx +2 -3
- package/examples/menu-demo.tsx +1 -3
- package/examples/menu-group.tsx +1 -3
- package/examples/menu-radio.tsx +1 -3
- package/examples/menu-submenu.tsx +2 -3
- package/examples/meter-demo.tsx +10 -2
- package/examples/meter-flip.tsx +8 -8
- package/examples/meter-no-label.tsx +9 -2
- package/examples/meter-no-value.tsx +7 -8
- package/examples/radio-card.tsx +28 -0
- package/examples/radio-demo.tsx +19 -1
- package/examples/radio-description.tsx +26 -0
- package/examples/radio-orientation.tsx +21 -0
- package/examples/select-alignment.tsx +51 -0
- package/examples/select-demo.tsx +36 -1
- package/examples/select-disabled.tsx +38 -0
- package/examples/select-groups.tsx +54 -0
- package/examples/select-invalid.tsx +41 -0
- package/examples/select-scrollable.tsx +112 -0
- package/examples/slider-controlled.tsx +28 -0
- package/examples/slider-demo.tsx +3 -1
- package/examples/slider-disabled.tsx +7 -0
- package/examples/slider-edge.tsx +13 -0
- package/examples/slider-multiple.tsx +7 -0
- package/examples/slider-range.tsx +5 -0
- package/examples/slider-vertical.tsx +10 -0
- package/examples/switch-demo.tsx +19 -1
- package/examples/switch-disabled.tsx +20 -0
- package/examples/switch-sizes.tsx +24 -0
- package/examples/switch-with-label.tsx +16 -0
- package/examples/tabs-demo.tsx +14 -1
- package/examples/tabs-disabled.tsx +21 -0
- package/examples/tabs-line.tsx +18 -0
- package/examples/tabs-vertical.tsx +13 -0
- package/examples/toast-action.tsx +39 -0
- package/examples/toast-anchored.tsx +36 -0
- package/examples/toast-demo.tsx +27 -1
- package/examples/toast-positions.tsx +54 -0
- package/examples/toast-promise.tsx +51 -0
- package/examples/toast-stacked.tsx +30 -0
- package/examples/toast-timeout.tsx +43 -0
- package/examples/toast-update.tsx +38 -0
- package/examples/toast-variants.tsx +54 -0
- package/examples/toggle-controlled.tsx +20 -0
- package/examples/toggle-demo.tsx +7 -51
- package/examples/toggle-group-demo.tsx +19 -0
- package/examples/toggle-group-multiple.tsx +19 -0
- package/examples/toggle-icon-fill.tsx +12 -0
- package/examples/toolbar-demo.tsx +45 -21
- package/examples/toolbar-input-link.tsx +35 -0
- package/examples/toolbar-menu.tsx +53 -0
- package/examples/tooltip-demo.tsx +48 -0
- package/examples/tooltip-positions.tsx +60 -0
- package/package.json +8 -8
- package/public/r/drawer.json +1 -1
- package/public/r/field.json +1 -1
- package/public/r/meter.json +1 -1
- package/public/r/number-field.json +1 -1
- package/public/r/progress.json +1 -1
- package/public/r/radio.json +1 -1
- package/public/r/select.json +1 -1
- package/public/r/slider.json +1 -1
- package/public/r/switch.json +1 -1
- package/public/r/tabs.json +1 -1
- package/public/r/toast.json +2 -1
- package/public/r/toggle.json +1 -1
- package/public/r/toolbar.json +1 -1
- package/public/r/tooltip.json +15 -0
- package/src/components/docs/layout/header.tsx +4 -14
- package/src/components/docs/layout/mobile-menu.tsx +27 -78
- package/src/components/docs/layout/nav-list.tsx +27 -21
- package/src/components/docs/layout/split-layout.tsx +6 -3
- package/src/components/ui/badge.tsx +1 -1
- package/src/components/ui/checkbox.tsx +1 -1
- package/src/components/ui/drawer.tsx +1 -1
- package/src/components/ui/field.tsx +9 -28
- package/src/components/ui/form.tsx +1 -1
- package/src/components/ui/meter.tsx +12 -26
- package/src/components/ui/number-field.tsx +1 -1
- package/src/components/ui/radio.tsx +32 -19
- package/src/components/ui/select.tsx +6 -6
- package/src/components/ui/slider.tsx +8 -5
- package/src/components/ui/switch.tsx +13 -17
- package/src/components/ui/tabs.tsx +23 -10
- package/src/components/ui/toast.tsx +190 -29
- package/src/components/ui/toggle.tsx +1 -1
- package/src/components/ui/toolbar.tsx +17 -4
- package/src/components/ui/tooltip.tsx +54 -0
- package/src/routes/__root.tsx +3 -5
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Field, FieldLabel } from "@/components/ui/field";
|
|
2
|
+
import { Radio, RadioGroup } from "@/components/ui/radio";
|
|
3
|
+
|
|
4
|
+
export default function RadioOrientationDemo() {
|
|
5
|
+
return (
|
|
6
|
+
<RadioGroup orientation="horizontal">
|
|
7
|
+
<Field className="flex-row items-center *:w-auto">
|
|
8
|
+
<Radio value={"left"} />
|
|
9
|
+
<FieldLabel>Left</FieldLabel>
|
|
10
|
+
</Field>
|
|
11
|
+
<Field className="flex-row items-center *:w-auto">
|
|
12
|
+
<Radio value={"middle"} />
|
|
13
|
+
<FieldLabel>Middle</FieldLabel>
|
|
14
|
+
</Field>
|
|
15
|
+
<Field className="flex-row items-center *:w-auto">
|
|
16
|
+
<Radio value={"right"} />
|
|
17
|
+
<FieldLabel>Right</FieldLabel>
|
|
18
|
+
</Field>
|
|
19
|
+
</RadioGroup>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import { Checkbox } from "@/components/ui/checkbox";
|
|
4
|
+
import { Field, FieldLabel } from "@/components/ui/field";
|
|
5
|
+
import { Fieldset } from "@/components/ui/fieldset";
|
|
6
|
+
import {
|
|
7
|
+
Select,
|
|
8
|
+
SelectGroup,
|
|
9
|
+
SelectItem,
|
|
10
|
+
SelectPopup,
|
|
11
|
+
SelectTrigger,
|
|
12
|
+
SelectValue,
|
|
13
|
+
} from "@/components/ui/select";
|
|
14
|
+
|
|
15
|
+
const items = [
|
|
16
|
+
{ label: "Select a framework", value: null },
|
|
17
|
+
{ label: "React", value: "react" },
|
|
18
|
+
{ label: "Vue", value: "vue" },
|
|
19
|
+
{ label: "Angular", value: "angular" },
|
|
20
|
+
{ label: "Svelte", value: "svelte" },
|
|
21
|
+
{ label: "Ember", value: "ember" },
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
export default function SelectAlignItem() {
|
|
25
|
+
const [alignItemWithTrigger, setAlignItemWithTrigger] = React.useState(true);
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<Fieldset className="w-full max-w-xs">
|
|
29
|
+
<Field name="alignment-trigger" className="flex-row items-center *:w-auto">
|
|
30
|
+
<Checkbox checked={alignItemWithTrigger} onCheckedChange={setAlignItemWithTrigger} />
|
|
31
|
+
<FieldLabel>Toggle to align the item with the trigger.</FieldLabel>
|
|
32
|
+
</Field>
|
|
33
|
+
<Field>
|
|
34
|
+
<Select items={items} defaultValue={"react"}>
|
|
35
|
+
<SelectTrigger>
|
|
36
|
+
<SelectValue />
|
|
37
|
+
</SelectTrigger>
|
|
38
|
+
<SelectPopup alignItemWithTrigger={alignItemWithTrigger}>
|
|
39
|
+
<SelectGroup>
|
|
40
|
+
{items.map((item) => (
|
|
41
|
+
<SelectItem key={item.value} value={item.value}>
|
|
42
|
+
{item.label}
|
|
43
|
+
</SelectItem>
|
|
44
|
+
))}
|
|
45
|
+
</SelectGroup>
|
|
46
|
+
</SelectPopup>
|
|
47
|
+
</Select>
|
|
48
|
+
</Field>
|
|
49
|
+
</Fieldset>
|
|
50
|
+
);
|
|
51
|
+
}
|
package/examples/select-demo.tsx
CHANGED
|
@@ -1,3 +1,38 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Select,
|
|
3
|
+
SelectPopup,
|
|
4
|
+
SelectGroup,
|
|
5
|
+
SelectItem,
|
|
6
|
+
SelectLabel,
|
|
7
|
+
SelectTrigger,
|
|
8
|
+
SelectValue,
|
|
9
|
+
} from "@/components/ui/select";
|
|
10
|
+
|
|
11
|
+
const items = [
|
|
12
|
+
{ label: "Select a provider", value: null },
|
|
13
|
+
{ label: "Google Cloud", value: "google-cloud" },
|
|
14
|
+
{ label: "Amazon Web Services", value: "aws" },
|
|
15
|
+
{ label: "Microsoft Azure", value: "azure" },
|
|
16
|
+
{ label: "IBM Cloud", value: "ibm-cloud" },
|
|
17
|
+
{ label: "Oracle Cloud", value: "oracle-cloud" },
|
|
18
|
+
];
|
|
19
|
+
|
|
1
20
|
export default function SelectDemo() {
|
|
2
|
-
return
|
|
21
|
+
return (
|
|
22
|
+
<Select items={items}>
|
|
23
|
+
<SelectTrigger className="w-full max-w-48">
|
|
24
|
+
<SelectValue />
|
|
25
|
+
</SelectTrigger>
|
|
26
|
+
<SelectPopup>
|
|
27
|
+
<SelectGroup>
|
|
28
|
+
<SelectLabel>Cloud Providers</SelectLabel>
|
|
29
|
+
{items.map((item) => (
|
|
30
|
+
<SelectItem key={item.value} value={item.value}>
|
|
31
|
+
{item.label}
|
|
32
|
+
</SelectItem>
|
|
33
|
+
))}
|
|
34
|
+
</SelectGroup>
|
|
35
|
+
</SelectPopup>
|
|
36
|
+
</Select>
|
|
37
|
+
);
|
|
3
38
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Select,
|
|
3
|
+
SelectPopup,
|
|
4
|
+
SelectGroup,
|
|
5
|
+
SelectItem,
|
|
6
|
+
SelectLabel,
|
|
7
|
+
SelectTrigger,
|
|
8
|
+
SelectValue,
|
|
9
|
+
} from "@/components/ui/select";
|
|
10
|
+
|
|
11
|
+
const items = [
|
|
12
|
+
{ label: "Select a provider", value: null },
|
|
13
|
+
{ label: "Google Cloud", value: "google-cloud" },
|
|
14
|
+
{ label: "Amazon Web Services", value: "aws" },
|
|
15
|
+
{ label: "Microsoft Azure", value: "azure" },
|
|
16
|
+
{ label: "IBM Cloud", value: "ibm-cloud" },
|
|
17
|
+
{ label: "Oracle Cloud", value: "oracle-cloud" },
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
export default function SelectDisabled() {
|
|
21
|
+
return (
|
|
22
|
+
<Select items={items} disabled>
|
|
23
|
+
<SelectTrigger className="w-full max-w-48">
|
|
24
|
+
<SelectValue />
|
|
25
|
+
</SelectTrigger>
|
|
26
|
+
<SelectPopup>
|
|
27
|
+
<SelectGroup>
|
|
28
|
+
<SelectLabel>Cloud Providers</SelectLabel>
|
|
29
|
+
{items.map((item) => (
|
|
30
|
+
<SelectItem key={item.value} value={item.value}>
|
|
31
|
+
{item.label}
|
|
32
|
+
</SelectItem>
|
|
33
|
+
))}
|
|
34
|
+
</SelectGroup>
|
|
35
|
+
</SelectPopup>
|
|
36
|
+
</Select>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Select,
|
|
3
|
+
SelectPopup,
|
|
4
|
+
SelectGroup,
|
|
5
|
+
SelectItem,
|
|
6
|
+
SelectLabel,
|
|
7
|
+
SelectSeparator,
|
|
8
|
+
SelectTrigger,
|
|
9
|
+
SelectValue,
|
|
10
|
+
} from "@/components/ui/select";
|
|
11
|
+
|
|
12
|
+
export default function SelectGroups() {
|
|
13
|
+
const frameworks = [
|
|
14
|
+
{ label: "React", value: "react" },
|
|
15
|
+
{ label: "Vue", value: "vue" },
|
|
16
|
+
{ label: "Angular", value: "angular" },
|
|
17
|
+
{ label: "Svelte", value: "svelte" },
|
|
18
|
+
{ label: "Ember", value: "ember" },
|
|
19
|
+
];
|
|
20
|
+
const metaFrameworks = [
|
|
21
|
+
{ label: "Tanstack Start", value: "tanstack-start" },
|
|
22
|
+
{ label: "Remix", value: "remix" },
|
|
23
|
+
{ label: "React Router", value: "react-router" },
|
|
24
|
+
{ label: "Next.js", value: "nextjs" },
|
|
25
|
+
];
|
|
26
|
+
const allItems = [{ label: "Select a framework", value: null }, ...frameworks, ...metaFrameworks];
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Select items={allItems}>
|
|
30
|
+
<SelectTrigger className="w-full max-w-48">
|
|
31
|
+
<SelectValue />
|
|
32
|
+
</SelectTrigger>
|
|
33
|
+
<SelectPopup>
|
|
34
|
+
<SelectGroup>
|
|
35
|
+
<SelectLabel>Frameworks</SelectLabel>
|
|
36
|
+
{frameworks.map((item) => (
|
|
37
|
+
<SelectItem key={item.value} value={item.value}>
|
|
38
|
+
{item.label}
|
|
39
|
+
</SelectItem>
|
|
40
|
+
))}
|
|
41
|
+
</SelectGroup>
|
|
42
|
+
<SelectSeparator />
|
|
43
|
+
<SelectGroup>
|
|
44
|
+
<SelectLabel>Meta Frameworks</SelectLabel>
|
|
45
|
+
{metaFrameworks.map((item) => (
|
|
46
|
+
<SelectItem key={item.value} value={item.value}>
|
|
47
|
+
{item.label}
|
|
48
|
+
</SelectItem>
|
|
49
|
+
))}
|
|
50
|
+
</SelectGroup>
|
|
51
|
+
</SelectPopup>
|
|
52
|
+
</Select>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Field, FieldError, FieldLabel } from "@/components/ui/field";
|
|
2
|
+
import {
|
|
3
|
+
Select,
|
|
4
|
+
SelectPopup,
|
|
5
|
+
SelectGroup,
|
|
6
|
+
SelectItem,
|
|
7
|
+
SelectTrigger,
|
|
8
|
+
SelectValue,
|
|
9
|
+
} from "@/components/ui/select";
|
|
10
|
+
|
|
11
|
+
const items = [
|
|
12
|
+
{ label: "Select a provider", value: null },
|
|
13
|
+
{ label: "Google Cloud", value: "google-cloud" },
|
|
14
|
+
{ label: "Amazon Web Services", value: "aws" },
|
|
15
|
+
{ label: "Microsoft Azure", value: "azure" },
|
|
16
|
+
{ label: "IBM Cloud", value: "ibm-cloud" },
|
|
17
|
+
{ label: "Oracle Cloud", value: "oracle-cloud" },
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
export default function SelectInvalid() {
|
|
21
|
+
return (
|
|
22
|
+
<Field invalid data-invalid className="w-full max-w-48">
|
|
23
|
+
<FieldLabel>Provider</FieldLabel>
|
|
24
|
+
<Select items={items}>
|
|
25
|
+
<SelectTrigger aria-invalid>
|
|
26
|
+
<SelectValue />
|
|
27
|
+
</SelectTrigger>
|
|
28
|
+
<SelectPopup>
|
|
29
|
+
<SelectGroup>
|
|
30
|
+
{items.map((item) => (
|
|
31
|
+
<SelectItem key={item.value} value={item.value}>
|
|
32
|
+
{item.label}
|
|
33
|
+
</SelectItem>
|
|
34
|
+
))}
|
|
35
|
+
</SelectGroup>
|
|
36
|
+
</SelectPopup>
|
|
37
|
+
</Select>
|
|
38
|
+
<FieldError> Please select a provider.</FieldError>
|
|
39
|
+
</Field>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Select,
|
|
3
|
+
SelectPopup,
|
|
4
|
+
SelectGroup,
|
|
5
|
+
SelectItem,
|
|
6
|
+
SelectLabel,
|
|
7
|
+
SelectTrigger,
|
|
8
|
+
SelectValue,
|
|
9
|
+
} from "@/components/ui/select";
|
|
10
|
+
|
|
11
|
+
const northAmerica = [
|
|
12
|
+
{ label: "Eastern Standard Time", value: "est" },
|
|
13
|
+
{ label: "Central Standard Time", value: "cst" },
|
|
14
|
+
{ label: "Mountain Standard Time", value: "mst" },
|
|
15
|
+
{ label: "Pacific Standard Time", value: "pst" },
|
|
16
|
+
{ label: "Alaska Standard Time", value: "akst" },
|
|
17
|
+
{ label: "Hawaii Standard Time", value: "hst" },
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
const europeAfrica = [
|
|
21
|
+
{ label: "Greenwich Mean Time", value: "gmt" },
|
|
22
|
+
{ label: "Central European Time", value: "cet" },
|
|
23
|
+
{ label: "Eastern European Time", value: "eet" },
|
|
24
|
+
{ label: "Western European Summer Time", value: "west" },
|
|
25
|
+
{ label: "Central Africa Time", value: "cat" },
|
|
26
|
+
{ label: "East Africa Time", value: "eat" },
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
const asia = [
|
|
30
|
+
{ label: "Moscow Time", value: "msk" },
|
|
31
|
+
{ label: "India Standard Time", value: "ist" },
|
|
32
|
+
{ label: "China Standard Time", value: "cst_china" },
|
|
33
|
+
{ label: "Japan Standard Time", value: "jst" },
|
|
34
|
+
{ label: "Korea Standard Time", value: "kst" },
|
|
35
|
+
{ label: "Indonesia Central Standard Time", value: "ist_indonesia" },
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
const australiaPacific = [
|
|
39
|
+
{ label: "Australian Western Standard Time", value: "awst" },
|
|
40
|
+
{ label: "Australian Central Standard Time", value: "acst" },
|
|
41
|
+
{ label: "Australian Eastern Standard Time", value: "aest" },
|
|
42
|
+
{ label: "New Zealand Standard Time", value: "nzst" },
|
|
43
|
+
{ label: "Fiji Time", value: "fjt" },
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
const southAmerica = [
|
|
47
|
+
{ label: "Argentina Time", value: "art" },
|
|
48
|
+
{ label: "Bolivia Time", value: "bot" },
|
|
49
|
+
{ label: "Brasilia Time", value: "brt" },
|
|
50
|
+
{ label: "Chile Standard Time", value: "clt" },
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
const items = [
|
|
54
|
+
{ label: "Select a timezone", value: null },
|
|
55
|
+
...northAmerica,
|
|
56
|
+
...europeAfrica,
|
|
57
|
+
...asia,
|
|
58
|
+
...australiaPacific,
|
|
59
|
+
...southAmerica,
|
|
60
|
+
];
|
|
61
|
+
|
|
62
|
+
export default function SelectScrollable() {
|
|
63
|
+
return (
|
|
64
|
+
<Select items={items}>
|
|
65
|
+
<SelectTrigger className="w-full max-w-64">
|
|
66
|
+
<SelectValue />
|
|
67
|
+
</SelectTrigger>
|
|
68
|
+
<SelectPopup>
|
|
69
|
+
<SelectGroup>
|
|
70
|
+
<SelectLabel>North America</SelectLabel>
|
|
71
|
+
{northAmerica.map((item) => (
|
|
72
|
+
<SelectItem key={item.value} value={item.value}>
|
|
73
|
+
{item.label}
|
|
74
|
+
</SelectItem>
|
|
75
|
+
))}
|
|
76
|
+
</SelectGroup>
|
|
77
|
+
<SelectGroup>
|
|
78
|
+
<SelectLabel>Europe & Africa</SelectLabel>
|
|
79
|
+
{europeAfrica.map((item) => (
|
|
80
|
+
<SelectItem key={item.value} value={item.value}>
|
|
81
|
+
{item.label}
|
|
82
|
+
</SelectItem>
|
|
83
|
+
))}
|
|
84
|
+
</SelectGroup>
|
|
85
|
+
<SelectGroup>
|
|
86
|
+
<SelectLabel>Asia</SelectLabel>
|
|
87
|
+
{asia.map((item) => (
|
|
88
|
+
<SelectItem key={item.value} value={item.value}>
|
|
89
|
+
{item.label}
|
|
90
|
+
</SelectItem>
|
|
91
|
+
))}
|
|
92
|
+
</SelectGroup>
|
|
93
|
+
<SelectGroup>
|
|
94
|
+
<SelectLabel>Australia & Pacific</SelectLabel>
|
|
95
|
+
{australiaPacific.map((item) => (
|
|
96
|
+
<SelectItem key={item.value} value={item.value}>
|
|
97
|
+
{item.label}
|
|
98
|
+
</SelectItem>
|
|
99
|
+
))}
|
|
100
|
+
</SelectGroup>
|
|
101
|
+
<SelectGroup>
|
|
102
|
+
<SelectLabel>South America</SelectLabel>
|
|
103
|
+
{southAmerica.map((item) => (
|
|
104
|
+
<SelectItem key={item.value} value={item.value}>
|
|
105
|
+
{item.label}
|
|
106
|
+
</SelectItem>
|
|
107
|
+
))}
|
|
108
|
+
</SelectGroup>
|
|
109
|
+
</SelectPopup>
|
|
110
|
+
</Select>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
5
|
+
import { Slider } from "@/components/ui/slider";
|
|
6
|
+
|
|
7
|
+
export default function SliderControlled() {
|
|
8
|
+
const [value, setValue] = React.useState([0.3, 0.7]);
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<div className="mx-auto grid w-full max-w-xs gap-3">
|
|
12
|
+
<div className="flex items-center justify-between gap-2">
|
|
13
|
+
<label htmlFor="slider-demo-temperature" className="text-sm font-medium">
|
|
14
|
+
Temperature
|
|
15
|
+
</label>
|
|
16
|
+
<span className="text-sm text-muted-foreground">{value.join(", ")}</span>
|
|
17
|
+
</div>
|
|
18
|
+
<Slider
|
|
19
|
+
id="slider-demo-temperature"
|
|
20
|
+
value={value}
|
|
21
|
+
onValueChange={(nextValue) => setValue(nextValue as number[])}
|
|
22
|
+
min={0}
|
|
23
|
+
max={1}
|
|
24
|
+
step={0.1}
|
|
25
|
+
/>
|
|
26
|
+
</div>
|
|
27
|
+
);
|
|
28
|
+
}
|
package/examples/slider-demo.tsx
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Slider } from "@/components/ui/slider";
|
|
2
|
+
|
|
3
|
+
export default function SliderVertical() {
|
|
4
|
+
return (
|
|
5
|
+
<div className="mx-auto flex w-full max-w-xs items-center justify-center gap-6">
|
|
6
|
+
<Slider defaultValue={[50]} max={100} step={1} orientation="vertical" className="h-40" />
|
|
7
|
+
<Slider defaultValue={[25]} max={100} step={1} orientation="vertical" className="h-40" />
|
|
8
|
+
</div>
|
|
9
|
+
);
|
|
10
|
+
}
|
package/examples/switch-demo.tsx
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
|
|
5
|
+
import { Switch } from "@/components/ui/switch";
|
|
6
|
+
|
|
1
7
|
export default function SwitchDemo() {
|
|
2
|
-
|
|
8
|
+
const [enabled, setEnabled] = useState(true);
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<div className="flex max-w-sm gap-3">
|
|
12
|
+
<Switch id="marketing" checked={enabled} onCheckedChange={setEnabled}>
|
|
13
|
+
Receive product updates
|
|
14
|
+
</Switch>
|
|
15
|
+
<p className="text-sm text-muted-foreground">
|
|
16
|
+
Marketing emails are currently{" "}
|
|
17
|
+
<span className="font-medium">{enabled ? "enabled" : "disabled"}</span>.
|
|
18
|
+
</p>
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
3
21
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Switch } from "@/components/ui/switch";
|
|
2
|
+
|
|
3
|
+
export default function SwitchDisabled() {
|
|
4
|
+
return (
|
|
5
|
+
<div className="flex gap-4">
|
|
6
|
+
<div className="flex items-center gap-2">
|
|
7
|
+
<Switch id="size-default" disabled />
|
|
8
|
+
<label htmlFor="size-default" className="text-sm">
|
|
9
|
+
Disabled switch
|
|
10
|
+
</label>
|
|
11
|
+
</div>
|
|
12
|
+
<div className="flex items-center gap-2">
|
|
13
|
+
<Switch id="size-sm" checked disabled />
|
|
14
|
+
<label htmlFor="size-sm" className="text-sm">
|
|
15
|
+
Disabled checked switch
|
|
16
|
+
</label>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Switch } from "@/components/ui/switch";
|
|
2
|
+
|
|
3
|
+
export default function SwitchSizes() {
|
|
4
|
+
return (
|
|
5
|
+
<div className="flex gap-3">
|
|
6
|
+
<div className="flex items-center gap-2">
|
|
7
|
+
<Switch id="size-default" size="default">
|
|
8
|
+
Default size
|
|
9
|
+
</Switch>
|
|
10
|
+
<label htmlFor="size-default" className="text-sm">
|
|
11
|
+
Default size
|
|
12
|
+
</label>
|
|
13
|
+
</div>
|
|
14
|
+
<div className="flex items-center gap-2">
|
|
15
|
+
<Switch id="size-sm" size="sm">
|
|
16
|
+
Small size
|
|
17
|
+
</Switch>
|
|
18
|
+
<label htmlFor="size-sm" className="text-sm">
|
|
19
|
+
Small size
|
|
20
|
+
</label>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Field, FieldItem, FieldDescription, FieldLabel } from "@/components/ui/field";
|
|
2
|
+
import { Switch } from "@/components/ui/switch";
|
|
3
|
+
|
|
4
|
+
export default function SwitchDescription() {
|
|
5
|
+
return (
|
|
6
|
+
<Field className="max-w-sm flex-row items-start justify-between gap-4 *:w-auto">
|
|
7
|
+
<FieldItem className="flex-1">
|
|
8
|
+
<FieldLabel htmlFor="switch-focus-mode">Share across devices</FieldLabel>
|
|
9
|
+
<FieldDescription>
|
|
10
|
+
Focus is shared across devices, and turns off when you leave the app.
|
|
11
|
+
</FieldDescription>
|
|
12
|
+
</FieldItem>
|
|
13
|
+
<Switch id="switch-focus-mode" />
|
|
14
|
+
</Field>
|
|
15
|
+
);
|
|
16
|
+
}
|
package/examples/tabs-demo.tsx
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
import { Tabs, TabsPanel, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
|
2
|
+
|
|
1
3
|
export default function TabsDemo() {
|
|
2
|
-
return
|
|
4
|
+
return (
|
|
5
|
+
<Tabs defaultValue="account" className={"mx-auto w-full max-w-md"}>
|
|
6
|
+
<TabsList>
|
|
7
|
+
<TabsTrigger value="account">Account</TabsTrigger>
|
|
8
|
+
<TabsTrigger value="notifications">Notifications</TabsTrigger>
|
|
9
|
+
</TabsList>
|
|
10
|
+
<TabsPanel value="account">Manage your profile, password, and security settings.</TabsPanel>
|
|
11
|
+
<TabsPanel value="notifications">
|
|
12
|
+
Control email and in-app notification preferences.
|
|
13
|
+
</TabsPanel>
|
|
14
|
+
</Tabs>
|
|
15
|
+
);
|
|
3
16
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Tabs, TabsPanel, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
|
2
|
+
|
|
3
|
+
export default function TabsDisabled() {
|
|
4
|
+
return (
|
|
5
|
+
<Tabs defaultValue="public" className={"mx-auto w-full max-w-md"}>
|
|
6
|
+
<TabsList>
|
|
7
|
+
<TabsTrigger value="public">Public</TabsTrigger>
|
|
8
|
+
<TabsTrigger value="team">Team</TabsTrigger>
|
|
9
|
+
<TabsTrigger value="enterprise" disabled>
|
|
10
|
+
Enterprise
|
|
11
|
+
</TabsTrigger>
|
|
12
|
+
</TabsList>
|
|
13
|
+
<TabsPanel value="public" className="rounded-lg border p-4 text-sm text-muted-foreground">
|
|
14
|
+
Public documentation is available on all plans.
|
|
15
|
+
</TabsPanel>
|
|
16
|
+
<TabsPanel value="team" className="rounded-lg border p-4 text-sm text-muted-foreground">
|
|
17
|
+
Team features are available on the Pro plan.
|
|
18
|
+
</TabsPanel>
|
|
19
|
+
</Tabs>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Tabs, TabsPanel, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
|
2
|
+
|
|
3
|
+
export default function TabsLine() {
|
|
4
|
+
return (
|
|
5
|
+
<Tabs defaultValue="overview" className={"mx-auto w-full max-w-md"}>
|
|
6
|
+
<TabsList variant="line">
|
|
7
|
+
<TabsTrigger value="overview">Overview</TabsTrigger>
|
|
8
|
+
<TabsTrigger value="analytics">Analytics</TabsTrigger>
|
|
9
|
+
</TabsList>
|
|
10
|
+
<TabsPanel value="overview" className="pt-2 text-sm text-muted-foreground">
|
|
11
|
+
Review key account trends and recent activity.
|
|
12
|
+
</TabsPanel>
|
|
13
|
+
<TabsPanel value="analytics" className="pt-2 text-sm text-muted-foreground">
|
|
14
|
+
Compare traffic, retention, and conversion metrics.
|
|
15
|
+
</TabsPanel>
|
|
16
|
+
</Tabs>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
|
2
|
+
|
|
3
|
+
export default function TabsVertical() {
|
|
4
|
+
return (
|
|
5
|
+
<Tabs defaultValue="profile" orientation="vertical">
|
|
6
|
+
<TabsList className="min-w-36">
|
|
7
|
+
<TabsTrigger value="profile">Profile</TabsTrigger>
|
|
8
|
+
<TabsTrigger value="billing">Billing</TabsTrigger>
|
|
9
|
+
<TabsTrigger value="security">Security</TabsTrigger>
|
|
10
|
+
</TabsList>
|
|
11
|
+
</Tabs>
|
|
12
|
+
);
|
|
13
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Button } from "@/components/ui/button";
|
|
2
|
+
import { Toast, useToast } from "@/components/ui/toast";
|
|
3
|
+
|
|
4
|
+
export default function ToastAction() {
|
|
5
|
+
return (
|
|
6
|
+
<Toast>
|
|
7
|
+
<ToastActionTrigger />
|
|
8
|
+
</Toast>
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function ToastActionTrigger() {
|
|
13
|
+
const toast = useToast();
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<Button
|
|
17
|
+
variant="outline"
|
|
18
|
+
onClick={() => {
|
|
19
|
+
const toastId = toast.add({
|
|
20
|
+
title: "Project archived",
|
|
21
|
+
description: "The project was moved to archive.",
|
|
22
|
+
type: "success",
|
|
23
|
+
actionProps: {
|
|
24
|
+
children: "Undo",
|
|
25
|
+
onClick: () => {
|
|
26
|
+
toast.close(toastId);
|
|
27
|
+
toast.add({
|
|
28
|
+
title: "Archive reverted",
|
|
29
|
+
description: "The project is active again.",
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
}}
|
|
35
|
+
>
|
|
36
|
+
Archive project
|
|
37
|
+
</Button>
|
|
38
|
+
);
|
|
39
|
+
}
|