lapikit 0.0.0-insiders.efb49b7 → 0.0.0-insiders.f44ab27

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.
Files changed (86) hide show
  1. package/bin/configuration.js +298 -0
  2. package/bin/helper.js +23 -0
  3. package/bin/index.js +41 -0
  4. package/bin/lapikit.js +37 -5
  5. package/bin/legacy.js +34 -0
  6. package/bin/modules/adapter.js +3 -3
  7. package/bin/modules/plugin.js +223 -0
  8. package/bin/presets.js +25 -0
  9. package/bin/prompts.js +100 -0
  10. package/dist/assets/icons/arrow-down.svelte +2 -0
  11. package/dist/assets/icons/arrow-down.svelte.d.ts +6 -14
  12. package/dist/assets/icons/arrow-up.svelte +2 -0
  13. package/dist/assets/icons/arrow-up.svelte.d.ts +6 -14
  14. package/dist/assets/icons/close-fill.svelte +2 -0
  15. package/dist/assets/icons/close-fill.svelte.d.ts +6 -14
  16. package/dist/assets/icons/loading-fill.svelte +2 -0
  17. package/dist/assets/icons/loading-fill.svelte.d.ts +6 -14
  18. package/dist/components/accordion/accordion.css +6 -6
  19. package/dist/components/alert/alert.css +19 -9
  20. package/dist/components/app/app.css +1 -1
  21. package/dist/components/app/app.svelte +22 -4
  22. package/dist/components/appbar/appbar.css +48 -0
  23. package/dist/components/appbar/appbar.svelte +40 -0
  24. package/dist/components/appbar/appbar.svelte.d.ts +4 -0
  25. package/dist/components/appbar/types.d.ts +15 -0
  26. package/dist/components/appbar/types.js +1 -0
  27. package/dist/components/aspect-ratio/aspect-ratio.svelte +22 -0
  28. package/dist/components/avatar/avatar.css +5 -5
  29. package/dist/components/avatar/avatar.svelte +4 -4
  30. package/dist/components/avatar/types.d.ts +1 -1
  31. package/dist/components/button/button.css +165 -194
  32. package/dist/components/button/button.svelte +39 -31
  33. package/dist/components/button/button.svelte.d.ts +2 -2
  34. package/dist/components/button/types.d.ts +7 -5
  35. package/dist/components/card/card.css +115 -0
  36. package/dist/components/card/card.svelte +63 -0
  37. package/dist/components/card/card.svelte.d.ts +4 -0
  38. package/dist/components/card/types.d.ts +18 -0
  39. package/dist/components/card/types.js +1 -0
  40. package/dist/components/chip/chip.css +218 -4
  41. package/dist/components/chip/chip.svelte +18 -5
  42. package/dist/components/chip/types.d.ts +3 -1
  43. package/dist/components/dialog/dialog.css +5 -3
  44. package/dist/components/dropdown/dropdown.css +4 -4
  45. package/dist/components/icon/icon.css +14 -11
  46. package/dist/components/index.d.ts +7 -1
  47. package/dist/components/index.js +7 -1
  48. package/dist/components/list/list.css +145 -119
  49. package/dist/components/list/list.svelte +1 -3
  50. package/dist/components/list/modules/list-item.svelte +9 -1
  51. package/dist/components/list/types.d.ts +2 -5
  52. package/dist/components/modal/modal.css +18 -13
  53. package/dist/components/modal/modal.svelte +1 -0
  54. package/dist/components/popover/popover.css +4 -4
  55. package/dist/components/separator/separator.css +1 -1
  56. package/dist/components/spacer/spacer.css +3 -0
  57. package/dist/components/spacer/spacer.svelte +7 -0
  58. package/dist/components/spacer/spacer.svelte.d.ts +4 -0
  59. package/dist/components/spacer/types.d.ts +4 -0
  60. package/dist/components/spacer/types.js +1 -0
  61. package/dist/components/textfield/textfield.css +305 -0
  62. package/dist/components/textfield/textfield.svelte +193 -0
  63. package/dist/components/textfield/textfield.svelte.d.ts +4 -0
  64. package/dist/components/textfield/types.d.ts +37 -0
  65. package/dist/components/textfield/types.js +1 -0
  66. package/dist/components/toolbar/toolbar.css +129 -0
  67. package/dist/components/toolbar/toolbar.svelte +47 -0
  68. package/dist/components/toolbar/toolbar.svelte.d.ts +4 -0
  69. package/dist/components/toolbar/types.d.ts +27 -0
  70. package/dist/components/toolbar/types.js +1 -0
  71. package/dist/components/tooltip/tooltip.css +4 -4
  72. package/dist/index.d.ts +5 -1
  73. package/dist/index.js +4 -3
  74. package/dist/internal/assets.svelte.js +2 -0
  75. package/dist/internal/ripple.d.ts +12 -0
  76. package/dist/internal/ripple.js +93 -0
  77. package/dist/internal/unit.d.ts +1 -0
  78. package/dist/internal/unit.js +11 -0
  79. package/dist/preset.js +2 -2
  80. package/dist/stores/index.d.ts +4 -3
  81. package/dist/stores/index.js +9 -4
  82. package/dist/style/animation.css +42 -0
  83. package/dist/style/normalize.css +2 -0
  84. package/dist/style/parser/color.js +2 -2
  85. package/dist/style/parser/device.js +31 -19
  86. package/package.json +7 -3
@@ -1,20 +1,23 @@
1
1
  <script lang="ts">
2
2
  import { getAssets } from '../../internal/index.js';
3
- import { Icon } from '../index.js';
4
- import type { BtnProps } from './types.js';
3
+ import type { ButtonProps } from './types.js';
5
4
 
6
5
  // external
6
+ import { Icon } from '../index.js';
7
7
  import LoadingFill from '../../assets/icons/loading-fill.svelte';
8
+ import { ripple } from '../../internal/ripple.js';
8
9
 
9
10
  let {
10
11
  children,
12
+ prepend,
13
+ append,
11
14
  ref = $bindable(),
12
15
  is = 'button',
13
16
  href,
14
17
  dark,
15
18
  light,
16
19
  active,
17
- variant,
20
+ variant = 'filled',
18
21
  error,
19
22
  info,
20
23
  success,
@@ -25,22 +28,15 @@
25
28
  type = 'button',
26
29
  background,
27
30
  color,
28
- label,
29
31
  loading,
30
32
  rounded,
31
33
  icon,
32
34
  load,
35
+ noRipple,
33
36
  ...rest
34
- }: BtnProps = $props();
37
+ }: ButtonProps = $props();
35
38
 
36
39
  const assets = getAssets();
37
-
38
- $effect(() => {
39
- if (type === 'radio') is = 'input';
40
- if (type === 'checkbox') is = 'input';
41
- if (type === 'submit') is = 'input';
42
- if (type === 'reset') is = 'input';
43
- });
44
40
  </script>
45
41
 
46
42
  <svelte:element
@@ -49,33 +45,35 @@
49
45
  {...rest}
50
46
  href={href && !disabled ? href : undefined}
51
47
  class={[
52
- 'kit-btn',
48
+ 'kit-button',
53
49
  light && 'light',
54
50
  dark && 'dark',
55
- size && assets.className('btn', 'size', size),
56
- variant && assets.className('btn', 'variant', variant),
57
- density && assets.className('btn', 'density', density),
58
- error && 'kit-btn--error',
59
- info && 'kit-btn--info',
60
- success && 'kit-btn--success',
61
- warning && 'kit-btn--warning',
62
- disabled && 'kit-btn--disabled',
63
- active && 'kit-btn--active',
64
- loading && 'kit-btn--loading',
65
- icon && 'kit-btn--icon',
51
+ size && assets.className('button', 'size', size),
52
+ variant && assets.className('button', 'variant', variant),
53
+ density && assets.className('button', 'density', density),
54
+ error && 'kit-button--error',
55
+ info && 'kit-button--info',
56
+ success && 'kit-button--success',
57
+ warning && 'kit-button--warning',
58
+ disabled && 'kit-button--disabled',
59
+ active && 'kit-button--active',
60
+ loading && 'kit-button--loading',
61
+ icon && 'kit-button--icon',
66
62
  rest.class
67
63
  ]}
68
64
  tabindex={href && disabled ? -1 : 0}
69
- aria-disabled={href ? disabled : undefined}
70
- aria-label={type !== 'button' ? label : undefined}
71
65
  disabled={href ? undefined : disabled}
72
66
  type={href ? undefined : type}
67
+ use:ripple={{
68
+ component: 'button',
69
+ disabled: noRipple || disabled
70
+ }}
73
71
  style:--base={assets.color(background)}
74
72
  style:--on={assets.color(color)}
75
73
  style:--shape={assets.shape(rounded)}
76
74
  >
77
75
  {#if loading}
78
- <div class="kit-btn-loading">
76
+ <div class="kit-button-loading">
79
77
  {#if load}
80
78
  {@render load?.()}
81
79
  {:else}
@@ -86,9 +84,19 @@
86
84
  </div>
87
85
  {/if}
88
86
 
89
- {#if !label}
90
- <span class="kit-btn-content">
91
- {@render children?.()}
92
- </span>
87
+ {#if prepend}
88
+ <div class="kit-button-prepend">
89
+ {@render prepend?.()}
90
+ </div>
91
+ {/if}
92
+
93
+ <div class="kit-button-content">
94
+ {@render children?.()}
95
+ </div>
96
+
97
+ {#if append}
98
+ <div class="kit-button-append">
99
+ {@render append?.()}
100
+ </div>
93
101
  {/if}
94
102
  </svelte:element>
@@ -1,4 +1,4 @@
1
- import type { BtnProps } from './types.js';
2
- declare const Button: import("svelte").Component<BtnProps, {}, "ref">;
1
+ import type { ButtonProps } from './types.js';
2
+ declare const Button: import("svelte").Component<ButtonProps, {}, "ref">;
3
3
  type Button = ReturnType<typeof Button>;
4
4
  export default Button;
@@ -1,12 +1,12 @@
1
1
  import type { Component } from '../../internal/types.js';
2
2
  import type { Snippet } from 'svelte';
3
- export interface BtnProps extends Component {
3
+ export interface ButtonProps extends Component {
4
4
  ref?: HTMLElement | null;
5
- is?: 'button' | 'a' | 'input';
5
+ is?: 'button' | 'a';
6
6
  dark?: boolean;
7
7
  light?: boolean;
8
8
  href?: string;
9
- variant?: 'outline' | 'text' | 'dash' | 'link';
9
+ variant?: 'outline' | 'text' | 'filled';
10
10
  density?: 'compact' | 'comfortable' | 'default';
11
11
  active?: boolean;
12
12
  loading?: boolean;
@@ -20,8 +20,10 @@ export interface BtnProps extends Component {
20
20
  size?: string | {
21
21
  [key: string]: string;
22
22
  };
23
- type?: 'button' | 'submit' | 'reset' | 'radio' | 'checkbox';
24
- label?: string;
23
+ type?: 'button' | 'submit' | 'reset';
25
24
  icon?: boolean;
26
25
  load?: Snippet;
26
+ append?: Snippet;
27
+ prepend?: Snippet;
28
+ noRipple?: boolean;
27
29
  }
@@ -0,0 +1,115 @@
1
+ /* root */
2
+ .kit-card {
3
+ --card-color: var(--on, var(--kit-on-surface));
4
+ --card-background: var(--base, var(--kit-surface));
5
+ --card-radius: var(--shape, var(--kit-radius-md));
6
+ }
7
+
8
+ .kit-card {
9
+ position: relative;
10
+ display: flex;
11
+ flex-direction: column;
12
+ text-align: start;
13
+ overflow: hidden;
14
+ /* transition:
15
+ color 0.5s,
16
+ background-color 0.5s; */
17
+ padding-top: var(--card-spacing-x);
18
+ padding-bottom: var(--card-spacing-x);
19
+ padding-right: var(--card-spacing-y);
20
+ padding-left: var(--card-spacing-y);
21
+ border-radius: var(--card-radius);
22
+ font-weight: 500;
23
+ color: var(--card-color);
24
+ text-decoration: none;
25
+ }
26
+
27
+ .kit-card.kit-card--clickable {
28
+ cursor: pointer;
29
+ }
30
+
31
+ .kit-card.kit-card--clickable::after {
32
+ content: '';
33
+ position: absolute;
34
+ inset: 0;
35
+ background-color: currentColor;
36
+ opacity: 0;
37
+ transition: opacity 150ms ease;
38
+ pointer-events: none;
39
+ border-radius: inherit;
40
+ }
41
+ .kit-card.kit-card--clickable:hover::after {
42
+ opacity: 0.08;
43
+ }
44
+ .kit-card.kit-card--clickable:active::after {
45
+ opacity: 0.12;
46
+ }
47
+ .kit-card.kit-card--clickable:focus-visible::after {
48
+ opacity: 0.12;
49
+ }
50
+
51
+ /* density */
52
+ .kit-card[breakpoint]kit-card--density-default {
53
+ --card-spacing-x: calc(var(--kit-spacing) * 2);
54
+ --card-spacing-y: calc(var(--kit-spacing) * 2);
55
+ }
56
+ .kit-card[breakpoint]kit-card--density-compact {
57
+ --card-spacing-x: 0;
58
+ --card-spacing-y: 0;
59
+ }
60
+ .kit-card[breakpoint]kit-card--density-comfortable {
61
+ --card-spacing-x: calc(var(--kit-spacing) * 4);
62
+ --card-spacing-y: calc(var(--kit-spacing) * 4);
63
+ }
64
+
65
+ /* variant */
66
+ .kit-card[breakpoint]kit-card--variant-filled {
67
+ background-color: var(--card-background);
68
+ }
69
+
70
+ .kit-card[breakpoint]kit-card--variant-outline {
71
+ --card-color: var(--base, var(--kit-on-surface));
72
+ background-color: transparent;
73
+ }
74
+ .kit-card[breakpoint]kit-card--variant-outline::before {
75
+ content: '';
76
+ position: absolute;
77
+ inset: 0;
78
+ border: 1px solid currentColor;
79
+ pointer-events: none;
80
+ border-radius: inherit;
81
+ }
82
+
83
+ .kit-card[breakpoint]kit-card--variant-text {
84
+ --card-color: var(--base, var(--kit-on-surface));
85
+ background-color: transparent;
86
+ border: none;
87
+ }
88
+
89
+ /* events */
90
+ .kit-card[class*='card--variant-filled'].kit-card--clickable:active,
91
+ .kit-card.kit-card--active[class*='card--variant-filled'].kit-card--clickable {
92
+ background-color: color-mix(in oklab, var(--card-background) 90%, var(--kit-scrim));
93
+ }
94
+ .kit-card.kit-card--active[class*='card--variant-']:not(
95
+ [class*='variant-filled']
96
+ ).kit-card--clickable:active,
97
+ .kit-card.kit-card--active[class*='card--variant-']:not(
98
+ [class*='variant-filled']
99
+ ).kit-card--clickable {
100
+ background-color: color-mix(in oklab, currentColor 15%, transparent);
101
+ }
102
+
103
+ /* disabled */
104
+ .kit-card.kit-card--disabled,
105
+ .kit-card[disabled],
106
+ .kit-card:disabled {
107
+ pointer-events: none;
108
+ user-select: none;
109
+ opacity: 0.6;
110
+ }
111
+ .kit-card.kit-card--disabled > *,
112
+ .kit-card[disabled] > *,
113
+ .kit-card:disabled > * {
114
+ opacity: 0.6;
115
+ }
@@ -0,0 +1,63 @@
1
+ <script lang="ts">
2
+ import { getAssets } from '../../internal/index.js';
3
+ import type { CardProps } from './types.js';
4
+
5
+ // external
6
+ import { ripple } from '../../internal/ripple.js';
7
+
8
+ let {
9
+ children,
10
+ ref = $bindable(),
11
+ is = 'div',
12
+ href,
13
+ dark,
14
+ light,
15
+ active,
16
+ density = 'default',
17
+ variant = 'filled',
18
+ disabled,
19
+ rounded,
20
+ color,
21
+ background,
22
+ noRipple,
23
+ ...rest
24
+ }: CardProps = $props();
25
+
26
+ const assets = getAssets();
27
+ let isClickable: boolean = $state(false);
28
+
29
+ $effect(() => {
30
+ const refProps = { ...rest };
31
+ if (href) is = 'a';
32
+ if (refProps?.onclick || href || is === 'a') isClickable = true;
33
+ else isClickable = false;
34
+ });
35
+ </script>
36
+
37
+ <svelte:element
38
+ this={is}
39
+ bind:this={ref}
40
+ {...rest}
41
+ href={href && !disabled ? href : undefined}
42
+ class={[
43
+ 'kit-card',
44
+ light && 'light',
45
+ dark && 'dark',
46
+ variant && assets.className('card', 'variant', variant),
47
+ density && assets.className('card', 'density', density),
48
+ isClickable && 'kit-card--clickable',
49
+ active && 'kit-card--active',
50
+ disabled && 'kit-card--disabled',
51
+ rest.class
52
+ ]}
53
+ disabled={href ? undefined : disabled}
54
+ use:ripple={{
55
+ component: 'card',
56
+ disabled: noRipple || disabled || !isClickable
57
+ }}
58
+ style:--base={assets.color(background)}
59
+ style:--on={assets.color(color)}
60
+ style:--shape={assets.shape(rounded)}
61
+ >
62
+ {@render children?.()}
63
+ </svelte:element>
@@ -0,0 +1,4 @@
1
+ import type { CardProps } from './types.js';
2
+ declare const Card: import("svelte").Component<CardProps, {}, "ref">;
3
+ type Card = ReturnType<typeof Card>;
4
+ export default Card;
@@ -0,0 +1,18 @@
1
+ import type { Component } from '../../internal/types.js';
2
+ type Density = 'compact' | 'comfortable' | 'default';
3
+ export interface CardProps extends Component {
4
+ is?: 'a' | 'button' | 'div';
5
+ dark?: boolean;
6
+ light?: boolean;
7
+ href?: string;
8
+ variant?: 'outline' | 'text' | 'filled';
9
+ density?: Density | {
10
+ [key: string]: Density;
11
+ };
12
+ active?: boolean;
13
+ disabled?: boolean;
14
+ rounded?: string;
15
+ color?: string;
16
+ background?: string;
17
+ }
18
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,12 +1,226 @@
1
- /* loading */
1
+ /* root */
2
+ .kit-chip {
3
+ --chip-color: var(--on, var(--kit-on-container));
4
+ --chip-background: var(--base, var(--kit-container));
5
+ --chip-radius: var(--shape, var(--kit-radius-full));
6
+ }
7
+
8
+ .kit-chip {
9
+ min-width: calc(var(--kit-spacing) * var(--chip-multiplier-x));
10
+ position: relative;
11
+ border: none;
12
+ outline: none;
13
+ padding-top: var(--chip-spacing-x);
14
+ padding-bottom: var(--chip-spacing-x);
15
+ padding-right: var(--chip-spacing-y);
16
+ padding-left: var(--chip-spacing-y);
17
+ border-radius: var(--chip-radius);
18
+ color: var(--chip-color);
19
+ font-weight: 500;
20
+ text-decoration: none;
21
+ }
22
+
23
+ .kit-chip:not(div):not(span):not(.kit-chip--readonly) {
24
+ cursor: pointer;
25
+ }
26
+
27
+ .kit-chip,
28
+ .kit-chip .kit-chip-content,
29
+ .kit-chip .kit-chip-append,
30
+ .kit-chip .kit-chip-prepend,
31
+ .kit-chip .kit-chip--close,
32
+ .kit-chip .kit-chip-loading {
33
+ display: inline-flex;
34
+ align-items: center;
35
+ justify-content: center;
36
+ white-space: nowrap;
37
+ gap: calc(var(--kit-spacing) * var(--chip-multiplier-gap));
38
+ font-size: calc(var(--kit-spacing) * var(--chip-multiplier-font-size));
39
+ line-height: 0;
40
+ }
41
+
42
+ .kit-chip:not(div):not(span)::after {
43
+ content: '';
44
+ position: absolute;
45
+ inset: 0;
46
+ background-color: currentColor;
47
+ opacity: 0;
48
+ transition: opacity 150ms ease;
49
+ pointer-events: none;
50
+ border-radius: inherit;
51
+ }
52
+ .kit-chip:not(div):not(span):not(.kit-chip--readonly):hover::after {
53
+ opacity: 0.08;
54
+ }
55
+ .kit-chip:not(div):not(span):not(.kit-chip--readonly):active::after {
56
+ opacity: 0.12;
57
+ }
58
+ .kit-chip:not(div):not(span):not(.kit-chip--readonly):focus-visible::after {
59
+ opacity: 0.12;
60
+ }
61
+
62
+ /* size */
63
+ .kit-chip[breakpoint]kit-chip--size-xs {
64
+ --chip-multiplier-x: 12;
65
+ --chip-multiplier-y: 2;
66
+ --chip-multiplier-gap: 2;
67
+ --chip-multiplier-font-size: 6;
68
+ }
69
+ .kit-chip[breakpoint]kit-chip--size-xs .kit-icon[class*='kit-icon--size-md'] {
70
+ --icon-multiplier-parent-size: 7;
71
+ }
72
+
73
+ .kit-chip[breakpoint]kit-chip--size-sm {
74
+ --chip-multiplier-x: 14;
75
+ --chip-multiplier-y: 2;
76
+ --chip-multiplier-gap: 2;
77
+ --chip-multiplier-font-size: 6.5;
78
+ }
79
+ .kit-chip[breakpoint]kit-chip--size-sm .kit-icon[class*='kit-icon--size-md'] {
80
+ --icon-multiplier-parent-size: 8;
81
+ }
82
+
83
+ .kit-chip[breakpoint]kit-chip--size-md {
84
+ --chip-multiplier-x: 16;
85
+ --chip-multiplier-y: 3;
86
+ --chip-multiplier-gap: 4;
87
+ --chip-multiplier-font-size: 7;
88
+ }
89
+ .kit-chip[breakpoint]kit-chip--size-md .kit-icon[class*='kit-icon--size-md'] {
90
+ --icon-multiplier-parent-size: 9;
91
+ }
92
+
93
+ .kit-chip[breakpoint]kit-chip--size-lg {
94
+ --chip-multiplier-x: 18;
95
+ --chip-multiplier-y: 3;
96
+ --chip-multiplier-gap: 4;
97
+ --chip-multiplier-font-size: 8;
98
+ }
99
+ .kit-chip[breakpoint]kit-chip--size-lg .kit-icon[class*='kit-icon--size-md'] {
100
+ --icon-multiplier-parent-size: 10;
101
+ }
102
+
103
+ .kit-chip[breakpoint]kit-chip--size-xl {
104
+ --chip-multiplier-x: 20;
105
+ --chip-multiplier-y: 4;
106
+ --chip-multiplier-gap: 4;
107
+ --chip-multiplier-font-size: 9;
108
+ }
109
+ .kit-chip[breakpoint]kit-chip--size-xl .kit-icon[class*='kit-icon--size-md'] {
110
+ --icon-multiplier-parent-size: 11;
111
+ }
112
+
113
+ /* variant */
114
+ .kit-chip[breakpoint]kit-chip--variant-filled {
115
+ background-color: var(--chip-background);
116
+ }
117
+
118
+ .kit-chip[breakpoint]kit-chip--variant-outline {
119
+ --chip-color: var(--on, var(--kit-on-container));
120
+ background-color: var(--chip-background);
121
+ }
122
+ .kit-chip[breakpoint]kit-chip--variant-outline::before {
123
+ content: '';
124
+ position: absolute;
125
+ inset: 0;
126
+ border: 1px solid currentColor;
127
+ pointer-events: none;
128
+ border-radius: inherit;
129
+ }
130
+
131
+ /* density */
132
+ .kit-chip[breakpoint]kit-chip--density-default {
133
+ height: calc(var(--kit-spacing) * var(--chip-multiplier-x));
134
+ --chip-spacing-x: 0;
135
+ --chip-spacing-y: calc(var(--kit-spacing) * var(--chip-multiplier-y));
136
+ }
137
+
138
+ .kit-chip[breakpoint]kit-chip--density-compact {
139
+ height: calc(var(--kit-spacing) * var(--chip-multiplier-x) - 0.25rem);
140
+ --chip-spacing-x: 0;
141
+ --chip-spacing-y: calc(var(--kit-spacing) * var(--chip-multiplier-y) - 0.25rem);
142
+ }
143
+
144
+ .kit-chip[breakpoint]kit-chip--density-comfortable {
145
+ height: calc(var(--kit-spacing) * var(--chip-multiplier-x) + 0.25rem);
146
+ --chip-spacing-x: 0;
147
+ --chip-spacing-y: calc(var(--kit-spacing) * var(--chip-multiplier-y) + 0.25rem);
148
+ }
149
+
150
+ /* state */
151
+ .kit-chip.kit-chip--info[class*='chip--variant-filled'] {
152
+ --on: var(--kit-on-info);
153
+ --base: var(--kit-info);
154
+ }
155
+ .kit-chip.kit-chip--info[class*='chip--variant-']:not([class*='variant-filled']) {
156
+ --base: var(--kit-info);
157
+ }
158
+
159
+ .kit-chip.kit-chip--success[class*='chip--variant-filled'] {
160
+ --on: var(--kit-on-success);
161
+ --base: var(--kit-success);
162
+ }
163
+ .kit-chip.kit-chip--success[class*='chip--variant-']:not([class*='variant-filled']) {
164
+ --base: var(--kit-success);
165
+ }
166
+
167
+ .kit-chip.kit-chip--warning[class*='chip--variant-filled'] {
168
+ --on: var(--kit-on-warning);
169
+ --base: var(--kit-warning);
170
+ }
171
+ .kit-chip.kit-chip--warning[class*='chip--variant-']:not([class*='variant-filled']) {
172
+ --base: var(--kit-warning);
173
+ }
174
+
175
+ .kit-chip.kit-chip--error[class*='chip--variant-filled'] {
176
+ --on: var(--kit-on-error);
177
+ --base: var(--kit-error);
178
+ }
179
+ .kit-chip.kit-chip--error[class*='chip--variant-']:not([class*='variant-filled']) {
180
+ --base: var(--kit-error);
181
+ }
182
+
183
+ /* events */
184
+ .kit-chip[class*='chip--variant-filled']:active,
185
+ .kit-chip.kit-chip--active[class*='chip--variant-filled'] {
186
+ background-color: color-mix(in oklab, var(--chip-background) 90%, var(--kit-scrim));
187
+ }
188
+ .kit-chip.kit-chip--active[class*='chip--variant-']:not([class*='variant-filled']):active,
189
+ .kit-chip.kit-chip--active[class*='chip--variant-']:not([class*='variant-filled']) {
190
+ background-color: color-mix(in oklab, currentColor 15%, transparent);
191
+ }
192
+
193
+ /* disabled */
194
+ .kit-chip.kit-chip--disabled,
195
+ .kit-chip[disabled],
2
196
  .kit-chip.kit-chip--loading {
3
197
  pointer-events: none;
4
198
  user-select: none;
5
199
  cursor: default;
6
200
  }
7
- .kit-chip.kit-chip--loading > .kit-chip-content {
8
- color: transparent;
9
- opacity: 0;
201
+ .kit-chip[class*='chip--variant-filled'].kit-chip--disabled {
202
+ color: color-mix(in oklab, var(--chip-color) 40%, transparent) !important;
203
+ background-color: color-mix(in oklab, var(--chip-background) 70%, transparent) !important;
204
+ }
205
+ .kit-chip[class*='chip--variant-filled'].kit-chip--disabled i:before {
206
+ color: color-mix(in oklab, var(--chip-color) 40%, transparent) !important;
207
+ }
208
+ .kit-chip[class*='chip--variant-']:not([class*='variant-filled']).kit-chip--disabled,
209
+ .kit-chip[class*='chip--variant-']:not([class*='variant-filled']).kit-chip--disabled i::before {
210
+ color: color-mix(in oklab, var(--chip-background) 40%, transparent) !important;
211
+ }
212
+
213
+ /* icon */
214
+ .kit-chip i::before,
215
+ .kit-chip .kit-icon {
216
+ --base-parent: var(--chip-color);
217
+ }
218
+
219
+ /* loading */
220
+ .kit-chip.kit-chip--loading > .kit-chip-content,
221
+ .kit-chip.kit-chip--loading > .kit-chip-append,
222
+ .kit-chip.kit-chip--loading > .kit-chip-prepend {
223
+ visibility: hidden;
10
224
  }
11
225
  .kit-chip.kit-chip--loading > .kit-chip-loading {
12
226
  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,
@@ -15,12 +16,12 @@
15
16
  prepend,
16
17
  ref = $bindable(),
17
18
  open = $bindable(true),
18
- is = 'span',
19
+ is = 'div',
19
20
  href,
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,17 @@
35
36
  loading,
36
37
  rounded,
37
38
  closable,
39
+ noRipple,
40
+ readonly = false,
38
41
  ...rest
39
42
  }: ChipProps = $props();
40
43
 
41
44
  const assets = getAssets();
45
+
46
+ $effect(() => {
47
+ const refProps = { ...rest };
48
+ if (refProps?.onclick && !readonly) is = 'button';
49
+ });
42
50
  </script>
43
51
 
44
52
  {#if !closable || (open && closable)}
@@ -61,6 +69,7 @@
61
69
  disabled && 'kit-chip--disabled',
62
70
  active && 'kit-chip--active',
63
71
  loading && 'kit-chip--loading',
72
+ readonly && 'kit-chip--readonly',
64
73
  rest.class
65
74
  ]}
66
75
  tabindex={href && disabled ? -1 : 0}
@@ -68,6 +77,10 @@
68
77
  aria-label={type !== 'button' ? label : undefined}
69
78
  disabled={href ? undefined : disabled}
70
79
  type={href ? undefined : type}
80
+ use:ripple={{
81
+ component: 'chip',
82
+ disabled: noRipple || readonly || disabled || is === 'div' || is === 'span'
83
+ }}
71
84
  style:--base={assets.color(background)}
72
85
  style:--on={assets.color(color)}
73
86
  style:--shape={assets.shape(rounded)}
@@ -89,16 +102,16 @@
89
102
  {@render prepend?.()}
90
103
  </div>
91
104
  {/if}
92
- <span class="kit-chip-content">
105
+ <div class="kit-chip-content">
93
106
  {@render children?.()}
94
- </span>
107
+ </div>
95
108
  {#if append}
96
109
  <div class="kit-chip-append">
97
110
  {@render append?.()}
98
111
  </div>
99
112
  {/if}
100
113
 
101
- {#if closable}
114
+ {#if closable && !readonly}
102
115
  <button
103
116
  class="kit-chip--close"
104
117
  type="button"
@@ -10,7 +10,7 @@ export interface ChipProps extends Component {
10
10
  dark?: boolean;
11
11
  light?: boolean;
12
12
  href?: string;
13
- variant?: 'outline' | 'label';
13
+ variant?: 'outline' | 'filled';
14
14
  density?: 'compact' | 'comfortable' | 'default';
15
15
  active?: boolean;
16
16
  loading?: boolean;
@@ -27,4 +27,6 @@ export interface ChipProps extends Component {
27
27
  type?: 'button';
28
28
  label?: string;
29
29
  closable?: boolean;
30
+ noRipple?: boolean;
31
+ readonly?: boolean;
30
32
  }