@flightlesslabs/dodo-ui 0.6.4 → 0.6.6

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 (122) hide show
  1. package/dist/index.d.ts +6 -4
  2. package/dist/stories/Home.mdx +4 -6
  3. package/dist/stories/components/Form/Button/Button.stories.svelte +16 -37
  4. package/dist/stories/components/Form/Button/Button.svelte +44 -46
  5. package/dist/stories/components/Form/Button/Button.svelte.d.ts +10 -9
  6. package/dist/stories/components/Form/Button/Color/Color.stories.svelte +23 -48
  7. package/dist/stories/components/Form/Button/Events/Events.stories.svelte +1 -7
  8. package/dist/stories/components/Form/Button/IconButton/IconButton.stories.svelte +4 -12
  9. package/dist/stories/components/Form/Button/Roundness/Roundness.stories.svelte +5 -31
  10. package/dist/stories/components/Form/Button/Size/Size.stories.svelte +3 -9
  11. package/dist/stories/components/Form/Button/Variant/Variant.stories.svelte +5 -8
  12. package/dist/stories/components/Form/FormControl/FormControl.stories.svelte +11 -12
  13. package/dist/stories/components/Form/FormControl/FormControl.svelte +3 -8
  14. package/dist/stories/components/Form/Label/Label.stories.svelte +1 -11
  15. package/dist/stories/components/Form/Label/Label.svelte +2 -4
  16. package/dist/stories/components/Form/Label/Label.svelte.d.ts +0 -2
  17. package/dist/stories/components/Form/Message/Color/Color.stories.svelte +9 -9
  18. package/dist/stories/components/Form/Message/Message.stories.svelte +5 -13
  19. package/dist/stories/components/Form/Message/Message.svelte +4 -9
  20. package/dist/stories/components/Form/Message/Message.svelte.d.ts +3 -5
  21. package/dist/stories/components/Form/Message/Size/Size.stories.svelte +3 -5
  22. package/dist/stories/components/Form/PasswordInput/Events/Events.stories.svelte +8 -72
  23. package/dist/stories/components/Form/PasswordInput/PasswordInput.stories.svelte +5 -3
  24. package/dist/stories/components/Form/PasswordInput/PasswordInput.svelte +4 -4
  25. package/dist/stories/components/Form/PasswordInput/PasswordInput.svelte.d.ts +3 -2
  26. package/dist/stories/components/Form/PasswordInput/Roundness/Roundness.stories.svelte +4 -4
  27. package/dist/stories/components/Form/PasswordInput/WithIcon/WithIcon.stories.svelte +2 -2
  28. package/dist/stories/components/Form/SimpleSelect/Events/Events.stories.svelte +3 -30
  29. package/dist/stories/components/Form/SimpleSelect/Roundness/Roundness.stories.svelte +4 -4
  30. package/dist/stories/components/Form/SimpleSelect/SimpleSelect.stories.svelte +4 -6
  31. package/dist/stories/components/Form/SimpleSelect/SimpleSelect.svelte +4 -4
  32. package/dist/stories/components/Form/SimpleSelect/SimpleSelect.svelte.d.ts +3 -2
  33. package/dist/stories/components/Form/SimpleSelect/WithIcon/WithIcon.stories.svelte +2 -2
  34. package/dist/stories/components/Form/TextInput/Events/Events.stories.svelte +7 -63
  35. package/dist/stories/components/Form/TextInput/Roundness/Roundness.stories.svelte +4 -4
  36. package/dist/stories/components/Form/TextInput/TextInput.stories.svelte +6 -4
  37. package/dist/stories/components/Form/TextInput/TextInput.svelte +12 -5
  38. package/dist/stories/components/Form/TextInput/TextInput.svelte.d.ts +4 -2
  39. package/dist/stories/components/Form/TextInput/WithIcon/WithIcon.stories.svelte +4 -4
  40. package/dist/stories/components/Layout/Paper/Color/Color.stories.svelte +63 -0
  41. package/dist/stories/components/Layout/Paper/Color/Color.stories.svelte.d.ts +26 -0
  42. package/dist/stories/components/Layout/Paper/Paper.stories.svelte +25 -16
  43. package/dist/stories/components/Layout/Paper/Paper.svelte +211 -14
  44. package/dist/stories/components/Layout/Paper/Paper.svelte.d.ts +18 -7
  45. package/dist/stories/components/Layout/Paper/Roundness/Roundness.stories.svelte +8 -13
  46. package/dist/stories/components/Layout/Paper/Shadow/Shadow.stories.svelte +6 -24
  47. package/dist/stories/components/Layout/Paper/utils/scss/mixins.scss +46 -0
  48. package/dist/stories/developer tools/Intro.mdx +2 -0
  49. package/dist/stories/developer tools/components/InputEnclosure/InputEnclosure.stories.svelte +5 -5
  50. package/dist/stories/developer tools/components/InputEnclosure/InputEnclosure.svelte +14 -14
  51. package/dist/stories/developer tools/components/InputEnclosure/InputEnclosure.svelte.d.ts +3 -2
  52. package/dist/stories/developer tools/components/InputEnclosure/Roundness/Roundness.stories.svelte +4 -4
  53. package/dist/stories/developer tools/components/InputEnclosure/WithIcon/WithIcon.stories.svelte +4 -4
  54. package/dist/stories/developer tools/components/UtilityButton/Size/Size.stories.svelte +3 -3
  55. package/dist/stories/developer tools/components/UtilityButton/UtilityButton.stories.svelte +4 -3
  56. package/dist/stories/developer tools/components/UtilityButton/UtilityButton.svelte +3 -3
  57. package/dist/stories/developer tools/components/UtilityButton/UtilityButton.svelte.d.ts +1 -1
  58. package/dist/stories/{philosophy/Colors/Colors.mdx → developer tools/philosophy/Colors/Colors.mdx } +2 -2
  59. package/dist/stories/{philosophy/Colors/Swatches/Palette.svelte → developer tools/philosophy/Colors/Swatches/Palette.svelte } +1 -1
  60. package/dist/stories/{philosophy/Colors/Swatches/Swatch.svelte → developer tools/philosophy/Colors/Swatches/Swatch.svelte } +1 -1
  61. package/dist/stories/{philosophy/Colors/Swatches/Swatches.svelte → developer tools/philosophy/Colors/Swatches/Swatches.svelte } +1 -1
  62. package/dist/stories/{philosophy/Colors/utils/color.js → developer tools/philosophy/Colors/utils/color.js } +1 -1
  63. package/dist/stories/{philosophy/Themes.mdx → developer tools/philosophy/Themes.mdx } +1 -1
  64. package/dist/styles/_colors.css +44 -44
  65. package/dist/styles/_components.css +6 -3
  66. package/dist/styles/_shadow.css +13 -20
  67. package/dist/styles/_space.css +7 -0
  68. package/dist/styles/global.css +1 -0
  69. package/dist/types/colors.d.ts +7 -0
  70. package/dist/types/colors.js +10 -0
  71. package/dist/types/roundness.d.ts +3 -0
  72. package/dist/types/roundness.js +1 -0
  73. package/dist/types/shadow.d.ts +3 -0
  74. package/dist/types/shadow.js +1 -0
  75. package/dist/types/size.d.ts +3 -0
  76. package/dist/types/size.js +1 -0
  77. package/dist/types/weight.d.ts +3 -0
  78. package/dist/types/weight.js +1 -0
  79. package/package.json +24 -24
  80. package/src/lib/index.ts +13 -8
  81. package/src/lib/stories/components/Form/Button/Button.svelte +30 -31
  82. package/src/lib/stories/components/Form/FormControl/FormControl.svelte +2 -7
  83. package/src/lib/stories/components/Form/Label/Label.svelte +1 -6
  84. package/src/lib/stories/components/Form/Message/Message.svelte +9 -16
  85. package/src/lib/stories/components/Form/PasswordInput/PasswordInput.svelte +7 -6
  86. package/src/lib/stories/components/Form/SimpleSelect/SimpleSelect.svelte +7 -6
  87. package/src/lib/stories/components/Form/TextInput/TextInput.svelte +16 -6
  88. package/src/lib/stories/components/Layout/Paper/Paper.svelte +151 -23
  89. package/src/lib/stories/components/Layout/Paper/utils/scss/mixins.scss +46 -0
  90. package/src/lib/stories/developer tools/components/InputEnclosure/InputEnclosure.svelte +17 -16
  91. package/src/lib/stories/developer tools/components/UtilityButton/UtilityButton.svelte +4 -4
  92. package/src/lib/stories/developer tools/philosophy/Colors/Colors.svelte +46 -0
  93. package/src/lib/stories/developer tools/philosophy/Colors/Opacity.svelte +23 -0
  94. package/src/lib/stories/developer tools/philosophy/Colors/Swatches/Palette.svelte +46 -0
  95. package/src/lib/stories/developer tools/philosophy/Colors/Swatches/Swatch.svelte +35 -0
  96. package/src/lib/stories/developer tools/philosophy/Colors/Swatches/Swatches.svelte +55 -0
  97. package/src/lib/stories/developer tools/philosophy/Colors/utils/color.ts +41 -0
  98. package/src/lib/styles/_colors.css +44 -44
  99. package/src/lib/styles/_components.css +6 -3
  100. package/src/lib/styles/_shadow.css +13 -20
  101. package/src/lib/styles/_space.css +7 -0
  102. package/src/lib/styles/global.css +1 -0
  103. package/src/lib/types/colors.ts +16 -0
  104. package/src/lib/types/roundness.ts +3 -0
  105. package/src/lib/types/shadow.ts +3 -0
  106. package/src/lib/types/size.ts +3 -0
  107. package/src/lib/types/weight.ts +3 -0
  108. package/dist/types.d.ts +0 -5
  109. package/dist/types.js +0 -1
  110. package/src/lib/types.ts +0 -6
  111. /package/dist/stories/{philosophy → developer tools/philosophy}/Colors/Colors.stories.svelte +0 -0
  112. /package/dist/stories/{philosophy → developer tools/philosophy}/Colors/Colors.stories.svelte.d.ts +0 -0
  113. /package/dist/stories/{philosophy → developer tools/philosophy}/Colors/Colors.svelte +0 -0
  114. /package/dist/stories/{philosophy → developer tools/philosophy}/Colors/Colors.svelte.d.ts +0 -0
  115. /package/dist/stories/{philosophy → developer tools/philosophy}/Colors/Opacity.stories.svelte +0 -0
  116. /package/dist/stories/{philosophy → developer tools/philosophy}/Colors/Opacity.stories.svelte.d.ts +0 -0
  117. /package/dist/stories/{philosophy → developer tools/philosophy}/Colors/Opacity.svelte +0 -0
  118. /package/dist/stories/{philosophy → developer tools/philosophy}/Colors/Opacity.svelte.d.ts +0 -0
  119. /package/dist/stories/{philosophy → developer tools/philosophy}/Colors/Swatches/Palette.svelte.d.ts +0 -0
  120. /package/dist/stories/{philosophy → developer tools/philosophy}/Colors/Swatches/Swatch.svelte.d.ts +0 -0
  121. /package/dist/stories/{philosophy → developer tools/philosophy}/Colors/Swatches/Swatches.svelte.d.ts +0 -0
  122. /package/dist/stories/{philosophy → developer tools/philosophy}/Colors/utils/color.d.ts +0 -0
@@ -1,6 +1,15 @@
1
1
  <script lang="ts" module>
2
2
  export type TextInputType = 'text' | 'tel' | 'email' | 'password' | 'url' | 'number';
3
3
 
4
+ export const textInputTypeArray: TextInputType[] = [
5
+ 'text',
6
+ 'tel',
7
+ 'email',
8
+ 'password',
9
+ 'url',
10
+ 'number',
11
+ ];
12
+
4
13
  export type TextInputFocusEvent = FocusEvent & {
5
14
  currentTarget: EventTarget & HTMLInputElement;
6
15
  };
@@ -12,8 +21,9 @@
12
21
 
13
22
  <script lang="ts">
14
23
  import InputEnclosure from '$lib/stories/developer tools/components/InputEnclosure/InputEnclosure.svelte';
24
+ import type { ComponentRoundness } from '$lib/types/roundness.js';
25
+ import type { ComponentSize } from '$lib/types/size.js';
15
26
 
16
- import type { ComponentRoundness, ComponentSize } from '$lib/types.js';
17
27
  import type { Snippet } from 'svelte';
18
28
  import type {
19
29
  ChangeEventHandler,
@@ -30,7 +40,7 @@
30
40
  /** How large should the button be? */
31
41
  size?: ComponentSize;
32
42
  /** How round should the border radius be? */
33
- roundness?: ComponentRoundness | false;
43
+ roundness?: ComponentRoundness;
34
44
  /** Add a border around the button. Default True */
35
45
  outline?: boolean;
36
46
  /** Input value */
@@ -72,7 +82,7 @@
72
82
  let {
73
83
  type = 'text',
74
84
  size = 'normal',
75
- roundness = '1x',
85
+ roundness = 1,
76
86
  outline = true,
77
87
  name,
78
88
  id,
@@ -158,13 +168,13 @@
158
168
  &--normal {
159
169
  input {
160
170
  font-size: 1rem;
161
- padding: 0 12px;
171
+ padding: 0 calc(var(--dodo-ui-space-small) * 2);
162
172
  }
163
173
  }
164
174
 
165
175
  &--small {
166
176
  input {
167
- padding: 0 8px;
177
+ padding: 0 var(--dodo-ui-space);
168
178
  font-size: 0.9rem;
169
179
  }
170
180
  }
@@ -172,7 +182,7 @@
172
182
  &--large {
173
183
  input {
174
184
  font-size: 1.1rem;
175
- padding: 0 14px;
185
+ padding: 0 calc(var(--dodo-ui-space) * 2);
176
186
  }
177
187
  }
178
188
  }
@@ -1,10 +1,24 @@
1
1
  <script lang="ts" module>
2
- export type PaperRoundness = ComponentRoundness | false | ComponentRoundnessFull;
3
- export type PaperShadow = false | '1x' | '2x' | '3x' | '4x' | '5x' | '6x' | '7x';
2
+ import {
3
+ componentColorPriorityArray,
4
+ componentColorSeverityArray,
5
+ type ComponentColor,
6
+ } from '$lib/types/colors.js';
7
+
8
+ export type PaperColor = 'default' | ComponentColor;
9
+
10
+ export const paperColorArray: PaperColor[] = [
11
+ 'default',
12
+ ...componentColorPriorityArray,
13
+ ...componentColorSeverityArray,
14
+ ];
4
15
  </script>
5
16
 
6
17
  <script lang="ts">
7
- import type { ComponentRoundness, ComponentRoundnessFull } from '$lib/types.js';
18
+ import type { ComponentRoundness } from '$lib/types/roundness.js';
19
+ import type { ComponentShadow } from '$lib/types/shadow.js';
20
+ import type { ComponentWeight } from '$lib/types/weight.js';
21
+
8
22
  import type { Snippet } from 'svelte';
9
23
 
10
24
  interface PaperProps {
@@ -13,9 +27,9 @@
13
27
  /** Paper ref */
14
28
  ref?: HTMLDivElement;
15
29
  /** How round should the border radius be? */
16
- roundness?: PaperRoundness;
30
+ roundness?: ComponentRoundness;
17
31
  /** Shadow elevation */
18
- shadow?: PaperShadow;
32
+ shadow?: ComponentShadow;
19
33
  /** Custom css class */
20
34
  class?: string;
21
35
  /** Paper Width */
@@ -24,48 +38,122 @@
24
38
  height?: string;
25
39
  /** Id */
26
40
  id?: string;
27
- /** Test: ⚠️ Unsafe Children String. Do Not use*/
28
- _unsafeChildrenStringForTesting?: string;
41
+ /** Add a border around paper */
42
+ outline?: boolean;
43
+ /** What color to use? */
44
+ color?: PaperColor;
45
+ /** How should paper appear? */
46
+ variant?: ComponentWeight;
47
+ /** Custom background color. Use CSS compatible value */
48
+ customBackgroundColor?: string;
49
+ /** Custom border color. Use CSS compatible value */
50
+ customBorderColor?: string;
29
51
  }
30
52
 
31
53
  let {
32
54
  children,
33
- roundness = '1x',
34
- shadow = '1x',
55
+ roundness = 1,
56
+ shadow = 0,
35
57
  id,
36
58
  class: className = '',
37
- _unsafeChildrenStringForTesting,
38
59
  width,
39
60
  height,
40
61
  ref = $bindable<HTMLDivElement>(),
62
+ color = 'default',
63
+ variant = 'text',
64
+ customBackgroundColor,
65
+ customBorderColor,
66
+ outline = false,
41
67
  }: PaperProps = $props();
42
68
  </script>
43
69
 
44
70
  <div
71
+ class:outline
45
72
  class={[
46
73
  'dodo-ui-Paper',
47
74
  `roundness--${roundness}`,
75
+ `color--${color}`,
76
+ `variant--${variant}`,
77
+ `shadow--${shadow}`,
48
78
  `${shadow ? `shadow--${shadow} dodo-shadow-${shadow}` : `shadow--${shadow}`}`,
49
79
  className,
50
80
  ].join(' ')}
51
81
  {id}
52
82
  bind:this={ref}
53
- style={`${width ? `width:${width};` : ''}${height ? `height:${height};` : ''}`}
83
+ style={`${width ? `width:${width};` : ''}
84
+ ${height ? `height:${height};` : ''}
85
+ ${customBackgroundColor ? `background-color:${customBackgroundColor};` : ''}
86
+ ${customBorderColor ? `border-color:${customBorderColor};` : ''}
87
+ `}
54
88
  >
55
89
  {#if children}
56
90
  {@render children()}
57
- {:else if _unsafeChildrenStringForTesting}
58
- {_unsafeChildrenStringForTesting}
59
91
  {/if}
60
92
  </div>
61
93
 
62
94
  <style lang="scss">
95
+ @use 'utils/scss/mixins.scss' as *;
96
+
63
97
  :global(:root) {
64
- --dodo-ui-Paper-bg: var(--dodo-color-white);
98
+ --dodo-ui-Paper-default-bg: var(--dodo-color-white);
99
+ --dodo-ui-Paper-default-bg-shadow-1: var(--dodo-color-white);
100
+ --dodo-ui-Paper-default-bg-shadow-2: var(--dodo-color-white);
101
+ --dodo-ui-Paper-default-bg-shadow-3: var(--dodo-color-white);
102
+ --dodo-ui-Paper-default-bg-shadow-4: var(--dodo-color-white);
103
+ --dodo-ui-Paper-default-bg-shadow-5: var(--dodo-color-white);
104
+
105
+ --dodo-ui-Paper-outline-default: var(--dodo-color-neutral-300);
106
+
107
+ @include generate-dodo-ui-paper-colors(neutral);
108
+ @include generate-dodo-ui-paper-colors(primary);
109
+ @include generate-dodo-ui-paper-colors(secondary);
110
+ @include generate-dodo-ui-paper-colors(safe);
111
+ @include generate-dodo-ui-paper-colors(warning);
112
+ @include generate-dodo-ui-paper-colors(danger);
65
113
  }
66
114
 
67
115
  :global(.dodo-theme--dark) {
68
- --dodo-ui-Paper-bg: var(--dodo-color-default-100);
116
+ --dodo-ui-Paper-default-bg-mixer: #999999fd;
117
+
118
+ --dodo-ui-Paper-default-bg: color-mix(
119
+ in oklab,
120
+ var(--dodo-color-neutral-50) 98%,
121
+ var(--dodo-ui-Paper-default-bg-mixer)
122
+ );
123
+ --dodo-ui-Paper-default-bg-shadow-1: color-mix(
124
+ in oklab,
125
+ var(--dodo-color-neutral-50) 95%,
126
+ var(--dodo-ui-Paper-default-bg-mixer)
127
+ );
128
+ --dodo-ui-Paper-default-bg-shadow-2: color-mix(
129
+ in oklab,
130
+ var(--dodo-color-neutral-50) 90%,
131
+ var(--dodo-ui-Paper-default-bg-mixer)
132
+ );
133
+ --dodo-ui-Paper-default-bg-shadow-3: color-mix(
134
+ in oklab,
135
+ var(--dodo-color-neutral-50) 85%,
136
+ var(--dodo-ui-Paper-default-bg-mixer)
137
+ );
138
+ --dodo-ui-Paper-default-bg-shadow-4: color-mix(
139
+ in oklab,
140
+ var(--dodo-color-neutral-50) 80%,
141
+ var(--dodo-ui-Paper-default-bg-mixer)
142
+ );
143
+ --dodo-ui-Paper-default-bg-shadow-5: color-mix(
144
+ in oklab,
145
+ var(--dodo-color-neutral-50) 75%,
146
+ var(--dodo-ui-Paper-default-bg-mixer)
147
+ );
148
+
149
+ --dodo-ui-Paper-outline-default: var(--dodo-color-neutral-200);
150
+
151
+ @include generate-dodo-ui-paper-colors-dark(neutral);
152
+ @include generate-dodo-ui-paper-colors-dark(primary);
153
+ @include generate-dodo-ui-paper-colors-dark(secondary);
154
+ @include generate-dodo-ui-paper-colors-dark(safe);
155
+ @include generate-dodo-ui-paper-colors-dark(warning);
156
+ @include generate-dodo-ui-paper-colors-dark(danger);
69
157
  }
70
158
 
71
159
  .dodo-ui-Paper {
@@ -73,26 +161,66 @@
73
161
  transition: all 150ms;
74
162
  font-family: inherit;
75
163
  color: inherit;
76
-
77
- background-color: var(--dodo-ui-Paper-bg);
164
+ border-style: solid;
165
+ border-width: var(--dodo-ui-element-border-width);
166
+ border-color: transparent;
78
167
  overflow: hidden;
79
168
 
80
169
  &.roundness {
81
- &--1x {
82
- border-radius: var(--dodo-ui-element-roundness-1x);
170
+ &--1 {
171
+ border-radius: var(--dodo-ui-element-roundness-1);
83
172
  }
84
173
 
85
- &--2x {
86
- border-radius: var(--dodo-ui-element-roundness-2x);
174
+ &--2 {
175
+ border-radius: var(--dodo-ui-element-roundness-2);
87
176
  }
88
177
 
89
- &--3x {
90
- border-radius: var(--dodo-ui-element-roundness-3x);
178
+ &--3 {
179
+ border-radius: var(--dodo-ui-element-roundness-3);
91
180
  }
92
181
 
93
182
  &--full {
94
183
  border-radius: 50%;
95
184
  }
96
185
  }
186
+
187
+ &.color {
188
+ &--default {
189
+ background-color: var(--dodo-ui-Paper-default-bg);
190
+
191
+ &.outline {
192
+ border-color: var(--dodo-ui-Paper-outline-default);
193
+ }
194
+ }
195
+
196
+ @include generate-dodo-ui-paper-color(neutral);
197
+ @include generate-dodo-ui-paper-color(primary);
198
+ @include generate-dodo-ui-paper-color(secondary);
199
+ @include generate-dodo-ui-paper-color(safe);
200
+ @include generate-dodo-ui-paper-color(warning);
201
+ @include generate-dodo-ui-paper-color(danger);
202
+ }
203
+
204
+ &.color--default.shadow {
205
+ &--1 {
206
+ background-color: var(--dodo-ui-Paper-default-bg-shadow-1);
207
+ }
208
+
209
+ &--2 {
210
+ background-color: var(--dodo-ui-Paper-default-bg-shadow-2);
211
+ }
212
+
213
+ &--3 {
214
+ background-color: var(--dodo-ui-Paper-default-bg-shadow-3);
215
+ }
216
+
217
+ &--4 {
218
+ background-color: var(--dodo-ui-Paper-default-bg-shadow-4);
219
+ }
220
+
221
+ &--5 {
222
+ background-color: var(--dodo-ui-Paper-default-bg-shadow-5);
223
+ }
224
+ }
97
225
  }
98
226
  </style>
@@ -0,0 +1,46 @@
1
+ /// Mixin: generate-dodo-ui-paper-colors
2
+ /// Generates CSS custom properties for Dodo UI paper styles (text & solid)
3
+ /// across different interaction states (default, hover, active).
4
+ /// @param {String} $color-name - The theme color name (e.g., "primary", "safe", etc.)
5
+ @mixin generate-dodo-ui-paper-colors($color-name) {
6
+ --dodo-ui-Paper-outline-#{$color-name}: var(--dodo-color-#{$color-name}-400);
7
+ --dodo-ui-Paper-text-#{$color-name}-bg: var(--dodo-color-#{$color-name}-100);
8
+ --dodo-ui-Paper-solid-#{$color-name}-bg: var(--dodo-color-#{$color-name}-500);
9
+ }
10
+
11
+ /// Mixin: generate-dodo-ui-paper-colors
12
+ /// Generates CSS custom properties for Dodo UI paper styles (text & solid)
13
+ /// across different interaction states (default, hover, active).
14
+ /// @param {String} $color-name - The theme color name (e.g., "primary", "safe", etc.)
15
+ @mixin generate-dodo-ui-paper-colors-dark($color-name) {
16
+ --dodo-ui-Paper-outline-#{$color-name}: var(--dodo-color-#{$color-name}-300);
17
+ --dodo-ui-Paper-text-#{$color-name}-bg: color-mix(
18
+ in oklab,
19
+ var(--dodo-color-#{$color-name}-50) 80%,
20
+ #00000080
21
+ );
22
+ --dodo-ui-Paper-solid-#{$color-name}-bg: var(--dodo-color-#{$color-name}-300);
23
+ }
24
+
25
+ /// Mixin: generate-dodo-ui-paper-color
26
+ /// Auto-generates .color--[theme] > .variant--text & .variant--solid styles
27
+ /// @param {String} $theme - e.g., default, safe, danger, etc.
28
+ @mixin generate-dodo-ui-paper-color($theme) {
29
+ &--#{$theme} {
30
+ &.variant {
31
+ &--text {
32
+ color: var(--dodo-color-#{$theme}-800);
33
+ background-color: var(--dodo-ui-Paper-text-#{$theme}-bg);
34
+
35
+ &.outline {
36
+ border-color: var(--dodo-ui-Paper-outline-#{$theme});
37
+ }
38
+ }
39
+
40
+ &--solid {
41
+ color: var(--dodo-color-constant-white);
42
+ background-color: var(--dodo-ui-Paper-solid-#{$theme}-bg);
43
+ }
44
+ }
45
+ }
46
+ }
@@ -1,5 +1,6 @@
1
1
  <script lang="ts">
2
- import type { ComponentRoundness, ComponentSize } from '$lib/types.js';
2
+ import type { ComponentRoundness } from '$lib/types/roundness.js';
3
+ import type { ComponentSize } from '$lib/types/size.js';
3
4
  import type { Snippet } from 'svelte';
4
5
 
5
6
  interface InputEnclosureProps {
@@ -10,7 +11,7 @@
10
11
  /** How large should the button be? */
11
12
  size?: ComponentSize;
12
13
  /** How round should the border radius be? */
13
- roundness?: ComponentRoundness | false;
14
+ roundness?: ComponentRoundness;
14
15
  /** Add a border around the button. Default True */
15
16
  outline?: boolean;
16
17
  /** disabled state */
@@ -29,7 +30,7 @@
29
30
 
30
31
  let {
31
32
  size = 'normal',
32
- roundness = '1x',
33
+ roundness = 1,
33
34
  outline = true,
34
35
  class: className = '',
35
36
  disabled = false,
@@ -70,27 +71,27 @@
70
71
 
71
72
  <style lang="scss">
72
73
  :global(:root) {
73
- --dodo-ui-InputEnclosure-border-color: var(--dodo-color-default-500);
74
+ --dodo-ui-InputEnclosure-border-color: var(--dodo-color-neutral-500);
74
75
  --dodo-ui-InputEnclosure-focus-border-color: var(--dodo-color-primary-500);
75
76
  --dodo-ui-InputEnclosure-error-border-color: var(--dodo-color-danger-500);
76
77
 
77
- --dodo-ui-InputEnclosure-disabled-color: var(--dodo-color-default-400);
78
- --dodo-ui-InputEnclosure-disabled-bg: var(--dodo-color-default-200);
78
+ --dodo-ui-InputEnclosure-disabled-color: var(--dodo-color-neutral-400);
79
+ --dodo-ui-InputEnclosure-disabled-bg: var(--dodo-color-neutral-200);
79
80
  }
80
81
 
81
82
  :global(.dodo-theme--dark) {
82
- --dodo-ui-InputEnclosure-border-color: var(--dodo-color-default-600);
83
+ --dodo-ui-InputEnclosure-border-color: var(--dodo-color-neutral-600);
83
84
  --dodo-ui-InputEnclosure-focus-border-color: var(--dodo-color-primary-600);
84
85
  --dodo-ui-InputEnclosure-error-border-color: var(--dodo-color-danger-600);
85
86
 
86
- --dodo-ui-InputEnclosure-disabled-bg: var(--dodo-color-default-100);
87
- --dodo-ui-InputEnclosure-disabled-color: var(--dodo-color-default-500);
87
+ --dodo-ui-InputEnclosure-disabled-bg: var(--dodo-color-neutral-100);
88
+ --dodo-ui-InputEnclosure-disabled-color: var(--dodo-color-neutral-500);
88
89
  }
89
90
 
90
91
  .dodo-ui-InputEnclosure {
91
92
  display: flex;
92
93
  overflow: hidden;
93
- color: var(--dodo-color-default-800);
94
+ color: var(--dodo-color-neutral-800);
94
95
  transition: all 150ms;
95
96
  border: 0;
96
97
 
@@ -182,16 +183,16 @@
182
183
  }
183
184
 
184
185
  &.roundness {
185
- &--1x {
186
- border-radius: var(--dodo-ui-element-roundness-1x);
186
+ &--1 {
187
+ border-radius: var(--dodo-ui-element-roundness-1);
187
188
  }
188
189
 
189
- &--2x {
190
- border-radius: var(--dodo-ui-element-roundness-2x);
190
+ &--2 {
191
+ border-radius: var(--dodo-ui-element-roundness-2);
191
192
  }
192
193
 
193
- &--3x {
194
- border-radius: var(--dodo-ui-element-roundness-3x);
194
+ &--3 {
195
+ border-radius: var(--dodo-ui-element-roundness-3);
195
196
  }
196
197
  }
197
198
  }
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import type { ComponentSize } from '$lib/types.js';
2
+ import type { ComponentSize } from '$lib/types/size.js';
3
3
  import type { Snippet } from 'svelte';
4
4
  import type { MouseEventHandler } from 'svelte/elements';
5
5
 
@@ -56,14 +56,14 @@
56
56
  --dodo-ui-UtilityButton-hover: var(--dodo-color-primary-600);
57
57
  --dodo-ui-UtilityButton-active: var(--dodo-color-primary-600);
58
58
 
59
- --dodo-ui-UtilityButton-disabled-color: var(--dodo-color-default-400);
59
+ --dodo-ui-UtilityButton-disabled-color: var(--dodo-color-neutral-400);
60
60
  }
61
61
 
62
62
  :global(.dodo-theme--dark) {
63
63
  --dodo-ui-UtilityButton-hover: var(--dodo-color-primary-600);
64
64
  --dodo-ui-UtilityButton-active: var(--dodo-color-primary-600);
65
65
 
66
- --dodo-ui-UtilityButton-disabled-color: var(--dodo-color-default-500);
66
+ --dodo-ui-UtilityButton-disabled-color: var(--dodo-color-neutral-500);
67
67
  }
68
68
 
69
69
  .dodo-ui-UtilityButton {
@@ -80,7 +80,7 @@
80
80
  border: 0;
81
81
  outline: 0;
82
82
  padding: 0;
83
- color: var(--dodo-color-default-700);
83
+ color: var(--dodo-color-neutral-700);
84
84
  border-radius: 50%;
85
85
  font-family: inherit;
86
86
 
@@ -0,0 +1,46 @@
1
+ <script lang="ts">
2
+ import Swatches from './Swatches/Swatches.svelte';
3
+ import { colorPalette, colorPaletteBase, colorPaletteNeutral } from './utils/color.js';
4
+
5
+ interface ColorsProps {
6
+ swatchType?:
7
+ | 'base-colors'
8
+ | 'base-colors-neutral'
9
+ | 'colors'
10
+ | 'colors-neutral'
11
+ | 'colors-constant';
12
+ }
13
+
14
+ const { swatchType }: ColorsProps = $props();
15
+ </script>
16
+
17
+ <div class="Colors">
18
+ {#if swatchType === 'base-colors'}
19
+ {#each colorPaletteBase as colorPaletteItem (colorPaletteItem)}
20
+ <Swatches colorPalette={colorPaletteItem} prefix="--dodo-color-base-" isColorPaletteValues />
21
+ {/each}
22
+ {:else if swatchType === 'base-colors-neutral'}
23
+ {#each colorPaletteNeutral as colorPaletteItem (colorPaletteItem)}
24
+ <Swatches colorPalette={colorPaletteItem} prefix="--dodo-color-base-" />
25
+ {/each}
26
+ {:else if swatchType === 'colors'}
27
+ {#each colorPalette as colorPaletteItem (colorPaletteItem)}
28
+ <Swatches colorPalette={colorPaletteItem} isColorPaletteValues />
29
+ {/each}
30
+ {:else if swatchType === 'colors-neutral'}
31
+ {#each colorPaletteNeutral as colorPaletteItem (colorPaletteItem)}
32
+ <Swatches colorPalette={colorPaletteItem} />
33
+ {/each}
34
+ {:else if swatchType === 'colors-constant'}
35
+ {#each colorPaletteNeutral as colorPaletteItem (colorPaletteItem)}
36
+ <Swatches colorPalette={colorPaletteItem} prefix="--dodo-color-constant-" />
37
+ {/each}
38
+ {/if}
39
+ </div>
40
+
41
+ <style lang="scss">
42
+ .Colors {
43
+ display: flex;
44
+ flex-direction: column;
45
+ }
46
+ </style>
@@ -0,0 +1,23 @@
1
+ <script lang="ts">
2
+ import Palette from './Swatches/Palette.svelte';
3
+ </script>
4
+
5
+ <div class="Opacity">
6
+ <Palette backgroundColor="color-mix(in oklab, var(--dodo-color-primary-800) 10%, transparent)" />
7
+ <Palette backgroundColor="color-mix(in oklab, var(--dodo-color-primary-800) 20%, transparent)" />
8
+ <Palette backgroundColor="color-mix(in oklab, var(--dodo-color-primary-800) 30%, transparent)" />
9
+ <Palette backgroundColor="color-mix(in oklab, var(--dodo-color-primary-800) 40%, transparent)" />
10
+ <Palette backgroundColor="color-mix(in oklab, var(--dodo-color-primary-800) 50%, transparent)" />
11
+ <Palette backgroundColor="color-mix(in oklab, var(--dodo-color-primary-800) 60%, transparent)" />
12
+ <Palette backgroundColor="color-mix(in oklab, var(--dodo-color-primary-800) 70%, transparent)" />
13
+ <Palette backgroundColor="color-mix(in oklab, var(--dodo-color-primary-800) 80%, transparent)" />
14
+ <Palette backgroundColor="color-mix(in oklab, var(--dodo-color-primary-800) 90%, transparent)" />
15
+ <Palette backgroundColor="color-mix(in oklab, var(--dodo-color-primary-800) 100%, transparent)" />
16
+ </div>
17
+
18
+ <style lang="scss">
19
+ .Opacity {
20
+ display: flex;
21
+ flex-wrap: wrap;
22
+ }
23
+ </style>
@@ -0,0 +1,46 @@
1
+ <script lang="ts">
2
+ interface PaletteProps {
3
+ backgroundColor: string;
4
+ }
5
+
6
+ const { backgroundColor }: PaletteProps = $props();
7
+
8
+ function onclick() {
9
+ navigator.clipboard.writeText(backgroundColor);
10
+ }
11
+ </script>
12
+
13
+ <!-- svelte-ignore a11y_consider_explicit_label -->
14
+ <button
15
+ class="Palette"
16
+ style={`background-color: ${backgroundColor};`}
17
+ {onclick}
18
+ title="Click to copy value!"
19
+ ></button>
20
+
21
+ <style lang="scss">
22
+ .Palette {
23
+ display: flex;
24
+ width: 60px;
25
+ height: 60px;
26
+ border-radius: 4px;
27
+ border: 1px solid;
28
+ border-color: color-mix(in oklab, var(--dodo-color-neutral-800) 20%, transparent);
29
+ background: transparent;
30
+ min-width: initial;
31
+ margin: 0;
32
+ padding: 0;
33
+ cursor: pointer;
34
+ outline: 0;
35
+ transition: all 100ms;
36
+
37
+ &:hover {
38
+ border-width: 2px;
39
+ }
40
+
41
+ &:active {
42
+ border-color: color-mix(in oklab, var(--dodo-color-primary-800) 80%, transparent);
43
+ border-width: 2px;
44
+ }
45
+ }
46
+ </style>
@@ -0,0 +1,35 @@
1
+ <script lang="ts">
2
+ import Palette from './Palette.svelte';
3
+
4
+ interface SwatchProps {
5
+ colorPalette: string;
6
+ colorPaletteValue?: string;
7
+ prefix?: string;
8
+ }
9
+
10
+ const { colorPalette, colorPaletteValue, prefix = '--dodo-color-' }: SwatchProps = $props();
11
+ </script>
12
+
13
+ <div class="Swatch">
14
+ {#if colorPaletteValue}
15
+ <Palette backgroundColor={`var(${prefix}${colorPalette}-${colorPaletteValue})`} />
16
+ {:else}
17
+ <Palette backgroundColor={`var(${prefix}${colorPalette})`} />
18
+ {/if}
19
+
20
+ <div class="colorPaletteValue">{colorPaletteValue}</div>
21
+ </div>
22
+
23
+ <style lang="scss">
24
+ .Swatch {
25
+ color: var(--dodo-color-neutral-900);
26
+ display: flex;
27
+ align-items: center;
28
+ flex-direction: column;
29
+ margin: 4px;
30
+
31
+ .colorPaletteValue {
32
+ margin-top: 8px;
33
+ }
34
+ }
35
+ </style>
@@ -0,0 +1,55 @@
1
+ <script lang="ts">
2
+ import { colorPaletteValues } from '../utils/color.js';
3
+ import Swatch from './Swatch.svelte';
4
+
5
+ interface SwatchesProps {
6
+ colorPalette: string;
7
+ prefix?: string;
8
+ isColorPaletteValues?: boolean;
9
+ }
10
+
11
+ const { colorPalette, prefix, isColorPaletteValues = false }: SwatchesProps = $props();
12
+ </script>
13
+
14
+ <ul class="Swatches">
15
+ <b>{colorPalette}</b>
16
+
17
+ {#if isColorPaletteValues}
18
+ {#each colorPaletteValues as colorPaletteValue (colorPaletteValue)}
19
+ <li>
20
+ <Swatch {colorPalette} {colorPaletteValue} {prefix} />
21
+ </li>
22
+ {/each}
23
+ {:else}
24
+ <li>
25
+ <Swatch {colorPalette} {prefix} />
26
+ </li>
27
+ {/if}
28
+ </ul>
29
+
30
+ <style lang="scss">
31
+ .Swatches {
32
+ color: var(--dodo-color-neutral-900);
33
+ margin: 0;
34
+ padding: 0;
35
+ width: 150px;
36
+ margin: 16px 0;
37
+ display: flex;
38
+ width: 100%;
39
+
40
+ b {
41
+ text-transform: capitalize;
42
+ display: flex;
43
+ font-weight: 500;
44
+ width: 100px;
45
+ align-items: center;
46
+ margin-bottom: 30px;
47
+ }
48
+
49
+ li {
50
+ display: flex;
51
+ align-items: center;
52
+ margin-bottom: 10px;
53
+ }
54
+ }
55
+ </style>