@flightlesslabs/dodo-ui 0.14.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.
- package/dist/index.d.ts +13 -0
- package/dist/index.js +8 -0
- package/dist/stories/components/Form/Checkbox/Checkbox.stories.svelte +39 -0
- package/dist/stories/components/Form/Checkbox/Checkbox.stories.svelte.d.ts +21 -0
- package/dist/stories/components/Form/Checkbox/Checkbox.svelte +452 -0
- package/dist/stories/components/Form/Checkbox/Checkbox.svelte.d.ts +42 -0
- package/dist/stories/components/Form/Checkbox/Color/Color.stories.svelte +19 -0
- package/dist/stories/components/Form/Checkbox/Color/Color.stories.svelte.d.ts +26 -0
- package/dist/stories/components/Form/Checkbox/Customize/Customize.stories.svelte +27 -0
- package/dist/stories/components/Form/Checkbox/Customize/Customize.stories.svelte.d.ts +18 -0
- package/dist/stories/components/Form/Checkbox/Events/Events.stories.svelte +35 -0
- package/dist/stories/components/Form/Checkbox/Events/Events.stories.svelte.d.ts +18 -0
- package/dist/stories/components/Form/Checkbox/Roundness/Roundness.stories.svelte +22 -0
- package/dist/stories/components/Form/Checkbox/Roundness/Roundness.stories.svelte.d.ts +26 -0
- package/dist/stories/components/Form/Checkbox/Size/Size.stories.svelte +16 -0
- package/dist/stories/components/Form/Checkbox/Size/Size.stories.svelte.d.ts +26 -0
- package/dist/stories/components/Form/Checkbox/utils/scss/mixins.scss +80 -0
- package/dist/stories/components/Form/Radio/Color/Color.stories.svelte +19 -0
- package/dist/stories/components/Form/Radio/Color/Color.stories.svelte.d.ts +26 -0
- package/dist/stories/components/Form/Radio/Events/Events.stories.svelte +32 -0
- package/dist/stories/components/Form/Radio/Events/Events.stories.svelte.d.ts +18 -0
- package/dist/stories/components/Form/Radio/Radio.stories.svelte +39 -0
- package/dist/stories/components/Form/Radio/Radio.stories.svelte.d.ts +21 -0
- package/dist/stories/components/Form/Radio/Radio.svelte +413 -0
- package/dist/stories/components/Form/Radio/Radio.svelte.d.ts +36 -0
- package/dist/stories/components/Form/Radio/Roundness/Roundness.stories.svelte +22 -0
- package/dist/stories/components/Form/Radio/Roundness/Roundness.stories.svelte.d.ts +26 -0
- package/dist/stories/components/Form/Radio/Size/Size.stories.svelte +16 -0
- package/dist/stories/components/Form/Radio/Size/Size.stories.svelte.d.ts +26 -0
- package/dist/stories/components/Form/Radio/utils/scss/mixins.scss +85 -0
- package/dist/stories/components/Form/Toggle/Toggle.svelte +30 -40
- package/dist/stories/components/Form/Toggle/Toggle.svelte.d.ts +2 -0
- package/dist/stories/components/Form/Toggle/utils/scss/mixins.scss +1 -14
- package/dist/stories/components/Layout/Grid/Column/Column.stories.svelte +18 -0
- package/dist/stories/components/Layout/Grid/Column/Column.stories.svelte.d.ts +21 -0
- package/dist/stories/components/Layout/Grid/Column/Column.svelte +73 -0
- package/dist/stories/components/Layout/Grid/Column/Column.svelte.d.ts +24 -0
- package/dist/stories/components/Layout/Grid/Grid.stories.svelte +179 -0
- package/dist/stories/components/Layout/Grid/Grid.stories.svelte.d.ts +21 -0
- package/dist/stories/components/Layout/Grid/Grid.svelte +24 -0
- package/dist/stories/components/Layout/Grid/Grid.svelte.d.ts +16 -0
- package/dist/stories/components/Layout/Grid/Row/Row.stories.svelte +19 -0
- package/dist/stories/components/Layout/Grid/Row/Row.stories.svelte.d.ts +21 -0
- package/dist/stories/components/Layout/Grid/Row/Row.svelte +20 -0
- package/dist/stories/components/Layout/Grid/Row/Row.svelte.d.ts +12 -0
- package/dist/styles/global.css +0 -1
- package/dist/styles/scss/_breakpoints.scss +5 -0
- package/dist/styles/scss/index.scss +1 -0
- package/package.json +4 -3
- package/src/lib/index.ts +19 -0
- package/src/lib/stories/components/Form/Checkbox/Checkbox.svelte +323 -0
- package/src/lib/stories/components/Form/Checkbox/utils/scss/mixins.scss +80 -0
- package/src/lib/stories/components/Form/Radio/Radio.svelte +278 -0
- package/src/lib/stories/components/Form/Radio/utils/scss/mixins.scss +85 -0
- package/src/lib/stories/components/Form/Toggle/Toggle.svelte +31 -3
- package/src/lib/stories/components/Form/Toggle/utils/scss/mixins.scss +1 -14
- package/src/lib/stories/components/Layout/Grid/Column/Column.svelte +127 -0
- package/src/lib/stories/components/Layout/Grid/Grid.svelte +47 -0
- package/src/lib/stories/components/Layout/Grid/Row/Row.svelte +36 -0
- package/src/lib/styles/global.css +0 -1
- package/src/lib/styles/scss/_breakpoints.scss +5 -0
- package/src/lib/styles/scss/index.scss +1 -0
- package/dist/styles/_breakpoint.css +0 -10
- package/src/lib/styles/_breakpoint.css +0 -10
|
@@ -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;
|
package/dist/styles/global.css
CHANGED
|
@@ -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.
|
|
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": {
|
|
@@ -74,7 +75,7 @@
|
|
|
74
75
|
"publint": "^0.3.12",
|
|
75
76
|
"sass": "^1.89.2",
|
|
76
77
|
"storybook": "^9.0.18",
|
|
77
|
-
"svelte": "^5.37.
|
|
78
|
+
"svelte": "^5.37.1",
|
|
78
79
|
"svelte-check": "^4.3.0",
|
|
79
80
|
"svelte-preprocess": "^6.0.3",
|
|
80
81
|
"typescript": "^5.8.3",
|
package/src/lib/index.ts
CHANGED
|
@@ -130,6 +130,14 @@ export type { RangeSliderProps } from '$lib/stories/components/Form/RangeSlider/
|
|
|
130
130
|
export { default as Toggle } from '$lib/stories/components/Form/Toggle/Toggle.svelte';
|
|
131
131
|
export type { ToggleProps } from '$lib/stories/components/Form/Toggle/Toggle.svelte';
|
|
132
132
|
|
|
133
|
+
/** Form: Checkbox */
|
|
134
|
+
export { default as Checkbox } from '$lib/stories/components/Form/Checkbox/Checkbox.svelte';
|
|
135
|
+
export type { CheckboxProps } from '$lib/stories/components/Form/Checkbox/Checkbox.svelte';
|
|
136
|
+
|
|
137
|
+
/** Form: Radio */
|
|
138
|
+
export { default as Radio } from '$lib/stories/components/Form/Radio/Radio.svelte';
|
|
139
|
+
export type { RadioProps } from '$lib/stories/components/Form/Radio/Radio.svelte';
|
|
140
|
+
|
|
133
141
|
/** Layout: Paper */
|
|
134
142
|
export { default as Paper } from '$lib/stories/components/Layout/Paper/Paper.svelte';
|
|
135
143
|
export type { PaperColor, PaperProps } from '$lib/stories/components/Layout/Paper/Paper.svelte';
|
|
@@ -155,6 +163,17 @@ export type {
|
|
|
155
163
|
DynamicMenuProps,
|
|
156
164
|
} from '$lib/stories/components/Layout/Menu/DynamicMenu/DynamicMenu.svelte';
|
|
157
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
|
+
|
|
158
177
|
/** Info: Calendar */
|
|
159
178
|
export { default as Calendar } from '$lib/stories/components/Info/Calendar/Calendar.svelte';
|
|
160
179
|
export type {
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { ComponentColor } from '$lib/types/colors.js';
|
|
3
|
+
import type { ComponentRoundness } from '$lib/types/roundness.js';
|
|
4
|
+
import type { ComponentSize } from '$lib/types/size.js';
|
|
5
|
+
import Icon from '@iconify/svelte';
|
|
6
|
+
|
|
7
|
+
import type { Snippet } from 'svelte';
|
|
8
|
+
import type { ChangeEventHandler } from 'svelte/elements';
|
|
9
|
+
|
|
10
|
+
export interface CheckboxProps {
|
|
11
|
+
/** Checkbox contents goes here */
|
|
12
|
+
children?: Snippet;
|
|
13
|
+
/** Checkbox ref */
|
|
14
|
+
ref?: HTMLInputElement;
|
|
15
|
+
/** How large should the checkbox be? */
|
|
16
|
+
size?: ComponentSize;
|
|
17
|
+
/** What color to use? */
|
|
18
|
+
color?: ComponentColor;
|
|
19
|
+
/** How round should the border radius be? */
|
|
20
|
+
roundness?: ComponentRoundness;
|
|
21
|
+
/** Checkbox disabled state */
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
/** Name */
|
|
24
|
+
name?: string;
|
|
25
|
+
/** value */
|
|
26
|
+
value?: string;
|
|
27
|
+
/** Id */
|
|
28
|
+
id?: string;
|
|
29
|
+
/** Title (for tooltip) */
|
|
30
|
+
title?: string;
|
|
31
|
+
/** Custom css class*/
|
|
32
|
+
class?: string;
|
|
33
|
+
/** onchange event handler */
|
|
34
|
+
onchange?: ChangeEventHandler<HTMLInputElement>;
|
|
35
|
+
/** checked */
|
|
36
|
+
checked?: boolean;
|
|
37
|
+
/** indeterminate */
|
|
38
|
+
indeterminate?: boolean;
|
|
39
|
+
/** Check Icon */
|
|
40
|
+
customCheckIcon?: (checked: boolean) => Snippet;
|
|
41
|
+
/** indeterminate Icon */
|
|
42
|
+
customIndeterminateIcon?: (checked: boolean) => Snippet;
|
|
43
|
+
}
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<script lang="ts">
|
|
47
|
+
let {
|
|
48
|
+
children,
|
|
49
|
+
size = 'normal',
|
|
50
|
+
color = 'primary',
|
|
51
|
+
roundness = 1,
|
|
52
|
+
name,
|
|
53
|
+
id,
|
|
54
|
+
title,
|
|
55
|
+
class: className = '',
|
|
56
|
+
disabled = false,
|
|
57
|
+
checked = $bindable<boolean>(),
|
|
58
|
+
indeterminate = false,
|
|
59
|
+
ref = $bindable<HTMLInputElement>(),
|
|
60
|
+
onchange,
|
|
61
|
+
customCheckIcon,
|
|
62
|
+
customIndeterminateIcon,
|
|
63
|
+
value,
|
|
64
|
+
}: CheckboxProps = $props();
|
|
65
|
+
|
|
66
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
67
|
+
let customCheckIconTyped = customCheckIcon as any;
|
|
68
|
+
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
70
|
+
let customIndeterminateIconTyped = customIndeterminateIcon as any;
|
|
71
|
+
</script>
|
|
72
|
+
|
|
73
|
+
{#snippet checkIconContent()}
|
|
74
|
+
{#if size === 'small'}
|
|
75
|
+
<Icon icon="material-symbols:check-rounded" width="24" height="24" />
|
|
76
|
+
{:else if size === 'large'}
|
|
77
|
+
<Icon icon="material-symbols:check-rounded" width="30" height="30" />
|
|
78
|
+
{:else}
|
|
79
|
+
<Icon icon="material-symbols:check-rounded" width="28" height="28" />
|
|
80
|
+
{/if}
|
|
81
|
+
{/snippet}
|
|
82
|
+
|
|
83
|
+
{#snippet indeterminateIconContent()}
|
|
84
|
+
{#if size === 'small'}
|
|
85
|
+
<Icon icon="material-symbols:check-indeterminate-small-rounded" width="28" height="28" />
|
|
86
|
+
{:else if size === 'large'}
|
|
87
|
+
<Icon icon="material-symbols:check-indeterminate-small-rounded" width="34" height="34" />
|
|
88
|
+
{:else}
|
|
89
|
+
<Icon icon="material-symbols:check-indeterminate-small-rounded" width="32" height="32" />
|
|
90
|
+
{/if}
|
|
91
|
+
{/snippet}
|
|
92
|
+
|
|
93
|
+
<label
|
|
94
|
+
class:disabled
|
|
95
|
+
class={[
|
|
96
|
+
'dodo-ui-Checkbox',
|
|
97
|
+
`size--${size}`,
|
|
98
|
+
`color--${color}`,
|
|
99
|
+
`roundness--${roundness}`,
|
|
100
|
+
className,
|
|
101
|
+
].join(' ')}
|
|
102
|
+
for={id}
|
|
103
|
+
>
|
|
104
|
+
<input
|
|
105
|
+
type="checkbox"
|
|
106
|
+
{name}
|
|
107
|
+
{id}
|
|
108
|
+
{title}
|
|
109
|
+
{disabled}
|
|
110
|
+
{onchange}
|
|
111
|
+
bind:this={ref}
|
|
112
|
+
bind:checked
|
|
113
|
+
{value}
|
|
114
|
+
/>
|
|
115
|
+
<div class="Checkbox">
|
|
116
|
+
<div class="CheckboxIcon">
|
|
117
|
+
{#if indeterminate && customIndeterminateIconTyped}
|
|
118
|
+
{@render customIndeterminateIconTyped(checked)}
|
|
119
|
+
{:else if indeterminate}
|
|
120
|
+
{@render indeterminateIconContent()}
|
|
121
|
+
{:else if customCheckIconTyped}
|
|
122
|
+
{@render customCheckIconTyped(checked)}
|
|
123
|
+
{:else}
|
|
124
|
+
{@render checkIconContent()}
|
|
125
|
+
{/if}
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
|
|
129
|
+
{#if children}
|
|
130
|
+
<div class="CheckboxMessage">
|
|
131
|
+
{@render children()}
|
|
132
|
+
</div>
|
|
133
|
+
{/if}
|
|
134
|
+
</label>
|
|
135
|
+
|
|
136
|
+
<style lang="scss">
|
|
137
|
+
@use 'utils/scss/mixins.scss' as *;
|
|
138
|
+
|
|
139
|
+
:global(:root) {
|
|
140
|
+
--dodo-ui-Checkbox-disabled-color: var(--dodo-color-neutral-400);
|
|
141
|
+
--dodo-ui-Checkbox-disabled-bg: var(--dodo-color-neutral-200);
|
|
142
|
+
--dodo-ui-Checkbox-border-disabled-color: var(--dodo-color-neutral-300);
|
|
143
|
+
|
|
144
|
+
--dodo-ui-Checkbox-border-color: var(--dodo-color-neutral-400);
|
|
145
|
+
|
|
146
|
+
@include generate-dodo-ui-checkbox-colors(neutral);
|
|
147
|
+
@include generate-dodo-ui-checkbox-colors(primary);
|
|
148
|
+
@include generate-dodo-ui-checkbox-colors(secondary);
|
|
149
|
+
@include generate-dodo-ui-checkbox-colors(safe);
|
|
150
|
+
@include generate-dodo-ui-checkbox-colors(warning);
|
|
151
|
+
@include generate-dodo-ui-checkbox-colors(danger);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
:global(.dodo-theme--dark) {
|
|
155
|
+
--dodo-ui-Checkbox-disabled-bg: var(--dodo-color-neutral-100);
|
|
156
|
+
--dodo-ui-Checkbox-disabled-color: var(--dodo-color-neutral-500);
|
|
157
|
+
--dodo-ui-Checkbox-border-disabled-color: var(--dodo-color-neutral-400);
|
|
158
|
+
|
|
159
|
+
--dodo-ui-Checkbox-border-color: var(--dodo-color-neutral-500);
|
|
160
|
+
|
|
161
|
+
@include generate-dodo-ui-checkbox-colors-dark(neutral);
|
|
162
|
+
@include generate-dodo-ui-checkbox-colors-dark(primary);
|
|
163
|
+
@include generate-dodo-ui-checkbox-colors-dark(secondary);
|
|
164
|
+
@include generate-dodo-ui-checkbox-colors-dark(safe);
|
|
165
|
+
@include generate-dodo-ui-checkbox-colors-dark(warning);
|
|
166
|
+
@include generate-dodo-ui-checkbox-colors-dark(danger);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.dodo-ui-Checkbox {
|
|
170
|
+
cursor: pointer;
|
|
171
|
+
outline: none;
|
|
172
|
+
display: inline-flex;
|
|
173
|
+
padding: 0;
|
|
174
|
+
margin: 0;
|
|
175
|
+
position: relative;
|
|
176
|
+
|
|
177
|
+
input {
|
|
178
|
+
opacity: 0;
|
|
179
|
+
width: 0;
|
|
180
|
+
height: 0;
|
|
181
|
+
position: absolute;
|
|
182
|
+
|
|
183
|
+
&:focus-visible {
|
|
184
|
+
& + .Checkbox {
|
|
185
|
+
outline: 1px solid;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
&:checked {
|
|
190
|
+
&:not([disabled]) {
|
|
191
|
+
& + .Checkbox {
|
|
192
|
+
.CheckboxIcon {
|
|
193
|
+
color: var(--dodo-color-constant-white);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
&[disabled] {
|
|
199
|
+
& + .Checkbox {
|
|
200
|
+
.CheckboxIcon {
|
|
201
|
+
color: var(--dodo-ui-Checkbox-disabled-color);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.CheckboxIcon {
|
|
209
|
+
color: transparent;
|
|
210
|
+
display: flex;
|
|
211
|
+
width: 100%;
|
|
212
|
+
height: 100%;
|
|
213
|
+
align-items: center;
|
|
214
|
+
justify-content: center;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.Checkbox {
|
|
218
|
+
transition: all 150ms;
|
|
219
|
+
text-decoration: none;
|
|
220
|
+
margin: 0;
|
|
221
|
+
display: inline-flex;
|
|
222
|
+
justify-content: center;
|
|
223
|
+
align-items: center;
|
|
224
|
+
font-family: inherit;
|
|
225
|
+
border-style: solid;
|
|
226
|
+
border-width: calc(var(--dodo-ui-element-border-width) * 2);
|
|
227
|
+
border-color: var(--dodo-ui-Checkbox-border-color);
|
|
228
|
+
outline: 0;
|
|
229
|
+
letter-spacing: 0.3px;
|
|
230
|
+
border-radius: inherit;
|
|
231
|
+
position: relative;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.CheckboxMessage {
|
|
235
|
+
display: flex;
|
|
236
|
+
align-items: center;
|
|
237
|
+
margin-left: var(--dodo-ui-space);
|
|
238
|
+
user-select: none;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
&.size {
|
|
242
|
+
&--normal {
|
|
243
|
+
font-size: 1rem;
|
|
244
|
+
|
|
245
|
+
.Checkbox {
|
|
246
|
+
height: calc(var(--dodo-ui-element-height-normal) / 1.2);
|
|
247
|
+
width: calc(var(--dodo-ui-element-height-normal) / 1.2);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
&--small {
|
|
252
|
+
font-size: 0.9rem;
|
|
253
|
+
|
|
254
|
+
.Checkbox {
|
|
255
|
+
height: calc(var(--dodo-ui-element-height-small) / 1.2);
|
|
256
|
+
width: calc(var(--dodo-ui-element-height-small) / 1.2);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
&--large {
|
|
261
|
+
font-size: 1.1rem;
|
|
262
|
+
|
|
263
|
+
.Checkbox {
|
|
264
|
+
height: calc(var(--dodo-ui-element-height-large) / 1.2);
|
|
265
|
+
width: calc(var(--dodo-ui-element-height-large) / 1.2);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
&.roundness {
|
|
271
|
+
&--1 {
|
|
272
|
+
border-radius: var(--dodo-ui-element-roundness-1);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
&--2 {
|
|
276
|
+
border-radius: var(--dodo-ui-element-roundness-2);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
&--3 {
|
|
280
|
+
border-radius: var(--dodo-ui-element-roundness-3);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
&--full {
|
|
284
|
+
border-radius: 50%;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
&.color {
|
|
289
|
+
@include generate-dodo-ui-checkbox-color(neutral);
|
|
290
|
+
@include generate-dodo-ui-checkbox-color(primary);
|
|
291
|
+
@include generate-dodo-ui-checkbox-color(secondary);
|
|
292
|
+
@include generate-dodo-ui-checkbox-color(safe);
|
|
293
|
+
@include generate-dodo-ui-checkbox-color(warning);
|
|
294
|
+
@include generate-dodo-ui-checkbox-color(danger);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
&.disabled {
|
|
298
|
+
cursor: initial;
|
|
299
|
+
color: var(--dodo-ui-Checkbox-disabled-color);
|
|
300
|
+
|
|
301
|
+
.Checkbox {
|
|
302
|
+
background-color: var(--dodo-ui-Checkbox-disabled-bg);
|
|
303
|
+
border-color: var(--dodo-ui-Checkbox-border-disabled-color);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
&:hover {
|
|
307
|
+
color: var(--dodo-ui-Checkbox-disabled-color);
|
|
308
|
+
|
|
309
|
+
.Checkbox {
|
|
310
|
+
background-color: var(--dodo-ui-Checkbox-disabled-bg);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
&:active {
|
|
315
|
+
color: var(--dodo-ui-Checkbox-disabled-color);
|
|
316
|
+
|
|
317
|
+
.Checkbox {
|
|
318
|
+
background-color: var(--dodo-ui-Checkbox-disabled-bg);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
</style>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/// Mixin: generate-dodo-ui-checkbox-colors
|
|
2
|
+
/// Generates CSS custom properties for Dodo UI checkbox 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-checkbox-colors($color-name) {
|
|
6
|
+
--dodo-ui-Checkbox-#{$color-name}-bg: var(--dodo-color-#{$color-name}-200);
|
|
7
|
+
--dodo-ui-Checkbox-#{$color-name}-hover-bg: var(--dodo-color-#{$color-name}-300);
|
|
8
|
+
--dodo-ui-Checkbox-#{$color-name}-active-bg: var(--dodo-color-#{$color-name}-400);
|
|
9
|
+
|
|
10
|
+
--dodo-ui-Checkbox-#{$color-name}-checked-bg: var(--dodo-color-#{$color-name}-500);
|
|
11
|
+
--dodo-ui-Checkbox-#{$color-name}-checked-hover-bg: var(--dodo-color-#{$color-name}-600);
|
|
12
|
+
--dodo-ui-Checkbox-#{$color-name}-checked-active-bg: var(--dodo-color-#{$color-name}-700);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/// Mixin: generate-dodo-ui-checkbox-colors
|
|
16
|
+
/// Generates CSS custom properties for Dodo UI checkbox styles (text & solid)
|
|
17
|
+
/// across different interaction states (default, hover, active).
|
|
18
|
+
/// @param {String} $color-name - The theme color name (e.g., "primary", "safe", etc.)
|
|
19
|
+
@mixin generate-dodo-ui-checkbox-colors-dark($color-name) {
|
|
20
|
+
--dodo-ui-Checkbox-#{$color-name}-bg: color-mix(
|
|
21
|
+
in oklab,
|
|
22
|
+
var(--dodo-color-#{$color-name}-50) 90%,
|
|
23
|
+
#fff
|
|
24
|
+
);
|
|
25
|
+
--dodo-ui-Checkbox-#{$color-name}-hover-bg: color-mix(
|
|
26
|
+
in oklab,
|
|
27
|
+
var(--dodo-color-#{$color-name}-100) 90%,
|
|
28
|
+
#fff
|
|
29
|
+
);
|
|
30
|
+
--dodo-ui-Checkbox-#{$color-name}-active-bg: color-mix(
|
|
31
|
+
in oklab,
|
|
32
|
+
var(--dodo-color-#{$color-name}-200) 90%,
|
|
33
|
+
#fff
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
--dodo-ui-Checkbox-#{$color-name}-checked-bg: var(--dodo-color-#{$color-name}-400);
|
|
37
|
+
--dodo-ui-Checkbox-#{$color-name}-checked-hover-bg: var(--dodo-color-#{$color-name}-300);
|
|
38
|
+
--dodo-ui-Checkbox-#{$color-name}-checked-active-bg: var(--dodo-color-#{$color-name}-200);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/// Mixin: generate-dodo-ui-checkbox-color
|
|
42
|
+
/// @param {String} $theme - e.g., default, safe, danger, etc.
|
|
43
|
+
@mixin generate-dodo-ui-checkbox-color($theme) {
|
|
44
|
+
&--#{$theme} {
|
|
45
|
+
.Checkbox {
|
|
46
|
+
background-color: var(--dodo-ui-Checkbox-#{$theme}-bg);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
input:checked:not([disabled]) {
|
|
50
|
+
& + .Checkbox {
|
|
51
|
+
background-color: var(--dodo-ui-Checkbox-#{$theme}-checked-bg);
|
|
52
|
+
border-color: transparent;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&:hover {
|
|
57
|
+
.Checkbox {
|
|
58
|
+
background-color: var(--dodo-ui-Checkbox-#{$theme}-hover-bg);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
input:checked:not([disabled]) {
|
|
62
|
+
& + .Checkbox {
|
|
63
|
+
background-color: var(--dodo-ui-Checkbox-#{$theme}-checked-hover-bg);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&:active {
|
|
69
|
+
.Checkbox {
|
|
70
|
+
background-color: var(--dodo-ui-Checkbox-#{$theme}-active-bg);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
input:checked:not([disabled]) {
|
|
74
|
+
& + .Checkbox {
|
|
75
|
+
background-color: var(--dodo-ui-Checkbox-#{$theme}-checked-active-bg);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|