@flightlesslabs/dodo-ui 0.15.0 → 0.16.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 (27) hide show
  1. package/dist/index.d.ts +7 -0
  2. package/dist/index.js +4 -0
  3. package/dist/stories/components/Layout/Grid/Column/Column.stories.svelte +18 -0
  4. package/dist/stories/components/Layout/Grid/Column/Column.stories.svelte.d.ts +21 -0
  5. package/dist/stories/components/Layout/Grid/Column/Column.svelte +73 -0
  6. package/dist/stories/components/Layout/Grid/Column/Column.svelte.d.ts +24 -0
  7. package/dist/stories/components/Layout/Grid/Grid.stories.svelte +179 -0
  8. package/dist/stories/components/Layout/Grid/Grid.stories.svelte.d.ts +21 -0
  9. package/dist/stories/components/Layout/Grid/Grid.svelte +24 -0
  10. package/dist/stories/components/Layout/Grid/Grid.svelte.d.ts +16 -0
  11. package/dist/stories/components/Layout/Grid/Row/Row.stories.svelte +19 -0
  12. package/dist/stories/components/Layout/Grid/Row/Row.stories.svelte.d.ts +21 -0
  13. package/dist/stories/components/Layout/Grid/Row/Row.svelte +20 -0
  14. package/dist/stories/components/Layout/Grid/Row/Row.svelte.d.ts +12 -0
  15. package/dist/styles/global.css +0 -1
  16. package/dist/styles/scss/_breakpoints.scss +5 -0
  17. package/dist/styles/scss/index.scss +1 -0
  18. package/package.json +3 -2
  19. package/src/lib/index.ts +11 -0
  20. package/src/lib/stories/components/Layout/Grid/Column/Column.svelte +127 -0
  21. package/src/lib/stories/components/Layout/Grid/Grid.svelte +47 -0
  22. package/src/lib/stories/components/Layout/Grid/Row/Row.svelte +36 -0
  23. package/src/lib/styles/global.css +0 -1
  24. package/src/lib/styles/scss/_breakpoints.scss +5 -0
  25. package/src/lib/styles/scss/index.scss +1 -0
  26. package/dist/styles/_breakpoint.css +0 -10
  27. package/src/lib/styles/_breakpoint.css +0 -10
package/dist/index.d.ts CHANGED
@@ -83,6 +83,13 @@ export { default as MenuItem } from './stories/components/Layout/Menu/MenuItem/M
83
83
  export type { MenuItemType, MenuItemProps, } from './stories/components/Layout/Menu/MenuItem/MenuItem.svelte';
84
84
  export { default as DynamicMenu } from './stories/components/Layout/Menu/DynamicMenu/DynamicMenu.svelte';
85
85
  export type { DynamicMenuItemOption, DynamicMenuProps, } from './stories/components/Layout/Menu/DynamicMenu/DynamicMenu.svelte';
86
+ /** Layout: Grid */
87
+ export { default as Grid } from './stories/components/Layout/Grid/Grid.svelte';
88
+ export type { GridProps } from './stories/components/Layout/Grid/Grid.svelte';
89
+ export { default as Row } from './stories/components/Layout/Grid/Row/Row.svelte';
90
+ export type { GridRowProps } from './stories/components/Layout/Grid/Row/Row.svelte';
91
+ export { default as Column } from './stories/components/Layout/Grid/Column/Column.svelte';
92
+ export type { GridColumnSize, GridColumnProps, } from './stories/components/Layout/Grid/Column/Column.svelte';
86
93
  /** Info: Calendar */
87
94
  export { default as Calendar } from './stories/components/Info/Calendar/Calendar.svelte';
88
95
  export type { CalendarProps, CalendarActiveSection, } from './stories/components/Info/Calendar/Calendar.svelte';
package/dist/index.js CHANGED
@@ -52,6 +52,10 @@ export { default as Separator } from './stories/components/Layout/Separator/Sepa
52
52
  export { default as Menu } from './stories/components/Layout/Menu/Menu.svelte';
53
53
  export { default as MenuItem } from './stories/components/Layout/Menu/MenuItem/MenuItem.svelte';
54
54
  export { default as DynamicMenu } from './stories/components/Layout/Menu/DynamicMenu/DynamicMenu.svelte';
55
+ /** Layout: Grid */
56
+ export { default as Grid } from './stories/components/Layout/Grid/Grid.svelte';
57
+ export { default as Row } from './stories/components/Layout/Grid/Row/Row.svelte';
58
+ export { default as Column } from './stories/components/Layout/Grid/Column/Column.svelte';
55
59
  /** Info: Calendar */
56
60
  export { default as Calendar } from './stories/components/Info/Calendar/Calendar.svelte';
57
61
  export { default as CalendarDatesChart } from './stories/components/Info/Calendar/SubComponents/CalendarDatesChart/CalendarDatesChart.svelte';
@@ -0,0 +1,18 @@
1
+ <script module lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
2
+ import Column, { GridColumnSizeArray } from './Column.svelte';
3
+ export const storyGridColumnArgTypes = {
4
+ size: {
5
+ control: { type: 'select' },
6
+ options: GridColumnSizeArray,
7
+ },
8
+ };
9
+ // More on how to set up stories at: https://storybook.js.org/docs/writing-stories
10
+ const { Story } = defineMeta({
11
+ component: Column,
12
+ tags: ['autodocs'],
13
+ argTypes: storyGridColumnArgTypes,
14
+ });
15
+ </script>
16
+
17
+ <!-- Default Grid Column -->
18
+ <Story name="Default">Hola!</Story>
@@ -0,0 +1,21 @@
1
+ import Column from './Column.svelte';
2
+ import type { StoryBookArgTypes } from '../../../../../storybook-types.js';
3
+ export declare const storyGridColumnArgTypes: StoryBookArgTypes;
4
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
5
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
6
+ $$bindings?: Bindings;
7
+ } & Exports;
8
+ (internal: unknown, props: {
9
+ $$events?: Events;
10
+ $$slots?: Slots;
11
+ }): Exports & {
12
+ $set?: any;
13
+ $on?: any;
14
+ };
15
+ z_$$bindings?: Bindings;
16
+ }
17
+ declare const Column: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
18
+ [evt: string]: CustomEvent<any>;
19
+ }, {}, {}, string>;
20
+ type Column = InstanceType<typeof Column>;
21
+ export default Column;
@@ -0,0 +1,73 @@
1
+ <script lang="ts" module>import {} from 'svelte';
2
+ export const GridColumnSizeArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
3
+ </script>
4
+
5
+ <script lang="ts">"use strict";
6
+ let { children, class: className = '', ref = $bindable(), sm = 12, md, lg, xl, xl2, } = $props();
7
+ const breakpoints = [
8
+ { name: 'sm', value: sm },
9
+ { name: 'md', value: md },
10
+ { name: 'lg', value: lg },
11
+ { name: 'xl', value: xl },
12
+ { name: 'xl2', value: xl2 },
13
+ ];
14
+ function getBreakpointClasses() {
15
+ let classNameBreakpoints = [];
16
+ for (let index = 0; index < breakpoints.length; index++) {
17
+ const element = breakpoints[index];
18
+ if (!element.value) {
19
+ continue;
20
+ }
21
+ classNameBreakpoints.push(`breakpoint--${element.name}`);
22
+ }
23
+ return classNameBreakpoints;
24
+ }
25
+ function getBreakpointCssVariables() {
26
+ let cssVariablesBreakpoints = [];
27
+ for (let index = 0; index < breakpoints.length; index++) {
28
+ const element = breakpoints[index];
29
+ if (!element.value) {
30
+ continue;
31
+ }
32
+ cssVariablesBreakpoints.push(`--GridColumnBreakpoint-${element.name}: ${element.value}`);
33
+ }
34
+ return cssVariablesBreakpoints.join(';');
35
+ }
36
+ </script>
37
+
38
+ <div
39
+ class={['dodo-ui-GridColumn', ...getBreakpointClasses(), className].join(' ')}
40
+ style={getBreakpointCssVariables()}
41
+ bind:this={ref}
42
+ >
43
+ {#if children}
44
+ {@render children()}
45
+ {/if}
46
+ </div>
47
+
48
+ <style>.dodo-ui-GridColumn {
49
+ min-width: 0;
50
+ }
51
+ .dodo-ui-GridColumn.breakpoint--sm {
52
+ grid-column: span var(--GridColumnBreakpoint-sm);
53
+ }
54
+ @media (min-width: 48rem) {
55
+ .dodo-ui-GridColumn.breakpoint--md {
56
+ grid-column: span var(--GridColumnBreakpoint-md);
57
+ }
58
+ }
59
+ @media (min-width: 64rem) {
60
+ .dodo-ui-GridColumn.breakpoint--lg {
61
+ grid-column: span var(--GridColumnBreakpoint-lg);
62
+ }
63
+ }
64
+ @media (min-width: 80rem) {
65
+ .dodo-ui-GridColumn.breakpoint--xl {
66
+ grid-column: span var(--GridColumnBreakpoint-xl);
67
+ }
68
+ }
69
+ @media (min-width: 96rem) {
70
+ .dodo-ui-GridColumn.breakpoint--xl2 {
71
+ grid-column: span var(--GridColumnBreakpoint-xl2);
72
+ }
73
+ }</style>
@@ -0,0 +1,24 @@
1
+ import { type Snippet } from 'svelte';
2
+ export type GridColumnSize = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
3
+ export declare const GridColumnSizeArray: GridColumnSize[];
4
+ export interface GridColumnProps {
5
+ /** GridColumn contents goes here */
6
+ children?: Snippet;
7
+ /** GridColumn ref */
8
+ ref?: HTMLDivElement;
9
+ /** Custom css class */
10
+ class?: string;
11
+ /** Breakpoint: sm */
12
+ sm?: GridColumnSize;
13
+ /** Breakpoint: md */
14
+ md?: GridColumnSize;
15
+ /** Breakpoint: lg */
16
+ lg?: GridColumnSize;
17
+ /** Breakpoint: xl */
18
+ xl?: GridColumnSize;
19
+ /** Breakpoint: 2 xl */
20
+ xl2?: GridColumnSize;
21
+ }
22
+ declare const Column: import("svelte").Component<GridColumnProps, {}, "ref">;
23
+ type Column = ReturnType<typeof Column>;
24
+ export default Column;
@@ -0,0 +1,179 @@
1
+ <script module lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
2
+ import Grid from './Grid.svelte';
3
+ import Row from './Row/Row.svelte';
4
+ import Column from './Column/Column.svelte';
5
+ import Paper from '../Paper/Paper.svelte';
6
+ export const storyGridArgTypes = {};
7
+ // More on how to set up stories at: https://storybook.js.org/docs/writing-stories
8
+ const { Story } = defineMeta({
9
+ component: Grid,
10
+ tags: ['autodocs'],
11
+ argTypes: storyGridArgTypes,
12
+ });
13
+ </script>
14
+
15
+ <!-- Default Grid -->
16
+ <Story name="Default" asChild>
17
+ <Grid>
18
+ <Column>Hola!</Column>
19
+ <Column>Hola!</Column>
20
+ <Column>Hola!</Column>
21
+ </Grid>
22
+ </Story>
23
+
24
+ <Story name="Example Column" asChild>
25
+ <Grid>
26
+ <Column sm={10}>
27
+ <Paper color="primary"><p>10</p></Paper>
28
+ </Column>
29
+ <Column sm={2}><Paper color="primary"><p>2</p></Paper></Column>
30
+ <Column sm={4}><Paper color="primary"><p>4</p></Paper></Column>
31
+ </Grid>
32
+ </Story>
33
+
34
+ <!-- the Row helps to furher separate Columns -->
35
+ <Story name="Example Row" asChild>
36
+ <Grid>
37
+ <Row>
38
+ <Column sm={10}>
39
+ <Paper color="primary"><p>10</p></Paper>
40
+ </Column>
41
+ <Column sm={2}><Paper color="primary"><p>2</p></Paper></Column>
42
+ <Column sm={4}><Paper color="primary"><p>4</p></Paper></Column>
43
+ </Row>
44
+ <Row>
45
+ <Column sm={10}>
46
+ <Paper color="primary"><p>10</p></Paper>
47
+ </Column>
48
+ <Column sm={2}><Paper color="primary"><p>2</p></Paper></Column>
49
+ <Column sm={4}><Paper color="primary"><p>4</p></Paper></Column>
50
+ </Row>
51
+ </Grid>
52
+ </Story>
53
+
54
+ <Story name="Nested" asChild>
55
+ <Grid>
56
+ <Column sm={6}>
57
+ <Paper color="primary"><p>6</p></Paper>
58
+ </Column>
59
+ <Column sm={6}>
60
+ <Grid>
61
+ <Column sm={8}>
62
+ <Paper color="safe"><p>8</p></Paper>
63
+ </Column>
64
+ <Column sm={4}>
65
+ <Paper color="safe"><p>4</p></Paper>
66
+ </Column>
67
+ <Column sm={12}>
68
+ <Paper color="safe"><p>12</p></Paper>
69
+ </Column>
70
+ </Grid>
71
+ </Column>
72
+ </Grid>
73
+ </Story>
74
+
75
+ <!-- Resize the screen to see the effect -->
76
+ <Story name="Responsive" asChild>
77
+ <Grid spacing={2}>
78
+ <Row>
79
+ <Column md={8}>
80
+ <Paper color="primary"><p>md:8</p></Paper>
81
+ </Column>
82
+ <Column md={4}><Paper color="primary"><p>md:4</p></Paper></Column>
83
+ </Row>
84
+ <Row>
85
+ <Column sm={4}>
86
+ <Paper color="primary"><p>sm:4</p></Paper>
87
+ </Column>
88
+ <Column><Paper color="primary"><p>sm:12</p></Paper></Column>
89
+ </Row>
90
+ <Row>
91
+ <Column lg={2}>
92
+ <Paper color="primary"><p>lg:2</p></Paper>
93
+ </Column>
94
+ <Column lg={10}>
95
+ <Paper color="primary"><p>lg:10</p></Paper>
96
+ </Column>
97
+ </Row>
98
+ <Row>
99
+ <Column xl={2}>
100
+ <Paper color="primary"><p>xl:2</p></Paper>
101
+ </Column>
102
+ <Column xl={10}>
103
+ <Paper color="primary"><p>xl:10</p></Paper>
104
+ </Column>
105
+ </Row>
106
+ <Row>
107
+ <Column xl2={2}>
108
+ <Paper color="primary"><p>xl2:2</p></Paper>
109
+ </Column>
110
+ <Column xl2={10}>
111
+ <Paper color="primary"><p>xl2:10</p></Paper>
112
+ </Column>
113
+ </Row>
114
+ </Grid>
115
+ </Story>
116
+
117
+ <Story name="Spacing" asChild>
118
+ <Grid spacing={2}>
119
+ <Row>
120
+ <Column sm={4}>
121
+ <Paper color="primary"><p>4</p></Paper>
122
+ </Column>
123
+ <Column sm={4}><Paper color="primary"><p>4</p></Paper></Column>
124
+ <Column sm={4}><Paper color="primary"><p>4</p></Paper></Column>
125
+ </Row>
126
+ <Row>
127
+ <Column sm={4}>
128
+ <Paper color="primary"><p>4</p></Paper>
129
+ </Column>
130
+ <Column><Paper color="primary"><p>12</p></Paper></Column>
131
+ </Row>
132
+ <Row>
133
+ <Column sm={2}>
134
+ <Paper color="primary"><p>2</p></Paper>
135
+ </Column>
136
+ <Column sm={3}>
137
+ <Paper color="primary"><p>3</p></Paper>
138
+ </Column>
139
+ <Column sm={4}>
140
+ <Paper color="primary"><p>4</p></Paper>
141
+ </Column>
142
+ <Column>
143
+ <Paper color="primary"><p>12</p></Paper>
144
+ </Column>
145
+ </Row>
146
+ </Grid>
147
+ </Story>
148
+
149
+ <Story name="RowSpacing" asChild>
150
+ <Grid rowSpacing={4}>
151
+ <Row>
152
+ <Column sm={4}>
153
+ <Paper color="primary"><p>4</p></Paper>
154
+ </Column>
155
+ <Column sm={4}><Paper color="primary"><p>4</p></Paper></Column>
156
+ <Column sm={4}><Paper color="primary"><p>4</p></Paper></Column>
157
+ </Row>
158
+ <Row>
159
+ <Column sm={4}>
160
+ <Paper color="primary"><p>4</p></Paper>
161
+ </Column>
162
+ <Column><Paper color="primary"><p>12</p></Paper></Column>
163
+ </Row>
164
+ <Row>
165
+ <Column sm={2}>
166
+ <Paper color="primary"><p>2</p></Paper>
167
+ </Column>
168
+ <Column sm={3}>
169
+ <Paper color="primary"><p>3</p></Paper>
170
+ </Column>
171
+ <Column sm={4}>
172
+ <Paper color="primary"><p>4</p></Paper>
173
+ </Column>
174
+ <Column>
175
+ <Paper color="primary"><p>12</p></Paper>
176
+ </Column>
177
+ </Row>
178
+ </Grid>
179
+ </Story>
@@ -0,0 +1,21 @@
1
+ import Grid from './Grid.svelte';
2
+ import type { StoryBookArgTypes } from '../../../../storybook-types.js';
3
+ export declare const storyGridArgTypes: StoryBookArgTypes;
4
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
5
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
6
+ $$bindings?: Bindings;
7
+ } & Exports;
8
+ (internal: unknown, props: {
9
+ $$events?: Events;
10
+ $$slots?: Slots;
11
+ }): Exports & {
12
+ $set?: any;
13
+ $on?: any;
14
+ };
15
+ z_$$bindings?: Bindings;
16
+ }
17
+ declare const Grid: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
18
+ [evt: string]: CustomEvent<any>;
19
+ }, {}, {}, string>;
20
+ type Grid = InstanceType<typeof Grid>;
21
+ export default Grid;
@@ -0,0 +1,24 @@
1
+ <script lang="ts" module>import {} from 'svelte';
2
+ </script>
3
+
4
+ <script lang="ts">"use strict";
5
+ let { children, class: className = '', ref = $bindable(), spacing = 1, rowSpacing, } = $props();
6
+ const rowSpacingModified = rowSpacing || rowSpacing === 0 ? rowSpacing : spacing;
7
+ </script>
8
+
9
+ <div
10
+ class={['dodo-ui-Grid', className].join(' ')}
11
+ bind:this={ref}
12
+ style={`--GridSpacing: ${spacing}; --GridRowSpacing: ${rowSpacingModified};`}
13
+ >
14
+ {#if children}
15
+ {@render children()}
16
+ {/if}
17
+ </div>
18
+
19
+ <style>.dodo-ui-Grid {
20
+ display: grid;
21
+ grid-template-columns: repeat(12, 1fr);
22
+ gap: calc(var(--GridRowSpacing) * var(--dodo-ui-space));
23
+ grid-auto-flow: row;
24
+ }</style>
@@ -0,0 +1,16 @@
1
+ import { type Snippet } from 'svelte';
2
+ export interface GridProps {
3
+ /** Grid contents goes here */
4
+ children?: Snippet;
5
+ /** Grid ref */
6
+ ref?: HTMLDivElement;
7
+ /** Custom css class */
8
+ class?: string;
9
+ /** Grid spacing, affects Coulumns */
10
+ spacing?: number;
11
+ /** Optional Row spacing, default is 0 */
12
+ rowSpacing?: number;
13
+ }
14
+ declare const Grid: import("svelte").Component<GridProps, {}, "ref">;
15
+ type Grid = ReturnType<typeof Grid>;
16
+ export default Grid;
@@ -0,0 +1,19 @@
1
+ <script module lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
2
+ import Row from './Row.svelte';
3
+ import Column from '../Column/Column.svelte';
4
+ export const storyGridRowArgTypes = {};
5
+ // More on how to set up stories at: https://storybook.js.org/docs/writing-stories
6
+ const { Story } = defineMeta({
7
+ component: Row,
8
+ tags: ['autodocs'],
9
+ argTypes: storyGridRowArgTypes,
10
+ });
11
+ </script>
12
+
13
+ <!-- Default Grid Row -->
14
+ <Story name="Default" asChild>
15
+ <Row>
16
+ <Column>Hola!</Column>
17
+ <Column>Hola!</Column>
18
+ </Row>
19
+ </Story>
@@ -0,0 +1,21 @@
1
+ import Row from './Row.svelte';
2
+ import type { StoryBookArgTypes } from '../../../../../storybook-types.js';
3
+ export declare const storyGridRowArgTypes: StoryBookArgTypes;
4
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
5
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
6
+ $$bindings?: Bindings;
7
+ } & Exports;
8
+ (internal: unknown, props: {
9
+ $$events?: Events;
10
+ $$slots?: Slots;
11
+ }): Exports & {
12
+ $set?: any;
13
+ $on?: any;
14
+ };
15
+ z_$$bindings?: Bindings;
16
+ }
17
+ declare const Row: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
18
+ [evt: string]: CustomEvent<any>;
19
+ }, {}, {}, string>;
20
+ type Row = InstanceType<typeof Row>;
21
+ export default Row;
@@ -0,0 +1,20 @@
1
+ <script lang="ts" module>import {} from 'svelte';
2
+ </script>
3
+
4
+ <script lang="ts">"use strict";
5
+ let { children, class: className = '', ref = $bindable(), } = $props();
6
+ </script>
7
+
8
+ <div class={['dodo-ui-GridRow', className].join(' ')} bind:this={ref}>
9
+ {#if children}
10
+ {@render children()}
11
+ {/if}
12
+ </div>
13
+
14
+ <style>.dodo-ui-GridRow {
15
+ grid-column: span 12;
16
+ display: grid;
17
+ grid-template-columns: repeat(12, 1fr);
18
+ gap: calc(var(--GridSpacing) * var(--dodo-ui-space));
19
+ grid-auto-flow: row;
20
+ }</style>
@@ -0,0 +1,12 @@
1
+ import { type Snippet } from 'svelte';
2
+ export interface GridRowProps {
3
+ /** GridRow contents goes here */
4
+ children?: Snippet;
5
+ /** GridRow ref */
6
+ ref?: HTMLDivElement;
7
+ /** Custom css class */
8
+ class?: string;
9
+ }
10
+ declare const Row: import("svelte").Component<GridRowProps, {}, "ref">;
11
+ type Row = ReturnType<typeof Row>;
12
+ export default Row;
@@ -3,6 +3,5 @@
3
3
  @import '_colors.css';
4
4
  @import '_space.css';
5
5
  @import '_z-index.css';
6
- @import '_breakpoint.css';
7
6
  @import '_shadow.css';
8
7
  @import '_components.css';
@@ -0,0 +1,5 @@
1
+ $breakpoints-sm: 40rem;
2
+ $breakpoints-md: 48rem;
3
+ $breakpoints-lg: 64rem;
4
+ $breakpoints-xl: 80rem;
5
+ $breakpoints-xl2: 96rem;
@@ -0,0 +1 @@
1
+ @forward 'breakpoints';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flightlesslabs/dodo-ui",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "scripts": {
5
5
  "build": "vite build && pnpm run prepack",
6
6
  "preview": "vite preview",
@@ -42,7 +42,8 @@
42
42
  "exports": {
43
43
  ".": {
44
44
  "types": "./dist/index.d.ts",
45
- "svelte": "./dist/index.js"
45
+ "svelte": "./dist/index.js",
46
+ "scss": "./dist/styles/scss/index.scss"
46
47
  }
47
48
  },
48
49
  "peerDependencies": {
package/src/lib/index.ts CHANGED
@@ -163,6 +163,17 @@ export type {
163
163
  DynamicMenuProps,
164
164
  } from '$lib/stories/components/Layout/Menu/DynamicMenu/DynamicMenu.svelte';
165
165
 
166
+ /** Layout: Grid */
167
+ export { default as Grid } from '$lib/stories/components/Layout/Grid/Grid.svelte';
168
+ export type { GridProps } from '$lib/stories/components/Layout/Grid/Grid.svelte';
169
+ export { default as Row } from '$lib/stories/components/Layout/Grid/Row/Row.svelte';
170
+ export type { GridRowProps } from '$lib/stories/components/Layout/Grid/Row/Row.svelte';
171
+ export { default as Column } from '$lib/stories/components/Layout/Grid/Column/Column.svelte';
172
+ export type {
173
+ GridColumnSize,
174
+ GridColumnProps,
175
+ } from '$lib/stories/components/Layout/Grid/Column/Column.svelte';
176
+
166
177
  /** Info: Calendar */
167
178
  export { default as Calendar } from '$lib/stories/components/Info/Calendar/Calendar.svelte';
168
179
  export type {
@@ -0,0 +1,127 @@
1
+ <script lang="ts" module>
2
+ import { type Snippet } from 'svelte';
3
+
4
+ export type GridColumnSize = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
5
+
6
+ export const GridColumnSizeArray: GridColumnSize[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
7
+
8
+ export interface GridColumnProps {
9
+ /** GridColumn contents goes here */
10
+ children?: Snippet;
11
+ /** GridColumn ref */
12
+ ref?: HTMLDivElement;
13
+ /** Custom css class */
14
+ class?: string;
15
+ /** Breakpoint: sm */
16
+ sm?: GridColumnSize;
17
+ /** Breakpoint: md */
18
+ md?: GridColumnSize;
19
+ /** Breakpoint: lg */
20
+ lg?: GridColumnSize;
21
+ /** Breakpoint: xl */
22
+ xl?: GridColumnSize;
23
+ /** Breakpoint: 2 xl */
24
+ xl2?: GridColumnSize;
25
+ }
26
+ </script>
27
+
28
+ <script lang="ts">
29
+ let {
30
+ children,
31
+ class: className = '',
32
+ ref = $bindable<HTMLDivElement>(),
33
+ sm = 12,
34
+ md,
35
+ lg,
36
+ xl,
37
+ xl2,
38
+ }: GridColumnProps = $props();
39
+
40
+ const breakpoints = [
41
+ { name: 'sm', value: sm },
42
+ { name: 'md', value: md },
43
+ { name: 'lg', value: lg },
44
+ { name: 'xl', value: xl },
45
+ { name: 'xl2', value: xl2 },
46
+ ];
47
+
48
+ function getBreakpointClasses() {
49
+ let classNameBreakpoints = [];
50
+
51
+ for (let index = 0; index < breakpoints.length; index++) {
52
+ const element = breakpoints[index];
53
+
54
+ if (!element.value) {
55
+ continue;
56
+ }
57
+
58
+ classNameBreakpoints.push(`breakpoint--${element.name}`);
59
+ }
60
+
61
+ return classNameBreakpoints;
62
+ }
63
+
64
+ function getBreakpointCssVariables() {
65
+ let cssVariablesBreakpoints = [];
66
+
67
+ for (let index = 0; index < breakpoints.length; index++) {
68
+ const element = breakpoints[index];
69
+
70
+ if (!element.value) {
71
+ continue;
72
+ }
73
+
74
+ cssVariablesBreakpoints.push(`--GridColumnBreakpoint-${element.name}: ${element.value}`);
75
+ }
76
+
77
+ return cssVariablesBreakpoints.join(';');
78
+ }
79
+ </script>
80
+
81
+ <div
82
+ class={['dodo-ui-GridColumn', ...getBreakpointClasses(), className].join(' ')}
83
+ style={getBreakpointCssVariables()}
84
+ bind:this={ref}
85
+ >
86
+ {#if children}
87
+ {@render children()}
88
+ {/if}
89
+ </div>
90
+
91
+ <style lang="scss">
92
+ @use '../../../../../styles/scss' as *;
93
+
94
+ .dodo-ui-GridColumn {
95
+ min-width: 0;
96
+
97
+ &.breakpoint {
98
+ &--sm {
99
+ grid-column: span var(--GridColumnBreakpoint-sm);
100
+ }
101
+
102
+ &--md {
103
+ @media (min-width: $breakpoints-md) {
104
+ grid-column: span var(--GridColumnBreakpoint-md);
105
+ }
106
+ }
107
+
108
+ &--lg {
109
+ @media (min-width: $breakpoints-lg) {
110
+ grid-column: span var(--GridColumnBreakpoint-lg);
111
+ }
112
+ }
113
+
114
+ &--xl {
115
+ @media (min-width: $breakpoints-xl) {
116
+ grid-column: span var(--GridColumnBreakpoint-xl);
117
+ }
118
+ }
119
+
120
+ &--xl2 {
121
+ @media (min-width: $breakpoints-xl2) {
122
+ grid-column: span var(--GridColumnBreakpoint-xl2);
123
+ }
124
+ }
125
+ }
126
+ }
127
+ </style>
@@ -0,0 +1,47 @@
1
+ <script lang="ts" module>
2
+ import { type Snippet } from 'svelte';
3
+
4
+ export interface GridProps {
5
+ /** Grid contents goes here */
6
+ children?: Snippet;
7
+ /** Grid ref */
8
+ ref?: HTMLDivElement;
9
+ /** Custom css class */
10
+ class?: string;
11
+ /** Grid spacing, affects Coulumns */
12
+ spacing?: number;
13
+ /** Optional Row spacing, default is 0 */
14
+ rowSpacing?: number;
15
+ }
16
+ </script>
17
+
18
+ <script lang="ts">
19
+ let {
20
+ children,
21
+ class: className = '',
22
+ ref = $bindable<HTMLDivElement>(),
23
+ spacing = 1,
24
+ rowSpacing,
25
+ }: GridProps = $props();
26
+
27
+ const rowSpacingModified = rowSpacing || rowSpacing === 0 ? rowSpacing : spacing;
28
+ </script>
29
+
30
+ <div
31
+ class={['dodo-ui-Grid', className].join(' ')}
32
+ bind:this={ref}
33
+ style={`--GridSpacing: ${spacing}; --GridRowSpacing: ${rowSpacingModified};`}
34
+ >
35
+ {#if children}
36
+ {@render children()}
37
+ {/if}
38
+ </div>
39
+
40
+ <style lang="scss">
41
+ .dodo-ui-Grid {
42
+ display: grid;
43
+ grid-template-columns: repeat(12, 1fr);
44
+ gap: calc(var(--GridRowSpacing) * var(--dodo-ui-space));
45
+ grid-auto-flow: row;
46
+ }
47
+ </style>
@@ -0,0 +1,36 @@
1
+ <script lang="ts" module>
2
+ import { type Snippet } from 'svelte';
3
+
4
+ export interface GridRowProps {
5
+ /** GridRow contents goes here */
6
+ children?: Snippet;
7
+ /** GridRow ref */
8
+ ref?: HTMLDivElement;
9
+ /** Custom css class */
10
+ class?: string;
11
+ }
12
+ </script>
13
+
14
+ <script lang="ts">
15
+ let {
16
+ children,
17
+ class: className = '',
18
+ ref = $bindable<HTMLDivElement>(),
19
+ }: GridRowProps = $props();
20
+ </script>
21
+
22
+ <div class={['dodo-ui-GridRow', className].join(' ')} bind:this={ref}>
23
+ {#if children}
24
+ {@render children()}
25
+ {/if}
26
+ </div>
27
+
28
+ <style lang="scss">
29
+ .dodo-ui-GridRow {
30
+ grid-column: span 12;
31
+ display: grid;
32
+ grid-template-columns: repeat(12, 1fr);
33
+ gap: calc(var(--GridSpacing) * var(--dodo-ui-space));
34
+ grid-auto-flow: row;
35
+ }
36
+ </style>
@@ -3,6 +3,5 @@
3
3
  @import '_colors.css';
4
4
  @import '_space.css';
5
5
  @import '_z-index.css';
6
- @import '_breakpoint.css';
7
6
  @import '_shadow.css';
8
7
  @import '_components.css';
@@ -0,0 +1,5 @@
1
+ $breakpoints-sm: 40rem;
2
+ $breakpoints-md: 48rem;
3
+ $breakpoints-lg: 64rem;
4
+ $breakpoints-xl: 80rem;
5
+ $breakpoints-xl2: 96rem;
@@ -0,0 +1 @@
1
+ @forward 'breakpoints';
@@ -1,10 +0,0 @@
1
- :root {
2
- /* Tailwind CSS */
3
- /* https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/theme.css */
4
-
5
- --dodo-breakpoint-sm: 40rem;
6
- --dodo-breakpoint-md: 48rem;
7
- --dodo-breakpoint-lg: 64rem;
8
- --dodo-breakpoint-xl: 80rem;
9
- --dodo-breakpoint-2xl: 96rem;
10
- }
@@ -1,10 +0,0 @@
1
- :root {
2
- /* Tailwind CSS */
3
- /* https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/theme.css */
4
-
5
- --dodo-breakpoint-sm: 40rem;
6
- --dodo-breakpoint-md: 48rem;
7
- --dodo-breakpoint-lg: 64rem;
8
- --dodo-breakpoint-xl: 80rem;
9
- --dodo-breakpoint-2xl: 96rem;
10
- }