lapikit 0.1.10 → 0.1.12

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,32 +1,29 @@
1
+ /* root */
1
2
  .kit-chip {
2
- --chip-color: var(--on, var(--kit-on-neutral));
3
- --chip-background: var(--base, var(--kit-neutral));
3
+ --chip-color: var(--on, var(--kit-on-container));
4
+ --chip-background: var(--base, var(--kit-container));
4
5
  --chip-radius: var(--shape, var(--kit-radius-full));
6
+ }
5
7
 
6
- display: inline-flex;
7
- align-items: center;
8
- justify-content: center;
9
- white-space: nowrap;
8
+ .kit-chip {
9
+ min-width: calc(var(--kit-spacing) * var(--chip-multiplier-x));
10
+ position: relative;
11
+ border: none;
12
+ outline: none;
10
13
  padding-top: var(--chip-spacing-x);
11
14
  padding-bottom: var(--chip-spacing-x);
12
15
  padding-right: var(--chip-spacing-y);
13
16
  padding-left: var(--chip-spacing-y);
14
-
15
- border-width: 1px;
16
- border-style: solid;
17
17
  border-radius: var(--chip-radius);
18
-
19
- /* theme */
20
18
  color: var(--chip-color);
21
- background-color: var(--chip-background);
22
- border-color: var(--chip-background);
19
+ font-weight: 500;
23
20
  }
24
21
 
25
- a.kit-chip,
26
- button.kit-chip {
22
+ .kit-chip:not(div):not(span) {
27
23
  cursor: pointer;
28
24
  }
29
25
 
26
+ .kit-chip,
30
27
  .kit-chip .kit-chip-content,
31
28
  .kit-chip .kit-chip-append,
32
29
  .kit-chip .kit-chip-prepend,
@@ -36,159 +33,192 @@ button.kit-chip {
36
33
  align-items: center;
37
34
  justify-content: center;
38
35
  white-space: nowrap;
39
- gap: var(--chip-gap);
36
+ gap: calc(var(--kit-spacing) * var(--chip-multiplier-gap));
37
+ font-size: calc(var(--kit-spacing) * var(--chip-multiplier-font-size));
38
+ }
39
+
40
+ .kit-chip:not(div):not(span)::after {
41
+ content: '';
42
+ position: absolute;
43
+ inset: 0;
44
+ background-color: currentColor;
45
+ opacity: 0;
46
+ transition: opacity 150ms ease;
47
+ pointer-events: none;
48
+ border-radius: inherit;
49
+ }
50
+ .kit-chip:not(div):not(span):hover::after {
51
+ opacity: 0.08;
52
+ }
53
+ .kit-chip:not(div):not(span):active::after {
54
+ opacity: 0.12;
55
+ }
56
+ .kit-chip:not(div):not(span):focus-visible::after {
57
+ opacity: 0.12;
40
58
  }
41
59
 
42
60
  /* size */
43
61
  .kit-chip[breakpoint]kit-chip--size-xs {
44
- --chip-height: 1.25rem;
62
+ --chip-multiplier-x: 12;
45
63
  --chip-multiplier-y: 2;
46
- --chip-gap: 0.25rem;
47
- font-size: 0.625rem;
48
- gap: var(--chip-gap);
64
+ --chip-multiplier-gap: 2;
65
+ --chip-multiplier-font-size: 6;
66
+ }
67
+ .kit-chip[breakpoint]kit-chip--size-xs .kit-icon[class*='kit-icon--size-md'] {
68
+ --icon-multiplier-parent-size: 7;
49
69
  }
50
70
 
51
71
  .kit-chip[breakpoint]kit-chip--size-sm {
52
- --chip-height: 1.625rem;
53
- --chip-multiplier-y: 3;
54
- --chip-gap: 0.5rem;
55
- font-size: 0.75rem;
56
- gap: var(--chip-gap);
72
+ --chip-multiplier-x: 14;
73
+ --chip-multiplier-y: 2;
74
+ --chip-multiplier-gap: 2;
75
+ --chip-multiplier-font-size: 6.5;
76
+ }
77
+ .kit-chip[breakpoint]kit-chip--size-sm .kit-icon[class*='kit-icon--size-md'] {
78
+ --icon-multiplier-parent-size: 8;
57
79
  }
58
80
 
59
81
  .kit-chip[breakpoint]kit-chip--size-md {
60
- --chip-height: 2rem;
61
- --chip-multiplier-y: 4;
62
- --chip-gap: 0.5rem;
63
- font-size: 0.875rem;
64
- gap: var(--chip-gap);
82
+ --chip-multiplier-x: 16;
83
+ --chip-multiplier-y: 3;
84
+ --chip-multiplier-gap: 4;
85
+ --chip-multiplier-font-size: 7;
86
+ }
87
+ .kit-chip[breakpoint]kit-chip--size-md .kit-icon[class*='kit-icon--size-md'] {
88
+ --icon-multiplier-parent-size: 9;
65
89
  }
66
90
 
67
91
  .kit-chip[breakpoint]kit-chip--size-lg {
68
- --chip-height: 2.375rem;
69
- --chip-multiplier-y: 5;
70
- --chip-gap: 0.5rem;
71
- font-size: 1rem;
72
- gap: var(--chip-gap);
92
+ --chip-multiplier-x: 18;
93
+ --chip-multiplier-y: 3;
94
+ --chip-multiplier-gap: 4;
95
+ --chip-multiplier-font-size: 8;
96
+ }
97
+ .kit-chip[breakpoint]kit-chip--size-lg .kit-icon[class*='kit-icon--size-md'] {
98
+ --icon-multiplier-parent-size: 10;
73
99
  }
74
100
 
75
101
  .kit-chip[breakpoint]kit-chip--size-xl {
76
- --chip-height: 2.75rem;
77
- --chip-multiplier-y: 6;
78
- --chip-gap: 0.675rem;
79
- font-size: 1.125rem;
80
- gap: var(--chip-gap);
102
+ --chip-multiplier-x: 20;
103
+ --chip-multiplier-y: 4;
104
+ --chip-multiplier-gap: 4;
105
+ --chip-multiplier-font-size: 9;
106
+ }
107
+ .kit-chip[breakpoint]kit-chip--size-xl .kit-icon[class*='kit-icon--size-md'] {
108
+ --icon-multiplier-parent-size: 11;
81
109
  }
82
110
 
83
111
  /* variant */
112
+ .kit-chip[breakpoint]kit-chip--variant-filled {
113
+ background-color: var(--chip-background);
114
+ }
115
+
84
116
  .kit-chip[breakpoint]kit-chip--variant-outline {
85
- --chip-color: var(--base, var(--kit-neutral));
117
+ --chip-color: var(--base, var(--kit-oncontainer));
86
118
  background-color: transparent;
119
+ }
120
+ .kit-chip[breakpoint]kit-chip--variant-outline::before {
121
+ content: '';
122
+ position: absolute;
123
+ inset: 0;
87
124
  border: 1px solid currentColor;
125
+ pointer-events: none;
126
+ border-radius: inherit;
88
127
  }
89
128
 
90
129
  /* density */
91
130
  .kit-chip[breakpoint]kit-chip--density-default {
92
- height: calc(var(--chip-height));
93
- min-width: calc(var(--chip-height));
131
+ height: calc(var(--kit-spacing) * var(--chip-multiplier-x));
94
132
  --chip-spacing-x: 0;
95
133
  --chip-spacing-y: calc(var(--kit-spacing) * var(--chip-multiplier-y));
96
134
  }
97
135
 
98
136
  .kit-chip[breakpoint]kit-chip--density-compact {
99
- height: calc(var(--chip-height) - 0.25rem);
100
- min-width: calc(var(--chip-height - 0.25rem));
137
+ height: calc(var(--kit-spacing) * var(--chip-multiplier-x) - 0.25rem);
101
138
  --chip-spacing-x: 0;
102
139
  --chip-spacing-y: calc(var(--kit-spacing) * var(--chip-multiplier-y) - 0.25rem);
103
140
  }
104
141
 
105
142
  .kit-chip[breakpoint]kit-chip--density-comfortable {
106
- height: calc(var(--chip-height) + 0.25rem);
107
- min-width: calc(var(--chip-height) + 0.25rem);
143
+ height: calc(var(--kit-spacing) * var(--chip-multiplier-x) + 0.25rem);
108
144
  --chip-spacing-x: 0;
109
145
  --chip-spacing-y: calc(var(--kit-spacing) * var(--chip-multiplier-y) + 0.25rem);
110
146
  }
111
147
 
112
148
  /* state */
113
- .kit-chip.kit-chip--info:not([class*='chip--variant-']) {
149
+ .kit-chip.kit-chip--info[class*='chip--variant-filled'] {
114
150
  --on: var(--kit-on-info);
115
151
  --base: var(--kit-info);
116
152
  }
117
- .kit-chip.kit-chip--info[class*='chip--variant-'] {
153
+ .kit-chip.kit-chip--info[class*='chip--variant-']:not([class*='variant-filled']) {
118
154
  --base: var(--kit-info);
119
155
  }
120
156
 
121
- .kit-chip.kit-chip--success:not([class*='chip--variant-']) {
157
+ .kit-chip.kit-chip--success[class*='chip--variant-filled'] {
122
158
  --on: var(--kit-on-success);
123
159
  --base: var(--kit-success);
124
160
  }
125
- .kit-chip.kit-chip--success[class*='chip--variant-'] {
161
+ .kit-chip.kit-chip--success[class*='chip--variant-']:not([class*='variant-filled']) {
126
162
  --base: var(--kit-success);
127
163
  }
128
164
 
129
- .kit-chip.kit-chip--warning:not([class*='chip--variant-']) {
165
+ .kit-chip.kit-chip--warning[class*='chip--variant-filled'] {
130
166
  --on: var(--kit-on-warning);
131
167
  --base: var(--kit-warning);
132
168
  }
133
- .kit-chip.kit-chip--warning[class*='chip--variant-'] {
169
+ .kit-chip.kit-chip--warning[class*='chip--variant-']:not([class*='variant-filled']) {
134
170
  --base: var(--kit-warning);
135
171
  }
136
172
 
137
- .kit-chip.kit-chip--error:not([class*='chip--variant-']) {
173
+ .kit-chip.kit-chip--error[class*='chip--variant-filled'] {
138
174
  --on: var(--kit-on-error);
139
175
  --base: var(--kit-error);
140
176
  }
141
- .kit-chip.kit-chip--error[class*='chip--variant-'] {
177
+ .kit-chip.kit-chip--error[class*='chip--variant-']:not([class*='variant-filled']) {
142
178
  --base: var(--kit-error);
143
179
  }
144
180
 
145
181
  /* events */
146
- .kit-chip.kit-chip--active:not([class*='chip--variant-']) {
182
+ .kit-chip[class*='chip--variant-filled']:active,
183
+ .kit-chip.kit-chip--active[class*='chip--variant-filled'] {
147
184
  background-color: color-mix(in oklab, var(--chip-background) 90%, var(--kit-scrim));
148
- border-color: color-mix(in oklab, var(--chip-background) 90%, var(--kit-scrim));
149
185
  }
150
- .kit-chip.kit-chip--active[class*='chip--variant-'] {
186
+ .kit-chip.kit-chip--active[class*='chip--variant-']:not([class*='variant-filled']):active,
187
+ .kit-chip.kit-chip--active[class*='chip--variant-']:not([class*='variant-filled']) {
151
188
  background-color: color-mix(in oklab, currentColor 15%, transparent);
152
- border-color: color-mix(in oklab, currentColor 15%, transparent);
153
- }
154
-
155
- .kit-chip:hover:not([class*='chip--variant-']) {
156
- background-color: color-mix(in oklab, var(--chip-background) 85%, var(--kit-scrim));
157
- border-color: color-mix(in oklab, var(--chip-background) 85%, var(--kit-scrim));
158
- }
159
- .kit-chip:hover[class*='chip--variant-'] {
160
- background-color: color-mix(in oklab, currentColor 25%, transparent);
161
189
  }
162
190
 
163
191
  /* disabled */
164
192
  .kit-chip.kit-chip--disabled,
165
- .kit-chip[disabled] {
193
+ .kit-chip[disabled],
194
+ .kit-chip.kit-chip--loading {
166
195
  pointer-events: none;
167
196
  user-select: none;
168
197
  cursor: default;
169
198
  }
170
- .kit-chip:not([class*='chip--variant-']).kit-chip--disabled {
199
+ .kit-chip[class*='chip--variant-filled'].kit-chip--disabled {
171
200
  color: color-mix(in oklab, var(--chip-color) 40%, transparent) !important;
172
201
  background-color: color-mix(in oklab, var(--chip-background) 70%, transparent) !important;
173
- border-color: color-mix(in oklab, var(--chip-background) 70%, transparent) !important;
174
202
  }
175
- .kit-chip:not([class*='chip--variant-']).kit-chip--disabled i:before {
203
+ .kit-chip[class*='chip--variant-filled'].kit-chip--disabled i:before {
176
204
  color: color-mix(in oklab, var(--chip-color) 40%, transparent) !important;
177
205
  }
178
- .kit-chip[class*='chip--variant-'].kit-chip--disabled,
179
- .kit-chip[class*='chip--variant-'].kit-chip--disabled i:before {
206
+ .kit-chip[class*='chip--variant-']:not([class*='variant-filled']).kit-chip--disabled,
207
+ .kit-chip[class*='chip--variant-']:not([class*='variant-filled']).kit-chip--disabled i::before {
180
208
  color: color-mix(in oklab, var(--chip-background) 40%, transparent) !important;
181
209
  }
182
210
 
183
- /* loading */
184
- .kit-chip.kit-chip--loading {
185
- pointer-events: none;
186
- user-select: none;
187
- cursor: default;
211
+ /* icon */
212
+ .kit-chip i::before,
213
+ .kit-chip .kit-icon {
214
+ --base-parent: var(--chip-color);
188
215
  }
189
- .kit-chip.kit-chip--loading > .kit-chip-content {
190
- color: transparent;
191
- opacity: 0;
216
+
217
+ /* loading */
218
+ .kit-chip.kit-chip--loading > .kit-chip-content,
219
+ .kit-chip.kit-chip--loading > .kit-chip-append,
220
+ .kit-chip.kit-chip--loading > .kit-chip-prepend {
221
+ visibility: hidden;
192
222
  }
193
223
  .kit-chip.kit-chip--loading > .kit-chip-loading {
194
224
  position: absolute;
@@ -6,6 +6,7 @@
6
6
  // external
7
7
  import LoadingFill from '../../assets/icons/loading-fill.svelte';
8
8
  import Close from '../../assets/icons/close-fill.svelte';
9
+ import { ripple } from '../../internal/ripple.js';
9
10
 
10
11
  let {
11
12
  children,
@@ -20,7 +21,7 @@
20
21
  dark,
21
22
  light,
22
23
  active,
23
- variant,
24
+ variant = 'filled',
24
25
  error,
25
26
  info,
26
27
  success,
@@ -35,10 +36,16 @@
35
36
  loading,
36
37
  rounded,
37
38
  closable,
39
+ noRipple,
38
40
  ...rest
39
41
  }: ChipProps = $props();
40
42
 
41
43
  const assets = getAssets();
44
+
45
+ $effect(() => {
46
+ const refProps = { ...rest };
47
+ if (refProps?.onclick) is = 'button';
48
+ });
42
49
  </script>
43
50
 
44
51
  {#if !closable || (open && closable)}
@@ -68,6 +75,9 @@
68
75
  aria-label={type !== 'button' ? label : undefined}
69
76
  disabled={href ? undefined : disabled}
70
77
  type={href ? undefined : type}
78
+ use:ripple={{
79
+ disabled: noRipple || disabled || is === 'div' || is === 'span'
80
+ }}
71
81
  style:--base={assets.color(background)}
72
82
  style:--on={assets.color(color)}
73
83
  style:--shape={assets.shape(rounded)}
@@ -85,17 +95,17 @@
85
95
  {/if}
86
96
 
87
97
  {#if prepend}
88
- <span class="kit-chip-prepend">
98
+ <div class="kit-chip-prepend">
89
99
  {@render prepend?.()}
90
- </span>
100
+ </div>
91
101
  {/if}
92
- <span class="kit-chip-content">
102
+ <div class="kit-chip-content">
93
103
  {@render children?.()}
94
- </span>
104
+ </div>
95
105
  {#if append}
96
- <span class="kit-chip-append">
106
+ <div class="kit-chip-append">
97
107
  {@render append?.()}
98
- </span>
108
+ </div>
99
109
  {/if}
100
110
 
101
111
  {#if closable}
@@ -10,7 +10,7 @@ export interface ChipProps extends Component {
10
10
  dark?: boolean;
11
11
  light?: boolean;
12
12
  href?: string;
13
- variant?: 'outline';
13
+ variant?: 'outline' | 'filled';
14
14
  density?: 'compact' | 'comfortable' | 'default';
15
15
  active?: boolean;
16
16
  loading?: boolean;
@@ -27,4 +27,5 @@ export interface ChipProps extends Component {
27
27
  type?: 'button';
28
28
  label?: string;
29
29
  closable?: boolean;
30
+ noRipple?: boolean;
30
31
  }
@@ -23,8 +23,8 @@
23
23
  }
24
24
 
25
25
  .kit-dialog .kit-dialog-container {
26
- --dialog-color: var(--on, var(--kit-on-neutral));
27
- --dialog-background: var(--base, var(--kit-neutral));
26
+ --dialog-color: var(--on, var(--kit-on-surface));
27
+ --dialog-background: var(--base, var(--kit-surface));
28
28
  --dialog-radius: var(--shape, var(--kit-radius-md));
29
29
 
30
30
  border-radius: var(--dialog-radius);
@@ -1,6 +1,6 @@
1
1
  .kit-dropdown-content {
2
- --dropdown-color: var(--on, var(--kit-on-neutral));
3
- --dropdown-background: var(--base, var(--kit-neutral));
2
+ --dropdown-color: var(--on, var(--kit-on-surface));
3
+ --dropdown-background: var(--base, var(--kit-surface));
4
4
  --dropdown-radius: var(--shape, var(--kit-radius-md));
5
5
 
6
6
  inset: 0px auto auto 0px;