kosui 0.0.28 → 0.0.30

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.
@@ -1,28 +1,184 @@
1
1
  <script lang="ts" module>
2
- import { Box, type BoxProps } from "../box/index.js";
3
- import { twMerge } from "tailwind-merge";
2
+ import {
3
+ COLORS,
4
+ RADII,
5
+ type Color,
6
+ type ColorProp,
7
+ type Radius,
8
+ type RadiusProp,
9
+ } from "../base.js";
10
+ import { mergeProps } from "../merge-props.js";
11
+ import type { Snippet } from "svelte";
12
+ import type { HTMLAttributes } from "svelte/elements";
4
13
 
5
- export type AlertProps = BoxProps;
14
+ export const ALERT_VARIANT = ["filled", "tonal", "plain"] as const;
15
+ export type AlertVariant = (typeof ALERT_VARIANT)[number];
16
+ export type AlertVariantProp = { variant?: AlertVariant };
17
+
18
+ export const ALERT_COLORS = COLORS;
19
+ export type AlertColor = Color;
20
+ export type AlertColorProp = ColorProp;
21
+
22
+ export type AlertOutlined = boolean;
23
+ export type AlertOutlinedProp = { outlined?: AlertOutlined };
24
+
25
+ export type AlertElevated = boolean;
26
+ export type AlertElevatedProp = { elevated?: AlertElevated };
27
+
28
+ export const ALERT_RADII = RADII;
29
+ export type AlertRadius = Radius;
30
+ export type AlertRadiusProp = RadiusProp;
31
+
32
+ export type AlertProps = {
33
+ children: Snippet<[]>;
34
+ } & AlertVariantProp &
35
+ AlertColorProp &
36
+ AlertRadiusProp &
37
+ AlertOutlinedProp &
38
+ AlertElevatedProp &
39
+ HTMLAttributes<HTMLDivElement>;
6
40
  </script>
7
41
 
8
42
  <script lang="ts">
9
- let {
10
- el = $bindable(),
11
- class: className,
12
- variant = "elevated",
43
+ const {
44
+ variant = "tonal",
13
45
  color = "primary",
14
- shape = "rounded",
15
- backdrop = true,
16
- ...restProps
46
+ radius = "sm",
47
+ outlined = false,
48
+ elevated = false,
49
+ children,
50
+ ...props
17
51
  }: AlertProps = $props();
18
52
  </script>
19
53
 
20
- <Box
21
- bind:el
22
- {variant}
23
- {color}
24
- {shape}
25
- {backdrop}
26
- class={twMerge("p-3", className)}
27
- {...restProps}
28
- />
54
+ <div
55
+ role="alert"
56
+ {...mergeProps(props, {
57
+ class: [
58
+ "base",
59
+ `radius-${radius}`,
60
+ `variant-${variant}`,
61
+ `color-${color}`,
62
+ outlined && "outlined",
63
+ elevated && "elevated",
64
+ ],
65
+ })}
66
+ >
67
+ {@render children()}
68
+ </div>
69
+
70
+ <style>
71
+ .base {
72
+ padding: calc(var(--spacing) * 4);
73
+ }
74
+
75
+ .elevated {
76
+ box-shadow:
77
+ 0 1px 3px 0 rgb(from var(--md-sys-color-shadow, rgb(0 0 0)) r g b / 0.2),
78
+ 0 1px 2px -1px
79
+ rgb(from var(--md-sys-color-shadow, rgb(0 0 0)) r g b / 0.2);
80
+ }
81
+
82
+ .variant-filled.color-primary {
83
+ background-color: var(--md-sys-color-primary);
84
+ color: var(--md-sys-color-on-primary);
85
+ }
86
+
87
+ .variant-filled.color-secondary {
88
+ background-color: var(--md-sys-color-secondary);
89
+ color: var(--md-sys-color-on-secondary);
90
+ }
91
+
92
+ .variant-filled.color-tertiary {
93
+ background-color: var(--md-sys-color-tertiary);
94
+ color: var(--md-sys-color-on-tertiary);
95
+ }
96
+
97
+ .variant-filled.color-error {
98
+ background-color: var(--md-sys-color-error);
99
+ color: var(--md-sys-color-on-error);
100
+ }
101
+
102
+ .variant-filled.color-plain {
103
+ background-color: var(--md-sys-color-inverse-surface);
104
+ color: var(--md-sys-color-inverse-on-surface);
105
+ }
106
+
107
+ .variant-tonal.color-primary {
108
+ background-color: var(--md-sys-color-primary-container);
109
+ color: var(--md-sys-color-on-primary-container);
110
+ }
111
+
112
+ .variant-tonal.color-secondary {
113
+ background-color: var(--md-sys-color-secondary-container);
114
+ color: var(--md-sys-color-on-secondary-container);
115
+ }
116
+
117
+ .variant-tonal.color-tertiary {
118
+ background-color: var(--md-sys-color-tertiary-container);
119
+ color: var(--md-sys-color-on-tertiary-container);
120
+ }
121
+
122
+ .variant-tonal.color-error {
123
+ background-color: var(--md-sys-color-error-container);
124
+ color: var(--md-sys-color-on-error-container);
125
+ }
126
+
127
+ .variant-tonal.color-plain {
128
+ background-color: var(--md-sys-color-surface-variant);
129
+ color: var(--md-sys-color-on-surface-variant);
130
+ }
131
+
132
+ .outlined {
133
+ border-width: 1px;
134
+ border-style: solid;
135
+ }
136
+
137
+ .outlined.color-primary {
138
+ border-color: var(--md-sys-color-primary);
139
+ }
140
+
141
+ .outlined.color-secondary {
142
+ border-color: var(--md-sys-color-secondary);
143
+ }
144
+
145
+ .outlined.color-tertiary {
146
+ border-color: var(--md-sys-color-tertiary);
147
+ }
148
+
149
+ .outlined.color-error {
150
+ border-color: var(--md-sys-color-error);
151
+ }
152
+
153
+ .outlined.color-plain {
154
+ border-color: var(--md-sys-color-outline);
155
+ }
156
+
157
+ .radius-none {
158
+ border-radius: 0;
159
+ }
160
+
161
+ .radius-xs {
162
+ border-radius: var(--radius-xs);
163
+ }
164
+
165
+ .radius-sm {
166
+ border-radius: var(--radius-sm);
167
+ }
168
+
169
+ .radius-md {
170
+ border-radius: var(--radius-lg);
171
+ }
172
+
173
+ .radius-lg {
174
+ border-radius: var(--radius-2xl);
175
+ }
176
+
177
+ .radius-xl {
178
+ border-radius: var(--radius-4xl);
179
+ }
180
+
181
+ .radius-full {
182
+ border-radius: calc(infinity * 1px);
183
+ }
184
+ </style>
@@ -1,5 +1,28 @@
1
- import { type BoxProps } from "../box/index.js";
2
- export type AlertProps = BoxProps;
3
- declare const Alert: import("svelte").Component<BoxProps, {}, "el">;
1
+ import { type Color, type ColorProp, type Radius, type RadiusProp } from "../base.js";
2
+ import type { Snippet } from "svelte";
3
+ import type { HTMLAttributes } from "svelte/elements";
4
+ export declare const ALERT_VARIANT: readonly ["filled", "tonal", "plain"];
5
+ export type AlertVariant = (typeof ALERT_VARIANT)[number];
6
+ export type AlertVariantProp = {
7
+ variant?: AlertVariant;
8
+ };
9
+ export declare const ALERT_COLORS: readonly ["primary", "secondary", "tertiary", "error", "plain", "inherit"];
10
+ export type AlertColor = Color;
11
+ export type AlertColorProp = ColorProp;
12
+ export type AlertOutlined = boolean;
13
+ export type AlertOutlinedProp = {
14
+ outlined?: AlertOutlined;
15
+ };
16
+ export type AlertElevated = boolean;
17
+ export type AlertElevatedProp = {
18
+ elevated?: AlertElevated;
19
+ };
20
+ export declare const ALERT_RADII: readonly ["none", "xs", "sm", "md", "lg", "xl", "full"];
21
+ export type AlertRadius = Radius;
22
+ export type AlertRadiusProp = RadiusProp;
23
+ export type AlertProps = {
24
+ children: Snippet<[]>;
25
+ } & AlertVariantProp & AlertColorProp & AlertRadiusProp & AlertOutlinedProp & AlertElevatedProp & HTMLAttributes<HTMLDivElement>;
26
+ declare const Alert: import("svelte").Component<AlertProps, {}, "">;
4
27
  type Alert = ReturnType<typeof Alert>;
5
28
  export default Alert;
@@ -1 +1 @@
1
- export { default as Alert, type AlertProps } from "./alert.svelte";
1
+ export { default as Alert, ALERT_COLORS, ALERT_RADII, ALERT_VARIANT, type AlertColor, type AlertColorProp, type AlertElevated, type AlertElevatedProp, type AlertOutlined, type AlertOutlinedProp, type AlertProps, type AlertRadius, type AlertRadiusProp, type AlertVariant, type AlertVariantProp, } from "./alert.svelte";
@@ -1 +1 @@
1
- export { default as Alert } from "./alert.svelte";
1
+ export { default as Alert, ALERT_COLORS, ALERT_RADII, ALERT_VARIANT, } from "./alert.svelte";
package/dist/base.d.ts CHANGED
@@ -3,7 +3,7 @@ export type Variant = (typeof VARIANTS)[number];
3
3
  export type VariantProp = {
4
4
  variant?: Variant;
5
5
  };
6
- export declare const COLORS: readonly ["primary", "secondary", "tertiary", "error", "inherit"];
6
+ export declare const COLORS: readonly ["primary", "secondary", "tertiary", "error", "plain", "inherit"];
7
7
  export type Color = (typeof COLORS)[number];
8
8
  export type ColorProp = {
9
9
  color?: Color;
@@ -13,12 +13,12 @@ export type Shape = (typeof SHAPES)[number];
13
13
  export type ShapeProp = {
14
14
  shape?: Shape;
15
15
  };
16
- export declare const SIZES: readonly ["xs", "sm", "md", "lg", "xl", "inherit"];
16
+ export declare const SIZES: readonly ["xs", "sm", "md", "lg", "xl"];
17
17
  export type Size = (typeof SIZES)[number];
18
18
  export type SizeProp = {
19
19
  size?: Size;
20
20
  };
21
- export declare const RADII: readonly ["xs", "sm", "md", "lg", "xl", "inherit"];
21
+ export declare const RADII: readonly ["none", "xs", "sm", "md", "lg", "xl", "full"];
22
22
  export type Radius = (typeof RADII)[number];
23
23
  export type RadiusProp = {
24
24
  radius?: Radius;
package/dist/base.js CHANGED
@@ -12,11 +12,12 @@ export const COLORS = [
12
12
  "secondary",
13
13
  "tertiary",
14
14
  "error",
15
+ "plain",
15
16
  "inherit",
16
17
  ];
17
18
  export const SHAPES = ["square", "rounded", "circle"];
18
- export const SIZES = ["xs", "sm", "md", "lg", "xl", "inherit"];
19
- export const RADII = ["xs", "sm", "md", "lg", "xl", "inherit"];
19
+ export const SIZES = ["xs", "sm", "md", "lg", "xl"];
20
+ export const RADII = ["none", "xs", "sm", "md", "lg", "xl", "full"];
20
21
  export const UNDERLINES = ["always", "hover", "none"];
21
22
  const hoverBaseClasses = ({ variant, color }) => twMerge("disabled:text-m3-on-surface/38 disabled:bg-m3-on-surface/12 disabled:cursor-not-allowed", variant === "filled" && "hover:opacity-90", variant === "tonal" && "hover:opacity-80", variant === "text" && "hover:opacity-80", variant === "elevated" &&
22
23
  color === "primary" &&
@@ -6,13 +6,13 @@ export type InputVariant = (typeof INPUT_VARIANTS)[number];
6
6
  export type InputVariantProp = {
7
7
  variant?: InputVariant;
8
8
  };
9
- export declare const INPUT_COLORS: readonly ["primary", "secondary", "tertiary", "error", "inherit"];
9
+ export declare const INPUT_COLORS: readonly ["primary", "secondary", "tertiary", "error", "plain", "inherit"];
10
10
  export type InputColor = Color;
11
11
  export type InputColorProp = ColorProp;
12
- export declare const INPUT_SIZES: readonly ["xs", "sm", "md", "lg", "xl", "inherit"];
12
+ export declare const INPUT_SIZES: readonly ["xs", "sm", "md", "lg", "xl"];
13
13
  export type InputSize = Size;
14
14
  export type InputSizeProp = SizeProp;
15
- export declare const INPUT_RADII: readonly ["xs", "sm", "md", "lg", "xl", "inherit"];
15
+ export declare const INPUT_RADII: readonly ["none", "xs", "sm", "md", "lg", "xl", "full"];
16
16
  export type InputRadius = Radius;
17
17
  export type InputRadiusProp = RadiusProp;
18
18
  export type InputProps = ElementRef & ClassName & InputVariantProp & InputSizeProp & InputRadiusProp & InputColorProp & Omit<HTMLInputAttributes, "size">;
@@ -15,9 +15,10 @@ export declare class SliderContext {
15
15
  markDotRenderer: Snippet<[SliderMarkDotProps]>;
16
16
  markLabelRenderer: Snippet<[SliderMarkLabelProps]>;
17
17
  sliderEl: HTMLDivElement;
18
- isHovered: boolean;
19
- isDragging: boolean;
20
- isFocused: boolean;
18
+ hovered: boolean;
19
+ clicked: boolean;
20
+ dragging: boolean;
21
+ focused: boolean;
21
22
  constructor(getValue: () => number, setValue: (val: number) => void, min: () => number, max: () => number, step: () => number, marks: () => Mark[], disabled: () => boolean, label: (value: number) => string, labelAlwaysOn: () => boolean, inverted: () => boolean, restrictToMarks: () => boolean, color: () => SliderColor, size: () => SliderSize, radius: () => SliderRadius, onChange: ((value: number) => void) | undefined, onChangeEnd: ((value: number) => void) | undefined, handleRenderer: Snippet<[SliderHandleProps]>, handleLabelRenderer: Snippet<[SliderHandleLabelProps]>, handleLabelArrowRenderer: Snippet<[SliderHandleLabelArrowProps]>, markRenderer: Snippet<[SliderMarkProps]>, markDotRenderer: Snippet<[SliderMarkDotProps]>, markLabelRenderer: Snippet<[SliderMarkLabelProps]>);
22
23
  get value(): number;
23
24
  set value(value: number);
@@ -34,6 +35,7 @@ export declare class SliderContext {
34
35
  get size(): SliderSize;
35
36
  get radius(): SliderRadius;
36
37
  get position(): number;
38
+ get animated(): boolean;
37
39
  clamp: (val: number, minVal: number, maxVal: number) => number;
38
40
  getValueFromPosition: (position: number) => number;
39
41
  getPositionFromValue: (val: number) => number;
@@ -24,9 +24,10 @@ export class SliderContext {
24
24
  markDotRenderer;
25
25
  markLabelRenderer;
26
26
  sliderEl;
27
- isHovered = $state(false);
28
- isDragging = $state(false);
29
- isFocused = $state(false);
27
+ hovered = $state(false);
28
+ clicked = $state(false);
29
+ dragging = $state(false);
30
+ focused = $state(false);
30
31
  constructor(getValue, setValue, min, max, step, marks, disabled, label, labelAlwaysOn, inverted, restrictToMarks, color, size, radius, onChange, onChangeEnd, handleRenderer, handleLabelRenderer, handleLabelArrowRenderer, markRenderer, markDotRenderer, markLabelRenderer) {
31
32
  this.#value = new Bindable(getValue());
32
33
  this.#value.bind(getValue, setValue);
@@ -97,6 +98,9 @@ export class SliderContext {
97
98
  get position() {
98
99
  return this.getPositionFromValue(this.value);
99
100
  }
101
+ get animated() {
102
+ return !this.dragging || this.restrictToMarks;
103
+ }
100
104
  clamp = (val, minVal, maxVal) => {
101
105
  return Math.min(Math.max(val, minVal), maxVal);
102
106
  };
@@ -125,23 +129,25 @@ export class SliderContext {
125
129
  pointerDown = (event) => {
126
130
  if (this.disabled)
127
131
  return;
128
- this.isDragging = true;
132
+ this.clicked = true;
129
133
  this.sliderEl.setPointerCapture(event.pointerId);
130
134
  this.value = this.getValueFromPosition(event.clientX);
131
135
  event.preventDefault();
132
136
  event.stopImmediatePropagation();
133
137
  };
134
138
  pointerMove = (event) => {
135
- if (this.disabled || !this.isDragging)
139
+ if (this.disabled || !this.clicked)
136
140
  return;
141
+ this.dragging = true;
137
142
  this.value = this.getValueFromPosition(event.clientX);
138
143
  event.preventDefault();
139
144
  event.stopImmediatePropagation();
140
145
  };
141
146
  pointerUp = (event) => {
142
- if (this.disabled || !this.isDragging)
147
+ if (this.disabled || !this.clicked)
143
148
  return;
144
- this.isDragging = false;
149
+ this.dragging = false;
150
+ this.clicked = false;
145
151
  this.sliderEl.releasePointerCapture(event.pointerId);
146
152
  this.onChangeEnd?.(this.value);
147
153
  event.preventDefault();
@@ -175,10 +181,10 @@ export class SliderContext {
175
181
  this.onChangeEnd?.(this.value);
176
182
  };
177
183
  focus = () => {
178
- this.isFocused = true;
184
+ this.focused = true;
179
185
  };
180
186
  blur = () => {
181
- this.isFocused = false;
187
+ this.focused = false;
182
188
  };
183
189
  }
184
190
  export function setSliderContext(state) {
@@ -12,7 +12,11 @@
12
12
 
13
13
  const showLabel = $derived(
14
14
  !ctx.disabled &&
15
- (ctx.labelAlwaysOn || ctx.isHovered || ctx.isDragging || ctx.isFocused),
15
+ (ctx.labelAlwaysOn ||
16
+ ctx.clicked ||
17
+ ctx.hovered ||
18
+ ctx.dragging ||
19
+ ctx.focused),
16
20
  );
17
21
  </script>
18
22
 
@@ -18,8 +18,9 @@
18
18
  <div class="relative">
19
19
  <div
20
20
  class={twMerge(
21
- "border-2 border-m3-surface shadow-md transition-all",
21
+ "border-2 border-m3-surface shadow-md",
22
22
 
23
+ ctx.animated && "transition-all",
23
24
  !ctx.disabled && "hover:scale-110 focus:scale-110 active:scale-110",
24
25
 
25
26
  ctx.color === "primary" && "bg-m3-primary",
@@ -33,17 +34,19 @@
33
34
  ctx.size === "lg" && "size-6",
34
35
  ctx.size === "xl" && "size-7",
35
36
 
37
+ ctx.radius === "none" && "rounded-none",
36
38
  ctx.radius === "xs" && "rounded-xs",
37
39
  ctx.radius === "sm" && "rounded-sm",
38
40
  ctx.radius === "md" && "rounded-lg",
39
41
  ctx.radius === "lg" && "rounded-2xl",
40
- ctx.radius === "xl" && "rounded-full",
42
+ ctx.radius === "xl" && "rounded-4xl",
43
+ ctx.radius === "full" && "rounded-full",
41
44
 
42
45
  className,
43
46
  )}
44
47
  {...mergeProps(restProps, {
45
- onpointerenter: () => (ctx.isHovered = true),
46
- onpointerleave: () => (ctx.isHovered = false),
48
+ onpointerenter: () => (ctx.hovered = true),
49
+ onpointerleave: () => (ctx.hovered = false),
47
50
  })}
48
51
  ></div>
49
52
 
@@ -98,7 +98,7 @@
98
98
  class: className,
99
99
  color = "primary",
100
100
  size = "md",
101
- radius = "xl",
101
+ radius = "full",
102
102
  ...restProps
103
103
  }: SliderProps = $props();
104
104
 
@@ -128,6 +128,16 @@
128
128
  sliderMarkLabel,
129
129
  ),
130
130
  );
131
+
132
+ const SIZE_RATIO: Record<Size, number> = {
133
+ xs: 1.5,
134
+ sm: 2,
135
+ md: 2.5,
136
+ lg: 3,
137
+ xl: 3.5,
138
+ };
139
+
140
+ let ratio = $derived(SIZE_RATIO[ctx.size]);
131
141
  </script>
132
142
 
133
143
  {#snippet defaultSliderHandle(props: SliderHandleProps)}
@@ -156,23 +166,26 @@
156
166
 
157
167
  <!-- Track -->
158
168
  <div
159
- bind:this={ctx.sliderEl}
160
169
  class={twMerge(
161
- "relative w-full cursor-pointer touch-none bg-m3-surface-container-highest select-none",
170
+ "cursor-pointer bg-m3-surface-container-highest px-2 select-none",
162
171
 
163
172
  ctx.disabled && "cursor-not-allowed opacity-50",
164
173
 
174
+ ctx.radius === "none" && "rounded-none",
165
175
  ctx.radius === "xs" && "rounded-xs",
166
176
  ctx.radius === "sm" && "rounded-sm",
167
177
  ctx.radius === "md" && "rounded-lg",
168
178
  ctx.radius === "lg" && "rounded-2xl",
169
179
  ctx.radius === "xl" && "rounded-4xl",
180
+ ctx.radius === "full" && "rounded-full",
181
+
182
+ ctx.size === "xs" && "my-1 h-0.5 px-1.5",
183
+ ctx.size === "sm" && "my-1 h-1 px-2",
184
+ ctx.size === "md" && "my-1 h-2 px-2.5",
185
+ ctx.size === "lg" && "my-1 h-3 px-3",
186
+ ctx.size === "xl" && "my-1 h-4 px-3.5",
170
187
 
171
- ctx.size === "xs" && "my-2.5 h-0.5",
172
- ctx.size === "sm" && "my-3 h-1",
173
- ctx.size === "md" && "my-3.5 h-2",
174
- ctx.size === "lg" && "my-4 h-3",
175
- ctx.size === "xl" && "my-4.5 h-4",
188
+ marks.length > 0 && "mb-6",
176
189
 
177
190
  className,
178
191
  )}
@@ -191,37 +204,46 @@
191
204
  onblur: ctx.blur,
192
205
  })}
193
206
  >
194
- <!-- Filled track -->
195
- <div
196
- class={twMerge(
197
- "absolute top-1/2 h-full -translate-y-1/2 transition-all",
198
-
199
- ctx.color === "primary" && "bg-m3-primary",
200
- ctx.color === "secondary" && "bg-m3-secondary",
201
- ctx.color === "tertiary" && "bg-m3-tertiary",
202
- ctx.color === "error" && "bg-m3-error",
203
-
204
- ctx.radius === "xs" && "rounded-xs",
205
- ctx.radius === "sm" && "rounded-sm",
206
- ctx.radius === "md" && "rounded-lg",
207
- ctx.radius === "lg" && "rounded-2xl",
208
- ctx.radius === "xl" && "rounded-4xl",
209
- )}
210
- style={ctx.inverted
211
- ? `right: 0; width: ${100 - ctx.position}%`
212
- : `left: 0; width: ${ctx.position}%`}
213
- ></div>
214
-
215
- <!-- Marks -->
216
- {#each marks as { value, label } (value)}
217
- {@render ctx.markRenderer({ value, label })}
218
- {/each}
219
-
220
- <!-- Handle -->
221
- <div
222
- class="absolute top-1/2 -translate-x-1/2 -translate-y-1/2 transition-all"
223
- style={`left: ${ctx.position}%`}
224
- >
225
- {@render ctx.handleRenderer({})}
207
+ <div bind:this={ctx.sliderEl} class="relative h-full">
208
+ <!-- Filled track -->
209
+ <div
210
+ class={twMerge(
211
+ "absolute h-full",
212
+
213
+ ctx.animated && "transition-all",
214
+
215
+ ctx.color === "primary" && "bg-m3-primary",
216
+ ctx.color === "secondary" && "bg-m3-secondary",
217
+ ctx.color === "tertiary" && "bg-m3-tertiary",
218
+ ctx.color === "error" && "bg-m3-error",
219
+
220
+ ctx.radius === "none" && "rounded-none",
221
+ ctx.radius === "xs" && "rounded-xs",
222
+ ctx.radius === "sm" && "rounded-sm",
223
+ ctx.radius === "md" && "rounded-lg",
224
+ ctx.radius === "lg" && "rounded-2xl",
225
+ ctx.radius === "xl" && "rounded-4xl",
226
+ ctx.radius === "full" && "rounded-full",
227
+ )}
228
+ style={ctx.inverted
229
+ ? `right: 0; margin-right: calc(var(--spacing) * -${ratio}); width: calc(${100 - ctx.position}% + var(--spacing) * ${ratio})`
230
+ : `left: 0; margin-left: calc(var(--spacing) * -${ratio}); width: calc(${ctx.position}% + var(--spacing) * ${ratio})`}
231
+ ></div>
232
+
233
+ <!-- Marks -->
234
+ {#each marks as { value, label } (value)}
235
+ {@render ctx.markRenderer({ value, label })}
236
+ {/each}
237
+
238
+ <!-- Handle -->
239
+ <div
240
+ class={twMerge(
241
+ "absolute top-1/2 -translate-x-1/2 -translate-y-1/2",
242
+ ctx.animated && "transition-all",
243
+ )}
244
+ style={`left: ${ctx.position}%`}
245
+ >
246
+ {@render ctx.handleRenderer({})}
247
+ </div>
226
248
  </div>
227
249
  </div>
@@ -3,13 +3,13 @@ import { type SliderHandleLabelArrowProps, type SliderHandleLabelProps, type Sli
3
3
  import type { ClassName } from "../utils.js";
4
4
  import type { Snippet } from "svelte";
5
5
  import type { HTMLAttributes } from "svelte/elements";
6
- export declare const SLIDER_COLORS: readonly ["primary", "secondary", "tertiary", "error", "inherit"];
6
+ export declare const SLIDER_COLORS: readonly ["primary", "secondary", "tertiary", "error", "plain", "inherit"];
7
7
  export type SliderColor = Color;
8
8
  export type SliderColorProp = ColorProp;
9
- export declare const SLIDER_SIZES: readonly ["xs", "sm", "md", "lg", "xl", "inherit"];
9
+ export declare const SLIDER_SIZES: readonly ["xs", "sm", "md", "lg", "xl"];
10
10
  export type SliderSize = Size;
11
11
  export type SliderSizeProp = SizeProp;
12
- export declare const SLIDER_RADII: readonly ["xs", "sm", "md", "lg", "xl", "inherit"];
12
+ export declare const SLIDER_RADII: readonly ["none", "xs", "sm", "md", "lg", "xl", "full"];
13
13
  export type SliderRadius = Radius;
14
14
  export type SliderRadiusProp = RadiusProp;
15
15
  export type Mark = {
@@ -3,13 +3,13 @@ import { type SwitchThumbProps } from "./index.js";
3
3
  import type { ClassName } from "../utils.js";
4
4
  import type { Snippet } from "svelte";
5
5
  import type { HTMLButtonAttributes } from "svelte/elements";
6
- export declare const SWITCH_COLORS: readonly ["primary", "secondary", "tertiary", "error", "inherit"];
6
+ export declare const SWITCH_COLORS: readonly ["primary", "secondary", "tertiary", "error", "plain", "inherit"];
7
7
  export type SwitchColor = Color;
8
8
  export type SwitchColorProp = ColorProp;
9
- export declare const SWITCH_SIZES: readonly ["xs", "sm", "md", "lg", "xl", "inherit"];
9
+ export declare const SWITCH_SIZES: readonly ["xs", "sm", "md", "lg", "xl"];
10
10
  export type SwitchSize = Size;
11
11
  export type SwitchSizeProp = SizeProp;
12
- export declare const SWITCH_RADII: readonly ["xs", "sm", "md", "lg", "xl", "inherit"];
12
+ export declare const SWITCH_RADII: readonly ["none", "xs", "sm", "md", "lg", "xl", "full"];
13
13
  export type SwitchRadius = Radius;
14
14
  export type SwitchRadiusProp = RadiusProp;
15
15
  export type SwitchProps = {
@@ -6,13 +6,13 @@ export type TextareaVariant = (typeof TEXTAREA_VARIANTS)[number];
6
6
  export type TextareaVariantProp = {
7
7
  variant?: TextareaVariant;
8
8
  };
9
- export declare const TEXTAREA_COLORS: readonly ["primary", "secondary", "tertiary", "error", "inherit"];
9
+ export declare const TEXTAREA_COLORS: readonly ["primary", "secondary", "tertiary", "error", "plain", "inherit"];
10
10
  export type TextareaColor = Color;
11
11
  export type TextareaColorProp = ColorProp;
12
- export declare const TEXTAREA_SIZES: readonly ["xs", "sm", "md", "lg", "xl", "inherit"];
12
+ export declare const TEXTAREA_SIZES: readonly ["xs", "sm", "md", "lg", "xl"];
13
13
  export type TextareaSize = Size;
14
14
  export type TextareaSizeProp = SizeProp;
15
- export declare const TEXTAREA_RADII: readonly ["xs", "sm", "md", "lg", "xl", "inherit"];
15
+ export declare const TEXTAREA_RADII: readonly ["none", "xs", "sm", "md", "lg", "xl", "full"];
16
16
  export type TextareaRadius = Radius;
17
17
  export type TextareaRadiusProp = RadiusProp;
18
18
  export type TextareaProps = ClassName & TextareaVariantProp & TextareaSizeProp & TextareaRadiusProp & TextareaColorProp & Omit<HTMLTextareaAttributes, "size">;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kosui",
3
- "version": "0.0.28",
3
+ "version": "0.0.30",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {