snice 2.1.5 → 2.2.0
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.
- package/dist/components/accordion/snice-accordion-item.d.ts +25 -0
- package/dist/components/accordion/snice-accordion-item.js +255 -0
- package/dist/components/accordion/snice-accordion-item.js.map +1 -0
- package/dist/components/accordion/snice-accordion.d.ts +28 -0
- package/dist/components/accordion/snice-accordion.js +206 -0
- package/dist/components/accordion/snice-accordion.js.map +1 -0
- package/dist/components/accordion/snice-accordion.types.d.ts +29 -0
- package/dist/components/alert/snice-alert.d.ts +26 -0
- package/dist/components/alert/snice-alert.js +180 -0
- package/dist/components/alert/snice-alert.js.map +1 -0
- package/{components/alert/snice-alert.types.ts → dist/components/alert/snice-alert.types.d.ts} +8 -9
- package/dist/components/avatar/snice-avatar.d.ts +24 -0
- package/dist/components/avatar/snice-avatar.js +180 -0
- package/dist/components/avatar/snice-avatar.js.map +1 -0
- package/dist/components/avatar/snice-avatar.types.d.ts +12 -0
- package/dist/components/badge/snice-badge.d.ts +25 -0
- package/dist/components/badge/snice-badge.js +169 -0
- package/dist/components/badge/snice-badge.js.map +1 -0
- package/{components/badge/snice-badge.types.ts → dist/components/badge/snice-badge.types.d.ts} +11 -12
- package/dist/components/breadcrumbs/snice-breadcrumbs.d.ts +27 -0
- package/dist/components/breadcrumbs/snice-breadcrumbs.js +214 -0
- package/dist/components/breadcrumbs/snice-breadcrumbs.js.map +1 -0
- package/dist/components/breadcrumbs/snice-breadcrumbs.types.d.ts +23 -0
- package/dist/components/breadcrumbs/snice-crumb.d.ts +9 -0
- package/dist/components/breadcrumbs/snice-crumb.js +63 -0
- package/dist/components/breadcrumbs/snice-crumb.js.map +1 -0
- package/dist/components/button/snice-button.d.ts +32 -0
- package/dist/components/button/snice-button.js +232 -0
- package/dist/components/button/snice-button.js.map +1 -0
- package/dist/components/button/snice-button.types.d.ts +23 -0
- package/dist/components/card/snice-card.d.ts +19 -0
- package/dist/components/card/snice-card.js +136 -0
- package/dist/components/card/snice-card.js.map +1 -0
- package/{components/card/snice-card.types.ts → dist/components/card/snice-card.types.d.ts} +6 -7
- package/dist/components/checkbox/snice-checkbox.d.ts +34 -0
- package/dist/components/checkbox/snice-checkbox.js +286 -0
- package/dist/components/checkbox/snice-checkbox.js.map +1 -0
- package/dist/components/checkbox/snice-checkbox.types.d.ts +20 -0
- package/dist/components/chip/snice-chip.d.ts +28 -0
- package/dist/components/chip/snice-chip.js +199 -0
- package/dist/components/chip/snice-chip.js.map +1 -0
- package/dist/components/chip/snice-chip.types.d.ts +14 -0
- package/dist/components/date-picker/snice-date-picker.d.ts +82 -0
- package/dist/components/date-picker/snice-date-picker.js +847 -0
- package/dist/components/date-picker/snice-date-picker.js.map +1 -0
- package/dist/components/date-picker/snice-date-picker.types.d.ts +71 -0
- package/dist/components/divider/snice-divider.d.ts +17 -0
- package/dist/components/divider/snice-divider.js +122 -0
- package/dist/components/divider/snice-divider.js.map +1 -0
- package/{components/divider/snice-divider.types.ts → dist/components/divider/snice-divider.types.d.ts} +9 -10
- package/dist/components/drawer/snice-drawer.d.ts +37 -0
- package/dist/components/drawer/snice-drawer.js +337 -0
- package/dist/components/drawer/snice-drawer.js.map +1 -0
- package/dist/components/drawer/snice-drawer.types.d.ts +16 -0
- package/dist/components/input/snice-input.d.ts +65 -0
- package/dist/components/input/snice-input.js +567 -0
- package/dist/components/input/snice-input.js.map +1 -0
- package/dist/components/input/snice-input.types.d.ts +53 -0
- package/dist/components/layout/snice-layout-blog.d.ts +4 -0
- package/dist/components/layout/snice-layout-blog.js +67 -0
- package/dist/components/layout/snice-layout-blog.js.map +1 -0
- package/dist/components/layout/snice-layout-card.d.ts +6 -0
- package/dist/components/layout/snice-layout-card.js +64 -0
- package/dist/components/layout/snice-layout-card.js.map +1 -0
- package/dist/components/layout/snice-layout-centered.d.ts +5 -0
- package/dist/components/layout/snice-layout-centered.js +48 -0
- package/dist/components/layout/snice-layout-centered.js.map +1 -0
- package/dist/components/layout/snice-layout-dashboard.d.ts +4 -0
- package/dist/components/layout/snice-layout-dashboard.js +64 -0
- package/dist/components/layout/snice-layout-dashboard.js.map +1 -0
- package/dist/components/layout/snice-layout-fullscreen.d.ts +5 -0
- package/dist/components/layout/snice-layout-fullscreen.js +60 -0
- package/dist/components/layout/snice-layout-fullscreen.js.map +1 -0
- package/dist/components/layout/snice-layout-landing.d.ts +4 -0
- package/dist/components/layout/snice-layout-landing.js +66 -0
- package/dist/components/layout/snice-layout-landing.js.map +1 -0
- package/dist/components/layout/snice-layout-minimal.d.ts +4 -0
- package/dist/components/layout/snice-layout-minimal.js +38 -0
- package/dist/components/layout/snice-layout-minimal.js.map +1 -0
- package/dist/components/layout/snice-layout-sidebar.d.ts +5 -0
- package/dist/components/layout/snice-layout-sidebar.js +74 -0
- package/dist/components/layout/snice-layout-sidebar.js.map +1 -0
- package/dist/components/layout/snice-layout-split.d.ts +6 -0
- package/dist/components/layout/snice-layout-split.js +58 -0
- package/dist/components/layout/snice-layout-split.js.map +1 -0
- package/dist/components/layout/snice-layout.d.ts +4 -0
- package/dist/components/layout/snice-layout.js +54 -0
- package/dist/components/layout/snice-layout.js.map +1 -0
- package/{components/layout/snice-layout.types.ts → dist/components/layout/snice-layout.types.d.ts} +1 -3
- package/dist/components/login/snice-login.d.ts +44 -0
- package/dist/components/login/snice-login.js +382 -0
- package/dist/components/login/snice-login.js.map +1 -0
- package/dist/components/login/snice-login.types.d.ts +26 -0
- package/dist/components/modal/snice-modal.d.ts +32 -0
- package/dist/components/modal/snice-modal.js +280 -0
- package/dist/components/modal/snice-modal.js.map +1 -0
- package/dist/components/modal/snice-modal.types.d.ts +18 -0
- package/dist/components/pagination/snice-pagination.d.ts +26 -0
- package/dist/components/pagination/snice-pagination.js +373 -0
- package/dist/components/pagination/snice-pagination.js.map +1 -0
- package/dist/components/pagination/snice-pagination.types.d.ts +18 -0
- package/dist/components/progress/snice-progress.d.ts +35 -0
- package/dist/components/progress/snice-progress.js +305 -0
- package/dist/components/progress/snice-progress.js.map +1 -0
- package/dist/components/progress/snice-progress.types.d.ts +18 -0
- package/dist/components/radio/snice-radio.d.ts +33 -0
- package/dist/components/radio/snice-radio.js +279 -0
- package/dist/components/radio/snice-radio.js.map +1 -0
- package/dist/components/radio/snice-radio.types.d.ts +19 -0
- package/dist/components/select/snice-option.d.ts +17 -0
- package/dist/components/select/snice-option.js +88 -0
- package/dist/components/select/snice-option.js.map +1 -0
- package/{components/select/snice-option.types.ts → dist/components/select/snice-option.types.d.ts} +8 -8
- package/dist/components/select/snice-select.d.ts +89 -0
- package/dist/components/select/snice-select.js +864 -0
- package/dist/components/select/snice-select.js.map +1 -0
- package/dist/components/select/snice-select.types.d.ts +49 -0
- package/dist/components/skeleton/snice-skeleton.d.ts +16 -0
- package/dist/components/skeleton/snice-skeleton.js +166 -0
- package/dist/components/skeleton/snice-skeleton.js.map +1 -0
- package/{components/skeleton/snice-skeleton.types.ts → dist/components/skeleton/snice-skeleton.types.d.ts} +7 -8
- package/dist/components/snice-cell-C8aBfN72.js +4 -0
- package/dist/components/snice-cell-C8aBfN72.js.map +1 -0
- package/dist/components/switch/snice-switch.d.ts +38 -0
- package/dist/components/switch/snice-switch.js +305 -0
- package/dist/components/switch/snice-switch.js.map +1 -0
- package/dist/components/switch/snice-switch.types.d.ts +21 -0
- package/dist/components/symbols.d.ts +1 -0
- package/dist/components/symbols.js +22 -0
- package/dist/components/symbols.js.map +1 -0
- package/dist/components/table/snice-cell-boolean.d.ts +21 -0
- package/dist/components/table/snice-cell-boolean.js +164 -0
- package/dist/components/table/snice-cell-boolean.js.map +1 -0
- package/dist/components/table/snice-cell-date.d.ts +24 -0
- package/dist/components/table/snice-cell-date.js +253 -0
- package/dist/components/table/snice-cell-date.js.map +1 -0
- package/dist/components/table/snice-cell-duration.d.ts +16 -0
- package/dist/components/table/snice-cell-duration.js +130 -0
- package/dist/components/table/snice-cell-duration.js.map +1 -0
- package/dist/components/table/snice-cell-filesize.d.ts +16 -0
- package/dist/components/table/snice-cell-filesize.js +126 -0
- package/dist/components/table/snice-cell-filesize.js.map +1 -0
- package/dist/components/table/snice-cell-number.d.ts +23 -0
- package/dist/components/table/snice-cell-number.js +215 -0
- package/dist/components/table/snice-cell-number.js.map +1 -0
- package/dist/components/table/snice-cell-progress.d.ts +17 -0
- package/dist/components/table/snice-cell-progress.js +121 -0
- package/dist/components/table/snice-cell-progress.js.map +1 -0
- package/dist/components/table/snice-cell-rating.d.ts +17 -0
- package/dist/components/table/snice-cell-rating.js +120 -0
- package/dist/components/table/snice-cell-rating.js.map +1 -0
- package/dist/components/table/snice-cell-sparkline.d.ts +29 -0
- package/dist/components/table/snice-cell-sparkline.js +306 -0
- package/dist/components/table/snice-cell-sparkline.js.map +1 -0
- package/dist/components/table/snice-cell-text.d.ts +19 -0
- package/dist/components/table/snice-cell-text.js +161 -0
- package/dist/components/table/snice-cell-text.js.map +1 -0
- package/dist/components/table/snice-cell.d.ts +32 -0
- package/dist/components/table/snice-cell.js +458 -0
- package/dist/components/table/snice-cell.js.map +1 -0
- package/dist/components/table/snice-column.d.ts +62 -0
- package/dist/components/table/snice-column.js +506 -0
- package/dist/components/table/snice-column.js.map +1 -0
- package/dist/components/table/snice-header.d.ts +33 -0
- package/dist/components/table/snice-header.js +289 -0
- package/dist/components/table/snice-header.js.map +1 -0
- package/dist/components/table/snice-progress.d.ts +10 -0
- package/dist/components/table/snice-progress.js +105 -0
- package/dist/components/table/snice-progress.js.map +1 -0
- package/dist/components/table/snice-rating.d.ts +9 -0
- package/dist/components/table/snice-rating.js +81 -0
- package/dist/components/table/snice-rating.js.map +1 -0
- package/dist/components/table/snice-row.d.ts +43 -0
- package/dist/components/table/snice-row.js +353 -0
- package/dist/components/table/snice-row.js.map +1 -0
- package/dist/components/table/snice-table.d.ts +69 -0
- package/dist/components/table/snice-table.js +792 -0
- package/dist/components/table/snice-table.js.map +1 -0
- package/dist/components/table/snice-table.types.d.ts +137 -0
- package/dist/components/tabs/snice-tab-panel.d.ts +12 -0
- package/dist/components/tabs/snice-tab-panel.js +87 -0
- package/dist/components/tabs/snice-tab-panel.js.map +1 -0
- package/dist/components/tabs/snice-tab.d.ts +13 -0
- package/dist/components/tabs/snice-tab.js +98 -0
- package/dist/components/tabs/snice-tab.js.map +1 -0
- package/dist/components/tabs/snice-tabs.d.ts +34 -0
- package/dist/components/tabs/snice-tabs.js +375 -0
- package/dist/components/tabs/snice-tabs.js.map +1 -0
- package/dist/components/tabs/snice-tabs.types.d.ts +23 -0
- package/dist/components/toast/snice-toast-container.d.ts +25 -0
- package/dist/components/toast/snice-toast-container.js +252 -0
- package/dist/components/toast/snice-toast-container.js.map +1 -0
- package/dist/components/toast/snice-toast.d.ts +23 -0
- package/dist/components/toast/snice-toast.js +321 -0
- package/dist/components/toast/snice-toast.js.map +1 -0
- package/dist/components/toast/snice-toast.types.d.ts +30 -0
- package/dist/components/tooltip/snice-tooltip.d.ts +50 -0
- package/dist/components/tooltip/snice-tooltip.js +644 -0
- package/dist/components/tooltip/snice-tooltip.js.map +1 -0
- package/dist/components/tooltip/snice-tooltip.types.d.ts +18 -0
- package/dist/components/transitions.d.ts +11 -0
- package/dist/components/transitions.js +72 -0
- package/dist/components/transitions.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.iife.js +1 -1
- package/dist/index.iife.min.js +1 -1
- package/dist/symbols.esm.js +1 -1
- package/dist/transitions.esm.js +1 -1
- package/package.json +10 -6
- package/components/accordion/demo.html +0 -403
- package/components/accordion/snice-accordion-item.css +0 -85
- package/components/accordion/snice-accordion-item.ts +0 -226
- package/components/accordion/snice-accordion.css +0 -31
- package/components/accordion/snice-accordion.ts +0 -182
- package/components/accordion/snice-accordion.types.ts +0 -32
- package/components/alert/demo.html +0 -445
- package/components/alert/snice-alert.css +0 -195
- package/components/alert/snice-alert.ts +0 -141
- package/components/avatar/demo.html +0 -598
- package/components/avatar/snice-avatar.css +0 -131
- package/components/avatar/snice-avatar.ts +0 -136
- package/components/avatar/snice-avatar.types.ts +0 -13
- package/components/badge/demo.html +0 -523
- package/components/badge/snice-badge.css +0 -161
- package/components/badge/snice-badge.ts +0 -117
- package/components/breadcrumbs/demo.html +0 -404
- package/components/breadcrumbs/snice-breadcrumbs.css +0 -133
- package/components/breadcrumbs/snice-breadcrumbs.ts +0 -191
- package/components/breadcrumbs/snice-breadcrumbs.types.ts +0 -26
- package/components/breadcrumbs/snice-crumb.ts +0 -26
- package/components/button/demo.html +0 -42
- package/components/button/snice-button.css +0 -230
- package/components/button/snice-button.ts +0 -169
- package/components/button/snice-button.types.ts +0 -25
- package/components/card/demo.html +0 -525
- package/components/card/snice-card.css +0 -140
- package/components/card/snice-card.ts +0 -102
- package/components/checkbox/demo.html +0 -253
- package/components/checkbox/snice-checkbox.css +0 -164
- package/components/checkbox/snice-checkbox.ts +0 -223
- package/components/checkbox/snice-checkbox.types.ts +0 -22
- package/components/chip/demo.html +0 -383
- package/components/chip/snice-chip.css +0 -195
- package/components/chip/snice-chip.ts +0 -139
- package/components/chip/snice-chip.types.ts +0 -15
- package/components/date-picker/README.md +0 -233
- package/components/date-picker/demo.html +0 -191
- package/components/date-picker/snice-date-picker.css +0 -330
- package/components/date-picker/snice-date-picker.ts +0 -777
- package/components/date-picker/snice-date-picker.types.ts +0 -83
- package/components/divider/demo.html +0 -233
- package/components/divider/snice-divider.css +0 -155
- package/components/divider/snice-divider.ts +0 -69
- package/components/drawer/demo.html +0 -328
- package/components/drawer/snice-drawer.css +0 -476
- package/components/drawer/snice-drawer.ts +0 -287
- package/components/drawer/snice-drawer.types.ts +0 -17
- package/components/global.d.ts +0 -14
- package/components/input/demo.html +0 -303
- package/components/input/snice-input.css +0 -257
- package/components/input/snice-input.ts +0 -442
- package/components/input/snice-input.types.ts +0 -59
- package/components/input/test.html +0 -77
- package/components/layout/README.md +0 -260
- package/components/layout/demo.html +0 -538
- package/components/layout/snice-layout-blog.css +0 -129
- package/components/layout/snice-layout-blog.ts +0 -48
- package/components/layout/snice-layout-card.css +0 -104
- package/components/layout/snice-layout-card.ts +0 -35
- package/components/layout/snice-layout-centered.css +0 -51
- package/components/layout/snice-layout-centered.ts +0 -22
- package/components/layout/snice-layout-dashboard.css +0 -98
- package/components/layout/snice-layout-dashboard.ts +0 -45
- package/components/layout/snice-layout-fullscreen.css +0 -72
- package/components/layout/snice-layout-fullscreen.ts +0 -34
- package/components/layout/snice-layout-landing.css +0 -92
- package/components/layout/snice-layout-landing.ts +0 -47
- package/components/layout/snice-layout-minimal.css +0 -16
- package/components/layout/snice-layout-minimal.ts +0 -19
- package/components/layout/snice-layout-sidebar.css +0 -117
- package/components/layout/snice-layout-sidebar.ts +0 -48
- package/components/layout/snice-layout-split.css +0 -103
- package/components/layout/snice-layout-split.ts +0 -29
- package/components/layout/snice-layout.css +0 -72
- package/components/layout/snice-layout.ts +0 -35
- package/components/login/demo-auth-controller.ts +0 -185
- package/components/login/demo.html +0 -470
- package/components/login/snice-login.css +0 -204
- package/components/login/snice-login.ts +0 -326
- package/components/login/snice-login.types.ts +0 -29
- package/components/modal/demo.html +0 -291
- package/components/modal/snice-modal.css +0 -203
- package/components/modal/snice-modal.ts +0 -233
- package/components/modal/snice-modal.types.ts +0 -21
- package/components/pagination/demo.html +0 -395
- package/components/pagination/snice-pagination.ts +0 -333
- package/components/pagination/snice-pagination.types.ts +0 -21
- package/components/progress/demo.html +0 -510
- package/components/progress/snice-progress.css +0 -267
- package/components/progress/snice-progress.ts +0 -247
- package/components/progress/snice-progress.types.ts +0 -19
- package/components/radio/demo.html +0 -287
- package/components/radio/snice-radio.css +0 -171
- package/components/radio/snice-radio.ts +0 -218
- package/components/radio/snice-radio.types.ts +0 -21
- package/components/select/demo.html +0 -511
- package/components/select/snice-option.ts +0 -52
- package/components/select/snice-select.css +0 -392
- package/components/select/snice-select.ts +0 -796
- package/components/select/snice-select.types.ts +0 -55
- package/components/skeleton/demo.html +0 -514
- package/components/skeleton/snice-skeleton.css +0 -109
- package/components/skeleton/snice-skeleton.ts +0 -126
- package/components/switch/demo.html +0 -284
- package/components/switch/snice-switch.css +0 -221
- package/components/switch/snice-switch.ts +0 -229
- package/components/switch/snice-switch.types.ts +0 -23
- package/components/symbols.ts +0 -23
- package/components/table/demo-table-controller.ts +0 -100
- package/components/table/demo.html +0 -480
- package/components/table/snice-cell-boolean.ts +0 -112
- package/components/table/snice-cell-date.ts +0 -210
- package/components/table/snice-cell-duration.ts +0 -91
- package/components/table/snice-cell-filesize.ts +0 -90
- package/components/table/snice-cell-number.ts +0 -165
- package/components/table/snice-cell-progress.ts +0 -83
- package/components/table/snice-cell-rating.ts +0 -82
- package/components/table/snice-cell-sparkline.ts +0 -253
- package/components/table/snice-cell-text.ts +0 -125
- package/components/table/snice-cell.css +0 -296
- package/components/table/snice-cell.ts +0 -473
- package/components/table/snice-column.ts +0 -353
- package/components/table/snice-header.css +0 -243
- package/components/table/snice-header.ts +0 -261
- package/components/table/snice-progress.ts +0 -66
- package/components/table/snice-rating.ts +0 -45
- package/components/table/snice-row.css +0 -255
- package/components/table/snice-row.ts +0 -331
- package/components/table/snice-table.css +0 -241
- package/components/table/snice-table.ts +0 -737
- package/components/table/snice-table.types.ts +0 -158
- package/components/tabs/demo.html +0 -487
- package/components/tabs/snice-tab-panel.css +0 -264
- package/components/tabs/snice-tab-panel.ts +0 -47
- package/components/tabs/snice-tab.css +0 -96
- package/components/tabs/snice-tab.ts +0 -65
- package/components/tabs/snice-tabs.css +0 -189
- package/components/tabs/snice-tabs.ts +0 -332
- package/components/tabs/snice-tabs.types.ts +0 -28
- package/components/theme/theme.css +0 -234
- package/components/toast/demo.html +0 -329
- package/components/toast/snice-toast-container.ts +0 -256
- package/components/toast/snice-toast.css +0 -213
- package/components/toast/snice-toast.ts +0 -276
- package/components/toast/snice-toast.types.ts +0 -35
- package/components/tooltip/demo.html +0 -350
- package/components/tooltip/snice-tooltip-portal.css +0 -79
- package/components/tooltip/snice-tooltip.css +0 -117
- package/components/tooltip/snice-tooltip.ts +0 -612
- package/components/tooltip/snice-tooltip.types.ts +0 -32
- package/components/transitions.ts +0 -94
- package/components/tsconfig.json +0 -18
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
:host {
|
|
2
|
-
--modal-z-index: 1000;
|
|
3
|
-
--modal-backdrop-bg: rgba(0, 0, 0, 0.5);
|
|
4
|
-
--modal-panel-bg: var(--snice-color-background, white);
|
|
5
|
-
--modal-panel-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
|
|
6
|
-
--modal-border-radius: var(--snice-border-radius-lg, 8px);
|
|
7
|
-
--modal-padding: var(--snice-spacing-lg, 1.5rem);
|
|
8
|
-
--modal-transition-duration: 200ms;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.modal {
|
|
12
|
-
position: fixed;
|
|
13
|
-
top: 0;
|
|
14
|
-
left: 0;
|
|
15
|
-
right: 0;
|
|
16
|
-
bottom: 0;
|
|
17
|
-
z-index: var(--modal-z-index);
|
|
18
|
-
display: flex;
|
|
19
|
-
align-items: center;
|
|
20
|
-
justify-content: center;
|
|
21
|
-
padding: var(--modal-padding);
|
|
22
|
-
pointer-events: none;
|
|
23
|
-
opacity: 0;
|
|
24
|
-
visibility: hidden;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.modal--open {
|
|
28
|
-
pointer-events: auto;
|
|
29
|
-
opacity: 1;
|
|
30
|
-
visibility: visible;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.modal__backdrop {
|
|
34
|
-
position: absolute;
|
|
35
|
-
top: 0;
|
|
36
|
-
left: 0;
|
|
37
|
-
right: 0;
|
|
38
|
-
bottom: 0;
|
|
39
|
-
background: var(--modal-backdrop-bg);
|
|
40
|
-
opacity: 0;
|
|
41
|
-
transition: opacity var(--modal-transition-duration) ease;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.modal--open .modal__backdrop {
|
|
45
|
-
opacity: 1;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.modal__panel {
|
|
49
|
-
position: relative;
|
|
50
|
-
background: var(--modal-panel-bg);
|
|
51
|
-
border-radius: var(--modal-border-radius);
|
|
52
|
-
box-shadow: var(--modal-panel-shadow);
|
|
53
|
-
display: flex;
|
|
54
|
-
flex-direction: column;
|
|
55
|
-
max-height: calc(100vh - 2 * var(--modal-padding));
|
|
56
|
-
opacity: 0;
|
|
57
|
-
transform: scale(0.95) translateY(1.25rem); /* 20px */
|
|
58
|
-
transition:
|
|
59
|
-
opacity var(--modal-transition-duration) ease,
|
|
60
|
-
transform var(--modal-transition-duration) ease;
|
|
61
|
-
z-index: 1;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.modal--open .modal__panel {
|
|
65
|
-
opacity: 1;
|
|
66
|
-
transform: scale(1) translateY(0);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/* Sizes */
|
|
70
|
-
.modal__panel--small {
|
|
71
|
-
width: 100%;
|
|
72
|
-
max-width: 25rem; /* 400px */
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.modal__panel--medium {
|
|
76
|
-
width: 100%;
|
|
77
|
-
max-width: 37.5rem; /* 600px */
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.modal__panel--large {
|
|
81
|
-
width: 100%;
|
|
82
|
-
max-width: 56.25rem; /* 900px */
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.modal__panel--fullscreen {
|
|
86
|
-
width: calc(100vw - 2 * var(--modal-padding));
|
|
87
|
-
height: calc(100vh - 2 * var(--modal-padding));
|
|
88
|
-
max-width: none;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.modal__header {
|
|
92
|
-
display: flex;
|
|
93
|
-
align-items: center;
|
|
94
|
-
justify-content: space-between;
|
|
95
|
-
padding: var(--modal-padding);
|
|
96
|
-
border-bottom: 1px solid var(--snice-color-border, #e5e7eb);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.modal__header:empty {
|
|
100
|
-
display: none;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
::slotted([slot="header"]) {
|
|
104
|
-
flex: 1;
|
|
105
|
-
margin: 0;
|
|
106
|
-
font-size: var(--snice-font-size-lg, 1.125rem);
|
|
107
|
-
font-weight: 600;
|
|
108
|
-
color: var(--snice-color-text, #111827);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.modal__close {
|
|
112
|
-
display: flex;
|
|
113
|
-
align-items: center;
|
|
114
|
-
justify-content: center;
|
|
115
|
-
width: 2rem; /* 32px */
|
|
116
|
-
height: 2rem; /* 32px */
|
|
117
|
-
padding: 0;
|
|
118
|
-
margin-left: auto;
|
|
119
|
-
background: transparent;
|
|
120
|
-
border: none;
|
|
121
|
-
border-radius: var(--snice-border-radius-md, 6px);
|
|
122
|
-
color: var(--snice-color-text-secondary, #6b7280);
|
|
123
|
-
cursor: pointer;
|
|
124
|
-
transition:
|
|
125
|
-
background-color var(--snice-transition-fast) ease,
|
|
126
|
-
color var(--snice-transition-fast) ease;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
.modal__close:hover {
|
|
130
|
-
background: var(--snice-color-background-hover, #f3f4f6);
|
|
131
|
-
color: var(--snice-color-text, #111827);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
.modal__close:focus-visible {
|
|
135
|
-
outline: 2px solid var(--snice-color-primary, #3b82f6);
|
|
136
|
-
outline-offset: 2px;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
.modal__body {
|
|
140
|
-
flex: 1;
|
|
141
|
-
padding: var(--modal-padding);
|
|
142
|
-
overflow-y: auto;
|
|
143
|
-
color: var(--snice-color-text, #111827);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
.modal__footer {
|
|
147
|
-
display: flex;
|
|
148
|
-
align-items: center;
|
|
149
|
-
justify-content: flex-end;
|
|
150
|
-
gap: var(--snice-spacing-sm, 0.5rem);
|
|
151
|
-
padding: var(--modal-padding);
|
|
152
|
-
border-top: 1px solid var(--snice-color-border, #e5e7eb);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
.modal__footer:empty {
|
|
156
|
-
display: none;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/* Remove borders when header/footer are empty */
|
|
160
|
-
.modal__header:empty + .modal__body {
|
|
161
|
-
padding-top: var(--modal-padding);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
.modal__body:has(+ .modal__footer:empty) {
|
|
165
|
-
padding-bottom: var(--modal-padding);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/* Animation for entrance from bottom (alternative) */
|
|
169
|
-
@keyframes slideUp {
|
|
170
|
-
from {
|
|
171
|
-
opacity: 0;
|
|
172
|
-
transform: translateY(6.25rem); /* 100px */
|
|
173
|
-
}
|
|
174
|
-
to {
|
|
175
|
-
opacity: 1;
|
|
176
|
-
transform: translateY(0);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
/* Animation for exit */
|
|
181
|
-
@keyframes fadeOut {
|
|
182
|
-
from {
|
|
183
|
-
opacity: 1;
|
|
184
|
-
}
|
|
185
|
-
to {
|
|
186
|
-
opacity: 0;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
/* Mobile responsiveness */
|
|
191
|
-
@media (max-width: 640px) {
|
|
192
|
-
.modal {
|
|
193
|
-
padding: 0;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
.modal__panel:not(.modal__panel--fullscreen) {
|
|
197
|
-
width: 100%;
|
|
198
|
-
height: 100%;
|
|
199
|
-
max-width: none;
|
|
200
|
-
max-height: none;
|
|
201
|
-
border-radius: 0;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
import { element, property, query, on, watch, ready, dispatch } from 'snice';
|
|
2
|
-
import css from './snice-modal.css?inline';
|
|
3
|
-
import type { ModalSize, SniceModalElement } from './snice-modal.types';
|
|
4
|
-
|
|
5
|
-
@element('snice-modal')
|
|
6
|
-
export class SniceModal extends HTMLElement implements SniceModalElement {
|
|
7
|
-
@property({ type: Boolean, reflect: true })
|
|
8
|
-
open = false;
|
|
9
|
-
|
|
10
|
-
@property({ reflect: true })
|
|
11
|
-
size: ModalSize = 'medium';
|
|
12
|
-
|
|
13
|
-
private previousSize = 'medium';
|
|
14
|
-
|
|
15
|
-
@property({ type: Boolean, attribute: 'no-backdrop-dismiss', reflect: true })
|
|
16
|
-
noBackdropDismiss = false;
|
|
17
|
-
|
|
18
|
-
@property({ type: Boolean, attribute: 'no-escape-dismiss', reflect: true })
|
|
19
|
-
noEscapeDismiss = false;
|
|
20
|
-
|
|
21
|
-
@property({ type: Boolean, attribute: 'no-focus-trap', reflect: true })
|
|
22
|
-
noFocusTrap = false;
|
|
23
|
-
|
|
24
|
-
@property({ type: Boolean, attribute: 'no-close-button', reflect: true })
|
|
25
|
-
noCloseButton = false;
|
|
26
|
-
|
|
27
|
-
@property({ reflect: true })
|
|
28
|
-
label = '';
|
|
29
|
-
|
|
30
|
-
@query('.modal')
|
|
31
|
-
modal?: HTMLElement;
|
|
32
|
-
|
|
33
|
-
@query('.modal__panel')
|
|
34
|
-
panel?: HTMLElement;
|
|
35
|
-
|
|
36
|
-
@query('.modal__backdrop')
|
|
37
|
-
backdrop?: HTMLElement;
|
|
38
|
-
|
|
39
|
-
private previousFocus: HTMLElement | null = null;
|
|
40
|
-
|
|
41
|
-
html() {
|
|
42
|
-
// Renders once - initial state
|
|
43
|
-
return /*html*/`
|
|
44
|
-
<div class="modal"
|
|
45
|
-
role="dialog"
|
|
46
|
-
aria-modal="true"
|
|
47
|
-
aria-label="${this.label}"
|
|
48
|
-
aria-hidden="true">
|
|
49
|
-
<div class="modal__backdrop" part="backdrop"></div>
|
|
50
|
-
<div class="modal__panel modal__panel--${this.size}" part="panel">
|
|
51
|
-
<div class="modal__header" part="header">
|
|
52
|
-
<slot name="header"></slot>
|
|
53
|
-
<button class="modal__close" part="close" aria-label="Close modal">
|
|
54
|
-
<svg viewBox="0 0 24 24" width="20" height="20">
|
|
55
|
-
<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" fill="currentColor"/>
|
|
56
|
-
</svg>
|
|
57
|
-
</button>
|
|
58
|
-
</div>
|
|
59
|
-
<div class="modal__body" part="body">
|
|
60
|
-
<slot></slot>
|
|
61
|
-
</div>
|
|
62
|
-
<div class="modal__footer" part="footer">
|
|
63
|
-
<slot name="footer"></slot>
|
|
64
|
-
</div>
|
|
65
|
-
</div>
|
|
66
|
-
</div>
|
|
67
|
-
`;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
css() {
|
|
71
|
-
return css;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
@ready()
|
|
75
|
-
init() {
|
|
76
|
-
// Make sure modal state is properly initialized
|
|
77
|
-
if (this.open) {
|
|
78
|
-
this.showModal();
|
|
79
|
-
}
|
|
80
|
-
// Apply initial close button state
|
|
81
|
-
if (this.noCloseButton) {
|
|
82
|
-
const closeButton = this.shadowRoot?.querySelector('.modal__close') as HTMLElement;
|
|
83
|
-
if (closeButton) {
|
|
84
|
-
closeButton.style.display = 'none';
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
@watch('open')
|
|
90
|
-
handleOpenChange() {
|
|
91
|
-
// Imperatively update the modal DOM
|
|
92
|
-
if (this.modal) {
|
|
93
|
-
if (this.open) {
|
|
94
|
-
this.modal.classList.add('modal--open');
|
|
95
|
-
this.modal.setAttribute('aria-hidden', 'false');
|
|
96
|
-
this.showModal();
|
|
97
|
-
} else {
|
|
98
|
-
this.modal.classList.remove('modal--open');
|
|
99
|
-
this.modal.setAttribute('aria-hidden', 'true');
|
|
100
|
-
this.hideModal();
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
@watch('size')
|
|
106
|
-
handleSizeChange() {
|
|
107
|
-
// Imperatively update the panel size class
|
|
108
|
-
if (this.panel) {
|
|
109
|
-
this.panel.classList.remove(`modal__panel--${this.previousSize}`);
|
|
110
|
-
this.panel.classList.add(`modal__panel--${this.size}`);
|
|
111
|
-
this.previousSize = this.size;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
@watch('noCloseButton')
|
|
116
|
-
handleCloseButtonChange() {
|
|
117
|
-
// Imperatively show/hide the close button
|
|
118
|
-
const closeButton = this.shadowRoot?.querySelector('.modal__close') as HTMLElement;
|
|
119
|
-
if (closeButton) {
|
|
120
|
-
closeButton.style.display = this.noCloseButton ? 'none' : '';
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
@on('click', '.modal__backdrop')
|
|
125
|
-
handleBackdropClick() {
|
|
126
|
-
if (!this.noBackdropDismiss) {
|
|
127
|
-
this.close();
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
@on('click', '.modal__close')
|
|
132
|
-
handleCloseClick() {
|
|
133
|
-
this.close();
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
@on('keydown:Escape', { stopPropagation: true })
|
|
137
|
-
handleEscape() {
|
|
138
|
-
if (!this.open) return;
|
|
139
|
-
if (!this.noEscapeDismiss) {
|
|
140
|
-
this.close();
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
@on('keydown:Tab')
|
|
145
|
-
handleTab(e: KeyboardEvent) {
|
|
146
|
-
if (!this.open) return;
|
|
147
|
-
if (!this.noFocusTrap) {
|
|
148
|
-
this.trapFocus(e);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
private showModal() {
|
|
154
|
-
// Store current focus
|
|
155
|
-
this.previousFocus = document.activeElement as HTMLElement;
|
|
156
|
-
|
|
157
|
-
// Lock body scroll
|
|
158
|
-
document.body.style.overflow = 'hidden';
|
|
159
|
-
|
|
160
|
-
// Focus first focusable element or modal itself
|
|
161
|
-
requestAnimationFrame(() => {
|
|
162
|
-
const firstFocusable = this.panel?.querySelector<HTMLElement>(
|
|
163
|
-
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
164
|
-
);
|
|
165
|
-
if (firstFocusable) {
|
|
166
|
-
firstFocusable.focus();
|
|
167
|
-
} else {
|
|
168
|
-
this.panel?.focus();
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
this.dispatchOpenEvent();
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
private hideModal() {
|
|
176
|
-
// Restore body scroll
|
|
177
|
-
document.body.style.overflow = '';
|
|
178
|
-
|
|
179
|
-
// Restore previous focus
|
|
180
|
-
if (this.previousFocus) {
|
|
181
|
-
this.previousFocus.focus();
|
|
182
|
-
this.previousFocus = null;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
this.dispatchCloseEvent();
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
private trapFocus(e: KeyboardEvent) {
|
|
189
|
-
if (!this.panel) return;
|
|
190
|
-
|
|
191
|
-
const focusableElements = this.panel.querySelectorAll<HTMLElement>(
|
|
192
|
-
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
193
|
-
);
|
|
194
|
-
|
|
195
|
-
const focusable = Array.from(focusableElements);
|
|
196
|
-
const firstFocusable = focusable[0];
|
|
197
|
-
const lastFocusable = focusable[focusable.length - 1];
|
|
198
|
-
|
|
199
|
-
if (e.shiftKey) {
|
|
200
|
-
// Shift + Tab
|
|
201
|
-
if (document.activeElement === firstFocusable) {
|
|
202
|
-
lastFocusable?.focus();
|
|
203
|
-
e.preventDefault();
|
|
204
|
-
}
|
|
205
|
-
} else {
|
|
206
|
-
// Tab
|
|
207
|
-
if (document.activeElement === lastFocusable) {
|
|
208
|
-
firstFocusable?.focus();
|
|
209
|
-
e.preventDefault();
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
@dispatch('@snice/modal-open', { bubbles: true, composed: true })
|
|
215
|
-
private dispatchOpenEvent() {
|
|
216
|
-
return { modal: this };
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
@dispatch('@snice/modal-close', { bubbles: true, composed: true })
|
|
220
|
-
private dispatchCloseEvent() {
|
|
221
|
-
return { modal: this };
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
// Public API
|
|
225
|
-
show() {
|
|
226
|
-
this.open = true;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
close() {
|
|
230
|
-
this.open = false;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export type ModalSize = 'small' | 'medium' | 'large' | 'fullscreen';
|
|
2
|
-
|
|
3
|
-
export interface SniceModalElement extends HTMLElement {
|
|
4
|
-
open: boolean;
|
|
5
|
-
size: ModalSize;
|
|
6
|
-
noBackdropDismiss: boolean;
|
|
7
|
-
noEscapeDismiss: boolean;
|
|
8
|
-
noFocusTrap: boolean;
|
|
9
|
-
noCloseButton: boolean;
|
|
10
|
-
label: string;
|
|
11
|
-
show(): void;
|
|
12
|
-
close(): void;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface ModalOpenDetail {
|
|
16
|
-
modal: SniceModalElement;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface ModalCloseDetail {
|
|
20
|
-
modal: SniceModalElement;
|
|
21
|
-
}
|