@lit-material/dialog 0.0.1 → 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,264 @@
1
+ {
2
+ "schemaVersion": "1.0.0",
3
+ "readme": "",
4
+ "modules": [
5
+ {
6
+ "kind": "javascript-module",
7
+ "path": "src/dialog-styles.ts",
8
+ "declarations": [
9
+ {
10
+ "kind": "variable",
11
+ "name": "styles",
12
+ "default": "css` :host { display: contents; } /* The dialog element itself is transparent and fills the viewport (rather than shrink-wrapping the visible card) so a click landing outside .container still has its event target equal to the dialog element — that's what lets the backdrop-click handler use a simple equality check instead of manual hit-testing against the card's bounding box. */ .dialog { margin: 0; padding: 0; border: none; width: 100%; height: 100%; max-width: 100%; max-height: 100%; background: transparent; color: inherit; } .dialog[open] { display: flex; align-items: center; justify-content: center; } .dialog::backdrop { background-color: rgba(0, 0, 0, 0.32); } .container { display: flex; flex-direction: column; align-items: stretch; gap: 16px; box-sizing: border-box; /* Not part of the tab order (see the component for why it's the default focus target) — no visible focus indicator of its own. */ outline: none; width: min(560px, calc(100vw - 48px)); max-height: calc(100vh - 48px); padding: 24px; border-radius: var(--md-sys-shape-corner-extra-large, 28px); background-color: var(--md-sys-color-surface-container-high, #ece6f0); /* Outlined text fields in the body notch their label against this surface. */ --lit-material-text-field-notch-color: var(--md-sys-color-surface-container-high, #ece6f0); color: var(--md-sys-color-on-surface, #1c1b1f); font-family: var(--md-sys-typescale-body-medium-font, Roboto, system-ui, sans-serif); box-shadow: var( --md-sys-elevation-level3, 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 4px 8px 3px rgba(0, 0, 0, 0.15) ); } slot.icon::slotted(*) { width: 24px; height: 24px; display: block; color: var(--md-sys-color-secondary, #625b71); } .icon:has(::slotted(*)) { align-self: center; } .headline { display: block; color: var(--md-sys-color-on-surface, #1c1b1f); font-family: var(--md-sys-typescale-headline-small-font, Roboto, system-ui, sans-serif); font-size: var(--md-sys-typescale-headline-small-size, 1.5rem); line-height: var(--md-sys-typescale-headline-small-line-height, 2rem); } .icon:has(::slotted(*)) ~ .headline { text-align: center; } .content { flex: 1; min-height: 0; overflow-y: auto; color: var(--md-sys-color-on-surface-variant, #49454f); font-size: var(--md-sys-typescale-body-medium-size, 0.875rem); line-height: var(--md-sys-typescale-body-medium-line-height, 1.25rem); } .actions { display: flex; justify-content: flex-end; gap: 8px; } .actions:empty { display: none; } `"
13
+ }
14
+ ],
15
+ "exports": [
16
+ {
17
+ "kind": "js",
18
+ "name": "styles",
19
+ "declaration": {
20
+ "name": "styles",
21
+ "module": "src/dialog-styles.ts"
22
+ }
23
+ }
24
+ ]
25
+ },
26
+ {
27
+ "kind": "javascript-module",
28
+ "path": "src/dialog.ts",
29
+ "declarations": [
30
+ {
31
+ "kind": "class",
32
+ "description": "Material Design 3 (basic) dialog, built on the native `<dialog>` element —\nso focus trapping, initial focus, top-layer stacking, and Escape-to-close\nall come from the browser rather than reimplemented JS.\n\nNative `close`/`cancel` events on `<dialog>` don't bubble or cross the\nshadow boundary (per spec they're `bubbles: false`, and not composed), so\nthis re-dispatches its own bubbling, composed `close`/`cancel` events.\n\n`showModal()` auto-focuses the first focusable descendant when nothing has\n`autofocus` — which, with no autofocus of your own, would otherwise land on\nthe first slotted action button and show its focus ring on every open,\nlooking like a stray highlight the user never asked for. `container` is\ngiven `tabindex=\"-1\" autofocus` (with its own focus ring suppressed) so\nthat's the default focus target instead. Because `container` is an\nancestor of the slotted content, its `autofocus` always wins over one on a\nslotted element (tree order), so it can't be opted out of that way — to\nfocus a specific action instead, call `.focus()` on it yourself after\nopening the dialog.",
33
+ "name": "LitMaterialDialog",
34
+ "cssParts": [
35
+ {
36
+ "description": "The native `<dialog>` element. Transparent and sized to the viewport so clicks outside `container` can be detected as backdrop clicks; style the visible card via `container` instead.",
37
+ "name": "dialog"
38
+ },
39
+ {
40
+ "description": "The visible card (background, padding, shape, elevation).",
41
+ "name": "container"
42
+ }
43
+ ],
44
+ "slots": [
45
+ {
46
+ "description": "An optional small icon shown centered above the headline.",
47
+ "name": "icon"
48
+ },
49
+ {
50
+ "description": "The dialog's title.",
51
+ "name": "headline"
52
+ },
53
+ {
54
+ "description": "The dialog's body content (supporting text, form fields, etc.).",
55
+ "name": ""
56
+ },
57
+ {
58
+ "description": "Action buttons, right-aligned. A `<form method=\"dialog\">` submit button inside this slot closes the dialog natively and sets `returnValue`, without any extra JS.",
59
+ "name": "actions"
60
+ }
61
+ ],
62
+ "members": [
63
+ {
64
+ "kind": "field",
65
+ "name": "open",
66
+ "type": {
67
+ "text": "boolean"
68
+ },
69
+ "default": "false",
70
+ "attribute": "open",
71
+ "reflects": true
72
+ },
73
+ {
74
+ "kind": "field",
75
+ "name": "disableBackdropClose",
76
+ "type": {
77
+ "text": "boolean"
78
+ },
79
+ "default": "false",
80
+ "description": "If set, clicking the backdrop (outside the visible card) does not close the dialog.",
81
+ "attribute": "disable-backdrop-close"
82
+ },
83
+ {
84
+ "kind": "field",
85
+ "name": "dialogElement",
86
+ "type": {
87
+ "text": "HTMLDialogElement | undefined"
88
+ },
89
+ "privacy": "private",
90
+ "readonly": true
91
+ },
92
+ {
93
+ "kind": "field",
94
+ "name": "reopenOnClose",
95
+ "type": {
96
+ "text": "boolean"
97
+ },
98
+ "privacy": "private",
99
+ "default": "false"
100
+ },
101
+ {
102
+ "kind": "method",
103
+ "name": "show",
104
+ "return": {
105
+ "type": {
106
+ "text": "void"
107
+ }
108
+ },
109
+ "description": "Opens the dialog. Equivalent to setting `.open = true`."
110
+ },
111
+ {
112
+ "kind": "method",
113
+ "name": "close",
114
+ "return": {
115
+ "type": {
116
+ "text": "void"
117
+ }
118
+ },
119
+ "parameters": [
120
+ {
121
+ "name": "returnValue",
122
+ "optional": true,
123
+ "type": {
124
+ "text": "string"
125
+ }
126
+ }
127
+ ],
128
+ "description": "Closes the dialog. Equivalent to setting `.open = false`."
129
+ },
130
+ {
131
+ "kind": "field",
132
+ "name": "returnValue",
133
+ "type": {
134
+ "text": "string"
135
+ },
136
+ "description": "The value the dialog was closed with (via `close()` or a `method=\"dialog\"` form submit).",
137
+ "readonly": true
138
+ },
139
+ {
140
+ "kind": "method",
141
+ "name": "handleClose",
142
+ "privacy": "private",
143
+ "return": {
144
+ "type": {
145
+ "text": "void"
146
+ }
147
+ }
148
+ },
149
+ {
150
+ "kind": "method",
151
+ "name": "handleCancel",
152
+ "privacy": "private",
153
+ "return": {
154
+ "type": {
155
+ "text": "void"
156
+ }
157
+ },
158
+ "parameters": [
159
+ {
160
+ "name": "event",
161
+ "type": {
162
+ "text": "Event"
163
+ }
164
+ }
165
+ ]
166
+ },
167
+ {
168
+ "kind": "method",
169
+ "name": "handleBackdropClick",
170
+ "privacy": "private",
171
+ "return": {
172
+ "type": {
173
+ "text": "void"
174
+ }
175
+ },
176
+ "parameters": [
177
+ {
178
+ "name": "event",
179
+ "type": {
180
+ "text": "MouseEvent"
181
+ }
182
+ }
183
+ ]
184
+ }
185
+ ],
186
+ "events": [
187
+ {
188
+ "name": "close",
189
+ "type": {
190
+ "text": "Event"
191
+ },
192
+ "description": "Re-dispatched from the native `close` event, after the dialog has closed."
193
+ },
194
+ {
195
+ "name": "cancel",
196
+ "type": {
197
+ "text": "Event"
198
+ },
199
+ "description": "Re-dispatched from the native `cancel` event (fired on Escape, before `close`). Cancelable: calling `preventDefault()` stops the dialog from closing."
200
+ }
201
+ ],
202
+ "attributes": [
203
+ {
204
+ "name": "open",
205
+ "type": {
206
+ "text": "boolean"
207
+ },
208
+ "default": "false",
209
+ "fieldName": "open"
210
+ },
211
+ {
212
+ "name": "disable-backdrop-close",
213
+ "type": {
214
+ "text": "boolean"
215
+ },
216
+ "default": "false",
217
+ "description": "If set, clicking the backdrop (outside the visible card) does not close the dialog.",
218
+ "fieldName": "disableBackdropClose"
219
+ }
220
+ ],
221
+ "superclass": {
222
+ "name": "LitElement",
223
+ "package": "lit"
224
+ },
225
+ "tagName": "lit-material-dialog",
226
+ "customElement": true
227
+ }
228
+ ],
229
+ "exports": [
230
+ {
231
+ "kind": "js",
232
+ "name": "LitMaterialDialog",
233
+ "declaration": {
234
+ "name": "LitMaterialDialog",
235
+ "module": "src/dialog.ts"
236
+ }
237
+ },
238
+ {
239
+ "kind": "custom-element-definition",
240
+ "name": "lit-material-dialog",
241
+ "declaration": {
242
+ "name": "LitMaterialDialog",
243
+ "module": "src/dialog.ts"
244
+ }
245
+ }
246
+ ]
247
+ },
248
+ {
249
+ "kind": "javascript-module",
250
+ "path": "src/index.ts",
251
+ "declarations": [],
252
+ "exports": [
253
+ {
254
+ "kind": "js",
255
+ "name": "LitMaterialDialog",
256
+ "declaration": {
257
+ "name": "LitMaterialDialog",
258
+ "module": "./dialog.js"
259
+ }
260
+ }
261
+ ]
262
+ }
263
+ ]
264
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"dialog-styles.d.ts","sourceRoot":"","sources":["../src/dialog-styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,yBAgGlB,CAAC"}
1
+ {"version":3,"file":"dialog-styles.d.ts","sourceRoot":"","sources":["../src/dialog-styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,yBAkGlB,CAAC"}
@@ -45,6 +45,8 @@ export const styles = css `
45
45
  padding: 24px;
46
46
  border-radius: var(--md-sys-shape-corner-extra-large, 28px);
47
47
  background-color: var(--md-sys-color-surface-container-high, #ece6f0);
48
+ /* Outlined text fields in the body notch their label against this surface. */
49
+ --lit-material-text-field-notch-color: var(--md-sys-color-surface-container-high, #ece6f0);
48
50
  color: var(--md-sys-color-on-surface, #1c1b1f);
49
51
  font-family: var(--md-sys-typescale-body-medium-font, Roboto, system-ui, sans-serif);
50
52
  box-shadow: var(
@@ -54,7 +56,7 @@ export const styles = css `
54
56
  );
55
57
  }
56
58
 
57
- .icon ::slotted(*) {
59
+ slot.icon::slotted(*) {
58
60
  width: 24px;
59
61
  height: 24px;
60
62
  display: block;
@@ -1 +1 @@
1
- {"version":3,"file":"dialog-styles.js","sourceRoot":"","sources":["../src/dialog-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgGxB,CAAC"}
1
+ {"version":3,"file":"dialog-styles.js","sourceRoot":"","sources":["../src/dialog-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkGxB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lit-material/dialog",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "Material Design 3 dialog web component, built on the native <dialog> element.",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -15,7 +15,15 @@
15
15
  "url": "git+ssh://git@github.com/bohdaq/lit-material.git",
16
16
  "directory": "packages/dialog"
17
17
  },
18
- "keywords": ["lit", "web-components", "lit-material", "material-design", "material-design-3", "dialog", "modal"],
18
+ "keywords": [
19
+ "lit",
20
+ "web-components",
21
+ "lit-material",
22
+ "material-design",
23
+ "material-design-3",
24
+ "dialog",
25
+ "modal"
26
+ ],
19
27
  "type": "module",
20
28
  "main": "./dist/index.js",
21
29
  "types": "./dist/index.d.ts",
@@ -26,19 +34,15 @@
26
34
  }
27
35
  },
28
36
  "files": [
29
- "dist"
37
+ "dist",
38
+ "custom-elements.json"
30
39
  ],
31
40
  "publishConfig": {
32
41
  "access": "public"
33
42
  },
34
- "scripts": {
35
- "build": "tsc -p tsconfig.json",
36
- "typecheck": "tsc -p tsconfig.json --noEmit",
37
- "test": "web-test-runner && node --import tsx --test src/dialog.ssr.test.ts"
38
- },
39
43
  "dependencies": {
40
- "@lit-material/tokens": "workspace:*",
41
- "lit": "^3.2.0"
44
+ "lit": "^3.2.0",
45
+ "@lit-material/tokens": "0.0.1"
42
46
  },
43
47
  "devDependencies": {
44
48
  "@lit-labs/ssr": "^3.3.1",
@@ -49,5 +53,12 @@
49
53
  "@web/test-runner-playwright": "^0.11.0",
50
54
  "tsx": "^4.19.0",
51
55
  "typescript": "^5.7.0"
56
+ },
57
+ "customElements": "custom-elements.json",
58
+ "scripts": {
59
+ "build": "tsc -p tsconfig.json",
60
+ "typecheck": "tsc -p tsconfig.json --noEmit",
61
+ "test": "web-test-runner && node --import tsx --test src/dialog.ssr.test.ts",
62
+ "analyze": "custom-elements-manifest analyze --litelement --globs \"src/**/*.ts\" --exclude \"src/**/*.test.ts\" --exclude \"src/**/*.ssr.test.ts\""
52
63
  }
53
- }
64
+ }