@m3ui-vue/m3ui-vue 1.3.5 → 1.3.7

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 (59) hide show
  1. package/dist/API.md +76 -16
  2. package/dist/{MButton-Bl_BSUep.js → MButton-D5eJiDza.js} +2 -2
  3. package/dist/{MButton-Bl_BSUep.js.map → MButton-D5eJiDza.js.map} +1 -1
  4. package/dist/{MDialog-D_Yik8ou.js → MDialog-WqB0jewp.js} +2 -2
  5. package/dist/{MDialog-D_Yik8ou.js.map → MDialog-WqB0jewp.js.map} +1 -1
  6. package/dist/{MListItem-BxifHJdU.js → MListItem-Cf-C2Ru-.js} +2 -2
  7. package/dist/{MListItem-BxifHJdU.js.map → MListItem-Cf-C2Ru-.js.map} +1 -1
  8. package/dist/{MLoadingIndicator-BxbFhSX6.js → MLoadingIndicator-D4GzEZoH.js} +2 -2
  9. package/dist/{MLoadingIndicator-BxbFhSX6.js.map → MLoadingIndicator-D4GzEZoH.js.map} +1 -1
  10. package/dist/{MSeekBar-BeN9QcB3.js → MSeekBar-B19xoWE3.js} +2 -2
  11. package/dist/{MSeekBar-BeN9QcB3.js.map → MSeekBar-B19xoWE3.js.map} +1 -1
  12. package/dist/{MSlider-BVSbJlGS.js → MSlider-9RoiuebS.js} +2 -2
  13. package/dist/{MSlider-BVSbJlGS.js.map → MSlider-9RoiuebS.js.map} +1 -1
  14. package/dist/{MSpinner-C2SUnWk4.js → MSpinner-BNF8MN-L.js} +2 -2
  15. package/dist/{MSpinner-C2SUnWk4.js.map → MSpinner-BNF8MN-L.js.map} +1 -1
  16. package/dist/{MTextField-CEkWSZ2v.js → MTextField-CuG0T3qh.js} +2 -2
  17. package/dist/{MTextField-CEkWSZ2v.js.map → MTextField-CuG0T3qh.js.map} +1 -1
  18. package/dist/{MTooltip-CodJGEO-.js → MTooltip-Bv7yxngk.js} +4 -4
  19. package/dist/{MTooltip-CodJGEO-.js.map → MTooltip-Bv7yxngk.js.map} +1 -1
  20. package/dist/api.json +1 -1
  21. package/dist/code-editor.js +1 -1
  22. package/dist/components/MFloorPlan.vue.d.ts +192 -14
  23. package/dist/components/MFloorPlanInspector.vue.d.ts +12 -12
  24. package/dist/components/MMap.vue.d.ts +2 -2
  25. package/dist/components/MPdfViewer.vue.d.ts +2 -2
  26. package/dist/composables/useFloorPlan.d.ts +10 -3
  27. package/dist/composables/useLocale.d.ts +9 -0
  28. package/dist/draw.js +2 -2
  29. package/dist/flow.js +1 -1
  30. package/dist/gantt.js +1 -1
  31. package/dist/index.d.ts +1 -1
  32. package/dist/locales/index.js +56 -0
  33. package/dist/locales/index.js.map +1 -1
  34. package/dist/m3ui-vue.css +1 -1
  35. package/dist/m3ui.js +3076 -1955
  36. package/dist/m3ui.js.map +1 -1
  37. package/dist/map.js +5 -5
  38. package/dist/media.js +4 -4
  39. package/dist/pdf.js +4 -4
  40. package/dist/rich-text-editor.js +4 -4
  41. package/dist/styles.css +1 -1
  42. package/dist/{useLocale-CaWwi-b6.js → useLocale-D2ucaY-l.js} +9 -1
  43. package/dist/useLocale-D2ucaY-l.js.map +1 -0
  44. package/package.json +1 -1
  45. package/src/__tests__/MFloorPlan.test.ts +423 -0
  46. package/src/components/MFloorPlan.vue +1337 -101
  47. package/src/components/MFloorPlanInspector.vue +21 -6
  48. package/src/components/MFloorPlanToolbar.vue +4 -3
  49. package/src/composables/useFloorPlan.ts +7 -3
  50. package/src/composables/useLocale.ts +17 -0
  51. package/src/index.ts +1 -1
  52. package/src/locales/de.ts +8 -0
  53. package/src/locales/es.ts +8 -0
  54. package/src/locales/fr.ts +8 -0
  55. package/src/locales/ja.ts +8 -0
  56. package/src/locales/ko.ts +8 -0
  57. package/src/locales/pt.ts +8 -0
  58. package/src/locales/zh.ts +8 -0
  59. package/dist/useLocale-CaWwi-b6.js.map +0 -1
package/dist/API.md CHANGED
@@ -1,4 +1,4 @@
1
- # @m3ui-vue/m3ui-vue 1.3.5 — API reference
1
+ # @m3ui-vue/m3ui-vue 1.3.7 — API reference
2
2
 
3
3
  Material Design 3 components for Vue 3 + Tailwind CSS v4. Generated from the source by
4
4
  `scripts/generate-api.mjs`; full docs with live demos at https://m3ui.dev.
@@ -1401,25 +1401,42 @@ Props:
1401
1401
  - `grid?: number = 10` — Grid step in plan units (0: no snapping)
1402
1402
  - `showGrid?: boolean = true` — Draw the grid while editing
1403
1403
  - `tableSnap?: "point" | "cell" = "point"` — Where a table's middle snaps: `point` a grid point (default), `cell` the middle of a grid square, so tables sit in the squares between the points while walls, zones and decor snap to the points (a plan of cells)
1404
+ - `subgrid?: number = 1` — Snapping steps per grid square for walls, zones and decor: 2 puts them on the points and halfway between them (tables keep to the grid). Drawn as smaller dots
1404
1405
  - `chairs?: boolean = true` — Draw chairs from `seats`
1406
+ - `measure?: FloorMeasure` — Real lengths: while editing, the picked wall's or zone's sides, the wall being drawn, and the picked table's or decor's size are labeled in your unit (the inspector's sizes too)
1407
+ - `seatNumbers?: boolean` — Number the chairs (1 from the top-left, clockwise); in service a click on one emits `seat-click`
1405
1408
  - `decorKinds?: Record<string, FloorDecorKind>` — Decor kinds of yours, or the built-in ones restyled (merged over them by name)
1406
- - `rotatable?: boolean = true` — The handle that turns the picked table or decor (off when your app doesn't keep angles)
1409
+ - `rotatable?: boolean | ("table" | "decor")[] = true` — What the turning handle turns: everything (`true`), nothing, or only these kinds (`['decor']` when your app keeps no tables' angles)
1410
+ - `cellSize?: number` — Tables placed by cell: their `x` / `y` are a column and a row (whole numbers from 0), each cell this many plan units wide. A table's middle sits in the middle of its cell and steps a cell at a time, and every table you get back (`update:tables`, `move`, events, slots) is in columns and rows. Zones, walls and decor stay in plan units
1411
+ - `zoomable?: boolean = false` — Zoom and pan: Ctrl + wheel or a pinch zooms (from the plan's own size up to `maxZoom`), the wheel, two fingers, a middle-button drag or (outside editing, or with a finger) a drag on empty floor pans, with + / − / fit buttons
1412
+ - `maxZoom?: number = 4`
1413
+ - `zoomControls?: boolean = true` — The zoom buttons, when zoomable
1414
+ - `backgroundImage?: string` — An image under everything (a scanned floor plan to trace over), placed in plan units (default: the whole plan)
1415
+ - `backgroundBox?: { x: number; y: number; width: number; height: number; }`
1416
+ - `backgroundOpacity?: number = 0.5` — Its opacity
1417
+ - `tableOrigin?: "center" | "corner" = "center"` — Which point of a table `x` / `y` name: its middle (default) or its top-left corner (unturned), as your data keeps it
1418
+ - `overlap?: "warn" | "allow" | "prevent" = "warn"` — Tables that overlap while editing: `warn` outlines them (default), `prevent` also undoes a move or a resize that would make one overlap another, `allow` says nothing
1419
+ - `resizeSnap?: "grid" | "free" | "subgrid" = "free"` — How a resize handle steps (tables and decor): `grid` whole grid squares, `subgrid` the snapping step of walls and zones (`subgrid`), `free` not at all. The change steps, not the size: a table drawn a little smaller than its square keeps that margin and grows by whole squares
1420
+ - `resizable?: boolean = true` — The handle that resizes the selected table (off when your tables keep one size)
1407
1421
  - `dragMerged?: boolean = false` — Dragging (or nudging) a merged table moves its whole merge with it
1408
1422
  - `selectable?: "none" | "multiple" | "single" = "none"` — What a click on a table selects outside editing: nothing, one, or several (toggling; to merge them). While editing, `multiple` keeps clicks toggling tables in and out of the selection, and a drag moves the table pressed on its own (to bring the ones being merged together)
1423
+ - `transferable?: boolean` — In service, a table carried onto another one emits `transfer` (to move its party, its bill): a mouse drags it, a finger holds it down first. The table itself doesn't move
1424
+ - `canTransfer?: ((from: FloorTable, to: FloorTable) => string | boolean)` — Whether a table's party may go to another table: `true`, or `false` / a reason (`transfer-refused` carries it)
1409
1425
  - `canMerge?: ((ids: (string | number)[]) => string | boolean)` — Whether these tables may be merged: `true`, or `false` / a reason to refuse (shown by `merge-refused`)
1410
1426
  - `label?: string` — Accessible name
1411
- - `tables?: FloorTable[] = []` (v-model:tables)
1427
+ - `tables?: FloorTable[] = []` (v-model:tables) — The tables as you keep them: plan units, or cells (`cellSize`), by their middle or corner (`tableOrigin`)
1412
1428
  - `merges?: FloorMerge[] = []` (v-model:merges)
1413
1429
  - `selection?: (string | number)[] = []` (v-model:selection)
1414
1430
  - `areas?: FloorArea[] = []` (v-model:areas)
1415
1431
  - `walls?: FloorWall[] = []` (v-model:walls)
1416
1432
  - `decor?: FloorDecor[] = []` (v-model:decor)
1417
- - `tool?: "select" | "area" | "wall" = "select"` (v-model:tool) — While editing: `select` moves things, `wall` draws a wall (click each corner, double-click or Enter to end), `area` drags out a zone
1433
+ - `tool?: "select" | "area" | "polygon" | "wall" = "select"` (v-model:tool) — While editing: `select` moves things, `wall` draws a wall (click each corner, double-click or Enter to end), `area` drags out a rectangular zone, `polygon` draws a zone of any shape corner by corner (click the first corner, double-click or Enter to close it)
1418
1434
  - `picked?: FloorPick = null` (v-model:picked) — While editing: the zone, wall (and corner) or decor item picked, for an inspector of your own
1435
+ - `zoom?: number = 1` (v-model:zoom) — Zoom (1: the whole plan; up to `maxZoom`), with `zoomable`
1419
1436
 
1420
1437
  Events:
1421
1438
  - `split(merge: FloorMerge)`
1422
- - `update:tool(value: "select" | "area" | "wall")`
1439
+ - `update:tool(value: "select" | "area" | "polygon" | "wall")`
1423
1440
  - `update:selection(value: (string | number)[])`
1424
1441
  - `update:tables(value: FloorTable[])`
1425
1442
  - `update:merges(value: FloorMerge[])`
@@ -1427,8 +1444,12 @@ Events:
1427
1444
  - `update:walls(value: FloorWall[])`
1428
1445
  - `update:decor(value: FloorDecor[])`
1429
1446
  - `update:picked(value: FloorPick)`
1447
+ - `update:zoom(value: number)`
1430
1448
  - `merge(merge: FloorMerge)`
1431
1449
  - `merge-refused(ids: (string | number)[], reason: string)`
1450
+ - `transfer(from: FloorTable, to: FloorTable)`
1451
+ - `seat-click(table: FloorTable, seat: number, event: MouseEvent)`
1452
+ - `transfer-refused(from: FloorTable, to: FloorTable, reason: string)`
1432
1453
  - `table-click(table: FloorTable, event: MouseEvent | KeyboardEvent)` — A table was clicked or opened with Enter (not after a drag)
1433
1454
  - `move(moved: { id: string | number; x: number; y: number; }[])` — Tables moved by a drag or the arrows, with their new positions (`{ id, x, y }[]`), to save them
1434
1455
 
@@ -1453,6 +1474,10 @@ Exposed (template ref):
1453
1474
  - `canRedo: boolean`
1454
1475
  - `duplicate: () => void` — Copy the selected tables, or the picked zone or decor (also Ctrl+D)
1455
1476
  - `removeTables: (ids: (string | number)[]) => void` — Remove tables, taking them out of their merges (Delete does it for the selection)
1477
+ - `zoomTo: (z: number, px?: number | undefined, py?: number | undefined) => void` — Zoom (with `zoomable`): to a level, keeping the plan point under (px, py) in place; and centering on a plan point
1478
+ - `centerOn: (x: number, y: number, z?: number) => void`
1479
+ - `toSVG: () => string` — The plan as a standalone SVG string, or a PNG Blob (`pixelRatio` px per plan unit)
1480
+ - `toPNG: (pixelRatio?: number) => Promise<Blob>`
1456
1481
 
1457
1482
  ```ts
1458
1483
  /** A table on the plan, in plan units (not pixels) */
@@ -1472,6 +1497,8 @@ export interface FloorTable {
1472
1497
  status?: string
1473
1498
  /** A small badge: minutes seated, the total, a count… */
1474
1499
  badge?: string | number
1500
+ /** Seats taken (numbered from 1, clockwise from the top-left), drawn in the status color */
1501
+ activeSeats?: number[]
1475
1502
  data?: Record<string, unknown>
1476
1503
  }
1477
1504
  ```
@@ -1505,6 +1532,11 @@ export interface FloorArea {
1505
1532
  height: number
1506
1533
  /** An M3 color role or any CSS color */
1507
1534
  color?: string
1535
+ /**
1536
+ * A zone of any shape (an L-shaped room): its corners. x / y / width / height are then the box around them, kept up
1537
+ * to date. Double-click a rectangular zone's edge to give it corners
1538
+ */
1539
+ points?: [number, number][]
1508
1540
  }
1509
1541
  ```
1510
1542
 
@@ -1528,13 +1560,15 @@ export interface FloorDecor {
1528
1560
  width?: number
1529
1561
  height?: number
1530
1562
  rotation?: number
1563
+ /** Mirrored across its length: a door hinged on the other side */
1564
+ flip?: boolean
1531
1565
  /** The text of a label (or a caption under the others) */
1532
1566
  label?: string
1533
1567
  }
1534
1568
  ```
1535
1569
 
1536
1570
  ```ts
1537
- /** What's picked on the plan besides tables: a zone, a wall (and one of its corners) or a decor item */
1571
+ /** What's picked on the plan besides tables: a zone, a wall (and one of its corners, as a zone of any shape) or a decor item */
1538
1572
  export type FloorPick = { kind: 'area' | 'wall' | 'decor'; id: string | number; vertex?: number } | null
1539
1573
  ```
1540
1574
 
@@ -1546,8 +1580,11 @@ export interface FloorDecorKind {
1546
1580
  icon?: string
1547
1581
  width: number
1548
1582
  height: number
1549
- /** `box` a rounded rectangle, `round` a circle, `bar` a thin slab (doors, windows), `text` the item's label only */
1550
- shape?: 'box' | 'round' | 'bar' | 'text'
1583
+ /**
1584
+ * `box` a rounded rectangle, `round` a circle, `bar` a thin slab, `door` an opening with its leaf and swing (as on an
1585
+ * architect's plan), `window` a framed pane, `text` the item's label only. A door or window cuts the wall it sits on
1586
+ */
1587
+ shape?: 'box' | 'round' | 'bar' | 'door' | 'window' | 'text'
1551
1588
  /** Fill: an M3 color role (`surface`, `primary`…) or any CSS color */
1552
1589
  color?: string
1553
1590
  }
@@ -1557,9 +1594,19 @@ export interface FloorDecorKind {
1557
1594
  export type FloorDecorBuiltin = 'door' | 'window' | 'plant' | 'column' | 'restroom' | 'kitchen' | 'register' | 'stairs' | 'label'
1558
1595
  ```
1559
1596
 
1597
+ ```ts
1598
+ /** Real lengths for the plan: `per` plan units make one `unit` (100 and 'm': a plan unit is a centimeter) */
1599
+ export interface FloorMeasure {
1600
+ unit: string
1601
+ per: number
1602
+ /** Decimals shown (default 2) */
1603
+ decimals?: number
1604
+ }
1605
+ ```
1606
+
1560
1607
  ### MFloorPlanInspector
1561
1608
 
1562
- Edits what's picked on an MFloorPlan: a table (name, seats, shape, angle; split it if merged), several tables (merge them), a zone (name, color), a wall (thickness, delete a corner) or decor (text, size, angle); duplicate and delete. A slot per kind adds fields of your own below the built-in ones, with an `update` to change the item (an undo step). Inside the plan's `#overlay` slot it finds the plan by itself; anywhere else, pass the plan's template ref as `plan`. Not an M3 spec component.
1609
+ Edits what's picked on an MFloorPlan: a table (name, seats, shape, angle; split it if merged), several tables (merge them), a zone (name, color), a wall (thickness, delete a corner) or decor (text, size, angle, a door's side); duplicate and delete. A slot per kind adds fields of your own below the built-in ones, with an `update` to change the item (an undo step). Inside the plan's `#overlay` slot it finds the plan by itself; anywhere else, pass the plan's template ref as `plan`. Not an M3 spec component.
1563
1610
 
1564
1611
  Props:
1565
1612
  - `plan?: FloorPlanContext | { context: FloorPlanContext; } | null = null` — The plan: its template ref (or its `context`). Not needed inside the plan's slots
@@ -1576,7 +1623,7 @@ Slots:
1576
1623
 
1577
1624
  ### MFloorPlanToolbar
1578
1625
 
1579
- A toolbar for editing an MFloorPlan: move / draw a wall / drag out a zone, add a table (your presets) or decor (any kind, yours too), duplicate, delete, undo and redo. Inside the plan's `#overlay` slot it finds the plan by itself; anywhere else, pass the plan's template ref as `plan`. Not an M3 spec component.
1626
+ A toolbar for editing an MFloorPlan: move / draw a wall / drag out a zone / draw a zone of any shape, add a table (your presets) or decor (any kind, yours too), duplicate, delete, undo and redo. Inside the plan's `#overlay` slot it finds the plan by itself; anywhere else, pass the plan's template ref as `plan`. Not an M3 spec component.
1580
1627
 
1581
1628
  Props:
1582
1629
  - `plan?: FloorPlanContext | { context: FloorPlanContext; } | null = null` — The plan: its template ref (or its `context`). Not needed inside the plan's slots
@@ -2310,9 +2357,9 @@ Props:
2310
2357
 
2311
2358
  Events:
2312
2359
  - `click(event: maplibregl.MapMouseEvent)` — A click on the map (MapLibre's `MapMouseEvent`: `lngLat`, `point`)
2360
+ - `update:zoom(zoom: number)` — The zoom changed (on `moveend`)
2313
2361
  - `ready(map: maplibregl.Map)` — The map loaded (with its style), with the MapLibre `Map`
2314
2362
  - `update:center(center: [number, number])` — The view moved (on `moveend`): `[lng, lat]`
2315
- - `update:zoom(zoom: number)` — The zoom changed (on `moveend`)
2316
2363
  - `update:bearing(bearing: number)` — The rotation changed (on `moveend`)
2317
2364
  - `update:pitch(pitch: number)` — The tilt changed (on `moveend`)
2318
2365
 
@@ -2981,8 +3028,8 @@ Events:
2981
3028
  - `link({ url?: string | undefined; page?: number | undefined; })` — A link was followed: `{ url }` (opens in a new tab) or `{ page }` (scrolled to)
2982
3029
  - `update:page(number)`
2983
3030
  - `update:tool(PdfTool)`
2984
- - `update:rotation(number)`
2985
3031
  - `update:zoom(PdfZoom)`
3032
+ - `update:rotation(number)`
2986
3033
  - `update:annotations(PdfAnnotation[])`
2987
3034
  - `update:sidebar("thumbnails" | "outline" | null)`
2988
3035
  - `loaded(PDFDocumentProxy)` — The document loaded, with its pdf.js proxy
@@ -3196,7 +3243,7 @@ Props:
3196
3243
  - `listWidth?: number` (v-model:listWidth) — The resource column's width, px (`v-model:list-width`; drag its edge); 0 hides it
3197
3244
  - `rowHeight?: number = 56` — A row's least height; rows grow with their lanes
3198
3245
  - `laneHeight?: number = 40` — One lane's height (a booking and its gap)
3199
- - `overlap?: "stack" | "prevent" = "stack"` — `'stack'` (default): overlaps share the row in lanes and show as conflicts past `capacity`; `'prevent'` also refuses a drop that makes one
3246
+ - `overlap?: "prevent" | "stack" = "stack"` — `'stack'` (default): overlaps share the row in lanes and show as conflicts past `capacity`; `'prevent'` also refuses a drop that makes one
3200
3247
  - `creatable?: boolean = false` — Dragging across empty time asks for a booking there (`create`)
3201
3248
  - `readonly?: boolean = false`
3202
3249
  - `snap?: number` — Minutes bookings snap to (default 15; by zoom when zoomed far out); whole-day bookings snap to days
@@ -7745,6 +7792,15 @@ export interface M3Locale {
7745
7792
  floorSquare: string
7746
7793
  floorLong: string
7747
7794
  floorAngle: string
7795
+ /** A door's button: hinge it on the other side */
7796
+ floorFlip: string
7797
+ floorZoomIn: string
7798
+ floorZoomOut: string
7799
+ floorZoomFit: string
7800
+ floorOverlaps: string
7801
+ floorSeatN: string
7802
+ floorDrawShape: string
7803
+ floorShapeHint: string
7748
7804
  floorColor: string
7749
7805
  floorThickness: string
7750
7806
  floorWidth: string
@@ -8154,10 +8210,14 @@ export interface FloorPlanContext {
8154
8210
  picked: Ref<FloorPick>
8155
8211
  tool: Ref<FloorTool>
8156
8212
  editable: ComputedRef<boolean>
8157
- /** A wall is being drawn (tool `wall`): finish it (also double-click / Enter) or cancel it (Escape) */
8213
+ /** A wall (tool `wall`) or a zone of any shape (tool `polygon`) is being drawn: finish it (also double-click / Enter) or cancel it (Escape) */
8158
8214
  drawingWall: ComputedRef<boolean>
8159
8215
  finishWall(): void
8160
8216
  cancelWall(): void
8217
+ /** A table's size in plan units (its own, or the default for its shape and seats) */
8218
+ tableSize(table: FloorTable): { w: number; h: number }
8219
+ /** The plan's real lengths (`measure`), if it has them */
8220
+ measure: ComputedRef<FloorMeasure | undefined>
8161
8221
  /** The decor kinds: built-in ones merged with `decorKinds` */
8162
8222
  kinds: ComputedRef<Record<string, FloorDecorKind>>
8163
8223
  statuses: ComputedRef<Record<string, FloorStatus>>
@@ -8187,7 +8247,7 @@ export interface FloorPlanContext {
8187
8247
  ```
8188
8248
 
8189
8249
  ```ts
8190
- export type FloorTool = 'select' | 'wall' | 'area'
8250
+ export type FloorTool = 'select' | 'wall' | 'area' | 'polygon'
8191
8251
  ```
8192
8252
 
8193
8253
  ```ts
@@ -8212,7 +8272,7 @@ export interface EmojiCategory {
8212
8272
  `M3Locale` keys (pass a partial object to `createM3UI({ locale })`; presets from `@m3ui-vue/m3ui-vue/locales`:
8213
8273
  `esLocale`, `frLocale`, `ptLocale`, `deLocale`, `jaLocale`, `zhLocale`, `koLocale`):
8214
8274
 
8215
- lang, search, noResults, close, cancel, confirm, loading, menu, previous, next, today, more, selectedCount, recordCount, expand, collapse, clear, columns, exportCsv, noGroup, finish, dropText, selectText, maxSizePrefix, remove, selectDate, ok, dateToggleInput, dateToggleCalendar, dateInputLabel, selectTime, timeHourSelection, timeMinuteSelection, timePeriodToggle, timeToggleKeyboard, timeToggleDial, timeToggleScroll, sheetExpand, sheetCollapse, sheetDismiss, seekBar, seekBarValue, seekBarShowRemaining, seekBarShowDuration, selectRange, pickStart, pickEnd, previousMonth, nextMonth, selectColor, colorHue, colorSaturation, colorBrightness, colorAlpha, colorEyedropper, colorOriginal, colorFormat, colorRecent, colorPresets, dayView, weekView, allDay, emojiSearch, emojiNoResults, emojiRecent, emojiSkinTone, emojiSkinTones, emojiCategorySmileys, emojiCategoryGestures, emojiCategoryPeople, emojiCategoryAnimals, emojiCategoryNature, emojiCategoryFood, emojiCategoryActivities, emojiCategoryTravel, emojiCategoryObjects, emojiCategorySymbols, emojiCategoryFlags, available, selected, noItems, moveAllRight, moveRight, moveLeft, moveAllLeft, searchCommand, navigateHint, selectHint, openHint, closeHint, loadingMore, noMoreItems, bold, italic, underline, strikethrough, highlight, bulletList, orderedList, blockquote, code, alignLeft, alignCenter, alignRight, undo, redo, link, image, paragraph, heading1, heading2, heading3, insertLink, insertImage, imageUrlLabel, insert, jsonValid, jsonInvalid, jsonFormat, jsonMinify, jsonElements, jsonFields, resultSuccessTitle, resultSuccessDesc, resultErrorTitle, resultErrorDesc, resultWarningTitle, resultWarningDesc, resultInfoTitle, resultInfoDesc, result404Title, result404Desc, result403Title, result403Desc, result500Title, result500Desc, chatTyping, chatRecordingAudio, reorderHandle, reorderGrabbed, reorderMoved, reorderDropped, reorderCancelled, selectAll, clearSearch, kanbanMoved, windowMinimize, windowMaximize, windowRestore, paginationRange, paginationPage, previousPage, nextPage, carousel, carouselItem, sparklineSummary, sliderRangeStart, sliderRangeEnd, mapTitle, mapMarker, mapZoomIn, mapZoomOut, mapResetBearing, mapFindMyLocation, mapLocationNotAvailable, mapEnterFullscreen, mapExitFullscreen, mapToggleAttribution, mapFeedback, mapCtrlScroll, mapCmdScroll, mapTwoFingers, mapLayers, mapSearchLayers, mapNoLayers, mapShowLayer, mapHideLayer, mapOpacity, mapDownload, mapNoBaseLayer, mapHoverInfo, mapNoValue, mapMeasureDistance, mapMeasureArea, mapClearMeasurements, mapDeleteMeasurement, mapTotal, mapSearchPlaces, timelineShowMore, timelineShowLess, mediaPlayer, mediaPlay, mediaPause, mediaReplay, mediaSeekBack, mediaSeekForward, mediaSeconds, mediaMute, mediaUnmute, mediaVolume, mediaFullscreen, mediaExitFullscreen, mediaPictureInPicture, mediaSettings, mediaSpeed, mediaSpeedNormal, mediaSubtitles, mediaSubtitlesOff, mediaQuality, mediaQualityAuto, mediaLive, mediaError, mediaRepeat, mediaRepeatOne, mediaShuffle, pdfViewer, pdfThumbnails, pdfOutline, pdfPage, pdfZoom, pdfZoomIn, pdfZoomOut, pdfFitWidth, pdfFitPage, pdfSearch, pdfSearchPrevious, pdfSearchNext, pdfMatchCount, pdfNoMatches, pdfMore, pdfRotate, pdfDownload, pdfPrint, pdfFullscreen, pdfExitFullscreen, pdfPassword, pdfPasswordLabel, pdfWrongPassword, pdfOpen, pdfError, pdfLoading, pdfAnnotate, pdfSelect, pdfHighlight, pdfNote, pdfDraw, pdfEraser, pdfInkWidth, pdfColor, pdfUndo, pdfCopy, pdfDelete, pdfNotePlaceholder, pdfAddComment, flowCanvas, flowNode, flowEdge, flowZoomIn, flowZoomOut, flowFitView, flowLock, flowUnlock, flowUndo, flowRedo, flowMinimap, flowMoved, flowConnected, flowDeleted, flowDeleteEdge, flowDelete, ganttChart, ganttTask, ganttStart, ganttEnd, ganttDuration, ganttProgress, ganttDays, ganttHours, ganttMilestone, ganttQuarter, ganttToday, ganttZoomIn, ganttZoomOut, ganttExpandAll, ganttCollapseAll, ganttExpand, ganttCollapse, ganttUndo, ganttRedo, ganttScaleHour, ganttScaleDay, ganttScaleWeek, ganttScaleMonth, ganttScaleQuarter, ganttScaleYear, ganttMoved, ganttProgressSet, ganttLinked, ganttUnlink, ganttDeleted, ganttDelete, ganttReordered, ganttSlack, ganttCritical, ganttBaseline, ganttEmpty, ganttResize, timelineResource, timelineConflict, timelineMoved, timelineEmpty, cropArea, cropRotateLeft, cropRotateRight, cropFlip, cropReset, cropFree, drawCanvas, drawTools, drawMore, drawSelect, drawPan, drawPen, drawBrush, drawMarker, drawHighlighter, drawEraser, drawStrokeEraser, drawLine, drawArrow, drawRect, drawEllipse, drawText, drawFill, drawColor, floorPlan, floorSeats, floorRotate, floorTools, floorMove, floorDrawWall, floorDrawZone, floorAddTable, floorAddDecor, floorDuplicate, floorDelete, floorUndo, floorRedo, floorLabel, floorSeatsField, floorShape, floorRound, floorSquare, floorLong, floorAngle, floorColor, floorThickness, floorWidth, floorHeight, floorMerge, floorSplit, floorNothingPicked, floorTablesPicked, floorTableN, floorZone, floorWall, floorDeleteCorner, floorFinishWall, floorCancel, floorDecorDoor, floorDecorWindow, floorDecorPlant, floorDecorColumn, floorDecorRestroom, floorDecorKitchen, floorDecorRegister, floorDecorStairs, floorDecorLabel, drawCustomColor, drawSize, drawUndo, drawRedo, drawDelete, drawLayers, drawLayer, drawLayerName, drawAddLayer, drawDeleteLayer, drawShowLayer, drawHideLayer, drawLockLayer, drawUnlockLayer, drawLayerUp, drawLayerDown
8275
+ lang, search, noResults, close, cancel, confirm, loading, menu, previous, next, today, more, selectedCount, recordCount, expand, collapse, clear, columns, exportCsv, noGroup, finish, dropText, selectText, maxSizePrefix, remove, selectDate, ok, dateToggleInput, dateToggleCalendar, dateInputLabel, selectTime, timeHourSelection, timeMinuteSelection, timePeriodToggle, timeToggleKeyboard, timeToggleDial, timeToggleScroll, sheetExpand, sheetCollapse, sheetDismiss, seekBar, seekBarValue, seekBarShowRemaining, seekBarShowDuration, selectRange, pickStart, pickEnd, previousMonth, nextMonth, selectColor, colorHue, colorSaturation, colorBrightness, colorAlpha, colorEyedropper, colorOriginal, colorFormat, colorRecent, colorPresets, dayView, weekView, allDay, emojiSearch, emojiNoResults, emojiRecent, emojiSkinTone, emojiSkinTones, emojiCategorySmileys, emojiCategoryGestures, emojiCategoryPeople, emojiCategoryAnimals, emojiCategoryNature, emojiCategoryFood, emojiCategoryActivities, emojiCategoryTravel, emojiCategoryObjects, emojiCategorySymbols, emojiCategoryFlags, available, selected, noItems, moveAllRight, moveRight, moveLeft, moveAllLeft, searchCommand, navigateHint, selectHint, openHint, closeHint, loadingMore, noMoreItems, bold, italic, underline, strikethrough, highlight, bulletList, orderedList, blockquote, code, alignLeft, alignCenter, alignRight, undo, redo, link, image, paragraph, heading1, heading2, heading3, insertLink, insertImage, imageUrlLabel, insert, jsonValid, jsonInvalid, jsonFormat, jsonMinify, jsonElements, jsonFields, resultSuccessTitle, resultSuccessDesc, resultErrorTitle, resultErrorDesc, resultWarningTitle, resultWarningDesc, resultInfoTitle, resultInfoDesc, result404Title, result404Desc, result403Title, result403Desc, result500Title, result500Desc, chatTyping, chatRecordingAudio, reorderHandle, reorderGrabbed, reorderMoved, reorderDropped, reorderCancelled, selectAll, clearSearch, kanbanMoved, windowMinimize, windowMaximize, windowRestore, paginationRange, paginationPage, previousPage, nextPage, carousel, carouselItem, sparklineSummary, sliderRangeStart, sliderRangeEnd, mapTitle, mapMarker, mapZoomIn, mapZoomOut, mapResetBearing, mapFindMyLocation, mapLocationNotAvailable, mapEnterFullscreen, mapExitFullscreen, mapToggleAttribution, mapFeedback, mapCtrlScroll, mapCmdScroll, mapTwoFingers, mapLayers, mapSearchLayers, mapNoLayers, mapShowLayer, mapHideLayer, mapOpacity, mapDownload, mapNoBaseLayer, mapHoverInfo, mapNoValue, mapMeasureDistance, mapMeasureArea, mapClearMeasurements, mapDeleteMeasurement, mapTotal, mapSearchPlaces, timelineShowMore, timelineShowLess, mediaPlayer, mediaPlay, mediaPause, mediaReplay, mediaSeekBack, mediaSeekForward, mediaSeconds, mediaMute, mediaUnmute, mediaVolume, mediaFullscreen, mediaExitFullscreen, mediaPictureInPicture, mediaSettings, mediaSpeed, mediaSpeedNormal, mediaSubtitles, mediaSubtitlesOff, mediaQuality, mediaQualityAuto, mediaLive, mediaError, mediaRepeat, mediaRepeatOne, mediaShuffle, pdfViewer, pdfThumbnails, pdfOutline, pdfPage, pdfZoom, pdfZoomIn, pdfZoomOut, pdfFitWidth, pdfFitPage, pdfSearch, pdfSearchPrevious, pdfSearchNext, pdfMatchCount, pdfNoMatches, pdfMore, pdfRotate, pdfDownload, pdfPrint, pdfFullscreen, pdfExitFullscreen, pdfPassword, pdfPasswordLabel, pdfWrongPassword, pdfOpen, pdfError, pdfLoading, pdfAnnotate, pdfSelect, pdfHighlight, pdfNote, pdfDraw, pdfEraser, pdfInkWidth, pdfColor, pdfUndo, pdfCopy, pdfDelete, pdfNotePlaceholder, pdfAddComment, flowCanvas, flowNode, flowEdge, flowZoomIn, flowZoomOut, flowFitView, flowLock, flowUnlock, flowUndo, flowRedo, flowMinimap, flowMoved, flowConnected, flowDeleted, flowDeleteEdge, flowDelete, ganttChart, ganttTask, ganttStart, ganttEnd, ganttDuration, ganttProgress, ganttDays, ganttHours, ganttMilestone, ganttQuarter, ganttToday, ganttZoomIn, ganttZoomOut, ganttExpandAll, ganttCollapseAll, ganttExpand, ganttCollapse, ganttUndo, ganttRedo, ganttScaleHour, ganttScaleDay, ganttScaleWeek, ganttScaleMonth, ganttScaleQuarter, ganttScaleYear, ganttMoved, ganttProgressSet, ganttLinked, ganttUnlink, ganttDeleted, ganttDelete, ganttReordered, ganttSlack, ganttCritical, ganttBaseline, ganttEmpty, ganttResize, timelineResource, timelineConflict, timelineMoved, timelineEmpty, cropArea, cropRotateLeft, cropRotateRight, cropFlip, cropReset, cropFree, drawCanvas, drawTools, drawMore, drawSelect, drawPan, drawPen, drawBrush, drawMarker, drawHighlighter, drawEraser, drawStrokeEraser, drawLine, drawArrow, drawRect, drawEllipse, drawText, drawFill, drawColor, floorPlan, floorSeats, floorRotate, floorTools, floorMove, floorDrawWall, floorDrawZone, floorAddTable, floorAddDecor, floorDuplicate, floorDelete, floorUndo, floorRedo, floorLabel, floorSeatsField, floorShape, floorRound, floorSquare, floorLong, floorAngle, floorFlip, floorZoomIn, floorZoomOut, floorZoomFit, floorOverlaps, floorSeatN, floorDrawShape, floorShapeHint, floorColor, floorThickness, floorWidth, floorHeight, floorMerge, floorSplit, floorNothingPicked, floorTablesPicked, floorTableN, floorZone, floorWall, floorDeleteCorner, floorFinishWall, floorCancel, floorDecorDoor, floorDecorWindow, floorDecorPlant, floorDecorColumn, floorDecorRestroom, floorDecorKitchen, floorDecorRegister, floorDecorStairs, floorDecorLabel, drawCustomColor, drawSize, drawUndo, drawRedo, drawDelete, drawLayers, drawLayer, drawLayerName, drawAddLayer, drawDeleteLayer, drawShowLayer, drawHideLayer, drawLockLayer, drawUnlockLayer, drawLayerUp, drawLayerDown
8216
8276
 
8217
8277
  ## Theme tokens
8218
8278
 
@@ -1,6 +1,6 @@
1
1
  import { p as e } from "./MIconButton-DoNotQ9v.js";
2
2
  import { t } from "./MIcon-Bxh9j135.js";
3
- import { t as n } from "./MSpinner-C2SUnWk4.js";
3
+ import { t as n } from "./MSpinner-BNF8MN-L.js";
4
4
  import { Fragment as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, defineComponent as c, normalizeClass as l, normalizeStyle as u, openBlock as d, renderSlot as f, resolveDynamicComponent as p, unref as m, withCtx as h, withDirectives as g } from "vue";
5
5
  //#region src/components/MButton.vue?vue&type=script&setup=true&lang.ts
6
6
  var _ = "relative inline-flex items-center justify-center font-medium whitespace-nowrap overflow-hidden transition-[box-shadow,background-color,color] duration-150 select-none cursor-pointer disabled:cursor-not-allowed disabled:shadow-none disabled:text-on-surface/38 before:content-[''] before:pointer-events-none before:absolute before:inset-0 before:bg-current before:opacity-0 before:transition-opacity before:duration-150 enabled:hover:before:opacity-[0.08] enabled:active:before:opacity-[0.12]", v = /* @__PURE__ */ c({
@@ -169,4 +169,4 @@ var _ = "relative inline-flex items-center justify-center font-medium whitespace
169
169
  //#endregion
170
170
  export { v as t };
171
171
 
172
- //# sourceMappingURL=MButton-Bl_BSUep.js.map
172
+ //# sourceMappingURL=MButton-D5eJiDza.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MButton-Bl_BSUep.js","names":[],"sources":["../src/components/MButton.vue","../src/components/MButton.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * The standard M3 button — five variants, five expressive size tiers, and either color.\n *\n * @slot default The button's label.\n */\nimport { computed } from 'vue'\nimport MSpinner from './MSpinner.vue'\nimport MIcon from './MIcon.vue'\nimport { vRipple } from '../directives/vRipple'\n\nconst NAMED_COLORS = ['primary', 'error'] as const\ntype NamedColor = (typeof NAMED_COLORS)[number]\n\nconst props = withDefaults(\n defineProps<{\n /** Visual style of the button */\n variant?: 'filled' | 'tonal' | 'outlined' | 'text' | 'elevated'\n /**\n * Named semantic color ('primary' | 'error') OR any CSS color string\n * ('red', '#e91e63', 'oklch(0.6 0.2 0)', …).\n * When a CSS color is passed, --color-primary is overridden for this button.\n */\n color?: string\n /** HTML button type */\n type?: 'button' | 'submit' | 'reset'\n /** Disables interaction */\n disabled?: boolean\n /** Shows a spinner and disables the button */\n loading?: boolean\n /** Material Symbol icon name shown next to the label */\n icon?: string\n /** Draw the icon filled (Material Symbols' FILL axis), e.g. a starred star or a play icon */\n iconFilled?: boolean\n /** Which side of the label the icon renders on */\n // Which side of the label `icon` renders on. Real M3 buttons support both via\n // `ButtonDefaults.contentPaddingFor(hasStartIcon/hasEndIcon)` — padding ends up identical\n // either way at every tier, so this only changes render order, not spacing.\n iconPos?: 'leading' | 'trailing'\n /**\n * M3's 5-tier expressive button sizing (xs: 32px, sm: 40px, md: 56px, lg: 96px, xl: 136px) — lg/xl are\n * meant for hero-style prominent buttons, not everyday UI\n */\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n /**\n * Button shape — rounded (pill, always) or squared (corner radius scales with size: 12px xs/sm, 16px md,\n * 28px lg/xl)\n */\n shape?: 'rounded' | 'squared'\n /** Vue Router destination — renders as RouterLink instead of button */\n to?: string | Record<string, any>\n /** Any CSS color for the press ripple; defaults to the button's content color */\n rippleColor?: string\n /**\n * Label and icon color, over what the variant and `color` give: an M3 role (`on-surface` for a neutral text\n * button, `on-primary-container`…) or any CSS color (`#000` on a white filled button). Disabled buttons keep\n * their own\n */\n contentColor?: string\n }>(),\n {\n variant: 'filled',\n color: 'primary',\n type: 'button',\n disabled: false,\n loading: false,\n iconPos: 'leading',\n size: 'sm',\n shape: 'rounded',\n },\n)\n\nconst tag = computed(() => props.to ? 'RouterLink' : 'button')\n\nconst isCustomColor = computed(\n () => !!props.color && !(NAMED_COLORS as readonly string[]).includes(props.color),\n)\n\nconst customStyle = computed(() => {\n if (!isCustomColor.value) return undefined\n return {\n '--color-primary': props.color,\n '--color-on-primary': '#ffffff',\n '--color-primary-container': props.color + '33',\n '--color-on-primary-container': props.color,\n }\n})\n\nconst isError = computed(() => props.color === 'error')\n\n// Color-role names (`on-surface`, `secondary-container`…) read the theme's token; anything else is a CSS color\nconst ROLE = /^(on-)?(primary|secondary|tertiary|error|surface|surface-variant|inverse-surface|inverse-primary)(-container|-variant)?$/\nconst style = computed(() => {\n const c = props.contentColor\n if (!c || props.disabled || props.loading) return customStyle.value\n return { ...customStyle.value, color: ROLE.test(c) ? `var(--color-${c})` : c }\n})\n\nconst base =\n 'relative inline-flex items-center justify-center font-medium ' +\n 'whitespace-nowrap overflow-hidden transition-[box-shadow,background-color,color] duration-150 select-none cursor-pointer ' +\n 'disabled:cursor-not-allowed disabled:shadow-none disabled:text-on-surface/38 ' +\n \"before:content-[''] before:pointer-events-none before:absolute before:inset-0 \" +\n 'before:bg-current before:opacity-0 before:transition-opacity before:duration-150 ' +\n 'enabled:hover:before:opacity-[0.08] enabled:active:before:opacity-[0.12]'\n\n// M3 disabled tokens: container at 10% on-surface opacity (DisabledContainerOpacity, same\n// across Filled/Tonal/Elevated), content/label always at 38% on-surface (handled in `base`\n// above, applies to every variant including text/elevated which have no container). The\n// outlined border uses the SAME color role as its enabled border (OutlineVariant, not\n// on-surface) just dimmed to that 10% too — see `variantClasses`' outlined case below for\n// why the enabled color is also outline-variant, not outline.\nconst disabledContainerClasses = computed(() => {\n switch (props.variant) {\n case 'filled':\n case 'tonal':\n case 'elevated':\n return 'disabled:bg-on-surface/10'\n case 'outlined':\n return isError.value ? 'disabled:border-error/10' : 'disabled:border-outline-variant/10'\n default:\n return ''\n }\n})\n\n/*\n * M3's newer 5-tier \"expressive\" button sizing (Button{XSmall,Small,Medium,Large,\n * XLarge}Tokens.kt + Button.kt's size-variant overloads — @ExperimentalMaterial3ExpressiveApi\n * in Compose, but this `size` prop is deliberately implementing exactly that system, same\n * as MFabMenu/MLoadingIndicator already do for other Expressive-only components). Content\n * padding is IDENTICAL whether or not an icon is present at every tier in the default\n * (non \"precision pointer\") mode — e.g. `IconMediumLeadingPadding = MediumLeadingPadding`\n * verbatim in the real source — so there's deliberately no separate icon-vs-no-icon padding\n * split here, unlike the old version of this file which had one (and got the values wrong\n * in both directions). `gap` between icon and label also varies by tier (IconLabelSpace),\n * not a flat value for every size.\n */\nconst sizeMap = {\n xs: { h: 'h-8', text: 'text-label-large', icon: 20, spinner: 16, gap: 'gap-1', px: 'px-3', pxText: 'px-2', squareRadius: 'rounded-md' },\n sm: { h: 'h-10', text: 'text-label-large', icon: 20, spinner: 16, gap: 'gap-2', px: 'px-4', pxText: 'px-3', squareRadius: 'rounded-md' },\n md: { h: 'h-14', text: 'text-title-medium', icon: 24, spinner: 18, gap: 'gap-2', px: 'px-6', pxText: 'px-3', squareRadius: 'rounded-lg' },\n lg: { h: 'h-24', text: 'text-headline-small', icon: 32, spinner: 26, gap: 'gap-3', px: 'px-12', pxText: 'px-4', squareRadius: 'rounded-xl' },\n xl: { h: 'h-[136px]', text: 'text-headline-large', icon: 40, spinner: 34, gap: 'gap-4', px: 'px-16', pxText: 'px-4', squareRadius: 'rounded-xl' },\n}\n\nconst s = computed(() => sizeMap[props.size] ?? sizeMap.sm)\nconst sizeClasses = computed(() => `${s.value.h} ${s.value.text} ${s.value.gap}`)\nconst iconSize = computed(() => s.value.icon)\nconst spinnerSize = computed(() => s.value.spinner)\n\nconst px = computed(() => props.variant === 'text' ? s.value.pxText : s.value.px)\n\n// Squared shape radius scales with size, matching each tier's own ContainerShapeSquare\n// token (ButtonXSmallTokens/ButtonSmallTokens use CornerMedium=12px, ButtonMediumTokens\n// CornerLarge=16px, ButtonLargeTokens/ButtonXLargeTokens CornerExtraLarge=28px) — the\n// pill (ContainerShapeRound) is CornerFull at every tier, so that half doesn't vary.\nconst shapeClass = computed(() => props.shape === 'squared' ? s.value.squareRadius : 'rounded-full')\n\nconst variantClasses = computed(() => {\n const err = isError.value\n switch (props.variant) {\n case 'filled':\n return err\n ? 'bg-error text-on-error enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n : 'bg-primary text-on-primary enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n case 'tonal':\n return err\n ? 'bg-error-container text-on-error-container enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n : 'bg-secondary-container text-on-secondary-container enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n case 'elevated':\n return err\n ? 'bg-surface-container-low text-error shadow-elevation-1 enabled:hover:shadow-elevation-2'\n : 'bg-surface-container-low text-primary shadow-elevation-1 enabled:hover:shadow-elevation-2'\n case 'outlined':\n // OutlinedButtonTokens.OutlineColor = ColorSchemeKeyTokens.OutlineVariant, not Outline\n return err\n ? 'border border-error text-error'\n : 'border border-outline-variant text-primary'\n case 'text':\n return err\n ? 'text-error'\n : 'text-primary'\n default:\n return ''\n }\n})\n</script>\n\n<template>\n <component\n :is=\"tag\"\n :to=\"to || undefined\"\n :type=\"to ? undefined : type\"\n :disabled=\"disabled || loading\"\n :class=\"[base, shapeClass, sizeClasses, px, variantClasses, disabledContainerClasses]\"\n :style=\"style\"\n v-ripple=\"{ disabled: disabled || loading, color: rippleColor }\"\n >\n <template v-if=\"iconPos === 'leading'\">\n <MSpinner v-if=\"loading\" :size=\"spinnerSize\" />\n <MIcon v-else-if=\"icon\" :name=\"icon\" :size=\"iconSize\" :filled=\"iconFilled\" />\n </template>\n <slot />\n <template v-if=\"iconPos === 'trailing'\">\n <MSpinner v-if=\"loading\" :size=\"spinnerSize\" />\n <MIcon v-else-if=\"icon\" :name=\"icon\" :size=\"iconSize\" :filled=\"iconFilled\" />\n </template>\n </component>\n</template>\n","<script setup lang=\"ts\">\n/**\n * The standard M3 button — five variants, five expressive size tiers, and either color.\n *\n * @slot default The button's label.\n */\nimport { computed } from 'vue'\nimport MSpinner from './MSpinner.vue'\nimport MIcon from './MIcon.vue'\nimport { vRipple } from '../directives/vRipple'\n\nconst NAMED_COLORS = ['primary', 'error'] as const\ntype NamedColor = (typeof NAMED_COLORS)[number]\n\nconst props = withDefaults(\n defineProps<{\n /** Visual style of the button */\n variant?: 'filled' | 'tonal' | 'outlined' | 'text' | 'elevated'\n /**\n * Named semantic color ('primary' | 'error') OR any CSS color string\n * ('red', '#e91e63', 'oklch(0.6 0.2 0)', …).\n * When a CSS color is passed, --color-primary is overridden for this button.\n */\n color?: string\n /** HTML button type */\n type?: 'button' | 'submit' | 'reset'\n /** Disables interaction */\n disabled?: boolean\n /** Shows a spinner and disables the button */\n loading?: boolean\n /** Material Symbol icon name shown next to the label */\n icon?: string\n /** Draw the icon filled (Material Symbols' FILL axis), e.g. a starred star or a play icon */\n iconFilled?: boolean\n /** Which side of the label the icon renders on */\n // Which side of the label `icon` renders on. Real M3 buttons support both via\n // `ButtonDefaults.contentPaddingFor(hasStartIcon/hasEndIcon)` — padding ends up identical\n // either way at every tier, so this only changes render order, not spacing.\n iconPos?: 'leading' | 'trailing'\n /**\n * M3's 5-tier expressive button sizing (xs: 32px, sm: 40px, md: 56px, lg: 96px, xl: 136px) — lg/xl are\n * meant for hero-style prominent buttons, not everyday UI\n */\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n /**\n * Button shape — rounded (pill, always) or squared (corner radius scales with size: 12px xs/sm, 16px md,\n * 28px lg/xl)\n */\n shape?: 'rounded' | 'squared'\n /** Vue Router destination — renders as RouterLink instead of button */\n to?: string | Record<string, any>\n /** Any CSS color for the press ripple; defaults to the button's content color */\n rippleColor?: string\n /**\n * Label and icon color, over what the variant and `color` give: an M3 role (`on-surface` for a neutral text\n * button, `on-primary-container`…) or any CSS color (`#000` on a white filled button). Disabled buttons keep\n * their own\n */\n contentColor?: string\n }>(),\n {\n variant: 'filled',\n color: 'primary',\n type: 'button',\n disabled: false,\n loading: false,\n iconPos: 'leading',\n size: 'sm',\n shape: 'rounded',\n },\n)\n\nconst tag = computed(() => props.to ? 'RouterLink' : 'button')\n\nconst isCustomColor = computed(\n () => !!props.color && !(NAMED_COLORS as readonly string[]).includes(props.color),\n)\n\nconst customStyle = computed(() => {\n if (!isCustomColor.value) return undefined\n return {\n '--color-primary': props.color,\n '--color-on-primary': '#ffffff',\n '--color-primary-container': props.color + '33',\n '--color-on-primary-container': props.color,\n }\n})\n\nconst isError = computed(() => props.color === 'error')\n\n// Color-role names (`on-surface`, `secondary-container`…) read the theme's token; anything else is a CSS color\nconst ROLE = /^(on-)?(primary|secondary|tertiary|error|surface|surface-variant|inverse-surface|inverse-primary)(-container|-variant)?$/\nconst style = computed(() => {\n const c = props.contentColor\n if (!c || props.disabled || props.loading) return customStyle.value\n return { ...customStyle.value, color: ROLE.test(c) ? `var(--color-${c})` : c }\n})\n\nconst base =\n 'relative inline-flex items-center justify-center font-medium ' +\n 'whitespace-nowrap overflow-hidden transition-[box-shadow,background-color,color] duration-150 select-none cursor-pointer ' +\n 'disabled:cursor-not-allowed disabled:shadow-none disabled:text-on-surface/38 ' +\n \"before:content-[''] before:pointer-events-none before:absolute before:inset-0 \" +\n 'before:bg-current before:opacity-0 before:transition-opacity before:duration-150 ' +\n 'enabled:hover:before:opacity-[0.08] enabled:active:before:opacity-[0.12]'\n\n// M3 disabled tokens: container at 10% on-surface opacity (DisabledContainerOpacity, same\n// across Filled/Tonal/Elevated), content/label always at 38% on-surface (handled in `base`\n// above, applies to every variant including text/elevated which have no container). The\n// outlined border uses the SAME color role as its enabled border (OutlineVariant, not\n// on-surface) just dimmed to that 10% too — see `variantClasses`' outlined case below for\n// why the enabled color is also outline-variant, not outline.\nconst disabledContainerClasses = computed(() => {\n switch (props.variant) {\n case 'filled':\n case 'tonal':\n case 'elevated':\n return 'disabled:bg-on-surface/10'\n case 'outlined':\n return isError.value ? 'disabled:border-error/10' : 'disabled:border-outline-variant/10'\n default:\n return ''\n }\n})\n\n/*\n * M3's newer 5-tier \"expressive\" button sizing (Button{XSmall,Small,Medium,Large,\n * XLarge}Tokens.kt + Button.kt's size-variant overloads — @ExperimentalMaterial3ExpressiveApi\n * in Compose, but this `size` prop is deliberately implementing exactly that system, same\n * as MFabMenu/MLoadingIndicator already do for other Expressive-only components). Content\n * padding is IDENTICAL whether or not an icon is present at every tier in the default\n * (non \"precision pointer\") mode — e.g. `IconMediumLeadingPadding = MediumLeadingPadding`\n * verbatim in the real source — so there's deliberately no separate icon-vs-no-icon padding\n * split here, unlike the old version of this file which had one (and got the values wrong\n * in both directions). `gap` between icon and label also varies by tier (IconLabelSpace),\n * not a flat value for every size.\n */\nconst sizeMap = {\n xs: { h: 'h-8', text: 'text-label-large', icon: 20, spinner: 16, gap: 'gap-1', px: 'px-3', pxText: 'px-2', squareRadius: 'rounded-md' },\n sm: { h: 'h-10', text: 'text-label-large', icon: 20, spinner: 16, gap: 'gap-2', px: 'px-4', pxText: 'px-3', squareRadius: 'rounded-md' },\n md: { h: 'h-14', text: 'text-title-medium', icon: 24, spinner: 18, gap: 'gap-2', px: 'px-6', pxText: 'px-3', squareRadius: 'rounded-lg' },\n lg: { h: 'h-24', text: 'text-headline-small', icon: 32, spinner: 26, gap: 'gap-3', px: 'px-12', pxText: 'px-4', squareRadius: 'rounded-xl' },\n xl: { h: 'h-[136px]', text: 'text-headline-large', icon: 40, spinner: 34, gap: 'gap-4', px: 'px-16', pxText: 'px-4', squareRadius: 'rounded-xl' },\n}\n\nconst s = computed(() => sizeMap[props.size] ?? sizeMap.sm)\nconst sizeClasses = computed(() => `${s.value.h} ${s.value.text} ${s.value.gap}`)\nconst iconSize = computed(() => s.value.icon)\nconst spinnerSize = computed(() => s.value.spinner)\n\nconst px = computed(() => props.variant === 'text' ? s.value.pxText : s.value.px)\n\n// Squared shape radius scales with size, matching each tier's own ContainerShapeSquare\n// token (ButtonXSmallTokens/ButtonSmallTokens use CornerMedium=12px, ButtonMediumTokens\n// CornerLarge=16px, ButtonLargeTokens/ButtonXLargeTokens CornerExtraLarge=28px) — the\n// pill (ContainerShapeRound) is CornerFull at every tier, so that half doesn't vary.\nconst shapeClass = computed(() => props.shape === 'squared' ? s.value.squareRadius : 'rounded-full')\n\nconst variantClasses = computed(() => {\n const err = isError.value\n switch (props.variant) {\n case 'filled':\n return err\n ? 'bg-error text-on-error enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n : 'bg-primary text-on-primary enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n case 'tonal':\n return err\n ? 'bg-error-container text-on-error-container enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n : 'bg-secondary-container text-on-secondary-container enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n case 'elevated':\n return err\n ? 'bg-surface-container-low text-error shadow-elevation-1 enabled:hover:shadow-elevation-2'\n : 'bg-surface-container-low text-primary shadow-elevation-1 enabled:hover:shadow-elevation-2'\n case 'outlined':\n // OutlinedButtonTokens.OutlineColor = ColorSchemeKeyTokens.OutlineVariant, not Outline\n return err\n ? 'border border-error text-error'\n : 'border border-outline-variant text-primary'\n case 'text':\n return err\n ? 'text-error'\n : 'text-primary'\n default:\n return ''\n }\n})\n</script>\n\n<template>\n <component\n :is=\"tag\"\n :to=\"to || undefined\"\n :type=\"to ? undefined : type\"\n :disabled=\"disabled || loading\"\n :class=\"[base, shapeClass, sizeClasses, px, variantClasses, disabledContainerClasses]\"\n :style=\"style\"\n v-ripple=\"{ disabled: disabled || loading, color: rippleColor }\"\n >\n <template v-if=\"iconPos === 'leading'\">\n <MSpinner v-if=\"loading\" :size=\"spinnerSize\" />\n <MIcon v-else-if=\"icon\" :name=\"icon\" :size=\"iconSize\" :filled=\"iconFilled\" />\n </template>\n <slot />\n <template v-if=\"iconPos === 'trailing'\">\n <MSpinner v-if=\"loading\" :size=\"spinnerSize\" />\n <MIcon v-else-if=\"icon\" :name=\"icon\" :size=\"iconSize\" :filled=\"iconFilled\" />\n </template>\n </component>\n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AM,EAAA;IACd,GAAA,MAAA,GAAA,CAAA,MAAA,CAAA,KAAA,EAAA,QAAlB,EAAA,GAAA,EAA6E,GAAA;;KAApD,MAAM,EAAA;KAAO,MAAM,EAAA;KAAW,QAAQ,EAAA;;;;;;IAEjE,EAAQ,EAAA,QAAA,SAAA;IACQ,EAAA,YAAO,cAAvB,EAAA,GAAA,EAGW,GAAA,EAAA,KAAA,EAAA,GAAA,CAFO,EAAA,WAAhB,EAAA,GAAA,EAA+C,GAAA;;KAArB,MAAM,EAAA;IACd,GAAA,MAAA,GAAA,CAAA,MAAA,CAAA,KAAA,EAAA,QAAlB,EAAA,GAAA,EAA6E,GAAA;;KAApD,MAAM,EAAA;KAAO,MAAM,EAAA;KAAW,QAAQ,EAAA;;;;;;;;;;;;;;EAT3C,CAAA,IAAA,CAAA,CAAA,EAAA,CAAA,GAAA;GAAA,UAAA,EAAA,YAAY,EAAA;GAAO,OAAS,EAAA;EAAW,CAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"MButton-D5eJiDza.js","names":[],"sources":["../src/components/MButton.vue","../src/components/MButton.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * The standard M3 button — five variants, five expressive size tiers, and either color.\n *\n * @slot default The button's label.\n */\nimport { computed } from 'vue'\nimport MSpinner from './MSpinner.vue'\nimport MIcon from './MIcon.vue'\nimport { vRipple } from '../directives/vRipple'\n\nconst NAMED_COLORS = ['primary', 'error'] as const\ntype NamedColor = (typeof NAMED_COLORS)[number]\n\nconst props = withDefaults(\n defineProps<{\n /** Visual style of the button */\n variant?: 'filled' | 'tonal' | 'outlined' | 'text' | 'elevated'\n /**\n * Named semantic color ('primary' | 'error') OR any CSS color string\n * ('red', '#e91e63', 'oklch(0.6 0.2 0)', …).\n * When a CSS color is passed, --color-primary is overridden for this button.\n */\n color?: string\n /** HTML button type */\n type?: 'button' | 'submit' | 'reset'\n /** Disables interaction */\n disabled?: boolean\n /** Shows a spinner and disables the button */\n loading?: boolean\n /** Material Symbol icon name shown next to the label */\n icon?: string\n /** Draw the icon filled (Material Symbols' FILL axis), e.g. a starred star or a play icon */\n iconFilled?: boolean\n /** Which side of the label the icon renders on */\n // Which side of the label `icon` renders on. Real M3 buttons support both via\n // `ButtonDefaults.contentPaddingFor(hasStartIcon/hasEndIcon)` — padding ends up identical\n // either way at every tier, so this only changes render order, not spacing.\n iconPos?: 'leading' | 'trailing'\n /**\n * M3's 5-tier expressive button sizing (xs: 32px, sm: 40px, md: 56px, lg: 96px, xl: 136px) — lg/xl are\n * meant for hero-style prominent buttons, not everyday UI\n */\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n /**\n * Button shape — rounded (pill, always) or squared (corner radius scales with size: 12px xs/sm, 16px md,\n * 28px lg/xl)\n */\n shape?: 'rounded' | 'squared'\n /** Vue Router destination — renders as RouterLink instead of button */\n to?: string | Record<string, any>\n /** Any CSS color for the press ripple; defaults to the button's content color */\n rippleColor?: string\n /**\n * Label and icon color, over what the variant and `color` give: an M3 role (`on-surface` for a neutral text\n * button, `on-primary-container`…) or any CSS color (`#000` on a white filled button). Disabled buttons keep\n * their own\n */\n contentColor?: string\n }>(),\n {\n variant: 'filled',\n color: 'primary',\n type: 'button',\n disabled: false,\n loading: false,\n iconPos: 'leading',\n size: 'sm',\n shape: 'rounded',\n },\n)\n\nconst tag = computed(() => props.to ? 'RouterLink' : 'button')\n\nconst isCustomColor = computed(\n () => !!props.color && !(NAMED_COLORS as readonly string[]).includes(props.color),\n)\n\nconst customStyle = computed(() => {\n if (!isCustomColor.value) return undefined\n return {\n '--color-primary': props.color,\n '--color-on-primary': '#ffffff',\n '--color-primary-container': props.color + '33',\n '--color-on-primary-container': props.color,\n }\n})\n\nconst isError = computed(() => props.color === 'error')\n\n// Color-role names (`on-surface`, `secondary-container`…) read the theme's token; anything else is a CSS color\nconst ROLE = /^(on-)?(primary|secondary|tertiary|error|surface|surface-variant|inverse-surface|inverse-primary)(-container|-variant)?$/\nconst style = computed(() => {\n const c = props.contentColor\n if (!c || props.disabled || props.loading) return customStyle.value\n return { ...customStyle.value, color: ROLE.test(c) ? `var(--color-${c})` : c }\n})\n\nconst base =\n 'relative inline-flex items-center justify-center font-medium ' +\n 'whitespace-nowrap overflow-hidden transition-[box-shadow,background-color,color] duration-150 select-none cursor-pointer ' +\n 'disabled:cursor-not-allowed disabled:shadow-none disabled:text-on-surface/38 ' +\n \"before:content-[''] before:pointer-events-none before:absolute before:inset-0 \" +\n 'before:bg-current before:opacity-0 before:transition-opacity before:duration-150 ' +\n 'enabled:hover:before:opacity-[0.08] enabled:active:before:opacity-[0.12]'\n\n// M3 disabled tokens: container at 10% on-surface opacity (DisabledContainerOpacity, same\n// across Filled/Tonal/Elevated), content/label always at 38% on-surface (handled in `base`\n// above, applies to every variant including text/elevated which have no container). The\n// outlined border uses the SAME color role as its enabled border (OutlineVariant, not\n// on-surface) just dimmed to that 10% too — see `variantClasses`' outlined case below for\n// why the enabled color is also outline-variant, not outline.\nconst disabledContainerClasses = computed(() => {\n switch (props.variant) {\n case 'filled':\n case 'tonal':\n case 'elevated':\n return 'disabled:bg-on-surface/10'\n case 'outlined':\n return isError.value ? 'disabled:border-error/10' : 'disabled:border-outline-variant/10'\n default:\n return ''\n }\n})\n\n/*\n * M3's newer 5-tier \"expressive\" button sizing (Button{XSmall,Small,Medium,Large,\n * XLarge}Tokens.kt + Button.kt's size-variant overloads — @ExperimentalMaterial3ExpressiveApi\n * in Compose, but this `size` prop is deliberately implementing exactly that system, same\n * as MFabMenu/MLoadingIndicator already do for other Expressive-only components). Content\n * padding is IDENTICAL whether or not an icon is present at every tier in the default\n * (non \"precision pointer\") mode — e.g. `IconMediumLeadingPadding = MediumLeadingPadding`\n * verbatim in the real source — so there's deliberately no separate icon-vs-no-icon padding\n * split here, unlike the old version of this file which had one (and got the values wrong\n * in both directions). `gap` between icon and label also varies by tier (IconLabelSpace),\n * not a flat value for every size.\n */\nconst sizeMap = {\n xs: { h: 'h-8', text: 'text-label-large', icon: 20, spinner: 16, gap: 'gap-1', px: 'px-3', pxText: 'px-2', squareRadius: 'rounded-md' },\n sm: { h: 'h-10', text: 'text-label-large', icon: 20, spinner: 16, gap: 'gap-2', px: 'px-4', pxText: 'px-3', squareRadius: 'rounded-md' },\n md: { h: 'h-14', text: 'text-title-medium', icon: 24, spinner: 18, gap: 'gap-2', px: 'px-6', pxText: 'px-3', squareRadius: 'rounded-lg' },\n lg: { h: 'h-24', text: 'text-headline-small', icon: 32, spinner: 26, gap: 'gap-3', px: 'px-12', pxText: 'px-4', squareRadius: 'rounded-xl' },\n xl: { h: 'h-[136px]', text: 'text-headline-large', icon: 40, spinner: 34, gap: 'gap-4', px: 'px-16', pxText: 'px-4', squareRadius: 'rounded-xl' },\n}\n\nconst s = computed(() => sizeMap[props.size] ?? sizeMap.sm)\nconst sizeClasses = computed(() => `${s.value.h} ${s.value.text} ${s.value.gap}`)\nconst iconSize = computed(() => s.value.icon)\nconst spinnerSize = computed(() => s.value.spinner)\n\nconst px = computed(() => props.variant === 'text' ? s.value.pxText : s.value.px)\n\n// Squared shape radius scales with size, matching each tier's own ContainerShapeSquare\n// token (ButtonXSmallTokens/ButtonSmallTokens use CornerMedium=12px, ButtonMediumTokens\n// CornerLarge=16px, ButtonLargeTokens/ButtonXLargeTokens CornerExtraLarge=28px) — the\n// pill (ContainerShapeRound) is CornerFull at every tier, so that half doesn't vary.\nconst shapeClass = computed(() => props.shape === 'squared' ? s.value.squareRadius : 'rounded-full')\n\nconst variantClasses = computed(() => {\n const err = isError.value\n switch (props.variant) {\n case 'filled':\n return err\n ? 'bg-error text-on-error enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n : 'bg-primary text-on-primary enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n case 'tonal':\n return err\n ? 'bg-error-container text-on-error-container enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n : 'bg-secondary-container text-on-secondary-container enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n case 'elevated':\n return err\n ? 'bg-surface-container-low text-error shadow-elevation-1 enabled:hover:shadow-elevation-2'\n : 'bg-surface-container-low text-primary shadow-elevation-1 enabled:hover:shadow-elevation-2'\n case 'outlined':\n // OutlinedButtonTokens.OutlineColor = ColorSchemeKeyTokens.OutlineVariant, not Outline\n return err\n ? 'border border-error text-error'\n : 'border border-outline-variant text-primary'\n case 'text':\n return err\n ? 'text-error'\n : 'text-primary'\n default:\n return ''\n }\n})\n</script>\n\n<template>\n <component\n :is=\"tag\"\n :to=\"to || undefined\"\n :type=\"to ? undefined : type\"\n :disabled=\"disabled || loading\"\n :class=\"[base, shapeClass, sizeClasses, px, variantClasses, disabledContainerClasses]\"\n :style=\"style\"\n v-ripple=\"{ disabled: disabled || loading, color: rippleColor }\"\n >\n <template v-if=\"iconPos === 'leading'\">\n <MSpinner v-if=\"loading\" :size=\"spinnerSize\" />\n <MIcon v-else-if=\"icon\" :name=\"icon\" :size=\"iconSize\" :filled=\"iconFilled\" />\n </template>\n <slot />\n <template v-if=\"iconPos === 'trailing'\">\n <MSpinner v-if=\"loading\" :size=\"spinnerSize\" />\n <MIcon v-else-if=\"icon\" :name=\"icon\" :size=\"iconSize\" :filled=\"iconFilled\" />\n </template>\n </component>\n</template>\n","<script setup lang=\"ts\">\n/**\n * The standard M3 button — five variants, five expressive size tiers, and either color.\n *\n * @slot default The button's label.\n */\nimport { computed } from 'vue'\nimport MSpinner from './MSpinner.vue'\nimport MIcon from './MIcon.vue'\nimport { vRipple } from '../directives/vRipple'\n\nconst NAMED_COLORS = ['primary', 'error'] as const\ntype NamedColor = (typeof NAMED_COLORS)[number]\n\nconst props = withDefaults(\n defineProps<{\n /** Visual style of the button */\n variant?: 'filled' | 'tonal' | 'outlined' | 'text' | 'elevated'\n /**\n * Named semantic color ('primary' | 'error') OR any CSS color string\n * ('red', '#e91e63', 'oklch(0.6 0.2 0)', …).\n * When a CSS color is passed, --color-primary is overridden for this button.\n */\n color?: string\n /** HTML button type */\n type?: 'button' | 'submit' | 'reset'\n /** Disables interaction */\n disabled?: boolean\n /** Shows a spinner and disables the button */\n loading?: boolean\n /** Material Symbol icon name shown next to the label */\n icon?: string\n /** Draw the icon filled (Material Symbols' FILL axis), e.g. a starred star or a play icon */\n iconFilled?: boolean\n /** Which side of the label the icon renders on */\n // Which side of the label `icon` renders on. Real M3 buttons support both via\n // `ButtonDefaults.contentPaddingFor(hasStartIcon/hasEndIcon)` — padding ends up identical\n // either way at every tier, so this only changes render order, not spacing.\n iconPos?: 'leading' | 'trailing'\n /**\n * M3's 5-tier expressive button sizing (xs: 32px, sm: 40px, md: 56px, lg: 96px, xl: 136px) — lg/xl are\n * meant for hero-style prominent buttons, not everyday UI\n */\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n /**\n * Button shape — rounded (pill, always) or squared (corner radius scales with size: 12px xs/sm, 16px md,\n * 28px lg/xl)\n */\n shape?: 'rounded' | 'squared'\n /** Vue Router destination — renders as RouterLink instead of button */\n to?: string | Record<string, any>\n /** Any CSS color for the press ripple; defaults to the button's content color */\n rippleColor?: string\n /**\n * Label and icon color, over what the variant and `color` give: an M3 role (`on-surface` for a neutral text\n * button, `on-primary-container`…) or any CSS color (`#000` on a white filled button). Disabled buttons keep\n * their own\n */\n contentColor?: string\n }>(),\n {\n variant: 'filled',\n color: 'primary',\n type: 'button',\n disabled: false,\n loading: false,\n iconPos: 'leading',\n size: 'sm',\n shape: 'rounded',\n },\n)\n\nconst tag = computed(() => props.to ? 'RouterLink' : 'button')\n\nconst isCustomColor = computed(\n () => !!props.color && !(NAMED_COLORS as readonly string[]).includes(props.color),\n)\n\nconst customStyle = computed(() => {\n if (!isCustomColor.value) return undefined\n return {\n '--color-primary': props.color,\n '--color-on-primary': '#ffffff',\n '--color-primary-container': props.color + '33',\n '--color-on-primary-container': props.color,\n }\n})\n\nconst isError = computed(() => props.color === 'error')\n\n// Color-role names (`on-surface`, `secondary-container`…) read the theme's token; anything else is a CSS color\nconst ROLE = /^(on-)?(primary|secondary|tertiary|error|surface|surface-variant|inverse-surface|inverse-primary)(-container|-variant)?$/\nconst style = computed(() => {\n const c = props.contentColor\n if (!c || props.disabled || props.loading) return customStyle.value\n return { ...customStyle.value, color: ROLE.test(c) ? `var(--color-${c})` : c }\n})\n\nconst base =\n 'relative inline-flex items-center justify-center font-medium ' +\n 'whitespace-nowrap overflow-hidden transition-[box-shadow,background-color,color] duration-150 select-none cursor-pointer ' +\n 'disabled:cursor-not-allowed disabled:shadow-none disabled:text-on-surface/38 ' +\n \"before:content-[''] before:pointer-events-none before:absolute before:inset-0 \" +\n 'before:bg-current before:opacity-0 before:transition-opacity before:duration-150 ' +\n 'enabled:hover:before:opacity-[0.08] enabled:active:before:opacity-[0.12]'\n\n// M3 disabled tokens: container at 10% on-surface opacity (DisabledContainerOpacity, same\n// across Filled/Tonal/Elevated), content/label always at 38% on-surface (handled in `base`\n// above, applies to every variant including text/elevated which have no container). The\n// outlined border uses the SAME color role as its enabled border (OutlineVariant, not\n// on-surface) just dimmed to that 10% too — see `variantClasses`' outlined case below for\n// why the enabled color is also outline-variant, not outline.\nconst disabledContainerClasses = computed(() => {\n switch (props.variant) {\n case 'filled':\n case 'tonal':\n case 'elevated':\n return 'disabled:bg-on-surface/10'\n case 'outlined':\n return isError.value ? 'disabled:border-error/10' : 'disabled:border-outline-variant/10'\n default:\n return ''\n }\n})\n\n/*\n * M3's newer 5-tier \"expressive\" button sizing (Button{XSmall,Small,Medium,Large,\n * XLarge}Tokens.kt + Button.kt's size-variant overloads — @ExperimentalMaterial3ExpressiveApi\n * in Compose, but this `size` prop is deliberately implementing exactly that system, same\n * as MFabMenu/MLoadingIndicator already do for other Expressive-only components). Content\n * padding is IDENTICAL whether or not an icon is present at every tier in the default\n * (non \"precision pointer\") mode — e.g. `IconMediumLeadingPadding = MediumLeadingPadding`\n * verbatim in the real source — so there's deliberately no separate icon-vs-no-icon padding\n * split here, unlike the old version of this file which had one (and got the values wrong\n * in both directions). `gap` between icon and label also varies by tier (IconLabelSpace),\n * not a flat value for every size.\n */\nconst sizeMap = {\n xs: { h: 'h-8', text: 'text-label-large', icon: 20, spinner: 16, gap: 'gap-1', px: 'px-3', pxText: 'px-2', squareRadius: 'rounded-md' },\n sm: { h: 'h-10', text: 'text-label-large', icon: 20, spinner: 16, gap: 'gap-2', px: 'px-4', pxText: 'px-3', squareRadius: 'rounded-md' },\n md: { h: 'h-14', text: 'text-title-medium', icon: 24, spinner: 18, gap: 'gap-2', px: 'px-6', pxText: 'px-3', squareRadius: 'rounded-lg' },\n lg: { h: 'h-24', text: 'text-headline-small', icon: 32, spinner: 26, gap: 'gap-3', px: 'px-12', pxText: 'px-4', squareRadius: 'rounded-xl' },\n xl: { h: 'h-[136px]', text: 'text-headline-large', icon: 40, spinner: 34, gap: 'gap-4', px: 'px-16', pxText: 'px-4', squareRadius: 'rounded-xl' },\n}\n\nconst s = computed(() => sizeMap[props.size] ?? sizeMap.sm)\nconst sizeClasses = computed(() => `${s.value.h} ${s.value.text} ${s.value.gap}`)\nconst iconSize = computed(() => s.value.icon)\nconst spinnerSize = computed(() => s.value.spinner)\n\nconst px = computed(() => props.variant === 'text' ? s.value.pxText : s.value.px)\n\n// Squared shape radius scales with size, matching each tier's own ContainerShapeSquare\n// token (ButtonXSmallTokens/ButtonSmallTokens use CornerMedium=12px, ButtonMediumTokens\n// CornerLarge=16px, ButtonLargeTokens/ButtonXLargeTokens CornerExtraLarge=28px) — the\n// pill (ContainerShapeRound) is CornerFull at every tier, so that half doesn't vary.\nconst shapeClass = computed(() => props.shape === 'squared' ? s.value.squareRadius : 'rounded-full')\n\nconst variantClasses = computed(() => {\n const err = isError.value\n switch (props.variant) {\n case 'filled':\n return err\n ? 'bg-error text-on-error enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n : 'bg-primary text-on-primary enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n case 'tonal':\n return err\n ? 'bg-error-container text-on-error-container enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n : 'bg-secondary-container text-on-secondary-container enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n case 'elevated':\n return err\n ? 'bg-surface-container-low text-error shadow-elevation-1 enabled:hover:shadow-elevation-2'\n : 'bg-surface-container-low text-primary shadow-elevation-1 enabled:hover:shadow-elevation-2'\n case 'outlined':\n // OutlinedButtonTokens.OutlineColor = ColorSchemeKeyTokens.OutlineVariant, not Outline\n return err\n ? 'border border-error text-error'\n : 'border border-outline-variant text-primary'\n case 'text':\n return err\n ? 'text-error'\n : 'text-primary'\n default:\n return ''\n }\n})\n</script>\n\n<template>\n <component\n :is=\"tag\"\n :to=\"to || undefined\"\n :type=\"to ? undefined : type\"\n :disabled=\"disabled || loading\"\n :class=\"[base, shapeClass, sizeClasses, px, variantClasses, disabledContainerClasses]\"\n :style=\"style\"\n v-ripple=\"{ disabled: disabled || loading, color: rippleColor }\"\n >\n <template v-if=\"iconPos === 'leading'\">\n <MSpinner v-if=\"loading\" :size=\"spinnerSize\" />\n <MIcon v-else-if=\"icon\" :name=\"icon\" :size=\"iconSize\" :filled=\"iconFilled\" />\n </template>\n <slot />\n <template v-if=\"iconPos === 'trailing'\">\n <MSpinner v-if=\"loading\" :size=\"spinnerSize\" />\n <MIcon v-else-if=\"icon\" :name=\"icon\" :size=\"iconSize\" :filled=\"iconFilled\" />\n </template>\n </component>\n</template>\n"],"mappings":";;;;;AAkGA,IAAM,IACJ;;;;;;;;;;;;;;;;;;;;;;;;EAxFF,IAAM,IAAe,CAAC,WAAW,OAAO,GAGlC,IAAQ,GA0DR,IAAM,QAAe,EAAM,KAAK,eAAe,QAAQ,GAEvD,IAAgB,QACd,CAAC,CAAC,EAAM,SAAS,CAAE,EAAmC,SAAS,EAAM,KAAK,CAClF,GAEM,IAAc,QAAe;GAC5B,MAAc,OACnB,OAAO;IACL,mBAAmB,EAAM;IACzB,sBAAsB;IACtB,6BAA6B,EAAM,QAAQ;IAC3C,gCAAgC,EAAM;GACxC;EACF,CAAC,GAEK,IAAU,QAAe,EAAM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A;;KAApD,MAAM,EAAA;KAAO,MAAM,EAAA;KAAW,QAAQ,EAAA;;;;;;;;;;;;;;EAT3C,CAAA,IAAA,CAAA,CAAA,EAAA,CAAA,GAAA;GAAA,UAAA,EAAA,YAAY,EAAA;GAAO,OAAS,EAAA;EAAW,CAAA,CAAA,CAAA"}
@@ -1,4 +1,4 @@
1
- import { i as e } from "./useLocale-CaWwi-b6.js";
1
+ import { i as e } from "./useLocale-D2ucaY-l.js";
2
2
  import { t } from "./MIconButton-DoNotQ9v.js";
3
3
  import { t as n } from "./_plugin-vue_export-helper-B3ysoDQm.js";
4
4
  import { t as r } from "./_useEscapeStack-CjndQhqg.js";
@@ -170,4 +170,4 @@ var F = ["aria-labelledby", "aria-label"], I = {
170
170
  //#endregion
171
171
  export { P as n, q as t };
172
172
 
173
- //# sourceMappingURL=MDialog-D_Yik8ou.js.map
173
+ //# sourceMappingURL=MDialog-WqB0jewp.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MDialog-D_Yik8ou.js","names":["$attrs","$slots"],"sources":["../src/composables/_useScrollLock.ts","../src/components/MDialog.vue","../src/components/MDialog.vue"],"sourcesContent":["import { getCurrentInstance, onBeforeUnmount, watch, type WatchSource } from 'vue'\n\n/*\n * Internal (not exported from index.ts): locks the page's scroll (body overflow hidden) while a modal surface is\n * open, shared by every component that does it. Counted, so overlays stacked on each other (a select's modal or a\n * date picker inside an MDialog) release it only when the last one closes: each component used to write\n * `overflow = ''` on its own, so closing the inner one let the page under the outer one scroll again. Each\n * instance also releases what it holds when it unmounts (a dialog removed while open left the page locked for good)\n * and nothing when it holds nothing (a select unmounting inside an open dialog used to unlock it).\n */\n\nlet count = 0\nlet previous = ''\n\nfunction lock() {\n if (count++ === 0) {\n previous = document.body.style.overflow\n document.body.style.overflow = 'hidden'\n }\n}\n\nfunction unlock() {\n if (count > 0 && --count === 0) document.body.style.overflow = previous\n}\n\n/**\n * Locks the page's scroll while `active` is true (from the start too: a dialog mounted open locks it), and releases\n * it when it turns false or the component unmounts. Without `active`, drive it with the returned `set`.\n */\nexport function useScrollLock(active?: WatchSource<boolean>) {\n let held = false\n function set(on: boolean) {\n if (typeof document === 'undefined' || on === held) return\n held = on\n if (on) lock()\n else unlock()\n }\n if (active) watch(active, (on) => set(!!on), { immediate: true })\n if (getCurrentInstance()) onBeforeUnmount(() => set(false))\n return { set }\n}\n","<script setup lang=\"ts\">\n/**\n * The generic M3 modal shell — Escape, scroll lock, and Teleport are handled internally. Supports a centered\n * card, a full-screen variant, and an optional icon that centers the title per spec.\n *\n * @slot icon M3 AlertDialog's optional icon (Secondary color, 24dp expected). Its presence also centers the\n * title, per spec.\n * @slot title Overrides the title prop with custom markup\n * @slot default Dialog body content — scrolls independently when taller than maxHeight. With `bare`, the whole\n * dialog: it fills the box (no title, padding, close button or actions row)\n * @slot actions Row of action buttons — wraps to a new line instead of overflowing when labels are long\n * @event update:modelValue Emitted when the dialog should open/close — powers v-model\n */\nimport { computed, nextTick, onUnmounted, ref, useId, watch } from 'vue'\nimport MIconButton from './MIconButton.vue'\nimport { useLocale } from '../composables/useLocale'\nimport { useScrollLock } from '../composables/_useScrollLock'\nimport { useEscapeStack } from '../composables/_useEscapeStack'\n\nconst props = withDefaults(\n defineProps<{\n /** Open/closed state (v-model) */\n modelValue: boolean\n /** Dialog title (overridable via the #title slot) */\n title?: string\n /** A Tailwind class (`max-w-sm`) or a CSS value (`420px`, `min(90vw, 40rem)`). */\n maxWidth?: string\n /**\n * Maximum height: a Tailwind class (`max-h-[60vh]`) or a CSS value (`480px`, `calc(100dvh - 4rem)`). When the\n * content is taller, the body scrolls and a divider appears above the actions.\n */\n // A Tailwind class (`max-h-[80vh]`) or a CSS value (`600px`). M3's `AlertDialogDefaults` has\n // no max-height token at all (only `DialogMaxWidth`) — the default here is a library-chosen\n // viewport-relative cap, not a spec value.\n maxHeight?: string\n /** Prevent closing by clicking the scrim, pressing Escape, or the X button */\n persistent?: boolean\n /** Full-screen variant — slides up from the bottom, covers the entire viewport */\n fullscreen?: boolean\n /** Aria label for the close (X) button — falls back to the locale string when omitted */\n closeLabel?: string\n /**\n * Show the header close (X) button — a library addition, not part of the M3 AlertDialog spec, so it can be\n * turned off\n */\n // Whether the header shows a close (\"X\") icon button. M3's `AlertDialog` spec has no such\n // button — it expects only a Cancel/Confirm text button in the actions row — so this is a\n // deliberate library extension on top of the spec, kept opt-out (default `true`, matching\n // this component's existing behavior) rather than added unconditionally.\n closable?: boolean\n /**\n * Just the dialog's box (surface, shape, elevation), scrim, Escape, scroll lock and animation, with the default\n * slot filling it: no title row, padding, close button or actions. For dialogs that draw everything themselves\n * (the date and time pickers). With `fullscreen`, the slot fills the screen and draws its own top bar. `title`\n * then only names it for assistive technology\n */\n bare?: boolean\n }>(),\n {\n // AlertDialogDefaults.DialogMaxWidth = 560dp\n maxWidth: 'max-w-[560px]',\n maxHeight: 'max-h-[90vh]',\n persistent: false,\n fullscreen: false,\n closable: true,\n bare: false,\n },\n)\n\n// The root is a Teleport, which can't take the consumer's class/style/attrs: they go on the dialog's surface\ndefineOptions({ inheritAttrs: false })\n\nconst locale = useLocale()\n\n// maxWidth/maxHeight take either a Tailwind class or a CSS value: a bare length or a CSS function\n// can't be a class, so those go to inline style instead.\nconst isCssValue = (v: string) => /^-?[\\d.]+[a-z%]*$|^(calc|min|max|clamp|var)\\(/i.test(v.trim())\nconst sizeClasses = computed(() => [props.maxWidth, props.maxHeight].filter((v) => !isCssValue(v)))\nconst sizeStyle = computed(() => ({\n ...(isCssValue(props.maxWidth) ? { maxWidth: props.maxWidth } : {}),\n ...(isCssValue(props.maxHeight) ? { maxHeight: props.maxHeight } : {}),\n}))\n\nconst emit = defineEmits<{ 'update:modelValue': [boolean] }>()\n\nfunction close() {\n if (props.persistent) return\n emit('update:modelValue', false)\n}\n\n\n// M3's dialog anatomy lists an optional divider between the (scrollable) content and the\n// actions row — Compose's own AlertDialog.kt has no built-in implementation of it at all, so\n// this shows it only when the content actually has more to scroll to, above the actions row.\nconst contentEl = ref<HTMLElement>()\nconst contentInnerEl = ref<HTMLElement>()\nconst showDivider = ref(false)\nlet resizeObserver: ResizeObserver | undefined\n\nfunction updateDividerVisibility() {\n const el = contentEl.value\n if (!el) { showDivider.value = false; return }\n showDivider.value = el.scrollHeight - el.scrollTop - el.clientHeight > 1\n}\n\nuseScrollLock(() => props.modelValue)\n// Escape closes the dialog on top only, when several are stacked\nuseEscapeStack(() => props.modelValue, close)\n\nconst titleId = `m3-dialog-${useId()}`\n\nwatch(\n () => props.modelValue,\n async (open) => {\n // Server rendering (a dialog open on load runs this immediately): nothing to measure or observe\n if (typeof window === 'undefined') return\n if (open) {\n await nextTick()\n updateDividerVisibility()\n // Observing contentEl alone only catches viewport-driven resizes (e.g. window resize\n // changing the maxHeight cap) — its own box stays put when the *slotted* content\n // changes height, since overflow doesn't affect the scroll container's own size. The\n // inner wrapper around the slot grows/shrinks with the actual content, so that's what\n // needs observing to catch dynamic content (reactive text, async-loaded content, etc).\n resizeObserver = new ResizeObserver(updateDividerVisibility)\n if (contentEl.value) resizeObserver.observe(contentEl.value)\n if (contentInnerEl.value) resizeObserver.observe(contentInnerEl.value)\n } else {\n resizeObserver?.disconnect()\n resizeObserver = undefined\n }\n },\n { immediate: true },\n)\n\nonUnmounted(() => {\n resizeObserver?.disconnect()\n})\n</script>\n\n<template>\n <Teleport to=\"body\">\n <!-- Basic dialog -->\n <!-- appear: a dialog mounted already open (v-if + modelValue in the same tick) animates in too -->\n <Transition v-if=\"!fullscreen\" name=\"m3-dialog\" appear>\n <div\n v-if=\"modelValue\"\n class=\"fixed inset-0 z-50 flex items-center justify-center bg-scrim/32 p-4\"\n @click.self=\"close\"\n >\n <div\n v-bind=\"$attrs\"\n class=\"dialog-box m3-dialog-surface flex min-w-[280px] w-full flex-col\"\n :class=\"sizeClasses\"\n :style=\"sizeStyle\"\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-labelledby=\"!bare && ($slots.title || title) ? titleId : undefined\"\n :aria-label=\"bare ? title : undefined\"\n >\n <!-- Bare: the content is the whole dialog (scrolling if taller than maxHeight), clipped to the box's\n corners (rounded-[inherit]) so content reaching its edges, like a full-bleed image, keeps them -->\n <div v-if=\"bare\" class=\"min-h-0 overflow-y-auto rounded-[inherit]\">\n <slot />\n </div>\n <template v-else>\n <!--\n AlertDialogDefaults.dialogPadding is 24dp on all four sides of the whole content\n column, with per-element bottom paddings (IconPadding/TitlePadding/textPadding)\n providing the gaps BETWEEN elements — not a single wrapping padding, since this\n template uses separate divs per section instead of one padded Column. Each\n section's own top/bottom classes are chosen so the combined gaps still land on\n the right dp value: title-to-body is 16dp (8px here + 8px there), body-to-actions\n is 24dp (8px here + 16px there), and the outermost edges (top of title, bottom of\n whichever section is last) are the full 24dp on their own.\n -->\n <div class=\"relative px-6 pt-6 pb-2\">\n <!--\n Wrapped in a plain div rather than passing `absolute right-4 top-4` straight to\n MIconButton: its root already carries its own `relative` (for the ripple span),\n and Tailwind resolves conflicting position utilities by source order in the\n compiled CSS, not by order in the class attribute — so an external `absolute`\n can silently lose to that internal `relative` instead of overriding it.\n -->\n <div v-if=\"closable && !persistent\" class=\"absolute right-4 top-4\">\n <MIconButton icon=\"close\" :label=\"closeLabel ?? locale.close\" @click=\"close\" />\n </div>\n <!--\n Icon slot: M3 AlertDialog's optional `icon` param (IconColor=Secondary,\n IconSize=24dp expected from the slot content, IconPadding bottom=16dp below it),\n which per spec also centers the title (\"Align the title to the center when an\n icon is present\") — reserving `pr-10` on the title only when the close button is\n also showing, so a centered title doesn't collide with it.\n -->\n <div v-if=\"$slots.icon\" class=\"mb-4 flex justify-center text-secondary\">\n <slot name=\"icon\" />\n </div>\n <h2\n :id=\"titleId\"\n class=\"text-headline-small text-on-surface\"\n :class=\"[\n $slots.icon ? 'text-center' : 'text-left',\n closable && !persistent ? ($slots.icon ? 'px-10' : 'pr-10') : '',\n ]\"\n >\n <slot name=\"title\">{{ title }}</slot>\n </h2>\n </div>\n <div\n ref=\"contentEl\"\n class=\"overflow-y-auto px-6 pt-2 text-body-medium text-on-surface-variant\"\n :class=\"$slots.actions ? 'pb-2' : 'pb-6'\"\n @scroll=\"updateDividerVisibility\"\n >\n <div ref=\"contentInnerEl\">\n <slot />\n </div>\n </div>\n <!-- Divider: M3 dialog anatomy's optional divider, shown only while the content has more to scroll to -->\n <div v-if=\"showDivider && $slots.actions\" class=\"shrink-0 border-t border-outline-variant\" />\n <!-- flex-wrap approximates AlertDialogFlowRow: buttons wrap to a new line instead of overflowing when labels are too long to fit on one -->\n <div v-if=\"$slots.actions\" class=\"flex flex-wrap justify-end gap-2 px-6 pt-4 pb-6\">\n <slot name=\"actions\" />\n </div>\n </template>\n </div>\n </div>\n </Transition>\n\n <!-- Fullscreen dialog -->\n <Transition v-else name=\"m3-dialog-fs\" appear>\n <div\n v-if=\"modelValue\"\n v-bind=\"$attrs\"\n class=\"dialog-fs m3-dialog-fs-surface fixed inset-0 z-50 flex flex-col\"\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-labelledby=\"!bare && ($slots.title || title) ? titleId : undefined\"\n :aria-label=\"bare ? title : undefined\"\n >\n <!-- Bare: the content is the whole screen, top bar included, in whatever colors it draws -->\n <div v-if=\"bare\" class=\"min-h-0 flex-1 overflow-y-auto\">\n <slot />\n </div>\n <div v-else class=\"flex h-14 shrink-0 items-center gap-2 px-2\">\n <MIconButton v-if=\"!persistent\" icon=\"close\" :label=\"closeLabel ?? locale.close\" @click=\"close\" />\n <h2 :id=\"titleId\" class=\"flex-1 text-title-large font-medium text-on-surface\">\n <slot name=\"title\">{{ title }}</slot>\n </h2>\n <div v-if=\"$slots.actions\" class=\"flex items-center gap-2\">\n <slot name=\"actions\" />\n </div>\n </div>\n <div v-if=\"!bare\" class=\"flex-1 overflow-y-auto px-6 py-4 text-body-medium text-on-surface-variant\">\n <slot />\n </div>\n </div>\n </Transition>\n </Teleport>\n</template>\n\n<style scoped>\n.m3-dialog-enter-active,\n.m3-dialog-leave-active {\n transition: opacity 0.15s ease;\n}\n.m3-dialog-enter-from,\n.m3-dialog-leave-to {\n opacity: 0;\n}\n.m3-dialog-enter-active .dialog-box,\n.m3-dialog-leave-active .dialog-box {\n transition: transform 0.15s ease;\n}\n.m3-dialog-enter-from .dialog-box,\n.m3-dialog-leave-to .dialog-box {\n transform: scale(0.95);\n}\n\n.m3-dialog-fs-enter-active,\n.m3-dialog-fs-leave-active {\n transition: transform 0.25s cubic-bezier(0.2, 0, 0, 1), opacity 0.15s ease;\n}\n.m3-dialog-fs-enter-from {\n transform: translateY(100%);\n opacity: 0;\n}\n.m3-dialog-fs-leave-to {\n transform: translateY(100%);\n opacity: 0;\n}\n</style>\n\n<style>\n/* The surfaces' look, in the base layer so the consumer's classes on MDialog win (see MShape) */\n@layer base {\n .m3-dialog-surface {\n background-color: var(--color-surface-container-high);\n border-radius: var(--radius-xl);\n box-shadow: var(--shadow-elevation-3);\n }\n .m3-dialog-fs-surface {\n background-color: var(--color-surface);\n }\n}\n</style>\n","<script setup lang=\"ts\">\n/**\n * The generic M3 modal shell — Escape, scroll lock, and Teleport are handled internally. Supports a centered\n * card, a full-screen variant, and an optional icon that centers the title per spec.\n *\n * @slot icon M3 AlertDialog's optional icon (Secondary color, 24dp expected). Its presence also centers the\n * title, per spec.\n * @slot title Overrides the title prop with custom markup\n * @slot default Dialog body content — scrolls independently when taller than maxHeight. With `bare`, the whole\n * dialog: it fills the box (no title, padding, close button or actions row)\n * @slot actions Row of action buttons — wraps to a new line instead of overflowing when labels are long\n * @event update:modelValue Emitted when the dialog should open/close — powers v-model\n */\nimport { computed, nextTick, onUnmounted, ref, useId, watch } from 'vue'\nimport MIconButton from './MIconButton.vue'\nimport { useLocale } from '../composables/useLocale'\nimport { useScrollLock } from '../composables/_useScrollLock'\nimport { useEscapeStack } from '../composables/_useEscapeStack'\n\nconst props = withDefaults(\n defineProps<{\n /** Open/closed state (v-model) */\n modelValue: boolean\n /** Dialog title (overridable via the #title slot) */\n title?: string\n /** A Tailwind class (`max-w-sm`) or a CSS value (`420px`, `min(90vw, 40rem)`). */\n maxWidth?: string\n /**\n * Maximum height: a Tailwind class (`max-h-[60vh]`) or a CSS value (`480px`, `calc(100dvh - 4rem)`). When the\n * content is taller, the body scrolls and a divider appears above the actions.\n */\n // A Tailwind class (`max-h-[80vh]`) or a CSS value (`600px`). M3's `AlertDialogDefaults` has\n // no max-height token at all (only `DialogMaxWidth`) — the default here is a library-chosen\n // viewport-relative cap, not a spec value.\n maxHeight?: string\n /** Prevent closing by clicking the scrim, pressing Escape, or the X button */\n persistent?: boolean\n /** Full-screen variant — slides up from the bottom, covers the entire viewport */\n fullscreen?: boolean\n /** Aria label for the close (X) button — falls back to the locale string when omitted */\n closeLabel?: string\n /**\n * Show the header close (X) button — a library addition, not part of the M3 AlertDialog spec, so it can be\n * turned off\n */\n // Whether the header shows a close (\"X\") icon button. M3's `AlertDialog` spec has no such\n // button — it expects only a Cancel/Confirm text button in the actions row — so this is a\n // deliberate library extension on top of the spec, kept opt-out (default `true`, matching\n // this component's existing behavior) rather than added unconditionally.\n closable?: boolean\n /**\n * Just the dialog's box (surface, shape, elevation), scrim, Escape, scroll lock and animation, with the default\n * slot filling it: no title row, padding, close button or actions. For dialogs that draw everything themselves\n * (the date and time pickers). With `fullscreen`, the slot fills the screen and draws its own top bar. `title`\n * then only names it for assistive technology\n */\n bare?: boolean\n }>(),\n {\n // AlertDialogDefaults.DialogMaxWidth = 560dp\n maxWidth: 'max-w-[560px]',\n maxHeight: 'max-h-[90vh]',\n persistent: false,\n fullscreen: false,\n closable: true,\n bare: false,\n },\n)\n\n// The root is a Teleport, which can't take the consumer's class/style/attrs: they go on the dialog's surface\ndefineOptions({ inheritAttrs: false })\n\nconst locale = useLocale()\n\n// maxWidth/maxHeight take either a Tailwind class or a CSS value: a bare length or a CSS function\n// can't be a class, so those go to inline style instead.\nconst isCssValue = (v: string) => /^-?[\\d.]+[a-z%]*$|^(calc|min|max|clamp|var)\\(/i.test(v.trim())\nconst sizeClasses = computed(() => [props.maxWidth, props.maxHeight].filter((v) => !isCssValue(v)))\nconst sizeStyle = computed(() => ({\n ...(isCssValue(props.maxWidth) ? { maxWidth: props.maxWidth } : {}),\n ...(isCssValue(props.maxHeight) ? { maxHeight: props.maxHeight } : {}),\n}))\n\nconst emit = defineEmits<{ 'update:modelValue': [boolean] }>()\n\nfunction close() {\n if (props.persistent) return\n emit('update:modelValue', false)\n}\n\n\n// M3's dialog anatomy lists an optional divider between the (scrollable) content and the\n// actions row — Compose's own AlertDialog.kt has no built-in implementation of it at all, so\n// this shows it only when the content actually has more to scroll to, above the actions row.\nconst contentEl = ref<HTMLElement>()\nconst contentInnerEl = ref<HTMLElement>()\nconst showDivider = ref(false)\nlet resizeObserver: ResizeObserver | undefined\n\nfunction updateDividerVisibility() {\n const el = contentEl.value\n if (!el) { showDivider.value = false; return }\n showDivider.value = el.scrollHeight - el.scrollTop - el.clientHeight > 1\n}\n\nuseScrollLock(() => props.modelValue)\n// Escape closes the dialog on top only, when several are stacked\nuseEscapeStack(() => props.modelValue, close)\n\nconst titleId = `m3-dialog-${useId()}`\n\nwatch(\n () => props.modelValue,\n async (open) => {\n // Server rendering (a dialog open on load runs this immediately): nothing to measure or observe\n if (typeof window === 'undefined') return\n if (open) {\n await nextTick()\n updateDividerVisibility()\n // Observing contentEl alone only catches viewport-driven resizes (e.g. window resize\n // changing the maxHeight cap) — its own box stays put when the *slotted* content\n // changes height, since overflow doesn't affect the scroll container's own size. The\n // inner wrapper around the slot grows/shrinks with the actual content, so that's what\n // needs observing to catch dynamic content (reactive text, async-loaded content, etc).\n resizeObserver = new ResizeObserver(updateDividerVisibility)\n if (contentEl.value) resizeObserver.observe(contentEl.value)\n if (contentInnerEl.value) resizeObserver.observe(contentInnerEl.value)\n } else {\n resizeObserver?.disconnect()\n resizeObserver = undefined\n }\n },\n { immediate: true },\n)\n\nonUnmounted(() => {\n resizeObserver?.disconnect()\n})\n</script>\n\n<template>\n <Teleport to=\"body\">\n <!-- Basic dialog -->\n <!-- appear: a dialog mounted already open (v-if + modelValue in the same tick) animates in too -->\n <Transition v-if=\"!fullscreen\" name=\"m3-dialog\" appear>\n <div\n v-if=\"modelValue\"\n class=\"fixed inset-0 z-50 flex items-center justify-center bg-scrim/32 p-4\"\n @click.self=\"close\"\n >\n <div\n v-bind=\"$attrs\"\n class=\"dialog-box m3-dialog-surface flex min-w-[280px] w-full flex-col\"\n :class=\"sizeClasses\"\n :style=\"sizeStyle\"\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-labelledby=\"!bare && ($slots.title || title) ? titleId : undefined\"\n :aria-label=\"bare ? title : undefined\"\n >\n <!-- Bare: the content is the whole dialog (scrolling if taller than maxHeight), clipped to the box's\n corners (rounded-[inherit]) so content reaching its edges, like a full-bleed image, keeps them -->\n <div v-if=\"bare\" class=\"min-h-0 overflow-y-auto rounded-[inherit]\">\n <slot />\n </div>\n <template v-else>\n <!--\n AlertDialogDefaults.dialogPadding is 24dp on all four sides of the whole content\n column, with per-element bottom paddings (IconPadding/TitlePadding/textPadding)\n providing the gaps BETWEEN elements — not a single wrapping padding, since this\n template uses separate divs per section instead of one padded Column. Each\n section's own top/bottom classes are chosen so the combined gaps still land on\n the right dp value: title-to-body is 16dp (8px here + 8px there), body-to-actions\n is 24dp (8px here + 16px there), and the outermost edges (top of title, bottom of\n whichever section is last) are the full 24dp on their own.\n -->\n <div class=\"relative px-6 pt-6 pb-2\">\n <!--\n Wrapped in a plain div rather than passing `absolute right-4 top-4` straight to\n MIconButton: its root already carries its own `relative` (for the ripple span),\n and Tailwind resolves conflicting position utilities by source order in the\n compiled CSS, not by order in the class attribute — so an external `absolute`\n can silently lose to that internal `relative` instead of overriding it.\n -->\n <div v-if=\"closable && !persistent\" class=\"absolute right-4 top-4\">\n <MIconButton icon=\"close\" :label=\"closeLabel ?? locale.close\" @click=\"close\" />\n </div>\n <!--\n Icon slot: M3 AlertDialog's optional `icon` param (IconColor=Secondary,\n IconSize=24dp expected from the slot content, IconPadding bottom=16dp below it),\n which per spec also centers the title (\"Align the title to the center when an\n icon is present\") — reserving `pr-10` on the title only when the close button is\n also showing, so a centered title doesn't collide with it.\n -->\n <div v-if=\"$slots.icon\" class=\"mb-4 flex justify-center text-secondary\">\n <slot name=\"icon\" />\n </div>\n <h2\n :id=\"titleId\"\n class=\"text-headline-small text-on-surface\"\n :class=\"[\n $slots.icon ? 'text-center' : 'text-left',\n closable && !persistent ? ($slots.icon ? 'px-10' : 'pr-10') : '',\n ]\"\n >\n <slot name=\"title\">{{ title }}</slot>\n </h2>\n </div>\n <div\n ref=\"contentEl\"\n class=\"overflow-y-auto px-6 pt-2 text-body-medium text-on-surface-variant\"\n :class=\"$slots.actions ? 'pb-2' : 'pb-6'\"\n @scroll=\"updateDividerVisibility\"\n >\n <div ref=\"contentInnerEl\">\n <slot />\n </div>\n </div>\n <!-- Divider: M3 dialog anatomy's optional divider, shown only while the content has more to scroll to -->\n <div v-if=\"showDivider && $slots.actions\" class=\"shrink-0 border-t border-outline-variant\" />\n <!-- flex-wrap approximates AlertDialogFlowRow: buttons wrap to a new line instead of overflowing when labels are too long to fit on one -->\n <div v-if=\"$slots.actions\" class=\"flex flex-wrap justify-end gap-2 px-6 pt-4 pb-6\">\n <slot name=\"actions\" />\n </div>\n </template>\n </div>\n </div>\n </Transition>\n\n <!-- Fullscreen dialog -->\n <Transition v-else name=\"m3-dialog-fs\" appear>\n <div\n v-if=\"modelValue\"\n v-bind=\"$attrs\"\n class=\"dialog-fs m3-dialog-fs-surface fixed inset-0 z-50 flex flex-col\"\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-labelledby=\"!bare && ($slots.title || title) ? titleId : undefined\"\n :aria-label=\"bare ? title : undefined\"\n >\n <!-- Bare: the content is the whole screen, top bar included, in whatever colors it draws -->\n <div v-if=\"bare\" class=\"min-h-0 flex-1 overflow-y-auto\">\n <slot />\n </div>\n <div v-else class=\"flex h-14 shrink-0 items-center gap-2 px-2\">\n <MIconButton v-if=\"!persistent\" icon=\"close\" :label=\"closeLabel ?? locale.close\" @click=\"close\" />\n <h2 :id=\"titleId\" class=\"flex-1 text-title-large font-medium text-on-surface\">\n <slot name=\"title\">{{ title }}</slot>\n </h2>\n <div v-if=\"$slots.actions\" class=\"flex items-center gap-2\">\n <slot name=\"actions\" />\n </div>\n </div>\n <div v-if=\"!bare\" class=\"flex-1 overflow-y-auto px-6 py-4 text-body-medium text-on-surface-variant\">\n <slot />\n </div>\n </div>\n </Transition>\n </Teleport>\n</template>\n\n<style scoped>\n.m3-dialog-enter-active,\n.m3-dialog-leave-active {\n transition: opacity 0.15s ease;\n}\n.m3-dialog-enter-from,\n.m3-dialog-leave-to {\n opacity: 0;\n}\n.m3-dialog-enter-active .dialog-box,\n.m3-dialog-leave-active .dialog-box {\n transition: transform 0.15s ease;\n}\n.m3-dialog-enter-from .dialog-box,\n.m3-dialog-leave-to .dialog-box {\n transform: scale(0.95);\n}\n\n.m3-dialog-fs-enter-active,\n.m3-dialog-fs-leave-active {\n transition: transform 0.25s cubic-bezier(0.2, 0, 0, 1), opacity 0.15s ease;\n}\n.m3-dialog-fs-enter-from {\n transform: translateY(100%);\n opacity: 0;\n}\n.m3-dialog-fs-leave-to {\n transform: translateY(100%);\n opacity: 0;\n}\n</style>\n\n<style>\n/* The surfaces' look, in the base layer so the consumer's classes on MDialog win (see MShape) */\n@layer base {\n .m3-dialog-surface {\n background-color: var(--color-surface-container-high);\n border-radius: var(--radius-xl);\n box-shadow: var(--shadow-elevation-3);\n }\n .m3-dialog-fs-surface {\n background-color: var(--color-surface);\n }\n}\n</style>\n"],"mappings":";;;;;;AAWA,IAAI,IAAQ,GACR,IAAW;AAEf,SAAS,IAAO;CACd,AAAI,QAAY,MACd,IAAW,SAAS,KAAK,MAAM,UAC/B,SAAS,KAAK,MAAM,WAAW;AAEnC;AAEA,SAAS,IAAS;CAChB,AAAI,IAAQ,KAAK,EAAE,MAAU,MAAG,SAAS,KAAK,MAAM,WAAW;AACjE;AAMA,SAAgB,EAAc,GAA+B;CAC3D,I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EAAA,CAAC,uCAAqC,CACfA,EAAAA,OAAO,OAAI,gBAAA,aAAkD,EAAA,YAAQ,CAAK,EAAA,aAAcA,EAAAA,OAAO,OAAI,UAAA,UAAA,EAAA,CAAA,CAAA;KAK/H,GAAA,CAAA,EAAqC,EAAA,QAAA,SAAA,CAAA,SAAA,CAAf,EAAA,EAAA,EAAA,KAAK,GAAA,CAAA,CAAA,GAAA,EAAA,CAAA,GAAA,CAAA;;IAG/B,EASM,OAAA;KARA,SAAA;KAAJ,KAAI;KACJ,OAAK,EAAA,CAAC,sEACEA,EAAAA,OAAO,UAAO,SAAA,MAAA,CAAA;KACrB,UAAQ;IAET,GAAA,CAAA,EAEM,OAAA;KAFG,SAAA;KAAJ,KAAI;IACP,GAAA,CAAA,EAAQ,EAAA,QAAA,WAAA,CAAA,GAAA,KAAA,GAAA,EAAA,CAAA,GAAA,GAAA,CAAA,GAAA,EAAA;IAID,EAAA,SAAeA,EAAAA,OAAO,WAAjC,EAAA,GAAA,EAA6F,OAA7F,CAA6F,KAAA,EAAA,IAAA,EAAA;IAElFA,EAAAA,OAAO,WAAlB,EAAA,GAAA,EAEM,OAFN,GAEM,CADJ,EAAuB,EAAA,QAAA,WAAA,CAAA,GAAA,KAAA,GAAA,EAAA,CAAA,CAAA,KAAA,EAAA,IAAA,EAAA;;;EAQjC,CAAA"}
1
+ {"version":3,"file":"MDialog-WqB0jewp.js","names":["$attrs","$slots"],"sources":["../src/composables/_useScrollLock.ts","../src/components/MDialog.vue","../src/components/MDialog.vue"],"sourcesContent":["import { getCurrentInstance, onBeforeUnmount, watch, type WatchSource } from 'vue'\n\n/*\n * Internal (not exported from index.ts): locks the page's scroll (body overflow hidden) while a modal surface is\n * open, shared by every component that does it. Counted, so overlays stacked on each other (a select's modal or a\n * date picker inside an MDialog) release it only when the last one closes: each component used to write\n * `overflow = ''` on its own, so closing the inner one let the page under the outer one scroll again. Each\n * instance also releases what it holds when it unmounts (a dialog removed while open left the page locked for good)\n * and nothing when it holds nothing (a select unmounting inside an open dialog used to unlock it).\n */\n\nlet count = 0\nlet previous = ''\n\nfunction lock() {\n if (count++ === 0) {\n previous = document.body.style.overflow\n document.body.style.overflow = 'hidden'\n }\n}\n\nfunction unlock() {\n if (count > 0 && --count === 0) document.body.style.overflow = previous\n}\n\n/**\n * Locks the page's scroll while `active` is true (from the start too: a dialog mounted open locks it), and releases\n * it when it turns false or the component unmounts. Without `active`, drive it with the returned `set`.\n */\nexport function useScrollLock(active?: WatchSource<boolean>) {\n let held = false\n function set(on: boolean) {\n if (typeof document === 'undefined' || on === held) return\n held = on\n if (on) lock()\n else unlock()\n }\n if (active) watch(active, (on) => set(!!on), { immediate: true })\n if (getCurrentInstance()) onBeforeUnmount(() => set(false))\n return { set }\n}\n","<script setup lang=\"ts\">\n/**\n * The generic M3 modal shell — Escape, scroll lock, and Teleport are handled internally. Supports a centered\n * card, a full-screen variant, and an optional icon that centers the title per spec.\n *\n * @slot icon M3 AlertDialog's optional icon (Secondary color, 24dp expected). Its presence also centers the\n * title, per spec.\n * @slot title Overrides the title prop with custom markup\n * @slot default Dialog body content — scrolls independently when taller than maxHeight. With `bare`, the whole\n * dialog: it fills the box (no title, padding, close button or actions row)\n * @slot actions Row of action buttons — wraps to a new line instead of overflowing when labels are long\n * @event update:modelValue Emitted when the dialog should open/close — powers v-model\n */\nimport { computed, nextTick, onUnmounted, ref, useId, watch } from 'vue'\nimport MIconButton from './MIconButton.vue'\nimport { useLocale } from '../composables/useLocale'\nimport { useScrollLock } from '../composables/_useScrollLock'\nimport { useEscapeStack } from '../composables/_useEscapeStack'\n\nconst props = withDefaults(\n defineProps<{\n /** Open/closed state (v-model) */\n modelValue: boolean\n /** Dialog title (overridable via the #title slot) */\n title?: string\n /** A Tailwind class (`max-w-sm`) or a CSS value (`420px`, `min(90vw, 40rem)`). */\n maxWidth?: string\n /**\n * Maximum height: a Tailwind class (`max-h-[60vh]`) or a CSS value (`480px`, `calc(100dvh - 4rem)`). When the\n * content is taller, the body scrolls and a divider appears above the actions.\n */\n // A Tailwind class (`max-h-[80vh]`) or a CSS value (`600px`). M3's `AlertDialogDefaults` has\n // no max-height token at all (only `DialogMaxWidth`) — the default here is a library-chosen\n // viewport-relative cap, not a spec value.\n maxHeight?: string\n /** Prevent closing by clicking the scrim, pressing Escape, or the X button */\n persistent?: boolean\n /** Full-screen variant — slides up from the bottom, covers the entire viewport */\n fullscreen?: boolean\n /** Aria label for the close (X) button — falls back to the locale string when omitted */\n closeLabel?: string\n /**\n * Show the header close (X) button — a library addition, not part of the M3 AlertDialog spec, so it can be\n * turned off\n */\n // Whether the header shows a close (\"X\") icon button. M3's `AlertDialog` spec has no such\n // button — it expects only a Cancel/Confirm text button in the actions row — so this is a\n // deliberate library extension on top of the spec, kept opt-out (default `true`, matching\n // this component's existing behavior) rather than added unconditionally.\n closable?: boolean\n /**\n * Just the dialog's box (surface, shape, elevation), scrim, Escape, scroll lock and animation, with the default\n * slot filling it: no title row, padding, close button or actions. For dialogs that draw everything themselves\n * (the date and time pickers). With `fullscreen`, the slot fills the screen and draws its own top bar. `title`\n * then only names it for assistive technology\n */\n bare?: boolean\n }>(),\n {\n // AlertDialogDefaults.DialogMaxWidth = 560dp\n maxWidth: 'max-w-[560px]',\n maxHeight: 'max-h-[90vh]',\n persistent: false,\n fullscreen: false,\n closable: true,\n bare: false,\n },\n)\n\n// The root is a Teleport, which can't take the consumer's class/style/attrs: they go on the dialog's surface\ndefineOptions({ inheritAttrs: false })\n\nconst locale = useLocale()\n\n// maxWidth/maxHeight take either a Tailwind class or a CSS value: a bare length or a CSS function\n// can't be a class, so those go to inline style instead.\nconst isCssValue = (v: string) => /^-?[\\d.]+[a-z%]*$|^(calc|min|max|clamp|var)\\(/i.test(v.trim())\nconst sizeClasses = computed(() => [props.maxWidth, props.maxHeight].filter((v) => !isCssValue(v)))\nconst sizeStyle = computed(() => ({\n ...(isCssValue(props.maxWidth) ? { maxWidth: props.maxWidth } : {}),\n ...(isCssValue(props.maxHeight) ? { maxHeight: props.maxHeight } : {}),\n}))\n\nconst emit = defineEmits<{ 'update:modelValue': [boolean] }>()\n\nfunction close() {\n if (props.persistent) return\n emit('update:modelValue', false)\n}\n\n\n// M3's dialog anatomy lists an optional divider between the (scrollable) content and the\n// actions row — Compose's own AlertDialog.kt has no built-in implementation of it at all, so\n// this shows it only when the content actually has more to scroll to, above the actions row.\nconst contentEl = ref<HTMLElement>()\nconst contentInnerEl = ref<HTMLElement>()\nconst showDivider = ref(false)\nlet resizeObserver: ResizeObserver | undefined\n\nfunction updateDividerVisibility() {\n const el = contentEl.value\n if (!el) { showDivider.value = false; return }\n showDivider.value = el.scrollHeight - el.scrollTop - el.clientHeight > 1\n}\n\nuseScrollLock(() => props.modelValue)\n// Escape closes the dialog on top only, when several are stacked\nuseEscapeStack(() => props.modelValue, close)\n\nconst titleId = `m3-dialog-${useId()}`\n\nwatch(\n () => props.modelValue,\n async (open) => {\n // Server rendering (a dialog open on load runs this immediately): nothing to measure or observe\n if (typeof window === 'undefined') return\n if (open) {\n await nextTick()\n updateDividerVisibility()\n // Observing contentEl alone only catches viewport-driven resizes (e.g. window resize\n // changing the maxHeight cap) — its own box stays put when the *slotted* content\n // changes height, since overflow doesn't affect the scroll container's own size. The\n // inner wrapper around the slot grows/shrinks with the actual content, so that's what\n // needs observing to catch dynamic content (reactive text, async-loaded content, etc).\n resizeObserver = new ResizeObserver(updateDividerVisibility)\n if (contentEl.value) resizeObserver.observe(contentEl.value)\n if (contentInnerEl.value) resizeObserver.observe(contentInnerEl.value)\n } else {\n resizeObserver?.disconnect()\n resizeObserver = undefined\n }\n },\n { immediate: true },\n)\n\nonUnmounted(() => {\n resizeObserver?.disconnect()\n})\n</script>\n\n<template>\n <Teleport to=\"body\">\n <!-- Basic dialog -->\n <!-- appear: a dialog mounted already open (v-if + modelValue in the same tick) animates in too -->\n <Transition v-if=\"!fullscreen\" name=\"m3-dialog\" appear>\n <div\n v-if=\"modelValue\"\n class=\"fixed inset-0 z-50 flex items-center justify-center bg-scrim/32 p-4\"\n @click.self=\"close\"\n >\n <div\n v-bind=\"$attrs\"\n class=\"dialog-box m3-dialog-surface flex min-w-[280px] w-full flex-col\"\n :class=\"sizeClasses\"\n :style=\"sizeStyle\"\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-labelledby=\"!bare && ($slots.title || title) ? titleId : undefined\"\n :aria-label=\"bare ? title : undefined\"\n >\n <!-- Bare: the content is the whole dialog (scrolling if taller than maxHeight), clipped to the box's\n corners (rounded-[inherit]) so content reaching its edges, like a full-bleed image, keeps them -->\n <div v-if=\"bare\" class=\"min-h-0 overflow-y-auto rounded-[inherit]\">\n <slot />\n </div>\n <template v-else>\n <!--\n AlertDialogDefaults.dialogPadding is 24dp on all four sides of the whole content\n column, with per-element bottom paddings (IconPadding/TitlePadding/textPadding)\n providing the gaps BETWEEN elements — not a single wrapping padding, since this\n template uses separate divs per section instead of one padded Column. Each\n section's own top/bottom classes are chosen so the combined gaps still land on\n the right dp value: title-to-body is 16dp (8px here + 8px there), body-to-actions\n is 24dp (8px here + 16px there), and the outermost edges (top of title, bottom of\n whichever section is last) are the full 24dp on their own.\n -->\n <div class=\"relative px-6 pt-6 pb-2\">\n <!--\n Wrapped in a plain div rather than passing `absolute right-4 top-4` straight to\n MIconButton: its root already carries its own `relative` (for the ripple span),\n and Tailwind resolves conflicting position utilities by source order in the\n compiled CSS, not by order in the class attribute — so an external `absolute`\n can silently lose to that internal `relative` instead of overriding it.\n -->\n <div v-if=\"closable && !persistent\" class=\"absolute right-4 top-4\">\n <MIconButton icon=\"close\" :label=\"closeLabel ?? locale.close\" @click=\"close\" />\n </div>\n <!--\n Icon slot: M3 AlertDialog's optional `icon` param (IconColor=Secondary,\n IconSize=24dp expected from the slot content, IconPadding bottom=16dp below it),\n which per spec also centers the title (\"Align the title to the center when an\n icon is present\") — reserving `pr-10` on the title only when the close button is\n also showing, so a centered title doesn't collide with it.\n -->\n <div v-if=\"$slots.icon\" class=\"mb-4 flex justify-center text-secondary\">\n <slot name=\"icon\" />\n </div>\n <h2\n :id=\"titleId\"\n class=\"text-headline-small text-on-surface\"\n :class=\"[\n $slots.icon ? 'text-center' : 'text-left',\n closable && !persistent ? ($slots.icon ? 'px-10' : 'pr-10') : '',\n ]\"\n >\n <slot name=\"title\">{{ title }}</slot>\n </h2>\n </div>\n <div\n ref=\"contentEl\"\n class=\"overflow-y-auto px-6 pt-2 text-body-medium text-on-surface-variant\"\n :class=\"$slots.actions ? 'pb-2' : 'pb-6'\"\n @scroll=\"updateDividerVisibility\"\n >\n <div ref=\"contentInnerEl\">\n <slot />\n </div>\n </div>\n <!-- Divider: M3 dialog anatomy's optional divider, shown only while the content has more to scroll to -->\n <div v-if=\"showDivider && $slots.actions\" class=\"shrink-0 border-t border-outline-variant\" />\n <!-- flex-wrap approximates AlertDialogFlowRow: buttons wrap to a new line instead of overflowing when labels are too long to fit on one -->\n <div v-if=\"$slots.actions\" class=\"flex flex-wrap justify-end gap-2 px-6 pt-4 pb-6\">\n <slot name=\"actions\" />\n </div>\n </template>\n </div>\n </div>\n </Transition>\n\n <!-- Fullscreen dialog -->\n <Transition v-else name=\"m3-dialog-fs\" appear>\n <div\n v-if=\"modelValue\"\n v-bind=\"$attrs\"\n class=\"dialog-fs m3-dialog-fs-surface fixed inset-0 z-50 flex flex-col\"\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-labelledby=\"!bare && ($slots.title || title) ? titleId : undefined\"\n :aria-label=\"bare ? title : undefined\"\n >\n <!-- Bare: the content is the whole screen, top bar included, in whatever colors it draws -->\n <div v-if=\"bare\" class=\"min-h-0 flex-1 overflow-y-auto\">\n <slot />\n </div>\n <div v-else class=\"flex h-14 shrink-0 items-center gap-2 px-2\">\n <MIconButton v-if=\"!persistent\" icon=\"close\" :label=\"closeLabel ?? locale.close\" @click=\"close\" />\n <h2 :id=\"titleId\" class=\"flex-1 text-title-large font-medium text-on-surface\">\n <slot name=\"title\">{{ title }}</slot>\n </h2>\n <div v-if=\"$slots.actions\" class=\"flex items-center gap-2\">\n <slot name=\"actions\" />\n </div>\n </div>\n <div v-if=\"!bare\" class=\"flex-1 overflow-y-auto px-6 py-4 text-body-medium text-on-surface-variant\">\n <slot />\n </div>\n </div>\n </Transition>\n </Teleport>\n</template>\n\n<style scoped>\n.m3-dialog-enter-active,\n.m3-dialog-leave-active {\n transition: opacity 0.15s ease;\n}\n.m3-dialog-enter-from,\n.m3-dialog-leave-to {\n opacity: 0;\n}\n.m3-dialog-enter-active .dialog-box,\n.m3-dialog-leave-active .dialog-box {\n transition: transform 0.15s ease;\n}\n.m3-dialog-enter-from .dialog-box,\n.m3-dialog-leave-to .dialog-box {\n transform: scale(0.95);\n}\n\n.m3-dialog-fs-enter-active,\n.m3-dialog-fs-leave-active {\n transition: transform 0.25s cubic-bezier(0.2, 0, 0, 1), opacity 0.15s ease;\n}\n.m3-dialog-fs-enter-from {\n transform: translateY(100%);\n opacity: 0;\n}\n.m3-dialog-fs-leave-to {\n transform: translateY(100%);\n opacity: 0;\n}\n</style>\n\n<style>\n/* The surfaces' look, in the base layer so the consumer's classes on MDialog win (see MShape) */\n@layer base {\n .m3-dialog-surface {\n background-color: var(--color-surface-container-high);\n border-radius: var(--radius-xl);\n box-shadow: var(--shadow-elevation-3);\n }\n .m3-dialog-fs-surface {\n background-color: var(--color-surface);\n }\n}\n</style>\n","<script setup lang=\"ts\">\n/**\n * The generic M3 modal shell — Escape, scroll lock, and Teleport are handled internally. Supports a centered\n * card, a full-screen variant, and an optional icon that centers the title per spec.\n *\n * @slot icon M3 AlertDialog's optional icon (Secondary color, 24dp expected). Its presence also centers the\n * title, per spec.\n * @slot title Overrides the title prop with custom markup\n * @slot default Dialog body content — scrolls independently when taller than maxHeight. With `bare`, the whole\n * dialog: it fills the box (no title, padding, close button or actions row)\n * @slot actions Row of action buttons — wraps to a new line instead of overflowing when labels are long\n * @event update:modelValue Emitted when the dialog should open/close — powers v-model\n */\nimport { computed, nextTick, onUnmounted, ref, useId, watch } from 'vue'\nimport MIconButton from './MIconButton.vue'\nimport { useLocale } from '../composables/useLocale'\nimport { useScrollLock } from '../composables/_useScrollLock'\nimport { useEscapeStack } from '../composables/_useEscapeStack'\n\nconst props = withDefaults(\n defineProps<{\n /** Open/closed state (v-model) */\n modelValue: boolean\n /** Dialog title (overridable via the #title slot) */\n title?: string\n /** A Tailwind class (`max-w-sm`) or a CSS value (`420px`, `min(90vw, 40rem)`). */\n maxWidth?: string\n /**\n * Maximum height: a Tailwind class (`max-h-[60vh]`) or a CSS value (`480px`, `calc(100dvh - 4rem)`). When the\n * content is taller, the body scrolls and a divider appears above the actions.\n */\n // A Tailwind class (`max-h-[80vh]`) or a CSS value (`600px`). M3's `AlertDialogDefaults` has\n // no max-height token at all (only `DialogMaxWidth`) — the default here is a library-chosen\n // viewport-relative cap, not a spec value.\n maxHeight?: string\n /** Prevent closing by clicking the scrim, pressing Escape, or the X button */\n persistent?: boolean\n /** Full-screen variant — slides up from the bottom, covers the entire viewport */\n fullscreen?: boolean\n /** Aria label for the close (X) button — falls back to the locale string when omitted */\n closeLabel?: string\n /**\n * Show the header close (X) button — a library addition, not part of the M3 AlertDialog spec, so it can be\n * turned off\n */\n // Whether the header shows a close (\"X\") icon button. M3's `AlertDialog` spec has no such\n // button — it expects only a Cancel/Confirm text button in the actions row — so this is a\n // deliberate library extension on top of the spec, kept opt-out (default `true`, matching\n // this component's existing behavior) rather than added unconditionally.\n closable?: boolean\n /**\n * Just the dialog's box (surface, shape, elevation), scrim, Escape, scroll lock and animation, with the default\n * slot filling it: no title row, padding, close button or actions. For dialogs that draw everything themselves\n * (the date and time pickers). With `fullscreen`, the slot fills the screen and draws its own top bar. `title`\n * then only names it for assistive technology\n */\n bare?: boolean\n }>(),\n {\n // AlertDialogDefaults.DialogMaxWidth = 560dp\n maxWidth: 'max-w-[560px]',\n maxHeight: 'max-h-[90vh]',\n persistent: false,\n fullscreen: false,\n closable: true,\n bare: false,\n },\n)\n\n// The root is a Teleport, which can't take the consumer's class/style/attrs: they go on the dialog's surface\ndefineOptions({ inheritAttrs: false })\n\nconst locale = useLocale()\n\n// maxWidth/maxHeight take either a Tailwind class or a CSS value: a bare length or a CSS function\n// can't be a class, so those go to inline style instead.\nconst isCssValue = (v: string) => /^-?[\\d.]+[a-z%]*$|^(calc|min|max|clamp|var)\\(/i.test(v.trim())\nconst sizeClasses = computed(() => [props.maxWidth, props.maxHeight].filter((v) => !isCssValue(v)))\nconst sizeStyle = computed(() => ({\n ...(isCssValue(props.maxWidth) ? { maxWidth: props.maxWidth } : {}),\n ...(isCssValue(props.maxHeight) ? { maxHeight: props.maxHeight } : {}),\n}))\n\nconst emit = defineEmits<{ 'update:modelValue': [boolean] }>()\n\nfunction close() {\n if (props.persistent) return\n emit('update:modelValue', false)\n}\n\n\n// M3's dialog anatomy lists an optional divider between the (scrollable) content and the\n// actions row — Compose's own AlertDialog.kt has no built-in implementation of it at all, so\n// this shows it only when the content actually has more to scroll to, above the actions row.\nconst contentEl = ref<HTMLElement>()\nconst contentInnerEl = ref<HTMLElement>()\nconst showDivider = ref(false)\nlet resizeObserver: ResizeObserver | undefined\n\nfunction updateDividerVisibility() {\n const el = contentEl.value\n if (!el) { showDivider.value = false; return }\n showDivider.value = el.scrollHeight - el.scrollTop - el.clientHeight > 1\n}\n\nuseScrollLock(() => props.modelValue)\n// Escape closes the dialog on top only, when several are stacked\nuseEscapeStack(() => props.modelValue, close)\n\nconst titleId = `m3-dialog-${useId()}`\n\nwatch(\n () => props.modelValue,\n async (open) => {\n // Server rendering (a dialog open on load runs this immediately): nothing to measure or observe\n if (typeof window === 'undefined') return\n if (open) {\n await nextTick()\n updateDividerVisibility()\n // Observing contentEl alone only catches viewport-driven resizes (e.g. window resize\n // changing the maxHeight cap) — its own box stays put when the *slotted* content\n // changes height, since overflow doesn't affect the scroll container's own size. The\n // inner wrapper around the slot grows/shrinks with the actual content, so that's what\n // needs observing to catch dynamic content (reactive text, async-loaded content, etc).\n resizeObserver = new ResizeObserver(updateDividerVisibility)\n if (contentEl.value) resizeObserver.observe(contentEl.value)\n if (contentInnerEl.value) resizeObserver.observe(contentInnerEl.value)\n } else {\n resizeObserver?.disconnect()\n resizeObserver = undefined\n }\n },\n { immediate: true },\n)\n\nonUnmounted(() => {\n resizeObserver?.disconnect()\n})\n</script>\n\n<template>\n <Teleport to=\"body\">\n <!-- Basic dialog -->\n <!-- appear: a dialog mounted already open (v-if + modelValue in the same tick) animates in too -->\n <Transition v-if=\"!fullscreen\" name=\"m3-dialog\" appear>\n <div\n v-if=\"modelValue\"\n class=\"fixed inset-0 z-50 flex items-center justify-center bg-scrim/32 p-4\"\n @click.self=\"close\"\n >\n <div\n v-bind=\"$attrs\"\n class=\"dialog-box m3-dialog-surface flex min-w-[280px] w-full flex-col\"\n :class=\"sizeClasses\"\n :style=\"sizeStyle\"\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-labelledby=\"!bare && ($slots.title || title) ? titleId : undefined\"\n :aria-label=\"bare ? title : undefined\"\n >\n <!-- Bare: the content is the whole dialog (scrolling if taller than maxHeight), clipped to the box's\n corners (rounded-[inherit]) so content reaching its edges, like a full-bleed image, keeps them -->\n <div v-if=\"bare\" class=\"min-h-0 overflow-y-auto rounded-[inherit]\">\n <slot />\n </div>\n <template v-else>\n <!--\n AlertDialogDefaults.dialogPadding is 24dp on all four sides of the whole content\n column, with per-element bottom paddings (IconPadding/TitlePadding/textPadding)\n providing the gaps BETWEEN elements — not a single wrapping padding, since this\n template uses separate divs per section instead of one padded Column. Each\n section's own top/bottom classes are chosen so the combined gaps still land on\n the right dp value: title-to-body is 16dp (8px here + 8px there), body-to-actions\n is 24dp (8px here + 16px there), and the outermost edges (top of title, bottom of\n whichever section is last) are the full 24dp on their own.\n -->\n <div class=\"relative px-6 pt-6 pb-2\">\n <!--\n Wrapped in a plain div rather than passing `absolute right-4 top-4` straight to\n MIconButton: its root already carries its own `relative` (for the ripple span),\n and Tailwind resolves conflicting position utilities by source order in the\n compiled CSS, not by order in the class attribute — so an external `absolute`\n can silently lose to that internal `relative` instead of overriding it.\n -->\n <div v-if=\"closable && !persistent\" class=\"absolute right-4 top-4\">\n <MIconButton icon=\"close\" :label=\"closeLabel ?? locale.close\" @click=\"close\" />\n </div>\n <!--\n Icon slot: M3 AlertDialog's optional `icon` param (IconColor=Secondary,\n IconSize=24dp expected from the slot content, IconPadding bottom=16dp below it),\n which per spec also centers the title (\"Align the title to the center when an\n icon is present\") — reserving `pr-10` on the title only when the close button is\n also showing, so a centered title doesn't collide with it.\n -->\n <div v-if=\"$slots.icon\" class=\"mb-4 flex justify-center text-secondary\">\n <slot name=\"icon\" />\n </div>\n <h2\n :id=\"titleId\"\n class=\"text-headline-small text-on-surface\"\n :class=\"[\n $slots.icon ? 'text-center' : 'text-left',\n closable && !persistent ? ($slots.icon ? 'px-10' : 'pr-10') : '',\n ]\"\n >\n <slot name=\"title\">{{ title }}</slot>\n </h2>\n </div>\n <div\n ref=\"contentEl\"\n class=\"overflow-y-auto px-6 pt-2 text-body-medium text-on-surface-variant\"\n :class=\"$slots.actions ? 'pb-2' : 'pb-6'\"\n @scroll=\"updateDividerVisibility\"\n >\n <div ref=\"contentInnerEl\">\n <slot />\n </div>\n </div>\n <!-- Divider: M3 dialog anatomy's optional divider, shown only while the content has more to scroll to -->\n <div v-if=\"showDivider && $slots.actions\" class=\"shrink-0 border-t border-outline-variant\" />\n <!-- flex-wrap approximates AlertDialogFlowRow: buttons wrap to a new line instead of overflowing when labels are too long to fit on one -->\n <div v-if=\"$slots.actions\" class=\"flex flex-wrap justify-end gap-2 px-6 pt-4 pb-6\">\n <slot name=\"actions\" />\n </div>\n </template>\n </div>\n </div>\n </Transition>\n\n <!-- Fullscreen dialog -->\n <Transition v-else name=\"m3-dialog-fs\" appear>\n <div\n v-if=\"modelValue\"\n v-bind=\"$attrs\"\n class=\"dialog-fs m3-dialog-fs-surface fixed inset-0 z-50 flex flex-col\"\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-labelledby=\"!bare && ($slots.title || title) ? titleId : undefined\"\n :aria-label=\"bare ? title : undefined\"\n >\n <!-- Bare: the content is the whole screen, top bar included, in whatever colors it draws -->\n <div v-if=\"bare\" class=\"min-h-0 flex-1 overflow-y-auto\">\n <slot />\n </div>\n <div v-else class=\"flex h-14 shrink-0 items-center gap-2 px-2\">\n <MIconButton v-if=\"!persistent\" icon=\"close\" :label=\"closeLabel ?? locale.close\" @click=\"close\" />\n <h2 :id=\"titleId\" class=\"flex-1 text-title-large font-medium text-on-surface\">\n <slot name=\"title\">{{ title }}</slot>\n </h2>\n <div v-if=\"$slots.actions\" class=\"flex items-center gap-2\">\n <slot name=\"actions\" />\n </div>\n </div>\n <div v-if=\"!bare\" class=\"flex-1 overflow-y-auto px-6 py-4 text-body-medium text-on-surface-variant\">\n <slot />\n </div>\n </div>\n </Transition>\n </Teleport>\n</template>\n\n<style scoped>\n.m3-dialog-enter-active,\n.m3-dialog-leave-active {\n transition: opacity 0.15s ease;\n}\n.m3-dialog-enter-from,\n.m3-dialog-leave-to {\n opacity: 0;\n}\n.m3-dialog-enter-active .dialog-box,\n.m3-dialog-leave-active .dialog-box {\n transition: transform 0.15s ease;\n}\n.m3-dialog-enter-from .dialog-box,\n.m3-dialog-leave-to .dialog-box {\n transform: scale(0.95);\n}\n\n.m3-dialog-fs-enter-active,\n.m3-dialog-fs-leave-active {\n transition: transform 0.25s cubic-bezier(0.2, 0, 0, 1), opacity 0.15s ease;\n}\n.m3-dialog-fs-enter-from {\n transform: translateY(100%);\n opacity: 0;\n}\n.m3-dialog-fs-leave-to {\n transform: translateY(100%);\n opacity: 0;\n}\n</style>\n\n<style>\n/* The surfaces' look, in the base layer so the consumer's classes on MDialog win (see MShape) */\n@layer base {\n .m3-dialog-surface {\n background-color: var(--color-surface-container-high);\n border-radius: var(--radius-xl);\n box-shadow: var(--shadow-elevation-3);\n }\n .m3-dialog-fs-surface {\n background-color: var(--color-surface);\n }\n}\n</style>\n"],"mappings":";;;;;;AAWA,IAAI,IAAQ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,cAAc,EAAA,CAAA,CAAM,CAAC;MAAQ,SAAO;;KAS7DA,EAAAA,OAAO,QAAlB,EAAA,GAAA,EAEM,OAFN,GAEM,CADJ,EAAoB,EAAA,QAAA,QAAA,CAAA,GAAA,KAAA,GAAA,EAAA,CAAA,CAAA,KAAA,EAAA,IAAA,EAAA;KAEtB,EASK,MAAA;MARF,IAAI;MACL,OAAK,EAAA,CAAC,uCAAqC,CACfA,EAAAA,OAAO,OAAI,gBAAA,aAAkD,EAAA,YAAQ,CAAK,EAAA,aAAcA,EAAAA,OAAO,OAAI,UAAA,UAAA,EAAA,CAAA,CAAA;KAK/H,GAAA,CAAA,EAAqC,EAAA,QAAA,SAAA,CAAA,SAAA,CAAf,EAAA,EAAA,EAAA,KAAK,GAAA,CAAA,CAAA,GAAA,EAAA,CAAA,GAAA,CAAA;;IAG/B,EASM,OAAA;KARA,SAAA;KAAJ,KAAI;KACJ,OAAK,EAAA,CAAC,sEACEA,EAAAA,OAAO,UAAO,SAAA,MAAA,CAAA;KACrB,UAAQ;IAET,GAAA,CAAA,EAEM,OAAA;KAFG,SAAA;KAAJ,KAAI;IACP,GAAA,CAAA,EAAQ,EAAA,QAAA,WAAA,CAAA,GAAA,KAAA,GAAA,EAAA,CAAA,GAAA,GAAA,CAAA,GAAA,EAAA;IAID,EAAA,SAAeA,EAAAA,OAAO,WAAjC,EAAA,GAAA,EAA6F,OAA7F,CAA6F,KAAA,EAAA,IAAA,EAAA;IAElFA,EAAAA,OAAO,WAAlB,EAAA,GAAA,EAEM,OAFN,GAEM,CADJ,EAAuB,EAAA,QAAA,WAAA,CAAA,GAAA,KAAA,GAAA,EAAA,CAAA,CAAA,KAAA,EAAA,IAAA,EAAA;;;EAQjC,CAAA"}
@@ -1,4 +1,4 @@
1
- import { i as e } from "./useLocale-CaWwi-b6.js";
1
+ import { i as e } from "./useLocale-D2ucaY-l.js";
2
2
  import { a as t, i as n, s as r } from "./MIconButton-DoNotQ9v.js";
3
3
  import { t as i } from "./MIcon-Bxh9j135.js";
4
4
  import { Transition as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createTextVNode as d, createVNode as f, defineComponent as p, getCurrentInstance as m, h, inject as g, mergeProps as _, nextTick as v, normalizeClass as y, normalizeStyle as b, onMounted as x, onUnmounted as S, onUpdated as C, openBlock as w, provide as T, ref as E, renderSlot as D, resolveDynamicComponent as ee, shallowRef as O, toDisplayString as k, unref as A, useId as te, useSlots as j, watch as M, withCtx as N, withModifiers as P } from "vue";
@@ -821,4 +821,4 @@ var le = ["role"], ue = /* @__PURE__ */ p({
821
821
  //#endregion
822
822
  export { J as a, ne as c, ce as i, fe as n, U as o, ue as r, ie as s, Se as t };
823
823
 
824
- //# sourceMappingURL=MListItem-BxifHJdU.js.map
824
+ //# sourceMappingURL=MListItem-Cf-C2Ru-.js.map