@tanstack/create 0.68.1 → 0.68.3
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/CHANGELOG.md +12 -0
- package/dist/create-app.js +22 -0
- package/dist/edge-add-ons.js +106 -0
- package/dist/edge-config-file.js +15 -0
- package/dist/edge-create-app.js +438 -0
- package/dist/edge-environment.js +141 -0
- package/dist/edge-file-helpers.js +88 -0
- package/dist/edge-frameworks.js +33 -0
- package/dist/edge-package-json.js +146 -0
- package/dist/edge-path.js +62 -0
- package/dist/edge-render.js +31 -0
- package/dist/edge-template-file.js +141 -0
- package/dist/edge.js +7 -0
- package/dist/frameworks/react/add-ons/storybook/info.json +5 -10
- package/dist/frameworks/react/project/base/_dot_gitignore +0 -1
- package/dist/frameworks/react/project/base/package.json +1 -0
- package/dist/frameworks/react/project/base/tsr.config.json +3 -0
- package/dist/frameworks/react/project/packages.json +3 -0
- package/dist/frameworks/solid/project/base/_dot_gitignore +0 -1
- package/dist/frameworks/solid/project/base/package.json +1 -0
- package/dist/frameworks/solid/project/base/tsr.config.json +3 -0
- package/dist/frameworks/solid/project/packages.json +3 -0
- package/dist/generated/create-manifest.js +4683 -0
- package/dist/manifest-types.js +1 -0
- package/dist/manifest.js +1 -0
- package/dist/types/custom-add-ons/add-on.d.ts +5 -3
- package/dist/types/edge-add-ons.d.ts +5 -0
- package/dist/types/edge-config-file.d.ts +8 -0
- package/dist/types/edge-create-app.d.ts +2 -0
- package/dist/types/edge-environment.d.ts +19 -0
- package/dist/types/edge-file-helpers.d.ts +7 -0
- package/dist/types/edge-frameworks.d.ts +7 -0
- package/dist/types/edge-package-json.d.ts +3 -0
- package/dist/types/edge-path.d.ts +5 -0
- package/dist/types/edge-render.d.ts +1 -0
- package/dist/types/edge-template-file.d.ts +2 -0
- package/dist/types/edge.d.ts +9 -0
- package/dist/types/generated/create-manifest.d.ts +36 -0
- package/dist/types/manifest-types.d.ts +4 -0
- package/dist/types/manifest.d.ts +1 -0
- package/dist/types/types.d.ts +96 -56
- package/dist/types.js +5 -3
- package/package.json +25 -5
- package/scripts/generate-manifest.mjs +407 -0
- package/src/create-app.ts +32 -1
- package/src/edge-add-ons.ts +138 -0
- package/src/edge-config-file.ts +35 -0
- package/src/edge-create-app.ts +594 -0
- package/src/edge-environment.ts +175 -0
- package/src/edge-file-helpers.ts +112 -0
- package/src/edge-frameworks.ts +54 -0
- package/src/edge-package-json.ts +212 -0
- package/src/edge-path.ts +77 -0
- package/src/edge-render.ts +32 -0
- package/src/edge-template-file.ts +204 -0
- package/src/edge.ts +43 -0
- package/src/frameworks/react/add-ons/storybook/info.json +5 -10
- package/src/frameworks/react/project/base/_dot_gitignore +0 -1
- package/src/frameworks/react/project/base/package.json +1 -0
- package/src/frameworks/react/project/base/tsr.config.json +3 -0
- package/src/frameworks/react/project/packages.json +3 -0
- package/src/frameworks/solid/project/base/_dot_gitignore +0 -1
- package/src/frameworks/solid/project/base/package.json +1 -0
- package/src/frameworks/solid/project/base/tsr.config.json +3 -0
- package/src/frameworks/solid/project/packages.json +3 -0
- package/src/generated/create-manifest.ts +6490 -0
- package/src/manifest-types.ts +8 -0
- package/src/manifest.ts +1 -0
- package/src/types.ts +5 -3
- package/tests/create-app.test.ts +39 -3
- package/tests/edge-import.test.ts +31 -0
- package/tests/edge-manifest.test.ts +168 -0
- package/tests/framework-template.test.ts +21 -2
- package/dist/frameworks/react/add-ons/storybook/assets/_dot_storybook/main.ts +0 -17
- package/dist/frameworks/react/add-ons/storybook/assets/_dot_storybook/preview.ts +0 -15
- package/dist/frameworks/react/add-ons/storybook/assets/src/components/storybook/button.stories.ts +0 -67
- package/dist/frameworks/react/add-ons/storybook/assets/src/components/storybook/button.tsx +0 -47
- package/dist/frameworks/react/add-ons/storybook/assets/src/components/storybook/dialog.stories.tsx +0 -92
- package/dist/frameworks/react/add-ons/storybook/assets/src/components/storybook/dialog.tsx +0 -29
- package/dist/frameworks/react/add-ons/storybook/assets/src/components/storybook/index.ts +0 -14
- package/dist/frameworks/react/add-ons/storybook/assets/src/components/storybook/input.stories.ts +0 -43
- package/dist/frameworks/react/add-ons/storybook/assets/src/components/storybook/input.tsx +0 -39
- package/dist/frameworks/react/add-ons/storybook/assets/src/components/storybook/radio-group.stories.ts +0 -53
- package/dist/frameworks/react/add-ons/storybook/assets/src/components/storybook/radio-group.tsx +0 -52
- package/dist/frameworks/react/add-ons/storybook/assets/src/components/storybook/slider.stories.ts +0 -55
- package/dist/frameworks/react/add-ons/storybook/assets/src/components/storybook/slider.tsx +0 -57
- package/dist/frameworks/react/add-ons/storybook/assets/src/routes/demo/storybook.tsx +0 -93
- package/dist/frameworks/react/add-ons/storybook/package.json +0 -10
- package/src/frameworks/react/add-ons/storybook/assets/_dot_storybook/main.ts +0 -17
- package/src/frameworks/react/add-ons/storybook/assets/_dot_storybook/preview.ts +0 -15
- package/src/frameworks/react/add-ons/storybook/assets/src/components/storybook/button.stories.ts +0 -67
- package/src/frameworks/react/add-ons/storybook/assets/src/components/storybook/button.tsx +0 -47
- package/src/frameworks/react/add-ons/storybook/assets/src/components/storybook/dialog.stories.tsx +0 -92
- package/src/frameworks/react/add-ons/storybook/assets/src/components/storybook/dialog.tsx +0 -29
- package/src/frameworks/react/add-ons/storybook/assets/src/components/storybook/index.ts +0 -14
- package/src/frameworks/react/add-ons/storybook/assets/src/components/storybook/input.stories.ts +0 -43
- package/src/frameworks/react/add-ons/storybook/assets/src/components/storybook/input.tsx +0 -39
- package/src/frameworks/react/add-ons/storybook/assets/src/components/storybook/radio-group.stories.ts +0 -53
- package/src/frameworks/react/add-ons/storybook/assets/src/components/storybook/radio-group.tsx +0 -52
- package/src/frameworks/react/add-ons/storybook/assets/src/components/storybook/slider.stories.ts +0 -55
- package/src/frameworks/react/add-ons/storybook/assets/src/components/storybook/slider.tsx +0 -57
- package/src/frameworks/react/add-ons/storybook/assets/src/routes/demo/storybook.tsx +0 -93
- package/src/frameworks/react/add-ons/storybook/package.json +0 -10
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
|
|
3
|
-
export interface InputProps {
|
|
4
|
-
label: string
|
|
5
|
-
id: string
|
|
6
|
-
value?: string
|
|
7
|
-
onChange?: (value: string) => void
|
|
8
|
-
placeholder?: string
|
|
9
|
-
required?: boolean
|
|
10
|
-
className?: string
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const Input: React.FC<InputProps> = ({
|
|
14
|
-
label,
|
|
15
|
-
id,
|
|
16
|
-
value = '',
|
|
17
|
-
onChange,
|
|
18
|
-
placeholder,
|
|
19
|
-
required = false,
|
|
20
|
-
className = '',
|
|
21
|
-
}) => {
|
|
22
|
-
return (
|
|
23
|
-
<div className={`flex flex-col gap-2 ${className}`}>
|
|
24
|
-
<label htmlFor={id} className="text-sm font-medium text-[var(--sea-ink)]">
|
|
25
|
-
{label}
|
|
26
|
-
{required && <span className="text-red-500 ml-1">*</span>}
|
|
27
|
-
</label>
|
|
28
|
-
<input
|
|
29
|
-
type="text"
|
|
30
|
-
id={id}
|
|
31
|
-
value={value}
|
|
32
|
-
onChange={(e) => onChange?.(e.target.value)}
|
|
33
|
-
placeholder={placeholder}
|
|
34
|
-
required={required}
|
|
35
|
-
className="demo-input"
|
|
36
|
-
/>
|
|
37
|
-
</div>
|
|
38
|
-
)
|
|
39
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
-
import { fn } from "storybook/test";
|
|
3
|
-
|
|
4
|
-
import { RadioGroup } from "./radio-group";
|
|
5
|
-
|
|
6
|
-
const meta = {
|
|
7
|
-
title: "Form/RadioGroup",
|
|
8
|
-
component: RadioGroup,
|
|
9
|
-
parameters: {
|
|
10
|
-
layout: "centered",
|
|
11
|
-
},
|
|
12
|
-
tags: ["autodocs"],
|
|
13
|
-
args: { onChange: fn() },
|
|
14
|
-
} satisfies Meta<typeof RadioGroup>;
|
|
15
|
-
|
|
16
|
-
export default meta;
|
|
17
|
-
type Story = StoryObj<typeof meta>;
|
|
18
|
-
|
|
19
|
-
export const Default: Story = {
|
|
20
|
-
args: {
|
|
21
|
-
label: "Employment Type",
|
|
22
|
-
name: "employmentType",
|
|
23
|
-
options: [
|
|
24
|
-
{ value: "full-time", label: "Full Time" },
|
|
25
|
-
{ value: "part-time", label: "Part Time" },
|
|
26
|
-
],
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const Selected: Story = {
|
|
31
|
-
args: {
|
|
32
|
-
label: "Employment Type",
|
|
33
|
-
name: "employmentType",
|
|
34
|
-
options: [
|
|
35
|
-
{ value: "full-time", label: "Full Time" },
|
|
36
|
-
{ value: "part-time", label: "Part Time" },
|
|
37
|
-
],
|
|
38
|
-
value: "full-time",
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export const MultipleOptions: Story = {
|
|
43
|
-
args: {
|
|
44
|
-
label: "Subscription Plan",
|
|
45
|
-
name: "plan",
|
|
46
|
-
options: [
|
|
47
|
-
{ value: "basic", label: "Basic" },
|
|
48
|
-
{ value: "pro", label: "Pro" },
|
|
49
|
-
{ value: "enterprise", label: "Enterprise" },
|
|
50
|
-
],
|
|
51
|
-
value: "pro",
|
|
52
|
-
},
|
|
53
|
-
};
|
package/dist/frameworks/react/add-ons/storybook/assets/src/components/storybook/radio-group.tsx
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
|
|
3
|
-
export interface RadioOption {
|
|
4
|
-
value: string
|
|
5
|
-
label: string
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface RadioGroupProps {
|
|
9
|
-
label: string
|
|
10
|
-
name: string
|
|
11
|
-
options: RadioOption[]
|
|
12
|
-
value?: string
|
|
13
|
-
onChange?: (value: string) => void
|
|
14
|
-
className?: string
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export const RadioGroup: React.FC<RadioGroupProps> = ({
|
|
18
|
-
label,
|
|
19
|
-
name,
|
|
20
|
-
options,
|
|
21
|
-
value,
|
|
22
|
-
onChange,
|
|
23
|
-
className = '',
|
|
24
|
-
}) => {
|
|
25
|
-
return (
|
|
26
|
-
<div className={`flex flex-col gap-3 ${className}`}>
|
|
27
|
-
<label className="text-sm font-medium text-[var(--sea-ink)]">
|
|
28
|
-
{label}
|
|
29
|
-
</label>
|
|
30
|
-
<div className="flex gap-4">
|
|
31
|
-
{options.map((option) => (
|
|
32
|
-
<label
|
|
33
|
-
key={option.value}
|
|
34
|
-
className="flex items-center gap-2 cursor-pointer group"
|
|
35
|
-
>
|
|
36
|
-
<input
|
|
37
|
-
type="radio"
|
|
38
|
-
name={name}
|
|
39
|
-
value={option.value}
|
|
40
|
-
checked={value === option.value}
|
|
41
|
-
onChange={(e) => onChange?.(e.target.value)}
|
|
42
|
-
className="h-4 w-4 cursor-pointer accent-[var(--lagoon-deep)]"
|
|
43
|
-
/>
|
|
44
|
-
<span className="demo-muted text-sm transition-colors group-hover:text-[var(--sea-ink)]">
|
|
45
|
-
{option.label}
|
|
46
|
-
</span>
|
|
47
|
-
</label>
|
|
48
|
-
))}
|
|
49
|
-
</div>
|
|
50
|
-
</div>
|
|
51
|
-
)
|
|
52
|
-
}
|
package/dist/frameworks/react/add-ons/storybook/assets/src/components/storybook/slider.stories.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
-
import { fn } from "storybook/test";
|
|
3
|
-
|
|
4
|
-
import { Slider } from "./slider";
|
|
5
|
-
|
|
6
|
-
const meta = {
|
|
7
|
-
title: "Form/Slider",
|
|
8
|
-
component: Slider,
|
|
9
|
-
parameters: {
|
|
10
|
-
layout: "centered",
|
|
11
|
-
},
|
|
12
|
-
tags: ["autodocs"],
|
|
13
|
-
args: { onChange: fn() },
|
|
14
|
-
} satisfies Meta<typeof Slider>;
|
|
15
|
-
|
|
16
|
-
export default meta;
|
|
17
|
-
type Story = StoryObj<typeof meta>;
|
|
18
|
-
|
|
19
|
-
export const Default: Story = {
|
|
20
|
-
args: {
|
|
21
|
-
label: "Volume",
|
|
22
|
-
id: "volume",
|
|
23
|
-
value: 50,
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export const Skill: Story = {
|
|
28
|
-
args: {
|
|
29
|
-
label: "Plays Guitar",
|
|
30
|
-
id: "guitar",
|
|
31
|
-
value: 75,
|
|
32
|
-
min: 0,
|
|
33
|
-
max: 100,
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export const NoValue: Story = {
|
|
38
|
-
args: {
|
|
39
|
-
label: "Experience Level",
|
|
40
|
-
id: "experience",
|
|
41
|
-
value: 30,
|
|
42
|
-
showValue: false,
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export const CustomRange: Story = {
|
|
47
|
-
args: {
|
|
48
|
-
label: "Custom Range",
|
|
49
|
-
id: "custom-range",
|
|
50
|
-
value: 5,
|
|
51
|
-
min: 1,
|
|
52
|
-
max: 20,
|
|
53
|
-
step: 1,
|
|
54
|
-
},
|
|
55
|
-
};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
|
|
3
|
-
export interface SliderProps {
|
|
4
|
-
label: string
|
|
5
|
-
id: string
|
|
6
|
-
value?: number
|
|
7
|
-
onChange?: (value: number) => void
|
|
8
|
-
min?: number
|
|
9
|
-
max?: number
|
|
10
|
-
step?: number
|
|
11
|
-
showValue?: boolean
|
|
12
|
-
className?: string
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const Slider: React.FC<SliderProps> = ({
|
|
16
|
-
label,
|
|
17
|
-
id,
|
|
18
|
-
value = 0,
|
|
19
|
-
onChange,
|
|
20
|
-
min = 0,
|
|
21
|
-
max = 100,
|
|
22
|
-
step = 1,
|
|
23
|
-
showValue = true,
|
|
24
|
-
className = '',
|
|
25
|
-
}) => {
|
|
26
|
-
return (
|
|
27
|
-
<div className={`flex flex-col gap-2 ${className}`}>
|
|
28
|
-
<div className="flex justify-between items-center">
|
|
29
|
-
<label
|
|
30
|
-
htmlFor={id}
|
|
31
|
-
className="text-sm font-medium text-[var(--sea-ink)]"
|
|
32
|
-
>
|
|
33
|
-
{label}
|
|
34
|
-
</label>
|
|
35
|
-
{showValue && (
|
|
36
|
-
<span className="min-w-12 text-right text-sm font-semibold text-[var(--lagoon-deep)]">
|
|
37
|
-
{value}
|
|
38
|
-
</span>
|
|
39
|
-
)}
|
|
40
|
-
</div>
|
|
41
|
-
<input
|
|
42
|
-
type="range"
|
|
43
|
-
id={id}
|
|
44
|
-
value={value}
|
|
45
|
-
onChange={(e) => onChange?.(Number(e.target.value))}
|
|
46
|
-
min={min}
|
|
47
|
-
max={max}
|
|
48
|
-
step={step}
|
|
49
|
-
className="h-2 w-full cursor-pointer appearance-none rounded-lg bg-[var(--chip-bg)] accent-[var(--lagoon-deep)]"
|
|
50
|
-
/>
|
|
51
|
-
<div className="demo-muted flex justify-between text-xs">
|
|
52
|
-
<span>{min}</span>
|
|
53
|
-
<span>{max}</span>
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
56
|
-
)
|
|
57
|
-
}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { createFileRoute } from '@tanstack/react-router'
|
|
2
|
-
import { useState } from 'react'
|
|
3
|
-
|
|
4
|
-
import { Dialog } from '#/components/storybook/dialog'
|
|
5
|
-
import { Input } from '#/components/storybook/input'
|
|
6
|
-
import { RadioGroup } from '#/components/storybook/radio-group'
|
|
7
|
-
import { Slider } from '#/components/storybook/slider'
|
|
8
|
-
import { Button } from '#/components/storybook/button'
|
|
9
|
-
|
|
10
|
-
export const Route = createFileRoute('/demo/storybook')({
|
|
11
|
-
component: StorybookDemo,
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
function StorybookDemo() {
|
|
15
|
-
const [firstName, setFirstName] = useState('')
|
|
16
|
-
const [lastName, setLastName] = useState('')
|
|
17
|
-
const [employmentType, setEmploymentType] = useState('full-time')
|
|
18
|
-
const [coffeeCups, setCoffeeCups] = useState(3)
|
|
19
|
-
|
|
20
|
-
const handleSubmit = () => {}
|
|
21
|
-
|
|
22
|
-
const handleReset = () => {
|
|
23
|
-
setFirstName('')
|
|
24
|
-
setLastName('')
|
|
25
|
-
setEmploymentType('full-time')
|
|
26
|
-
setCoffeeCups(3)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<main className="demo-page demo-center">
|
|
31
|
-
<div className="w-full max-w-2xl">
|
|
32
|
-
<Dialog
|
|
33
|
-
title="Employee Information Form"
|
|
34
|
-
footer={
|
|
35
|
-
<div className="flex gap-3 justify-end">
|
|
36
|
-
<Button variant="secondary" size="medium" onClick={handleReset}>
|
|
37
|
-
Reset
|
|
38
|
-
</Button>
|
|
39
|
-
<Button
|
|
40
|
-
variant="primary"
|
|
41
|
-
size="medium"
|
|
42
|
-
type="submit"
|
|
43
|
-
onClick={handleSubmit}
|
|
44
|
-
>
|
|
45
|
-
Submit
|
|
46
|
-
</Button>
|
|
47
|
-
</div>
|
|
48
|
-
}
|
|
49
|
-
>
|
|
50
|
-
<form onSubmit={handleSubmit} className="space-y-6">
|
|
51
|
-
<Input
|
|
52
|
-
label="First Name"
|
|
53
|
-
id="firstName"
|
|
54
|
-
value={firstName}
|
|
55
|
-
onChange={setFirstName}
|
|
56
|
-
placeholder="John"
|
|
57
|
-
required
|
|
58
|
-
/>
|
|
59
|
-
|
|
60
|
-
<Input
|
|
61
|
-
label="Last Name"
|
|
62
|
-
id="lastName"
|
|
63
|
-
value={lastName}
|
|
64
|
-
onChange={setLastName}
|
|
65
|
-
placeholder="Doe"
|
|
66
|
-
required
|
|
67
|
-
/>
|
|
68
|
-
|
|
69
|
-
<RadioGroup
|
|
70
|
-
label="Employment Type"
|
|
71
|
-
name="employmentType"
|
|
72
|
-
options={[
|
|
73
|
-
{ value: 'full-time', label: 'Full Time' },
|
|
74
|
-
{ value: 'part-time', label: 'Part Time' },
|
|
75
|
-
]}
|
|
76
|
-
value={employmentType}
|
|
77
|
-
onChange={setEmploymentType}
|
|
78
|
-
/>
|
|
79
|
-
|
|
80
|
-
<Slider
|
|
81
|
-
label="Coffee Cups Per Day"
|
|
82
|
-
id="coffeeCups"
|
|
83
|
-
value={coffeeCups}
|
|
84
|
-
onChange={setCoffeeCups}
|
|
85
|
-
min={0}
|
|
86
|
-
max={10}
|
|
87
|
-
/>
|
|
88
|
-
</form>
|
|
89
|
-
</Dialog>
|
|
90
|
-
</div>
|
|
91
|
-
</main>
|
|
92
|
-
)
|
|
93
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { StorybookConfig } from "@storybook/react-vite";
|
|
2
|
-
|
|
3
|
-
const config: StorybookConfig = {
|
|
4
|
-
stories: ["../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
|
|
5
|
-
addons: [],
|
|
6
|
-
framework: {
|
|
7
|
-
name: "@storybook/react-vite",
|
|
8
|
-
options: {},
|
|
9
|
-
},
|
|
10
|
-
async viteFinal(config) {
|
|
11
|
-
const { default: tailwindcss } = await import("@tailwindcss/vite");
|
|
12
|
-
config.plugins = config.plugins || [];
|
|
13
|
-
config.plugins.push(tailwindcss());
|
|
14
|
-
return config;
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
export default config;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Preview } from "@storybook/react-vite";
|
|
2
|
-
import "../src/styles.css";
|
|
3
|
-
|
|
4
|
-
const preview: Preview = {
|
|
5
|
-
parameters: {
|
|
6
|
-
controls: {
|
|
7
|
-
matchers: {
|
|
8
|
-
color: /(background|color)$/i,
|
|
9
|
-
date: /Date$/i,
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export default preview;
|
package/src/frameworks/react/add-ons/storybook/assets/src/components/storybook/button.stories.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
-
import { fn } from "storybook/test";
|
|
3
|
-
|
|
4
|
-
import { Button } from "./button";
|
|
5
|
-
|
|
6
|
-
const meta = {
|
|
7
|
-
title: "Form/Button",
|
|
8
|
-
component: Button,
|
|
9
|
-
parameters: {
|
|
10
|
-
layout: "centered",
|
|
11
|
-
},
|
|
12
|
-
tags: ["autodocs"],
|
|
13
|
-
args: { onClick: fn() },
|
|
14
|
-
} satisfies Meta<typeof Button>;
|
|
15
|
-
|
|
16
|
-
export default meta;
|
|
17
|
-
type Story = StoryObj<typeof meta>;
|
|
18
|
-
|
|
19
|
-
export const Primary: Story = {
|
|
20
|
-
args: {
|
|
21
|
-
variant: "primary",
|
|
22
|
-
children: "Primary Button",
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const Secondary: Story = {
|
|
27
|
-
args: {
|
|
28
|
-
variant: "secondary",
|
|
29
|
-
children: "Secondary Button",
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const Danger: Story = {
|
|
34
|
-
args: {
|
|
35
|
-
variant: "danger",
|
|
36
|
-
children: "Delete Account",
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export const Small: Story = {
|
|
41
|
-
args: {
|
|
42
|
-
size: "small",
|
|
43
|
-
children: "Small Button",
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export const Medium: Story = {
|
|
48
|
-
args: {
|
|
49
|
-
size: "medium",
|
|
50
|
-
children: "Medium Button",
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export const Large: Story = {
|
|
55
|
-
args: {
|
|
56
|
-
size: "large",
|
|
57
|
-
children: "Large Button",
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export const Disabled: Story = {
|
|
62
|
-
args: {
|
|
63
|
-
variant: "primary",
|
|
64
|
-
children: "Disabled Button",
|
|
65
|
-
disabled: true,
|
|
66
|
-
},
|
|
67
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
|
|
3
|
-
export interface ButtonProps {
|
|
4
|
-
variant?: 'primary' | 'secondary' | 'danger'
|
|
5
|
-
size?: 'small' | 'medium' | 'large'
|
|
6
|
-
children: React.ReactNode
|
|
7
|
-
onClick?: () => void
|
|
8
|
-
disabled?: boolean
|
|
9
|
-
type?: 'button' | 'submit' | 'reset'
|
|
10
|
-
className?: string
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const Button: React.FC<ButtonProps> = ({
|
|
14
|
-
variant = 'primary',
|
|
15
|
-
size = 'medium',
|
|
16
|
-
children,
|
|
17
|
-
onClick,
|
|
18
|
-
disabled = false,
|
|
19
|
-
type = 'button',
|
|
20
|
-
className = '',
|
|
21
|
-
}) => {
|
|
22
|
-
const baseStyles =
|
|
23
|
-
'demo-button disabled:opacity-50 disabled:cursor-not-allowed'
|
|
24
|
-
|
|
25
|
-
const variantStyles = {
|
|
26
|
-
primary: '',
|
|
27
|
-
secondary: 'demo-button-secondary',
|
|
28
|
-
danger: 'demo-button-danger',
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const sizeStyles = {
|
|
32
|
-
small: 'px-3 py-1.5 text-sm',
|
|
33
|
-
medium: 'px-4 py-2 text-base',
|
|
34
|
-
large: 'px-6 py-3 text-lg',
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<button
|
|
39
|
-
type={type}
|
|
40
|
-
onClick={onClick}
|
|
41
|
-
disabled={disabled}
|
|
42
|
-
className={`${baseStyles} ${variantStyles[variant]} ${sizeStyles[size]} ${className}`}
|
|
43
|
-
>
|
|
44
|
-
{children}
|
|
45
|
-
</button>
|
|
46
|
-
)
|
|
47
|
-
}
|
package/src/frameworks/react/add-ons/storybook/assets/src/components/storybook/dialog.stories.tsx
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
-
|
|
3
|
-
import { Dialog } from "./dialog";
|
|
4
|
-
import { Button } from "./button";
|
|
5
|
-
|
|
6
|
-
const meta = {
|
|
7
|
-
title: "Form/Dialog",
|
|
8
|
-
component: Dialog,
|
|
9
|
-
parameters: {
|
|
10
|
-
layout: "centered",
|
|
11
|
-
},
|
|
12
|
-
tags: ["autodocs"],
|
|
13
|
-
} satisfies Meta<typeof Dialog>;
|
|
14
|
-
|
|
15
|
-
export default meta;
|
|
16
|
-
type Story = StoryObj<typeof meta>;
|
|
17
|
-
|
|
18
|
-
export const Default: Story = {
|
|
19
|
-
args: {
|
|
20
|
-
title: "User Profile",
|
|
21
|
-
children: (
|
|
22
|
-
<div className="space-y-4">
|
|
23
|
-
<p className="text-gray-700 dark:text-gray-300">
|
|
24
|
-
This is a simple dialog component with a title and content area.
|
|
25
|
-
</p>
|
|
26
|
-
</div>
|
|
27
|
-
),
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export const WithFooter: Story = {
|
|
32
|
-
args: {
|
|
33
|
-
title: "Confirm Action",
|
|
34
|
-
children: (
|
|
35
|
-
<div className="space-y-4">
|
|
36
|
-
<p className="text-gray-700 dark:text-gray-300">
|
|
37
|
-
Are you sure you want to proceed with this action?
|
|
38
|
-
</p>
|
|
39
|
-
</div>
|
|
40
|
-
),
|
|
41
|
-
footer: (
|
|
42
|
-
<div className="flex gap-3 justify-end">
|
|
43
|
-
<Button variant="secondary" size="medium">
|
|
44
|
-
Cancel
|
|
45
|
-
</Button>
|
|
46
|
-
<Button variant="primary" size="medium">
|
|
47
|
-
Confirm
|
|
48
|
-
</Button>
|
|
49
|
-
</div>
|
|
50
|
-
),
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export const Form: Story = {
|
|
55
|
-
args: {
|
|
56
|
-
title: "Create Account",
|
|
57
|
-
children: (
|
|
58
|
-
<div className="space-y-4 min-w-80">
|
|
59
|
-
<div className="flex flex-col gap-2">
|
|
60
|
-
<label className="text-sm font-medium text-gray-700 dark:text-gray-200">
|
|
61
|
-
Email
|
|
62
|
-
</label>
|
|
63
|
-
<input
|
|
64
|
-
type="email"
|
|
65
|
-
placeholder="you@example.com"
|
|
66
|
-
className="px-4 py-2 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100"
|
|
67
|
-
/>
|
|
68
|
-
</div>
|
|
69
|
-
<div className="flex flex-col gap-2">
|
|
70
|
-
<label className="text-sm font-medium text-gray-700 dark:text-gray-200">
|
|
71
|
-
Password
|
|
72
|
-
</label>
|
|
73
|
-
<input
|
|
74
|
-
type="password"
|
|
75
|
-
placeholder="••••••••"
|
|
76
|
-
className="px-4 py-2 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100"
|
|
77
|
-
/>
|
|
78
|
-
</div>
|
|
79
|
-
</div>
|
|
80
|
-
),
|
|
81
|
-
footer: (
|
|
82
|
-
<div className="flex gap-3 justify-end">
|
|
83
|
-
<Button variant="secondary" size="medium">
|
|
84
|
-
Cancel
|
|
85
|
-
</Button>
|
|
86
|
-
<Button variant="primary" size="medium">
|
|
87
|
-
Create Account
|
|
88
|
-
</Button>
|
|
89
|
-
</div>
|
|
90
|
-
),
|
|
91
|
-
},
|
|
92
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
|
|
3
|
-
export interface DialogProps {
|
|
4
|
-
title: string
|
|
5
|
-
children: React.ReactNode
|
|
6
|
-
footer?: React.ReactNode
|
|
7
|
-
className?: string
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const Dialog: React.FC<DialogProps> = ({
|
|
11
|
-
title,
|
|
12
|
-
children,
|
|
13
|
-
footer,
|
|
14
|
-
className = '',
|
|
15
|
-
}) => {
|
|
16
|
-
return (
|
|
17
|
-
<div className={`demo-panel overflow-hidden p-0 ${className}`}>
|
|
18
|
-
<div className="border-b border-[var(--line)] px-6 py-4">
|
|
19
|
-
<h2 className="demo-section-title">{title}</h2>
|
|
20
|
-
</div>
|
|
21
|
-
<div className="px-6 py-6">{children}</div>
|
|
22
|
-
{footer && (
|
|
23
|
-
<div className="border-t border-[var(--line)] bg-[var(--chip-bg)] px-6 py-4">
|
|
24
|
-
{footer}
|
|
25
|
-
</div>
|
|
26
|
-
)}
|
|
27
|
-
</div>
|
|
28
|
-
)
|
|
29
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export { Input } from "./input";
|
|
2
|
-
export type { InputProps } from "./input";
|
|
3
|
-
|
|
4
|
-
export { RadioGroup } from "./radio-group";
|
|
5
|
-
export type { RadioGroupProps, RadioOption } from "./radio-group";
|
|
6
|
-
|
|
7
|
-
export { Slider } from "./slider";
|
|
8
|
-
export type { SliderProps } from "./slider";
|
|
9
|
-
|
|
10
|
-
export { Dialog } from "./dialog";
|
|
11
|
-
export type { DialogProps } from "./dialog";
|
|
12
|
-
|
|
13
|
-
export { Button } from "./button";
|
|
14
|
-
export type { ButtonProps } from "./button";
|
package/src/frameworks/react/add-ons/storybook/assets/src/components/storybook/input.stories.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
-
import { fn } from "storybook/test";
|
|
3
|
-
|
|
4
|
-
import { Input } from "./input";
|
|
5
|
-
|
|
6
|
-
const meta = {
|
|
7
|
-
title: "Form/Input",
|
|
8
|
-
component: Input,
|
|
9
|
-
parameters: {
|
|
10
|
-
layout: "centered",
|
|
11
|
-
},
|
|
12
|
-
tags: ["autodocs"],
|
|
13
|
-
args: { onChange: fn() },
|
|
14
|
-
} satisfies Meta<typeof Input>;
|
|
15
|
-
|
|
16
|
-
export default meta;
|
|
17
|
-
type Story = StoryObj<typeof meta>;
|
|
18
|
-
|
|
19
|
-
export const Default: Story = {
|
|
20
|
-
args: {
|
|
21
|
-
label: "Email Address",
|
|
22
|
-
id: "email",
|
|
23
|
-
placeholder: "Enter your email",
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export const Required: Story = {
|
|
28
|
-
args: {
|
|
29
|
-
label: "First Name",
|
|
30
|
-
id: "firstName",
|
|
31
|
-
placeholder: "John",
|
|
32
|
-
required: true,
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export const WithValue: Story = {
|
|
37
|
-
args: {
|
|
38
|
-
label: "Last Name",
|
|
39
|
-
id: "lastName",
|
|
40
|
-
value: "Doe",
|
|
41
|
-
placeholder: "Enter last name",
|
|
42
|
-
},
|
|
43
|
-
};
|