lapikit 0.5.4 → 0.5.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.
@@ -1,5 +1,8 @@
1
1
  import type { RoundedType, Component } from '../../@types';
2
2
  import type { Snippet } from 'svelte';
3
+ export type ModelAccordionItemProps = {
4
+ open: boolean;
5
+ };
3
6
  export interface AccordionProps extends Component {
4
7
  ref?: HTMLElement | null;
5
8
  is?: 'div';
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { useClassName, useStyles } from '../../utils';
3
3
  import { makeComponentProps } from '../../html-mapped';
4
- import type { AlertDensity, AlertProps, AlertTone, AlertVariant } from './alert.types.js';
4
+ import type { AlertProps, AlertTone, AlertVariant, AlertDensity } from './alert.types.js';
5
5
 
6
6
  function resolveVariant(value: AlertVariant | undefined): AlertVariant {
7
7
  return value === 'filled' || value === 'outline' || value === 'text' ? value : 'filled';
@@ -13,25 +13,8 @@
13
13
  : 'default';
14
14
  }
15
15
 
16
- function resolveTone({
17
- tone,
18
- info,
19
- success,
20
- warning,
21
- error
22
- }: {
23
- tone?: AlertTone;
24
- info?: boolean;
25
- success?: boolean;
26
- warning?: boolean;
27
- error?: boolean;
28
- }): AlertTone {
29
- if (tone && ['default', 'info', 'success', 'warning', 'error'].includes(tone)) return tone;
30
- if (error) return 'error';
31
- if (warning) return 'warning';
32
- if (success) return 'success';
33
- if (info) return 'info';
34
- return 'default';
16
+ function resolveTone(value: AlertTone | undefined): AlertTone {
17
+ return value && ['info', 'success', 'warning', 'error'].includes(value) ? value : 'default';
35
18
  }
36
19
 
37
20
  let {
@@ -48,10 +31,6 @@
48
31
  density = 'default',
49
32
  rounded = 'md',
50
33
  tone = 'default',
51
- info = false,
52
- success = false,
53
- warning = false,
54
- error = false,
55
34
  color = undefined,
56
35
  background = undefined,
57
36
  prepend = undefined,
@@ -83,7 +62,7 @@
83
62
 
84
63
  let safeVariant = $derived(resolveVariant(variant));
85
64
  let safeDensity = $derived(resolveDensity(density));
86
- let safeTone = $derived(resolveTone({ tone, info, success, warning, error }));
65
+ let safeTone = $derived(resolveTone(tone));
87
66
  let mergedStyle = $derived(
88
67
  [
89
68
  baseStyle,
@@ -171,7 +150,7 @@
171
150
  .kit-alert[data-variant='outline'] {
172
151
  background: transparent;
173
152
  color: var(--kit-alert-fg);
174
- border-color: transparent;
153
+ border-color: var(--kit-alert-bd);
175
154
  }
176
155
 
177
156
  .kit-alert[data-variant='text'] {
@@ -185,29 +164,48 @@
185
164
  }
186
165
 
187
166
  .kit-alert[data-tone='info'] {
167
+ --kit-alert-tone-accent: hsl(var(--kit-h-info, 205) 60% 42%);
188
168
  --kit-alert-bg: hsl(var(--kit-h-info, 205) 90% 95%);
189
169
  --kit-alert-fg: hsl(var(--kit-h-info, 205) 36% 24%);
190
170
  --kit-alert-bd: hsl(var(--kit-h-info, 205) 45% 78%);
191
171
  }
192
172
 
193
173
  .kit-alert[data-tone='success'] {
174
+ --kit-alert-tone-accent: hsl(var(--kit-h-success, 145) 50% 38%);
194
175
  --kit-alert-bg: hsl(var(--kit-h-success, 145) 58% 93%);
195
176
  --kit-alert-fg: hsl(var(--kit-h-success, 145) 38% 23%);
196
177
  --kit-alert-bd: hsl(var(--kit-h-success, 145) 30% 75%);
197
178
  }
198
179
 
199
180
  .kit-alert[data-tone='warning'] {
181
+ --kit-alert-tone-accent: hsl(var(--kit-h-warning, 35) 80% 38%);
200
182
  --kit-alert-bg: hsl(var(--kit-h-warning, 35) 95% 92%);
201
183
  --kit-alert-fg: hsl(var(--kit-h-warning, 35) 55% 24%);
202
184
  --kit-alert-bd: hsl(var(--kit-h-warning, 35) 55% 72%);
203
185
  }
204
186
 
205
187
  .kit-alert[data-tone='error'] {
188
+ --kit-alert-tone-accent: hsl(var(--kit-h-danger, 5) 65% 45%);
206
189
  --kit-alert-bg: hsl(var(--kit-h-danger, 5) 90% 94%);
207
190
  --kit-alert-fg: hsl(var(--kit-h-danger, 5) 48% 28%);
208
191
  --kit-alert-bd: hsl(var(--kit-h-danger, 5) 55% 78%);
209
192
  }
210
193
 
194
+ .kit-alert[data-variant='outline'][data-tone='info'],
195
+ .kit-alert[data-variant='outline'][data-tone='success'],
196
+ .kit-alert[data-variant='outline'][data-tone='warning'],
197
+ .kit-alert[data-variant='outline'][data-tone='error'] {
198
+ --kit-alert-fg: var(--kit-alert-tone-accent);
199
+ --kit-alert-bd: var(--kit-alert-tone-accent);
200
+ }
201
+
202
+ .kit-alert[data-variant='text'][data-tone='info'],
203
+ .kit-alert[data-variant='text'][data-tone='success'],
204
+ .kit-alert[data-variant='text'][data-tone='warning'],
205
+ .kit-alert[data-variant='text'][data-tone='error'] {
206
+ --kit-alert-fg: var(--kit-alert-tone-accent);
207
+ }
208
+
211
209
  .kit-alert[data-density='compact'] {
212
210
  --kit-alert-py: 0.5rem;
213
211
  --kit-alert-px: 0.75rem;
@@ -12,10 +12,6 @@ export interface AlertProps extends Component {
12
12
  density?: AlertDensity;
13
13
  rounded?: RoundedType;
14
14
  tone?: AlertTone;
15
- info?: boolean;
16
- success?: boolean;
17
- warning?: boolean;
18
- error?: boolean;
19
15
  color?: string;
20
16
  background?: string;
21
17
  prepend?: Snippet;
@@ -1,4 +1,5 @@
1
1
  export type { ModelDropdownProps } from './dropdown/dropdown.types';
2
+ export type { ModelAccordionItemProps } from './accordion/accordion.types';
2
3
  export { default as KitApp } from './app/app.svelte';
3
4
  export { default as KitAppbar } from './appbar/appbar.svelte';
4
5
  export { default as KitBtn } from './btn/btn.svelte';
@@ -118,6 +118,7 @@
118
118
  --kit-list-item-px: var(--kit-list-item-px-md);
119
119
  --kit-list-item-gap: var(--kit-list-item-gap-md);
120
120
  --kit-list-item-font: var(--kit-list-item-font-md);
121
+ --kit-list-density-offset: 0rem;
121
122
 
122
123
  display: flex;
123
124
  flex-direction: column;
@@ -169,11 +170,11 @@
169
170
  }
170
171
 
171
172
  .kit-list[data-density='compact'] {
172
- --kit-list-item-h: calc(var(--kit-list-item-h) - 0.25rem);
173
+ --kit-list-density-offset: -0.25rem;
173
174
  }
174
175
 
175
176
  .kit-list[data-density='comfortable'] {
176
- --kit-list-item-h: calc(var(--kit-list-item-h) + 0.25rem);
177
+ --kit-list-density-offset: 0.25rem;
177
178
  }
178
179
 
179
180
  .kit-list[data-rounded='0'] {
@@ -106,7 +106,7 @@
106
106
  grid-template-columns: auto minmax(0, 1fr) auto;
107
107
  align-items: center;
108
108
  gap: var(--kit-list-item-gap, 0.625rem);
109
- min-height: var(--kit-list-item-h, 2.75rem);
109
+ min-height: calc(var(--kit-list-item-h, 2.75rem) + var(--kit-list-density-offset, 0rem));
110
110
  padding-inline: var(--kit-list-item-px, 0.875rem);
111
111
  border: 0;
112
112
  border-radius: var(--kit-list-item-radius);
@@ -146,6 +146,10 @@
146
146
  background: var(--kit-list-item-bg, transparent);
147
147
  }
148
148
 
149
+ :global(.kit-list[data-variant='filled']) .kit-list-item[data-active='true'] {
150
+ background: color-mix(in oklab, currentColor 12%, transparent);
151
+ }
152
+
149
153
  :global(.kit-list[data-variant='outline']) .kit-list-item::before {
150
154
  content: '';
151
155
  position: absolute;
@@ -12,7 +12,7 @@
12
12
  's-class': sClass,
13
13
  's-style': sStyle,
14
14
  classContent,
15
- variant = 'text',
15
+ variant = 'filled',
16
16
  rounded,
17
17
  background,
18
18
  color,
@@ -24,9 +24,9 @@
24
24
 
25
25
  let safeVariant = $derived(
26
26
  typeof variant === 'string' &&
27
- (variant === 'outline' || variant === 'text' || variant === 'dash')
27
+ (variant === 'filled' || variant === 'outline' || variant === 'text' || variant === 'dash')
28
28
  ? variant
29
- : 'text'
29
+ : 'filled'
30
30
  );
31
31
 
32
32
  let safeDensity = $derived(
@@ -1,5 +1,5 @@
1
1
  import type { Component, PropValue, RoundedType } from '../../@types';
2
- type Variant = 'outline' | 'text' | 'dash';
2
+ type Variant = 'filled' | 'outline' | 'text' | 'dash';
3
3
  type Density = 'compact' | 'comfortable' | 'default';
4
4
  type Orientation = 'horizontal' | 'vertical';
5
5
  type Location = 'top' | 'bottom';
package/dist/constants.js CHANGED
@@ -22,7 +22,7 @@ export const lapikitComponents = [
22
22
  'dialog',
23
23
  'modal',
24
24
  'accordion',
25
- 'accordionItem',
25
+ 'accordion-item',
26
26
  'alert',
27
27
  'aspect-ratio',
28
28
  'spacer',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lapikit",
3
- "version": "0.5.4",
3
+ "version": "0.5.6",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"