snice 2.1.5 → 2.2.1
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-C9N6yGxQ.js +4 -0
- package/dist/components/snice-cell-C9N6yGxQ.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.iife.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
- package/dist/index.cjs.min.map +0 -1
- package/dist/index.esm.min.js +0 -14
- package/dist/index.esm.min.js.map +0 -1
- package/dist/index.iife.min.js +0 -15
- package/dist/index.iife.min.js.map +0 -1
|
@@ -1,287 +0,0 @@
|
|
|
1
|
-
import { element, property, query, on, watch, dispatch, ready, dispose } from 'snice';
|
|
2
|
-
import css from './snice-drawer.css?inline';
|
|
3
|
-
import type { DrawerPosition, DrawerSize, SniceDrawerElement } from './snice-drawer.types';
|
|
4
|
-
|
|
5
|
-
@element('snice-drawer')
|
|
6
|
-
export class SniceDrawer extends HTMLElement implements SniceDrawerElement {
|
|
7
|
-
@property({ type: Boolean, reflect: true })
|
|
8
|
-
open = false;
|
|
9
|
-
|
|
10
|
-
@property({ reflect: true })
|
|
11
|
-
position: DrawerPosition = 'left';
|
|
12
|
-
|
|
13
|
-
@property({ reflect: true })
|
|
14
|
-
size: DrawerSize = 'medium';
|
|
15
|
-
|
|
16
|
-
@property({ type: Boolean, attribute: 'no-backdrop', reflect: true })
|
|
17
|
-
noBackdrop = false;
|
|
18
|
-
|
|
19
|
-
@property({ type: Boolean, attribute: 'no-backdrop-dismiss', reflect: true })
|
|
20
|
-
noBackdropDismiss = false;
|
|
21
|
-
|
|
22
|
-
@property({ type: Boolean, attribute: 'no-escape-dismiss', reflect: true })
|
|
23
|
-
noEscapeDismiss = false;
|
|
24
|
-
|
|
25
|
-
@property({ type: Boolean, attribute: 'no-focus-trap', reflect: true })
|
|
26
|
-
noFocusTrap = false;
|
|
27
|
-
|
|
28
|
-
@property({ type: Boolean, reflect: true })
|
|
29
|
-
persistent = false;
|
|
30
|
-
|
|
31
|
-
@property({ type: Boolean, attribute: 'push-content', reflect: true })
|
|
32
|
-
pushContent = false;
|
|
33
|
-
|
|
34
|
-
@query('.drawer')
|
|
35
|
-
drawerElement?: HTMLElement;
|
|
36
|
-
|
|
37
|
-
@query('.drawer-backdrop')
|
|
38
|
-
backdropElement?: HTMLElement;
|
|
39
|
-
|
|
40
|
-
@query('.drawer-close')
|
|
41
|
-
closeButton?: HTMLButtonElement;
|
|
42
|
-
|
|
43
|
-
@query('.focus-trap-start')
|
|
44
|
-
focusTrapStart?: HTMLElement;
|
|
45
|
-
|
|
46
|
-
@query('.focus-trap-end')
|
|
47
|
-
focusTrapEnd?: HTMLElement;
|
|
48
|
-
|
|
49
|
-
private previousFocus?: HTMLElement;
|
|
50
|
-
private boundHandleEscape?: (e: KeyboardEvent) => void;
|
|
51
|
-
|
|
52
|
-
html() {
|
|
53
|
-
return /*html*/`
|
|
54
|
-
<div class="drawer-backdrop" part="backdrop"></div>
|
|
55
|
-
|
|
56
|
-
<div class="drawer" role="dialog" aria-modal="true" tabindex="-1" part="base">
|
|
57
|
-
<span class="focus-trap-start" tabindex="0"></span>
|
|
58
|
-
|
|
59
|
-
<div class="drawer-header" part="header">
|
|
60
|
-
<h2 class="drawer-title" part="title">
|
|
61
|
-
<slot name="title"></slot>
|
|
62
|
-
</h2>
|
|
63
|
-
${!this.persistent ? /*html*/`
|
|
64
|
-
<button class="drawer-close" type="button" aria-label="Close" part="close">
|
|
65
|
-
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
66
|
-
<path d="M18 6L6 18M6 6l12 12"/>
|
|
67
|
-
</svg>
|
|
68
|
-
</button>
|
|
69
|
-
` : ''}
|
|
70
|
-
</div>
|
|
71
|
-
|
|
72
|
-
<div class="drawer-body" part="body">
|
|
73
|
-
<slot></slot>
|
|
74
|
-
</div>
|
|
75
|
-
|
|
76
|
-
<div class="drawer-footer" part="footer">
|
|
77
|
-
<slot name="footer"></slot>
|
|
78
|
-
</div>
|
|
79
|
-
|
|
80
|
-
<span class="focus-trap-end" tabindex="0"></span>
|
|
81
|
-
</div>
|
|
82
|
-
`;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
css() {
|
|
86
|
-
return css;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
@ready()
|
|
90
|
-
init() {
|
|
91
|
-
// Ensure default attributes are set
|
|
92
|
-
if (!this.hasAttribute('position')) {
|
|
93
|
-
this.setAttribute('position', this.position);
|
|
94
|
-
}
|
|
95
|
-
if (!this.hasAttribute('size')) {
|
|
96
|
-
this.setAttribute('size', this.size);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
this.setAttribute('role', 'complementary');
|
|
100
|
-
this.setAttribute('aria-hidden', String(!this.open));
|
|
101
|
-
|
|
102
|
-
// Pre-set transition for push content mode to avoid jump on first use
|
|
103
|
-
if (this.pushContent) {
|
|
104
|
-
const mainContent = document.querySelector('main') || document.body;
|
|
105
|
-
if (mainContent && mainContent !== document.body) {
|
|
106
|
-
(mainContent as HTMLElement).style.transition = 'margin 0.3s cubic-bezier(0.4, 0, 0.2, 1)';
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
if (this.open) {
|
|
111
|
-
this.handleOpen();
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
@watch('open')
|
|
116
|
-
handleOpenChange() {
|
|
117
|
-
this.setAttribute('aria-hidden', String(!this.open));
|
|
118
|
-
|
|
119
|
-
if (this.open) {
|
|
120
|
-
this.handleOpen();
|
|
121
|
-
} else {
|
|
122
|
-
this.handleClose();
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
@on('click', '.drawer-backdrop')
|
|
127
|
-
handleBackdropClick(e: MouseEvent) {
|
|
128
|
-
if (!this.noBackdropDismiss && !this.persistent) {
|
|
129
|
-
e.stopPropagation();
|
|
130
|
-
this.hide();
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
@on('click', '.drawer-close')
|
|
135
|
-
handleCloseClick(e: MouseEvent) {
|
|
136
|
-
e.stopPropagation();
|
|
137
|
-
this.hide();
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
@on('focus', '.focus-trap-start')
|
|
141
|
-
handleFocusTrapStart() {
|
|
142
|
-
if (!this.noFocusTrap) {
|
|
143
|
-
// Focus the last focusable element in the drawer
|
|
144
|
-
const focusableElements = this.getFocusableElements();
|
|
145
|
-
if (focusableElements.length > 0) {
|
|
146
|
-
(focusableElements[focusableElements.length - 1] as HTMLElement).focus();
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
@on('focus', '.focus-trap-end')
|
|
152
|
-
handleFocusTrapEnd() {
|
|
153
|
-
if (!this.noFocusTrap) {
|
|
154
|
-
// Focus the first focusable element in the drawer
|
|
155
|
-
const focusableElements = this.getFocusableElements();
|
|
156
|
-
if (focusableElements.length > 0) {
|
|
157
|
-
(focusableElements[0] as HTMLElement).focus();
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
private handleOpen() {
|
|
163
|
-
// Store current focus
|
|
164
|
-
this.previousFocus = document.activeElement as HTMLElement;
|
|
165
|
-
|
|
166
|
-
// Add escape key handler
|
|
167
|
-
if (!this.noEscapeDismiss && !this.persistent) {
|
|
168
|
-
this.boundHandleEscape = (e: KeyboardEvent) => {
|
|
169
|
-
if (e.key === 'Escape') {
|
|
170
|
-
e.preventDefault();
|
|
171
|
-
this.hide();
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
document.addEventListener('keydown', this.boundHandleEscape);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
// Prevent body scroll
|
|
178
|
-
document.body.style.overflow = 'hidden';
|
|
179
|
-
|
|
180
|
-
// Focus management
|
|
181
|
-
if (!this.noFocusTrap) {
|
|
182
|
-
requestAnimationFrame(() => {
|
|
183
|
-
if (this.drawerElement) {
|
|
184
|
-
this.drawerElement.focus();
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
// Push content if enabled
|
|
190
|
-
if (this.pushContent) {
|
|
191
|
-
this.updatePushContent();
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
this.dispatchOpenEvent();
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
private handleClose() {
|
|
198
|
-
// Remove escape key handler
|
|
199
|
-
if (this.boundHandleEscape) {
|
|
200
|
-
document.removeEventListener('keydown', this.boundHandleEscape);
|
|
201
|
-
this.boundHandleEscape = undefined;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// Restore body scroll
|
|
205
|
-
document.body.style.overflow = '';
|
|
206
|
-
|
|
207
|
-
// Restore focus
|
|
208
|
-
if (this.previousFocus && this.previousFocus.focus) {
|
|
209
|
-
this.previousFocus.focus();
|
|
210
|
-
this.previousFocus = undefined;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
// Reset push content
|
|
214
|
-
if (this.pushContent) {
|
|
215
|
-
this.updatePushContent();
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
this.dispatchCloseEvent();
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
private updatePushContent() {
|
|
222
|
-
if (!this.pushContent) return;
|
|
223
|
-
|
|
224
|
-
// Apply to body or main content container
|
|
225
|
-
const mainContent = document.querySelector('main') || document.body;
|
|
226
|
-
if (mainContent && mainContent !== document.body) {
|
|
227
|
-
// Set transition first if not already set
|
|
228
|
-
if (!mainContent.style.transition) {
|
|
229
|
-
(mainContent as HTMLElement).style.transition = 'margin 0.3s cubic-bezier(0.4, 0, 0.2, 1)';
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
if (this.open) {
|
|
233
|
-
// Use CSS custom property that's calculated in CSS based on size/position
|
|
234
|
-
const amount = getComputedStyle(this).getPropertyValue('--drawer-push-amount');
|
|
235
|
-
const property = this.position === 'left' || this.position === 'right'
|
|
236
|
-
? 'marginLeft'
|
|
237
|
-
: 'marginTop';
|
|
238
|
-
(mainContent as HTMLElement).style[property] = amount || '0px';
|
|
239
|
-
} else {
|
|
240
|
-
// Reset margins
|
|
241
|
-
(mainContent as HTMLElement).style.marginLeft = '';
|
|
242
|
-
(mainContent as HTMLElement).style.marginTop = '';
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
private getFocusableElements(): NodeListOf<Element> {
|
|
248
|
-
if (!this.drawerElement) return document.querySelectorAll('none');
|
|
249
|
-
|
|
250
|
-
return this.drawerElement.querySelectorAll(
|
|
251
|
-
'a[href], button:not([disabled]), textarea:not([disabled]), ' +
|
|
252
|
-
'input:not([disabled]), select:not([disabled]), ' +
|
|
253
|
-
'[tabindex]:not([tabindex="-1"])'
|
|
254
|
-
);
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
@dispatch('drawer-open', { bubbles: true, composed: true })
|
|
258
|
-
private dispatchOpenEvent() {
|
|
259
|
-
return { drawer: this };
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
@dispatch('drawer-close', { bubbles: true, composed: true })
|
|
263
|
-
private dispatchCloseEvent() {
|
|
264
|
-
return { drawer: this };
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
@dispose()
|
|
268
|
-
cleanup() {
|
|
269
|
-
if (this.boundHandleEscape) {
|
|
270
|
-
document.removeEventListener('keydown', this.boundHandleEscape);
|
|
271
|
-
}
|
|
272
|
-
document.body.style.overflow = '';
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
// Public API
|
|
276
|
-
show() {
|
|
277
|
-
this.open = true;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
hide() {
|
|
281
|
-
this.open = false;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
toggle() {
|
|
285
|
-
this.open = !this.open;
|
|
286
|
-
}
|
|
287
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export type DrawerPosition = 'left' | 'right' | 'top' | 'bottom';
|
|
2
|
-
export type DrawerSize = 'small' | 'medium' | 'large' | 'xl' | 'xxl' | 'xxxl' | 'full';
|
|
3
|
-
|
|
4
|
-
export interface SniceDrawerElement extends HTMLElement {
|
|
5
|
-
open: boolean;
|
|
6
|
-
position: DrawerPosition;
|
|
7
|
-
size: DrawerSize;
|
|
8
|
-
noBackdrop: boolean;
|
|
9
|
-
noBackdropDismiss: boolean;
|
|
10
|
-
noEscapeDismiss: boolean;
|
|
11
|
-
noFocusTrap: boolean;
|
|
12
|
-
persistent: boolean;
|
|
13
|
-
pushContent: boolean;
|
|
14
|
-
show(): void;
|
|
15
|
-
hide(): void;
|
|
16
|
-
toggle(): void;
|
|
17
|
-
}
|
package/components/global.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
declare module '*.css' {
|
|
2
|
-
const content: string;
|
|
3
|
-
export default content;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
declare module '*.css?inline' {
|
|
7
|
-
const content: string;
|
|
8
|
-
export default content;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
declare module '*.html' {
|
|
12
|
-
const content: string;
|
|
13
|
-
export default content;
|
|
14
|
-
}
|
|
@@ -1,303 +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>Input 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
|
-
max-width: 800px;
|
|
15
|
-
margin: 0 auto;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.section {
|
|
19
|
-
margin-bottom: 40px;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
h2 {
|
|
23
|
-
color: var(--snice-color-text);
|
|
24
|
-
margin-bottom: 20px;
|
|
25
|
-
font-size: var(--snice-font-size-2xl);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
h3 {
|
|
29
|
-
color: var(--snice-color-text-secondary);
|
|
30
|
-
margin-bottom: 16px;
|
|
31
|
-
font-size: var(--snice-font-size-lg);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.input-group {
|
|
35
|
-
display: flex;
|
|
36
|
-
flex-direction: column;
|
|
37
|
-
gap: 20px;
|
|
38
|
-
margin-bottom: 20px;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.row {
|
|
42
|
-
display: flex;
|
|
43
|
-
gap: 20px;
|
|
44
|
-
align-items: flex-start;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.row > * {
|
|
48
|
-
flex: 1;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.output {
|
|
52
|
-
padding: 10px;
|
|
53
|
-
background: var(--snice-color-background-secondary);
|
|
54
|
-
border-radius: var(--snice-border-radius-md);
|
|
55
|
-
font-family: monospace;
|
|
56
|
-
font-size: var(--snice-font-size-sm);
|
|
57
|
-
margin-top: 10px;
|
|
58
|
-
}
|
|
59
|
-
</style>
|
|
60
|
-
</head>
|
|
61
|
-
<body>
|
|
62
|
-
<h2>Input Component Demo</h2>
|
|
63
|
-
|
|
64
|
-
<div class="section">
|
|
65
|
-
<h3>Basic Inputs</h3>
|
|
66
|
-
<div class="input-group">
|
|
67
|
-
<snice-input placeholder="Enter text..." label="Default Input"></snice-input>
|
|
68
|
-
<snice-input value="Pre-filled value" label="With Value"></snice-input>
|
|
69
|
-
<snice-input placeholder="Required field" label="Required Input" required></snice-input>
|
|
70
|
-
<snice-input placeholder="Disabled input" label="Disabled" disabled value="Can't edit this"></snice-input>
|
|
71
|
-
<snice-input placeholder="Read-only input" label="Read Only" readonly value="Read only value"></snice-input>
|
|
72
|
-
</div>
|
|
73
|
-
</div>
|
|
74
|
-
|
|
75
|
-
<div class="section">
|
|
76
|
-
<h3>Input Types</h3>
|
|
77
|
-
<div class="input-group">
|
|
78
|
-
<snice-input type="email" placeholder="email@example.com" label="Email" helper-text="Enter a valid email address"></snice-input>
|
|
79
|
-
<snice-input type="password" placeholder="Enter password" label="Password" password helper-text="Click the eye icon to toggle visibility"></snice-input>
|
|
80
|
-
<snice-input type="number" placeholder="0" label="Number" min="0" max="100" step="5" helper-text="Min: 0, Max: 100, Step: 5"></snice-input>
|
|
81
|
-
<snice-input type="tel" placeholder="+1 (555) 000-0000" label="Phone"></snice-input>
|
|
82
|
-
<snice-input type="url" placeholder="https://example.com" label="URL"></snice-input>
|
|
83
|
-
<snice-input type="search" placeholder="Search..." label="Search" clearable></snice-input>
|
|
84
|
-
<snice-input type="date" label="Date"></snice-input>
|
|
85
|
-
<snice-input type="time" label="Time"></snice-input>
|
|
86
|
-
</div>
|
|
87
|
-
</div>
|
|
88
|
-
|
|
89
|
-
<div class="section">
|
|
90
|
-
<h3>Sizes</h3>
|
|
91
|
-
<div class="input-group">
|
|
92
|
-
<snice-input size="small" placeholder="Small input" label="Small"></snice-input>
|
|
93
|
-
<snice-input size="medium" placeholder="Medium input" label="Medium (Default)"></snice-input>
|
|
94
|
-
<snice-input size="large" placeholder="Large input" label="Large"></snice-input>
|
|
95
|
-
</div>
|
|
96
|
-
</div>
|
|
97
|
-
|
|
98
|
-
<div class="section">
|
|
99
|
-
<h3>Variants</h3>
|
|
100
|
-
<div class="input-group">
|
|
101
|
-
<snice-input variant="outlined" placeholder="Outlined variant" label="Outlined (Default)"></snice-input>
|
|
102
|
-
<snice-input variant="filled" placeholder="Filled variant" label="Filled"></snice-input>
|
|
103
|
-
<snice-input variant="underlined" placeholder="Underlined variant" label="Underlined"></snice-input>
|
|
104
|
-
</div>
|
|
105
|
-
</div>
|
|
106
|
-
|
|
107
|
-
<div class="section">
|
|
108
|
-
<h3>With Icons</h3>
|
|
109
|
-
<div class="input-group">
|
|
110
|
-
<snice-input
|
|
111
|
-
placeholder="Search..."
|
|
112
|
-
label="With Prefix Icon"
|
|
113
|
-
prefix-icon="🔍">
|
|
114
|
-
</snice-input>
|
|
115
|
-
<snice-input
|
|
116
|
-
placeholder="Enter amount"
|
|
117
|
-
label="With Suffix Icon"
|
|
118
|
-
suffix-icon="💵">
|
|
119
|
-
</snice-input>
|
|
120
|
-
<snice-input
|
|
121
|
-
placeholder="Email address"
|
|
122
|
-
label="With Both Icons"
|
|
123
|
-
prefix-icon="📧"
|
|
124
|
-
suffix-icon="✓">
|
|
125
|
-
</snice-input>
|
|
126
|
-
</div>
|
|
127
|
-
</div>
|
|
128
|
-
|
|
129
|
-
<div class="section">
|
|
130
|
-
<h3>Clearable Inputs</h3>
|
|
131
|
-
<div class="input-group">
|
|
132
|
-
<snice-input
|
|
133
|
-
clearable
|
|
134
|
-
value="Clear me!"
|
|
135
|
-
label="Clearable Input"
|
|
136
|
-
helper-text="Hover to see clear button">
|
|
137
|
-
</snice-input>
|
|
138
|
-
<snice-input
|
|
139
|
-
clearable
|
|
140
|
-
value="With suffix icon"
|
|
141
|
-
label="Clearable with Icon"
|
|
142
|
-
suffix-icon="📝">
|
|
143
|
-
</snice-input>
|
|
144
|
-
</div>
|
|
145
|
-
</div>
|
|
146
|
-
|
|
147
|
-
<div class="section">
|
|
148
|
-
<h3>Validation States</h3>
|
|
149
|
-
<div class="input-group">
|
|
150
|
-
<snice-input
|
|
151
|
-
placeholder="Enter email"
|
|
152
|
-
label="Valid State"
|
|
153
|
-
helper-text="This looks good!">
|
|
154
|
-
</snice-input>
|
|
155
|
-
<snice-input
|
|
156
|
-
invalid
|
|
157
|
-
value="invalid@"
|
|
158
|
-
label="Invalid State"
|
|
159
|
-
error-text="Please enter a valid email address">
|
|
160
|
-
</snice-input>
|
|
161
|
-
<snice-input
|
|
162
|
-
type="email"
|
|
163
|
-
required
|
|
164
|
-
placeholder="email@example.com"
|
|
165
|
-
label="With Pattern Validation"
|
|
166
|
-
pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}$"
|
|
167
|
-
helper-text="Must be a valid email format">
|
|
168
|
-
</snice-input>
|
|
169
|
-
</div>
|
|
170
|
-
</div>
|
|
171
|
-
|
|
172
|
-
<div class="section">
|
|
173
|
-
<h3>Text Length Constraints</h3>
|
|
174
|
-
<div class="input-group">
|
|
175
|
-
<snice-input
|
|
176
|
-
maxlength="10"
|
|
177
|
-
placeholder="Max 10 chars"
|
|
178
|
-
label="Max Length"
|
|
179
|
-
helper-text="Maximum 10 characters allowed">
|
|
180
|
-
</snice-input>
|
|
181
|
-
<snice-input
|
|
182
|
-
minlength="5"
|
|
183
|
-
placeholder="Min 5 chars"
|
|
184
|
-
label="Min Length"
|
|
185
|
-
helper-text="Minimum 5 characters required">
|
|
186
|
-
</snice-input>
|
|
187
|
-
</div>
|
|
188
|
-
</div>
|
|
189
|
-
|
|
190
|
-
<div class="section">
|
|
191
|
-
<h3>Interactive Example</h3>
|
|
192
|
-
<div class="input-group">
|
|
193
|
-
<snice-input
|
|
194
|
-
id="interactive-input"
|
|
195
|
-
clearable
|
|
196
|
-
placeholder="Type something..."
|
|
197
|
-
label="Interactive Input"
|
|
198
|
-
helper-text="Events will be logged below">
|
|
199
|
-
</snice-input>
|
|
200
|
-
<div id="output" class="output">
|
|
201
|
-
<div>Waiting for input...</div>
|
|
202
|
-
</div>
|
|
203
|
-
</div>
|
|
204
|
-
</div>
|
|
205
|
-
|
|
206
|
-
<div class="section">
|
|
207
|
-
<h3>Form Example</h3>
|
|
208
|
-
<form id="demo-form">
|
|
209
|
-
<div class="input-group">
|
|
210
|
-
<div class="row">
|
|
211
|
-
<snice-input
|
|
212
|
-
name="firstName"
|
|
213
|
-
required
|
|
214
|
-
placeholder="John"
|
|
215
|
-
label="First Name">
|
|
216
|
-
</snice-input>
|
|
217
|
-
<snice-input
|
|
218
|
-
name="lastName"
|
|
219
|
-
required
|
|
220
|
-
placeholder="Doe"
|
|
221
|
-
label="Last Name">
|
|
222
|
-
</snice-input>
|
|
223
|
-
</div>
|
|
224
|
-
<snice-input
|
|
225
|
-
type="email"
|
|
226
|
-
name="email"
|
|
227
|
-
required
|
|
228
|
-
placeholder="john.doe@example.com"
|
|
229
|
-
label="Email Address">
|
|
230
|
-
</snice-input>
|
|
231
|
-
<snice-input
|
|
232
|
-
type="password"
|
|
233
|
-
name="password"
|
|
234
|
-
required
|
|
235
|
-
password
|
|
236
|
-
minlength="8"
|
|
237
|
-
placeholder="Min 8 characters"
|
|
238
|
-
label="Password">
|
|
239
|
-
</snice-input>
|
|
240
|
-
<snice-input
|
|
241
|
-
type="tel"
|
|
242
|
-
name="phone"
|
|
243
|
-
placeholder="+1 (555) 000-0000"
|
|
244
|
-
label="Phone (Optional)">
|
|
245
|
-
</snice-input>
|
|
246
|
-
<button type="submit" style="
|
|
247
|
-
padding: 10px 20px;
|
|
248
|
-
background: var(--snice-color-primary);
|
|
249
|
-
color: white;
|
|
250
|
-
border: none;
|
|
251
|
-
border-radius: var(--snice-border-radius-md);
|
|
252
|
-
cursor: pointer;
|
|
253
|
-
font-size: var(--snice-font-size-md);
|
|
254
|
-
">Submit Form</button>
|
|
255
|
-
</div>
|
|
256
|
-
</form>
|
|
257
|
-
</div>
|
|
258
|
-
|
|
259
|
-
<script type="module">
|
|
260
|
-
import './snice-input.ts';
|
|
261
|
-
|
|
262
|
-
// Interactive example
|
|
263
|
-
const input = document.getElementById('interactive-input');
|
|
264
|
-
const output = document.getElementById('output');
|
|
265
|
-
|
|
266
|
-
let eventLog = [];
|
|
267
|
-
|
|
268
|
-
function logEvent(type, detail) {
|
|
269
|
-
eventLog.unshift(`${type}: ${JSON.stringify(detail)}`);
|
|
270
|
-
eventLog = eventLog.slice(0, 5);
|
|
271
|
-
output.innerHTML = eventLog.map(log => `<div>${log}</div>`).join('');
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
input.addEventListener('@snice/input-input', (e) => {
|
|
275
|
-
logEvent('input', { value: e.detail.value });
|
|
276
|
-
});
|
|
277
|
-
|
|
278
|
-
input.addEventListener('@snice/input-change', (e) => {
|
|
279
|
-
logEvent('change', { value: e.detail.value });
|
|
280
|
-
});
|
|
281
|
-
|
|
282
|
-
input.addEventListener('@snice/input-focus', () => {
|
|
283
|
-
logEvent('focus', {});
|
|
284
|
-
});
|
|
285
|
-
|
|
286
|
-
input.addEventListener('@snice/input-blur', () => {
|
|
287
|
-
logEvent('blur', {});
|
|
288
|
-
});
|
|
289
|
-
|
|
290
|
-
input.addEventListener('@snice/input-clear', () => {
|
|
291
|
-
logEvent('clear', {});
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
// Form example
|
|
295
|
-
document.getElementById('demo-form').addEventListener('submit', (e) => {
|
|
296
|
-
e.preventDefault();
|
|
297
|
-
const formData = new FormData(e.target);
|
|
298
|
-
const data = Object.fromEntries(formData);
|
|
299
|
-
alert('Form submitted with: ' + JSON.stringify(data, null, 2));
|
|
300
|
-
});
|
|
301
|
-
</script>
|
|
302
|
-
</body>
|
|
303
|
-
</html>
|