@flightlesslabs/dodo-ui 0.20.0 → 0.22.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/README.md +2 -205
- package/dist/components/Form/Button/ButtonAsAnchor.svelte +1 -1
- package/dist/components/Form/DatePicker/DatePicker.scss +0 -26
- package/dist/components/Form/DatePicker/DatePicker.svelte +8 -1
- package/dist/components/Form/DatePicker/DatePickerInput/DatePickerInput.svelte +3 -1
- package/dist/components/Form/DatePicker/DatePickerPopup/CalendarGrid.svelte +1 -1
- package/dist/components/Form/InputEnclosure/InputEnclosure.scss +34 -0
- package/dist/components/Form/InputEnclosure/InputEnclosure.stories.svelte +11 -11
- package/dist/components/Form/Label/Label.svelte +1 -1
- package/dist/components/Form/Select/Select.scss +0 -27
- package/dist/components/Form/Select/SelectInput.svelte +4 -1
- package/dist/components/Form/TextInput/TextInput.svelte +3 -3
- package/dist/components/Layout/Card/Card.stories.svelte +1 -2
- package/dist/components/Layout/Card/Card.svelte +1 -1
- package/dist/components/Layout/Card/Card.svelte.d.ts +1 -1
- package/dist/components/Layout/Grid/Column/Column.scss +78 -0
- package/dist/components/Layout/Grid/Column/Column.stories.svelte +66 -0
- package/dist/components/Layout/Grid/Column/Column.stories.svelte.d.ts +22 -0
- package/dist/components/Layout/Grid/Column/Column.svelte +79 -0
- package/dist/components/Layout/Grid/Column/Column.svelte.d.ts +33 -0
- package/dist/components/Layout/Grid/Grid.scss +8 -0
- package/dist/components/Layout/Grid/Grid.stories.svelte +177 -0
- package/dist/components/Layout/Grid/Grid.stories.svelte.d.ts +22 -0
- package/dist/components/Layout/Grid/Grid.svelte +32 -0
- package/dist/components/Layout/Grid/Grid.svelte.d.ts +12 -0
- package/dist/components/Layout/Grid/Row/Row.scss +7 -0
- package/dist/components/Layout/Grid/Row/Row.stories.svelte +39 -0
- package/dist/components/Layout/Grid/Row/Row.stories.svelte.d.ts +22 -0
- package/dist/components/Layout/Grid/Row/Row.svelte +21 -0
- package/dist/components/Layout/Grid/Row/Row.svelte.d.ts +10 -0
- package/dist/components/Layout/Theme/ThemeSystem/index.mdx +53 -53
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/styles/components.css +478 -68
- package/dist/styles/components.css.map +1 -1
- package/dist/styles/components.scss +3 -1
- package/package.json +1 -1
- package/src/lib/components/Form/Button/ButtonAsAnchor.svelte +1 -1
- package/src/lib/components/Form/DatePicker/DatePicker.scss +0 -26
- package/src/lib/components/Form/DatePicker/DatePicker.svelte +8 -1
- package/src/lib/components/Form/DatePicker/DatePickerInput/DatePickerInput.svelte +3 -1
- package/src/lib/components/Form/DatePicker/DatePickerPopup/CalendarGrid.svelte +1 -1
- package/src/lib/components/Form/InputEnclosure/InputEnclosure.scss +34 -0
- package/src/lib/components/Form/InputEnclosure/InputEnclosure.stories.svelte +11 -11
- package/src/lib/components/Form/Label/Label.svelte +1 -1
- package/src/lib/components/Form/Select/Select.scss +0 -27
- package/src/lib/components/Form/Select/SelectInput.svelte +4 -1
- package/src/lib/components/Form/TextInput/TextInput.svelte +3 -3
- package/src/lib/components/Layout/Card/Card.stories.svelte +1 -2
- package/src/lib/components/Layout/Card/Card.svelte +1 -1
- package/src/lib/components/Layout/Grid/Column/Column.scss +78 -0
- package/src/lib/components/Layout/Grid/Column/Column.stories.svelte +66 -0
- package/src/lib/components/Layout/Grid/Column/Column.svelte +79 -0
- package/src/lib/components/Layout/Grid/Grid.scss +8 -0
- package/src/lib/components/Layout/Grid/Grid.stories.svelte +177 -0
- package/src/lib/components/Layout/Grid/Grid.svelte +32 -0
- package/src/lib/components/Layout/Grid/Row/Row.scss +7 -0
- package/src/lib/components/Layout/Grid/Row/Row.stories.svelte +39 -0
- package/src/lib/components/Layout/Grid/Row/Row.svelte +21 -0
- package/src/lib/components/Layout/Theme/ThemeSystem/index.mdx +53 -53
- package/src/lib/index.ts +17 -0
- package/src/lib/styles/components.scss +3 -1
- package/dist/components/Form/TextInput/TextInput.scss +0 -34
- package/src/lib/components/Form/TextInput/TextInput.scss +0 -34
|
@@ -1,20 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
1
|
.dodo-ui-DatePicker {
|
|
4
2
|
button[data-popover-trigger] {
|
|
5
3
|
font-size: 1.4em;
|
|
6
4
|
}
|
|
7
5
|
|
|
8
6
|
[data-date-field-input] {
|
|
9
|
-
flex: 1;
|
|
10
|
-
border: 0;
|
|
11
|
-
outline: 0;
|
|
12
|
-
height: 100%;
|
|
13
|
-
background-color: transparent;
|
|
14
|
-
font-family: inherit;
|
|
15
|
-
color: inherit;
|
|
16
|
-
letter-spacing: 0.3px;
|
|
17
|
-
margin: 0;
|
|
18
7
|
display: flex;
|
|
19
8
|
align-items: center;
|
|
20
9
|
}
|
|
@@ -34,11 +23,6 @@
|
|
|
34
23
|
// ----------------------------------------
|
|
35
24
|
&.size {
|
|
36
25
|
&--normal {
|
|
37
|
-
[data-date-field-input] {
|
|
38
|
-
font-size: 1rem;
|
|
39
|
-
padding: 0 calc(var(--dodo-ui-space-small) * 2);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
26
|
button[data-popover-trigger] {
|
|
43
27
|
margin: 0 calc(var(--dodo-ui-space) / 2.5);
|
|
44
28
|
}
|
|
@@ -49,11 +33,6 @@
|
|
|
49
33
|
}
|
|
50
34
|
|
|
51
35
|
&--small {
|
|
52
|
-
[data-date-field-input] {
|
|
53
|
-
padding: 0 var(--dodo-ui-space);
|
|
54
|
-
font-size: 0.9rem;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
36
|
button[data-popover-trigger] {
|
|
58
37
|
margin: 0 calc(var(--dodo-ui-space--small) / 2.5);
|
|
59
38
|
}
|
|
@@ -64,11 +43,6 @@
|
|
|
64
43
|
}
|
|
65
44
|
|
|
66
45
|
&--large {
|
|
67
|
-
[data-date-field-input] {
|
|
68
|
-
font-size: 1.1rem;
|
|
69
|
-
padding: 0 calc(var(--dodo-ui-space) * 2);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
46
|
button[data-popover-trigger] {
|
|
73
47
|
margin: 0 calc(var(--dodo-ui-space--large) / 2.5);
|
|
74
48
|
}
|
|
@@ -109,7 +109,14 @@
|
|
|
109
109
|
}: DatePickerProps = $props();
|
|
110
110
|
</script>
|
|
111
111
|
|
|
112
|
-
<DatePickerBitsUi.Root
|
|
112
|
+
<DatePickerBitsUi.Root
|
|
113
|
+
{...restProps}
|
|
114
|
+
bind:value
|
|
115
|
+
bind:open
|
|
116
|
+
{weekdayFormat}
|
|
117
|
+
{weekStartsOn}
|
|
118
|
+
{fixedWeeks}
|
|
119
|
+
>
|
|
113
120
|
<DatepickerInput
|
|
114
121
|
{size}
|
|
115
122
|
{roundness}
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
error = false,
|
|
35
35
|
focused: forcedFocused = false,
|
|
36
36
|
placeholder,
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
37
38
|
after,
|
|
38
39
|
dateFieldInputProps,
|
|
39
40
|
datePickerTriggerProps,
|
|
@@ -51,7 +52,7 @@
|
|
|
51
52
|
isFocused = false;
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
const classes = $derived(['dodo-ui-DatePicker',
|
|
55
|
+
const classes = $derived(['dodo-ui-DatePicker', className].filter(Boolean));
|
|
55
56
|
|
|
56
57
|
const triggerClasses = $derived(
|
|
57
58
|
[
|
|
@@ -78,6 +79,7 @@
|
|
|
78
79
|
onfocus={handleFocus}
|
|
79
80
|
onblur={handleBlur}
|
|
80
81
|
{placeholder}
|
|
82
|
+
class="InputBox"
|
|
81
83
|
{...dateFieldInputProps}
|
|
82
84
|
>
|
|
83
85
|
{#snippet children({ segments })}
|
|
@@ -62,6 +62,19 @@ $states: (
|
|
|
62
62
|
border-color: var(--dodo-ui-InputEnclosure-border-color);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
// input tag is styled here
|
|
66
|
+
.InputBox {
|
|
67
|
+
flex: 1;
|
|
68
|
+
border: 0;
|
|
69
|
+
outline: 0;
|
|
70
|
+
height: 100%;
|
|
71
|
+
background-color: transparent;
|
|
72
|
+
font-family: inherit;
|
|
73
|
+
color: inherit;
|
|
74
|
+
letter-spacing: 0.3px;
|
|
75
|
+
margin: 0;
|
|
76
|
+
}
|
|
77
|
+
|
|
65
78
|
// ----------------------------------------
|
|
66
79
|
// Visual states (focused, error)
|
|
67
80
|
// ----------------------------------------
|
|
@@ -90,6 +103,27 @@ $states: (
|
|
|
90
103
|
height: $height;
|
|
91
104
|
}
|
|
92
105
|
}
|
|
106
|
+
|
|
107
|
+
&--normal {
|
|
108
|
+
.InputBox {
|
|
109
|
+
font-size: 1rem;
|
|
110
|
+
padding: 0 calc(var(--dodo-ui-space-small) * 2);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
&--small {
|
|
115
|
+
.InputBox {
|
|
116
|
+
padding: 0 var(--dodo-ui-space);
|
|
117
|
+
font-size: 0.9rem;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
&--large {
|
|
122
|
+
.InputBox {
|
|
123
|
+
font-size: 1.1rem;
|
|
124
|
+
padding: 0 calc(var(--dodo-ui-space) * 2);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
93
127
|
}
|
|
94
128
|
|
|
95
129
|
// ----------------------------------------
|
|
@@ -88,31 +88,31 @@
|
|
|
88
88
|
<!-- ------------------------------ -->
|
|
89
89
|
|
|
90
90
|
<Story name="Default (Outlined)">
|
|
91
|
-
<input placeholder="Type something…" />
|
|
91
|
+
<input placeholder="Type something…" class="InputBox" />
|
|
92
92
|
</Story>
|
|
93
93
|
|
|
94
94
|
<Story name="No Outline" args={{ outline: false }}>
|
|
95
|
-
<input placeholder="No outline…" />
|
|
95
|
+
<input placeholder="No outline…" class="InputBox" />
|
|
96
96
|
</Story>
|
|
97
97
|
|
|
98
98
|
<Story name="Focused" args={{ focused: true }}>
|
|
99
|
-
<input placeholder="Focused state…" />
|
|
99
|
+
<input placeholder="Focused state…" class="InputBox" />
|
|
100
100
|
</Story>
|
|
101
101
|
|
|
102
102
|
<Story name="Error" args={{ error: true }}>
|
|
103
|
-
<input placeholder="Error state…" />
|
|
103
|
+
<input placeholder="Error state…" class="InputBox" />
|
|
104
104
|
</Story>
|
|
105
105
|
|
|
106
106
|
<Story name="Disabled" args={{ disabled: true }}>
|
|
107
|
-
<input placeholder="Disabled state…" disabled />
|
|
107
|
+
<input placeholder="Disabled state…" disabled class="InputBox" />
|
|
108
108
|
</Story>
|
|
109
109
|
|
|
110
110
|
<Story name="Large" args={{ size: 'large' }}>
|
|
111
|
-
<input placeholder="Large input…" />
|
|
111
|
+
<input placeholder="Large input…" class="InputBox" />
|
|
112
112
|
</Story>
|
|
113
113
|
|
|
114
114
|
<Story name="Pill Shape" args={{ roundness: 'pill' }}>
|
|
115
|
-
<input placeholder="Pill shaped input…" />
|
|
115
|
+
<input placeholder="Pill shaped input…" class="InputBox" />
|
|
116
116
|
</Story>
|
|
117
117
|
|
|
118
118
|
<Story name="With Before (Icon Prefix)" asChild>
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
<span style="color: #888;">🔍</span>
|
|
122
122
|
{/snippet}
|
|
123
123
|
|
|
124
|
-
<input placeholder="Search…" />
|
|
124
|
+
<input placeholder="Search…" class="InputBox" />
|
|
125
125
|
</InputEnclosure>
|
|
126
126
|
</Story>
|
|
127
127
|
|
|
@@ -131,14 +131,14 @@
|
|
|
131
131
|
<span style="color: #888;">.com</span>
|
|
132
132
|
{/snippet}
|
|
133
133
|
|
|
134
|
-
<input placeholder="Website" />
|
|
134
|
+
<input placeholder="Website" class="InputBox" />
|
|
135
135
|
</InputEnclosure>
|
|
136
136
|
</Story>
|
|
137
137
|
|
|
138
138
|
<Story name="Light Theme" asChild>
|
|
139
139
|
<Theme type="light">
|
|
140
140
|
<InputEnclosure>
|
|
141
|
-
<input placeholder="Type something…" />
|
|
141
|
+
<input placeholder="Type something…" class="InputBox" />
|
|
142
142
|
</InputEnclosure>
|
|
143
143
|
</Theme>
|
|
144
144
|
</Story>
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
<Story name="Dark Theme" asChild globals={{ backgrounds: { value: 'dark' } }}>
|
|
147
147
|
<Theme type="dark">
|
|
148
148
|
<InputEnclosure>
|
|
149
|
-
<input placeholder="Type something…" />
|
|
149
|
+
<input placeholder="Type something…" class="InputBox" />
|
|
150
150
|
</InputEnclosure>
|
|
151
151
|
</Theme>
|
|
152
152
|
</Story>
|
|
@@ -29,6 +29,6 @@
|
|
|
29
29
|
const classes = $derived(['dodo-ui-Label', className].filter(Boolean));
|
|
30
30
|
</script>
|
|
31
31
|
|
|
32
|
-
<LabelBitUi.Root {...restProps} class=
|
|
32
|
+
<LabelBitUi.Root {...restProps} class={classes.join(' ')} bind:ref>
|
|
33
33
|
{@render children?.()}
|
|
34
34
|
</LabelBitUi.Root>
|
|
@@ -15,50 +15,23 @@
|
|
|
15
15
|
font-size: 1.5em;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
input[data-combobox-input] {
|
|
19
|
-
flex: 1;
|
|
20
|
-
border: 0;
|
|
21
|
-
outline: 0;
|
|
22
|
-
height: 100%;
|
|
23
|
-
background-color: transparent;
|
|
24
|
-
font-family: inherit;
|
|
25
|
-
color: inherit;
|
|
26
|
-
letter-spacing: 0.3px;
|
|
27
|
-
margin: 0;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
18
|
// ----------------------------------------
|
|
31
19
|
// Sizes
|
|
32
20
|
// ----------------------------------------
|
|
33
21
|
&.size {
|
|
34
22
|
&--normal {
|
|
35
|
-
input[data-combobox-input] {
|
|
36
|
-
font-size: 1rem;
|
|
37
|
-
padding: 0 calc(var(--dodo-ui-space-small) * 2);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
23
|
button[data-combobox-trigger] {
|
|
41
24
|
margin: 0 calc(var(--dodo-ui-space) / 2.5);
|
|
42
25
|
}
|
|
43
26
|
}
|
|
44
27
|
|
|
45
28
|
&--small {
|
|
46
|
-
input[data-combobox-input] {
|
|
47
|
-
padding: 0 var(--dodo-ui-space);
|
|
48
|
-
font-size: 0.9rem;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
29
|
button[data-combobox-trigger] {
|
|
52
30
|
margin: 0 calc(var(--dodo-ui-space--small) / 2.5);
|
|
53
31
|
}
|
|
54
32
|
}
|
|
55
33
|
|
|
56
34
|
&--large {
|
|
57
|
-
input[data-combobox-input] {
|
|
58
|
-
font-size: 1.1rem;
|
|
59
|
-
padding: 0 calc(var(--dodo-ui-space) * 2);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
35
|
button[data-combobox-trigger] {
|
|
63
36
|
margin: 0 calc(var(--dodo-ui-space--large) / 2.5);
|
|
64
37
|
}
|
|
@@ -40,7 +40,9 @@
|
|
|
40
40
|
placeholder,
|
|
41
41
|
comboboxInputProps,
|
|
42
42
|
comboboxTriggerProps,
|
|
43
|
+
// eslint-disable-next-line no-useless-assignment
|
|
43
44
|
searchValue = $bindable<string>(''),
|
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
44
46
|
after,
|
|
45
47
|
updateOpenState,
|
|
46
48
|
value,
|
|
@@ -84,6 +86,7 @@
|
|
|
84
86
|
{...restProps}
|
|
85
87
|
>
|
|
86
88
|
<Combobox.Input
|
|
89
|
+
{...comboboxInputProps}
|
|
87
90
|
oninput={(e) => {
|
|
88
91
|
searchValue = e.currentTarget.value;
|
|
89
92
|
}}
|
|
@@ -93,7 +96,7 @@
|
|
|
93
96
|
onclick={!searchable && !disabled ? () => updateOpenState(true) : undefined}
|
|
94
97
|
{placeholder}
|
|
95
98
|
{defaultValue}
|
|
96
|
-
|
|
99
|
+
class="InputBox"
|
|
97
100
|
/>
|
|
98
101
|
|
|
99
102
|
{#snippet after()}
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
/**
|
|
116
116
|
* Computed class list for the InputEnclosure component.
|
|
117
117
|
*/
|
|
118
|
-
const classes = $derived(['dodo-ui-TextInput',
|
|
118
|
+
const classes = $derived(['dodo-ui-TextInput', className].filter(Boolean));
|
|
119
119
|
</script>
|
|
120
120
|
|
|
121
121
|
<InputEnclosure
|
|
@@ -125,16 +125,16 @@
|
|
|
125
125
|
{disabled}
|
|
126
126
|
{error}
|
|
127
127
|
focused={forcedFocused || isFocused}
|
|
128
|
-
class={
|
|
128
|
+
class={classes.join(' ')}
|
|
129
129
|
{before}
|
|
130
130
|
{after}
|
|
131
131
|
>
|
|
132
132
|
<input
|
|
133
133
|
{...restProps}
|
|
134
|
-
class={classes.join(' ')}
|
|
135
134
|
bind:this={ref}
|
|
136
135
|
{disabled}
|
|
137
136
|
onfocus={handleFocus}
|
|
138
137
|
onblur={handleBlur}
|
|
138
|
+
class="InputBox"
|
|
139
139
|
/>
|
|
140
140
|
</InputEnclosure>
|
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
import { componentVariantOptions } from '$lib/attributes/variant.js';
|
|
7
7
|
import { componentRoundnessOptions } from '$lib/attributes/roundness.js';
|
|
8
8
|
import { ComponentShadowOptions } from '$lib/attributes/shadow.js';
|
|
9
|
-
import
|
|
10
|
-
import { componentThemeColorsOptions, componentThemeOptions } from '$lib/attributes/theme.js';
|
|
9
|
+
import { componentThemeColorsOptions } from '$lib/attributes/theme.js';
|
|
11
10
|
|
|
12
11
|
// ------------------------------
|
|
13
12
|
// Storybook ArgTypes
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Grid-Column
|
|
2
|
+
@use '../../../../styles/global/breakpoints' as breakpoints;
|
|
3
|
+
@use 'sass:math';
|
|
4
|
+
@use 'sass:map';
|
|
5
|
+
|
|
6
|
+
// ----------------------------------------
|
|
7
|
+
// Config
|
|
8
|
+
// ----------------------------------------
|
|
9
|
+
|
|
10
|
+
$grid-columns: 12;
|
|
11
|
+
|
|
12
|
+
$breakpoint-keys: (default, sm, md, lg, xl, xxl);
|
|
13
|
+
|
|
14
|
+
// ----------------------------------------
|
|
15
|
+
// Function
|
|
16
|
+
// ----------------------------------------
|
|
17
|
+
|
|
18
|
+
@function col($n) {
|
|
19
|
+
@return math.div(100%, $grid-columns) * $n;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// ----------------------------------------
|
|
23
|
+
// Column map
|
|
24
|
+
// ----------------------------------------
|
|
25
|
+
|
|
26
|
+
$column-size: ();
|
|
27
|
+
|
|
28
|
+
@for $i from 1 through $grid-columns {
|
|
29
|
+
$column-size: map.set($column-size, $i, col($i));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// ----------------------------------------
|
|
33
|
+
// Mixin (core logic)
|
|
34
|
+
// ----------------------------------------
|
|
35
|
+
|
|
36
|
+
@mixin column-styles($bp) {
|
|
37
|
+
@each $name, $size in $column-size {
|
|
38
|
+
&--#{$name} {
|
|
39
|
+
@if $bp == default {
|
|
40
|
+
width: $size;
|
|
41
|
+
flex: initial;
|
|
42
|
+
} @else {
|
|
43
|
+
@include breakpoints.up($bp) {
|
|
44
|
+
width: $size;
|
|
45
|
+
flex: initial;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&--flex {
|
|
52
|
+
@if $bp == default {
|
|
53
|
+
flex: 1;
|
|
54
|
+
} @else {
|
|
55
|
+
@include breakpoints.up($bp) {
|
|
56
|
+
flex: 1;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// ----------------------------------------
|
|
63
|
+
// Component
|
|
64
|
+
// ----------------------------------------
|
|
65
|
+
|
|
66
|
+
.dodo-ui-Grid-Column {
|
|
67
|
+
display: block;
|
|
68
|
+
min-width: 0;
|
|
69
|
+
padding: calc(var(--dodo-ui-space) * var(--Grid-gap));
|
|
70
|
+
|
|
71
|
+
&.column-size {
|
|
72
|
+
@each $bp in $breakpoint-keys {
|
|
73
|
+
&--#{$bp} {
|
|
74
|
+
@include column-styles($bp);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Column, { gridColumnSizeOptions } from './Column.svelte';
|
|
4
|
+
import type { GridColumnProps } from './Column.svelte';
|
|
5
|
+
import type { ArgTypes } from 'storybook/internal/csf';
|
|
6
|
+
|
|
7
|
+
// ------------------------------
|
|
8
|
+
// Storybook ArgTypes
|
|
9
|
+
// ------------------------------
|
|
10
|
+
export const storyColumnArgTypes: Partial<ArgTypes<GridColumnProps>> = {
|
|
11
|
+
// ------------------------------
|
|
12
|
+
// Core
|
|
13
|
+
// ------------------------------
|
|
14
|
+
children: { table: { category: 'API', subcategory: 'Base' } },
|
|
15
|
+
class: { table: { category: 'API', subcategory: 'Base' } },
|
|
16
|
+
|
|
17
|
+
// ------------------------------
|
|
18
|
+
// Size
|
|
19
|
+
// ------------------------------
|
|
20
|
+
size: {
|
|
21
|
+
control: { type: 'select' },
|
|
22
|
+
options: gridColumnSizeOptions,
|
|
23
|
+
table: { category: 'API', subcategory: 'Size', defaultValue: { summary: '12' } },
|
|
24
|
+
},
|
|
25
|
+
sm: {
|
|
26
|
+
control: { type: 'select' },
|
|
27
|
+
options: gridColumnSizeOptions,
|
|
28
|
+
table: { category: 'API', subcategory: 'Size' },
|
|
29
|
+
},
|
|
30
|
+
md: {
|
|
31
|
+
control: { type: 'select' },
|
|
32
|
+
options: gridColumnSizeOptions,
|
|
33
|
+
table: { category: 'API', subcategory: 'Size' },
|
|
34
|
+
},
|
|
35
|
+
lg: {
|
|
36
|
+
control: { type: 'select' },
|
|
37
|
+
options: gridColumnSizeOptions,
|
|
38
|
+
table: { category: 'API', subcategory: 'Size' },
|
|
39
|
+
},
|
|
40
|
+
xl: {
|
|
41
|
+
control: { type: 'select' },
|
|
42
|
+
options: gridColumnSizeOptions,
|
|
43
|
+
table: { category: 'API', subcategory: 'Size' },
|
|
44
|
+
},
|
|
45
|
+
xxl: {
|
|
46
|
+
control: { type: 'select' },
|
|
47
|
+
options: gridColumnSizeOptions,
|
|
48
|
+
table: { category: 'API', subcategory: 'Size' },
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// ------------------------------
|
|
53
|
+
// Storybook Meta
|
|
54
|
+
// ------------------------------
|
|
55
|
+
const { Story } = defineMeta({
|
|
56
|
+
component: Column,
|
|
57
|
+
tags: ['autodocs'],
|
|
58
|
+
argTypes: storyColumnArgTypes,
|
|
59
|
+
});
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<!-- ------------------------------ -->
|
|
63
|
+
<!-- Stories -->
|
|
64
|
+
<!-- ------------------------------ -->
|
|
65
|
+
|
|
66
|
+
<Story name="Default">Hello there</Story>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
export const GRID_COLUMN_BREAKPOINT = {
|
|
5
|
+
numerical: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
|
|
6
|
+
flex: ['flex'],
|
|
7
|
+
} as const;
|
|
8
|
+
|
|
9
|
+
export type GridColumnSizeNumerical = (typeof GRID_COLUMN_BREAKPOINT.numerical)[number];
|
|
10
|
+
type GridColumnSizeFlex = (typeof GRID_COLUMN_BREAKPOINT.flex)[number];
|
|
11
|
+
export type GridColumnSize = GridColumnSizeNumerical | GridColumnSizeFlex;
|
|
12
|
+
|
|
13
|
+
export const gridColumnSizeOptions = [
|
|
14
|
+
...GRID_COLUMN_BREAKPOINT.numerical,
|
|
15
|
+
...GRID_COLUMN_BREAKPOINT.flex,
|
|
16
|
+
] as const satisfies readonly GridColumnSize[];
|
|
17
|
+
|
|
18
|
+
export const gridColumnSizeNumericalOptions = GRID_COLUMN_BREAKPOINT.numerical;
|
|
19
|
+
|
|
20
|
+
export interface GridColumnProps {
|
|
21
|
+
/** Custom CSS class names */
|
|
22
|
+
class?: string;
|
|
23
|
+
|
|
24
|
+
/** Column contents go here */
|
|
25
|
+
children?: Snippet;
|
|
26
|
+
|
|
27
|
+
/** GridColumn ref */
|
|
28
|
+
ref?: HTMLDivElement | null;
|
|
29
|
+
|
|
30
|
+
/** Breakpoint: size (default unit) */
|
|
31
|
+
size?: GridColumnSize;
|
|
32
|
+
|
|
33
|
+
/** Breakpoint: sm */
|
|
34
|
+
sm?: GridColumnSize;
|
|
35
|
+
|
|
36
|
+
/** Breakpoint: md */
|
|
37
|
+
md?: GridColumnSize;
|
|
38
|
+
|
|
39
|
+
/** Breakpoint: lg */
|
|
40
|
+
lg?: GridColumnSize;
|
|
41
|
+
|
|
42
|
+
/** Breakpoint: xl */
|
|
43
|
+
xl?: GridColumnSize;
|
|
44
|
+
|
|
45
|
+
/** Breakpoint: xxl */
|
|
46
|
+
xxl?: GridColumnSize;
|
|
47
|
+
}
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<script lang="ts">
|
|
51
|
+
let {
|
|
52
|
+
class: className = '',
|
|
53
|
+
ref = $bindable(null),
|
|
54
|
+
children,
|
|
55
|
+
size = 12,
|
|
56
|
+
sm,
|
|
57
|
+
md,
|
|
58
|
+
lg,
|
|
59
|
+
xl,
|
|
60
|
+
xxl,
|
|
61
|
+
}: GridColumnProps = $props();
|
|
62
|
+
|
|
63
|
+
const classes = $derived(
|
|
64
|
+
[
|
|
65
|
+
'dodo-ui-Grid-Column',
|
|
66
|
+
`column-size--default--${size}`,
|
|
67
|
+
sm ? `column-size--sm--${sm}` : '',
|
|
68
|
+
md ? `column-size--md--${md}` : '',
|
|
69
|
+
lg ? `column-size--lg--${lg}` : '',
|
|
70
|
+
xl ? `column-size--xl--${xl}` : '',
|
|
71
|
+
xxl ? `column-size--xxl--${xxl}` : '',
|
|
72
|
+
className,
|
|
73
|
+
].filter(Boolean),
|
|
74
|
+
);
|
|
75
|
+
</script>
|
|
76
|
+
|
|
77
|
+
<div class={classes.join(' ')} bind:this={ref}>
|
|
78
|
+
{@render children?.()}
|
|
79
|
+
</div>
|