snice 2.5.4 → 3.1.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/README.md +501 -882
- package/bin/templates/base/src/components/counter-button.ts +13 -26
- package/bin/templates/base/src/controllers/counter-controller.ts +3 -3
- package/dist/components/accordion/snice-accordion-item.d.ts +4 -5
- package/dist/components/accordion/snice-accordion-item.js +37 -39
- package/dist/components/accordion/snice-accordion-item.js.map +1 -1
- package/dist/components/accordion/snice-accordion.d.ts +5 -11
- package/dist/components/accordion/snice-accordion.js +51 -52
- package/dist/components/accordion/snice-accordion.js.map +1 -1
- package/dist/components/alert/snice-alert.d.ts +2 -6
- package/dist/components/alert/snice-alert.js +41 -56
- package/dist/components/alert/snice-alert.js.map +1 -1
- package/dist/components/avatar/snice-avatar.d.ts +2 -6
- package/dist/components/avatar/snice-avatar.js +64 -71
- package/dist/components/avatar/snice-avatar.js.map +1 -1
- package/dist/components/badge/snice-badge.d.ts +2 -3
- package/dist/components/badge/snice-badge.js +22 -23
- package/dist/components/badge/snice-badge.js.map +1 -1
- package/dist/components/breadcrumbs/snice-breadcrumbs.d.ts +5 -12
- package/dist/components/breadcrumbs/snice-breadcrumbs.js +88 -89
- package/dist/components/breadcrumbs/snice-breadcrumbs.js.map +1 -1
- package/dist/components/button/snice-button.d.ts +3 -7
- package/dist/components/button/snice-button.js +37 -58
- package/dist/components/button/snice-button.js.map +1 -1
- package/dist/components/card/snice-card.d.ts +5 -8
- package/dist/components/card/snice-card.js +71 -56
- package/dist/components/card/snice-card.js.map +1 -1
- package/dist/components/checkbox/snice-checkbox.d.ts +4 -13
- package/dist/components/checkbox/snice-checkbox.js +66 -137
- package/dist/components/checkbox/snice-checkbox.js.map +1 -1
- package/dist/components/chip/snice-chip.d.ts +5 -11
- package/dist/components/chip/snice-chip.js +44 -47
- package/dist/components/chip/snice-chip.js.map +1 -1
- package/dist/components/date-picker/snice-date-picker.d.ts +11 -11
- package/dist/components/date-picker/snice-date-picker.js +134 -133
- package/dist/components/date-picker/snice-date-picker.js.map +1 -1
- package/dist/components/divider/snice-divider.d.ts +2 -4
- package/dist/components/divider/snice-divider.js +14 -22
- package/dist/components/divider/snice-divider.js.map +1 -1
- package/dist/components/drawer/snice-drawer.d.ts +4 -4
- package/dist/components/drawer/snice-drawer.js +25 -19
- package/dist/components/drawer/snice-drawer.js.map +1 -1
- package/dist/components/input/snice-input.d.ts +8 -6
- package/dist/components/input/snice-input.js +122 -105
- package/dist/components/input/snice-input.js.map +1 -1
- package/dist/components/layout/snice-layout-blog.d.ts +4 -4
- package/dist/components/layout/snice-layout-blog.js +21 -19
- package/dist/components/layout/snice-layout-blog.js.map +1 -1
- package/dist/components/layout/snice-layout-card.d.ts +2 -2
- package/dist/components/layout/snice-layout-card.js +16 -9
- package/dist/components/layout/snice-layout-card.js.map +1 -1
- package/dist/components/layout/snice-layout-centered.d.ts +2 -2
- package/dist/components/layout/snice-layout-centered.js +14 -7
- package/dist/components/layout/snice-layout-centered.js.map +1 -1
- package/dist/components/layout/snice-layout-dashboard.d.ts +5 -5
- package/dist/components/layout/snice-layout-dashboard.js +38 -30
- package/dist/components/layout/snice-layout-dashboard.js.map +1 -1
- package/dist/components/layout/snice-layout-fullscreen.d.ts +2 -2
- package/dist/components/layout/snice-layout-fullscreen.js +17 -10
- package/dist/components/layout/snice-layout-fullscreen.js.map +1 -1
- package/dist/components/layout/snice-layout-landing.d.ts +4 -4
- package/dist/components/layout/snice-layout-landing.js +21 -19
- package/dist/components/layout/snice-layout-landing.js.map +1 -1
- package/dist/components/layout/snice-layout-minimal.d.ts +2 -2
- package/dist/components/layout/snice-layout-minimal.js +17 -6
- package/dist/components/layout/snice-layout-minimal.js.map +1 -1
- package/dist/components/layout/snice-layout-sidebar.d.ts +5 -4
- package/dist/components/layout/snice-layout-sidebar.js +42 -20
- package/dist/components/layout/snice-layout-sidebar.js.map +1 -1
- package/dist/components/layout/snice-layout-split.d.ts +2 -2
- package/dist/components/layout/snice-layout-split.js +14 -7
- package/dist/components/layout/snice-layout-split.js.map +1 -1
- package/dist/components/layout/snice-layout.d.ts +4 -4
- package/dist/components/layout/snice-layout.js +16 -10
- package/dist/components/layout/snice-layout.js.map +1 -1
- package/dist/components/login/snice-login.d.ts +6 -11
- package/dist/components/login/snice-login.js +97 -71
- package/dist/components/login/snice-login.js.map +1 -1
- package/dist/components/modal/snice-modal.d.ts +5 -9
- package/dist/components/modal/snice-modal.js +47 -78
- package/dist/components/modal/snice-modal.js.map +1 -1
- package/dist/components/nav/snice-nav.d.ts +13 -7
- package/dist/components/nav/snice-nav.js +191 -100
- package/dist/components/nav/snice-nav.js.map +1 -1
- package/dist/components/nav/snice-nav.types.d.ts +3 -3
- package/dist/components/pagination/snice-pagination.d.ts +6 -7
- package/dist/components/pagination/snice-pagination.js +94 -81
- package/dist/components/pagination/snice-pagination.js.map +1 -1
- package/dist/components/progress/snice-progress.d.ts +2 -7
- package/dist/components/progress/snice-progress.js +41 -98
- package/dist/components/progress/snice-progress.js.map +1 -1
- package/dist/components/radio/snice-radio.d.ts +4 -4
- package/dist/components/radio/snice-radio.js +52 -44
- package/dist/components/radio/snice-radio.js.map +1 -1
- package/dist/components/select/snice-option.d.ts +2 -1
- package/dist/components/select/snice-option.js +12 -5
- package/dist/components/select/snice-option.js.map +1 -1
- package/dist/components/select/snice-select.d.ts +9 -21
- package/dist/components/select/snice-select.js +98 -170
- package/dist/components/select/snice-select.js.map +1 -1
- package/dist/components/skeleton/snice-skeleton.d.ts +2 -6
- package/dist/components/skeleton/snice-skeleton.js +18 -49
- package/dist/components/skeleton/snice-skeleton.js.map +1 -1
- package/dist/components/snice-cell-BLFVdxPp.js +4 -0
- package/dist/components/snice-cell-BLFVdxPp.js.map +1 -0
- package/dist/components/switch/snice-switch.d.ts +2 -2
- package/dist/components/switch/snice-switch.js +38 -26
- package/dist/components/switch/snice-switch.js.map +1 -1
- package/dist/components/table/snice-cell-actions.d.ts +24 -0
- package/dist/components/table/snice-cell-actions.js +149 -0
- package/dist/components/table/snice-cell-actions.js.map +1 -0
- package/dist/components/table/snice-cell-boolean.d.ts +2 -2
- package/dist/components/table/snice-cell-boolean.js +13 -7
- package/dist/components/table/snice-cell-boolean.js.map +1 -1
- package/dist/components/table/snice-cell-color.d.ts +18 -0
- package/dist/components/table/snice-cell-color.js +149 -0
- package/dist/components/table/snice-cell-color.js.map +1 -0
- package/dist/components/table/snice-cell-currency.d.ts +24 -0
- package/dist/components/table/snice-cell-currency.js +235 -0
- package/dist/components/table/snice-cell-currency.js.map +1 -0
- package/dist/components/table/snice-cell-date.d.ts +2 -2
- package/dist/components/table/snice-cell-date.js +14 -8
- package/dist/components/table/snice-cell-date.js.map +1 -1
- package/dist/components/table/snice-cell-duration.d.ts +2 -2
- package/dist/components/table/snice-cell-duration.js +12 -6
- package/dist/components/table/snice-cell-duration.js.map +1 -1
- package/dist/components/table/snice-cell-email.d.ts +15 -0
- package/dist/components/table/snice-cell-email.js +125 -0
- package/dist/components/table/snice-cell-email.js.map +1 -0
- package/dist/components/table/snice-cell-filesize.d.ts +2 -2
- package/dist/components/table/snice-cell-filesize.js +12 -6
- package/dist/components/table/snice-cell-filesize.js.map +1 -1
- package/dist/components/table/snice-cell-image.d.ts +20 -0
- package/dist/components/table/snice-cell-image.js +162 -0
- package/dist/components/table/snice-cell-image.js.map +1 -0
- package/dist/components/table/snice-cell-json.d.ts +20 -0
- package/dist/components/table/snice-cell-json.js +186 -0
- package/dist/components/table/snice-cell-json.js.map +1 -0
- package/dist/components/table/snice-cell-link.d.ts +17 -0
- package/dist/components/table/snice-cell-link.js +142 -0
- package/dist/components/table/snice-cell-link.js.map +1 -0
- package/dist/components/table/snice-cell-location.d.ts +19 -0
- package/dist/components/table/snice-cell-location.js +185 -0
- package/dist/components/table/snice-cell-location.js.map +1 -0
- package/dist/components/table/snice-cell-number.d.ts +2 -2
- package/dist/components/table/snice-cell-number.js +12 -6
- package/dist/components/table/snice-cell-number.js.map +1 -1
- package/dist/components/table/snice-cell-percentage.d.ts +22 -0
- package/dist/components/table/snice-cell-percentage.js +208 -0
- package/dist/components/table/snice-cell-percentage.js.map +1 -0
- package/dist/components/table/snice-cell-phone.d.ts +18 -0
- package/dist/components/table/snice-cell-phone.js +153 -0
- package/dist/components/table/snice-cell-phone.js.map +1 -0
- package/dist/components/table/snice-cell-progress.d.ts +2 -2
- package/dist/components/table/snice-cell-progress.js +12 -6
- package/dist/components/table/snice-cell-progress.js.map +1 -1
- package/dist/components/table/snice-cell-rating.d.ts +2 -2
- package/dist/components/table/snice-cell-rating.js +12 -6
- package/dist/components/table/snice-cell-rating.js.map +1 -1
- package/dist/components/table/snice-cell-sparkline.d.ts +2 -2
- package/dist/components/table/snice-cell-sparkline.js +13 -7
- package/dist/components/table/snice-cell-sparkline.js.map +1 -1
- package/dist/components/table/snice-cell-status.d.ts +17 -0
- package/dist/components/table/snice-cell-status.js +144 -0
- package/dist/components/table/snice-cell-status.js.map +1 -0
- package/dist/components/table/snice-cell-tag.d.ts +16 -0
- package/dist/components/table/snice-cell-tag.js +131 -0
- package/dist/components/table/snice-cell-tag.js.map +1 -0
- package/dist/components/table/snice-cell-text.d.ts +2 -2
- package/dist/components/table/snice-cell-text.js +14 -8
- package/dist/components/table/snice-cell-text.js.map +1 -1
- package/dist/components/table/snice-cell.d.ts +2 -2
- package/dist/components/table/snice-cell.js +12 -6
- package/dist/components/table/snice-cell.js.map +1 -1
- package/dist/components/table/snice-column.d.ts +1 -1
- package/dist/components/table/snice-column.js +6 -3
- package/dist/components/table/snice-column.js.map +1 -1
- package/dist/components/table/snice-header.d.ts +5 -5
- package/dist/components/table/snice-header.js +60 -50
- package/dist/components/table/snice-header.js.map +1 -1
- package/dist/components/table/snice-progress.d.ts +2 -2
- package/dist/components/table/snice-progress.js +18 -11
- package/dist/components/table/snice-progress.js.map +1 -1
- package/dist/components/table/snice-rating.d.ts +2 -2
- package/dist/components/table/snice-rating.js +15 -8
- package/dist/components/table/snice-rating.js.map +1 -1
- package/dist/components/table/snice-row.d.ts +17 -6
- package/dist/components/table/snice-row.js +95 -44
- package/dist/components/table/snice-row.js.map +1 -1
- package/dist/components/table/snice-table.d.ts +18 -10
- package/dist/components/table/snice-table.js +355 -173
- package/dist/components/table/snice-table.js.map +1 -1
- package/dist/components/table/snice-table.types.d.ts +101 -2
- package/dist/components/tabs/snice-tab-panel.d.ts +2 -2
- package/dist/components/tabs/snice-tab-panel.js +12 -6
- package/dist/components/tabs/snice-tab-panel.js.map +1 -1
- package/dist/components/tabs/snice-tab.d.ts +6 -5
- package/dist/components/tabs/snice-tab.js +36 -19
- package/dist/components/tabs/snice-tab.js.map +1 -1
- package/dist/components/tabs/snice-tabs.d.ts +5 -5
- package/dist/components/tabs/snice-tabs.js +38 -28
- package/dist/components/tabs/snice-tabs.js.map +1 -1
- package/dist/components/toast/snice-toast-container.d.ts +7 -7
- package/dist/components/toast/snice-toast-container.js +19 -12
- package/dist/components/toast/snice-toast-container.js.map +1 -1
- package/dist/components/toast/snice-toast.d.ts +3 -15
- package/dist/components/toast/snice-toast.js +49 -108
- package/dist/components/toast/snice-toast.js.map +1 -1
- package/dist/components/tooltip/snice-tooltip.d.ts +2 -2
- package/dist/components/tooltip/snice-tooltip.js +14 -7
- package/dist/components/tooltip/snice-tooltip.js.map +1 -1
- package/dist/context.d.ts +44 -0
- package/dist/element-ready.d.ts +40 -0
- package/dist/{types/element.d.ts → element.d.ts} +2 -8
- package/dist/{types/events.d.ts → events.d.ts} +0 -4
- package/dist/index.cjs +2589 -605
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +21 -0
- package/dist/index.esm.js +2568 -604
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +2589 -605
- package/dist/index.iife.js.map +1 -1
- package/dist/method-decorators.d.ts +121 -0
- package/dist/on.d.ts +59 -0
- package/dist/parts.d.ts +159 -0
- package/dist/render-debug.d.ts +27 -0
- package/dist/render-tracker.d.ts +14 -0
- package/dist/render.d.ts +96 -0
- package/dist/symbols.cjs +163 -0
- package/dist/symbols.cjs.map +1 -1
- package/dist/{types/symbols.d.ts → symbols.d.ts} +22 -0
- package/dist/symbols.esm.js +27 -3
- package/dist/symbols.esm.js.map +1 -1
- package/dist/template.d.ts +100 -0
- package/dist/transitions.cjs +219 -0
- package/dist/transitions.esm.js +2 -2
- package/dist/types/context.d.ts +48 -0
- package/dist/types/element-options.d.ts +26 -0
- package/dist/types/index.d.ts +25 -9
- package/dist/types/nav-context.d.ts +19 -0
- package/dist/types/{types/on-options.d.ts → on-options.d.ts} +2 -0
- package/dist/types/{types/placard.d.ts → placard.d.ts} +0 -1
- package/docs/ai/README.md +17 -0
- package/docs/ai/api.md +175 -0
- package/docs/ai/architecture.md +160 -0
- package/docs/ai/components/accordion.md +174 -0
- package/docs/ai/components/alert.md +77 -0
- package/docs/ai/components/avatar.md +61 -0
- package/docs/ai/components/badge.md +69 -0
- package/docs/ai/components/breadcrumbs.md +74 -0
- package/docs/ai/components/button.md +75 -0
- package/docs/ai/components/card.md +61 -0
- package/docs/ai/components/checkbox.md +74 -0
- package/docs/ai/components/chip.md +73 -0
- package/docs/ai/components/date-picker.md +75 -0
- package/docs/ai/components/divider.md +66 -0
- package/docs/ai/components/drawer.md +80 -0
- package/docs/ai/components/input.md +111 -0
- package/docs/ai/components/login.md +109 -0
- package/docs/ai/components/modal.md +67 -0
- package/docs/ai/components/nav.md +76 -0
- package/docs/ai/components/pagination.md +55 -0
- package/docs/ai/components/progress.md +72 -0
- package/docs/ai/components/radio.md +79 -0
- package/docs/ai/components/select.md +92 -0
- package/docs/ai/components/skeleton.md +57 -0
- package/docs/ai/components/switch.md +53 -0
- package/docs/ai/components/table.md +227 -0
- package/docs/ai/components/tabs.md +83 -0
- package/docs/ai/components/toast.md +140 -0
- package/docs/ai/components/tooltip.md +146 -0
- package/docs/ai/patterns.md +244 -0
- package/docs/components/accordion.md +558 -0
- package/docs/components/drawer.md +602 -0
- package/docs/components/modal.md +558 -0
- package/docs/components/nav.md +239 -0
- package/docs/components/pagination.md +289 -0
- package/docs/components/select.md +599 -0
- package/docs/components/switch.md +354 -0
- package/docs/components/tabs.md +546 -0
- package/docs/components/toast.md +506 -0
- package/docs/components/tooltip.md +523 -0
- package/docs/controllers.md +744 -0
- package/docs/elements.md +855 -0
- package/docs/events.md +807 -0
- package/docs/migration-v2-to-v3.md +569 -0
- package/docs/observe.md +588 -0
- package/docs/placards.md +401 -0
- package/docs/request-response.md +852 -0
- package/docs/routing.md +1186 -0
- package/package.json +10 -11
- package/dist/components/snice-cell-C9N6yGxQ.js +0 -4
- package/dist/components/snice-cell-C9N6yGxQ.js.map +0 -1
- package/dist/types/types/index.d.ts +0 -23
- /package/dist/{types/controller.d.ts → controller.d.ts} +0 -0
- /package/dist/{types/global.d.ts → global.d.ts} +0 -0
- /package/dist/{types/observe.d.ts → observe.d.ts} +0 -0
- /package/dist/{types/request-response.d.ts → request-response.d.ts} +0 -0
- /package/dist/{types/router.d.ts → router.d.ts} +0 -0
- /package/dist/{types/testing.d.ts → testing.d.ts} +0 -0
- /package/dist/{types/transitions.d.ts → transitions.d.ts} +0 -0
- /package/dist/types/{types/adopted-options.d.ts → adopted-options.d.ts} +0 -0
- /package/dist/types/{types/app-context.d.ts → app-context.d.ts} +0 -0
- /package/dist/types/{types/dispatch-options.d.ts → dispatch-options.d.ts} +0 -0
- /package/dist/types/{types/guard.d.ts → guard.d.ts} +0 -0
- /package/dist/types/{types/i-controller.d.ts → i-controller.d.ts} +0 -0
- /package/dist/types/{types/moved-options.d.ts → moved-options.d.ts} +0 -0
- /package/dist/types/{types/observe-options.d.ts → observe-options.d.ts} +0 -0
- /package/dist/types/{types/page-options.d.ts → page-options.d.ts} +0 -0
- /package/dist/types/{types/part-options.d.ts → part-options.d.ts} +0 -0
- /package/dist/types/{types/property-converter.d.ts → property-converter.d.ts} +0 -0
- /package/dist/types/{types/property-options.d.ts → property-options.d.ts} +0 -0
- /package/dist/types/{types/query-options.d.ts → query-options.d.ts} +0 -0
- /package/dist/types/{types/request-options.d.ts → request-options.d.ts} +0 -0
- /package/dist/types/{types/respond-options.d.ts → respond-options.d.ts} +0 -0
- /package/dist/types/{types/route-params.d.ts → route-params.d.ts} +0 -0
- /package/dist/types/{types/router-instance.d.ts → router-instance.d.ts} +0 -0
- /package/dist/types/{types/router-options.d.ts → router-options.d.ts} +0 -0
- /package/dist/types/{types/simple-array.d.ts → simple-array.d.ts} +0 -0
- /package/dist/types/{types/snice-element.d.ts → snice-element.d.ts} +0 -0
- /package/dist/types/{types/snice-global.d.ts → snice-global.d.ts} +0 -0
- /package/dist/types/{types/transition.d.ts → transition.d.ts} +0 -0
- /package/dist/{types/utils.d.ts → utils.d.ts} +0 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# snice-skeleton
|
|
2
|
+
|
|
3
|
+
Loading placeholder with animated shimmer effect.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
variant: 'text'|'circular'|'rectangular'|'rounded' = 'text';
|
|
9
|
+
width: string = '';
|
|
10
|
+
height: string = '';
|
|
11
|
+
animation: 'pulse'|'wave'|'none' = 'pulse';
|
|
12
|
+
count: number = 1;
|
|
13
|
+
spacing: string = '8px';
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```html
|
|
19
|
+
<!-- Text placeholder -->
|
|
20
|
+
<snice-skeleton variant="text"></snice-skeleton>
|
|
21
|
+
<snice-skeleton variant="text" width="200px"></snice-skeleton>
|
|
22
|
+
|
|
23
|
+
<!-- Circular (avatar) -->
|
|
24
|
+
<snice-skeleton variant="circular" width="40px" height="40px"></snice-skeleton>
|
|
25
|
+
|
|
26
|
+
<!-- Rectangular -->
|
|
27
|
+
<snice-skeleton variant="rectangular" width="100%" height="200px"></snice-skeleton>
|
|
28
|
+
|
|
29
|
+
<!-- Rounded (card) -->
|
|
30
|
+
<snice-skeleton variant="rounded" width="300px" height="150px"></snice-skeleton>
|
|
31
|
+
|
|
32
|
+
<!-- Multiple lines -->
|
|
33
|
+
<snice-skeleton variant="text" count="3"></snice-skeleton>
|
|
34
|
+
<snice-skeleton variant="text" count="5" spacing="12px"></snice-skeleton>
|
|
35
|
+
|
|
36
|
+
<!-- Animation types -->
|
|
37
|
+
<snice-skeleton animation="pulse"></snice-skeleton>
|
|
38
|
+
<snice-skeleton animation="wave"></snice-skeleton>
|
|
39
|
+
<snice-skeleton animation="none"></snice-skeleton>
|
|
40
|
+
|
|
41
|
+
<!-- Complex layout -->
|
|
42
|
+
<div style="display: flex; gap: 16px;">
|
|
43
|
+
<snice-skeleton variant="circular" width="48px" height="48px"></snice-skeleton>
|
|
44
|
+
<div style="flex: 1;">
|
|
45
|
+
<snice-skeleton variant="text" width="40%"></snice-skeleton>
|
|
46
|
+
<snice-skeleton variant="text" width="60%"></snice-skeleton>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Features
|
|
52
|
+
|
|
53
|
+
- 4 shape variants (text/circular/rectangular/rounded)
|
|
54
|
+
- 3 animation styles (pulse/wave/none)
|
|
55
|
+
- Custom dimensions
|
|
56
|
+
- Multiple skeleton elements with spacing
|
|
57
|
+
- Mimics loading content shapes
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# snice-switch
|
|
2
|
+
|
|
3
|
+
Toggle switch input for boolean selections.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
checked: boolean = false; // Switch state
|
|
9
|
+
disabled: boolean = false; // Disabled state
|
|
10
|
+
required: boolean = false; // Form required
|
|
11
|
+
invalid: boolean = false; // Invalid state styling
|
|
12
|
+
size: 'small'|'medium'|'large' = 'medium';
|
|
13
|
+
name: string = ''; // Form field name
|
|
14
|
+
value: string = 'on'; // Form field value when checked
|
|
15
|
+
label: string = ''; // Label text
|
|
16
|
+
labelOn: string = ''; // Label shown when on
|
|
17
|
+
labelOff: string = ''; // Label shown when off
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Methods
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
toggle() // Toggle switch state
|
|
24
|
+
focus() // Focus the switch
|
|
25
|
+
blur() // Remove focus
|
|
26
|
+
click() // Programmatic click
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Events
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
'@snice/switch-change' // { checked, switch }
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
```html
|
|
38
|
+
<snice-switch label="Enable notifications"></snice-switch>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
switchEl.addEventListener('@snice/switch-change', (e) => {
|
|
43
|
+
console.log(e.detail.checked);
|
|
44
|
+
});
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## CSS Parts
|
|
48
|
+
|
|
49
|
+
```css
|
|
50
|
+
::part(track) // Switch track
|
|
51
|
+
::part(thumb) // Switch thumb
|
|
52
|
+
::part(label) // Label text
|
|
53
|
+
```
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
# snice-table, snice-row, snice-column, snice-cell, snice-header
|
|
2
|
+
|
|
3
|
+
Data table with Excel-like formatting, sorting, pagination, and 15 column types.
|
|
4
|
+
|
|
5
|
+
## snice-table
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
size: 'small'|'medium'|'large' = 'medium';
|
|
9
|
+
variant: 'default'|'striped'|'bordered' = 'default';
|
|
10
|
+
striped: boolean = false;
|
|
11
|
+
hoverable: boolean = false;
|
|
12
|
+
bordered: boolean = false;
|
|
13
|
+
stickyHeader: boolean = false;
|
|
14
|
+
sortable: boolean = false;
|
|
15
|
+
selectable: boolean = false;
|
|
16
|
+
clickable: boolean = false;
|
|
17
|
+
loading: boolean = false;
|
|
18
|
+
data: any[] = [];
|
|
19
|
+
columns: ColumnDefinition[] = [];
|
|
20
|
+
showSearch: boolean = false;
|
|
21
|
+
showPagination: boolean = false;
|
|
22
|
+
pageSize: number = 10;
|
|
23
|
+
currentPage: number = 1;
|
|
24
|
+
totalItems: number = 0;
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Methods:**
|
|
28
|
+
- `setData(data)` - Set table data
|
|
29
|
+
- `sort(column)` - Sort by column
|
|
30
|
+
- `getSelectedRows()` - Get selected rows
|
|
31
|
+
- `search(query)` - Filter data
|
|
32
|
+
- `goToPage(page)` - Navigate pagination
|
|
33
|
+
|
|
34
|
+
**Events:**
|
|
35
|
+
- `row-click` - {row, index}
|
|
36
|
+
- `row-select` - {row, selected}
|
|
37
|
+
- `sort` - {column, direction}
|
|
38
|
+
- `page-change` - {page, pageSize}
|
|
39
|
+
|
|
40
|
+
## Column Types
|
|
41
|
+
|
|
42
|
+
15 specialized column types with formatting options:
|
|
43
|
+
|
|
44
|
+
1. **text** - Plain text
|
|
45
|
+
2. **number** - Formatted numbers (decimals, thousands separators, prefix/suffix)
|
|
46
|
+
3. **date** - Date formatting (short/medium/long/full/custom)
|
|
47
|
+
4. **boolean** - True/false with symbols or text
|
|
48
|
+
5. **currency** - Currency formatting with locale and display options
|
|
49
|
+
6. **percent** - Percentages with trends and colorization
|
|
50
|
+
7. **rating** - Star ratings with custom symbols
|
|
51
|
+
8. **progress** - Progress bars with percentage
|
|
52
|
+
9. **sparkline** - Inline charts (line/bar/area)
|
|
53
|
+
10. **accounting** - Accounting number format
|
|
54
|
+
11. **scientific** - Scientific notation
|
|
55
|
+
12. **fraction** - Fraction display
|
|
56
|
+
13. **duration** - Time durations
|
|
57
|
+
14. **filesize** - File size formatting
|
|
58
|
+
15. **custom** - Custom formatter function
|
|
59
|
+
|
|
60
|
+
## Column Definition
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
interface ColumnDefinition {
|
|
64
|
+
key: string;
|
|
65
|
+
label: string;
|
|
66
|
+
type?: ColumnType;
|
|
67
|
+
align?: 'left'|'center'|'right';
|
|
68
|
+
width?: string;
|
|
69
|
+
sortable?: boolean;
|
|
70
|
+
filterable?: boolean;
|
|
71
|
+
formatter?: (value, row) => string;
|
|
72
|
+
|
|
73
|
+
// Excel-like formatting
|
|
74
|
+
numberFormat?: NumberFormat;
|
|
75
|
+
dateFormat?: DateFormat;
|
|
76
|
+
booleanFormat?: BooleanFormat;
|
|
77
|
+
ratingFormat?: RatingFormat;
|
|
78
|
+
progressFormat?: ProgressFormat;
|
|
79
|
+
sparklineFormat?: SparklineFormat;
|
|
80
|
+
percentageFormat?: PercentageFormat;
|
|
81
|
+
currencyFormat?: CurrencyFormat;
|
|
82
|
+
|
|
83
|
+
// Additional formats
|
|
84
|
+
phoneFormat?: PhoneFormat;
|
|
85
|
+
statusFormat?: StatusFormat;
|
|
86
|
+
tagFormat?: TagFormat;
|
|
87
|
+
actionsFormat?: ActionsFormat;
|
|
88
|
+
linkFormat?: LinkFormat;
|
|
89
|
+
colorFormat?: ColorFormat;
|
|
90
|
+
emailFormat?: EmailFormat;
|
|
91
|
+
imageFormat?: ImageFormat;
|
|
92
|
+
jsonFormat?: JsonFormat;
|
|
93
|
+
locationFormat?: LocationFormat;
|
|
94
|
+
|
|
95
|
+
// Cell styling
|
|
96
|
+
style?: CellStyle;
|
|
97
|
+
conditionalFormats?: ConditionalFormat[];
|
|
98
|
+
|
|
99
|
+
// Display options
|
|
100
|
+
wrap?: boolean;
|
|
101
|
+
ellipsis?: boolean;
|
|
102
|
+
tooltip?: boolean | ((value, row) => string);
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Usage
|
|
107
|
+
|
|
108
|
+
```html
|
|
109
|
+
<!-- Basic table -->
|
|
110
|
+
<snice-table id="table"></snice-table>
|
|
111
|
+
|
|
112
|
+
<script>
|
|
113
|
+
const table = document.querySelector('#table');
|
|
114
|
+
|
|
115
|
+
table.columns = [
|
|
116
|
+
{ key: 'name', label: 'Name', sortable: true },
|
|
117
|
+
{ key: 'age', label: 'Age', type: 'number', align: 'right' },
|
|
118
|
+
{ key: 'email', label: 'Email' }
|
|
119
|
+
];
|
|
120
|
+
|
|
121
|
+
table.data = [
|
|
122
|
+
{ name: 'John', age: 30, email: 'john@example.com' },
|
|
123
|
+
{ name: 'Jane', age: 25, email: 'jane@example.com' }
|
|
124
|
+
];
|
|
125
|
+
</script>
|
|
126
|
+
|
|
127
|
+
<!-- Striped and hoverable -->
|
|
128
|
+
<snice-table striped hoverable></snice-table>
|
|
129
|
+
|
|
130
|
+
<!-- With sorting and selection -->
|
|
131
|
+
<snice-table sortable selectable></snice-table>
|
|
132
|
+
|
|
133
|
+
<!-- With pagination and search -->
|
|
134
|
+
<snice-table show-pagination show-search page-size="20"></snice-table>
|
|
135
|
+
|
|
136
|
+
<!-- Sticky header -->
|
|
137
|
+
<snice-table sticky-header></snice-table>
|
|
138
|
+
|
|
139
|
+
<!-- Advanced formatting -->
|
|
140
|
+
<script>
|
|
141
|
+
table.columns = [
|
|
142
|
+
{
|
|
143
|
+
key: 'price',
|
|
144
|
+
label: 'Price',
|
|
145
|
+
type: 'currency',
|
|
146
|
+
currencyFormat: { currency: 'USD', decimals: 2 }
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
key: 'progress',
|
|
150
|
+
label: 'Progress',
|
|
151
|
+
type: 'progress',
|
|
152
|
+
progressFormat: { max: 100, showPercentage: true }
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
key: 'rating',
|
|
156
|
+
label: 'Rating',
|
|
157
|
+
type: 'rating',
|
|
158
|
+
ratingFormat: { max: 5, symbol: '★' }
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
key: 'trend',
|
|
162
|
+
label: 'Trend',
|
|
163
|
+
type: 'sparkline',
|
|
164
|
+
sparklineFormat: { type: 'line', color: '#3b82f6' }
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
key: 'status',
|
|
168
|
+
label: 'Status',
|
|
169
|
+
type: 'boolean',
|
|
170
|
+
booleanFormat: { trueValue: 'Active', falseValue: 'Inactive', useSymbols: true }
|
|
171
|
+
}
|
|
172
|
+
];
|
|
173
|
+
</script>
|
|
174
|
+
|
|
175
|
+
<!-- Conditional formatting -->
|
|
176
|
+
<script>
|
|
177
|
+
table.columns = [
|
|
178
|
+
{
|
|
179
|
+
key: 'score',
|
|
180
|
+
label: 'Score',
|
|
181
|
+
type: 'number',
|
|
182
|
+
conditionalFormats: [
|
|
183
|
+
{
|
|
184
|
+
condition: (val) => val >= 90,
|
|
185
|
+
style: { backgroundColor: '#dcfce7', color: '#166534' }
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
condition: (val) => val < 60,
|
|
189
|
+
style: { backgroundColor: '#fee2e2', color: '#991b1b' }
|
|
190
|
+
}
|
|
191
|
+
]
|
|
192
|
+
}
|
|
193
|
+
];
|
|
194
|
+
</script>
|
|
195
|
+
|
|
196
|
+
<!-- Event handling -->
|
|
197
|
+
<script>
|
|
198
|
+
table.addEventListener('row-click', (e) => {
|
|
199
|
+
console.log('Clicked row:', e.detail.row);
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
table.addEventListener('row-select', (e) => {
|
|
203
|
+
console.log('Selected:', e.detail.selected);
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
table.addEventListener('sort', (e) => {
|
|
207
|
+
console.log('Sort by:', e.detail.column, e.detail.direction);
|
|
208
|
+
});
|
|
209
|
+
</script>
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Features
|
|
213
|
+
|
|
214
|
+
- 15 specialized column types
|
|
215
|
+
- Excel-like formatting for numbers, dates, currencies
|
|
216
|
+
- Visual formatters (progress bars, ratings, sparklines)
|
|
217
|
+
- Conditional formatting with styles
|
|
218
|
+
- Sorting and filtering
|
|
219
|
+
- Row selection
|
|
220
|
+
- Pagination and search
|
|
221
|
+
- Sticky header
|
|
222
|
+
- Custom cell formatters
|
|
223
|
+
- Tooltips and ellipsis
|
|
224
|
+
- Action buttons in cells
|
|
225
|
+
- 3 sizes and variants
|
|
226
|
+
- Loading state
|
|
227
|
+
- Responsive and accessible
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# snice-tabs
|
|
2
|
+
|
|
3
|
+
Tabbed interface with container, tab buttons, and content panels.
|
|
4
|
+
|
|
5
|
+
## Components
|
|
6
|
+
|
|
7
|
+
### snice-tabs (Container)
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
selected: number = 0; // Active tab index
|
|
11
|
+
placement: 'top'|'bottom'|'start'|'end' = 'top'; // Tab navigation position
|
|
12
|
+
noScrollControls: boolean = false; // Hide scroll buttons
|
|
13
|
+
transition: string = 'none'; // Panel transition effect
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
**Methods:**
|
|
17
|
+
```typescript
|
|
18
|
+
selectTab(index: number) // Select tab by index
|
|
19
|
+
show(index: number) // Alias for selectTab
|
|
20
|
+
getTab(index: number) // Get tab element
|
|
21
|
+
getPanel(index: number) // Get panel element
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Events:**
|
|
25
|
+
```typescript
|
|
26
|
+
'@snice/tab-change' // { index, oldIndex, tab, panel }
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### snice-tab (Tab Button)
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
disabled: boolean = false; // Disabled state
|
|
33
|
+
closable: boolean = false; // Show close button
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Methods:**
|
|
37
|
+
```typescript
|
|
38
|
+
focus() // Focus the tab
|
|
39
|
+
blur() // Remove focus
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**Events:**
|
|
43
|
+
```typescript
|
|
44
|
+
'@snice/tab-select' // { tab }
|
|
45
|
+
'@snice/close' // { tab }
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### snice-tab-panel (Content Panel)
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
name: string = ''; // Panel identifier
|
|
52
|
+
transitionIn: string = ''; // Transition when showing
|
|
53
|
+
transitionOut: string = ''; // Transition when hiding
|
|
54
|
+
transitioning: 'in'|'out'|'' = ''; // Transition state
|
|
55
|
+
transitionDuration: number = 300; // Transition duration (ms)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Usage
|
|
59
|
+
|
|
60
|
+
```html
|
|
61
|
+
<snice-tabs>
|
|
62
|
+
<snice-tab slot="nav">Tab 1</snice-tab>
|
|
63
|
+
<snice-tab slot="nav">Tab 2</snice-tab>
|
|
64
|
+
|
|
65
|
+
<snice-tab-panel>Content 1</snice-tab-panel>
|
|
66
|
+
<snice-tab-panel>Content 2</snice-tab-panel>
|
|
67
|
+
</snice-tabs>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
tabs.addEventListener('@snice/tab-change', (e) => {
|
|
72
|
+
console.log(e.detail.index);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
tabs.selectTab(1);
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Notes
|
|
79
|
+
|
|
80
|
+
- Tabs use `slot="nav"` attribute
|
|
81
|
+
- Panels in default slot
|
|
82
|
+
- Automatically manages ARIA attributes
|
|
83
|
+
- Supports keyboard navigation
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# snice-toast & snice-toast-container
|
|
2
|
+
|
|
3
|
+
Temporary notification system with static API.
|
|
4
|
+
|
|
5
|
+
## Components
|
|
6
|
+
|
|
7
|
+
### snice-toast
|
|
8
|
+
|
|
9
|
+
Individual toast notification element.
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
type: 'success'|'error'|'warning'|'info' = 'info';
|
|
13
|
+
message: string = '';
|
|
14
|
+
closable: boolean = true;
|
|
15
|
+
icon: boolean = true;
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
**Methods:**
|
|
19
|
+
- `hide()` - Start hide animation
|
|
20
|
+
|
|
21
|
+
### snice-toast-container
|
|
22
|
+
|
|
23
|
+
Manages and positions multiple toasts.
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
position: 'top-left'|'top-center'|'top-right'|'bottom-left'|'bottom-center'|'bottom-right' = 'bottom-center';
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Methods:**
|
|
30
|
+
- `show(message, options?)` - Show toast, returns ID
|
|
31
|
+
- `hide(id)` - Hide specific toast
|
|
32
|
+
- `clear()` - Remove all toasts
|
|
33
|
+
|
|
34
|
+
## Static API (Recommended)
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
import Toast from 'snice/components/toast/snice-toast-container';
|
|
38
|
+
|
|
39
|
+
// Convenience methods
|
|
40
|
+
Toast.success(message, options?): Promise<string>
|
|
41
|
+
Toast.error(message, options?): Promise<string>
|
|
42
|
+
Toast.warning(message, options?): Promise<string>
|
|
43
|
+
Toast.info(message, options?): Promise<string>
|
|
44
|
+
|
|
45
|
+
// Generic
|
|
46
|
+
Toast.show(message, options?): Promise<string>
|
|
47
|
+
|
|
48
|
+
// Control
|
|
49
|
+
Toast.hide(id): void
|
|
50
|
+
Toast.clear(): void
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Toast Options
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
interface ToastOptions {
|
|
57
|
+
type?: 'success'|'error'|'warning'|'info'; // Default: 'info'
|
|
58
|
+
duration?: number; // ms, 0 = no auto-dismiss, default: 4000
|
|
59
|
+
position?: ToastPosition; // Only for static API
|
|
60
|
+
closable?: boolean; // Default: true
|
|
61
|
+
icon?: boolean; // Default: true
|
|
62
|
+
id?: string; // Custom ID, auto-generated if omitted
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Usage
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
// Basic
|
|
70
|
+
Toast.success('Saved successfully');
|
|
71
|
+
Toast.error('Failed to load');
|
|
72
|
+
Toast.warning('Low disk space');
|
|
73
|
+
Toast.info('5 new messages');
|
|
74
|
+
|
|
75
|
+
// With options
|
|
76
|
+
Toast.show('Custom', {
|
|
77
|
+
type: 'success',
|
|
78
|
+
duration: 5000,
|
|
79
|
+
position: 'top-right',
|
|
80
|
+
closable: true,
|
|
81
|
+
icon: false
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// Manual control
|
|
85
|
+
const id = Toast.info('Loading...', { duration: 0 });
|
|
86
|
+
await operation();
|
|
87
|
+
Toast.hide(id);
|
|
88
|
+
Toast.success('Complete');
|
|
89
|
+
|
|
90
|
+
// Clear all
|
|
91
|
+
Toast.clear();
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Container Usage
|
|
95
|
+
|
|
96
|
+
```html
|
|
97
|
+
<snice-toast-container position="bottom-center"></snice-toast-container>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
const container = document.querySelector('snice-toast-container');
|
|
102
|
+
const id = container.show('Message', { type: 'success' });
|
|
103
|
+
container.hide(id);
|
|
104
|
+
container.clear();
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Features
|
|
108
|
+
|
|
109
|
+
- Auto-dismiss after duration (default 4s)
|
|
110
|
+
- 4 types with icons and colors
|
|
111
|
+
- 6 position options
|
|
112
|
+
- Slide in/out animations (300ms)
|
|
113
|
+
- Global container auto-creation
|
|
114
|
+
- Top positions prepend, bottom append
|
|
115
|
+
- Accessibility: role="alert", aria-live="polite"
|
|
116
|
+
- Close button keyboard accessible
|
|
117
|
+
|
|
118
|
+
## Patterns
|
|
119
|
+
|
|
120
|
+
**Success/Error:**
|
|
121
|
+
```typescript
|
|
122
|
+
try {
|
|
123
|
+
await action();
|
|
124
|
+
Toast.success('Done');
|
|
125
|
+
} catch (e) {
|
|
126
|
+
Toast.error(e.message);
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**Loading:**
|
|
131
|
+
```typescript
|
|
132
|
+
const id = Toast.info('Loading...', { duration: 0 });
|
|
133
|
+
await fetch();
|
|
134
|
+
Toast.hide(id);
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**Persistent:**
|
|
138
|
+
```typescript
|
|
139
|
+
Toast.show('Manual close only', { duration: 0 });
|
|
140
|
+
```
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# snice-tooltip
|
|
2
|
+
|
|
3
|
+
Contextual information on hover, click, or focus with smart positioning.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
content: string = '';
|
|
9
|
+
position: TooltipPosition = 'top';
|
|
10
|
+
trigger: 'hover'|'click'|'focus'|'manual' = 'hover';
|
|
11
|
+
delay: number = 0; // Show delay (ms)
|
|
12
|
+
hideDelay: number = 0; // Hide delay (ms)
|
|
13
|
+
offset: number = 12; // Distance from trigger (px)
|
|
14
|
+
arrow: boolean = true;
|
|
15
|
+
open: boolean = false; // For manual trigger
|
|
16
|
+
maxWidth: number = 250; // px
|
|
17
|
+
zIndex: number = 10000;
|
|
18
|
+
strictPositioning: boolean = false; // Disable auto-repositioning
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Positions
|
|
22
|
+
|
|
23
|
+
**Main (13 total):**
|
|
24
|
+
- `top`, `bottom`, `left`, `right`
|
|
25
|
+
- `top-start`, `top-end`
|
|
26
|
+
- `bottom-start`, `bottom-end`
|
|
27
|
+
- `left-start`, `left-end`
|
|
28
|
+
- `right-start`, `right-end`
|
|
29
|
+
|
|
30
|
+
## Methods
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
show() // Show tooltip
|
|
34
|
+
hide() // Hide tooltip
|
|
35
|
+
toggle() // Toggle visibility
|
|
36
|
+
updatePosition() // Recalculate position
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Usage
|
|
40
|
+
|
|
41
|
+
```html
|
|
42
|
+
<!-- Basic -->
|
|
43
|
+
<snice-tooltip content="Tooltip text">
|
|
44
|
+
<button>Hover me</button>
|
|
45
|
+
</snice-tooltip>
|
|
46
|
+
|
|
47
|
+
<!-- Position -->
|
|
48
|
+
<snice-tooltip content="Below" position="bottom">
|
|
49
|
+
<button>Button</button>
|
|
50
|
+
</snice-tooltip>
|
|
51
|
+
|
|
52
|
+
<!-- Click trigger -->
|
|
53
|
+
<snice-tooltip content="Click to toggle" trigger="click">
|
|
54
|
+
<button>Click me</button>
|
|
55
|
+
</snice-tooltip>
|
|
56
|
+
|
|
57
|
+
<!-- Focus trigger -->
|
|
58
|
+
<snice-tooltip content="Focus input" trigger="focus">
|
|
59
|
+
<input type="text">
|
|
60
|
+
</snice-tooltip>
|
|
61
|
+
|
|
62
|
+
<!-- Manual control -->
|
|
63
|
+
<snice-tooltip id="tip" content="Manual" trigger="manual">
|
|
64
|
+
<span>Element</span>
|
|
65
|
+
</snice-tooltip>
|
|
66
|
+
<button onclick="document.querySelector('#tip').open = true">Show</button>
|
|
67
|
+
|
|
68
|
+
<!-- With delay -->
|
|
69
|
+
<snice-tooltip content="Delayed" delay="500" hide-delay="200">
|
|
70
|
+
<button>Wait</button>
|
|
71
|
+
</snice-tooltip>
|
|
72
|
+
|
|
73
|
+
<!-- Custom styling -->
|
|
74
|
+
<snice-tooltip
|
|
75
|
+
content="Custom"
|
|
76
|
+
max-width="400"
|
|
77
|
+
offset="20"
|
|
78
|
+
arrow="false">
|
|
79
|
+
<button>Custom</button>
|
|
80
|
+
</snice-tooltip>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Features
|
|
84
|
+
|
|
85
|
+
- Portal rendering (appends to body)
|
|
86
|
+
- Smart viewport detection & auto-repositioning
|
|
87
|
+
- 13 position options with alignment
|
|
88
|
+
- 4 trigger modes
|
|
89
|
+
- Show/hide delays
|
|
90
|
+
- Arrow indicator
|
|
91
|
+
- Click-outside detection (click trigger)
|
|
92
|
+
- Custom max-width, offset, z-index
|
|
93
|
+
- Accessibility: role="tooltip"
|
|
94
|
+
- Focus restoration
|
|
95
|
+
|
|
96
|
+
## Patterns
|
|
97
|
+
|
|
98
|
+
**Help icon:**
|
|
99
|
+
```html
|
|
100
|
+
<snice-tooltip content="Help text">
|
|
101
|
+
<span>?</span>
|
|
102
|
+
</snice-tooltip>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**Disabled button:**
|
|
106
|
+
```html
|
|
107
|
+
<snice-tooltip content="Fill form first">
|
|
108
|
+
<span>
|
|
109
|
+
<button disabled>Submit</button>
|
|
110
|
+
</span>
|
|
111
|
+
</snice-tooltip>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**Truncated text:**
|
|
115
|
+
```html
|
|
116
|
+
<snice-tooltip content="Full text here">
|
|
117
|
+
<div class="truncated">Full text...</div>
|
|
118
|
+
</snice-tooltip>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**Programmatic:**
|
|
122
|
+
```typescript
|
|
123
|
+
const tip = document.querySelector('snice-tooltip');
|
|
124
|
+
tip.show();
|
|
125
|
+
tip.hide();
|
|
126
|
+
tip.toggle();
|
|
127
|
+
tip.updatePosition(); // After layout change
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Smart Positioning
|
|
131
|
+
|
|
132
|
+
Auto-repositions if tooltip would overflow viewport. Tries alternative positions in order:
|
|
133
|
+
- Top → Bottom → Left → Right
|
|
134
|
+
- Bottom → Top → Left → Right
|
|
135
|
+
- Left → Right → Top → Bottom
|
|
136
|
+
- Right → Left → Top → Bottom
|
|
137
|
+
|
|
138
|
+
Disable with `strict-positioning` attribute.
|
|
139
|
+
|
|
140
|
+
## Notes
|
|
141
|
+
|
|
142
|
+
- Disabled elements need wrapper span (no events)
|
|
143
|
+
- Portal created in document.body
|
|
144
|
+
- Hover doesn't work on touch devices
|
|
145
|
+
- Content should be brief (not interactive)
|
|
146
|
+
- Use `trigger="manual"` with `open` for programmatic control
|