@melodicdev/components 4.0.0 → 4.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 +4 -4
- package/assets/fonts/phosphor/phosphor.css +5 -25
- package/assets/melodic-components.css +50 -25
- package/assets/melodic-components.js +9230 -7814
- package/assets/melodic-components.js.map +1 -1
- package/assets/melodic-components.min.css +1 -21
- package/assets/melodic-components.min.js +1895 -26471
- package/lib/components/data-display/activity-feed/activity-feed-item.styles.d.ts.map +1 -1
- package/lib/components/data-display/activity-feed/activity-feed-item.styles.js +83 -78
- package/lib/components/data-display/activity-feed/activity-feed.styles.d.ts.map +1 -1
- package/lib/components/data-display/activity-feed/activity-feed.styles.js +10 -5
- package/lib/components/data-display/avatar/avatar.styles.d.ts.map +1 -1
- package/lib/components/data-display/avatar/avatar.styles.js +23 -18
- package/lib/components/data-display/badge/badge.styles.d.ts.map +1 -1
- package/lib/components/data-display/badge/badge.styles.js +54 -48
- package/lib/components/data-display/badge-group/badge-group.styles.d.ts.map +1 -1
- package/lib/components/data-display/badge-group/badge-group.styles.js +34 -29
- package/lib/components/data-display/calendar-view/calendar-view.styles.d.ts.map +1 -1
- package/lib/components/data-display/calendar-view/calendar-view.styles.js +174 -155
- package/lib/components/data-display/data-grid/data-grid.component.d.ts +43 -2
- package/lib/components/data-display/data-grid/data-grid.component.d.ts.map +1 -1
- package/lib/components/data-display/data-grid/data-grid.component.js +94 -8
- package/lib/components/data-display/data-grid/data-grid.styles.d.ts.map +1 -1
- package/lib/components/data-display/data-grid/data-grid.styles.js +139 -117
- package/lib/components/data-display/data-grid/data-grid.template.d.ts.map +1 -1
- package/lib/components/data-display/data-grid/data-grid.template.js +19 -10
- package/lib/components/data-display/data-grid/index.d.ts +1 -0
- package/lib/components/data-display/data-grid/index.d.ts.map +1 -1
- package/lib/components/data-display/list/list-item.styles.d.ts.map +1 -1
- package/lib/components/data-display/list/list-item.styles.js +40 -35
- package/lib/components/data-display/list/list.styles.d.ts.map +1 -1
- package/lib/components/data-display/list/list.styles.js +10 -5
- package/lib/components/data-display/profile-card/profile-card.styles.d.ts.map +1 -1
- package/lib/components/data-display/profile-card/profile-card.styles.js +71 -66
- package/lib/components/data-display/stat-card/stat-card.styles.d.ts.map +1 -1
- package/lib/components/data-display/stat-card/stat-card.styles.js +67 -63
- package/lib/components/data-display/table/index.d.ts +1 -0
- package/lib/components/data-display/table/index.d.ts.map +1 -1
- package/lib/components/data-display/table/table.component.d.ts +16 -0
- package/lib/components/data-display/table/table.component.d.ts.map +1 -1
- package/lib/components/data-display/table/table.component.js +28 -3
- package/lib/components/data-display/table/table.styles.d.ts.map +1 -1
- package/lib/components/data-display/table/table.styles.js +101 -90
- package/lib/components/data-display/table/table.template.d.ts.map +1 -1
- package/lib/components/data-display/table/table.template.js +8 -6
- package/lib/components/data-display/table-core/index.d.ts +2 -2
- package/lib/components/data-display/table-core/index.d.ts.map +1 -1
- package/lib/components/data-display/table-core/index.js +1 -1
- package/lib/components/data-display/table-core/table-core.d.ts +16 -2
- package/lib/components/data-display/table-core/table-core.d.ts.map +1 -1
- package/lib/components/data-display/table-core/table-core.js +32 -5
- package/lib/components/data-display/tag/tag.styles.d.ts.map +1 -1
- package/lib/components/data-display/tag/tag.styles.js +78 -66
- package/lib/components/feedback/alert/alert.styles.d.ts.map +1 -1
- package/lib/components/feedback/alert/alert.styles.js +89 -76
- package/lib/components/feedback/progress/progress.styles.d.ts.map +1 -1
- package/lib/components/feedback/progress/progress.styles.js +110 -106
- package/lib/components/feedback/spinner/spinner.styles.d.ts.map +1 -1
- package/lib/components/feedback/spinner/spinner.styles.js +18 -13
- package/lib/components/feedback/toast/index.d.ts +1 -0
- package/lib/components/feedback/toast/index.d.ts.map +1 -1
- package/lib/components/feedback/toast/toast-container.styles.d.ts.map +1 -1
- package/lib/components/feedback/toast/toast-container.styles.js +20 -0
- package/lib/components/feedback/toast/toast.component.d.ts +16 -0
- package/lib/components/feedback/toast/toast.component.d.ts.map +1 -1
- package/lib/components/feedback/toast/toast.component.js +63 -5
- package/lib/components/feedback/toast/toast.service.d.ts +14 -0
- package/lib/components/feedback/toast/toast.service.d.ts.map +1 -1
- package/lib/components/feedback/toast/toast.service.js +41 -0
- package/lib/components/feedback/toast/toast.styles.d.ts.map +1 -1
- package/lib/components/feedback/toast/toast.styles.js +80 -69
- package/lib/components/feedback/toast/toast.template.js +1 -1
- package/lib/components/forms/autocomplete/autocomplete.component.d.ts +14 -4
- package/lib/components/forms/autocomplete/autocomplete.component.d.ts.map +1 -1
- package/lib/components/forms/autocomplete/autocomplete.component.js +40 -96
- package/lib/components/forms/autocomplete/autocomplete.styles.d.ts.map +1 -1
- package/lib/components/forms/autocomplete/autocomplete.styles.js +191 -170
- package/lib/components/forms/autocomplete/autocomplete.template.js +7 -1
- package/lib/components/forms/button/button.styles.d.ts.map +1 -1
- package/lib/components/forms/button/button.styles.js +73 -57
- package/lib/components/forms/button-group/button-group-item.styles.d.ts.map +1 -1
- package/lib/components/forms/button-group/button-group-item.styles.js +11 -0
- package/lib/components/forms/button-group/button-group.styles.d.ts.map +1 -1
- package/lib/components/forms/button-group/button-group.styles.js +24 -19
- package/lib/components/forms/checkbox/checkbox.styles.d.ts.map +1 -1
- package/lib/components/forms/checkbox/checkbox.styles.js +94 -78
- package/lib/components/forms/date-picker/calendar.component.d.ts +20 -7
- package/lib/components/forms/date-picker/calendar.component.d.ts.map +1 -1
- package/lib/components/forms/date-picker/calendar.component.js +88 -13
- package/lib/components/forms/date-picker/calendar.styles.d.ts.map +1 -1
- package/lib/components/forms/date-picker/calendar.styles.js +171 -147
- package/lib/components/forms/date-picker/date-picker.component.d.ts +2 -3
- package/lib/components/forms/date-picker/date-picker.component.d.ts.map +1 -1
- package/lib/components/forms/date-picker/date-picker.component.js +70 -18
- package/lib/components/forms/date-picker/date-picker.styles.d.ts.map +1 -1
- package/lib/components/forms/date-picker/date-picker.styles.js +109 -92
- package/lib/components/forms/date-time-picker/date-time-picker.styles.d.ts.map +1 -1
- package/lib/components/forms/date-time-picker/date-time-picker.styles.js +99 -83
- package/lib/components/forms/date-time-picker/tz-utils.d.ts.map +1 -1
- package/lib/components/forms/date-time-picker/tz-utils.js +24 -3
- package/lib/components/forms/file-upload/file-upload-item.styles.d.ts.map +1 -1
- package/lib/components/forms/file-upload/file-upload-item.styles.js +13 -1
- package/lib/components/forms/file-upload/file-upload.styles.d.ts.map +1 -1
- package/lib/components/forms/file-upload/file-upload.styles.js +108 -92
- package/lib/components/forms/form-field/form-field.component.d.ts +18 -1
- package/lib/components/forms/form-field/form-field.component.d.ts.map +1 -1
- package/lib/components/forms/form-field/form-field.component.js +55 -16
- package/lib/components/forms/form-field/form-field.styles.d.ts.map +1 -1
- package/lib/components/forms/form-field/form-field.styles.js +92 -74
- package/lib/components/forms/input/input.styles.d.ts.map +1 -1
- package/lib/components/forms/input/input.styles.js +98 -82
- package/lib/components/forms/listbox-core/index.d.ts +3 -0
- package/lib/components/forms/listbox-core/index.d.ts.map +1 -0
- package/lib/components/forms/listbox-core/index.js +2 -0
- package/lib/components/forms/listbox-core/listbox-core.d.ts +57 -0
- package/lib/components/forms/listbox-core/listbox-core.d.ts.map +1 -0
- package/lib/components/forms/listbox-core/listbox-core.js +168 -0
- package/lib/components/forms/radio/radio-group.styles.js +1 -1
- package/lib/components/forms/radio/radio.styles.d.ts.map +1 -1
- package/lib/components/forms/radio/radio.styles.js +89 -73
- package/lib/components/forms/radio-card-group/radio-card-group.styles.d.ts.map +1 -1
- package/lib/components/forms/radio-card-group/radio-card-group.styles.js +40 -35
- package/lib/components/forms/radio-card-group/radio-card.styles.d.ts.map +1 -1
- package/lib/components/forms/radio-card-group/radio-card.styles.js +124 -108
- package/lib/components/forms/select/select.component.d.ts +12 -4
- package/lib/components/forms/select/select.component.d.ts.map +1 -1
- package/lib/components/forms/select/select.component.js +41 -110
- package/lib/components/forms/select/select.styles.d.ts.map +1 -1
- package/lib/components/forms/select/select.styles.js +181 -159
- package/lib/components/forms/select/select.template.d.ts.map +1 -1
- package/lib/components/forms/select/select.template.js +25 -9
- package/lib/components/forms/slider/slider.component.js +1 -1
- package/lib/components/forms/slider/slider.styles.d.ts.map +1 -1
- package/lib/components/forms/slider/slider.styles.js +93 -77
- package/lib/components/forms/slider/slider.template.d.ts.map +1 -1
- package/lib/components/forms/slider/slider.template.js +5 -1
- package/lib/components/forms/textarea/textarea.styles.d.ts.map +1 -1
- package/lib/components/forms/textarea/textarea.styles.js +97 -81
- package/lib/components/forms/time-picker/time-picker.component.d.ts +1 -2
- package/lib/components/forms/time-picker/time-picker.component.d.ts.map +1 -1
- package/lib/components/forms/time-picker/time-picker.component.js +8 -17
- package/lib/components/forms/time-picker/time-picker.styles.d.ts.map +1 -1
- package/lib/components/forms/time-picker/time-picker.styles.js +220 -194
- package/lib/components/forms/toggle/toggle.styles.d.ts.map +1 -1
- package/lib/components/forms/toggle/toggle.styles.js +95 -79
- package/lib/components/foundation/card/card.styles.d.ts.map +1 -1
- package/lib/components/foundation/card/card.styles.js +62 -46
- package/lib/components/foundation/container/container.styles.d.ts.map +1 -1
- package/lib/components/foundation/container/container.styles.js +15 -10
- package/lib/components/foundation/divider/divider.styles.d.ts.map +1 -1
- package/lib/components/foundation/divider/divider.styles.js +29 -24
- package/lib/components/foundation/stack/stack.styles.d.ts.map +1 -1
- package/lib/components/foundation/stack/stack.styles.js +16 -10
- package/lib/components/general/icon/icon.styles.d.ts.map +1 -1
- package/lib/components/general/icon/icon.styles.js +12 -8
- package/lib/components/navigation/breadcrumb/breadcrumb-item.template.d.ts.map +1 -1
- package/lib/components/navigation/breadcrumb/breadcrumb-item.template.js +5 -3
- package/lib/components/navigation/breadcrumb/breadcrumb.styles.d.ts.map +1 -1
- package/lib/components/navigation/breadcrumb/breadcrumb.styles.js +9 -4
- package/lib/components/navigation/pagination/pagination.styles.d.ts.map +1 -1
- package/lib/components/navigation/pagination/pagination.styles.js +74 -69
- package/lib/components/navigation/sidebar/sidebar-group.styles.d.ts.map +1 -1
- package/lib/components/navigation/sidebar/sidebar-group.styles.js +23 -18
- package/lib/components/navigation/sidebar/sidebar-item.styles.d.ts.map +1 -1
- package/lib/components/navigation/sidebar/sidebar-item.styles.js +105 -100
- package/lib/components/navigation/sidebar/sidebar-item.template.js +2 -2
- package/lib/components/navigation/sidebar/sidebar.styles.d.ts.map +1 -1
- package/lib/components/navigation/sidebar/sidebar.styles.js +180 -175
- package/lib/components/navigation/sidebar/sidebar.template.js +2 -2
- package/lib/components/navigation/steps/step.styles.d.ts.map +1 -1
- package/lib/components/navigation/steps/step.styles.js +155 -150
- package/lib/components/navigation/steps/steps.styles.d.ts.map +1 -1
- package/lib/components/navigation/steps/steps.styles.js +175 -170
- package/lib/components/navigation/tabs/tab-panel.styles.d.ts.map +1 -1
- package/lib/components/navigation/tabs/tab-panel.styles.js +12 -7
- package/lib/components/navigation/tabs/tab.styles.d.ts.map +1 -1
- package/lib/components/navigation/tabs/tab.styles.js +41 -36
- package/lib/components/navigation/tabs/tabs.component.d.ts.map +1 -1
- package/lib/components/navigation/tabs/tabs.component.js +4 -1
- package/lib/components/navigation/tabs/tabs.styles.d.ts.map +1 -1
- package/lib/components/navigation/tabs/tabs.styles.js +134 -129
- package/lib/components/overlays/dialog/dialog.component.d.ts +15 -2
- package/lib/components/overlays/dialog/dialog.component.d.ts.map +1 -1
- package/lib/components/overlays/dialog/dialog.component.js +33 -1
- package/lib/components/overlays/dialog/dialog.service.d.ts +8 -2
- package/lib/components/overlays/dialog/dialog.service.d.ts.map +1 -1
- package/lib/components/overlays/dialog/dialog.service.js +1 -0
- package/lib/components/overlays/dialog/dialog.styles.d.ts.map +1 -1
- package/lib/components/overlays/dialog/dialog.styles.js +78 -73
- package/lib/components/overlays/dialog/index.d.ts +1 -0
- package/lib/components/overlays/dialog/index.d.ts.map +1 -1
- package/lib/components/overlays/drawer/drawer.component.d.ts +18 -3
- package/lib/components/overlays/drawer/drawer.component.d.ts.map +1 -1
- package/lib/components/overlays/drawer/drawer.component.js +59 -16
- package/lib/components/overlays/drawer/drawer.styles.d.ts.map +1 -1
- package/lib/components/overlays/drawer/drawer.styles.js +82 -77
- package/lib/components/overlays/dropdown/dropdown-item.styles.d.ts.map +1 -1
- package/lib/components/overlays/dropdown/dropdown-item.styles.js +60 -43
- package/lib/components/overlays/dropdown/dropdown.styles.d.ts.map +1 -1
- package/lib/components/overlays/dropdown/dropdown.styles.js +35 -30
- package/lib/components/overlays/popover/popover.component.d.ts +12 -0
- package/lib/components/overlays/popover/popover.component.d.ts.map +1 -1
- package/lib/components/overlays/popover/popover.component.js +28 -1
- package/lib/components/overlays/popover/popover.styles.d.ts.map +1 -1
- package/lib/components/overlays/popover/popover.styles.js +36 -31
- package/lib/components/overlays/popover/popover.template.d.ts.map +1 -1
- package/lib/components/overlays/popover/popover.template.js +2 -0
- package/lib/components/overlays/tooltip/tooltip.component.d.ts +8 -5
- package/lib/components/overlays/tooltip/tooltip.component.d.ts.map +1 -1
- package/lib/components/overlays/tooltip/tooltip.component.js +10 -3
- package/lib/components/overlays/tooltip/tooltip.styles.d.ts.map +1 -1
- package/lib/components/overlays/tooltip/tooltip.styles.js +34 -28
- package/lib/components/pages/auth/auth-layout.styles.d.ts +1 -1
- package/lib/components/pages/auth/auth-layout.styles.d.ts.map +1 -1
- package/lib/components/pages/auth/auth-layout.styles.js +86 -81
- package/lib/components/pages/dashboard/dashboard-page.styles.d.ts.map +1 -1
- package/lib/components/pages/dashboard/dashboard-page.styles.js +39 -34
- package/lib/components/sections/app-shell/app-shell.styles.d.ts.map +1 -1
- package/lib/components/sections/app-shell/app-shell.styles.js +63 -57
- package/lib/components/sections/hero/hero-section.styles.js +97 -97
- package/lib/components/sections/page-header/page-header.styles.d.ts.map +1 -1
- package/lib/components/sections/page-header/page-header.styles.js +69 -64
- package/lib/components/sections/page-section/page-section.styles.d.ts.map +1 -1
- package/lib/components/sections/page-section/page-section.styles.js +56 -51
- package/lib/directives/tooltip.directive.d.ts.map +1 -1
- package/lib/directives/tooltip.directive.js +22 -3
- package/lib/theme/presets/base.preset.d.ts.map +1 -1
- package/lib/theme/presets/base.preset.js +17 -0
- package/lib/theme/presets/dark.preset.d.ts +8 -0
- package/lib/theme/presets/dark.preset.d.ts.map +1 -1
- package/lib/theme/presets/dark.preset.js +9 -0
- package/lib/theme/presets/light.preset.d.ts +6 -0
- package/lib/theme/presets/light.preset.d.ts.map +1 -1
- package/lib/theme/presets/light.preset.js +7 -0
- package/lib/theme/tokens/all-tokens.d.ts +10 -0
- package/lib/theme/tokens/all-tokens.d.ts.map +1 -1
- package/lib/theme/tokens/colors.tokens.d.ts +8 -0
- package/lib/theme/tokens/colors.tokens.d.ts.map +1 -1
- package/lib/theme/tokens/colors.tokens.js +11 -0
- package/lib/theme/tokens/transitions.tokens.d.ts +1 -0
- package/lib/theme/tokens/transitions.tokens.d.ts.map +1 -1
- package/lib/theme/tokens/transitions.tokens.js +3 -0
- package/lib/theme/tokens/typography.tokens.d.ts +1 -0
- package/lib/theme/tokens/typography.tokens.d.ts.map +1 -1
- package/lib/theme/tokens/typography.tokens.js +1 -0
- package/lib/utils/accessibility/cross-root-aria.d.ts +16 -8
- package/lib/utils/accessibility/cross-root-aria.d.ts.map +1 -1
- package/lib/utils/accessibility/cross-root-aria.js +58 -22
- package/lib/utils/accessibility/focus-trap.d.ts.map +1 -1
- package/lib/utils/accessibility/focus-trap.js +9 -19
- package/lib/utils/accessibility/focus-utils.d.ts +10 -1
- package/lib/utils/accessibility/focus-utils.d.ts.map +1 -1
- package/lib/utils/accessibility/focus-utils.js +48 -14
- package/lib/utils/accessibility/index.d.ts +2 -1
- package/lib/utils/accessibility/index.d.ts.map +1 -1
- package/lib/utils/accessibility/index.js +1 -1
- package/lib/utils/positioning/compute-position.d.ts +6 -1
- package/lib/utils/positioning/compute-position.d.ts.map +1 -1
- package/lib/utils/positioning/compute-position.js +3 -2
- package/lib/utils/positioning/middlewares/flip.middleware.js +2 -51
- package/package.json +8 -5
- package/assets/fonts/phosphor/Phosphor-Bold.svg +0 -3057
- package/assets/fonts/phosphor/Phosphor-Bold.ttf +0 -0
- package/assets/fonts/phosphor/Phosphor-Bold.woff +0 -0
- package/assets/fonts/phosphor/Phosphor-Fill.svg +0 -3057
- package/assets/fonts/phosphor/Phosphor-Fill.ttf +0 -0
- package/assets/fonts/phosphor/Phosphor-Fill.woff +0 -0
- package/assets/fonts/phosphor/Phosphor-Light.svg +0 -3057
- package/assets/fonts/phosphor/Phosphor-Light.ttf +0 -0
- package/assets/fonts/phosphor/Phosphor-Light.woff +0 -0
- package/assets/fonts/phosphor/Phosphor-Thin.svg +0 -3057
- package/assets/fonts/phosphor/Phosphor-Thin.ttf +0 -0
- package/assets/fonts/phosphor/Phosphor-Thin.woff +0 -0
- package/assets/fonts/phosphor/Phosphor.svg +0 -3056
- package/assets/fonts/phosphor/Phosphor.ttf +0 -0
- package/assets/fonts/phosphor/Phosphor.woff +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/feedback/toast/toast.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"toast.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/feedback/toast/toast.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,iDAkJvB,CAAC"}
|
|
@@ -1,64 +1,75 @@
|
|
|
1
1
|
import { css } from '@melodicdev/core';
|
|
2
2
|
export const toastStyles = () => css `
|
|
3
|
+
/*
|
|
4
|
+
* Tokens. Rules read each one with its default as the var() fallback,
|
|
5
|
+
* so a value set on the element or inherited from any ancestor wins.
|
|
6
|
+
*
|
|
7
|
+
* Background & border
|
|
8
|
+
* --ml-toast-bg: var(--ml-color-surface)
|
|
9
|
+
* --ml-toast-border-color: var(--ml-color-border)
|
|
10
|
+
* --ml-toast-border-radius: var(--ml-radius-lg)
|
|
11
|
+
* --ml-toast-shadow: var(--ml-shadow-lg)
|
|
12
|
+
*
|
|
13
|
+
* Spacing
|
|
14
|
+
* --ml-toast-gap: var(--ml-space-3)
|
|
15
|
+
* --ml-toast-padding: var(--ml-space-4)
|
|
16
|
+
* --ml-toast-min-width: 320px
|
|
17
|
+
* --ml-toast-max-width: 420px
|
|
18
|
+
*
|
|
19
|
+
* Title
|
|
20
|
+
* --ml-toast-title-font-size: var(--ml-text-sm)
|
|
21
|
+
* --ml-toast-title-font-weight: var(--ml-font-semibold)
|
|
22
|
+
* --ml-toast-title-color: var(--ml-color-text)
|
|
23
|
+
* --ml-toast-title-line-height: var(--ml-leading-tight)
|
|
24
|
+
*
|
|
25
|
+
* Message
|
|
26
|
+
* --ml-toast-message-font-size: var(--ml-text-sm)
|
|
27
|
+
* --ml-toast-message-color: var(--ml-color-text-secondary)
|
|
28
|
+
* --ml-toast-message-line-height: var(--ml-leading-relaxed)
|
|
29
|
+
* --ml-toast-message-margin-top: var(--ml-space-1)
|
|
30
|
+
*
|
|
31
|
+
* Icon variant colors
|
|
32
|
+
* --ml-toast-info-icon-color: var(--ml-color-primary)
|
|
33
|
+
* --ml-toast-success-icon-color: var(--ml-color-success)
|
|
34
|
+
* --ml-toast-warning-icon-color: var(--ml-color-warning)
|
|
35
|
+
* --ml-toast-error-icon-color: var(--ml-color-danger)
|
|
36
|
+
*
|
|
37
|
+
* Dismiss button
|
|
38
|
+
* --ml-toast-dismiss-border-radius: var(--ml-radius-sm)
|
|
39
|
+
* --ml-toast-dismiss-color: var(--ml-color-text-tertiary)
|
|
40
|
+
* --ml-toast-dismiss-hover-color: var(--ml-color-text)
|
|
41
|
+
*
|
|
42
|
+
* Transition
|
|
43
|
+
* --ml-toast-transition-duration: var(--ml-duration-150)
|
|
44
|
+
* --ml-toast-transition-easing: var(--ml-ease-in-out)
|
|
45
|
+
*
|
|
46
|
+
* Animation
|
|
47
|
+
* --ml-toast-animation-duration: var(--ml-duration-300)
|
|
48
|
+
* --ml-toast-animation-easing: var(--ml-ease-out)
|
|
49
|
+
*/
|
|
50
|
+
|
|
3
51
|
:host {
|
|
4
52
|
display: block;
|
|
5
|
-
|
|
6
|
-
/* Background & border */
|
|
7
|
-
--ml-toast-bg: var(--ml-color-surface);
|
|
8
|
-
--ml-toast-border-color: var(--ml-color-border);
|
|
9
|
-
--ml-toast-border-radius: var(--ml-radius-lg);
|
|
10
|
-
--ml-toast-shadow: var(--ml-shadow-lg);
|
|
11
|
-
|
|
12
|
-
/* Spacing */
|
|
13
|
-
--ml-toast-gap: var(--ml-space-3);
|
|
14
|
-
--ml-toast-padding: var(--ml-space-4);
|
|
15
|
-
--ml-toast-min-width: 320px;
|
|
16
|
-
--ml-toast-max-width: 420px;
|
|
17
|
-
|
|
18
|
-
/* Title */
|
|
19
|
-
--ml-toast-title-font-size: var(--ml-text-sm);
|
|
20
|
-
--ml-toast-title-font-weight: var(--ml-font-semibold);
|
|
21
|
-
--ml-toast-title-color: var(--ml-color-text);
|
|
22
|
-
--ml-toast-title-line-height: var(--ml-leading-tight);
|
|
23
|
-
|
|
24
|
-
/* Message */
|
|
25
|
-
--ml-toast-message-font-size: var(--ml-text-sm);
|
|
26
|
-
--ml-toast-message-color: var(--ml-color-text-secondary);
|
|
27
|
-
--ml-toast-message-line-height: var(--ml-leading-relaxed);
|
|
28
|
-
--ml-toast-message-margin-top: var(--ml-space-1);
|
|
29
|
-
|
|
30
|
-
/* Icon variant colors */
|
|
31
|
-
--ml-toast-info-icon-color: var(--ml-color-primary);
|
|
32
|
-
--ml-toast-success-icon-color: var(--ml-color-success);
|
|
33
|
-
--ml-toast-warning-icon-color: var(--ml-color-warning);
|
|
34
|
-
--ml-toast-error-icon-color: var(--ml-color-danger);
|
|
35
|
-
|
|
36
|
-
/* Dismiss button */
|
|
37
|
-
--ml-toast-dismiss-border-radius: var(--ml-radius-sm);
|
|
38
|
-
--ml-toast-dismiss-color: var(--ml-color-text-tertiary);
|
|
39
|
-
--ml-toast-dismiss-hover-color: var(--ml-color-text);
|
|
40
|
-
|
|
41
|
-
/* Transition */
|
|
42
|
-
--ml-toast-transition-duration: var(--ml-duration-150);
|
|
43
|
-
--ml-toast-transition-easing: var(--ml-ease-in-out);
|
|
44
|
-
|
|
45
|
-
/* Animation */
|
|
46
|
-
--ml-toast-animation-duration: var(--ml-duration-300);
|
|
47
|
-
--ml-toast-animation-easing: var(--ml-ease-out);
|
|
48
53
|
}
|
|
49
54
|
|
|
50
55
|
.ml-toast {
|
|
51
56
|
display: flex;
|
|
52
57
|
align-items: flex-start;
|
|
53
|
-
gap: var(--ml-toast-gap);
|
|
54
|
-
padding: var(--ml-toast-padding);
|
|
55
|
-
background-color: var(--ml-toast-bg);
|
|
56
|
-
border: 1px solid var(--ml-toast-border-color);
|
|
57
|
-
border-radius: var(--ml-toast-border-radius);
|
|
58
|
-
box-shadow: var(--ml-toast-shadow);
|
|
59
|
-
min-width: var(--ml-toast-min-width);
|
|
60
|
-
max-width: var(--ml-toast-max-width);
|
|
61
|
-
animation: ml-toast-in var(--ml-toast-animation-duration) var(--ml-toast-animation-easing);
|
|
58
|
+
gap: var(--ml-toast-gap, var(--ml-space-3));
|
|
59
|
+
padding: var(--ml-toast-padding, var(--ml-space-4));
|
|
60
|
+
background-color: var(--ml-toast-bg, var(--ml-color-surface));
|
|
61
|
+
border: 1px solid var(--ml-toast-border-color, var(--ml-color-border));
|
|
62
|
+
border-radius: var(--ml-toast-border-radius, var(--ml-radius-lg));
|
|
63
|
+
box-shadow: var(--ml-toast-shadow, var(--ml-shadow-lg));
|
|
64
|
+
min-width: var(--ml-toast-min-width, 320px);
|
|
65
|
+
max-width: var(--ml-toast-max-width, 420px);
|
|
66
|
+
animation: ml-toast-in var(--ml-toast-animation-duration, var(--ml-duration-300)) var(--ml-toast-animation-easing, var(--ml-ease-out));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@media (prefers-reduced-motion: reduce) {
|
|
70
|
+
.ml-toast {
|
|
71
|
+
animation: none;
|
|
72
|
+
}
|
|
62
73
|
}
|
|
63
74
|
|
|
64
75
|
@keyframes ml-toast-in {
|
|
@@ -79,19 +90,19 @@ export const toastStyles = () => css `
|
|
|
79
90
|
}
|
|
80
91
|
|
|
81
92
|
.ml-toast--info .ml-toast__icon {
|
|
82
|
-
color: var(--ml-toast-info-icon-color);
|
|
93
|
+
color: var(--ml-toast-info-icon-color, var(--ml-color-primary));
|
|
83
94
|
}
|
|
84
95
|
|
|
85
96
|
.ml-toast--success .ml-toast__icon {
|
|
86
|
-
color: var(--ml-toast-success-icon-color);
|
|
97
|
+
color: var(--ml-toast-success-icon-color, var(--ml-color-success));
|
|
87
98
|
}
|
|
88
99
|
|
|
89
100
|
.ml-toast--warning .ml-toast__icon {
|
|
90
|
-
color: var(--ml-toast-warning-icon-color);
|
|
101
|
+
color: var(--ml-toast-warning-icon-color, var(--ml-color-warning));
|
|
91
102
|
}
|
|
92
103
|
|
|
93
104
|
.ml-toast--error .ml-toast__icon {
|
|
94
|
-
color: var(--ml-toast-error-icon-color);
|
|
105
|
+
color: var(--ml-toast-error-icon-color, var(--ml-color-danger));
|
|
95
106
|
}
|
|
96
107
|
|
|
97
108
|
.ml-toast__content {
|
|
@@ -100,21 +111,21 @@ export const toastStyles = () => css `
|
|
|
100
111
|
}
|
|
101
112
|
|
|
102
113
|
.ml-toast__title {
|
|
103
|
-
font-size: var(--ml-toast-title-font-size);
|
|
104
|
-
font-weight: var(--ml-toast-title-font-weight);
|
|
105
|
-
color: var(--ml-toast-title-color);
|
|
106
|
-
line-height: var(--ml-toast-title-line-height);
|
|
114
|
+
font-size: var(--ml-toast-title-font-size, var(--ml-text-sm));
|
|
115
|
+
font-weight: var(--ml-toast-title-font-weight, var(--ml-font-semibold));
|
|
116
|
+
color: var(--ml-toast-title-color, var(--ml-color-text));
|
|
117
|
+
line-height: var(--ml-toast-title-line-height, var(--ml-leading-tight));
|
|
107
118
|
}
|
|
108
119
|
|
|
109
120
|
.ml-toast__message {
|
|
110
|
-
font-size: var(--ml-toast-message-font-size);
|
|
111
|
-
color: var(--ml-toast-message-color);
|
|
112
|
-
line-height: var(--ml-toast-message-line-height);
|
|
113
|
-
margin-top: var(--ml-toast-message-margin-top);
|
|
121
|
+
font-size: var(--ml-toast-message-font-size, var(--ml-text-sm));
|
|
122
|
+
color: var(--ml-toast-message-color, var(--ml-color-text-secondary));
|
|
123
|
+
line-height: var(--ml-toast-message-line-height, var(--ml-leading-relaxed));
|
|
124
|
+
margin-top: var(--ml-toast-message-margin-top, var(--ml-space-1));
|
|
114
125
|
}
|
|
115
126
|
|
|
116
127
|
.ml-toast__title + .ml-toast__message {
|
|
117
|
-
margin-top: var(--ml-toast-message-margin-top);
|
|
128
|
+
margin-top: var(--ml-toast-message-margin-top, var(--ml-space-1));
|
|
118
129
|
}
|
|
119
130
|
|
|
120
131
|
.ml-toast__dismiss {
|
|
@@ -125,13 +136,13 @@ export const toastStyles = () => css `
|
|
|
125
136
|
padding: 0;
|
|
126
137
|
background: none;
|
|
127
138
|
border: none;
|
|
128
|
-
border-radius: var(--ml-toast-dismiss-border-radius);
|
|
139
|
+
border-radius: var(--ml-toast-dismiss-border-radius, var(--ml-radius-sm));
|
|
129
140
|
cursor: pointer;
|
|
130
|
-
color: var(--ml-toast-dismiss-color);
|
|
131
|
-
transition: color var(--ml-toast-transition-duration) var(--ml-toast-transition-easing);
|
|
141
|
+
color: var(--ml-toast-dismiss-color, var(--ml-color-text-tertiary));
|
|
142
|
+
transition: color var(--ml-toast-transition-duration, var(--ml-duration-150)) var(--ml-toast-transition-easing, var(--ml-ease-in-out));
|
|
132
143
|
}
|
|
133
144
|
|
|
134
145
|
.ml-toast__dismiss:hover {
|
|
135
|
-
color: var(--ml-toast-dismiss-hover-color);
|
|
146
|
+
color: var(--ml-toast-dismiss-hover-color, var(--ml-color-text));
|
|
136
147
|
}
|
|
137
148
|
`;
|
|
@@ -81,10 +81,11 @@ export declare class AutocompleteComponent implements IElementRef, OnCreate, OnD
|
|
|
81
81
|
private readonly _positioner;
|
|
82
82
|
private _debounceTimer;
|
|
83
83
|
private _searchGeneration;
|
|
84
|
-
|
|
84
|
+
/** Keeps value / values / multiple consistent (shared with ml-select). */
|
|
85
|
+
private readonly _valueSync;
|
|
85
86
|
onCreate(): void;
|
|
86
87
|
onDestroy(): void;
|
|
87
|
-
onPropertyChange(name: string): void;
|
|
88
|
+
onPropertyChange(name: string, _: unknown, newValue: unknown): void;
|
|
88
89
|
/** Get the selected option (single mode) */
|
|
89
90
|
get selectedOption(): AutocompleteOption | undefined;
|
|
90
91
|
/** Get selected options (multi mode) */
|
|
@@ -94,6 +95,12 @@ export declare class AutocompleteComponent implements IElementRef, OnCreate, OnD
|
|
|
94
95
|
/** Filtered options for display */
|
|
95
96
|
get filteredOptions(): AutocompleteOption[];
|
|
96
97
|
get hasValue(): boolean;
|
|
98
|
+
/** Unique id of the error element (for aria-describedby) */
|
|
99
|
+
get errorId(): string;
|
|
100
|
+
/** Unique id of the hint element (for aria-describedby) */
|
|
101
|
+
get hintId(): string;
|
|
102
|
+
/** Id of the message that describes the input, or undefined when there is none. */
|
|
103
|
+
get describedBy(): string | undefined;
|
|
97
104
|
/** Unique id of the listbox element (for aria-controls) */
|
|
98
105
|
get listboxId(): string;
|
|
99
106
|
/** Unique id for the option at the given display index */
|
|
@@ -139,10 +146,13 @@ export declare class AutocompleteComponent implements IElementRef, OnCreate, OnD
|
|
|
139
146
|
private stopPositioning;
|
|
140
147
|
private getDropdownEl;
|
|
141
148
|
private onKeyDown;
|
|
149
|
+
/**
|
|
150
|
+
* Keep the keyboard-focused option visible. Arrowing past the visible
|
|
151
|
+
* part of a long list used to move the highlight out of view.
|
|
152
|
+
*/
|
|
153
|
+
private scrollFocusedOptionIntoView;
|
|
142
154
|
private focusNextOption;
|
|
143
155
|
private focusPreviousOption;
|
|
144
156
|
private findFirstEnabledIndex;
|
|
145
|
-
private updateValues;
|
|
146
|
-
private areValuesEqual;
|
|
147
157
|
}
|
|
148
158
|
//# sourceMappingURL=autocomplete.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/autocomplete/autocomplete.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"autocomplete.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/autocomplete/autocomplete.component.ts"],"names":[],"mappings":"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"}
|
|
@@ -5,27 +5,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { MelodicComponent } from '@melodicdev/core';
|
|
8
|
-
import { registerAdapter } from '@melodicdev/core/forms';
|
|
9
8
|
import { OverlayPositioner } from '../../../utils/overlay/index.js';
|
|
10
9
|
import { newID } from '../../../functions/index.js';
|
|
10
|
+
import { ListboxValueSync, registerListboxAdapter, findNextEnabledIndex, findPreviousEnabledIndex, findFirstEnabledIndex as firstEnabledIndex, scrollOptionIntoView } from '../listbox-core/index.js';
|
|
11
11
|
import { autocompleteTemplate } from './autocomplete.template.js';
|
|
12
12
|
import { autocompleteStyles } from './autocomplete.styles.js';
|
|
13
|
-
|
|
14
|
-
inputEvent: 'ml:change',
|
|
15
|
-
blurEvent: 'focusout',
|
|
16
|
-
getValue: (el) => {
|
|
17
|
-
const e = el;
|
|
18
|
-
return e.multiple ? (e.values ?? []) : (e.value ?? '');
|
|
19
|
-
},
|
|
20
|
-
setValue: (el, value) => {
|
|
21
|
-
const e = el;
|
|
22
|
-
if (Array.isArray(value))
|
|
23
|
-
e.values = value;
|
|
24
|
-
else
|
|
25
|
-
e.value = value !== null && value !== undefined ? String(value) : '';
|
|
26
|
-
},
|
|
27
|
-
setDisabled: (el, disabled) => { el.disabled = disabled; }
|
|
28
|
-
});
|
|
13
|
+
registerListboxAdapter('ML-AUTOCOMPLETE');
|
|
29
14
|
/**
|
|
30
15
|
* ml-autocomplete - Typeahead/autocomplete form component
|
|
31
16
|
*
|
|
@@ -110,7 +95,8 @@ let AutocompleteComponent = class AutocompleteComponent {
|
|
|
110
95
|
}));
|
|
111
96
|
this._debounceTimer = null;
|
|
112
97
|
this._searchGeneration = 0;
|
|
113
|
-
|
|
98
|
+
/** Keeps value / values / multiple consistent (shared with ml-select). */
|
|
99
|
+
this._valueSync = new ListboxValueSync(this);
|
|
114
100
|
/** Unique id for the option at the given display index */
|
|
115
101
|
this.optionId = (index) => {
|
|
116
102
|
return `${this.listboxId}-option-${index}`;
|
|
@@ -278,53 +264,8 @@ let AutocompleteComponent = class AutocompleteComponent {
|
|
|
278
264
|
clearTimeout(this._debounceTimer);
|
|
279
265
|
}
|
|
280
266
|
}
|
|
281
|
-
onPropertyChange(name) {
|
|
282
|
-
|
|
283
|
-
return;
|
|
284
|
-
if (name === 'multiple') {
|
|
285
|
-
if (this.multiple) {
|
|
286
|
-
if (!this.values.length && this.value) {
|
|
287
|
-
this.updateValues([this.value]);
|
|
288
|
-
}
|
|
289
|
-
return;
|
|
290
|
-
}
|
|
291
|
-
if (this.values.length) {
|
|
292
|
-
this.value = this.values[0] ?? '';
|
|
293
|
-
}
|
|
294
|
-
this.updateValues([]);
|
|
295
|
-
this.search = '';
|
|
296
|
-
return;
|
|
297
|
-
}
|
|
298
|
-
if (name === 'values') {
|
|
299
|
-
const rawValues = this.values;
|
|
300
|
-
let normalized = [];
|
|
301
|
-
if (typeof rawValues === 'string') {
|
|
302
|
-
normalized = rawValues
|
|
303
|
-
.split(',')
|
|
304
|
-
.map((v) => v.trim())
|
|
305
|
-
.filter((v) => v.length > 0);
|
|
306
|
-
}
|
|
307
|
-
else if (Array.isArray(rawValues)) {
|
|
308
|
-
normalized = rawValues.filter((v) => typeof v === 'string');
|
|
309
|
-
}
|
|
310
|
-
normalized = Array.from(new Set(normalized));
|
|
311
|
-
if (!this.areValuesEqual(this.values, normalized)) {
|
|
312
|
-
this.updateValues(normalized);
|
|
313
|
-
}
|
|
314
|
-
if (!this.multiple) {
|
|
315
|
-
this.value = normalized[0] ?? '';
|
|
316
|
-
this.updateValues([]);
|
|
317
|
-
}
|
|
318
|
-
return;
|
|
319
|
-
}
|
|
320
|
-
if (name === 'value' && this.multiple) {
|
|
321
|
-
if (this.value) {
|
|
322
|
-
const nextValues = Array.from(new Set([...this.values, this.value]));
|
|
323
|
-
if (!this.areValuesEqual(this.values, nextValues)) {
|
|
324
|
-
this.updateValues(nextValues);
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
}
|
|
267
|
+
onPropertyChange(name, _, newValue) {
|
|
268
|
+
this._valueSync.handlePropertyChange(name, newValue);
|
|
328
269
|
}
|
|
329
270
|
/** Get the selected option (single mode) */
|
|
330
271
|
get selectedOption() {
|
|
@@ -366,6 +307,22 @@ let AutocompleteComponent = class AutocompleteComponent {
|
|
|
366
307
|
get hasValue() {
|
|
367
308
|
return this.multiple ? this.values.length > 0 : !!this.value;
|
|
368
309
|
}
|
|
310
|
+
/** Unique id of the error element (for aria-describedby) */
|
|
311
|
+
get errorId() {
|
|
312
|
+
return `ml-autocomplete-error-${this._uid}`;
|
|
313
|
+
}
|
|
314
|
+
/** Unique id of the hint element (for aria-describedby) */
|
|
315
|
+
get hintId() {
|
|
316
|
+
return `ml-autocomplete-hint-${this._uid}`;
|
|
317
|
+
}
|
|
318
|
+
/** Id of the message that describes the input, or undefined when there is none. */
|
|
319
|
+
get describedBy() {
|
|
320
|
+
if (this.error)
|
|
321
|
+
return this.errorId;
|
|
322
|
+
if (this.hint)
|
|
323
|
+
return this.hintId;
|
|
324
|
+
return undefined;
|
|
325
|
+
}
|
|
369
326
|
/** Unique id of the listbox element (for aria-controls) */
|
|
370
327
|
get listboxId() {
|
|
371
328
|
return `ml-autocomplete-listbox-${this._uid}`;
|
|
@@ -520,44 +477,31 @@ let AutocompleteComponent = class AutocompleteComponent {
|
|
|
520
477
|
break;
|
|
521
478
|
}
|
|
522
479
|
}
|
|
480
|
+
/**
|
|
481
|
+
* Keep the keyboard-focused option visible. Arrowing past the visible
|
|
482
|
+
* part of a long list used to move the highlight out of view.
|
|
483
|
+
*/
|
|
484
|
+
scrollFocusedOptionIntoView() {
|
|
485
|
+
if (this.focusedIndex < 0)
|
|
486
|
+
return;
|
|
487
|
+
scrollOptionIntoView(this.elementRef.shadowRoot, this.optionId(this.focusedIndex));
|
|
488
|
+
}
|
|
523
489
|
focusNextOption() {
|
|
524
|
-
const
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
this.focusedIndex = index;
|
|
529
|
-
return;
|
|
530
|
-
}
|
|
531
|
-
index++;
|
|
490
|
+
const index = findNextEnabledIndex(this.filteredOptions, this.focusedIndex);
|
|
491
|
+
if (index >= 0) {
|
|
492
|
+
this.focusedIndex = index;
|
|
493
|
+
this.scrollFocusedOptionIntoView();
|
|
532
494
|
}
|
|
533
495
|
}
|
|
534
496
|
focusPreviousOption() {
|
|
535
|
-
const
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
this.focusedIndex = index;
|
|
540
|
-
return;
|
|
541
|
-
}
|
|
542
|
-
index--;
|
|
497
|
+
const index = findPreviousEnabledIndex(this.filteredOptions, this.focusedIndex);
|
|
498
|
+
if (index >= 0) {
|
|
499
|
+
this.focusedIndex = index;
|
|
500
|
+
this.scrollFocusedOptionIntoView();
|
|
543
501
|
}
|
|
544
502
|
}
|
|
545
503
|
findFirstEnabledIndex() {
|
|
546
|
-
return this.filteredOptions
|
|
547
|
-
}
|
|
548
|
-
updateValues(values) {
|
|
549
|
-
this._syncingValues = true;
|
|
550
|
-
this.values = values;
|
|
551
|
-
this._syncingValues = false;
|
|
552
|
-
}
|
|
553
|
-
areValuesEqual(left, right) {
|
|
554
|
-
if (left.length !== right.length)
|
|
555
|
-
return false;
|
|
556
|
-
for (let i = 0; i < left.length; i++) {
|
|
557
|
-
if (left[i] !== right[i])
|
|
558
|
-
return false;
|
|
559
|
-
}
|
|
560
|
-
return true;
|
|
504
|
+
return firstEnabledIndex(this.filteredOptions);
|
|
561
505
|
}
|
|
562
506
|
};
|
|
563
507
|
AutocompleteComponent = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/autocomplete/autocomplete.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"autocomplete.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/autocomplete/autocomplete.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kBAAkB,iDA6c9B,CAAC"}
|