@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.
Files changed (64) hide show
  1. package/README.md +2 -205
  2. package/dist/components/Form/Button/ButtonAsAnchor.svelte +1 -1
  3. package/dist/components/Form/DatePicker/DatePicker.scss +0 -26
  4. package/dist/components/Form/DatePicker/DatePicker.svelte +8 -1
  5. package/dist/components/Form/DatePicker/DatePickerInput/DatePickerInput.svelte +3 -1
  6. package/dist/components/Form/DatePicker/DatePickerPopup/CalendarGrid.svelte +1 -1
  7. package/dist/components/Form/InputEnclosure/InputEnclosure.scss +34 -0
  8. package/dist/components/Form/InputEnclosure/InputEnclosure.stories.svelte +11 -11
  9. package/dist/components/Form/Label/Label.svelte +1 -1
  10. package/dist/components/Form/Select/Select.scss +0 -27
  11. package/dist/components/Form/Select/SelectInput.svelte +4 -1
  12. package/dist/components/Form/TextInput/TextInput.svelte +3 -3
  13. package/dist/components/Layout/Card/Card.stories.svelte +1 -2
  14. package/dist/components/Layout/Card/Card.svelte +1 -1
  15. package/dist/components/Layout/Card/Card.svelte.d.ts +1 -1
  16. package/dist/components/Layout/Grid/Column/Column.scss +78 -0
  17. package/dist/components/Layout/Grid/Column/Column.stories.svelte +66 -0
  18. package/dist/components/Layout/Grid/Column/Column.stories.svelte.d.ts +22 -0
  19. package/dist/components/Layout/Grid/Column/Column.svelte +79 -0
  20. package/dist/components/Layout/Grid/Column/Column.svelte.d.ts +33 -0
  21. package/dist/components/Layout/Grid/Grid.scss +8 -0
  22. package/dist/components/Layout/Grid/Grid.stories.svelte +177 -0
  23. package/dist/components/Layout/Grid/Grid.stories.svelte.d.ts +22 -0
  24. package/dist/components/Layout/Grid/Grid.svelte +32 -0
  25. package/dist/components/Layout/Grid/Grid.svelte.d.ts +12 -0
  26. package/dist/components/Layout/Grid/Row/Row.scss +7 -0
  27. package/dist/components/Layout/Grid/Row/Row.stories.svelte +39 -0
  28. package/dist/components/Layout/Grid/Row/Row.stories.svelte.d.ts +22 -0
  29. package/dist/components/Layout/Grid/Row/Row.svelte +21 -0
  30. package/dist/components/Layout/Grid/Row/Row.svelte.d.ts +10 -0
  31. package/dist/components/Layout/Theme/ThemeSystem/index.mdx +53 -53
  32. package/dist/index.d.ts +6 -0
  33. package/dist/index.js +6 -0
  34. package/dist/styles/components.css +478 -68
  35. package/dist/styles/components.css.map +1 -1
  36. package/dist/styles/components.scss +3 -1
  37. package/package.json +1 -1
  38. package/src/lib/components/Form/Button/ButtonAsAnchor.svelte +1 -1
  39. package/src/lib/components/Form/DatePicker/DatePicker.scss +0 -26
  40. package/src/lib/components/Form/DatePicker/DatePicker.svelte +8 -1
  41. package/src/lib/components/Form/DatePicker/DatePickerInput/DatePickerInput.svelte +3 -1
  42. package/src/lib/components/Form/DatePicker/DatePickerPopup/CalendarGrid.svelte +1 -1
  43. package/src/lib/components/Form/InputEnclosure/InputEnclosure.scss +34 -0
  44. package/src/lib/components/Form/InputEnclosure/InputEnclosure.stories.svelte +11 -11
  45. package/src/lib/components/Form/Label/Label.svelte +1 -1
  46. package/src/lib/components/Form/Select/Select.scss +0 -27
  47. package/src/lib/components/Form/Select/SelectInput.svelte +4 -1
  48. package/src/lib/components/Form/TextInput/TextInput.svelte +3 -3
  49. package/src/lib/components/Layout/Card/Card.stories.svelte +1 -2
  50. package/src/lib/components/Layout/Card/Card.svelte +1 -1
  51. package/src/lib/components/Layout/Grid/Column/Column.scss +78 -0
  52. package/src/lib/components/Layout/Grid/Column/Column.stories.svelte +66 -0
  53. package/src/lib/components/Layout/Grid/Column/Column.svelte +79 -0
  54. package/src/lib/components/Layout/Grid/Grid.scss +8 -0
  55. package/src/lib/components/Layout/Grid/Grid.stories.svelte +177 -0
  56. package/src/lib/components/Layout/Grid/Grid.svelte +32 -0
  57. package/src/lib/components/Layout/Grid/Row/Row.scss +7 -0
  58. package/src/lib/components/Layout/Grid/Row/Row.stories.svelte +39 -0
  59. package/src/lib/components/Layout/Grid/Row/Row.svelte +21 -0
  60. package/src/lib/components/Layout/Theme/ThemeSystem/index.mdx +53 -53
  61. package/src/lib/index.ts +17 -0
  62. package/src/lib/styles/components.scss +3 -1
  63. package/dist/components/Form/TextInput/TextInput.scss +0 -34
  64. package/src/lib/components/Form/TextInput/TextInput.scss +0 -34
@@ -0,0 +1,177 @@
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
+ // ------------------------------
11
+ // Storybook ArgTypes
12
+ // ------------------------------
13
+ export const storyGridArgTypes: Partial<ArgTypes<GridProps>> = {
14
+ // ------------------------------
15
+ // Core
16
+ // ------------------------------
17
+ children: { table: { category: 'API', subcategory: 'Base' } },
18
+ class: { table: { category: 'API', subcategory: 'Base' } },
19
+ gap: { table: { category: 'API', subcategory: 'Base', defaultValue: { summary: '1' } } },
20
+ };
21
+
22
+ // ------------------------------
23
+ // Storybook Meta
24
+ // ------------------------------
25
+ const { Story } = defineMeta({
26
+ component: Grid,
27
+ tags: ['autodocs'],
28
+ argTypes: storyGridArgTypes,
29
+ });
30
+ </script>
31
+
32
+ <!-- ------------------------------ -->
33
+ <!-- Stories -->
34
+ <!-- ------------------------------ -->
35
+
36
+ <!-- Basic 12 column grid -->
37
+ <Story name="Default">
38
+ <Column sm={4}>Hello there</Column>
39
+ <Column sm={4}>Hello there</Column>
40
+ <Column sm={4}>Hello there</Column>
41
+ <Column sm={4}>Hello there</Column>
42
+ <Column sm={4}>Hello there</Column>
43
+ </Story>
44
+
45
+ <Story name="Example">
46
+ <Column sm={4}>
47
+ <Card color="primary">
48
+ <p>Hello there</p>
49
+ </Card>
50
+ </Column>
51
+ <Column sm={4}>
52
+ <Card color="primary">
53
+ <p>Hello there</p>
54
+ </Card>
55
+ </Column>
56
+ <Column sm={4}>
57
+ <Card color="primary">
58
+ <p>Hello there</p>
59
+ </Card>
60
+ </Column>
61
+ <Column sm={4}>
62
+ <Card color="primary">
63
+ <p>Hello there</p>
64
+ </Card>
65
+ </Column>
66
+ </Story>
67
+
68
+ <Story name="Grid Row">
69
+ <Row>
70
+ <Column sm={6} md={4} lg={3}>
71
+ <Card color="primary">
72
+ <p>Hello there</p>
73
+ </Card>
74
+ </Column>
75
+ <Column sm={6} md={4} lg={3}>
76
+ <Card color="primary">
77
+ <p>Hello there</p>
78
+ </Card>
79
+ </Column>
80
+ <Column sm={6} md={4} lg={3}>
81
+ <Card color="primary">
82
+ <p>Hello there</p>
83
+ </Card>
84
+ </Column>
85
+ </Row>
86
+ <Row>
87
+ <Column sm={6} md={4} lg={3}>
88
+ <Card color="primary">
89
+ <p>Hello there</p>
90
+ </Card>
91
+ </Column>
92
+ <Column sm={6} md={4} lg={3}>
93
+ <Card color="primary">
94
+ <p>Hello there</p>
95
+ </Card>
96
+ </Column>
97
+ <Column sm={6} md={4} lg={3}>
98
+ <Card color="primary">
99
+ <p>Hello there</p>
100
+ </Card>
101
+ </Column>
102
+ </Row>
103
+ </Story>
104
+
105
+ <Story name="Gap" args={{ gap: 2 }}>
106
+ <Column sm={4}>
107
+ <Card color="primary">
108
+ <p>Hello there</p>
109
+ </Card>
110
+ </Column>
111
+ <Column sm={4}>
112
+ <Card color="primary">
113
+ <p>Hello there</p>
114
+ </Card>
115
+ </Column>
116
+ <Column sm={4}>
117
+ <Card color="primary">
118
+ <p>Hello there</p>
119
+ </Card>
120
+ </Column>
121
+ <Column sm={4}>
122
+ <Card color="primary">
123
+ <p>Hello there</p>
124
+ </Card>
125
+ </Column>
126
+ </Story>
127
+
128
+ <Story name="Responsive">
129
+ <Column sm={6} md={4} lg={3}>
130
+ <Card color="primary">
131
+ <p>Hello there</p>
132
+ </Card>
133
+ </Column>
134
+ <Column sm={6} md={4} lg={3}>
135
+ <Card color="primary">
136
+ <p>Hello there</p>
137
+ </Card>
138
+ </Column>
139
+ <Column sm={6} md={4} lg={3}>
140
+ <Card color="primary">
141
+ <p>Hello there</p>
142
+ </Card>
143
+ </Column>
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
+ </Story>
160
+
161
+ <Story name="Flex">
162
+ <Column md="flex">
163
+ <Card color="primary">
164
+ <p>Hello there</p>
165
+ </Card>
166
+ </Column>
167
+ <Column md={2}>
168
+ <Card color="primary">
169
+ <p>Hello there</p>
170
+ </Card>
171
+ </Column>
172
+ <Column md={2}>
173
+ <Card color="primary">
174
+ <p>Hello there</p>
175
+ </Card>
176
+ </Column>
177
+ </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,7 @@
1
+ // Grid-Row
2
+
3
+ .dodo-ui-Grid-Row {
4
+ display: flex;
5
+ width: 100%;
6
+ flex-wrap: wrap;
7
+ }
@@ -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>
@@ -1,53 +1,53 @@
1
- import { Source } from '@storybook/addon-docs/blocks';
2
-
3
- # 🎨 Theme System
4
-
5
- A lightweight theme system built using context + local store.
6
-
7
- ## 🧩 Theme Context
8
-
9
- ### 📦 Import
10
-
11
- <Source
12
- dark
13
- language="ts"
14
- code={`
15
- import { useThemeContext } from '@flightlesslabs/dodo-ui';
16
- `}
17
- />
18
-
19
- Provides access to the active theme.
20
-
21
- ### Usage
22
-
23
- <Source
24
- dark
25
- language="ts"
26
- code={`
27
- const { theme } = useThemeContext();
28
- `}
29
- />
30
-
31
- ## 🏪 Theme Store
32
-
33
- Global theme state.
34
-
35
- ### 📦 Import
36
-
37
- <Source
38
- dark
39
- language="ts"
40
- code={`
41
- import { useThemeStore } from '@flightlesslabs/dodo-ui';
42
- `}
43
- />
44
-
45
- ### Read
46
-
47
- <Source
48
- dark
49
- language="ts"
50
- code={`
51
- const theme = useThemeStore.theme;
52
- `}
53
- />
1
+ import { Source } from '@storybook/addon-docs/blocks';
2
+
3
+ # 🎨 Theme System
4
+
5
+ A lightweight theme system built using context + local store.
6
+
7
+ ## 🧩 Theme Context
8
+
9
+ ### 📦 Import
10
+
11
+ <Source
12
+ dark
13
+ language="ts"
14
+ code={`
15
+ import { useThemeContext } from '@flightlesslabs/dodo-ui';
16
+ `}
17
+ />
18
+
19
+ Provides access to the active theme.
20
+
21
+ ### Usage
22
+
23
+ <Source
24
+ dark
25
+ language="ts"
26
+ code={`
27
+ const { theme } = useThemeContext();
28
+ `}
29
+ />
30
+
31
+ ## 🏪 Theme Store
32
+
33
+ Global theme state.
34
+
35
+ ### 📦 Import
36
+
37
+ <Source
38
+ dark
39
+ language="ts"
40
+ code={`
41
+ import { useThemeStore } from '@flightlesslabs/dodo-ui';
42
+ `}
43
+ />
44
+
45
+ ### Read
46
+
47
+ <Source
48
+ dark
49
+ language="ts"
50
+ code={`
51
+ const theme = useThemeStore.theme;
52
+ `}
53
+ />
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
  // =====================================================
@@ -3,7 +3,6 @@
3
3
  @use '../components/Form/UtilityButton/UtilityButton.scss';
4
4
  @use '../components/Form/Button/Button.scss';
5
5
  @use '../components/Form/InputEnclosure/InputEnclosure.scss';
6
- @use '../components/Form/TextInput/TextInput.scss';
7
6
  @use '../components/Form/Label/Label.scss';
8
7
  @use '../components/Form/FormField/FormField.scss';
9
8
  @use '../components/Form/CheckEnclosure/CheckEnclosure.scss';
@@ -13,3 +12,6 @@
13
12
  @use '../components/Form/Switch/Switch.scss';
14
13
  @use '../components/Form/Select/Select.scss';
15
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';
@@ -1,34 +0,0 @@
1
- // ----------------------------------------
2
- // Component CSS
3
- // ----------------------------------------
4
- .dodo-ui-TextInput {
5
- flex: 1;
6
- border: 0;
7
- outline: 0;
8
- height: 100%;
9
- background-color: transparent;
10
- font-family: inherit;
11
- color: inherit;
12
- letter-spacing: 0.3px;
13
- margin: 0;
14
-
15
- // ----------------------------------------
16
- // Sizes
17
- // ----------------------------------------
18
- &.size {
19
- &--normal {
20
- font-size: 1rem;
21
- padding: 0 calc(var(--dodo-ui-space-small) * 2);
22
- }
23
-
24
- &--small {
25
- padding: 0 var(--dodo-ui-space);
26
- font-size: 0.9rem;
27
- }
28
-
29
- &--large {
30
- font-size: 1.1rem;
31
- padding: 0 calc(var(--dodo-ui-space) * 2);
32
- }
33
- }
34
- }
@@ -1,34 +0,0 @@
1
- // ----------------------------------------
2
- // Component CSS
3
- // ----------------------------------------
4
- .dodo-ui-TextInput {
5
- flex: 1;
6
- border: 0;
7
- outline: 0;
8
- height: 100%;
9
- background-color: transparent;
10
- font-family: inherit;
11
- color: inherit;
12
- letter-spacing: 0.3px;
13
- margin: 0;
14
-
15
- // ----------------------------------------
16
- // Sizes
17
- // ----------------------------------------
18
- &.size {
19
- &--normal {
20
- font-size: 1rem;
21
- padding: 0 calc(var(--dodo-ui-space-small) * 2);
22
- }
23
-
24
- &--small {
25
- padding: 0 var(--dodo-ui-space);
26
- font-size: 0.9rem;
27
- }
28
-
29
- &--large {
30
- font-size: 1.1rem;
31
- padding: 0 calc(var(--dodo-ui-space) * 2);
32
- }
33
- }
34
- }