@lit-material/chip 0.0.2 → 0.0.3

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.
@@ -0,0 +1,327 @@
1
+ {
2
+ "schemaVersion": "1.0.0",
3
+ "readme": "",
4
+ "modules": [
5
+ {
6
+ "kind": "javascript-module",
7
+ "path": "src/chip-styles.ts",
8
+ "declarations": [
9
+ {
10
+ "kind": "variable",
11
+ "name": "styles",
12
+ "default": "css` :host { display: inline-flex; vertical-align: top; -webkit-tap-highlight-color: transparent; } :host([disabled]) { pointer-events: none; } .chip { position: relative; display: inline-flex; align-items: stretch; box-sizing: border-box; height: 32px; border-radius: var(--md-sys-shape-corner-small, 8px); background-color: transparent; border: 1px solid var(--md-sys-color-outline, #79747e); color: var(--md-sys-color-on-surface-variant, #49454f); transition: background-color 150ms var(--md-sys-motion-easing-standard, cubic-bezier(0.2, 0, 0, 1)), border-color 150ms var(--md-sys-motion-easing-standard, cubic-bezier(0.2, 0, 0, 1)); } .chip.elevated { border-color: transparent; background-color: var(--md-sys-color-surface-container-low, #f7f2fa); box-shadow: var(--md-sys-elevation-1, 0 1px 2px 0 rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15)); } .chip.filter.selected { border-color: transparent; background-color: var(--md-sys-color-secondary-container, #e8def8); color: var(--md-sys-color-on-secondary-container, #1d192b); } :host([disabled]) .chip { opacity: 0.38; box-shadow: none; } .action { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 100%; padding-inline: 16px; margin: 0; border: none; background: transparent; text-decoration: none; cursor: pointer; color: inherit; font-family: var(--md-sys-typescale-label-large-font, Roboto, system-ui, sans-serif); font-size: var(--md-sys-typescale-label-large-size, 0.875rem); line-height: var(--md-sys-typescale-label-large-line-height, 1.25rem); border-radius: inherit; -webkit-appearance: none; appearance: none; } .action:disabled, .action[aria-disabled=\"true\"] { cursor: default; } .action:focus-visible { outline: 2px solid var(--md-sys-color-secondary, #625b71); outline-offset: -2px; } .state-layer { position: absolute; inset: 0; border-radius: inherit; background-color: currentColor; opacity: 0; pointer-events: none; transition: opacity 100ms linear; } .action:hover .state-layer { opacity: var(--md-sys-state-hover-state-layer-opacity, 0.08); } .state-layer[data-pressed] { opacity: var(--md-sys-state-pressed-state-layer-opacity, 0.1); } slot.leading-icon::slotted(*) { width: 18px; height: 18px; display: block; pointer-events: none; } .checkmark { width: 18px; height: 18px; flex: none; pointer-events: none; } .checkmark path { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; } .label { display: inline-flex; align-items: center; white-space: nowrap; } .remove { position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none; width: 24px; margin-inline: -8px 8px; padding: 0; border: none; background: transparent; border-radius: 50%; color: inherit; cursor: pointer; -webkit-appearance: none; appearance: none; } .remove:disabled { cursor: default; } .remove:hover { background-color: color-mix(in srgb, currentColor 8%, transparent); } .remove:focus-visible { outline: 2px solid var(--md-sys-color-secondary, #625b71); outline-offset: -1px; } .remove-icon { width: 14px; height: 14px; pointer-events: none; } .remove-icon path { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; } @media (prefers-reduced-motion: reduce) { .chip, .state-layer { transition: none; } } `"
13
+ }
14
+ ],
15
+ "exports": [
16
+ {
17
+ "kind": "js",
18
+ "name": "styles",
19
+ "declaration": {
20
+ "name": "styles",
21
+ "module": "src/chip-styles.ts"
22
+ }
23
+ }
24
+ ]
25
+ },
26
+ {
27
+ "kind": "javascript-module",
28
+ "path": "src/chip.ts",
29
+ "declarations": [
30
+ {
31
+ "kind": "class",
32
+ "description": "Material Design 3 chip.\n\nUnlike checkbox/radio/switch, chips are not form-associated: they're\nauxiliary UI (filters, action triggers, removable tags) rather than a\nvalue a `<form>` submits, matching how Material Design itself treats\nchips. A `filter` chip's `selected` state and an `input` chip's removal\nare communicated via `change`/`remove` events instead.",
33
+ "name": "LitMaterialChip",
34
+ "cssParts": [
35
+ {
36
+ "description": "The outer container (background/border/elevation).",
37
+ "name": "chip"
38
+ },
39
+ {
40
+ "description": "The main clickable `<button>` or `<a>` (icon + label).",
41
+ "name": "action"
42
+ },
43
+ {
44
+ "description": "The trailing remove `<button>`, when `removable`.",
45
+ "name": "remove-button"
46
+ },
47
+ {
48
+ "description": "The state-layer element the hover/press feedback is drawn on.",
49
+ "name": "ripple"
50
+ }
51
+ ],
52
+ "slots": [
53
+ {
54
+ "description": "The chip's label.",
55
+ "name": ""
56
+ },
57
+ {
58
+ "description": "An optional icon before the label. Ignored on a selected `filter` chip, which shows a checkmark in its place.",
59
+ "name": "leading-icon"
60
+ }
61
+ ],
62
+ "members": [
63
+ {
64
+ "kind": "field",
65
+ "name": "variant",
66
+ "type": {
67
+ "text": "ChipVariant"
68
+ },
69
+ "default": "\"assist\"",
70
+ "attribute": "variant"
71
+ },
72
+ {
73
+ "kind": "field",
74
+ "name": "selected",
75
+ "type": {
76
+ "text": "boolean"
77
+ },
78
+ "default": "false",
79
+ "attribute": "selected",
80
+ "reflects": true
81
+ },
82
+ {
83
+ "kind": "field",
84
+ "name": "disabled",
85
+ "type": {
86
+ "text": "boolean"
87
+ },
88
+ "default": "false",
89
+ "attribute": "disabled",
90
+ "reflects": true
91
+ },
92
+ {
93
+ "kind": "field",
94
+ "name": "elevated",
95
+ "type": {
96
+ "text": "boolean"
97
+ },
98
+ "default": "false",
99
+ "attribute": "elevated",
100
+ "reflects": true
101
+ },
102
+ {
103
+ "kind": "field",
104
+ "name": "removable",
105
+ "type": {
106
+ "text": "boolean"
107
+ },
108
+ "default": "false",
109
+ "attribute": "removable"
110
+ },
111
+ {
112
+ "kind": "field",
113
+ "name": "href",
114
+ "type": {
115
+ "text": "string"
116
+ },
117
+ "default": "\"\"",
118
+ "description": "If set, renders the main action as a link (`<a>`) instead of a `<button>`.",
119
+ "attribute": "href"
120
+ },
121
+ {
122
+ "kind": "field",
123
+ "name": "target",
124
+ "type": {
125
+ "text": "string"
126
+ },
127
+ "default": "\"\"",
128
+ "attribute": "target"
129
+ },
130
+ {
131
+ "kind": "field",
132
+ "name": "stateLayerElement",
133
+ "type": {
134
+ "text": "HTMLElement | undefined"
135
+ },
136
+ "privacy": "private",
137
+ "readonly": true
138
+ },
139
+ {
140
+ "kind": "field",
141
+ "name": "ripple",
142
+ "privacy": "private",
143
+ "readonly": true,
144
+ "default": "new RippleController(this)"
145
+ },
146
+ {
147
+ "kind": "method",
148
+ "name": "handleActionClick",
149
+ "privacy": "private",
150
+ "return": {
151
+ "type": {
152
+ "text": "void"
153
+ }
154
+ },
155
+ "parameters": [
156
+ {
157
+ "name": "event",
158
+ "type": {
159
+ "text": "MouseEvent"
160
+ }
161
+ }
162
+ ]
163
+ },
164
+ {
165
+ "kind": "method",
166
+ "name": "handleLinkClick",
167
+ "privacy": "private",
168
+ "return": {
169
+ "type": {
170
+ "text": "void"
171
+ }
172
+ },
173
+ "parameters": [
174
+ {
175
+ "name": "event",
176
+ "type": {
177
+ "text": "MouseEvent"
178
+ }
179
+ }
180
+ ]
181
+ },
182
+ {
183
+ "kind": "method",
184
+ "name": "handleRemoveClick",
185
+ "privacy": "private",
186
+ "return": {
187
+ "type": {
188
+ "text": "void"
189
+ }
190
+ },
191
+ "parameters": [
192
+ {
193
+ "name": "event",
194
+ "type": {
195
+ "text": "MouseEvent"
196
+ }
197
+ }
198
+ ]
199
+ }
200
+ ],
201
+ "events": [
202
+ {
203
+ "name": "change",
204
+ "type": {
205
+ "text": "Event"
206
+ },
207
+ "description": "Bubbles when a `filter` chip's `selected` state toggles via user interaction."
208
+ },
209
+ {
210
+ "name": "remove",
211
+ "type": {
212
+ "text": "Event"
213
+ },
214
+ "description": "Cancelable; fires when the remove button is activated. Unless `event.preventDefault()` is called, the chip removes itself from the DOM afterward."
215
+ }
216
+ ],
217
+ "attributes": [
218
+ {
219
+ "name": "variant",
220
+ "type": {
221
+ "text": "ChipVariant"
222
+ },
223
+ "default": "\"assist\"",
224
+ "fieldName": "variant"
225
+ },
226
+ {
227
+ "name": "selected",
228
+ "type": {
229
+ "text": "boolean"
230
+ },
231
+ "default": "false",
232
+ "fieldName": "selected"
233
+ },
234
+ {
235
+ "name": "disabled",
236
+ "type": {
237
+ "text": "boolean"
238
+ },
239
+ "default": "false",
240
+ "fieldName": "disabled"
241
+ },
242
+ {
243
+ "name": "elevated",
244
+ "type": {
245
+ "text": "boolean"
246
+ },
247
+ "default": "false",
248
+ "fieldName": "elevated"
249
+ },
250
+ {
251
+ "name": "removable",
252
+ "type": {
253
+ "text": "boolean"
254
+ },
255
+ "default": "false",
256
+ "fieldName": "removable"
257
+ },
258
+ {
259
+ "name": "href",
260
+ "type": {
261
+ "text": "string"
262
+ },
263
+ "default": "\"\"",
264
+ "description": "If set, renders the main action as a link (`<a>`) instead of a `<button>`.",
265
+ "fieldName": "href"
266
+ },
267
+ {
268
+ "name": "target",
269
+ "type": {
270
+ "text": "string"
271
+ },
272
+ "default": "\"\"",
273
+ "fieldName": "target"
274
+ }
275
+ ],
276
+ "superclass": {
277
+ "name": "LitElement",
278
+ "package": "lit"
279
+ },
280
+ "tagName": "lit-material-chip",
281
+ "customElement": true
282
+ }
283
+ ],
284
+ "exports": [
285
+ {
286
+ "kind": "js",
287
+ "name": "LitMaterialChip",
288
+ "declaration": {
289
+ "name": "LitMaterialChip",
290
+ "module": "src/chip.ts"
291
+ }
292
+ },
293
+ {
294
+ "kind": "custom-element-definition",
295
+ "name": "lit-material-chip",
296
+ "declaration": {
297
+ "name": "LitMaterialChip",
298
+ "module": "src/chip.ts"
299
+ }
300
+ }
301
+ ]
302
+ },
303
+ {
304
+ "kind": "javascript-module",
305
+ "path": "src/index.ts",
306
+ "declarations": [],
307
+ "exports": [
308
+ {
309
+ "kind": "js",
310
+ "name": "LitMaterialChip",
311
+ "declaration": {
312
+ "name": "LitMaterialChip",
313
+ "module": "./chip.js"
314
+ }
315
+ },
316
+ {
317
+ "kind": "js",
318
+ "name": "ChipVariant",
319
+ "declaration": {
320
+ "name": "ChipVariant",
321
+ "module": "./chip.js"
322
+ }
323
+ }
324
+ ]
325
+ }
326
+ ]
327
+ }
@@ -91,7 +91,7 @@ export const styles = css `
91
91
  opacity: var(--md-sys-state-pressed-state-layer-opacity, 0.1);
92
92
  }
93
93
 
94
- .leading-icon ::slotted(*) {
94
+ slot.leading-icon::slotted(*) {
95
95
  width: 18px;
96
96
  height: 18px;
97
97
  display: block;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lit-material/chip",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Material Design 3 chip web component (assist, filter, input, suggestion variants).",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -33,15 +33,16 @@
33
33
  }
34
34
  },
35
35
  "files": [
36
- "dist"
36
+ "dist",
37
+ "custom-elements.json"
37
38
  ],
38
39
  "publishConfig": {
39
40
  "access": "public"
40
41
  },
41
42
  "dependencies": {
42
43
  "lit": "^3.2.0",
43
- "@lit-material/tokens": "0.0.1",
44
- "@lit-material/core": "0.0.1"
44
+ "@lit-material/core": "0.0.3",
45
+ "@lit-material/tokens": "0.0.2"
45
46
  },
46
47
  "devDependencies": {
47
48
  "@lit-labs/ssr": "^3.3.1",
@@ -53,9 +54,11 @@
53
54
  "tsx": "^4.19.0",
54
55
  "typescript": "^5.7.0"
55
56
  },
57
+ "customElements": "custom-elements.json",
56
58
  "scripts": {
57
59
  "build": "tsc -p tsconfig.json",
58
60
  "typecheck": "tsc -p tsconfig.json --noEmit",
59
- "test": "web-test-runner && node --import tsx --test src/chip.ssr.test.ts"
61
+ "test": "web-test-runner && node --import tsx --test src/chip.ssr.test.ts",
62
+ "analyze": "custom-elements-manifest analyze --litelement --globs \"src/**/*.ts\" --exclude \"src/**/*.test.ts\" --exclude \"src/**/*.ssr.test.ts\""
60
63
  }
61
64
  }