@flightlesslabs/dodo-ui 0.21.0 → 0.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Home.mdx +25 -36
- package/dist/components/Form/Button/Button.stories.svelte +33 -23
- package/dist/components/Form/Button/Button.svelte +0 -25
- package/dist/components/Form/Button/Button.svelte.d.ts +0 -16
- package/dist/components/Form/Checkbox/Checkbox.stories.svelte +25 -16
- package/dist/components/Form/Checkbox/Checkbox.svelte +0 -3
- package/dist/components/Form/DatePicker/DatePicker.stories.svelte +26 -2
- package/dist/components/Form/DatePicker/DatePickerPopup/DatePickerPopup.svelte +1 -1
- package/dist/components/Form/FormField/FormField.stories.svelte +15 -10
- package/dist/components/Form/FormField/FormField.svelte +0 -3
- package/dist/components/Form/InputEnclosure/InputEnclosure.stories.svelte +21 -7
- package/dist/components/Form/InputEnclosure/InputEnclosure.svelte +0 -21
- package/dist/components/Form/InputEnclosure/InputEnclosure.svelte.d.ts +0 -12
- package/dist/components/Form/Select/Select.stories.svelte +18 -3
- package/dist/components/Form/Select/Select.svelte +0 -6
- package/dist/components/Form/Select/Select.svelte.d.ts +0 -6
- package/dist/components/Form/Switch/Switch.stories.svelte +17 -8
- package/dist/components/Form/TextInput/TextInput.stories.svelte +19 -16
- package/dist/components/Form/TextInput/TextInput.svelte +0 -3
- package/dist/components/Form/UtilityButton/UtilityButton.stories.svelte +42 -33
- package/dist/components/Form/UtilityButton/UtilityButton.svelte +0 -36
- package/dist/components/Form/UtilityButton/UtilityButton.svelte.d.ts +0 -27
- package/dist/components/Info/Calendar/Calendar.scss +20 -10
- package/dist/components/Info/Calendar/Calendar.stories.svelte +22 -1
- package/dist/components/Layout/Card/Card.stories.svelte +17 -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 +192 -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/Theme.stories.svelte +16 -2
- package/dist/components/Layout/Theme/ThemeSystem/index.mdx +8 -26
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/styles/components.css +468 -6
- package/dist/styles/components.css.map +1 -1
- package/dist/styles/components.scss +3 -0
- package/dist/utils/time/date-creator/createDate/createDate.mdx +13 -38
- package/dist/utils/time/date-creator/createDateFactory/createDateFactory.mdx +11 -34
- package/dist/utils/time/timeout/timeout.mdx +19 -39
- package/package.json +1 -1
- package/src/lib/Home.mdx +25 -36
- package/src/lib/components/Form/Button/Button.stories.svelte +33 -23
- package/src/lib/components/Form/Button/Button.svelte +0 -25
- package/src/lib/components/Form/Checkbox/Checkbox.stories.svelte +25 -16
- package/src/lib/components/Form/Checkbox/Checkbox.svelte +0 -3
- package/src/lib/components/Form/DatePicker/DatePicker.stories.svelte +26 -2
- package/src/lib/components/Form/DatePicker/DatePickerPopup/DatePickerPopup.svelte +1 -1
- package/src/lib/components/Form/FormField/FormField.stories.svelte +15 -10
- package/src/lib/components/Form/FormField/FormField.svelte +0 -3
- package/src/lib/components/Form/InputEnclosure/InputEnclosure.stories.svelte +21 -7
- package/src/lib/components/Form/InputEnclosure/InputEnclosure.svelte +0 -21
- package/src/lib/components/Form/Select/Select.stories.svelte +18 -3
- package/src/lib/components/Form/Select/Select.svelte +0 -6
- package/src/lib/components/Form/Switch/Switch.stories.svelte +17 -8
- package/src/lib/components/Form/TextInput/TextInput.stories.svelte +19 -16
- package/src/lib/components/Form/TextInput/TextInput.svelte +0 -3
- package/src/lib/components/Form/UtilityButton/UtilityButton.stories.svelte +42 -33
- package/src/lib/components/Form/UtilityButton/UtilityButton.svelte +0 -36
- package/src/lib/components/Info/Calendar/Calendar.scss +20 -10
- package/src/lib/components/Info/Calendar/Calendar.stories.svelte +22 -1
- package/src/lib/components/Layout/Card/Card.stories.svelte +17 -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 +192 -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/Theme.stories.svelte +16 -2
- package/src/lib/components/Layout/Theme/ThemeSystem/index.mdx +8 -26
- package/src/lib/index.ts +17 -0
- package/src/lib/styles/components.scss +3 -0
- package/src/lib/utils/time/date-creator/createDate/createDate.mdx +13 -38
- package/src/lib/utils/time/date-creator/createDateFactory/createDateFactory.mdx +11 -34
- package/src/lib/utils/time/timeout/timeout.mdx +19 -39
|
@@ -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>
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Grid from './Grid.svelte';
|
|
4
|
+
import type { GridProps } from './Grid.svelte';
|
|
5
|
+
import type { ArgTypes } from 'storybook/internal/csf';
|
|
6
|
+
import Column from './Column/Column.svelte';
|
|
7
|
+
import Card from '../Card/Card.svelte';
|
|
8
|
+
import Row from './Row/Row.svelte';
|
|
9
|
+
|
|
10
|
+
const description = `
|
|
11
|
+
a set of components for your basic "12 column grid" needs
|
|
12
|
+
|
|
13
|
+
\`\`\`ts
|
|
14
|
+
import { Grid, Column, Row } from '@flightlesslabs/dodo-ui';
|
|
15
|
+
\`\`\`
|
|
16
|
+
`;
|
|
17
|
+
|
|
18
|
+
// ------------------------------
|
|
19
|
+
// Storybook ArgTypes
|
|
20
|
+
// ------------------------------
|
|
21
|
+
export const storyGridArgTypes: Partial<ArgTypes<GridProps>> = {
|
|
22
|
+
// ------------------------------
|
|
23
|
+
// Core
|
|
24
|
+
// ------------------------------
|
|
25
|
+
children: { table: { category: 'API', subcategory: 'Base' } },
|
|
26
|
+
class: { table: { category: 'API', subcategory: 'Base' } },
|
|
27
|
+
gap: { table: { category: 'API', subcategory: 'Base', defaultValue: { summary: '1' } } },
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// ------------------------------
|
|
31
|
+
// Storybook Meta
|
|
32
|
+
// ------------------------------
|
|
33
|
+
const { Story } = defineMeta({
|
|
34
|
+
component: Grid,
|
|
35
|
+
tags: ['autodocs'],
|
|
36
|
+
argTypes: storyGridArgTypes,
|
|
37
|
+
parameters: {
|
|
38
|
+
docs: {
|
|
39
|
+
description: {
|
|
40
|
+
component: description,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<!-- ------------------------------ -->
|
|
48
|
+
<!-- Stories -->
|
|
49
|
+
<!-- ------------------------------ -->
|
|
50
|
+
|
|
51
|
+
<!-- Basic 12 column grid -->
|
|
52
|
+
<Story name="Default">
|
|
53
|
+
<Column sm={4}>Hello there</Column>
|
|
54
|
+
<Column sm={4}>Hello there</Column>
|
|
55
|
+
<Column sm={4}>Hello there</Column>
|
|
56
|
+
<Column sm={4}>Hello there</Column>
|
|
57
|
+
<Column sm={4}>Hello there</Column>
|
|
58
|
+
</Story>
|
|
59
|
+
|
|
60
|
+
<Story name="Example">
|
|
61
|
+
<Column sm={4}>
|
|
62
|
+
<Card color="primary">
|
|
63
|
+
<p>Hello there</p>
|
|
64
|
+
</Card>
|
|
65
|
+
</Column>
|
|
66
|
+
<Column sm={4}>
|
|
67
|
+
<Card color="primary">
|
|
68
|
+
<p>Hello there</p>
|
|
69
|
+
</Card>
|
|
70
|
+
</Column>
|
|
71
|
+
<Column sm={4}>
|
|
72
|
+
<Card color="primary">
|
|
73
|
+
<p>Hello there</p>
|
|
74
|
+
</Card>
|
|
75
|
+
</Column>
|
|
76
|
+
<Column sm={4}>
|
|
77
|
+
<Card color="primary">
|
|
78
|
+
<p>Hello there</p>
|
|
79
|
+
</Card>
|
|
80
|
+
</Column>
|
|
81
|
+
</Story>
|
|
82
|
+
|
|
83
|
+
<Story name="Grid Row">
|
|
84
|
+
<Row>
|
|
85
|
+
<Column sm={6} md={4} lg={3}>
|
|
86
|
+
<Card color="primary">
|
|
87
|
+
<p>Hello there</p>
|
|
88
|
+
</Card>
|
|
89
|
+
</Column>
|
|
90
|
+
<Column sm={6} md={4} lg={3}>
|
|
91
|
+
<Card color="primary">
|
|
92
|
+
<p>Hello there</p>
|
|
93
|
+
</Card>
|
|
94
|
+
</Column>
|
|
95
|
+
<Column sm={6} md={4} lg={3}>
|
|
96
|
+
<Card color="primary">
|
|
97
|
+
<p>Hello there</p>
|
|
98
|
+
</Card>
|
|
99
|
+
</Column>
|
|
100
|
+
</Row>
|
|
101
|
+
<Row>
|
|
102
|
+
<Column sm={6} md={4} lg={3}>
|
|
103
|
+
<Card color="primary">
|
|
104
|
+
<p>Hello there</p>
|
|
105
|
+
</Card>
|
|
106
|
+
</Column>
|
|
107
|
+
<Column sm={6} md={4} lg={3}>
|
|
108
|
+
<Card color="primary">
|
|
109
|
+
<p>Hello there</p>
|
|
110
|
+
</Card>
|
|
111
|
+
</Column>
|
|
112
|
+
<Column sm={6} md={4} lg={3}>
|
|
113
|
+
<Card color="primary">
|
|
114
|
+
<p>Hello there</p>
|
|
115
|
+
</Card>
|
|
116
|
+
</Column>
|
|
117
|
+
</Row>
|
|
118
|
+
</Story>
|
|
119
|
+
|
|
120
|
+
<Story name="Gap" args={{ gap: 2 }}>
|
|
121
|
+
<Column sm={4}>
|
|
122
|
+
<Card color="primary">
|
|
123
|
+
<p>Hello there</p>
|
|
124
|
+
</Card>
|
|
125
|
+
</Column>
|
|
126
|
+
<Column sm={4}>
|
|
127
|
+
<Card color="primary">
|
|
128
|
+
<p>Hello there</p>
|
|
129
|
+
</Card>
|
|
130
|
+
</Column>
|
|
131
|
+
<Column sm={4}>
|
|
132
|
+
<Card color="primary">
|
|
133
|
+
<p>Hello there</p>
|
|
134
|
+
</Card>
|
|
135
|
+
</Column>
|
|
136
|
+
<Column sm={4}>
|
|
137
|
+
<Card color="primary">
|
|
138
|
+
<p>Hello there</p>
|
|
139
|
+
</Card>
|
|
140
|
+
</Column>
|
|
141
|
+
</Story>
|
|
142
|
+
|
|
143
|
+
<Story name="Responsive">
|
|
144
|
+
<Column sm={6} md={4} lg={3}>
|
|
145
|
+
<Card color="primary">
|
|
146
|
+
<p>Hello there</p>
|
|
147
|
+
</Card>
|
|
148
|
+
</Column>
|
|
149
|
+
<Column sm={6} md={4} lg={3}>
|
|
150
|
+
<Card color="primary">
|
|
151
|
+
<p>Hello there</p>
|
|
152
|
+
</Card>
|
|
153
|
+
</Column>
|
|
154
|
+
<Column sm={6} md={4} lg={3}>
|
|
155
|
+
<Card color="primary">
|
|
156
|
+
<p>Hello there</p>
|
|
157
|
+
</Card>
|
|
158
|
+
</Column>
|
|
159
|
+
<Column sm={6} md={4} lg={3}>
|
|
160
|
+
<Card color="primary">
|
|
161
|
+
<p>Hello there</p>
|
|
162
|
+
</Card>
|
|
163
|
+
</Column>
|
|
164
|
+
<Column sm={6} md={4} lg={3}>
|
|
165
|
+
<Card color="primary">
|
|
166
|
+
<p>Hello there</p>
|
|
167
|
+
</Card>
|
|
168
|
+
</Column>
|
|
169
|
+
<Column sm={6} md={4} lg={3}>
|
|
170
|
+
<Card color="primary">
|
|
171
|
+
<p>Hello there</p>
|
|
172
|
+
</Card>
|
|
173
|
+
</Column>
|
|
174
|
+
</Story>
|
|
175
|
+
|
|
176
|
+
<Story name="Flex">
|
|
177
|
+
<Column md="flex">
|
|
178
|
+
<Card color="primary">
|
|
179
|
+
<p>Hello there</p>
|
|
180
|
+
</Card>
|
|
181
|
+
</Column>
|
|
182
|
+
<Column md={2}>
|
|
183
|
+
<Card color="primary">
|
|
184
|
+
<p>Hello there</p>
|
|
185
|
+
</Card>
|
|
186
|
+
</Column>
|
|
187
|
+
<Column md={2}>
|
|
188
|
+
<Card color="primary">
|
|
189
|
+
<p>Hello there</p>
|
|
190
|
+
</Card>
|
|
191
|
+
</Column>
|
|
192
|
+
</Story>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
export interface GridProps {
|
|
5
|
+
/** Custom CSS class names */
|
|
6
|
+
class?: string;
|
|
7
|
+
|
|
8
|
+
/** Grid contents go here*/
|
|
9
|
+
children?: Snippet;
|
|
10
|
+
|
|
11
|
+
/** Grid spacing, affects Coulumns */
|
|
12
|
+
gap?: number;
|
|
13
|
+
}
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<script lang="ts">
|
|
17
|
+
let { class: className = '', gap = 1, children }: GridProps = $props();
|
|
18
|
+
|
|
19
|
+
function normalizeGap(value: number) {
|
|
20
|
+
return value === 0 ? 0 : value / 2;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const gapHalf = $derived(normalizeGap(gap));
|
|
24
|
+
|
|
25
|
+
const classes = $derived(['dodo-ui-Grid', className].filter(Boolean));
|
|
26
|
+
|
|
27
|
+
const inlineStyles = $derived([`--Grid-gap: ${gapHalf}`].filter(Boolean));
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<div class={classes.join(' ')} style={inlineStyles.join(';')}>
|
|
31
|
+
{@render children?.()}
|
|
32
|
+
</div>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Row from './Row.svelte';
|
|
4
|
+
import type { GridRowProps } from './Row.svelte';
|
|
5
|
+
import type { ArgTypes } from 'storybook/internal/csf';
|
|
6
|
+
import Column from '../Column/Column.svelte';
|
|
7
|
+
|
|
8
|
+
// ------------------------------
|
|
9
|
+
// Storybook ArgTypes
|
|
10
|
+
// ------------------------------
|
|
11
|
+
export const storyRowArgTypes: Partial<ArgTypes<GridRowProps>> = {
|
|
12
|
+
// ------------------------------
|
|
13
|
+
// Core
|
|
14
|
+
// ------------------------------
|
|
15
|
+
children: { table: { category: 'API', subcategory: 'Base' } },
|
|
16
|
+
class: { table: { category: 'API', subcategory: 'Base' } },
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// ------------------------------
|
|
20
|
+
// Storybook Meta
|
|
21
|
+
// ------------------------------
|
|
22
|
+
const { Story } = defineMeta({
|
|
23
|
+
component: Row,
|
|
24
|
+
tags: ['autodocs'],
|
|
25
|
+
argTypes: storyRowArgTypes,
|
|
26
|
+
});
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<!-- ------------------------------ -->
|
|
30
|
+
<!-- Stories -->
|
|
31
|
+
<!-- ------------------------------ -->
|
|
32
|
+
|
|
33
|
+
<Story name="Default">
|
|
34
|
+
<Column sm={4}>Hello there</Column>
|
|
35
|
+
<Column sm={4}>Hello there</Column>
|
|
36
|
+
<Column sm={4}>Hello there</Column>
|
|
37
|
+
<Column sm={4}>Hello there</Column>
|
|
38
|
+
<Column sm={4}>Hello there</Column>
|
|
39
|
+
</Story>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
export interface GridRowProps {
|
|
5
|
+
/** Custom CSS class names */
|
|
6
|
+
class?: string;
|
|
7
|
+
|
|
8
|
+
/** GridRow contents go here*/
|
|
9
|
+
children?: Snippet;
|
|
10
|
+
}
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<script lang="ts">
|
|
14
|
+
let { class: className = '', children }: GridRowProps = $props();
|
|
15
|
+
|
|
16
|
+
const classes = $derived(['dodo-ui-Grid-Row', className].filter(Boolean));
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<div class={classes.join(' ')}>
|
|
20
|
+
{@render children?.()}
|
|
21
|
+
</div>
|
|
@@ -5,6 +5,14 @@
|
|
|
5
5
|
import type { ArgTypes } from 'storybook/internal/csf';
|
|
6
6
|
import { componentThemeOptions } from '$lib/attributes/theme.js';
|
|
7
7
|
|
|
8
|
+
const description = `
|
|
9
|
+
Wrap your app at the root with Theme to provide a consistent light or dark class (based on system or override) to all child components
|
|
10
|
+
|
|
11
|
+
\`\`\`ts
|
|
12
|
+
import { Theme } from '@flightlesslabs/dodo-ui';
|
|
13
|
+
\`\`\`
|
|
14
|
+
`;
|
|
15
|
+
|
|
8
16
|
/**
|
|
9
17
|
* Storybook controls for Theme
|
|
10
18
|
*/
|
|
@@ -25,6 +33,13 @@
|
|
|
25
33
|
component: Theme,
|
|
26
34
|
tags: ['autodocs'],
|
|
27
35
|
argTypes: ThemeArgTypes,
|
|
36
|
+
parameters: {
|
|
37
|
+
docs: {
|
|
38
|
+
description: {
|
|
39
|
+
component: description,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
28
43
|
});
|
|
29
44
|
</script>
|
|
30
45
|
|
|
@@ -32,8 +47,7 @@
|
|
|
32
47
|
<!-- Stories -->
|
|
33
48
|
<!-- ------------------------------ -->
|
|
34
49
|
|
|
35
|
-
|
|
36
|
-
<Story name="Auto"></Story>
|
|
50
|
+
<Story name="Default"></Story>
|
|
37
51
|
|
|
38
52
|
<Story name="Light" args={{ type: 'light' }}></Story>
|
|
39
53
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { Source } from '@storybook/addon-docs/blocks';
|
|
2
|
-
|
|
3
1
|
# 🎨 Theme System
|
|
4
2
|
|
|
5
3
|
A lightweight theme system built using context + local store.
|
|
@@ -8,25 +6,17 @@ A lightweight theme system built using context + local store.
|
|
|
8
6
|
|
|
9
7
|
### 📦 Import
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
dark
|
|
13
|
-
language="ts"
|
|
14
|
-
code={`
|
|
9
|
+
```ts
|
|
15
10
|
import { useThemeContext } from '@flightlesslabs/dodo-ui';
|
|
16
|
-
|
|
17
|
-
/>
|
|
11
|
+
```
|
|
18
12
|
|
|
19
13
|
Provides access to the active theme.
|
|
20
14
|
|
|
21
15
|
### Usage
|
|
22
16
|
|
|
23
|
-
|
|
24
|
-
dark
|
|
25
|
-
language="ts"
|
|
26
|
-
code={`
|
|
17
|
+
```ts
|
|
27
18
|
const { theme } = useThemeContext();
|
|
28
|
-
|
|
29
|
-
/>
|
|
19
|
+
```
|
|
30
20
|
|
|
31
21
|
## 🏪 Theme Store
|
|
32
22
|
|
|
@@ -34,20 +24,12 @@ Global theme state.
|
|
|
34
24
|
|
|
35
25
|
### 📦 Import
|
|
36
26
|
|
|
37
|
-
|
|
38
|
-
dark
|
|
39
|
-
language="ts"
|
|
40
|
-
code={`
|
|
27
|
+
```ts
|
|
41
28
|
import { useThemeStore } from '@flightlesslabs/dodo-ui';
|
|
42
|
-
|
|
43
|
-
/>
|
|
29
|
+
```
|
|
44
30
|
|
|
45
31
|
### Read
|
|
46
32
|
|
|
47
|
-
|
|
48
|
-
dark
|
|
49
|
-
language="ts"
|
|
50
|
-
code={`
|
|
33
|
+
```ts
|
|
51
34
|
const theme = useThemeStore.theme;
|
|
52
|
-
|
|
53
|
-
/>
|
|
35
|
+
```
|
package/src/lib/index.ts
CHANGED
|
@@ -120,6 +120,23 @@ export {
|
|
|
120
120
|
type CardProps,
|
|
121
121
|
} from './components/Layout/Card/Card.svelte';
|
|
122
122
|
|
|
123
|
+
/**
|
|
124
|
+
* Grid component and related prop types.
|
|
125
|
+
*/
|
|
126
|
+
export { default as Grid, type GridProps } from './components/Layout/Grid/Grid.svelte';
|
|
127
|
+
|
|
128
|
+
export {
|
|
129
|
+
GRID_COLUMN_BREAKPOINT,
|
|
130
|
+
default as Column,
|
|
131
|
+
gridColumnSizeOptions,
|
|
132
|
+
gridColumnSizeNumericalOptions,
|
|
133
|
+
type GridColumnProps,
|
|
134
|
+
type GridColumnSizeNumerical,
|
|
135
|
+
type GridColumnSize,
|
|
136
|
+
} from './components/Layout/Grid/Column/Column.svelte';
|
|
137
|
+
|
|
138
|
+
export { default as Row, type GridRowProps } from './components/Layout/Grid/Row/Row.svelte';
|
|
139
|
+
|
|
123
140
|
// =====================================================
|
|
124
141
|
// Info Components – Public API
|
|
125
142
|
// =====================================================
|
|
@@ -12,3 +12,6 @@
|
|
|
12
12
|
@use '../components/Form/Switch/Switch.scss';
|
|
13
13
|
@use '../components/Form/Select/Select.scss';
|
|
14
14
|
@use '../components/Form/DatePicker/DatePicker.scss';
|
|
15
|
+
@use '../components/Layout/Grid/Grid.scss';
|
|
16
|
+
@use '../components/Layout/Grid/Column/Column.scss';
|
|
17
|
+
@use '../components/Layout/Grid/Row/Row.scss';
|