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,326 +0,0 @@
|
|
|
1
|
-
import { element, property, query, queryAll, on, dispatch, request } from 'snice';
|
|
2
|
-
import css from './snice-login.css?inline';
|
|
3
|
-
import type { LoginVariant, LoginSize, LoginCredentials, LoginResult, SniceLoginElement } from './snice-login.types';
|
|
4
|
-
import '../alert/snice-alert';
|
|
5
|
-
import '../button/snice-button';
|
|
6
|
-
|
|
7
|
-
@element('snice-login')
|
|
8
|
-
export class SniceLogin extends HTMLElement implements SniceLoginElement {
|
|
9
|
-
@property({ reflect: true })
|
|
10
|
-
variant: LoginVariant = 'default';
|
|
11
|
-
|
|
12
|
-
@property({ reflect: true })
|
|
13
|
-
size: LoginSize = 'medium';
|
|
14
|
-
|
|
15
|
-
@property({ reflect: true })
|
|
16
|
-
title = 'Sign In';
|
|
17
|
-
|
|
18
|
-
@property({ type: Boolean, reflect: true })
|
|
19
|
-
disabled = false;
|
|
20
|
-
|
|
21
|
-
@property({ type: Boolean, reflect: true })
|
|
22
|
-
loading = false;
|
|
23
|
-
|
|
24
|
-
@property({ type: Boolean, reflect: true, attribute: 'show-remember-me' })
|
|
25
|
-
showRememberMe = true;
|
|
26
|
-
|
|
27
|
-
@property({ type: Boolean, reflect: true, attribute: 'show-forgot-password' })
|
|
28
|
-
showForgotPassword = true;
|
|
29
|
-
|
|
30
|
-
@property({ reflect: true, attribute: 'action-text' })
|
|
31
|
-
actionText = 'Sign In';
|
|
32
|
-
|
|
33
|
-
@query('.login__form')
|
|
34
|
-
form!: HTMLFormElement;
|
|
35
|
-
|
|
36
|
-
@query('input[name="username"]')
|
|
37
|
-
usernameInput!: HTMLInputElement;
|
|
38
|
-
|
|
39
|
-
@query('input[name="password"]')
|
|
40
|
-
passwordInput!: HTMLInputElement;
|
|
41
|
-
|
|
42
|
-
@query('input[name="remember"]')
|
|
43
|
-
rememberInput?: HTMLInputElement;
|
|
44
|
-
|
|
45
|
-
@query('snice-alert')
|
|
46
|
-
alertElement!: HTMLElement;
|
|
47
|
-
|
|
48
|
-
@query('snice-button')
|
|
49
|
-
buttonElement!: HTMLElement;
|
|
50
|
-
|
|
51
|
-
@queryAll('input')
|
|
52
|
-
inputElements!: NodeListOf<HTMLInputElement>;
|
|
53
|
-
|
|
54
|
-
private alertMessage = '';
|
|
55
|
-
private alertVariant: 'error' | 'success' | '' = '';
|
|
56
|
-
|
|
57
|
-
html() {
|
|
58
|
-
return /*html*/`
|
|
59
|
-
<div class="login login--${this.variant} login--${this.size}">
|
|
60
|
-
<slot name="before-header"></slot>
|
|
61
|
-
|
|
62
|
-
<div class="login__header">
|
|
63
|
-
<h1 class="login__title">${this.title}</h1>
|
|
64
|
-
<slot name="subtitle">
|
|
65
|
-
<p class="login__subtitle">Enter your credentials to continue</p>
|
|
66
|
-
</slot>
|
|
67
|
-
</div>
|
|
68
|
-
|
|
69
|
-
<slot name="after-header"></slot>
|
|
70
|
-
<slot name="before-form"></slot>
|
|
71
|
-
|
|
72
|
-
<form class="login__form">
|
|
73
|
-
<slot name="form-top"></slot>
|
|
74
|
-
|
|
75
|
-
<div class="login__field">
|
|
76
|
-
<label class="login__label" for="username">Username</label>
|
|
77
|
-
<input
|
|
78
|
-
class="login__input"
|
|
79
|
-
type="text"
|
|
80
|
-
name="username"
|
|
81
|
-
id="username"
|
|
82
|
-
required
|
|
83
|
-
autocomplete="username"
|
|
84
|
-
placeholder="Enter your username"
|
|
85
|
-
${this.disabled || this.loading ? 'disabled' : ''}
|
|
86
|
-
/>
|
|
87
|
-
</div>
|
|
88
|
-
|
|
89
|
-
<slot name="between-fields"></slot>
|
|
90
|
-
|
|
91
|
-
<div class="login__field">
|
|
92
|
-
<label class="login__label" for="password">Password</label>
|
|
93
|
-
<input
|
|
94
|
-
class="login__input"
|
|
95
|
-
type="password"
|
|
96
|
-
name="password"
|
|
97
|
-
id="password"
|
|
98
|
-
required
|
|
99
|
-
autocomplete="current-password"
|
|
100
|
-
placeholder="Enter your password"
|
|
101
|
-
${this.disabled || this.loading ? 'disabled' : ''}
|
|
102
|
-
/>
|
|
103
|
-
</div>
|
|
104
|
-
|
|
105
|
-
<div class="login__options" ${!this.showRememberMe && !this.showForgotPassword ? 'hidden' : ''}>
|
|
106
|
-
<label class="login__remember" ${!this.showRememberMe ? 'hidden' : ''}>
|
|
107
|
-
<input class="login__checkbox" type="checkbox" name="remember" ${this.disabled || this.loading ? 'disabled' : ''} />
|
|
108
|
-
Remember me
|
|
109
|
-
</label>
|
|
110
|
-
|
|
111
|
-
<a href="#" class="login__forgot" ${!this.showForgotPassword ? 'hidden' : ''}>Forgot password?</a>
|
|
112
|
-
</div>
|
|
113
|
-
|
|
114
|
-
<slot name="before-submit"></slot>
|
|
115
|
-
|
|
116
|
-
<snice-button type="submit" variant="primary" ${this.disabled ? 'disabled' : ''} ${this.loading ? 'loading' : ''}>
|
|
117
|
-
${this.actionText}
|
|
118
|
-
</snice-button>
|
|
119
|
-
|
|
120
|
-
<slot name="after-submit"></slot>
|
|
121
|
-
</form>
|
|
122
|
-
|
|
123
|
-
<slot name="after-form"></slot>
|
|
124
|
-
|
|
125
|
-
<snice-alert variant="${this.alertVariant}" ${!this.alertMessage ? 'hidden' : ''}>${this.alertMessage}</snice-alert>
|
|
126
|
-
|
|
127
|
-
<div class="login__footer">
|
|
128
|
-
<slot name="footer"></slot>
|
|
129
|
-
</div>
|
|
130
|
-
</div>
|
|
131
|
-
`;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
css() {
|
|
136
|
-
return css;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
@request('login-user')
|
|
140
|
-
async *login(credentials?: LoginCredentials): any {
|
|
141
|
-
if (!credentials) {
|
|
142
|
-
credentials = this.getFormData();
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
if (!credentials.username || !credentials.password) {
|
|
146
|
-
return {
|
|
147
|
-
success: false,
|
|
148
|
-
error: 'Username and password are required'
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
try {
|
|
153
|
-
const result = await (yield credentials);
|
|
154
|
-
return result;
|
|
155
|
-
} catch (error) {
|
|
156
|
-
return {
|
|
157
|
-
success: false,
|
|
158
|
-
error: error instanceof Error ? error.message : 'Login failed'
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
@on('click', 'snice-button')
|
|
164
|
-
async handleButtonClick(event: Event) {
|
|
165
|
-
event.preventDefault();
|
|
166
|
-
// Trigger form submit
|
|
167
|
-
if (this.form) {
|
|
168
|
-
this.form.requestSubmit();
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
@on('submit', '.login__form')
|
|
173
|
-
@dispatch('@snice/login-attempt', { bubbles: true, composed: true })
|
|
174
|
-
async handleSubmit(event: Event) {
|
|
175
|
-
event.preventDefault();
|
|
176
|
-
|
|
177
|
-
if (this.loading || this.disabled) {
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
this.clearAlert();
|
|
182
|
-
this.loading = true;
|
|
183
|
-
this.updateLoadingState();
|
|
184
|
-
|
|
185
|
-
// Wait a tick to ensure the form is properly rendered
|
|
186
|
-
await new Promise(resolve => setTimeout(resolve, 0));
|
|
187
|
-
|
|
188
|
-
try {
|
|
189
|
-
const credentials = this.getFormData();
|
|
190
|
-
|
|
191
|
-
if (!credentials.username || !credentials.password) {
|
|
192
|
-
this.showAlert('Username and password are required', 'error');
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
const result = await this.login(credentials);
|
|
197
|
-
|
|
198
|
-
if (result.success) {
|
|
199
|
-
this.showAlert('Login successful!', 'success');
|
|
200
|
-
this.dispatchLoginSuccess(result);
|
|
201
|
-
} else {
|
|
202
|
-
this.showAlert(result.error || 'Login failed', 'error');
|
|
203
|
-
this.dispatchLoginError(result.error || 'Login failed');
|
|
204
|
-
}
|
|
205
|
-
} catch (error) {
|
|
206
|
-
const errorMessage = error instanceof Error ? error.message : 'Login failed';
|
|
207
|
-
this.showAlert(errorMessage, 'error');
|
|
208
|
-
this.dispatchLoginError(errorMessage);
|
|
209
|
-
} finally {
|
|
210
|
-
this.loading = false;
|
|
211
|
-
this.updateLoadingState();
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
const credentials = this.getFormData();
|
|
215
|
-
return {
|
|
216
|
-
username: credentials.username,
|
|
217
|
-
timestamp: new Date().toISOString()
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
@on('keydown:Enter', '.login__input')
|
|
222
|
-
handleEnterKey() {
|
|
223
|
-
if (!this.loading && !this.disabled && this.form) {
|
|
224
|
-
this.form.requestSubmit();
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
@on('click', '.login__forgot')
|
|
229
|
-
@dispatch('@snice/login-forgot-password', { bubbles: true, composed: true })
|
|
230
|
-
handleForgotPassword(event: Event) {
|
|
231
|
-
event.preventDefault();
|
|
232
|
-
return {
|
|
233
|
-
timestamp: new Date().toISOString()
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
@dispatch('@snice/login-success', { bubbles: true, composed: true })
|
|
238
|
-
private dispatchLoginSuccess(result: LoginResult) {
|
|
239
|
-
return { timestamp: new Date().toISOString() };
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
@dispatch('@snice/login-error', { bubbles: true, composed: true })
|
|
243
|
-
private dispatchLoginError(error: string) {
|
|
244
|
-
return {
|
|
245
|
-
error,
|
|
246
|
-
timestamp: new Date().toISOString()
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
private getFormData(): LoginCredentials {
|
|
252
|
-
const usernameInput = this.shadowRoot?.querySelector('#username') as HTMLInputElement;
|
|
253
|
-
const passwordInput = this.shadowRoot?.querySelector('#password') as HTMLInputElement;
|
|
254
|
-
const rememberInput = this.shadowRoot?.querySelector('input[name="remember"]') as HTMLInputElement;
|
|
255
|
-
|
|
256
|
-
return {
|
|
257
|
-
username: usernameInput?.value || '',
|
|
258
|
-
password: passwordInput?.value || '',
|
|
259
|
-
remember: rememberInput?.checked || false
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
showAlert(message: string, variant: 'error' | 'success') {
|
|
264
|
-
this.alertMessage = message;
|
|
265
|
-
this.alertVariant = variant;
|
|
266
|
-
this.updateAlert();
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
clearAlert() {
|
|
270
|
-
this.alertMessage = '';
|
|
271
|
-
this.alertVariant = '';
|
|
272
|
-
this.updateAlert();
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
private updateAlert() {
|
|
276
|
-
if (this.alertElement) {
|
|
277
|
-
this.alertElement.setAttribute('variant', this.alertVariant);
|
|
278
|
-
this.alertElement.textContent = this.alertMessage;
|
|
279
|
-
if (this.alertMessage) {
|
|
280
|
-
this.alertElement.removeAttribute('hidden');
|
|
281
|
-
} else {
|
|
282
|
-
this.alertElement.setAttribute('hidden', '');
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
private updateLoadingState() {
|
|
288
|
-
if (this.buttonElement) {
|
|
289
|
-
if (this.loading) {
|
|
290
|
-
this.buttonElement.setAttribute('loading', '');
|
|
291
|
-
} else {
|
|
292
|
-
this.buttonElement.removeAttribute('loading');
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
if (this.disabled) {
|
|
296
|
-
this.buttonElement.setAttribute('disabled', '');
|
|
297
|
-
} else {
|
|
298
|
-
this.buttonElement.removeAttribute('disabled');
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
this.inputElements?.forEach(input => {
|
|
303
|
-
if (this.disabled || this.loading) {
|
|
304
|
-
input.setAttribute('disabled', '');
|
|
305
|
-
} else {
|
|
306
|
-
input.removeAttribute('disabled');
|
|
307
|
-
}
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
setError(message: string) {
|
|
312
|
-
this.showAlert(message, 'error');
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
clearError() {
|
|
316
|
-
this.clearAlert();
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
reset() {
|
|
320
|
-
if (this.form) {
|
|
321
|
-
this.form.reset();
|
|
322
|
-
}
|
|
323
|
-
this.clearAlert();
|
|
324
|
-
this.loading = false;
|
|
325
|
-
}
|
|
326
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export type LoginVariant = 'default' | 'card' | 'minimal';
|
|
2
|
-
export type LoginSize = 'small' | 'medium' | 'large';
|
|
3
|
-
|
|
4
|
-
export interface LoginCredentials {
|
|
5
|
-
username: string;
|
|
6
|
-
password: string;
|
|
7
|
-
remember?: boolean;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface LoginResult {
|
|
11
|
-
success: boolean;
|
|
12
|
-
error?: string;
|
|
13
|
-
data?: any;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface SniceLoginElement extends HTMLElement {
|
|
17
|
-
variant: LoginVariant;
|
|
18
|
-
size: LoginSize;
|
|
19
|
-
title: string;
|
|
20
|
-
disabled: boolean;
|
|
21
|
-
loading: boolean;
|
|
22
|
-
showRememberMe: boolean;
|
|
23
|
-
showForgotPassword: boolean;
|
|
24
|
-
actionText: string;
|
|
25
|
-
login(credentials: LoginCredentials): Promise<LoginResult>;
|
|
26
|
-
reset(): void;
|
|
27
|
-
setError(message: string): void;
|
|
28
|
-
clearError(): void;
|
|
29
|
-
}
|
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<title>Modal Demo</title>
|
|
7
|
-
<link rel="stylesheet" href="../theme/theme.css">
|
|
8
|
-
<style>
|
|
9
|
-
body {
|
|
10
|
-
padding: 40px;
|
|
11
|
-
font-family: var(--snice-font-family);
|
|
12
|
-
background: var(--snice-color-background);
|
|
13
|
-
color: var(--snice-color-text);
|
|
14
|
-
min-height: 200vh; /* To test scroll locking */
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.section {
|
|
18
|
-
margin-bottom: 40px;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
h2 {
|
|
22
|
-
color: var(--snice-color-text);
|
|
23
|
-
margin-bottom: 20px;
|
|
24
|
-
font-size: var(--snice-font-size-2xl);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
h3 {
|
|
28
|
-
color: var(--snice-color-text-secondary);
|
|
29
|
-
margin-bottom: 16px;
|
|
30
|
-
font-size: var(--snice-font-size-lg);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.button-group {
|
|
34
|
-
display: flex;
|
|
35
|
-
gap: 10px;
|
|
36
|
-
flex-wrap: wrap;
|
|
37
|
-
margin-bottom: 20px;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
button {
|
|
41
|
-
padding: 8px 16px;
|
|
42
|
-
background: var(--snice-color-primary);
|
|
43
|
-
color: var(--snice-color-text-inverse);
|
|
44
|
-
border: none;
|
|
45
|
-
border-radius: var(--snice-border-radius-md);
|
|
46
|
-
font-family: var(--snice-font-family);
|
|
47
|
-
font-size: var(--snice-font-size-md);
|
|
48
|
-
cursor: pointer;
|
|
49
|
-
transition: background-color var(--snice-transition-fast) ease;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
button:hover {
|
|
53
|
-
background: var(--snice-color-primary-hover);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
button.secondary {
|
|
57
|
-
background: var(--snice-color-secondary);
|
|
58
|
-
color: var(--snice-color-text);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
button.secondary:hover {
|
|
62
|
-
background: var(--snice-color-secondary-hover);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.long-content {
|
|
66
|
-
height: 1000px;
|
|
67
|
-
background: linear-gradient(to bottom, #f3f4f6, #e5e7eb);
|
|
68
|
-
padding: 20px;
|
|
69
|
-
margin-top: 20px;
|
|
70
|
-
border-radius: var(--snice-border-radius-lg);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
input, textarea {
|
|
74
|
-
width: 100%;
|
|
75
|
-
padding: 8px;
|
|
76
|
-
margin: 8px 0;
|
|
77
|
-
border: 1px solid var(--snice-color-border);
|
|
78
|
-
border-radius: var(--snice-border-radius-md);
|
|
79
|
-
font-family: var(--snice-font-family);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
label {
|
|
83
|
-
display: block;
|
|
84
|
-
margin-top: 12px;
|
|
85
|
-
font-weight: 500;
|
|
86
|
-
}
|
|
87
|
-
</style>
|
|
88
|
-
</head>
|
|
89
|
-
<body>
|
|
90
|
-
<h2>Modal Component Demo</h2>
|
|
91
|
-
|
|
92
|
-
<div class="section">
|
|
93
|
-
<h3>Basic Modal</h3>
|
|
94
|
-
<div class="button-group">
|
|
95
|
-
<button onclick="document.getElementById('basic-modal').show()">Open Basic Modal</button>
|
|
96
|
-
</div>
|
|
97
|
-
|
|
98
|
-
<snice-modal id="basic-modal" label="Basic Modal">
|
|
99
|
-
<h2 slot="header">Welcome!</h2>
|
|
100
|
-
<p>This is a basic modal with header, body, and footer slots.</p>
|
|
101
|
-
<p>Click the backdrop or press Escape to close.</p>
|
|
102
|
-
<div slot="footer">
|
|
103
|
-
<button class="secondary" onclick="document.getElementById('basic-modal').close()">Cancel</button>
|
|
104
|
-
<button onclick="document.getElementById('basic-modal').close()">Confirm</button>
|
|
105
|
-
</div>
|
|
106
|
-
</snice-modal>
|
|
107
|
-
</div>
|
|
108
|
-
|
|
109
|
-
<div class="section">
|
|
110
|
-
<h3>Different Sizes</h3>
|
|
111
|
-
<div class="button-group">
|
|
112
|
-
<button onclick="document.getElementById('small-modal').show()">Small Modal</button>
|
|
113
|
-
<button onclick="document.getElementById('medium-modal').show()">Medium Modal</button>
|
|
114
|
-
<button onclick="document.getElementById('large-modal').show()">Large Modal</button>
|
|
115
|
-
<button onclick="document.getElementById('fullscreen-modal').show()">Fullscreen Modal</button>
|
|
116
|
-
</div>
|
|
117
|
-
|
|
118
|
-
<snice-modal id="small-modal" size="small" label="Small Modal">
|
|
119
|
-
<h2 slot="header">Small Modal</h2>
|
|
120
|
-
<p>This is a small modal, perfect for confirmations.</p>
|
|
121
|
-
<div slot="footer">
|
|
122
|
-
<button onclick="document.getElementById('small-modal').close()">Got it</button>
|
|
123
|
-
</div>
|
|
124
|
-
</snice-modal>
|
|
125
|
-
|
|
126
|
-
<snice-modal id="medium-modal" size="medium" label="Medium Modal">
|
|
127
|
-
<h2 slot="header">Medium Modal</h2>
|
|
128
|
-
<p>This is the default medium size modal.</p>
|
|
129
|
-
<p>It works well for most content.</p>
|
|
130
|
-
<div slot="footer">
|
|
131
|
-
<button onclick="document.getElementById('medium-modal').close()">Close</button>
|
|
132
|
-
</div>
|
|
133
|
-
</snice-modal>
|
|
134
|
-
|
|
135
|
-
<snice-modal id="large-modal" size="large" label="Large Modal">
|
|
136
|
-
<h2 slot="header">Large Modal</h2>
|
|
137
|
-
<p>This is a large modal for more complex content.</p>
|
|
138
|
-
<p>It provides more space for forms, tables, or detailed information.</p>
|
|
139
|
-
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
|
|
140
|
-
<div slot="footer">
|
|
141
|
-
<button onclick="document.getElementById('large-modal').close()">Close</button>
|
|
142
|
-
</div>
|
|
143
|
-
</snice-modal>
|
|
144
|
-
|
|
145
|
-
<snice-modal id="fullscreen-modal" size="fullscreen" label="Fullscreen Modal">
|
|
146
|
-
<h2 slot="header">Fullscreen Modal</h2>
|
|
147
|
-
<p>This modal takes up the entire viewport (with padding).</p>
|
|
148
|
-
<p>Great for complex workflows or full-screen experiences.</p>
|
|
149
|
-
<div slot="footer">
|
|
150
|
-
<button onclick="document.getElementById('fullscreen-modal').close()">Exit Fullscreen</button>
|
|
151
|
-
</div>
|
|
152
|
-
</snice-modal>
|
|
153
|
-
</div>
|
|
154
|
-
|
|
155
|
-
<div class="section">
|
|
156
|
-
<h3>No Dismiss Options</h3>
|
|
157
|
-
<div class="button-group">
|
|
158
|
-
<button onclick="document.getElementById('no-backdrop-modal').show()">No Backdrop Dismiss</button>
|
|
159
|
-
<button onclick="document.getElementById('no-escape-modal').show()">No Escape Dismiss</button>
|
|
160
|
-
<button onclick="document.getElementById('no-dismiss-modal').show()">Force Action</button>
|
|
161
|
-
</div>
|
|
162
|
-
|
|
163
|
-
<snice-modal id="no-backdrop-modal" no-backdrop-dismiss label="No Backdrop Dismiss">
|
|
164
|
-
<h2 slot="header">No Backdrop Dismiss</h2>
|
|
165
|
-
<p>Clicking the backdrop won't close this modal.</p>
|
|
166
|
-
<p>You can still press Escape or click the X button.</p>
|
|
167
|
-
<div slot="footer">
|
|
168
|
-
<button onclick="document.getElementById('no-backdrop-modal').close()">Close</button>
|
|
169
|
-
</div>
|
|
170
|
-
</snice-modal>
|
|
171
|
-
|
|
172
|
-
<snice-modal id="no-escape-modal" no-escape-dismiss label="No Escape Dismiss">
|
|
173
|
-
<h2 slot="header">No Escape Dismiss</h2>
|
|
174
|
-
<p>Pressing Escape won't close this modal.</p>
|
|
175
|
-
<p>You can still click the backdrop or the X button.</p>
|
|
176
|
-
<div slot="footer">
|
|
177
|
-
<button onclick="document.getElementById('no-escape-modal').close()">Close</button>
|
|
178
|
-
</div>
|
|
179
|
-
</snice-modal>
|
|
180
|
-
|
|
181
|
-
<snice-modal id="no-dismiss-modal" no-backdrop-dismiss no-escape-dismiss no-close-button label="Force Action">
|
|
182
|
-
<h2 slot="header">Important Action Required</h2>
|
|
183
|
-
<p>This modal can't be dismissed by clicking outside, pressing Escape, or using the X button.</p>
|
|
184
|
-
<p>The user must make a choice using the action buttons.</p>
|
|
185
|
-
<div slot="footer">
|
|
186
|
-
<button class="secondary" onclick="document.getElementById('no-dismiss-modal').close()">Cancel</button>
|
|
187
|
-
<button onclick="document.getElementById('no-dismiss-modal').close()">Confirm</button>
|
|
188
|
-
</div>
|
|
189
|
-
</snice-modal>
|
|
190
|
-
</div>
|
|
191
|
-
|
|
192
|
-
<div class="section">
|
|
193
|
-
<h3>Form Modal with Focus Trap</h3>
|
|
194
|
-
<div class="button-group">
|
|
195
|
-
<button onclick="document.getElementById('form-modal').show()">Open Form</button>
|
|
196
|
-
</div>
|
|
197
|
-
|
|
198
|
-
<snice-modal id="form-modal" label="User Form">
|
|
199
|
-
<h2 slot="header">User Information</h2>
|
|
200
|
-
<form onsubmit="event.preventDefault(); alert('Form submitted!'); document.getElementById('form-modal').close();">
|
|
201
|
-
<label for="name">Name:</label>
|
|
202
|
-
<input type="text" id="name" name="name" required>
|
|
203
|
-
|
|
204
|
-
<label for="email">Email:</label>
|
|
205
|
-
<input type="email" id="email" name="email" required>
|
|
206
|
-
|
|
207
|
-
<label for="message">Message:</label>
|
|
208
|
-
<textarea id="message" name="message" rows="4"></textarea>
|
|
209
|
-
|
|
210
|
-
<div slot="footer">
|
|
211
|
-
<button type="button" class="secondary" onclick="document.getElementById('form-modal').close()">Cancel</button>
|
|
212
|
-
<button type="submit">Submit</button>
|
|
213
|
-
</div>
|
|
214
|
-
</form>
|
|
215
|
-
</snice-modal>
|
|
216
|
-
</div>
|
|
217
|
-
|
|
218
|
-
<div class="section">
|
|
219
|
-
<h3>Scrollable Content</h3>
|
|
220
|
-
<div class="button-group">
|
|
221
|
-
<button onclick="document.getElementById('scroll-modal').show()">Open Scrollable Modal</button>
|
|
222
|
-
</div>
|
|
223
|
-
|
|
224
|
-
<snice-modal id="scroll-modal" label="Terms and Conditions">
|
|
225
|
-
<h2 slot="header">Terms and Conditions</h2>
|
|
226
|
-
<h3>1. Introduction</h3>
|
|
227
|
-
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
|
|
228
|
-
|
|
229
|
-
<h3>2. Terms of Use</h3>
|
|
230
|
-
<p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
|
231
|
-
|
|
232
|
-
<h3>3. Privacy Policy</h3>
|
|
233
|
-
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
|
|
234
|
-
|
|
235
|
-
<h3>4. Disclaimers</h3>
|
|
236
|
-
<p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
|
237
|
-
|
|
238
|
-
<h3>5. Contact Information</h3>
|
|
239
|
-
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
|
|
240
|
-
|
|
241
|
-
<div slot="footer">
|
|
242
|
-
<button class="secondary" onclick="document.getElementById('scroll-modal').close()">Decline</button>
|
|
243
|
-
<button onclick="document.getElementById('scroll-modal').close()">Accept</button>
|
|
244
|
-
</div>
|
|
245
|
-
</snice-modal>
|
|
246
|
-
</div>
|
|
247
|
-
|
|
248
|
-
<div class="section">
|
|
249
|
-
<h3>Nested Modals</h3>
|
|
250
|
-
<div class="button-group">
|
|
251
|
-
<button onclick="document.getElementById('parent-modal').show()">Open Parent Modal</button>
|
|
252
|
-
</div>
|
|
253
|
-
|
|
254
|
-
<snice-modal id="parent-modal" label="Parent Modal">
|
|
255
|
-
<h2 slot="header">Parent Modal</h2>
|
|
256
|
-
<p>This modal can open another modal.</p>
|
|
257
|
-
<button onclick="document.getElementById('child-modal').show()">Open Child Modal</button>
|
|
258
|
-
<div slot="footer">
|
|
259
|
-
<button onclick="document.getElementById('parent-modal').close()">Close</button>
|
|
260
|
-
</div>
|
|
261
|
-
</snice-modal>
|
|
262
|
-
|
|
263
|
-
<snice-modal id="child-modal" label="Child Modal">
|
|
264
|
-
<h2 slot="header">Child Modal</h2>
|
|
265
|
-
<p>This is a nested modal on top of the parent.</p>
|
|
266
|
-
<div slot="footer">
|
|
267
|
-
<button onclick="document.getElementById('child-modal').close()">Close Child</button>
|
|
268
|
-
</div>
|
|
269
|
-
</snice-modal>
|
|
270
|
-
</div>
|
|
271
|
-
|
|
272
|
-
<div class="long-content">
|
|
273
|
-
<h3>Scroll Test Area</h3>
|
|
274
|
-
<p>This area is here to test that body scroll is locked when a modal is open.</p>
|
|
275
|
-
<p>Try opening a modal and then attempting to scroll the page.</p>
|
|
276
|
-
</div>
|
|
277
|
-
|
|
278
|
-
<script type="module">
|
|
279
|
-
import './snice-modal.ts';
|
|
280
|
-
|
|
281
|
-
// Listen for modal events
|
|
282
|
-
document.addEventListener('@snice/modal-open', (e) => {
|
|
283
|
-
console.log('Modal opened:', e.detail.modal);
|
|
284
|
-
});
|
|
285
|
-
|
|
286
|
-
document.addEventListener('@snice/modal-close', (e) => {
|
|
287
|
-
console.log('Modal closed:', e.detail.modal);
|
|
288
|
-
});
|
|
289
|
-
</script>
|
|
290
|
-
</body>
|
|
291
|
-
</html>
|