kosui 0.0.32 → 0.0.34

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.
@@ -7,7 +7,6 @@
7
7
  type Radius,
8
8
  type RadiusProp,
9
9
  } from "../base.js";
10
- import { mergeProps } from "../merge-props.js";
11
10
  import type { Snippet } from "svelte";
12
11
  import type { HTMLAttributes } from "svelte/elements";
13
12
 
@@ -47,138 +46,123 @@
47
46
  outlined = false,
48
47
  elevated = false,
49
48
  children,
49
+ class: className,
50
50
  ...props
51
51
  }: AlertProps = $props();
52
52
  </script>
53
53
 
54
54
  <div
55
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
- })}
56
+ class={[
57
+ "base",
58
+ `variant-${variant}`,
59
+ `color-${color}`,
60
+ `radius-${radius}`,
61
+ outlined && "outlined",
62
+ elevated && "elevated",
63
+ className,
64
+ ]}
65
+ {...props}
66
66
  >
67
67
  {@render children()}
68
68
  </div>
69
69
 
70
- <style>@layer components {
71
- .base {
70
+ <style>@layer components { .radius-none {
71
+ --radius: none;
72
+ }
73
+
74
+ .radius-xs {
75
+ --radius: 0.125rem;
76
+ }
77
+
78
+ .radius-sm {
79
+ --radius: 0.25rem;
80
+ }
81
+
82
+ .radius-md {
83
+ --radius: 0.375rem;
84
+ }
85
+
86
+ .radius-lg {
87
+ --radius: 0.5rem;
88
+ }
89
+
90
+ .radius-xl {
91
+ --radius: 0.75rem;
92
+ }
93
+
94
+ .radius-2xl {
95
+ --radius: 1rem;
96
+ }
97
+
98
+ .radius-3xl {
99
+ --radius: 1.5rem;
100
+ }
101
+
102
+ .radius-4xl {
103
+ --radius: 2rem;
104
+ }
105
+
106
+ .radius-full {
107
+ --radius: calc(infinity * 1px);
108
+ }
109
+
110
+ .color-primary {
111
+ --color-main: var(--md-sys-color-primary);
112
+ --color-on-main: var(--md-sys-color-on-primary);
113
+ --color-tonal: var(--md-sys-color-primary-container);
114
+ --color-on-tonal: var(--md-sys-color-on-primary-container);
115
+ --color-shadow: var(--md-sys-color-shadow);
116
+ }
117
+
118
+ .color-secondary {
119
+ --color-main: var(--md-sys-color-secondary);
120
+ --color-on-main: var(--md-sys-color-on-secondary);
121
+ --color-tonal: var(--md-sys-color-secondary-container);
122
+ --color-on-tonal: var(--md-sys-color-on-secondary-container);
123
+ --color-shadow: var(--md-sys-color-shadow);
124
+ }
125
+
126
+ .color-tertiary {
127
+ --color-main: var(--md-sys-color-tertiary);
128
+ --color-on-main: var(--md-sys-color-on-tertiary);
129
+ --color-tonal: var(--md-sys-color-tertiary-container);
130
+ --color-on-tonal: var(--md-sys-color-on-tertiary-container);
131
+ --color-shadow: var(--md-sys-color-shadow);
132
+ }
133
+
134
+ .color-error {
135
+ --color-main: var(--md-sys-color-error);
136
+ --color-on-main: var(--md-sys-color-on-error);
137
+ --color-tonal: var(--md-sys-color-error-container);
138
+ --color-on-tonal: var(--md-sys-color-on-error-container);
139
+ --color-shadow: var(--md-sys-color-shadow);
140
+ }
141
+
142
+ .base {
72
143
  padding: calc(var(--spacing) * 4);
144
+ border-radius: var(--radius);
73
145
  }
74
146
 
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);
147
+ .variant-filled {
148
+ background-color: var(--color-main);
149
+ color: var(--color-on-main);
105
150
  }
106
151
 
107
- .variant-tonal.color-primary {
108
- background-color: var(--md-sys-color-primary-container);
109
- color: var(--md-sys-color-on-primary-container);
152
+ .variant-tonal {
153
+ background-color: var(--color-tonal);
154
+ color: var(--color-on-tonal);
110
155
  }
111
156
 
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 {
157
+ .outlined {
133
158
  border-width: 1px;
134
159
  border-style: solid;
160
+ border-color: var(--color-main);
135
161
  }
136
162
 
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);
163
+ .elevated {
164
+ box-shadow:
165
+ 0 1px 3px 0 rgb(from var(--color-shadow, rgb(0 0 0)) r g b / 0.2),
166
+ 0 1px 2px -1px rgb(from var(--color-shadow, rgb(0 0 0)) r g b / 0.2);
183
167
  }
184
168
  }</style>
@@ -17,7 +17,7 @@ export type AlertElevated = boolean;
17
17
  export type AlertElevatedProp = {
18
18
  elevated?: AlertElevated;
19
19
  };
20
- export declare const ALERT_RADII: readonly ["none", "xs", "sm", "md", "lg", "xl", "full"];
20
+ export declare const ALERT_RADII: readonly ["none", "xs", "sm", "md", "lg", "xl", "2xl", "3xl", "4xl", "full"];
21
21
  export type AlertRadius = Radius;
22
22
  export type AlertRadiusProp = RadiusProp;
23
23
  export type AlertProps = {
package/dist/base.css ADDED
@@ -0,0 +1,71 @@
1
+ .radius-none {
2
+ --radius: none;
3
+ }
4
+
5
+ .radius-xs {
6
+ --radius: 0.125rem;
7
+ }
8
+
9
+ .radius-sm {
10
+ --radius: 0.25rem;
11
+ }
12
+
13
+ .radius-md {
14
+ --radius: 0.375rem;
15
+ }
16
+
17
+ .radius-lg {
18
+ --radius: 0.5rem;
19
+ }
20
+
21
+ .radius-xl {
22
+ --radius: 0.75rem;
23
+ }
24
+
25
+ .radius-2xl {
26
+ --radius: 1rem;
27
+ }
28
+
29
+ .radius-3xl {
30
+ --radius: 1.5rem;
31
+ }
32
+
33
+ .radius-4xl {
34
+ --radius: 2rem;
35
+ }
36
+
37
+ .radius-full {
38
+ --radius: calc(infinity * 1px);
39
+ }
40
+
41
+ .color-primary {
42
+ --color-main: var(--md-sys-color-primary);
43
+ --color-on-main: var(--md-sys-color-on-primary);
44
+ --color-tonal: var(--md-sys-color-primary-container);
45
+ --color-on-tonal: var(--md-sys-color-on-primary-container);
46
+ --color-shadow: var(--md-sys-color-shadow);
47
+ }
48
+
49
+ .color-secondary {
50
+ --color-main: var(--md-sys-color-secondary);
51
+ --color-on-main: var(--md-sys-color-on-secondary);
52
+ --color-tonal: var(--md-sys-color-secondary-container);
53
+ --color-on-tonal: var(--md-sys-color-on-secondary-container);
54
+ --color-shadow: var(--md-sys-color-shadow);
55
+ }
56
+
57
+ .color-tertiary {
58
+ --color-main: var(--md-sys-color-tertiary);
59
+ --color-on-main: var(--md-sys-color-on-tertiary);
60
+ --color-tonal: var(--md-sys-color-tertiary-container);
61
+ --color-on-tonal: var(--md-sys-color-on-tertiary-container);
62
+ --color-shadow: var(--md-sys-color-shadow);
63
+ }
64
+
65
+ .color-error {
66
+ --color-main: var(--md-sys-color-error);
67
+ --color-on-main: var(--md-sys-color-on-error);
68
+ --color-tonal: var(--md-sys-color-error-container);
69
+ --color-on-tonal: var(--md-sys-color-on-error-container);
70
+ --color-shadow: var(--md-sys-color-shadow);
71
+ }
package/dist/base.d.ts CHANGED
@@ -18,7 +18,7 @@ export type Size = (typeof SIZES)[number];
18
18
  export type SizeProp = {
19
19
  size?: Size;
20
20
  };
21
- export declare const RADII: readonly ["none", "xs", "sm", "md", "lg", "xl", "full"];
21
+ export declare const RADII: readonly ["none", "xs", "sm", "md", "lg", "xl", "2xl", "3xl", "4xl", "full"];
22
22
  export type Radius = (typeof RADII)[number];
23
23
  export type RadiusProp = {
24
24
  radius?: Radius;
package/dist/base.js CHANGED
@@ -17,7 +17,18 @@ export const COLORS = [
17
17
  ];
18
18
  export const SHAPES = ["square", "rounded", "circle"];
19
19
  export const SIZES = ["xs", "sm", "md", "lg", "xl"];
20
- export const RADII = ["none", "xs", "sm", "md", "lg", "xl", "full"];
20
+ export const RADII = [
21
+ "none",
22
+ "xs",
23
+ "sm",
24
+ "md",
25
+ "lg",
26
+ "xl",
27
+ "2xl",
28
+ "3xl",
29
+ "4xl",
30
+ "full",
31
+ ];
21
32
  export const UNDERLINES = ["always", "hover", "none"];
22
33
  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" &&
23
34
  color === "primary" &&
@@ -12,7 +12,7 @@ export type InputColorProp = ColorProp;
12
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 ["none", "xs", "sm", "md", "lg", "xl", "full"];
15
+ export declare const INPUT_RADII: readonly ["none", "xs", "sm", "md", "lg", "xl", "2xl", "3xl", "4xl", "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">;
@@ -9,7 +9,7 @@ export type SliderColorProp = ColorProp;
9
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 ["none", "xs", "sm", "md", "lg", "xl", "full"];
12
+ export declare const SLIDER_RADII: readonly ["none", "xs", "sm", "md", "lg", "xl", "2xl", "3xl", "4xl", "full"];
13
13
  export type SliderRadius = Radius;
14
14
  export type SliderRadiusProp = RadiusProp;
15
15
  export type Mark = {
@@ -9,7 +9,7 @@ export type SwitchColorProp = ColorProp;
9
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 ["none", "xs", "sm", "md", "lg", "xl", "full"];
12
+ export declare const SWITCH_RADII: readonly ["none", "xs", "sm", "md", "lg", "xl", "2xl", "3xl", "4xl", "full"];
13
13
  export type SwitchRadius = Radius;
14
14
  export type SwitchRadiusProp = RadiusProp;
15
15
  export type SwitchProps = {
@@ -12,7 +12,7 @@ export type TextareaColorProp = ColorProp;
12
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 ["none", "xs", "sm", "md", "lg", "xl", "full"];
15
+ export declare const TEXTAREA_RADII: readonly ["none", "xs", "sm", "md", "lg", "xl", "2xl", "3xl", "4xl", "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.32",
3
+ "version": "0.0.34",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@floating-ui/dom": "^1.7.2",
31
- "@lucide/svelte": "^0.542.0",
31
+ "@lucide/svelte": "^0.545.0",
32
32
  "marked": "^16.1.1"
33
33
  },
34
34
  "peerDependencies": {
@@ -53,11 +53,11 @@
53
53
  "globals": "^16.0.0",
54
54
  "highlight.js": "^11.11.1",
55
55
  "highlight.svelte": "^0.1.3",
56
- "jsdom": "^26.1.0",
56
+ "jsdom": "^27.0.0",
57
57
  "postcss": "^8.5.6",
58
58
  "prettier": "^3.4.2",
59
59
  "prettier-plugin-svelte": "^3.3.3",
60
- "prettier-plugin-tailwindcss": "^0.6.11",
60
+ "prettier-plugin-tailwindcss": "^0.7.0",
61
61
  "publint": "^0.3.2",
62
62
  "svelte": "^5.0.0",
63
63
  "svelte-check": "^4.0.0",