@flightlesslabs/dodo-ui 0.22.2 → 0.24.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 (118) hide show
  1. package/README.md +1 -9
  2. package/dist/index.d.ts +4 -10
  3. package/dist/index.js +5 -10
  4. package/dist/styles/components.css +0 -154
  5. package/dist/styles/components.css.map +1 -1
  6. package/dist/styles/components.scss +0 -2
  7. package/package.json +27 -41
  8. package/src/lib/index.ts +6 -19
  9. package/src/lib/styles/components.scss +0 -2
  10. package/src/lib/utils/time/date-creator/createDate/createDate.test.ts +109 -0
  11. package/src/lib/utils/time/date-creator/createDateFactory/createDateFactory.test.ts +146 -0
  12. package/dist/Home.mdx +0 -69
  13. package/dist/components/Form/Button/Button.stories.svelte +0 -178
  14. package/dist/components/Form/Button/Button.stories.svelte.d.ts +0 -22
  15. package/dist/components/Form/Checkbox/Checkbox.stories.svelte +0 -132
  16. package/dist/components/Form/Checkbox/Checkbox.stories.svelte.d.ts +0 -25
  17. package/dist/components/Form/DatePicker/DatePicker.scss +0 -55
  18. package/dist/components/Form/DatePicker/DatePicker.stories.svelte +0 -139
  19. package/dist/components/Form/DatePicker/DatePicker.stories.svelte.d.ts +0 -22
  20. package/dist/components/Form/DatePicker/DatePicker.svelte +0 -136
  21. package/dist/components/Form/DatePicker/DatePicker.svelte.d.ts +0 -64
  22. package/dist/components/Form/DatePicker/DatePickerInput/DatePickerInput.svelte +0 -96
  23. package/dist/components/Form/DatePicker/DatePickerInput/DatePickerInput.svelte.d.ts +0 -23
  24. package/dist/components/Form/DatePicker/DatePickerInput/Segments.svelte +0 -17
  25. package/dist/components/Form/DatePicker/DatePickerInput/Segments.svelte.d.ts +0 -8
  26. package/dist/components/Form/DatePicker/DatePickerInput/utils.d.ts +0 -10
  27. package/dist/components/Form/DatePicker/DatePickerInput/utils.js +0 -26
  28. package/dist/components/Form/DatePicker/DatePickerPopup/CalendarGrid.svelte +0 -35
  29. package/dist/components/Form/DatePicker/DatePickerPopup/CalendarGrid.svelte.d.ts +0 -4
  30. package/dist/components/Form/DatePicker/DatePickerPopup/DatePickerPopup.svelte +0 -52
  31. package/dist/components/Form/DatePicker/DatePickerPopup/DatePickerPopup.svelte.d.ts +0 -6
  32. package/dist/components/Form/DatePicker/DatePickerPopup/Header.svelte +0 -25
  33. package/dist/components/Form/DatePicker/DatePickerPopup/Header.svelte.d.ts +0 -3
  34. package/dist/components/Form/FormField/FormField.stories.svelte +0 -48
  35. package/dist/components/Form/FormField/FormField.stories.svelte.d.ts +0 -25
  36. package/dist/components/Form/InputEnclosure/InputEnclosure.stories.svelte +0 -166
  37. package/dist/components/Form/InputEnclosure/InputEnclosure.stories.svelte.d.ts +0 -22
  38. package/dist/components/Form/Label/Label.stories.svelte +0 -31
  39. package/dist/components/Form/Label/Label.stories.svelte.d.ts +0 -25
  40. package/dist/components/Form/RadioGroup/Radio/Radio.stories.svelte +0 -78
  41. package/dist/components/Form/RadioGroup/Radio/Radio.stories.svelte.d.ts +0 -25
  42. package/dist/components/Form/RadioGroup/RadioGroup.stories.svelte +0 -172
  43. package/dist/components/Form/RadioGroup/RadioGroup.stories.svelte.d.ts +0 -25
  44. package/dist/components/Form/Select/Select.stories.svelte +0 -175
  45. package/dist/components/Form/Select/Select.stories.svelte.d.ts +0 -22
  46. package/dist/components/Form/Switch/Switch.stories.svelte +0 -128
  47. package/dist/components/Form/Switch/Switch.stories.svelte.d.ts +0 -25
  48. package/dist/components/Form/TextInput/TextInput.stories.svelte +0 -162
  49. package/dist/components/Form/TextInput/TextInput.stories.svelte.d.ts +0 -22
  50. package/dist/components/Form/UtilityButton/UtilityButton.stories.svelte +0 -163
  51. package/dist/components/Form/UtilityButton/UtilityButton.stories.svelte.d.ts +0 -22
  52. package/dist/components/Info/Calendar/Calendar.scss +0 -147
  53. package/dist/components/Info/Calendar/Calendar.stories.svelte +0 -134
  54. package/dist/components/Info/Calendar/Calendar.stories.svelte.d.ts +0 -22
  55. package/dist/components/Info/Calendar/Calendar.svelte +0 -61
  56. package/dist/components/Info/Calendar/Calendar.svelte.d.ts +0 -6
  57. package/dist/components/Info/Calendar/CalendarGrid/CalendarGrid.svelte +0 -16
  58. package/dist/components/Info/Calendar/CalendarGrid/CalendarGrid.svelte.d.ts +0 -4
  59. package/dist/components/Info/Calendar/CalendarGrid/TableBody.svelte +0 -25
  60. package/dist/components/Info/Calendar/CalendarGrid/TableBody.svelte.d.ts +0 -8
  61. package/dist/components/Info/Calendar/CalendarGrid/TableHead.svelte +0 -19
  62. package/dist/components/Info/Calendar/CalendarGrid/TableHead.svelte.d.ts +0 -6
  63. package/dist/components/Info/Calendar/Header.svelte +0 -25
  64. package/dist/components/Info/Calendar/Header.svelte.d.ts +0 -3
  65. package/dist/components/Layout/Card/Card.stories.svelte +0 -113
  66. package/dist/components/Layout/Card/Card.stories.svelte.d.ts +0 -22
  67. package/dist/components/Layout/Grid/Column/Column.stories.svelte +0 -66
  68. package/dist/components/Layout/Grid/Column/Column.stories.svelte.d.ts +0 -22
  69. package/dist/components/Layout/Grid/Grid.stories.svelte +0 -192
  70. package/dist/components/Layout/Grid/Grid.stories.svelte.d.ts +0 -22
  71. package/dist/components/Layout/Grid/Row/Row.stories.svelte +0 -39
  72. package/dist/components/Layout/Grid/Row/Row.stories.svelte.d.ts +0 -22
  73. package/dist/components/Layout/Theme/Theme.stories.svelte +0 -54
  74. package/dist/components/Layout/Theme/Theme.stories.svelte.d.ts +0 -25
  75. package/dist/components/Layout/Theme/ThemeSystem/index.mdx +0 -35
  76. package/dist/storybook-types.d.ts +0 -129
  77. package/dist/storybook-types.js +0 -1
  78. package/dist/utils/time/date-creator/createDate/createDate.mdx +0 -98
  79. package/dist/utils/time/date-creator/createDateFactory/createDateFactory.mdx +0 -104
  80. package/dist/utils/time/timeout/timeout.mdx +0 -114
  81. package/src/lib/Home.mdx +0 -69
  82. package/src/lib/components/Form/Button/Button.stories.svelte +0 -178
  83. package/src/lib/components/Form/Checkbox/Checkbox.stories.svelte +0 -132
  84. package/src/lib/components/Form/DatePicker/DatePicker.scss +0 -55
  85. package/src/lib/components/Form/DatePicker/DatePicker.stories.svelte +0 -139
  86. package/src/lib/components/Form/DatePicker/DatePicker.svelte +0 -136
  87. package/src/lib/components/Form/DatePicker/DatePickerInput/DatePickerInput.svelte +0 -96
  88. package/src/lib/components/Form/DatePicker/DatePickerInput/Segments.svelte +0 -17
  89. package/src/lib/components/Form/DatePicker/DatePickerInput/utils.ts +0 -55
  90. package/src/lib/components/Form/DatePicker/DatePickerPopup/CalendarGrid.svelte +0 -35
  91. package/src/lib/components/Form/DatePicker/DatePickerPopup/DatePickerPopup.svelte +0 -52
  92. package/src/lib/components/Form/DatePicker/DatePickerPopup/Header.svelte +0 -25
  93. package/src/lib/components/Form/FormField/FormField.stories.svelte +0 -48
  94. package/src/lib/components/Form/InputEnclosure/InputEnclosure.stories.svelte +0 -166
  95. package/src/lib/components/Form/Label/Label.stories.svelte +0 -31
  96. package/src/lib/components/Form/RadioGroup/Radio/Radio.stories.svelte +0 -78
  97. package/src/lib/components/Form/RadioGroup/RadioGroup.stories.svelte +0 -172
  98. package/src/lib/components/Form/Select/Select.stories.svelte +0 -175
  99. package/src/lib/components/Form/Switch/Switch.stories.svelte +0 -128
  100. package/src/lib/components/Form/TextInput/TextInput.stories.svelte +0 -162
  101. package/src/lib/components/Form/UtilityButton/UtilityButton.stories.svelte +0 -163
  102. package/src/lib/components/Info/Calendar/Calendar.scss +0 -147
  103. package/src/lib/components/Info/Calendar/Calendar.stories.svelte +0 -134
  104. package/src/lib/components/Info/Calendar/Calendar.svelte +0 -61
  105. package/src/lib/components/Info/Calendar/CalendarGrid/CalendarGrid.svelte +0 -16
  106. package/src/lib/components/Info/Calendar/CalendarGrid/TableBody.svelte +0 -25
  107. package/src/lib/components/Info/Calendar/CalendarGrid/TableHead.svelte +0 -19
  108. package/src/lib/components/Info/Calendar/Header.svelte +0 -25
  109. package/src/lib/components/Layout/Card/Card.stories.svelte +0 -113
  110. package/src/lib/components/Layout/Grid/Column/Column.stories.svelte +0 -66
  111. package/src/lib/components/Layout/Grid/Grid.stories.svelte +0 -192
  112. package/src/lib/components/Layout/Grid/Row/Row.stories.svelte +0 -39
  113. package/src/lib/components/Layout/Theme/Theme.stories.svelte +0 -54
  114. package/src/lib/components/Layout/Theme/ThemeSystem/index.mdx +0 -35
  115. package/src/lib/storybook-types.ts +0 -182
  116. package/src/lib/utils/time/date-creator/createDate/createDate.mdx +0 -98
  117. package/src/lib/utils/time/date-creator/createDateFactory/createDateFactory.mdx +0 -104
  118. package/src/lib/utils/time/timeout/timeout.mdx +0 -114
@@ -1,163 +0,0 @@
1
- <script module lang="ts">
2
- import { defineMeta } from '@storybook/addon-svelte-csf';
3
- import UtilityButton from './UtilityButton.svelte';
4
- import type { UtilityButtonProps } from './UtilityButton.svelte';
5
- import type { ArgTypes } from 'storybook/internal/csf';
6
- import { componentColorOptions } from '../../../attributes/color.js';
7
- import { componentSizeOptions } from '../../../attributes/size.js';
8
- import { componentRoundnessOptions } from '../../../attributes/roundness.js';
9
- import Theme from '../../Layout/Theme/Theme.svelte';
10
-
11
- const description = `
12
- A flexible small sized button component based on bits-ui [button](https://bits-ui.com/docs/components/button).
13
-
14
- \`\`\`ts
15
- import { UtilityButton } from '@flightlesslabs/dodo-ui';
16
- \`\`\`
17
- `;
18
-
19
- // ------------------------------
20
- // Storybook ArgTypes
21
- // ------------------------------
22
- export const storyUtilityButtonArgTypes: Partial<ArgTypes<UtilityButtonProps>> = {
23
- // ------------------------------
24
- // Core
25
- // ------------------------------
26
- children: { table: { category: 'API', subcategory: 'Base' } },
27
- href: {
28
- control: { type: 'text' },
29
- description: 'Render as Anchor when provided',
30
- table: { category: 'API', subcategory: 'Base' },
31
- },
32
- disabled: {
33
- control: { type: 'boolean' },
34
- description: 'Disable interactions',
35
- table: { category: 'API', subcategory: 'Base' },
36
- },
37
- class: { table: { category: 'API', subcategory: 'Base' } },
38
- type: { table: { category: 'API', subcategory: 'Base' } },
39
-
40
- // ------------------------------
41
- // Appearance
42
- // ------------------------------
43
- color: {
44
- control: { type: 'select' },
45
- options: componentColorOptions,
46
- description: 'Color theme token',
47
- table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: 'primary' } },
48
- },
49
- size: {
50
- control: { type: 'select' },
51
- options: componentSizeOptions,
52
- description: 'Visual size token',
53
- table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: 'normal' } },
54
- },
55
- roundness: {
56
- control: { type: 'select' },
57
- options: componentRoundnessOptions,
58
- description: 'Border radius token',
59
- table: { category: 'API', subcategory: 'Appearance' },
60
- },
61
- compact: {
62
- control: { type: 'boolean' },
63
- description: 'Compact spacing (icon buttons)',
64
- table: { category: 'API', subcategory: 'Appearance' },
65
- },
66
- outline: {
67
- control: { type: 'boolean' },
68
- description: 'Render outlined style',
69
- table: { category: 'API', subcategory: 'Appearance' },
70
- },
71
-
72
- // ------------------------------
73
- // Accessibility
74
- // ------------------------------
75
- 'aria-label': {
76
- control: { type: 'text' },
77
- description: 'Accessible label (required for icon-only buttons)',
78
- table: { category: 'API', subcategory: 'Accessibility' },
79
- },
80
-
81
- // ------------------------------
82
- // Events (Svelte-style)
83
- // ------------------------------
84
- onclick: { table: { category: 'API', subcategory: 'Events' }, action: 'click' },
85
- };
86
-
87
- // ------------------------------
88
- // Storybook Meta
89
- // ------------------------------
90
- const { Story } = defineMeta({
91
- component: UtilityButton,
92
- tags: ['autodocs'],
93
- argTypes: storyUtilityButtonArgTypes,
94
- parameters: {
95
- docs: {
96
- description: {
97
- component: description,
98
- },
99
- },
100
- },
101
- });
102
- </script>
103
-
104
- <!-- ------------------------------ -->
105
- <!-- Stories -->
106
- <!-- ------------------------------ -->
107
-
108
- <Story name="Default">Click me!</Story>
109
-
110
- <Story
111
- name="Link Button"
112
- args={{
113
- href: 'https://www.w3schools.com/tags/tag_a.asp',
114
- target: '_blank',
115
- }}
116
- >
117
- Click me!
118
- </Story>
119
-
120
- <Story
121
- name="OnClick (Actions)"
122
- args={{
123
- onclick: (e: Event) => {
124
- const target = e.target as HTMLButtonElement;
125
- alert('Button Clicked');
126
- console.log('Button Clicked', target);
127
- },
128
- }}
129
- >
130
- Click me
131
- </Story>
132
-
133
- <Story name="Color" args={{ color: 'safe' }}>Click me</Story>
134
-
135
- <Story name="Outline" args={{ outline: true }}>Click me!</Story>
136
-
137
- <Story name="Size" args={{ size: 'large' }}>Click me!</Story>
138
-
139
- <Story name="Disabled" args={{ disabled: true }}>Click me!</Story>
140
-
141
- <Story name="Submit Button" args={{ type: 'submit' }}>Click me!</Story>
142
-
143
- <Story
144
- name="Compact"
145
- args={{
146
- compact: true,
147
- 'aria-label': 'Add item',
148
- }}
149
- >
150
- +
151
- </Story>
152
-
153
- <Story name="Light Theme" asChild>
154
- <Theme type="light">
155
- <UtilityButton>Click me!</UtilityButton>
156
- </Theme>
157
- </Story>
158
-
159
- <Story name="Dark Theme" asChild globals={{ backgrounds: { value: 'dark' } }}>
160
- <Theme type="dark">
161
- <UtilityButton>Click me!</UtilityButton>
162
- </Theme>
163
- </Story>
@@ -1,22 +0,0 @@
1
- import UtilityButton from './UtilityButton.svelte';
2
- import type { UtilityButtonProps } from './UtilityButton.svelte';
3
- import type { ArgTypes } from 'storybook/internal/csf';
4
- export declare const storyUtilityButtonArgTypes: Partial<ArgTypes<UtilityButtonProps>>;
5
- 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> {
6
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
7
- $$bindings?: Bindings;
8
- } & Exports;
9
- (internal: unknown, props: {
10
- $$events?: Events;
11
- $$slots?: Slots;
12
- }): Exports & {
13
- $set?: any;
14
- $on?: any;
15
- };
16
- z_$$bindings?: Bindings;
17
- }
18
- declare const UtilityButton: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
19
- [evt: string]: CustomEvent<any>;
20
- }, {}, {}, string>;
21
- type UtilityButton = InstanceType<typeof UtilityButton>;
22
- export default UtilityButton;
@@ -1,147 +0,0 @@
1
- @use '../../../styles/global/breakpoints' as breakpoints;
2
-
3
- // ----------------------------------------
4
- // Theme tokens (global CSS variables)
5
- // ----------------------------------------
6
- :root {
7
- --dodo-ui-Calendar-date-selected-bg: var(--dodo-color-primary-500);
8
- --dodo-ui-Calendar-date-selected-hover-bg: var(--dodo-color-primary-600);
9
- }
10
-
11
- .dodo-theme--dark {
12
- --dodo-ui-Calendar-date-selected-bg: var(--dodo-color-primary-300);
13
- --dodo-ui-Calendar-date-selected-hover-bg: var(--dodo-color-primary-400);
14
- }
15
-
16
- .dodo-ui-Calendar {
17
- font-size: 1rem;
18
- color: var(--dodo-color-neutral-900);
19
- display: inline-flex;
20
- flex-direction: column;
21
-
22
- @include breakpoints.up('sm') {
23
- padding: var(--dodo-ui-space);
24
- }
25
-
26
- [data-calendar-header] {
27
- display: flex;
28
- justify-content: space-between;
29
- align-items: center;
30
- padding: 0 calc(var(--dodo-ui-space) / 2);
31
- margin-bottom: calc(var(--dodo-ui-space) * 2);
32
- margin-top: var(--dodo-ui-space);
33
- }
34
-
35
- [data-calendar-heading] {
36
- margin: 0 calc(var(--dodo-ui-space) / 2);
37
- font-weight: 500;
38
- }
39
-
40
- button[data-calendar-next-button],
41
- button[data-calendar-prev-button] {
42
- font-size: 1.4em;
43
- }
44
-
45
- [data-calendar-grid] {
46
- width: 100%;
47
- user-select: none;
48
- }
49
-
50
- [data-calendar-grid-row] {
51
- display: flex;
52
- width: 100%;
53
- justify-content: space-around;
54
- }
55
-
56
- [data-calendar-grid-head] {
57
- margin-bottom: var(--dodo-ui-space);
58
- display: block;
59
- }
60
-
61
- [data-calendar-head-cell] {
62
- display: inline-flex;
63
- width: var(--dodo-ui-element-height-normal);
64
- justify-content: center;
65
- font-weight: 600;
66
- color: var(--dodo-color-neutral-600);
67
- font-size: 0.9rem;
68
- }
69
-
70
- [data-calendar-cell] {
71
- display: inline-flex;
72
- }
73
-
74
- [data-calendar-day] {
75
- transition:
76
- background-color 70ms,
77
- color 70ms,
78
- border-color 70ms;
79
- display: inline-flex;
80
- justify-content: center;
81
- align-items: center;
82
- width: var(--dodo-ui-element-height-normal);
83
- height: var(--dodo-ui-element-height-normal);
84
- border-radius: var(--dodo-ui-element-roundness-1);
85
- border: var(--dodo-ui-element-border-width) solid transparent;
86
- position: relative;
87
-
88
- &:hover {
89
- background-color: var(--dodo-color-neutral-100);
90
- border-color: var(--dodo-color-neutral-400);
91
- }
92
-
93
- &[data-selected] {
94
- background-color: var(--dodo-ui-Calendar-date-selected-bg);
95
- color: var(--dodo-color-constant-white);
96
-
97
- &:hover {
98
- background-color: var(--dodo-ui-Calendar-date-selected-hover-bg);
99
- }
100
-
101
- &[data-today] {
102
- background-color: var(--dodo-ui-Calendar-date-selected-bg);
103
- color: var(--dodo-color-constant-white);
104
-
105
- &:hover {
106
- background-color: var(--dodo-ui-Calendar-date-selected-hover-bg);
107
- }
108
-
109
- &::after {
110
- background-color: var(--dodo-color-constant-white);
111
-
112
- &:hover {
113
- background-color: var(--dodo-color-constant-white);
114
- }
115
- }
116
- }
117
- }
118
-
119
- &[data-today] {
120
- background-color: var(--dodo-color-primary-50);
121
- &::after {
122
- content: '';
123
- width: var(--dodo-ui-track-element-height-small);
124
- height: var(--dodo-ui-track-element-height-small);
125
- border-radius: 50%;
126
- display: inline-flex;
127
- background-color: var(--dodo-color-primary-600);
128
- position: absolute;
129
- bottom: 0.2em;
130
- }
131
- }
132
-
133
- &[data-outside-month],
134
- &[data-disabled] {
135
- color: var(--dodo-color-neutral-400);
136
-
137
- &:hover {
138
- background-color: initial;
139
- border-color: transparent;
140
- }
141
-
142
- &[data-today] {
143
- background-color: initial;
144
- }
145
- }
146
- }
147
- }
@@ -1,134 +0,0 @@
1
- <script module lang="ts">
2
- import { defineMeta } from '@storybook/addon-svelte-csf';
3
- import Calendar from './Calendar.svelte';
4
- import type { CalendarProps } from './Calendar.svelte';
5
- import type { ArgTypes } from 'storybook/internal/csf';
6
- import { componentRoundnessOptions } from '../../../attributes/roundness.js';
7
- import { CalendarDate, type DateValue } from '@internationalized/date';
8
- import Theme from '../../Layout/Theme/Theme.svelte';
9
- import { componentVariantOptions } from '../../../attributes/variant.js';
10
- import { cardColorOptions } from '../../Layout/Card/Card.svelte';
11
- import { componentThemeColorsOptions } from '../../../attributes/theme.js';
12
- import { ComponentShadowOptions } from '../../../attributes/shadow.js';
13
-
14
- const description = `
15
- a plug and play Calendar component based on bits-ui [calendar](https://bits-ui.com/docs/components/calendar).
16
-
17
- \`\`\`ts
18
- import { Calendar } from '@flightlesslabs/dodo-ui';
19
- \`\`\`
20
- `;
21
-
22
- // ------------------------------
23
- // Storybook ArgTypes
24
- // ------------------------------
25
- export const storyCalendarArgTypes: Partial<ArgTypes<CalendarProps>> = {
26
- // ------------------------------
27
- // Core
28
- // ------------------------------
29
- class: { table: { category: 'API', subcategory: 'Base' } },
30
- value: {
31
- control: { type: 'text' },
32
- table: { category: 'API', subcategory: 'Base' },
33
- },
34
-
35
- // ------------------------------
36
- // State
37
- // ------------------------------
38
- disabled: {
39
- control: { type: 'boolean' },
40
- description: 'Disabled state of the input',
41
- table: { category: 'API', subcategory: 'State', defaultValue: { summary: 'false' } },
42
- },
43
-
44
- // ------------------------------
45
- // Appearance
46
- // ------------------------------
47
- shadow: {
48
- control: { type: 'select' },
49
- options: ComponentShadowOptions,
50
- description: 'Component Shadow',
51
- table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: '1' } },
52
- },
53
- color: {
54
- control: { type: 'select' },
55
- options: cardColorOptions,
56
- description: 'Color theme token',
57
- table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: 'default' } },
58
- },
59
- variant: {
60
- control: { type: 'select' },
61
- options: componentVariantOptions,
62
- description: 'Visual variant of the card',
63
- table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: 'text' } },
64
- },
65
- roundness: {
66
- control: { type: 'select' },
67
- options: componentRoundnessOptions,
68
- description: 'Border radius token',
69
- table: { category: 'API', subcategory: 'Appearance' },
70
- },
71
- outline: {
72
- control: { type: 'boolean' },
73
- description: 'Render outlined style',
74
- table: { category: 'API', subcategory: 'Appearance' },
75
- },
76
- active: {
77
- control: { type: 'boolean' },
78
- description: 'Add mouse hover and active effects',
79
- table: { category: 'API', subcategory: 'Appearance' },
80
- },
81
- theme: {
82
- control: { type: 'select' },
83
- options: componentThemeColorsOptions,
84
- description: 'Theme color',
85
- table: { category: 'API', subcategory: 'Base', defaultValue: { summary: 'undefined' } },
86
- },
87
- };
88
-
89
- // ------------------------------
90
- // Storybook Meta
91
- // ------------------------------
92
- const { Story } = defineMeta({
93
- component: Calendar,
94
- tags: ['autodocs'],
95
- argTypes: storyCalendarArgTypes,
96
- parameters: {
97
- docs: {
98
- description: {
99
- component: description,
100
- },
101
- },
102
- },
103
- });
104
-
105
- let myValue = $state<DateValue>(new CalendarDate(2026, 4, 7));
106
- </script>
107
-
108
- <!-- ------------------------------ -->
109
- <!-- Stories -->
110
- <!-- ------------------------------ -->
111
-
112
- <Story name="Default" />
113
-
114
- <Story name="Controlled" asChild>
115
- <Calendar bind:value={myValue} />
116
- </Story>
117
-
118
- <Story name="Starts On Sunday" args={{ weekStartsOn: 0 }} />
119
-
120
- <Story name="Min Date" args={{ minValue: new CalendarDate(2026, 4, 7) }} />
121
-
122
- <Story name="Max Date" args={{ maxValue: new CalendarDate(2026, 4, 7) }} />
123
-
124
- <Story name="Light Theme" asChild>
125
- <Theme type="light">
126
- <Calendar />
127
- </Theme>
128
- </Story>
129
-
130
- <Story name="Dark Theme" asChild globals={{ backgrounds: { value: 'dark' } }}>
131
- <Theme type="dark">
132
- <Calendar />
133
- </Theme>
134
- </Story>
@@ -1,22 +0,0 @@
1
- import Calendar from './Calendar.svelte';
2
- import type { CalendarProps } from './Calendar.svelte';
3
- import type { ArgTypes } from 'storybook/internal/csf';
4
- export declare const storyCalendarArgTypes: Partial<ArgTypes<CalendarProps>>;
5
- 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> {
6
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
7
- $$bindings?: Bindings;
8
- } & Exports;
9
- (internal: unknown, props: {
10
- $$events?: Events;
11
- $$slots?: Slots;
12
- }): Exports & {
13
- $set?: any;
14
- $on?: any;
15
- };
16
- z_$$bindings?: Bindings;
17
- }
18
- declare const Calendar: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
19
- [evt: string]: CustomEvent<any>;
20
- }, {}, {}, string>;
21
- type Calendar = InstanceType<typeof Calendar>;
22
- export default Calendar;
@@ -1,61 +0,0 @@
1
- <script lang="ts" module>
2
- import type { CardProps } from '../../Layout/Card/Card.svelte';
3
- import { useThemeContext } from '../../Layout/Theme/ThemeSystem/context.js';
4
-
5
- export type CalendarProps = Omit<CalendarSingleRootProps, 'type'> &
6
- Omit<CardProps, 'children' | 'ref'>;
7
- </script>
8
-
9
- <script lang="ts">
10
- import { Calendar as CalendarBitsUi, type CalendarSingleRootProps } from 'bits-ui';
11
- import Header from './Header.svelte';
12
- import CalendarGrid from './CalendarGrid/CalendarGrid.svelte';
13
- let {
14
- roundness = 1,
15
- outline = true,
16
- class: className = '',
17
- theme: cardTheme,
18
- color = 'default',
19
- variant = 'text',
20
- shadow = 0,
21
- active = false,
22
- weekStartsOn = 1,
23
- weekdayFormat = 'short',
24
- fixedWeeks = true,
25
- value = $bindable(undefined),
26
- ...restProps
27
- }: CalendarProps = $props();
28
-
29
- const themeContext = useThemeContext();
30
- const theme = $derived(cardTheme ? cardTheme : themeContext.theme);
31
-
32
- const popupClasses = $derived(
33
- [
34
- 'dodo-ui-Card',
35
- 'dodo-ui-Calendar',
36
- `color--${color}`,
37
- `variant--${variant}`,
38
- `roundness--${roundness}`,
39
- `dodo-shadow-${shadow}`,
40
- outline && 'outline',
41
- active && 'active',
42
- theme ? `dodo-theme--${theme}` : '',
43
- className,
44
- ].filter(Boolean),
45
- );
46
- </script>
47
-
48
- <CalendarBitsUi.Root
49
- {...restProps}
50
- {weekStartsOn}
51
- {weekdayFormat}
52
- {fixedWeeks}
53
- bind:value
54
- type="single"
55
- class={popupClasses.join(' ')}
56
- >
57
- {#snippet children(calendarRootSnippetProps)}
58
- <Header />
59
- <CalendarGrid {...calendarRootSnippetProps} />
60
- {/snippet}
61
- </CalendarBitsUi.Root>
@@ -1,6 +0,0 @@
1
- import type { CardProps } from '../../Layout/Card/Card.svelte';
2
- export type CalendarProps = Omit<CalendarSingleRootProps, 'type'> & Omit<CardProps, 'children' | 'ref'>;
3
- import { type CalendarSingleRootProps } from 'bits-ui';
4
- declare const Calendar: import("svelte").Component<CalendarProps, {}, "value">;
5
- type Calendar = ReturnType<typeof Calendar>;
6
- export default Calendar;
@@ -1,16 +0,0 @@
1
- <script lang="ts">
2
- import { Calendar, type CalendarRootSnippetProps } from 'bits-ui';
3
- import TableHead from './TableHead.svelte';
4
- import TableBody from './TableBody.svelte';
5
-
6
- let { months, weekdays }: CalendarRootSnippetProps = $props();
7
- </script>
8
-
9
- <div class="CalendarGrid">
10
- {#each months as month (month.value)}
11
- <Calendar.Grid>
12
- <TableHead {weekdays} />
13
- <TableBody {month} />
14
- </Calendar.Grid>
15
- {/each}
16
- </div>
@@ -1,4 +0,0 @@
1
- import { type CalendarRootSnippetProps } from 'bits-ui';
2
- declare const CalendarGrid: import("svelte").Component<CalendarRootSnippetProps, {}, "">;
3
- type CalendarGrid = ReturnType<typeof CalendarGrid>;
4
- export default CalendarGrid;
@@ -1,25 +0,0 @@
1
- <script lang="ts">
2
- import type { DateValue } from '@internationalized/date';
3
- import { Calendar, type Month } from 'bits-ui';
4
-
5
- type Props = {
6
- month: Month<DateValue>;
7
- };
8
-
9
- let { month }: Props = $props();
10
- </script>
11
-
12
- <Calendar.GridBody>
13
- {#each month.weeks as weekDates (weekDates)}
14
- <Calendar.GridRow>
15
- {#each weekDates as date (date)}
16
- <Calendar.Cell {date} month={month.value}>
17
- <Calendar.Day>
18
- <div></div>
19
- {date.day}
20
- </Calendar.Day>
21
- </Calendar.Cell>
22
- {/each}
23
- </Calendar.GridRow>
24
- {/each}
25
- </Calendar.GridBody>
@@ -1,8 +0,0 @@
1
- import type { DateValue } from '@internationalized/date';
2
- import { type Month } from 'bits-ui';
3
- type Props = {
4
- month: Month<DateValue>;
5
- };
6
- declare const TableBody: import("svelte").Component<Props, {}, "">;
7
- type TableBody = ReturnType<typeof TableBody>;
8
- export default TableBody;
@@ -1,19 +0,0 @@
1
- <script lang="ts">
2
- import { Calendar } from 'bits-ui';
3
-
4
- type Props = {
5
- weekdays: string[];
6
- };
7
-
8
- let { weekdays }: Props = $props();
9
- </script>
10
-
11
- <Calendar.GridHead>
12
- <Calendar.GridRow>
13
- {#each weekdays as day (day)}
14
- <Calendar.HeadCell>
15
- <div>{day.slice(0, 2)}</div>
16
- </Calendar.HeadCell>
17
- {/each}
18
- </Calendar.GridRow>
19
- </Calendar.GridHead>
@@ -1,6 +0,0 @@
1
- type Props = {
2
- weekdays: string[];
3
- };
4
- declare const TableHead: import("svelte").Component<Props, {}, "">;
5
- type TableHead = ReturnType<typeof TableHead>;
6
- export default TableHead;
@@ -1,25 +0,0 @@
1
- <script lang="ts">
2
- import Icon from '@iconify/svelte';
3
- import { Calendar } from 'bits-ui';
4
-
5
- const triggerClasses = $derived(
6
- [
7
- 'dodo-ui-Button',
8
- 'compact',
9
- 'size--normal',
10
- 'variant--text',
11
- 'color--primary',
12
- 'roundness--1',
13
- ].filter(Boolean),
14
- );
15
- </script>
16
-
17
- <Calendar.Header>
18
- <Calendar.PrevButton class={triggerClasses.join(' ')}>
19
- <Icon icon="material-symbols:chevron-left-rounded" />
20
- </Calendar.PrevButton>
21
- <Calendar.Heading />
22
- <Calendar.NextButton class={triggerClasses.join(' ')}>
23
- <Icon icon="material-symbols:chevron-right-rounded" />
24
- </Calendar.NextButton>
25
- </Calendar.Header>
@@ -1,3 +0,0 @@
1
- declare const Header: import("svelte").Component<Record<string, never>, {}, "">;
2
- type Header = ReturnType<typeof Header>;
3
- export default Header;