@nuraly/lumenui 0.1.0 → 0.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/nuralyui.bundle.js +23024 -17355
- package/dist/nuralyui.bundle.js.gz +0 -0
- package/dist/src/components/alert/alert.component.d.ts +8 -5
- package/dist/src/components/alert/alert.component.js +24 -20
- package/dist/src/components/alert/alert.style.d.ts +0 -7
- package/dist/src/components/alert/alert.style.js +48 -90
- package/dist/src/components/alert/bundle.js +82 -108
- package/dist/src/components/alert/bundle.js.gz +0 -0
- package/dist/src/components/badge/badge.component.d.ts +9 -8
- package/dist/src/components/badge/badge.component.js +17 -14
- package/dist/src/components/badge/badge.style.d.ts +0 -7
- package/dist/src/components/badge/badge.style.js +49 -107
- package/dist/src/components/badge/bundle.js +81 -119
- package/dist/src/components/badge/bundle.js.gz +0 -0
- package/dist/src/components/breadcrumb/breadcrumb.component.d.ts +8 -10
- package/dist/src/components/breadcrumb/breadcrumb.component.js +16 -15
- package/dist/src/components/breadcrumb/breadcrumb.style.d.ts +0 -7
- package/dist/src/components/breadcrumb/breadcrumb.style.js +42 -60
- package/dist/src/components/breadcrumb/bundle.js +96 -93
- package/dist/src/components/breadcrumb/bundle.js.gz +0 -0
- package/dist/src/components/button/bundle.js +221 -470
- package/dist/src/components/button/bundle.js.gz +0 -0
- package/dist/src/components/button/button.component.d.ts +2 -1
- package/dist/src/components/button/button.component.js +6 -6
- package/dist/src/components/button/button.style.d.ts +0 -7
- package/dist/src/components/button/button.style.js +167 -433
- package/dist/src/components/canvas/base-canvas.component.d.ts +2 -1
- package/dist/src/components/canvas/base-canvas.component.js +1 -0
- package/dist/src/components/canvas/bundle.js +16919 -9595
- package/dist/src/components/canvas/bundle.js.gz +0 -0
- package/dist/src/components/canvas/canvas.constants.d.ts +1 -1
- package/dist/src/components/canvas/canvas.constants.js +1 -1
- package/dist/src/components/canvas/chatbot-panel.style.js +31 -31
- package/dist/src/components/canvas/index.d.ts +2 -0
- package/dist/src/components/canvas/index.js +3 -0
- package/dist/src/components/canvas/whiteboard-canvas.component.d.ts +3 -1
- package/dist/src/components/canvas/whiteboard-canvas.component.js +19 -1
- package/dist/src/components/canvas/whiteboard-canvas.style.js +159 -138
- package/dist/src/components/canvas/whiteboard-node.component.d.ts +2 -1
- package/dist/src/components/canvas/whiteboard-node.component.js +2 -1
- package/dist/src/components/canvas/whiteboard-node.style.js +44 -44
- package/dist/src/components/canvas/workflow-canvas-only.d.ts +4 -0
- package/dist/src/components/canvas/workflow-canvas-only.js +5 -0
- package/dist/src/components/canvas/workflow-canvas.component.d.ts +3 -1
- package/dist/src/components/canvas/workflow-canvas.component.js +24 -2
- package/dist/src/components/canvas/workflow-canvas.style.js +776 -648
- package/dist/src/components/canvas/workflow-canvas.types.d.ts +113 -4
- package/dist/src/components/canvas/workflow-canvas.types.js +646 -3
- package/dist/src/components/canvas/workflow-node.component.d.ts +3 -2
- package/dist/src/components/canvas/workflow-node.component.js +5 -5
- package/dist/src/components/canvas/workflow-node.style.js +183 -181
- package/dist/src/components/card/bundle.js +43 -35
- package/dist/src/components/card/bundle.js.gz +0 -0
- package/dist/src/components/card/card.component.d.ts +6 -1
- package/dist/src/components/card/card.component.js +8 -2
- package/dist/src/components/card/card.style.js +26 -30
- package/dist/src/components/carousel/bundle.js +8 -8
- package/dist/src/components/carousel/bundle.js.gz +0 -0
- package/dist/src/components/carousel/carousel.component.d.ts +12 -0
- package/dist/src/components/carousel/carousel.component.js +16 -4
- package/dist/src/components/chatbot/bundle.js +422 -406
- package/dist/src/components/chatbot/bundle.js.gz +0 -0
- package/dist/src/components/chatbot/chatbot.component.d.ts +2 -1
- package/dist/src/components/chatbot/chatbot.component.js +1 -0
- package/dist/src/components/chatbot/chatbot.style.js +277 -277
- package/dist/src/components/checkbox/bundle.js +86 -245
- package/dist/src/components/checkbox/bundle.js.gz +0 -0
- package/dist/src/components/checkbox/checkbox.component.d.ts +5 -2
- package/dist/src/components/checkbox/checkbox.component.js +11 -13
- package/dist/src/components/checkbox/checkbox.style.js +56 -231
- package/dist/src/components/code-editor/bundle.js +151 -25
- package/dist/src/components/code-editor/bundle.js.gz +0 -0
- package/dist/src/components/code-editor/code-editor.component.d.ts +18 -56
- package/dist/src/components/code-editor/code-editor.component.js +141 -394
- package/dist/src/components/code-editor/code-editor.style.js +139 -15
- package/dist/src/components/collapse/bundle.js +97 -84
- package/dist/src/components/collapse/bundle.js.gz +0 -0
- package/dist/src/components/collapse/collapse.component.d.ts +7 -1
- package/dist/src/components/collapse/collapse.component.js +11 -2
- package/dist/src/components/collapse/collapse.style.js +60 -60
- package/dist/src/components/colorpicker/bundle.js +85 -48
- package/dist/src/components/colorpicker/bundle.js.gz +0 -0
- package/dist/src/components/colorpicker/color-holder.component.d.ts +2 -4
- package/dist/src/components/colorpicker/color-holder.component.js +5 -6
- package/dist/src/components/colorpicker/color-holder.style.js +11 -11
- package/dist/src/components/colorpicker/color-picker.component.d.ts +2 -1
- package/dist/src/components/colorpicker/color-picker.component.js +1 -0
- package/dist/src/components/colorpicker/color-picker.style.js +12 -12
- package/dist/src/components/colorpicker/default-color-sets.component.d.ts +2 -2
- package/dist/src/components/colorpicker/default-color-sets.component.js +4 -3
- package/dist/src/components/colorpicker/default-color-sets.style.js +5 -5
- package/dist/src/components/container/bundle.js +24 -14
- package/dist/src/components/container/bundle.js.gz +0 -0
- package/dist/src/components/container/container.component.d.ts +4 -1
- package/dist/src/components/container/container.component.js +7 -5
- package/dist/src/components/container/container.style.js +9 -9
- package/dist/src/components/datepicker/bundle.js +193 -177
- package/dist/src/components/datepicker/bundle.js.gz +0 -0
- package/dist/src/components/datepicker/datepicker.component.d.ts +2 -1
- package/dist/src/components/datepicker/datepicker.component.js +1 -0
- package/dist/src/components/datepicker/datepicker.style.js +65 -65
- package/dist/src/components/datepicker/datepicker.style.variables.js +91 -91
- package/dist/src/components/db-connection-select/bundle.js +7 -6
- package/dist/src/components/db-connection-select/bundle.js.gz +0 -0
- package/dist/src/components/db-connection-select/db-connection-select.component.d.ts +3 -0
- package/dist/src/components/db-connection-select/db-connection-select.component.js +4 -0
- package/dist/src/components/divider/bundle.js +61 -35
- package/dist/src/components/divider/bundle.js.gz +0 -0
- package/dist/src/components/divider/divider.component.d.ts +4 -6
- package/dist/src/components/divider/divider.component.js +10 -14
- package/dist/src/components/divider/divider.style.js +41 -31
- package/dist/src/components/document/bundle.js +50 -48
- package/dist/src/components/document/bundle.js.gz +0 -0
- package/dist/src/components/document/document.component.d.ts +12 -1
- package/dist/src/components/document/document.component.js +18 -6
- package/dist/src/components/document/document.style.js +21 -36
- package/dist/src/components/dropdown/bundle.js +117 -101
- package/dist/src/components/dropdown/bundle.js.gz +0 -0
- package/dist/src/components/dropdown/dropdown.component.d.ts +2 -1
- package/dist/src/components/dropdown/dropdown.component.js +1 -0
- package/dist/src/components/dropdown/dropdown.style.js +68 -68
- package/dist/src/components/file-upload/bundle.js +82 -76
- package/dist/src/components/file-upload/bundle.js.gz +0 -0
- package/dist/src/components/file-upload/file-upload.component.d.ts +2 -1
- package/dist/src/components/file-upload/file-upload.component.js +1 -0
- package/dist/src/components/file-upload/styles.js +59 -59
- package/dist/src/components/flex/bundle.js +18 -8
- package/dist/src/components/flex/bundle.js.gz +0 -0
- package/dist/src/components/flex/flex.component.d.ts +4 -1
- package/dist/src/components/flex/flex.component.js +7 -4
- package/dist/src/components/flex/flex.style.js +2 -2
- package/dist/src/components/form/bundle.js +22 -10
- package/dist/src/components/form/bundle.js.gz +0 -0
- package/dist/src/components/form/form.component.d.ts +4 -1
- package/dist/src/components/form/form.component.js +5 -1
- package/dist/src/components/form/form.style.js +2 -2
- package/dist/src/components/grid/bundle.js +26 -14
- package/dist/src/components/grid/bundle.js.gz +0 -0
- package/dist/src/components/grid/col.component.d.ts +4 -1
- package/dist/src/components/grid/col.component.js +4 -1
- package/dist/src/components/grid/col.style.js +2 -2
- package/dist/src/components/grid/row.component.d.ts +4 -1
- package/dist/src/components/grid/row.component.js +4 -1
- package/dist/src/components/grid/row.style.js +2 -2
- package/dist/src/components/icon/bundle.js +78 -252
- package/dist/src/components/icon/bundle.js.gz +0 -0
- package/dist/src/components/icon/icon-paths.d.ts +2 -0
- package/dist/src/components/icon/icon-paths.js +141 -0
- package/dist/src/components/icon/icon.component.d.ts +10 -12
- package/dist/src/components/icon/icon.component.js +42 -93
- package/dist/src/components/icon/icon.style.js +42 -130
- package/dist/src/components/icon/icon.variables.js +9 -9
- package/dist/src/components/iconpicker/bundle.js +859 -1511
- package/dist/src/components/iconpicker/bundle.js.gz +0 -0
- package/dist/src/components/iconpicker/icon-picker.component.d.ts +2 -1
- package/dist/src/components/iconpicker/icon-picker.component.js +1 -0
- package/dist/src/components/iconpicker/icon-picker.style.js +13 -13
- package/dist/src/components/image/bundle.js +43 -33
- package/dist/src/components/image/bundle.js.gz +0 -0
- package/dist/src/components/image/image.component.d.ts +10 -1
- package/dist/src/components/image/image.component.js +13 -3
- package/dist/src/components/image/image.style.js +19 -26
- package/dist/src/components/input/bundle.js +420 -644
- package/dist/src/components/input/bundle.js.gz +0 -0
- package/dist/src/components/input/input.component.d.ts +16 -3
- package/dist/src/components/input/input.component.js +43 -27
- package/dist/src/components/input/input.style.d.ts +1 -1
- package/dist/src/components/input/input.style.js +331 -634
- package/dist/src/components/kv-secret-select/bundle.js +2 -1
- package/dist/src/components/kv-secret-select/bundle.js.gz +0 -0
- package/dist/src/components/kv-secret-select/kv-secret-select.component.d.ts +3 -0
- package/dist/src/components/kv-secret-select/kv-secret-select.component.js +4 -0
- package/dist/src/components/label/bundle.js +37 -60
- package/dist/src/components/label/bundle.js.gz +0 -0
- package/dist/src/components/label/label.component.d.ts +8 -4
- package/dist/src/components/label/label.component.js +9 -14
- package/dist/src/components/label/label.style.js +17 -25
- package/dist/src/components/label/label.style.variables.js +18 -18
- package/dist/src/components/layout/bundle.js +86 -70
- package/dist/src/components/layout/bundle.js.gz +0 -0
- package/dist/src/components/layout/content.component.d.ts +2 -1
- package/dist/src/components/layout/content.component.js +2 -1
- package/dist/src/components/layout/content.style.js +3 -3
- package/dist/src/components/layout/footer.component.d.ts +2 -1
- package/dist/src/components/layout/footer.component.js +3 -2
- package/dist/src/components/layout/footer.style.js +7 -7
- package/dist/src/components/layout/header.component.d.ts +2 -1
- package/dist/src/components/layout/header.component.js +3 -2
- package/dist/src/components/layout/header.style.js +7 -7
- package/dist/src/components/layout/layout.component.d.ts +4 -7
- package/dist/src/components/layout/layout.component.js +9 -22
- package/dist/src/components/layout/layout.style.js +1 -1
- package/dist/src/components/layout/sider.component.d.ts +3 -1
- package/dist/src/components/layout/sider.component.js +3 -1
- package/dist/src/components/layout/sider.style.js +29 -29
- package/dist/src/components/menu/bundle.js +135 -125
- package/dist/src/components/menu/bundle.js.gz +0 -0
- package/dist/src/components/menu/menu.component.d.ts +2 -1
- package/dist/src/components/menu/menu.component.js +1 -0
- package/dist/src/components/menu/menu.style.js +87 -87
- package/dist/src/components/modal/bundle.js +105 -96
- package/dist/src/components/modal/bundle.js.gz +0 -0
- package/dist/src/components/modal/modal.component.d.ts +2 -1
- package/dist/src/components/modal/modal.component.js +1 -0
- package/dist/src/components/modal/modal.style.js +69 -71
- package/dist/src/components/panel/bundle.js +190 -391
- package/dist/src/components/panel/bundle.js.gz +0 -0
- package/dist/src/components/panel/panel.component.d.ts +2 -1
- package/dist/src/components/panel/panel.component.js +1 -0
- package/dist/src/components/panel/panel.style.js +65 -65
- package/dist/src/components/popconfirm/bundle.js +107 -93
- package/dist/src/components/popconfirm/bundle.js.gz +0 -0
- package/dist/src/components/popconfirm/popconfirm-manager.component.d.ts +2 -1
- package/dist/src/components/popconfirm/popconfirm-manager.component.js +1 -0
- package/dist/src/components/popconfirm/popconfirm-manager.style.js +16 -16
- package/dist/src/components/popconfirm/popconfirm.component.d.ts +2 -1
- package/dist/src/components/popconfirm/popconfirm.component.js +9 -5
- package/dist/src/components/popconfirm/popconfirm.style.js +43 -43
- package/dist/src/components/radio/bundle.js +56 -86
- package/dist/src/components/radio/bundle.js.gz +0 -0
- package/dist/src/components/radio/radio.component.d.ts +8 -2
- package/dist/src/components/radio/radio.component.js +17 -9
- package/dist/src/components/radio/radio.style.js +30 -77
- package/dist/src/components/radio-group/bundle.js +125 -89
- package/dist/src/components/radio-group/bundle.js.gz +0 -0
- package/dist/src/components/radio-group/radio-group.component.d.ts +5 -1
- package/dist/src/components/radio-group/radio-group.component.js +18 -10
- package/dist/src/components/radio-group/radio-group.style.js +44 -44
- package/dist/src/components/select/bundle.js +260 -367
- package/dist/src/components/select/bundle.js.gz +0 -0
- package/dist/src/components/select/select.component.d.ts +12 -17
- package/dist/src/components/select/select.component.js +35 -35
- package/dist/src/components/select/select.style.js +184 -324
- package/dist/src/components/skeleton/bundle.js +82 -162
- package/dist/src/components/skeleton/bundle.js.gz +0 -0
- package/dist/src/components/skeleton/skeleton.component.d.ts +10 -5
- package/dist/src/components/skeleton/skeleton.component.js +20 -7
- package/dist/src/components/skeleton/skeleton.style.js +34 -133
- package/dist/src/components/slider-input/bundle.js +89 -88
- package/dist/src/components/slider-input/bundle.js.gz +0 -0
- package/dist/src/components/slider-input/slider-input.component.d.ts +11 -0
- package/dist/src/components/slider-input/slider-input.component.js +20 -8
- package/dist/src/components/slider-input/slider-input.style.js +47 -47
- package/dist/src/components/slider-input/slider-input.style.variables.js +32 -32
- package/dist/src/components/table/bundle.js +149 -128
- package/dist/src/components/table/bundle.js.gz +0 -0
- package/dist/src/components/table/table.component.d.ts +2 -1
- package/dist/src/components/table/table.component.js +1 -0
- package/dist/src/components/table/table.style.js +79 -79
- package/dist/src/components/tabs/bundle.js +462 -663
- package/dist/src/components/tabs/bundle.js.gz +0 -0
- package/dist/src/components/tabs/tabs.component.d.ts +6 -1
- package/dist/src/components/tabs/tabs.component.js +8 -1
- package/dist/src/components/tabs/tabs.style.js +200 -201
- package/dist/src/components/tag/bundle.js +44 -36
- package/dist/src/components/tag/bundle.js.gz +0 -0
- package/dist/src/components/tag/tag.component.d.ts +7 -6
- package/dist/src/components/tag/tag.component.js +10 -19
- package/dist/src/components/tag/tag.style.js +20 -24
- package/dist/src/components/textarea/bundle.js +131 -94
- package/dist/src/components/textarea/bundle.js.gz +0 -0
- package/dist/src/components/textarea/textarea.component.d.ts +7 -1
- package/dist/src/components/textarea/textarea.component.js +10 -3
- package/dist/src/components/textarea/textarea.style.d.ts +1 -13
- package/dist/src/components/textarea/textarea.style.js +79 -91
- package/dist/src/components/timeline/bundle.js +71 -134
- package/dist/src/components/timeline/bundle.js.gz +0 -0
- package/dist/src/components/timeline/timeline.component.d.ts +9 -6
- package/dist/src/components/timeline/timeline.component.js +16 -13
- package/dist/src/components/timeline/timeline.style.d.ts +0 -7
- package/dist/src/components/timeline/timeline.style.js +41 -122
- package/dist/src/components/timepicker/bundle.js +196 -166
- package/dist/src/components/timepicker/bundle.js.gz +0 -0
- package/dist/src/components/timepicker/timepicker.component.d.ts +2 -1
- package/dist/src/components/timepicker/timepicker.component.js +1 -0
- package/dist/src/components/timepicker/timepicker.style.js +42 -42
- package/dist/src/components/timepicker/timepicker.style.variables.js +91 -91
- package/dist/src/components/toast/bundle.js +97 -81
- package/dist/src/components/toast/bundle.js.gz +0 -0
- package/dist/src/components/toast/toast.component.d.ts +2 -1
- package/dist/src/components/toast/toast.component.js +1 -0
- package/dist/src/components/toast/toast.style.js +62 -62
- package/dist/src/components/tooltips/bundle.js +10 -10
- package/dist/src/components/tooltips/bundle.js.gz +0 -0
- package/dist/src/components/tooltips/tooltips.component.d.ts +8 -0
- package/dist/src/components/tooltips/tooltips.component.js +9 -1
- package/dist/src/components/tooltips/tooltips.style.js +6 -6
- package/dist/src/components/video/bundle.js +47 -36
- package/dist/src/components/video/bundle.js.gz +0 -0
- package/dist/src/components/video/video.component.d.ts +12 -1
- package/dist/src/components/video/video.component.js +18 -6
- package/dist/src/components/video/video.style.js +18 -24
- package/package.json +25 -12
- package/packages/common/dist/VERSIONS.md +2 -2
- package/packages/common/dist/shared/base-mixin.d.ts +21 -19
- package/packages/common/dist/shared/base-mixin.d.ts.map +1 -1
- package/packages/common/dist/shared/base-mixin.js +102 -18
- package/packages/common/dist/shared/base-mixin.js.map +1 -1
- package/packages/common/dist/shared/index.d.ts +1 -0
- package/packages/common/dist/shared/index.d.ts.map +1 -1
- package/packages/common/dist/shared/index.js +2 -0
- package/packages/common/dist/shared/index.js.map +1 -1
- package/packages/common/dist/shared/style-injector.d.ts +11 -0
- package/packages/common/dist/shared/style-injector.d.ts.map +1 -0
- package/packages/common/dist/shared/style-injector.js +53 -0
- package/packages/common/dist/shared/style-injector.js.map +1 -0
- package/packages/common/dist/shared/theme-mixin.d.ts +2 -24
- package/packages/common/dist/shared/theme-mixin.d.ts.map +1 -1
- package/packages/common/dist/shared/theme-mixin.js +5 -38
- package/packages/common/dist/shared/theme-mixin.js.map +1 -1
- package/packages/themes/dist/default.css +0 -10
- package/packages/themes/dist/package.json +1 -1
|
@@ -1,170 +1,113 @@
|
|
|
1
|
-
import{css as t,nothing as
|
|
1
|
+
import{css as t,nothing as i,html as e,LitElement as s}from"lit";import{property as o,customElement as r}from"lit/decorators.js";import{map as n}from"lit/directives/map.js";import{choose as a}from"lit/directives/choose.js";import{classMap as h}from"lit/directives/class-map.js";import{styleMap as c}from"lit/directives/style-map.js";import{unsafeHTML as l}from"lit/directives/unsafe-html.js";import"lit/directives/if-defined.js";const d=t`
|
|
2
2
|
:host {
|
|
3
3
|
width: fit-content;
|
|
4
4
|
display: block;
|
|
5
|
-
font-family:
|
|
6
|
-
font-size:
|
|
7
|
-
line-height:
|
|
8
|
-
margin:
|
|
5
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
|
|
6
|
+
font-size: 13px;
|
|
7
|
+
line-height: 1.4;
|
|
8
|
+
margin: 0;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
/*
|
|
11
|
+
/* Disabled */
|
|
12
12
|
:host([disabled]) {
|
|
13
|
-
opacity:
|
|
13
|
+
opacity: 0.5;
|
|
14
14
|
pointer-events: none;
|
|
15
15
|
}
|
|
16
|
-
|
|
17
16
|
:host([disabled]) .wrapper {
|
|
18
|
-
background-color:
|
|
19
|
-
border-color: var(--
|
|
20
|
-
color: var(--
|
|
17
|
+
background-color: #f4f4f4;
|
|
18
|
+
border-color: var(--nr-border, #e0e0e0);
|
|
19
|
+
color: var(--nr-disabled, #c6c6c6);
|
|
21
20
|
cursor: not-allowed;
|
|
22
21
|
}
|
|
23
22
|
|
|
24
|
-
/* Size
|
|
25
|
-
:host([size=
|
|
26
|
-
height:
|
|
27
|
-
|
|
28
|
-
font-size: var(--nuraly-select-small-font-size, var(--nuraly-font-size-xs));
|
|
23
|
+
/* Size: Small */
|
|
24
|
+
:host([size="small"]) .wrapper {
|
|
25
|
+
min-height: 28px;
|
|
26
|
+
font-size: 12px;
|
|
29
27
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
padding:
|
|
33
|
-
padding-right: calc(var(--nuraly-select-small-icon-size, var(--nuraly-font-size-sm)) + var(--nuraly-spacing-5));
|
|
28
|
+
:host([size="small"]) .select-trigger {
|
|
29
|
+
padding: 4px 8px;
|
|
30
|
+
padding-right: 28px;
|
|
34
31
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
:host([size="small"]) .option {
|
|
33
|
+
padding: 4px 8px;
|
|
34
|
+
font-size: 12px;
|
|
38
35
|
}
|
|
39
36
|
|
|
40
|
-
:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
/* Size: Medium */
|
|
38
|
+
:host([size="medium"]) .wrapper {
|
|
39
|
+
min-height: 32px;
|
|
40
|
+
font-size: 13px;
|
|
44
41
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
--nuraly-icon-width: var(--nuraly-select-small-icon-size, var(--nuraly-font-size-sm));
|
|
42
|
+
:host([size="medium"]) .select-trigger {
|
|
43
|
+
padding: 5px 10px;
|
|
44
|
+
padding-right: 30px;
|
|
49
45
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
font-size: var(--nuraly-select-medium-font-size, var(--nuraly-font-size-sm));
|
|
46
|
+
:host([size="medium"]) .option {
|
|
47
|
+
padding: 5px 10px;
|
|
48
|
+
font-size: 13px;
|
|
54
49
|
}
|
|
55
50
|
|
|
56
|
-
:
|
|
57
|
-
|
|
58
|
-
|
|
51
|
+
/* Size: Large */
|
|
52
|
+
:host([size="large"]) .wrapper {
|
|
53
|
+
min-height: 38px;
|
|
54
|
+
font-size: 14px;
|
|
59
55
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
56
|
+
:host([size="large"]) .select-trigger {
|
|
57
|
+
padding: 8px 12px;
|
|
58
|
+
padding-right: 34px;
|
|
63
59
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
font-size: var(--nuraly-select-medium-font-size, var(--nuraly-font-size-sm));
|
|
68
|
-
min-height: var(--nuraly-select-medium-height, var(--nuraly-size-lg));
|
|
60
|
+
:host([size="large"]) .option {
|
|
61
|
+
padding: 8px 12px;
|
|
62
|
+
font-size: 14px;
|
|
69
63
|
}
|
|
70
64
|
|
|
71
|
-
|
|
72
|
-
:host([
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
:host([size='large']) .wrapper {
|
|
77
|
-
min-height: var(--nuraly-select-large-height, var(--nuraly-size-xl));
|
|
78
|
-
font-size: var(--nuraly-select-large-font-size, var(--nuraly-font-size-lg));
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
:host([size='large']) .select-trigger {
|
|
82
|
-
padding: var(--nuraly-select-large-padding, var(--nuraly-spacing-3) var(--nuraly-spacing-4));
|
|
83
|
-
padding-right: calc(var(--nuraly-select-large-icon-size, var(--nuraly-font-size-xl)) + var(--nuraly-spacing-5));
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
:host([size='large']) .icons-container nr-icon {
|
|
87
|
-
--nuraly-icon-width: var(--nuraly-select-large-icon-size, var(--nuraly-font-size-xl));
|
|
88
|
-
}
|
|
65
|
+
/* Status */
|
|
66
|
+
:host([status="error"]) .wrapper { border-color: var(--nr-danger, #da1e28); }
|
|
67
|
+
:host([status="warning"]) .wrapper { border-color: var(--nr-warning, #f1c21b); }
|
|
68
|
+
:host([status="success"]) .wrapper { border-color: var(--nr-success, #198038); }
|
|
89
69
|
|
|
90
|
-
:
|
|
91
|
-
|
|
92
|
-
font-size: var(--nuraly-select-large-font-size, var(--nuraly-font-size-lg));
|
|
93
|
-
min-height: var(--nuraly-select-large-height, var(--nuraly-size-xl));
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
:host([size='large']) .option-icon,
|
|
97
|
-
:host([size='large']) .option nr-icon {
|
|
98
|
-
--nuraly-icon-width: var(--nuraly-select-large-icon-size, var(--nuraly-font-size-xl));
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/* Status variants */
|
|
102
|
-
:host([status='error']) .wrapper {
|
|
103
|
-
border-color: var(--nuraly-select-error-border-color, var(--nuraly-color-danger));
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
:host([status='warning']) .wrapper {
|
|
107
|
-
border-color: var(--nuraly-select-warning-border-color, var(--nuraly-color-warning));
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
:host([status='success']) .wrapper {
|
|
111
|
-
border-color: var(--nuraly-select-success-border-color, var(--nuraly-color-success));
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/* Type variants */
|
|
115
|
-
:host([type='inline']) {
|
|
70
|
+
/* Type: inline */
|
|
71
|
+
:host([type="inline"]) {
|
|
116
72
|
display: flex;
|
|
117
73
|
align-items: center;
|
|
118
|
-
gap:
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
:host([type='inline']) .wrapper {
|
|
122
|
-
flex: 1;
|
|
74
|
+
gap: 0.5rem;
|
|
123
75
|
}
|
|
76
|
+
:host([type="inline"]) .wrapper { flex: 1; }
|
|
124
77
|
|
|
125
78
|
/* Block (full width) */
|
|
126
|
-
:host([block]) {
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
:host([block]) .wrapper {
|
|
131
|
-
width: 100%;
|
|
132
|
-
}
|
|
79
|
+
:host([block]) { width: 100%; }
|
|
80
|
+
:host([block]) .wrapper { width: 100%; }
|
|
133
81
|
|
|
134
|
-
/*
|
|
135
|
-
:host([show]) .
|
|
136
|
-
|
|
82
|
+
/* Arrow rotation when open */
|
|
83
|
+
:host([show]) .arrow-icon {
|
|
84
|
+
transform: rotate(180deg);
|
|
137
85
|
}
|
|
138
86
|
|
|
139
|
-
/*
|
|
87
|
+
/* Wrapper */
|
|
140
88
|
.wrapper {
|
|
141
89
|
position: relative;
|
|
142
|
-
width:
|
|
143
|
-
background-color: var(--
|
|
144
|
-
border: var(--
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
transition: all var(--nuraly-select-transition-duration, var(--nuraly-transition-fast))
|
|
148
|
-
var(--nuraly-select-transition-timing, ease-in-out);
|
|
90
|
+
width: fit-content;
|
|
91
|
+
background-color: var(--nr-bg, #ffffff);
|
|
92
|
+
border: 1px solid var(--nr-border, #e0e0e0);
|
|
93
|
+
border-radius: 8px;
|
|
94
|
+
transition: all 0.15s ease-in-out;
|
|
149
95
|
cursor: pointer;
|
|
150
96
|
outline: none;
|
|
151
|
-
margin:
|
|
152
|
-
min-height:
|
|
97
|
+
margin: 0;
|
|
98
|
+
min-height: 32px;
|
|
153
99
|
box-sizing: border-box;
|
|
154
100
|
display: flex;
|
|
155
101
|
align-items: center;
|
|
156
|
-
/* Ensure dropdown can overflow the wrapper */
|
|
157
102
|
overflow: visible;
|
|
158
103
|
}
|
|
159
|
-
|
|
160
104
|
.wrapper:hover:not(:disabled) {
|
|
161
|
-
border-color: var(--
|
|
105
|
+
border-color: var(--nr-primary, #7c3aed);
|
|
162
106
|
}
|
|
163
|
-
|
|
164
107
|
.wrapper:focus,
|
|
165
108
|
.wrapper:focus-within {
|
|
166
|
-
border-color: var(--
|
|
167
|
-
box-shadow:
|
|
109
|
+
border-color: var(--nr-primary, #7c3aed);
|
|
110
|
+
box-shadow: 0 0 0 2px rgba(15, 98, 254, 0.2);
|
|
168
111
|
}
|
|
169
112
|
|
|
170
113
|
/* Select container */
|
|
@@ -173,243 +116,159 @@ import{css as t,nothing as e,html as i,LitElement as r}from"lit";import{property
|
|
|
173
116
|
flex-direction: column;
|
|
174
117
|
}
|
|
175
118
|
|
|
176
|
-
/*
|
|
119
|
+
/* Trigger */
|
|
177
120
|
.select-trigger {
|
|
178
121
|
display: flex;
|
|
179
122
|
align-items: center;
|
|
180
|
-
padding:
|
|
181
|
-
|
|
182
|
-
var(--nuraly-select-padding-bottom, var(--nuraly-spacing-2))
|
|
183
|
-
var(--nuraly-select-padding-left, var(--nuraly-spacing-3));
|
|
184
|
-
color: var(--nuraly-select-color, var(--nuraly-color-text));
|
|
123
|
+
padding: 5px 30px 5px 10px;
|
|
124
|
+
color: var(--nr-text, #161616);
|
|
185
125
|
font-size: inherit;
|
|
186
126
|
line-height: inherit;
|
|
187
127
|
word-break: break-word;
|
|
188
128
|
flex: 1;
|
|
189
129
|
min-height: 0;
|
|
190
130
|
flex-wrap: wrap;
|
|
191
|
-
gap:
|
|
131
|
+
gap: 0.25rem;
|
|
192
132
|
box-sizing: border-box;
|
|
193
133
|
}
|
|
194
134
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
color: var(--
|
|
198
|
-
font-size:
|
|
135
|
+
/* Placeholder */
|
|
136
|
+
.placeholder {
|
|
137
|
+
color: var(--nr-text-secondary, #525252);
|
|
138
|
+
font-size: 13px;
|
|
199
139
|
}
|
|
200
140
|
|
|
201
|
-
/*
|
|
141
|
+
/* Tags (multi-select) */
|
|
202
142
|
.tag {
|
|
203
143
|
display: inline-flex;
|
|
204
144
|
align-items: center;
|
|
205
|
-
gap:
|
|
206
|
-
background-color: var(--
|
|
207
|
-
color: var(--
|
|
208
|
-
padding:
|
|
209
|
-
border-radius:
|
|
210
|
-
font-size:
|
|
145
|
+
gap: 4px;
|
|
146
|
+
background-color: var(--nr-bg-hover, #f4f4f4);
|
|
147
|
+
color: var(--nr-text, #161616);
|
|
148
|
+
padding: 2px 8px;
|
|
149
|
+
border-radius: 9999px;
|
|
150
|
+
font-size: 12px;
|
|
211
151
|
max-width: 100%;
|
|
212
152
|
}
|
|
213
|
-
|
|
214
153
|
.tag-label {
|
|
215
154
|
overflow: hidden;
|
|
216
155
|
text-overflow: ellipsis;
|
|
217
156
|
white-space: nowrap;
|
|
218
157
|
}
|
|
219
|
-
|
|
220
158
|
.tag-close {
|
|
221
|
-
color: var(--
|
|
159
|
+
color: var(--nr-text-secondary, #525252);
|
|
222
160
|
cursor: pointer;
|
|
223
161
|
display: flex;
|
|
224
162
|
align-items: center;
|
|
225
163
|
justify-content: center;
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
border-radius: var(--nuraly-border-radius-full);
|
|
229
|
-
transition: color var(--nuraly-select-transition-duration, var(--nuraly-transition-fast));
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
.tag-close:hover {
|
|
233
|
-
color: var(--nuraly-select-tag-close-hover-color, var(--nuraly-color-text));
|
|
164
|
+
border-radius: 50%;
|
|
165
|
+
transition: color 0.15s;
|
|
234
166
|
}
|
|
167
|
+
.tag-close:hover { color: var(--nr-text, #161616); }
|
|
235
168
|
|
|
236
169
|
/* Icons container */
|
|
237
170
|
.icons-container {
|
|
238
171
|
position: absolute;
|
|
239
172
|
top: 50%;
|
|
240
|
-
right:
|
|
173
|
+
right: 0.75rem;
|
|
241
174
|
transform: translateY(-50%);
|
|
242
175
|
display: flex;
|
|
243
176
|
align-items: center;
|
|
244
|
-
gap:
|
|
177
|
+
gap: 0.25rem;
|
|
245
178
|
pointer-events: none;
|
|
246
179
|
}
|
|
247
|
-
|
|
248
180
|
.icons-container nr-icon {
|
|
249
|
-
--nuraly-icon-width: var(--nuraly-select-icon-size, var(--nuraly-font-size-base));
|
|
250
|
-
--nuraly-icon-color: var(--nuraly-color-select-icon, var(--nuraly-color-text-secondary));
|
|
251
181
|
pointer-events: auto;
|
|
252
182
|
cursor: pointer;
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
.icons-container nr-icon:hover {
|
|
257
|
-
--nuraly-icon-color: var(--nuraly-color-select-icon-hover, var(--nuraly-color-text));
|
|
183
|
+
color: var(--nr-text-secondary, #525252);
|
|
184
|
+
transition: color 0.15s;
|
|
258
185
|
}
|
|
186
|
+
.icons-container nr-icon:hover { color: var(--nr-text, #161616); }
|
|
259
187
|
|
|
260
188
|
.arrow-icon {
|
|
261
|
-
|
|
262
|
-
transition: transform var(--nuraly-select-transition-duration, var(--nuraly-transition-fast));
|
|
189
|
+
transition: transform 0.15s;
|
|
263
190
|
pointer-events: none !important;
|
|
264
191
|
}
|
|
265
192
|
|
|
266
|
-
|
|
267
|
-
transform: rotate(180deg);
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
/* Dropdown options */
|
|
193
|
+
/* Dropdown */
|
|
271
194
|
.options {
|
|
272
|
-
/* Fixed positioning to escape overflow containers */
|
|
273
195
|
position: fixed;
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
border:
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
z-index: var(--nuraly-select-dropdown-z-index, var(--nuraly-z-dropdown));
|
|
281
|
-
max-height: var(--nuraly-select-dropdown-max-height, auto);
|
|
196
|
+
background-color: var(--nr-surface, #ffffff);
|
|
197
|
+
border: 1px solid var(--nr-border, #e0e0e0);
|
|
198
|
+
border-radius: 8px;
|
|
199
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
200
|
+
z-index: 9999;
|
|
201
|
+
max-height: auto;
|
|
282
202
|
overflow-y: auto;
|
|
283
203
|
overflow-x: hidden;
|
|
284
204
|
display: none;
|
|
285
205
|
flex-direction: column;
|
|
286
|
-
animation:
|
|
287
|
-
/* Ensure proper containment and exact wrapper width */
|
|
206
|
+
animation: nr-select-dropdown-enter 0.15s ease-out;
|
|
288
207
|
box-sizing: border-box;
|
|
289
|
-
|
|
290
|
-
width: var(
|
|
291
|
-
--nuraly-select-dropdown-width,
|
|
292
|
-
var(--select-dropdown-width, max-content)
|
|
293
|
-
);
|
|
294
|
-
/* Create new stacking context to prevent layering issues */
|
|
208
|
+
width: max-content;
|
|
295
209
|
isolation: isolate;
|
|
296
|
-
/* Ensure solid background to prevent visual bleed-through */
|
|
297
|
-
backdrop-filter: none;
|
|
298
|
-
-webkit-backdrop-filter: none;
|
|
299
|
-
/* Prevent pointer events when hidden */
|
|
300
|
-
pointer-events: none;
|
|
301
210
|
}
|
|
302
211
|
|
|
212
|
+
/* Show dropdown — must come after base .options */
|
|
303
213
|
:host([show]) .options {
|
|
304
|
-
|
|
214
|
+
display: flex !important;
|
|
215
|
+
pointer-events: auto !important;
|
|
305
216
|
}
|
|
306
217
|
|
|
307
218
|
.options.placement-top {
|
|
308
|
-
animation:
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
.options.placement-bottom {
|
|
312
|
-
animation: dropdown-enter var(--nuraly-select-dropdown-animation-duration, var(--nuraly-transition-fast)) ease-out;
|
|
219
|
+
animation: nr-select-dropdown-enter-top 0.15s ease-out;
|
|
313
220
|
}
|
|
314
221
|
|
|
315
|
-
@keyframes dropdown-enter {
|
|
316
|
-
from {
|
|
317
|
-
|
|
318
|
-
transform: translateY(-8px);
|
|
319
|
-
}
|
|
320
|
-
to {
|
|
321
|
-
opacity: 1;
|
|
322
|
-
transform: translateY(0);
|
|
323
|
-
}
|
|
222
|
+
@keyframes nr-select-dropdown-enter {
|
|
223
|
+
from { opacity: 0; transform: translateY(-8px); }
|
|
224
|
+
to { opacity: 1; transform: translateY(0); }
|
|
324
225
|
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
opacity: 0;
|
|
329
|
-
transform: translateY(8px);
|
|
330
|
-
}
|
|
331
|
-
to {
|
|
332
|
-
opacity: 1;
|
|
333
|
-
transform: translateY(0);
|
|
334
|
-
}
|
|
226
|
+
@keyframes nr-select-dropdown-enter-top {
|
|
227
|
+
from { opacity: 0; transform: translateY(8px); }
|
|
228
|
+
to { opacity: 1; transform: translateY(0); }
|
|
335
229
|
}
|
|
336
230
|
|
|
337
|
-
/* Search
|
|
231
|
+
/* Search */
|
|
338
232
|
.search-container {
|
|
339
233
|
position: sticky;
|
|
340
234
|
top: 0;
|
|
341
|
-
z-index:
|
|
342
|
-
background-color: var(--
|
|
343
|
-
border-bottom: var(--
|
|
344
|
-
|
|
345
|
-
padding: var(--nuraly-spacing-2);
|
|
235
|
+
z-index: 1;
|
|
236
|
+
background-color: var(--nr-surface, #ffffff);
|
|
237
|
+
border-bottom: 1px solid var(--nr-border, #e0e0e0);
|
|
238
|
+
padding: 0.5rem;
|
|
346
239
|
margin: 0;
|
|
347
|
-
/* Ensure it stays above options during scroll */
|
|
348
|
-
backdrop-filter: blur(8px);
|
|
349
|
-
-webkit-backdrop-filter: blur(8px);
|
|
350
|
-
/* Ensure proper stacking and smooth scrolling */
|
|
351
|
-
will-change: transform;
|
|
352
|
-
transform: translateZ(0);
|
|
353
240
|
}
|
|
354
|
-
|
|
355
|
-
/* Search input styling */
|
|
356
241
|
.search-container .search-input {
|
|
357
242
|
width: 100%;
|
|
358
|
-
max-width: var(--nuraly-select-input-container-max-width, var(--nuraly-select-width));
|
|
359
|
-
--nuraly-input-border-radius: var(--nuraly-select-border-radius, var(--nuraly-border-radius-md));
|
|
360
|
-
--nuraly-input-background-color: var(--nuraly-select-background, var(--nuraly-color-background-panel));
|
|
361
|
-
--nuraly-input-border-color: var(--nuraly-select-border-color, var(--nuraly-color-border));
|
|
362
|
-
--nuraly-input-text-color: var(--nuraly-select-color, var(--nuraly-color-text));
|
|
363
|
-
--nuraly-input-placeholder-color: var(--nuraly-select-placeholder-color, var(--nuraly-color-text-secondary));
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
/* Search icon in the search input */
|
|
367
|
-
.search-container .search-icon {
|
|
368
|
-
--nuraly-icon-color: var(--nuraly-color-select-icon, var(--nuraly-color-text-secondary));
|
|
369
243
|
}
|
|
370
244
|
|
|
371
|
-
/* Options
|
|
372
|
-
.options:has(.search-container) {
|
|
373
|
-
/* Add small padding-top when search is present to ensure proper separation */
|
|
374
|
-
padding-top: 0;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
/* Option items */
|
|
245
|
+
/* Options */
|
|
378
246
|
.option {
|
|
379
247
|
display: flex;
|
|
380
248
|
align-items: center;
|
|
381
|
-
gap:
|
|
382
|
-
padding:
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
font-size: var(--nuraly-select-option-font-size, var(--nuraly-font-size-sm));
|
|
249
|
+
gap: 6px;
|
|
250
|
+
padding: 6px 10px;
|
|
251
|
+
color: var(--nr-text, #161616);
|
|
252
|
+
font-size: 13px;
|
|
386
253
|
cursor: pointer;
|
|
387
|
-
transition: background-color
|
|
254
|
+
transition: background-color 0.15s;
|
|
388
255
|
position: relative;
|
|
389
256
|
}
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
.option:hover {
|
|
397
|
-
background-color: var(--nuraly-select-option-hover-background, var(--nuraly-color-background-hover));
|
|
257
|
+
.option:hover:not(.selected):not(.disabled) {
|
|
258
|
+
background-color: rgba(124, 58, 237, 0.08);
|
|
259
|
+
color: var(--nr-primary, #7c3aed);
|
|
260
|
+
cursor: pointer;
|
|
398
261
|
}
|
|
399
|
-
|
|
400
262
|
.option.selected {
|
|
401
|
-
background-color: var(--
|
|
402
|
-
color: var(--
|
|
263
|
+
background-color: var(--nr-primary, #7c3aed);
|
|
264
|
+
color: var(--nr-text-on-color, #ffffff);
|
|
403
265
|
}
|
|
404
|
-
|
|
405
266
|
.option.focused {
|
|
406
|
-
background-color:
|
|
407
|
-
|
|
408
|
-
outline-offset: -2px;
|
|
267
|
+
background-color: rgba(124, 58, 237, 0.08);
|
|
268
|
+
color: var(--nr-primary, #7c3aed);
|
|
409
269
|
}
|
|
410
|
-
|
|
411
270
|
.option.disabled {
|
|
412
|
-
opacity:
|
|
271
|
+
opacity: 0.5;
|
|
413
272
|
cursor: not-allowed;
|
|
414
273
|
}
|
|
415
274
|
|
|
@@ -417,95 +276,102 @@ import{css as t,nothing as e,html as i,LitElement as r}from"lit";import{property
|
|
|
417
276
|
flex: 1;
|
|
418
277
|
display: flex;
|
|
419
278
|
align-items: center;
|
|
420
|
-
gap:
|
|
279
|
+
gap: 0.5rem;
|
|
421
280
|
}
|
|
422
|
-
|
|
423
|
-
.option-icon {
|
|
424
|
-
--nuraly-icon-width: var(--nuraly-select-icon-size, var(--nuraly-font-size-base));
|
|
425
|
-
--nuraly-icon-color: currentColor;
|
|
426
|
-
}
|
|
427
|
-
|
|
281
|
+
.option-icon { color: currentColor; }
|
|
428
282
|
.option-text {
|
|
429
283
|
flex: 1;
|
|
430
284
|
overflow: hidden;
|
|
431
285
|
text-overflow: ellipsis;
|
|
432
286
|
white-space: nowrap;
|
|
433
287
|
}
|
|
434
|
-
|
|
435
288
|
.option-description {
|
|
436
|
-
font-size:
|
|
289
|
+
font-size: 12px;
|
|
437
290
|
opacity: 0.7;
|
|
438
|
-
margin-top:
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
.check-icon {
|
|
442
|
-
--nuraly-icon-width: var(--nuraly-select-icon-size, var(--nuraly-font-size-base));
|
|
443
|
-
--nuraly-icon-color: var(--nuraly-select-option-selected-color, var(--nuraly-color-text-on-color));
|
|
291
|
+
margin-top: 0.25rem;
|
|
444
292
|
}
|
|
293
|
+
.check-icon { color: var(--nr-text-on-color, #ffffff); }
|
|
445
294
|
|
|
295
|
+
/* No options */
|
|
446
296
|
.no-options {
|
|
447
297
|
display: flex;
|
|
448
298
|
align-items: center;
|
|
449
299
|
justify-content: center;
|
|
450
|
-
padding:
|
|
451
|
-
color: var(--
|
|
452
|
-
font-size:
|
|
300
|
+
padding: 12px 10px;
|
|
301
|
+
color: var(--nr-text-secondary, #525252);
|
|
302
|
+
font-size: 13px;
|
|
453
303
|
cursor: default;
|
|
454
304
|
user-select: none;
|
|
455
305
|
}
|
|
456
|
-
|
|
457
306
|
.no-options-content {
|
|
458
307
|
display: flex;
|
|
459
308
|
flex-direction: column;
|
|
460
309
|
align-items: center;
|
|
461
|
-
gap:
|
|
310
|
+
gap: 0.5rem;
|
|
462
311
|
text-align: center;
|
|
463
312
|
}
|
|
464
|
-
|
|
465
313
|
.no-options-icon {
|
|
466
|
-
--nuraly-icon-width: var(--nuraly-spacing-6);
|
|
467
|
-
--nuraly-icon-color: var(--select-no-options-icon-color, var(--nuraly-color-border));
|
|
468
314
|
opacity: 0.8;
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
.no-options-text {
|
|
472
|
-
font-size: var(--nuraly-select-option-font-size, var(--nuraly-font-size-sm));
|
|
473
|
-
color: var(--select-no-options-color, var(--nuraly-color-text-secondary));
|
|
474
|
-
line-height: 1.4;
|
|
315
|
+
color: var(--nr-border, #e0e0e0);
|
|
475
316
|
}
|
|
476
317
|
|
|
477
318
|
/* Validation message */
|
|
478
319
|
.validation-message {
|
|
479
320
|
display: block;
|
|
480
|
-
margin-top:
|
|
481
|
-
font-size:
|
|
482
|
-
color: var(--
|
|
321
|
+
margin-top: 0.25rem;
|
|
322
|
+
font-size: 0.75rem;
|
|
323
|
+
color: var(--nr-danger, #da1e28);
|
|
483
324
|
}
|
|
325
|
+
.validation-message.warning { color: var(--nr-warning, #f1c21b); }
|
|
326
|
+
.validation-message.success { color: var(--nr-success, #198038); }
|
|
484
327
|
|
|
485
|
-
|
|
486
|
-
|
|
328
|
+
/* Label slot */
|
|
329
|
+
::slotted([slot="label"]) {
|
|
330
|
+
display: block;
|
|
331
|
+
margin-bottom: 0.25rem;
|
|
332
|
+
font-weight: 500;
|
|
333
|
+
color: var(--nr-text, #161616);
|
|
487
334
|
}
|
|
488
335
|
|
|
489
|
-
|
|
490
|
-
|
|
336
|
+
/* Helper text slot */
|
|
337
|
+
::slotted([slot="helper-text"]) {
|
|
338
|
+
display: block;
|
|
339
|
+
margin-top: 0.25rem;
|
|
340
|
+
font-size: 0.75rem;
|
|
341
|
+
color: var(--nr-text-secondary, #525252);
|
|
491
342
|
}
|
|
492
343
|
|
|
493
|
-
/*
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
344
|
+
/* Status icons */
|
|
345
|
+
.status-icon.warning { color: var(--nr-warning, #f1c21b); }
|
|
346
|
+
.status-icon.error { color: var(--nr-danger, #da1e28); }
|
|
347
|
+
.status-icon.success { color: var(--nr-success, #198038); }
|
|
348
|
+
|
|
349
|
+
/* Clear icon */
|
|
350
|
+
.clear-icon {
|
|
351
|
+
color: var(--nr-text-secondary, #525252);
|
|
352
|
+
cursor: pointer;
|
|
353
|
+
pointer-events: auto !important;
|
|
499
354
|
}
|
|
355
|
+
.clear-icon:hover { color: var(--nr-text, #161616); }
|
|
500
356
|
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
357
|
+
/* Button type */
|
|
358
|
+
.select-button {
|
|
359
|
+
display: inline-flex;
|
|
360
|
+
align-items: center;
|
|
361
|
+
gap: 0.5rem;
|
|
362
|
+
padding: 0.5rem 1rem;
|
|
363
|
+
border: 1px solid var(--nr-border, #e0e0e0);
|
|
364
|
+
border-radius: 4px;
|
|
365
|
+
background-color: var(--nr-surface, #ffffff);
|
|
366
|
+
color: var(--nr-text, #161616);
|
|
367
|
+
cursor: pointer;
|
|
368
|
+
font-size: inherit;
|
|
369
|
+
transition: all 0.15s;
|
|
506
370
|
}
|
|
371
|
+
.select-button:hover { border-color: var(--nr-primary, #7c3aed); }
|
|
372
|
+
.select-button:disabled { opacity: 0.5; cursor: not-allowed; }
|
|
507
373
|
|
|
508
|
-
/* Accessibility
|
|
374
|
+
/* Accessibility */
|
|
509
375
|
@media (prefers-reduced-motion: reduce) {
|
|
510
376
|
.options,
|
|
511
377
|
.wrapper,
|
|
@@ -517,18 +383,39 @@ import{css as t,nothing as e,html as i,LitElement as r}from"lit";import{property
|
|
|
517
383
|
}
|
|
518
384
|
}
|
|
519
385
|
|
|
520
|
-
/* High contrast mode support */
|
|
521
386
|
@media (prefers-contrast: high) {
|
|
522
|
-
.wrapper {
|
|
523
|
-
border-width: 2px;
|
|
524
|
-
}
|
|
525
|
-
|
|
387
|
+
.wrapper { border-width: 2px; }
|
|
526
388
|
.wrapper:focus,
|
|
527
|
-
.wrapper:focus-within {
|
|
528
|
-
outline: 3px solid;
|
|
529
|
-
}
|
|
389
|
+
.wrapper:focus-within { outline: 3px solid; }
|
|
530
390
|
}
|
|
531
|
-
`;var m,f,b,w,x,z,O,E,k;!function(t){t.Default="default",t.Inline="inline",t.Button="button",t.Slot="slot"}(m||(m={})),function(t){t.Default="default",t.Warning="warning",t.Error="error",t.Success="success"}(f||(f={})),function(t){t.Small="small",t.Medium="medium",t.Large="large"}(b||(b={})),function(t){t.Small="small",t.Medium="medium",t.Large="large"}(w||(w={})),function(t){t.Horizontal="horizontal",t.Vertical="vertical"}(x||(x={})),function(t){t.Default="default",t.Solid="solid",t.Outline="outline",t.Borderless="borderless"}(z||(z={})),function(t){t.Bottom="bottom",t.Top="top",t.Auto="auto"}(O||(O={})),function(t){t.None="none",t.StartsWith="starts-with",t.Contains="contains",t.Fuzzy="fuzzy"}(E||(E={}));class S extends v{}class $ extends S{constructor(){super(...arguments),this._selectedOptions=[],this._initialized=!1}getSelectedOptions(){return[...this._selectedOptions]}getSelectedOption(){return this._selectedOptions[0]}selectOption(t){try{if(this.isOptionDisabled(t))return;const e=this.host.multiple,i=this.getCurrentValue();e?this.isOptionSelected(t)||(this._selectedOptions=[...this._selectedOptions,t],this.updateHostValue(),this.dispatchChangeEvent(i)):(this.isOptionSelected(t)?this._selectedOptions=[]:this._selectedOptions=[t],this.updateHostValue(),this.dispatchChangeEvent(i)),this.requestUpdate()}catch(t){this.handleError(t,"selectOption")}}unselectOption(t){try{if(this.isOptionSelected(t)){const e=this.getCurrentValue();this._selectedOptions=this._selectedOptions.filter(e=>e.value!==t.value),this.updateHostValue(),this.dispatchChangeEvent(e),this.requestUpdate()}}catch(t){this.handleError(t,"unselectOption")}}clearSelection(){try{if(this._selectedOptions.length>0){const t=this.getCurrentValue();this._selectedOptions=[],this.updateHostValue(),this.dispatchChangeEvent(t),this.requestUpdate()}}catch(t){this.handleError(t,"clearSelection")}}isOptionSelected(t){return this._selectedOptions.some(e=>e.value===t.value)}isOptionDisabled(t){return Boolean(t.disabled)||this.host.disabled}toggleOption(t){this.isOptionSelected(t)?this.unselectOption(t):this.selectOption(t)}initializeFromValue(){try{if(this._initialized)return;const t=this.host.value;if(!t||Array.isArray(t)&&0===t.length)return;const e=Array.isArray(t)?t:[t],i=this.host.options.filter(t=>e.includes(t.value));i.length>0&&(this._selectedOptions=this.host.multiple?i:[i[0]],this.requestUpdate()),this._initialized=!0}catch(t){this.handleError(t,"initializeFromValue")}}updateHostValue(){var t;const e=this.host.multiple?this._selectedOptions.map(t=>t.value):(null===(t=this._selectedOptions[0])||void 0===t?void 0:t.value)||"",i=this.host.value;let r=!1;if(this.host.multiple){const t=Array.isArray(i)?i:[],s=Array.isArray(e)?e:[];r=t.length===s.length&&t.every((t,e)=>t===s[e])}else r=i===e;r||(this.host.value=e)}getCurrentValue(){var t;return this.host.multiple?this._selectedOptions.map(t=>t.value):(null===(t=this._selectedOptions[0])||void 0===t?void 0:t.value)||""}dispatchChangeEvent(t){const e={value:this.getCurrentValue(),selectedOptions:this.getSelectedOptions(),previousValue:t};this.dispatchEvent(new CustomEvent("nr-change",{detail:e,bubbles:!0,composed:!0}))}hostUpdated(){this.syncWithHostOptions()}syncWithHostOptions(){try{this._selectedOptions=this._selectedOptions.filter(t=>this.host.options.some(e=>e.value===t.value)),this._selectedOptions=this._selectedOptions.map(t=>this.host.options.find(e=>e.value===t.value)||t),this.updateHostValue()}catch(t){this.handleError(t,"syncWithHostOptions")}}}class C extends S{constructor(t,e,i){super(t),this.selectionController=e,this.dropdownController=i,this._focusedIndex=-1,this._hasKeyboardNavigated=!1}handleKeyDown(t){try{const e=this.isSearchInputFocused();switch(t.key){case"ArrowDown":t.preventDefault(),this.dropdownController.isOpen?this.navigateNext():this.openDropdown();break;case"ArrowUp":t.preventDefault(),this.dropdownController.isOpen?this.navigatePrevious():this.openDropdown();break;case"Enter":this.dropdownController.isOpen?e&&this._focusedIndex>=0?(t.preventDefault(),this.selectFocused()):e||(t.preventDefault(),this.selectFocused()):(t.preventDefault(),this.openDropdown());break;case" ":e||(t.preventDefault(),this.dropdownController.isOpen?this.selectFocused():this.openDropdown());break;case"Escape":t.preventDefault(),this.closeDropdown();break;case"Tab":this.closeDropdown();break;case"Home":this.dropdownController.isOpen&&(t.preventDefault(),this.setFocusedIndex(0));break;case"End":this.dropdownController.isOpen&&(t.preventDefault(),this.setFocusedIndex(this.host.options.length-1));break;default:1===t.key.length&&/[a-zA-Z0-9]/.test(t.key)&&this.handleAlphanumericKey(t.key.toLowerCase())}}catch(t){this.handleError(t,"handleKeyDown")}}navigateNext(){try{const t=this.getNavigableOptions();if(0===t.length)return;if(this.isSearchInputFocused()&&(this._focusedIndex<0||!this._hasKeyboardNavigated))return this._hasKeyboardNavigated=!0,void this.setFocusedIndex(0);let e=this._focusedIndex+1;e>=t.length&&(e=0),this.setFocusedIndex(e)}catch(t){this.handleError(t,"navigateNext")}}navigatePrevious(){try{const t=this.getNavigableOptions();if(0===t.length)return;if(this.isSearchInputFocused()&&(this._focusedIndex<0||!this._hasKeyboardNavigated))return this._hasKeyboardNavigated=!0,void this.setFocusedIndex(t.length-1);let e=this._focusedIndex-1;e<0&&(e=t.length-1),this.setFocusedIndex(e)}catch(t){this.handleError(t,"navigatePrevious")}}selectFocused(){try{const t=this.getNavigableOptions()[this._focusedIndex];t&&!this.selectionController.isOptionDisabled(t)&&(this.selectionController.selectOption(t),this.host.multiple||this.closeDropdown())}catch(t){this.handleError(t,"selectFocused")}}openDropdown(){try{this.dropdownController.open(),this._hasKeyboardNavigated=!1,this._focusedIndex=-1}catch(t){this.handleError(t,"openDropdown")}}closeDropdown(){try{this.dropdownController.close(),this._focusedIndex=-1,this._hasKeyboardNavigated=!1}catch(t){this.handleError(t,"closeDropdown")}}setFocusedIndex(t){try{const e=this.getNavigableOptions();t>=0&&t<e.length&&(this._focusedIndex=t,this.dispatchFocusEvent(e[t],t),this.requestUpdate(),this.scrollToFocusedOption(t))}catch(t){this.handleError(t,"setFocusedIndex")}}scrollToFocusedOption(t){var e;try{const i=null===(e=this.host.shadowRoot)||void 0===e?void 0:e.querySelector(".options");if(!i)return;setTimeout(()=>{const e=i.querySelector(".option.focused");if(e)e.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"});else{const e=40,r=i.clientHeight,s=i.scrollTop,o=t*e,n=o+e,a=s+r;o<s?i.scrollTo({top:o,behavior:"smooth"}):n>a&&i.scrollTo({top:n-r,behavior:"smooth"})}},10)}catch(t){console.warn("Failed to scroll to focused option:",t)}}get focusedIndex(){return this._focusedIndex}get focusedOption(){return this.getNavigableOptions()[this._focusedIndex]}handleAlphanumericKey(t){try{const e=this.getNavigableOptions(),i=this._focusedIndex+1;for(let r=0;r<e.length;r++){const s=(i+r)%e.length;if(e[s].label.toLowerCase().startsWith(t)){this.setFocusedIndex(s),this.dropdownController.isOpen||this.openDropdown();break}}}catch(t){this.handleError(t,"handleAlphanumericKey")}}getNavigableOptions(){const t=this.host;if(!t.options||!Array.isArray(t.options))return[];let e=t.options;return t.searchable&&t.searchQuery&&"function"==typeof t.getFilteredOptions&&(e=t.getFilteredOptions()),e.filter(t=>!t.disabled)}dispatchFocusEvent(t,e){const i={focusedOption:t,focusedIndex:e};this.dispatchEvent(new CustomEvent("nr-select-focus",{detail:i,bubbles:!0,composed:!0}))}isSearchInputFocused(){var t;try{const e=this.host;if(!e.searchable)return!1;const i=null===(t=e.shadowRoot)||void 0===t?void 0:t.querySelector(".search-input");return!!i&&(document.activeElement===i||i.shadowRoot&&i.shadowRoot.querySelector("input")===i.shadowRoot.activeElement||i.contains(document.activeElement))}catch(t){return!1}}hostUpdated(){this.dropdownController.isOpen||-1===this._focusedIndex||(this._focusedIndex=-1)}}function A(t){if(t.parentElement)return t.parentElement;const e=t.getRootNode();return e instanceof ShadowRoot?e.host:null}function I(t,e,i={}){var r,s;const{offset:o=4,viewportMargin:n=8}=i,a=t.getBoundingClientRect(),l=e.getBoundingClientRect(),c=(null===(r=window.visualViewport)||void 0===r?void 0:r.height)||window.innerHeight,h=(null===(s=window.visualViewport)||void 0===s?void 0:s.width)||window.innerWidth,u=function(t){let e=t;for(;e;){const t=A(e);if(!t||t===document.body||t===document.documentElement)break;if(t instanceof HTMLElement){const e=getComputedStyle(t),i=e.transform,r=e.willChange,s=e.filter,o=e.perspective,n=e.contain;if(i&&"none"!==i||o&&"none"!==o||s&&"none"!==s||"transform"===r||"perspective"===r||"filter"===r||n&&n.includes("paint"))return t}e=t}return null}(e);let d={top:0,left:0};if(u){const t=u.getBoundingClientRect();d={top:t.top,left:t.left}}const p=c-a.bottom,v=a.top,y=l.height||200,g=function(t,e,i){return i>=t?"bottom":e>=t||e>i?"top":"bottom"}(y,v,p);let m;m="bottom"===g?a.bottom+o:a.top-y-o;let f=a.left;const b=a.width;return f=Math.max(n,Math.min(f,h-b-n)),m=Math.max(n,Math.min(m,c-y-n)),u&&(m-=d.top,f-=d.left),{top:m,left:f,width:a.width,placement:g}}function N(t,e,i,r={}){var s;const{viewportMargin:o=8,maxHeight:n}=r,a=(null===(s=window.visualViewport)||void 0===s?void 0:s.height)||window.innerHeight,l=e.getBoundingClientRect(),c=t.scrollHeight;let h;h="bottom"===i?a-l.bottom-o-2:l.top-o-2,n?(t.style.maxHeight=n,t.style.overflowY="auto"):c>h?(t.style.maxHeight=`${h}px`,t.style.overflowY="auto"):(t.style.maxHeight=`${c}px`,t.style.overflowY="auto")}class D extends S{constructor(){super(...arguments),this._isOpen=!1,this._position={top:0,left:0,width:0,placement:"bottom"},this._dropdownElement=null,this._triggerElement=null,this.handleResize=()=>{this._isOpen&&this.calculatePosition()},this.handleScroll=()=>{this._isOpen&&this._triggerElement&&(!function(t){var e;const i=t.getBoundingClientRect(),r=(null===(e=window.visualViewport)||void 0===e?void 0:e.height)||window.innerHeight;return i.bottom>=0&&i.top<=r}(this._triggerElement)?this.close():this.calculatePosition())}}get isOpen(){return this._isOpen}get position(){return Object.assign({},this._position)}open(){try{this._isOpen||(this._isOpen=!0,this.host.show=!0,this.requestUpdate(),this.findElements(),setTimeout(()=>{this.calculatePosition()},10),this.host&&"function"==typeof this.host.setupEventListeners&&setTimeout(()=>{this.host.setupEventListeners()},50),this.focusSearchInput(),this.dispatchEvent(new CustomEvent("nr-dropdown-open",{bubbles:!0,composed:!0})))}catch(t){this.handleError(t,"open")}}close(){try{this._isOpen&&(this._isOpen=!1,this.host.show=!1,this.resetPosition(),this.requestUpdate(),this.host&&"function"==typeof this.host.removeEventListeners&&this.host.removeEventListeners(),this.dispatchEvent(new CustomEvent("nr-dropdown-close",{bubbles:!0,composed:!0})))}catch(t){this.handleError(t,"close")}}toggle(){this._isOpen?this.close():this.open()}focusSearchInput(){try{const t=this.host;t&&t.searchable&&setTimeout(()=>{var e;const i=null===(e=t.shadowRoot)||void 0===e?void 0:e.querySelector(".search-input");i&&"function"==typeof i.focus&&i.focus()},100)}catch(t){console.warn("Failed to focus search input:",t)}}calculatePosition(){try{if(this._dropdownElement&&this._triggerElement||this.findElements(),!this._dropdownElement||!this._triggerElement)return;const t=I(this._triggerElement,this._dropdownElement,{offset:4,viewportMargin:8});this._position=t,this.applyPosition()}catch(t){this.handleError(t,"calculatePosition")}}resetPosition(){try{if(this._dropdownElement){t=this._dropdownElement,["position","top","left","right","bottom","width","min-width","max-height","min-height","height","overflow-y","transform","display","opacity","visibility","z-index"].forEach(e=>t.style.removeProperty(e)),t.classList.remove("placement-top","placement-bottom");this.host.maxHeight||this._dropdownElement.style.removeProperty("max-height")}}catch(t){this.handleError(t,"resetPosition")}var t}setElements(t,e){this._dropdownElement=t,this._triggerElement=e}findElements(){try{const t=this._host;if(t.optionsElement&&t.wrapper)return this._dropdownElement=t.optionsElement,void(this._triggerElement=t.wrapper);t.shadowRoot&&(this._dropdownElement=t.shadowRoot.querySelector(".options"),this._triggerElement=t.shadowRoot.querySelector(".wrapper"))}catch(t){this.handleError(t,"findElements")}}applyPosition(){var t;try{if(!this._dropdownElement||!this._triggerElement)return;const e=this.host.maxHeight,i=null===(t=getComputedStyle(this._dropdownElement).getPropertyValue("--nuraly-select-local-dropdown-max-height"))||void 0===t?void 0:t.trim(),r="auto"===i||!e&&"auto"===i;!function(t,e,i="9999"){t.style.position="fixed",t.style.top=`${e.top}px`,t.style.left=`${e.left}px`,t.style.removeProperty("right"),t.style.removeProperty("bottom"),t.style.minWidth=`${e.width}px`,t.style.removeProperty("width"),t.style.zIndex=i,t.style.height="auto",t.style.minHeight="auto",t.classList.remove("placement-top","placement-bottom"),t.classList.add(`placement-${e.placement}`)}(this._dropdownElement,this._position,"var(--nuraly-select-dropdown-z-index, 9999)"),e||r||(this._dropdownElement.style.maxHeight="none"),e?N(this._dropdownElement,this._triggerElement,this._position.placement,{viewportMargin:10,maxHeight:e}):r?(this._dropdownElement.style.removeProperty("max-height"),this._dropdownElement.style.overflowY="visible"):N(this._dropdownElement,this._triggerElement,this._position.placement,{viewportMargin:10})}catch(t){this.handleError(t,"applyPosition")}}getAvailableSpace(){var t,e;if(!this._triggerElement)return{above:0,below:0,left:0,right:0};const i=this._triggerElement.getBoundingClientRect(),r=(null===(t=window.visualViewport)||void 0===t?void 0:t.height)||window.innerHeight,s=(null===(e=window.visualViewport)||void 0===e?void 0:e.width)||window.innerWidth;return{above:i.top,below:r-i.bottom,left:i.left,right:s-i.right}}hostConnected(){window.addEventListener("resize",this.handleResize),window.addEventListener("scroll",this.handleScroll,!0)}hostDisconnected(){window.removeEventListener("resize",this.handleResize),window.removeEventListener("scroll",this.handleScroll,!0)}}class T extends S{constructor(){super(...arguments),this._focusedIndex=-1,this._hasFocus=!1}get focusedIndex(){return this._focusedIndex}getFocusedOption(){if(this._focusedIndex>=0&&this._focusedIndex<this.host.options.length)return this.host.options[this._focusedIndex]}get hasFocus(){return this._hasFocus}setFocusedOption(t){try{t>=0&&t<this.host.options.length&&(this._focusedIndex=t,this.requestUpdate(),this.dispatchEvent(new CustomEvent("nr-focus-change",{detail:{focusedIndex:t,focusedOption:this.getFocusedOption()},bubbles:!0,composed:!0})))}catch(t){this.handleError(t,"setFocusedOption")}}focus(){var t;try{const e=null===(t=this._host.shadowRoot)||void 0===t?void 0:t.querySelector(".wrapper");e&&(e.focus(),this._hasFocus=!0,this.requestUpdate(),this.dispatchEvent(new CustomEvent("nr-focus",{bubbles:!0,composed:!0})))}catch(t){this.handleError(t,"focus")}}blur(){var t;try{const e=null===(t=this._host.shadowRoot)||void 0===t?void 0:t.querySelector(".wrapper");e&&e.blur(),this._hasFocus=!1,this._focusedIndex=-1,this.requestUpdate(),this.dispatchEvent(new CustomEvent("nr-blur",{bubbles:!0,composed:!0}))}catch(t){this.handleError(t,"blur")}}focusNext(){try{const t=this.getNextFocusableIndex(this._focusedIndex);-1!==t&&this.setFocusedOption(t)}catch(t){this.handleError(t,"focusNext")}}focusPrevious(){try{const t=this.getPreviousFocusableIndex(this._focusedIndex);-1!==t&&this.setFocusedOption(t)}catch(t){this.handleError(t,"focusPrevious")}}focusFirst(){try{const t=this.getNextFocusableIndex(-1);-1!==t&&this.setFocusedOption(t)}catch(t){this.handleError(t,"focusFirst")}}focusLast(){try{const t=this.getPreviousFocusableIndex(this.host.options.length);-1!==t&&this.setFocusedOption(t)}catch(t){this.handleError(t,"focusLast")}}clearFocus(){this._focusedIndex=-1,this._hasFocus=!1,this.requestUpdate()}handleFocus(){this._hasFocus=!0,this.requestUpdate()}handleBlur(){this._hasFocus=!1,this._focusedIndex=-1,this.requestUpdate()}getNextFocusableIndex(t){const e=this.host.options;for(let i=t+1;i<e.length;i++)if(!e[i].disabled)return i;for(let i=0;i<=t;i++)if(!e[i].disabled)return i;return-1}getPreviousFocusableIndex(t){const e=this.host.options;for(let i=t-1;i>=0;i--)if(!e[i].disabled)return i;for(let i=e.length-1;i>=t;i--)if(!e[i].disabled)return i;return-1}findOptionIndex(t){return this.host.options.findIndex(e=>e.value===t)}focusOptionByValue(t){const e=this.findOptionIndex(t);-1!==e&&this.setFocusedOption(e)}}!function(t){t.Valid="valid",t.Invalid="invalid",t.Pending="pending",t.Pristine="pristine"}(k||(k={}));class R extends y{constructor(t,e){super(t),this.selectionController=e}get validationState(){return this._validationState}validate(){try{this._validationState=k.Pending;const t=this.selectionController.getSelectedOptions().length>0;return this.host.required&&!t?(this.setValidationResult(!1,"This field is required",k.Invalid),!1):(this.setValidationResult(!0,"",k.Valid),!0)}catch(t){return this.handleError(t,"validate"),this.setValidationResult(!1,"Validation error occurred",k.Invalid),!1}}reset(){try{this._isValid=!0,this._validationMessage="",this._validationState=k.Pristine,this.requestUpdate(),this.dispatchValidationEvent()}catch(t){this.handleError(t,"reset")}}getFormData(){var t;try{const e=this._host,i=e.name||e.getAttribute("name")||"select",r=this.selectionController.getSelectedOptions();return this.host.multiple?{[i]:r.map(t=>t.value)}:{[i]:(null===(t=r[0])||void 0===t?void 0:t.value)||""}}catch(t){return this.handleError(t,"getFormData"),{}}}reportValidity(){var t;const e=this.validate();if(!e){const e=null===(t=this._host.shadowRoot)||void 0===t?void 0:t.querySelector(".wrapper");e&&e.focus()}return e}setCustomValidity(t){try{t?this.setValidationResult(!1,t,k.Invalid):this.validate()}catch(t){this.handleError(t,"setCustomValidity")}}validateOnChange(){this._validationState!==k.Pristine&&this.validate()}validateOnBlur(){this._validationState===k.Pristine&&(this._validationState=k.Pending),this.validate()}setValidationResult(t,e,i){const r=this._isValid!==t||this._validationMessage!==e||this._validationState!==i;this._isValid=t,this._validationMessage=e,this._validationState=i,r&&(this.requestUpdate(),this.dispatchValidationEvent())}dispatchValidationEvent(){const t={isValid:this._isValid,validationMessage:this._validationMessage,validationState:this._validationState};this.dispatchEvent(new CustomEvent("nr-validation",{detail:t,bubbles:!0,composed:!0}))}hostUpdated(){this.validateOnChange()}getValidationClasses(){return{valid:this._isValid&&this._validationState===k.Valid,invalid:!this._isValid&&this._validationState===k.Invalid,pending:this._validationState===k.Pending,pristine:this._validationState===k.Pristine}}getAriaAttributes(){const t={};return this.host.required&&(t["aria-required"]="true"),this._isValid||(t["aria-invalid"]="true",this._validationMessage&&(t["aria-describedby"]="validation-message")),t}}class L extends S{constructor(){super(...arguments),this._searchQuery="",this.handleSearchInput=t=>{this.setSearchQuery(t.detail.value||"")},this.handleSearchClear=()=>{this.clearSearch()},this.handleSearchKeyDown=t=>{if(["ArrowDown","ArrowUp","Enter","Home","End"].includes(t.key)){const e=this.host.keyboardController;return void(e&&e.handleKeyDown(t))}t.stopPropagation(),"Escape"===t.key&&(this.host.closeDropdown(),this.host.focus())}}get searchQuery(){return this._searchQuery}get hasSearch(){return""!==this._searchQuery.trim()}setSearchQuery(t){this._searchQuery=t,this.host.searchQuery=t,this.host.requestUpdate()}search(t){this.setSearchQuery(t)}clearSearch(){this.setSearchQuery("")}getFilteredOptions(t){if(!this.host.searchable||!this._searchQuery.trim())return t;const e=this._searchQuery.toLowerCase().trim();return t.filter(t=>t.label.toLowerCase().includes(e)||t.value.toLowerCase().includes(e)||t.description&&t.description.toLowerCase().includes(e))}renderSearchInput(){return this.host.searchable?i`
|
|
391
|
+
`
|
|
392
|
+
/**
|
|
393
|
+
* @license
|
|
394
|
+
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
395
|
+
* SPDX-License-Identifier: MIT
|
|
396
|
+
*/,p=t=>class extends t{constructor(){super(...arguments),this.handleSystemThemeChange=()=>{this.closest("[data-theme]")||document.documentElement.hasAttribute("data-theme")||this.requestUpdate()}}connectedCallback(){super.connectedCallback(),this.setupThemeObserver(),this.setupDesignSystemObserver(),this.setupSystemThemeListener()}disconnectedCallback(){var t,i,e;super.disconnectedCallback(),null===(t=this.themeObserver)||void 0===t||t.disconnect(),null===(i=this.designSystemObserver)||void 0===i||i.disconnect(),null===(e=this.mediaQuery)||void 0===e||e.removeEventListener("change",this.handleSystemThemeChange)}get currentTheme(){var t,i;const e=(null===(t=this.closest("[data-theme]"))||void 0===t?void 0:t.getAttribute("data-theme"))||document.documentElement.getAttribute("data-theme");return e||((null===(i=window.matchMedia)||void 0===i?void 0:i.call(window,"(prefers-color-scheme: dark)").matches)?"dark":"light")}get currentDesignSystem(){var t;const i=(null===(t=this.closest("[design-system]"))||void 0===t?void 0:t.getAttribute("design-system"))||document.documentElement.getAttribute("design-system");return"carbon"===i?i:"default"}setupThemeObserver(){this.themeObserver=new MutationObserver(()=>{this.requestUpdate()}),this.themeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})}setupDesignSystemObserver(){this.designSystemObserver=new MutationObserver(()=>{this.requestUpdate()}),this.designSystemObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["design-system"]})}setupSystemThemeListener(){window.matchMedia&&(this.mediaQuery=window.matchMedia("(prefers-color-scheme: dark)"),this.mediaQuery.addEventListener("change",this.handleSystemThemeChange))}},u=()=>{var t;return void 0!==globalThis.litElementVersions||"undefined"!=typeof process&&"development"===(null===(t=process.env)||void 0===t?void 0:t.NODE_ENV)||"undefined"!=typeof window&&("localhost"===window.location.hostname||"127.0.0.1"===window.location.hostname)},v=t=>class extends t{constructor(){super(...arguments),this.requiredComponents=[]}validateDependencies(){if(u())for(const t of this.requiredComponents)if(!this.isComponentAvailable(t))throw new Error(`Required component "${t}" is not registered. Please import and register the component before using ${this.tagName.toLowerCase()}. Example: import '@nuralyui/${t}';`)}validateDependenciesWithHandler(t){if(!u())return!0;let i=!0;for(const e of this.requiredComponents)if(!this.isComponentAvailable(e)){i=!1;const s=new Error(`Required component "${e}" is not registered. Please import and register the component before using ${this.tagName.toLowerCase()}.`);t?t(e,s):console.error(s.message)}return i}isComponentAvailable(t){return!!customElements.get(t)}getMissingDependencies(){return this.requiredComponents.filter(t=>!this.isComponentAvailable(t))}areDependenciesAvailable(){return this.requiredComponents.every(t=>this.isComponentAvailable(t))}addRequiredComponent(t){this.requiredComponents.includes(t)||this.requiredComponents.push(t)}removeRequiredComponent(t){const i=this.requiredComponents.indexOf(t);i>-1&&this.requiredComponents.splice(i,1)}},f=t=>class extends t{dispatchCustomEvent(t,i){this.dispatchEvent(new CustomEvent(t,{detail:i,bubbles:!0,composed:!0}))}dispatchEventWithMetadata(t,i){var e;const s=Object.assign(Object.assign({},i),{timestamp:Date.now(),componentName:(null===(e=this.tagName)||void 0===e?void 0:e.toLowerCase())||"unknown"});this.dispatchCustomEvent(t,s)}dispatchInputEvent(t,i){const e=Object.assign({target:i.target||this,value:i.value,originalEvent:i.originalEvent},i);this.dispatchCustomEvent(t,e)}dispatchFocusEvent(t,i){const e=Object.assign({target:i.target||this,value:i.value,focused:i.focused,cursorPosition:i.cursorPosition,selectedText:i.selectedText},i);this.dispatchCustomEvent(t,e)}dispatchValidationEvent(t,i){var e;const s=Object.assign({target:i.target||this,value:i.value,isValid:null!==(e=i.isValid)&&void 0!==e&&e,error:i.error},i);this.dispatchCustomEvent(t,s)}dispatchActionEvent(t,i){const e=Object.assign({target:i.target||this,action:i.action,previousValue:i.previousValue,newValue:i.newValue},i);this.dispatchCustomEvent(t,e)}isReadonlyKeyAllowed(t){if(t.ctrlKey||t.metaKey){return["KeyA","KeyC"].includes(t.code)}return["Tab","Escape","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(t.key)}isActivationKey(t){return"Enter"===t.key||" "===t.key}},m=new Set,g=new Map;
|
|
397
|
+
/**
|
|
398
|
+
* @license
|
|
399
|
+
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
400
|
+
* SPDX-License-Identifier: MIT
|
|
401
|
+
*/
|
|
402
|
+
const b=t=>{class i extends t{constructor(){super(...arguments),this.t=null}createRenderRoot(){return this.constructor.useShadowDom?super.createRenderRoot():this}connectedCallback(){const t=this.constructor.useShadowDom;if(!t&&null===this.t)for(this.t=[];this.firstChild;)this.t.push(this.removeChild(this.firstChild));if(super.connectedCallback(),!t){const t=this.constructor,i=this.tagName.toLowerCase(),e=t.styles;if(e){const t=w(e);t&&function(t,i,e){var s;if(!g.has(t)){const e=new CSSStyleSheet;e.replaceSync(i),g.set(t,e)}const o=g.get(t),r=`doc:${t}`;if(m.has(r)||(document.adoptedStyleSheets=[...document.adoptedStyleSheets,o],m.add(r)),e){let i=e;for(;i;){const e=i.getRootNode();if(!(e instanceof ShadowRoot))break;{const r=`shadow:${((null===(s=e.host)||void 0===s?void 0:s.tagName)||"").toLowerCase()}:${t}`;m.has(r)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,o],m.add(r)),i=e.host}}}}(i,t,this)}}}get lightChildren(){return this.t?this.t.filter(t=>!(t instanceof Element&&t.hasAttribute("slot"))):[]}lightChildrenNamed(t){return this.t?this.t.filter(i=>i instanceof Element&&i.getAttribute("slot")===t):[]}}return i.useShadowDom=!1,i};function w(t){return Array.isArray(t)?t.map(t=>w(t)).filter(Boolean).join("\n"):t&&"string"==typeof t.cssText?t.cssText:"string"==typeof t?t:""}
|
|
403
|
+
/**
|
|
404
|
+
* @license
|
|
405
|
+
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
406
|
+
* SPDX-License-Identifier: MIT
|
|
407
|
+
*/var x,y,E,O,S,$,C,A,k;!function(t){t.Default="default",t.Inline="inline",t.Button="button",t.Slot="slot"}(x||(x={})),function(t){t.Default="default",t.Warning="warning",t.Error="error",t.Success="success"}(y||(y={})),function(t){t.Small="small",t.Medium="medium",t.Large="large"}(E||(E={})),function(t){t.Small="small",t.Medium="medium",t.Large="large"}(O||(O={})),function(t){t.Horizontal="horizontal",t.Vertical="vertical"}(S||(S={})),function(t){t.Default="default",t.Solid="solid",t.Outline="outline",t.Borderless="borderless"}($||($={})),function(t){t.Bottom="bottom",t.Top="top",t.Auto="auto"}(C||(C={})),function(t){t.None="none",t.StartsWith="starts-with",t.Contains="contains",t.Fuzzy="fuzzy"}(A||(A={}));
|
|
408
|
+
/**
|
|
409
|
+
* @license
|
|
410
|
+
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
411
|
+
* SPDX-License-Identifier: MIT
|
|
412
|
+
*/
|
|
413
|
+
class D{constructor(t){this._host=t,t.addController(this)}get host(){return this._host}hostConnected(){}hostDisconnected(){}hostUpdate(){}hostUpdated(){}requestUpdate(){try{this._host.requestUpdate()}catch(t){this.handleError(t,"requestUpdate")}}dispatchEvent(t){try{return this._host.dispatchEvent(t)}catch(t){return this.handleError(t,"dispatchEvent"),!1}}handleError(t,i){console.error(`[${this.constructor.name}] Error in ${i}:`,t);try{this._host.dispatchEvent(new CustomEvent("nr-controller-error",{detail:{error:t.message,context:i,controller:this.constructor.name},bubbles:!0,composed:!0}))}catch(t){}}safeExecute(t,i,e){try{return t()}catch(t){return this.handleError(t,i),e}}debounce(t,i){let e;const s=(...s)=>{void 0!==e&&clearTimeout(e),e=setTimeout(()=>{e=void 0,t.apply(this,s)},i)};return s.cancel=()=>{void 0!==e&&(clearTimeout(e),e=void 0)},s}}
|
|
414
|
+
/**
|
|
415
|
+
* @license
|
|
416
|
+
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
417
|
+
* SPDX-License-Identifier: MIT
|
|
418
|
+
*/class T extends D{constructor(){super(...arguments),this._isValid=!0,this._validationMessage="",this._validationState="pristine",this._rules=[]}get isValid(){return this._isValid}get validationMessage(){return this._validationMessage}get validationState(){return this._validationState}addRule(t){this._rules.push(t),this.requestUpdate()}removeRule(t){this._rules=this._rules.filter(i=>!t(i)),this.requestUpdate()}clearRules(){this._rules=[],this.clearValidation()}clearValidation(){this._isValid=!0,this._validationMessage="",this._validationState="pristine",this.requestUpdate(),this.dispatchValidationEvent()}checkValidity(){return this.validate()}reportValidity(){const t=this.checkValidity();return t||this.dispatchValidationEvent(),t}dispatchValidationEvent(){this.dispatchEvent(new CustomEvent("nr-validation",{detail:{isValid:this._isValid,validationMessage:this._validationMessage,validationState:this._validationState},bubbles:!0,composed:!0}))}}class I extends D{}class N extends I{constructor(){super(...arguments),this._selectedOptions=[],this._initialized=!1}getSelectedOptions(){return[...this._selectedOptions]}getSelectedOption(){return this._selectedOptions[0]}selectOption(t){try{if(this.isOptionDisabled(t))return;const i=this.host.multiple,e=this.getCurrentValue();i?this.isOptionSelected(t)||(this._selectedOptions=[...this._selectedOptions,t],this.updateHostValue(),this.dispatchChangeEvent(e)):(this.isOptionSelected(t)?this._selectedOptions=[]:this._selectedOptions=[t],this.updateHostValue(),this.dispatchChangeEvent(e)),this.requestUpdate()}catch(t){this.handleError(t,"selectOption")}}unselectOption(t){try{if(this.isOptionSelected(t)){const i=this.getCurrentValue();this._selectedOptions=this._selectedOptions.filter(i=>i.value!==t.value),this.updateHostValue(),this.dispatchChangeEvent(i),this.requestUpdate()}}catch(t){this.handleError(t,"unselectOption")}}clearSelection(){try{if(this._selectedOptions.length>0){const t=this.getCurrentValue();this._selectedOptions=[],this.updateHostValue(),this.dispatchChangeEvent(t),this.requestUpdate()}}catch(t){this.handleError(t,"clearSelection")}}isOptionSelected(t){return this._selectedOptions.some(i=>i.value===t.value)}isOptionDisabled(t){return Boolean(t.disabled)||this.host.disabled}toggleOption(t){this.isOptionSelected(t)?this.unselectOption(t):this.selectOption(t)}initializeFromValue(){try{if(this._initialized)return;const t=this.host.value;if(!t||Array.isArray(t)&&0===t.length)return;const i=Array.isArray(t)?t:[t],e=this.host.options.filter(t=>i.includes(t.value));e.length>0&&(this._selectedOptions=this.host.multiple?e:[e[0]],this.requestUpdate()),this._initialized=!0}catch(t){this.handleError(t,"initializeFromValue")}}updateHostValue(){var t;const i=this.host.multiple?this._selectedOptions.map(t=>t.value):(null===(t=this._selectedOptions[0])||void 0===t?void 0:t.value)||"",e=this.host.value;let s=!1;if(this.host.multiple){const t=Array.isArray(e)?e:[],o=Array.isArray(i)?i:[];s=t.length===o.length&&t.every((t,i)=>t===o[i])}else s=e===i;s||(this.host.value=i)}getCurrentValue(){var t;return this.host.multiple?this._selectedOptions.map(t=>t.value):(null===(t=this._selectedOptions[0])||void 0===t?void 0:t.value)||""}dispatchChangeEvent(t){const i={value:this.getCurrentValue(),selectedOptions:this.getSelectedOptions(),previousValue:t};this.dispatchEvent(new CustomEvent("nr-change",{detail:i,bubbles:!0,composed:!0}))}hostUpdated(){this.syncWithHostOptions()}syncWithHostOptions(){try{this._selectedOptions=this._selectedOptions.filter(t=>this.host.options.some(i=>i.value===t.value)),this._selectedOptions=this._selectedOptions.map(t=>this.host.options.find(i=>i.value===t.value)||t),this.updateHostValue()}catch(t){this.handleError(t,"syncWithHostOptions")}}}class z extends I{constructor(t,i,e){super(t),this.selectionController=i,this.dropdownController=e,this._focusedIndex=-1,this._hasKeyboardNavigated=!1}handleKeyDown(t){try{const i=this.isSearchInputFocused();switch(t.key){case"ArrowDown":t.preventDefault(),this.dropdownController.isOpen?this.navigateNext():this.openDropdown();break;case"ArrowUp":t.preventDefault(),this.dropdownController.isOpen?this.navigatePrevious():this.openDropdown();break;case"Enter":this.dropdownController.isOpen?i&&this._focusedIndex>=0?(t.preventDefault(),this.selectFocused()):i||(t.preventDefault(),this.selectFocused()):(t.preventDefault(),this.openDropdown());break;case" ":i||(t.preventDefault(),this.dropdownController.isOpen?this.selectFocused():this.openDropdown());break;case"Escape":t.preventDefault(),this.closeDropdown();break;case"Tab":this.closeDropdown();break;case"Home":this.dropdownController.isOpen&&(t.preventDefault(),this.setFocusedIndex(0));break;case"End":this.dropdownController.isOpen&&(t.preventDefault(),this.setFocusedIndex(this.host.options.length-1));break;default:1===t.key.length&&/[a-zA-Z0-9]/.test(t.key)&&this.handleAlphanumericKey(t.key.toLowerCase())}}catch(t){this.handleError(t,"handleKeyDown")}}navigateNext(){try{const t=this.getNavigableOptions();if(0===t.length)return;if(this.isSearchInputFocused()&&(this._focusedIndex<0||!this._hasKeyboardNavigated))return this._hasKeyboardNavigated=!0,void this.setFocusedIndex(0);let i=this._focusedIndex+1;i>=t.length&&(i=0),this.setFocusedIndex(i)}catch(t){this.handleError(t,"navigateNext")}}navigatePrevious(){try{const t=this.getNavigableOptions();if(0===t.length)return;if(this.isSearchInputFocused()&&(this._focusedIndex<0||!this._hasKeyboardNavigated))return this._hasKeyboardNavigated=!0,void this.setFocusedIndex(t.length-1);let i=this._focusedIndex-1;i<0&&(i=t.length-1),this.setFocusedIndex(i)}catch(t){this.handleError(t,"navigatePrevious")}}selectFocused(){try{const t=this.getNavigableOptions()[this._focusedIndex];t&&!this.selectionController.isOptionDisabled(t)&&(this.selectionController.selectOption(t),this.host.multiple||this.closeDropdown())}catch(t){this.handleError(t,"selectFocused")}}openDropdown(){try{this.dropdownController.open(),this._hasKeyboardNavigated=!1,this._focusedIndex=-1}catch(t){this.handleError(t,"openDropdown")}}closeDropdown(){try{this.dropdownController.close(),this._focusedIndex=-1,this._hasKeyboardNavigated=!1}catch(t){this.handleError(t,"closeDropdown")}}setFocusedIndex(t){try{const i=this.getNavigableOptions();t>=0&&t<i.length&&(this._focusedIndex=t,this.dispatchFocusEvent(i[t],t),this.requestUpdate(),this.scrollToFocusedOption(t))}catch(t){this.handleError(t,"setFocusedIndex")}}scrollToFocusedOption(t){var i;try{const e=this.host,s=null===(i=e.querySelector)||void 0===i?void 0:i.call(e,".options");if(!s)return;setTimeout(()=>{const i=s.querySelector(".option.focused");if(i)i.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"});else{const i=40,e=s.clientHeight,o=s.scrollTop,r=t*i,n=r+i,a=o+e;r<o?s.scrollTo({top:r,behavior:"smooth"}):n>a&&s.scrollTo({top:n-e,behavior:"smooth"})}},10)}catch(t){console.warn("Failed to scroll to focused option:",t)}}get focusedIndex(){return this._focusedIndex}get focusedOption(){return this.getNavigableOptions()[this._focusedIndex]}handleAlphanumericKey(t){try{const i=this.getNavigableOptions(),e=this._focusedIndex+1;for(let s=0;s<i.length;s++){const o=(e+s)%i.length;if(i[o].label.toLowerCase().startsWith(t)){this.setFocusedIndex(o),this.dropdownController.isOpen||this.openDropdown();break}}}catch(t){this.handleError(t,"handleAlphanumericKey")}}getNavigableOptions(){const t=this.host;if(!t.options||!Array.isArray(t.options))return[];let i=t.options;return t.searchable&&t.searchQuery&&"function"==typeof t.getFilteredOptions&&(i=t.getFilteredOptions()),i.filter(t=>!t.disabled)}dispatchFocusEvent(t,i){const e={focusedOption:t,focusedIndex:i};this.dispatchEvent(new CustomEvent("nr-select-focus",{detail:e,bubbles:!0,composed:!0}))}isSearchInputFocused(){var t;try{const i=this.host;if(!i.searchable)return!1;const e=null===(t=i.querySelector)||void 0===t?void 0:t.call(i,".search-input");return!!e&&(document.activeElement===e||e.contains(document.activeElement))}catch(t){return!1}}hostUpdated(){this.dropdownController.isOpen||-1===this._focusedIndex||(this._focusedIndex=-1)}}function R(t){if(t.parentElement)return t.parentElement;const i=t.getRootNode();return i instanceof ShadowRoot?i.host:null}function P(t,i,e={}){var s,o;const{offset:r=4,viewportMargin:n=8}=e,a=t.getBoundingClientRect(),h=i.getBoundingClientRect(),c=(null===(s=window.visualViewport)||void 0===s?void 0:s.height)||window.innerHeight,l=(null===(o=window.visualViewport)||void 0===o?void 0:o.width)||window.innerWidth,d=function(t){let i=t;for(;i;){const t=R(i);if(!t||t===document.body||t===document.documentElement)break;if(t instanceof HTMLElement){const i=getComputedStyle(t),e=i.transform,s=i.willChange,o=i.filter,r=i.perspective,n=i.contain;if(e&&"none"!==e||r&&"none"!==r||o&&"none"!==o||"transform"===s||"perspective"===s||"filter"===s||n&&n.includes("paint"))return t}i=t}return null}(i);let p={top:0,left:0};if(d){const t=d.getBoundingClientRect();p={top:t.top,left:t.left}}const u=c-a.bottom,v=a.top,f=h.height||200,m=function(t,i,e){return e>=t?"bottom":i>=t||i>e?"top":"bottom"}(f,v,u);let g;g="bottom"===m?a.bottom+r:a.top-f-r;let b=a.left;const w=a.width;return b=Math.max(n,Math.min(b,l-w-n)),g=Math.max(n,Math.min(g,c-f-n)),d&&(g-=p.top,b-=p.left),{top:g,left:b,width:a.width,placement:m}}function L(t,i,e,s={}){var o;const{viewportMargin:r=8,maxHeight:n}=s,a=(null===(o=window.visualViewport)||void 0===o?void 0:o.height)||window.innerHeight,h=i.getBoundingClientRect(),c=t.scrollHeight;let l;l="bottom"===e?a-h.bottom-r-2:h.top-r-2,n?(t.style.maxHeight=n,t.style.overflowY="auto"):c>l?(t.style.maxHeight=`${l}px`,t.style.overflowY="auto"):(t.style.maxHeight=`${c}px`,t.style.overflowY="auto")}class V extends I{constructor(){super(...arguments),this._isOpen=!1,this._position={top:0,left:0,width:0,placement:"bottom"},this._dropdownElement=null,this._triggerElement=null,this.handleResize=()=>{this._isOpen&&this.calculatePosition()},this.handleScroll=()=>{this._isOpen&&this._triggerElement&&(!function(t){var i;const e=t.getBoundingClientRect(),s=(null===(i=window.visualViewport)||void 0===i?void 0:i.height)||window.innerHeight;return e.bottom>=0&&e.top<=s}(this._triggerElement)?this.close():this.calculatePosition())}}get isOpen(){return this._isOpen}get position(){return Object.assign({},this._position)}open(){try{this._isOpen||(this._isOpen=!0,this.host.show=!0,this.requestUpdate(),this.findElements(),setTimeout(()=>{this.calculatePosition()},10),this.host&&"function"==typeof this.host.setupEventListeners&&setTimeout(()=>{this.host.setupEventListeners()},50),this.focusSearchInput(),this.dispatchEvent(new CustomEvent("nr-dropdown-open",{bubbles:!0,composed:!0})))}catch(t){this.handleError(t,"open")}}close(){try{this._isOpen&&(this._isOpen=!1,this.host.show=!1,this.resetPosition(),this.requestUpdate(),this.host&&"function"==typeof this.host.removeEventListeners&&this.host.removeEventListeners(),this.dispatchEvent(new CustomEvent("nr-dropdown-close",{bubbles:!0,composed:!0})))}catch(t){this.handleError(t,"close")}}toggle(){this._isOpen?this.close():this.open()}focusSearchInput(){try{const t=this.host;t&&t.searchable&&setTimeout(()=>{var i;const e=null===(i=t.querySelector)||void 0===i?void 0:i.call(t,".search-input");e&&"function"==typeof e.focus&&e.focus()},100)}catch(t){console.warn("Failed to focus search input:",t)}}calculatePosition(){try{if(this._dropdownElement&&this._triggerElement||this.findElements(),!this._dropdownElement||!this._triggerElement)return;const t=P(this._triggerElement,this._dropdownElement,{offset:4,viewportMargin:8});this._position=t,this.applyPosition()}catch(t){this.handleError(t,"calculatePosition")}}resetPosition(){try{if(this._dropdownElement){t=this._dropdownElement,["position","top","left","right","bottom","width","min-width","max-height","min-height","height","overflow-y","transform","display","opacity","visibility","z-index"].forEach(i=>t.style.removeProperty(i)),t.classList.remove("placement-top","placement-bottom");this.host.maxHeight||this._dropdownElement.style.removeProperty("max-height")}}catch(t){this.handleError(t,"resetPosition")}var t}setElements(t,i){this._dropdownElement=t,this._triggerElement=i}findElements(){try{const t=this._host;if(t.optionsElement&&t.wrapper)return this._dropdownElement=t.optionsElement,void(this._triggerElement=t.wrapper);t.querySelector&&(this._dropdownElement=t.querySelector(".options"),this._triggerElement=t.querySelector(".wrapper"))}catch(t){this.handleError(t,"findElements")}}applyPosition(){var t;try{if(!this._dropdownElement||!this._triggerElement)return;const i=this.host.maxHeight,e=null===(t=getComputedStyle(this._dropdownElement).getPropertyValue("--nuraly-select-local-dropdown-max-height"))||void 0===t?void 0:t.trim(),s="auto"===e||!i&&"auto"===e;!function(t,i,e="9999"){t.style.position="fixed",t.style.top=`${i.top}px`,t.style.left=`${i.left}px`,t.style.removeProperty("right"),t.style.removeProperty("bottom"),t.style.minWidth=`${i.width}px`,t.style.removeProperty("width"),t.style.zIndex=e,t.style.height="auto",t.style.minHeight="auto",t.classList.remove("placement-top","placement-bottom"),t.classList.add(`placement-${i.placement}`)}(this._dropdownElement,this._position,"9999"),i||s||(this._dropdownElement.style.maxHeight="none"),i?L(this._dropdownElement,this._triggerElement,this._position.placement,{viewportMargin:10,maxHeight:i}):s?(this._dropdownElement.style.removeProperty("max-height"),this._dropdownElement.style.overflowY="visible"):L(this._dropdownElement,this._triggerElement,this._position.placement,{viewportMargin:10})}catch(t){this.handleError(t,"applyPosition")}}getAvailableSpace(){var t,i;if(!this._triggerElement)return{above:0,below:0,left:0,right:0};const e=this._triggerElement.getBoundingClientRect(),s=(null===(t=window.visualViewport)||void 0===t?void 0:t.height)||window.innerHeight,o=(null===(i=window.visualViewport)||void 0===i?void 0:i.width)||window.innerWidth;return{above:e.top,below:s-e.bottom,left:e.left,right:o-e.right}}hostConnected(){window.addEventListener("resize",this.handleResize),window.addEventListener("scroll",this.handleScroll,!0)}hostDisconnected(){window.removeEventListener("resize",this.handleResize),window.removeEventListener("scroll",this.handleScroll,!0)}}class B extends I{constructor(){super(...arguments),this._focusedIndex=-1,this._hasFocus=!1}get focusedIndex(){return this._focusedIndex}getFocusedOption(){if(this._focusedIndex>=0&&this._focusedIndex<this.host.options.length)return this.host.options[this._focusedIndex]}get hasFocus(){return this._hasFocus}setFocusedOption(t){try{t>=0&&t<this.host.options.length&&(this._focusedIndex=t,this.requestUpdate(),this.dispatchEvent(new CustomEvent("nr-focus-change",{detail:{focusedIndex:t,focusedOption:this.getFocusedOption()},bubbles:!0,composed:!0})))}catch(t){this.handleError(t,"setFocusedOption")}}focus(){var t;try{const i=this._host,e=null===(t=i.querySelector)||void 0===t?void 0:t.call(i,".wrapper");e&&(e.focus(),this._hasFocus=!0,this.requestUpdate(),this.dispatchEvent(new CustomEvent("nr-focus",{bubbles:!0,composed:!0})))}catch(t){this.handleError(t,"focus")}}blur(){var t;try{const i=this._host,e=null===(t=i.querySelector)||void 0===t?void 0:t.call(i,".wrapper");e&&e.blur(),this._hasFocus=!1,this._focusedIndex=-1,this.requestUpdate(),this.dispatchEvent(new CustomEvent("nr-blur",{bubbles:!0,composed:!0}))}catch(t){this.handleError(t,"blur")}}focusNext(){try{const t=this.getNextFocusableIndex(this._focusedIndex);-1!==t&&this.setFocusedOption(t)}catch(t){this.handleError(t,"focusNext")}}focusPrevious(){try{const t=this.getPreviousFocusableIndex(this._focusedIndex);-1!==t&&this.setFocusedOption(t)}catch(t){this.handleError(t,"focusPrevious")}}focusFirst(){try{const t=this.getNextFocusableIndex(-1);-1!==t&&this.setFocusedOption(t)}catch(t){this.handleError(t,"focusFirst")}}focusLast(){try{const t=this.getPreviousFocusableIndex(this.host.options.length);-1!==t&&this.setFocusedOption(t)}catch(t){this.handleError(t,"focusLast")}}clearFocus(){this._focusedIndex=-1,this._hasFocus=!1,this.requestUpdate()}handleFocus(){this._hasFocus=!0,this.requestUpdate()}handleBlur(){this._hasFocus=!1,this._focusedIndex=-1,this.requestUpdate()}getNextFocusableIndex(t){const i=this.host.options;for(let e=t+1;e<i.length;e++)if(!i[e].disabled)return e;for(let e=0;e<=t;e++)if(!i[e].disabled)return e;return-1}getPreviousFocusableIndex(t){const i=this.host.options;for(let e=t-1;e>=0;e--)if(!i[e].disabled)return e;for(let e=i.length-1;e>=t;e--)if(!i[e].disabled)return e;return-1}findOptionIndex(t){return this.host.options.findIndex(i=>i.value===t)}focusOptionByValue(t){const i=this.findOptionIndex(t);-1!==i&&this.setFocusedOption(i)}}!function(t){t.Valid="valid",t.Invalid="invalid",t.Pending="pending",t.Pristine="pristine"}(k||(k={}));class F extends T{constructor(t,i){super(t),this.selectionController=i}get validationState(){return this._validationState}validate(){try{this._validationState=k.Pending;const t=this.selectionController.getSelectedOptions().length>0;return this.host.required&&!t?(this.setValidationResult(!1,"This field is required",k.Invalid),!1):(this.setValidationResult(!0,"",k.Valid),!0)}catch(t){return this.handleError(t,"validate"),this.setValidationResult(!1,"Validation error occurred",k.Invalid),!1}}reset(){try{this._isValid=!0,this._validationMessage="",this._validationState=k.Pristine,this.requestUpdate(),this.dispatchValidationEvent()}catch(t){this.handleError(t,"reset")}}getFormData(){var t;try{const i=this._host,e=i.name||i.getAttribute("name")||"select",s=this.selectionController.getSelectedOptions();return this.host.multiple?{[e]:s.map(t=>t.value)}:{[e]:(null===(t=s[0])||void 0===t?void 0:t.value)||""}}catch(t){return this.handleError(t,"getFormData"),{}}}reportValidity(){var t;const i=this.validate();if(!i){const i=this._host,e=null===(t=i.querySelector)||void 0===t?void 0:t.call(i,".wrapper");e&&e.focus()}return i}setCustomValidity(t){try{t?this.setValidationResult(!1,t,k.Invalid):this.validate()}catch(t){this.handleError(t,"setCustomValidity")}}validateOnChange(){this._validationState!==k.Pristine&&this.validate()}validateOnBlur(){this._validationState===k.Pristine&&(this._validationState=k.Pending),this.validate()}setValidationResult(t,i,e){const s=this._isValid!==t||this._validationMessage!==i||this._validationState!==e;this._isValid=t,this._validationMessage=i,this._validationState=e,s&&(this.requestUpdate(),this.dispatchValidationEvent())}dispatchValidationEvent(){const t={isValid:this._isValid,validationMessage:this._validationMessage,validationState:this._validationState};this.dispatchEvent(new CustomEvent("nr-validation",{detail:t,bubbles:!0,composed:!0}))}hostUpdated(){this.validateOnChange()}getValidationClasses(){return{valid:this._isValid&&this._validationState===k.Valid,invalid:!this._isValid&&this._validationState===k.Invalid,pending:this._validationState===k.Pending,pristine:this._validationState===k.Pristine}}getAriaAttributes(){const t={};return this.host.required&&(t["aria-required"]="true"),this._isValid||(t["aria-invalid"]="true",this._validationMessage&&(t["aria-describedby"]="validation-message")),t}}class M extends I{constructor(){super(...arguments),this._searchQuery="",this.handleSearchInput=t=>{this.setSearchQuery(t.detail.value||"")},this.handleSearchClear=()=>{this.clearSearch()},this.handleSearchKeyDown=t=>{if(["ArrowDown","ArrowUp","Enter","Home","End"].includes(t.key)){const i=this.host.keyboardController;return void(i&&i.handleKeyDown(t))}t.stopPropagation(),"Escape"===t.key&&(this.host.closeDropdown(),this.host.focus())}}get searchQuery(){return this._searchQuery}get hasSearch(){return""!==this._searchQuery.trim()}setSearchQuery(t){this._searchQuery=t,this.host.searchQuery=t,this.host.requestUpdate()}search(t){this.setSearchQuery(t)}clearSearch(){this.setSearchQuery("")}getFilteredOptions(t){if(!this.host.searchable||!this._searchQuery.trim())return t;const i=this._searchQuery.toLowerCase().trim();return t.filter(t=>t.label.toLowerCase().includes(i)||t.value.toLowerCase().includes(i)||t.description&&t.description.toLowerCase().includes(i))}renderSearchInput(){return this.host.searchable?e`
|
|
532
419
|
<div class="search-container">
|
|
533
420
|
<nr-input
|
|
534
421
|
type="text"
|
|
@@ -549,7 +436,7 @@ import{css as t,nothing as e,html as i,LitElement as r}from"lit";import{property
|
|
|
549
436
|
</nr-icon>
|
|
550
437
|
</nr-input>
|
|
551
438
|
</div>
|
|
552
|
-
`:
|
|
439
|
+
`:i}renderNoResults(){return e`
|
|
553
440
|
<div class="no-options" role="option" aria-disabled="true">
|
|
554
441
|
<div class="no-options-content">
|
|
555
442
|
<nr-icon
|
|
@@ -560,16 +447,15 @@ import{css as t,nothing as e,html as i,LitElement as r}from"lit";import{property
|
|
|
560
447
|
<span class="no-options-text">No results found for "${this._searchQuery}"</span>
|
|
561
448
|
</div>
|
|
562
449
|
</div>
|
|
563
|
-
`}hasNoResults(t){return this.host.searchable&&""!==this._searchQuery.trim()&&0===this.getFilteredOptions(t).length}getCurrentQuery(){return this.host.searchQuery||this._searchQuery}hostUpdated(){super.hostUpdated(),this.host.searchQuery!==this._searchQuery&&(this._searchQuery=this.host.searchQuery)}hostConnected(){super.hostConnected(),this._searchQuery=""}}class
|
|
450
|
+
`}hasNoResults(t){return this.host.searchable&&""!==this._searchQuery.trim()&&0===this.getFilteredOptions(t).length}getCurrentQuery(){return this.host.searchQuery||this._searchQuery}hostUpdated(){super.hostUpdated(),this.host.searchQuery!==this._searchQuery&&(this._searchQuery=this.host.searchQuery)}hostConnected(){super.hostConnected(),this._searchQuery=""}}class _ extends I{constructor(){super(...arguments),this.handleTriggerClick=t=>{this.host.disabled||(t.preventDefault(),t.stopPropagation(),this.host.toggleDropdown())},this.handleOptionClick=(t,i)=>{t.stopPropagation(),i.disabled||(this.host.multiple?this.host.toggleOption(i):(this.host.selectOption(i),this.host.closeDropdown()))},this.handleTagRemove=(t,i)=>{t.stopPropagation(),this.host.unselectOption(i)},this.handleClearAll=t=>{t.stopPropagation(),this.host.clearSelection()},this.handleKeyDown=t=>{const i=this.host.keyboardController;i&&i.handleKeyDown(t)},this.handleFocus=()=>{const t=this.host.focusController;t&&t.handleFocus()},this.handleBlur=()=>{const t=this.host.focusController;t&&t.handleBlur()},this.handleWindowClick=t=>{t.composedPath().includes(this.host)||this.host.closeDropdown()}}setupEventListeners(){window.addEventListener("click",this.handleWindowClick)}removeEventListeners(){window.removeEventListener("click",this.handleWindowClick)}hostDisconnected(){super.hostDisconnected(),this.removeEventListeners()}}
|
|
564
451
|
/**
|
|
565
452
|
* @license
|
|
566
453
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
567
454
|
* SPDX-License-Identifier: MIT
|
|
568
|
-
*/var
|
|
455
|
+
*/var U=function(t,i,e,s){for(var o,r=arguments.length,n=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s,a=t.length-1;a>=0;a--)(o=t[a])&&(n=(r<3?o(n):r>3?o(i,e,n):o(i,e))||n);return r>3&&n&&Object.defineProperty(i,e,n),n};let H=class extends((t=>v(p(f(b(t)))))(s)){constructor(){super(...arguments),this.requiredComponents=["nr-input","nr-icon"],this.options=[],this.placeholder="Select an option",this.disabled=!1,this.type=x.Default,this.multiple=!1,this.show=!1,this.status=y.Default,this.size=E.Medium,this.required=!1,this.name="",this.value="",this.noOptionsMessage="No options available",this.noOptionsIcon="info",this.searchable=!1,this.clearable=!1,this.searchPlaceholder="Search options...",this.searchQuery="",this.useCustomSelectedDisplay=!1,this.maxHeight="",this.block=!1,this.selectionController=new N(this),this.dropdownController=new V(this),this.keyboardController=new z(this,this.selectionController,this.dropdownController),this.focusController=new B(this),this.validationController=new F(this,this.selectionController),this.searchController=new M(this),this.eventController=new _(this),this.handleTriggerClick=t=>{this.eventController.handleTriggerClick(t)},this.handleOptionClick=(t,i)=>{this.eventController.handleOptionClick(t,i)},this.handleTagRemove=(t,i)=>{this.eventController.handleTagRemove(t,i)},this.handleClearAll=t=>{this.eventController.handleClearAll(t)},this.handleKeyDown=t=>{this.eventController.handleKeyDown(t)},this.handleFocus=()=>{this.eventController.handleFocus()},this.handleBlur=()=>{this.eventController.handleBlur()}}get optionsElement(){return this.renderRoot.querySelector(".options")}get wrapper(){return this.renderRoot.querySelector(".wrapper")}get searchInput(){return this.renderRoot.querySelector(".search-input")}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback()}willUpdate(t){super.willUpdate(t),(t.has("options")||t.has("value"))&&this.options.length>0&&this.value&&(Array.isArray(this.value)?this.value.length>0:""!==this.value)&&(this.selectionController._initialized=!1,this.selectionController.initializeFromValue())}firstUpdated(t){super.firstUpdated(t),this.optionsElement&&this.wrapper?this.dropdownController.setElements(this.optionsElement,this.wrapper):setTimeout(()=>{this.optionsElement&&this.wrapper&&this.dropdownController.setElements(this.optionsElement,this.wrapper)},100),this.value&&(Array.isArray(this.value)?this.value.length>0:""!==this.value)&&this.selectionController.initializeFromValue()}get selectedOptions(){return this.selectionController.getSelectedOptions()}get selectedOption(){return this.selectionController.getSelectedOption()}selectOption(t){this.selectionController.selectOption(t)}unselectOption(t){this.selectionController.unselectOption(t)}toggleOption(t){this.selectionController.toggleOption(t)}clearSelection(){this.selectionController.clearSelection()}isOptionSelected(t){return this.selectionController.isOptionSelected(t)}toggleDropdown(){this.dropdownController.toggle()}openDropdown(){this.dropdownController.open()}closeDropdown(){this.dropdownController.close()}focus(){this.focusController.focus()}blur(){this.focusController.blur()}validate(){return this.validationController.validate()}checkValidity(){return this.validationController.checkValidity()}reportValidity(){return this.validationController.reportValidity()}setCustomValidity(t){this.validationController.setCustomValidity(t)}getValidationStatus(){return{isValid:this.validationController.checkValidity(),validationMessage:this.validationController.validationMessage||""}}get validationMessage(){return this.validationController.validationMessage||""}clearValidation(){this.validationController.setCustomValidity(""),this.status=y.Default}searchOptions(t){this.searchController.search(t)}clearSearch(){this.searchController.clearSearch()}getSearchFilteredOptions(){return this.searchController.getFilteredOptions(this.options)}getCurrentSearchQuery(){return this.searchController.searchQuery}getSelectedOptions(){return this.selectedOptions}setupGlobalEventListeners(){this.eventController.setupEventListeners()}removeGlobalEventListeners(){this.eventController.removeEventListeners()}getFilteredOptions(){return this.searchController.getFilteredOptions(this.options)}setupEventListeners(){this.eventController.setupEventListeners()}removeEventListeners(){this.eventController.removeEventListeners()}render(){return e`${a(this.type,[[x.Default,()=>this.renderDefault()],[x.Inline,()=>this.renderInline()],[x.Button,()=>this.renderButton()],[x.Slot,()=>this.renderSlot()]])}`}renderDefault(){const t=this.selectedOptions,s=this.validationController.getValidationClasses();return e`
|
|
569
456
|
<slot name="label"></slot>
|
|
570
|
-
<div
|
|
571
|
-
class="${
|
|
572
|
-
data-theme="${this.currentTheme}"
|
|
457
|
+
<div
|
|
458
|
+
class="${h(Object.assign({wrapper:!0},s))}"
|
|
573
459
|
tabindex="0"
|
|
574
460
|
role="combobox"
|
|
575
461
|
aria-expanded="${this.show}"
|
|
@@ -582,43 +468,44 @@ import{css as t,nothing as e,html as i,LitElement as r}from"lit";import{property
|
|
|
582
468
|
@blur=${this.handleBlur}
|
|
583
469
|
>
|
|
584
470
|
<div class="select">
|
|
585
|
-
<div class="select-trigger">
|
|
471
|
+
<div part="trigger" class="select-trigger">
|
|
586
472
|
${this.renderSelectedContent(t)}
|
|
587
473
|
</div>
|
|
588
|
-
|
|
474
|
+
|
|
589
475
|
<div class="icons-container">
|
|
590
476
|
${this.renderStatusIcon()}
|
|
591
477
|
${this.renderClearButton(t)}
|
|
592
|
-
<nr-icon
|
|
593
|
-
name="chevron-down"
|
|
478
|
+
<nr-icon
|
|
479
|
+
name="chevron-down"
|
|
594
480
|
size="${this.size}"
|
|
595
481
|
class="arrow-icon"
|
|
596
482
|
aria-hidden="true"
|
|
597
483
|
></nr-icon>
|
|
598
484
|
</div>
|
|
599
|
-
|
|
485
|
+
|
|
600
486
|
<div
|
|
487
|
+
part="dropdown"
|
|
601
488
|
class="options"
|
|
602
489
|
role="listbox"
|
|
603
490
|
aria-multiselectable="${this.multiple}"
|
|
604
|
-
style=${this.maxHeight?
|
|
491
|
+
style=${this.maxHeight?c({"max-height":this.maxHeight}):i}
|
|
605
492
|
@click=${t=>t.stopPropagation()}
|
|
606
493
|
>
|
|
607
|
-
${this.searchable?this.renderSearchInput():
|
|
494
|
+
${this.searchable?this.renderSearchInput():i}
|
|
608
495
|
<slot name="before-options"></slot>
|
|
609
496
|
${this.renderSelectOptions()}
|
|
610
497
|
<slot name="after-options"></slot>
|
|
611
498
|
</div>
|
|
612
499
|
</div>
|
|
613
500
|
</div>
|
|
614
|
-
|
|
501
|
+
|
|
615
502
|
${this.renderValidationMessage()}
|
|
616
503
|
<slot name="helper-text"></slot>
|
|
617
|
-
`}renderInline(){return
|
|
504
|
+
`}renderInline(){return e`
|
|
618
505
|
<slot name="label"></slot>
|
|
619
506
|
${this.renderDefault()}
|
|
620
507
|
<slot name="helper-text"></slot>
|
|
621
|
-
`}renderButton(){const t=this.selectedOptions;return
|
|
508
|
+
`}renderButton(){const t=this.selectedOptions;return e`
|
|
622
509
|
<button
|
|
623
510
|
class="select-button"
|
|
624
511
|
?disabled=${this.disabled}
|
|
@@ -632,40 +519,41 @@ import{css as t,nothing as e,html as i,LitElement as r}from"lit";import{property
|
|
|
632
519
|
<div
|
|
633
520
|
class="options"
|
|
634
521
|
role="listbox"
|
|
635
|
-
style=${this.maxHeight?
|
|
522
|
+
style=${this.maxHeight?c({"max-height":this.maxHeight}):i}
|
|
636
523
|
@click=${t=>t.stopPropagation()}
|
|
637
524
|
>
|
|
638
|
-
${this.searchable?this.renderSearchInput():
|
|
525
|
+
${this.searchable?this.renderSearchInput():i}
|
|
639
526
|
<slot name="before-options"></slot>
|
|
640
527
|
${this.renderSelectOptions()}
|
|
641
528
|
<slot name="after-options"></slot>
|
|
642
529
|
</div>
|
|
643
|
-
`}renderSlot(){return
|
|
644
|
-
<
|
|
530
|
+
`}renderSlot(){return e`
|
|
531
|
+
<span @click=${this.handleTriggerClick}><slot name="trigger"></slot></span>
|
|
645
532
|
<div
|
|
646
533
|
class="options"
|
|
647
534
|
role="listbox"
|
|
648
|
-
style=${this.maxHeight?
|
|
535
|
+
style=${this.maxHeight?c({"max-height":this.maxHeight}):i}
|
|
649
536
|
@click=${t=>t.stopPropagation()}
|
|
650
537
|
>
|
|
651
|
-
${this.searchable?this.renderSearchInput():
|
|
538
|
+
${this.searchable?this.renderSearchInput():i}
|
|
652
539
|
<slot name="before-options"></slot>
|
|
653
540
|
${this.renderSelectOptions()}
|
|
654
541
|
<slot name="after-options"></slot>
|
|
655
542
|
</div>
|
|
656
|
-
`}renderSelectedContent(t){return 0===t.length?
|
|
657
|
-
<span class="tag">
|
|
543
|
+
`}renderSelectedContent(t){return 0===t.length?e`<span class="placeholder" aria-hidden="true">${this.placeholder}</span>`:this.multiple?this.useCustomSelectedDisplay?e`<slot name="selected-display"></slot>`:n(t,t=>e`
|
|
544
|
+
<span part="tag" class="tag">
|
|
658
545
|
<span class="tag-label">${t.label}</span>
|
|
659
|
-
<nr-icon
|
|
546
|
+
<nr-icon
|
|
660
547
|
name="x"
|
|
661
548
|
size="${this.size}"
|
|
662
549
|
class="tag-close"
|
|
663
|
-
@click=${
|
|
550
|
+
@click=${i=>this.handleTagRemove(i,t)}
|
|
664
551
|
aria-label="Remove ${t.label}"
|
|
665
552
|
></nr-icon>
|
|
666
553
|
</span>
|
|
667
|
-
`):
|
|
554
|
+
`):e`${t[0].label}`}renderStatusIcon(){switch(this.status){case y.Warning:return e`<nr-icon name="alert-triangle" size="${this.size}" class="status-icon warning"></nr-icon>`;case y.Error:return e`<nr-icon name="alert-circle" size="${this.size}" class="status-icon error"></nr-icon>`;case y.Success:return e`<nr-icon name="circle-check" size="${this.size}" class="status-icon success"></nr-icon>`;default:return i}}renderClearButton(t){return!this.clearable||0===t.length||this.disabled?i:e`
|
|
668
555
|
<nr-icon
|
|
556
|
+
part="clear"
|
|
669
557
|
name="x"
|
|
670
558
|
size="${this.size}"
|
|
671
559
|
class="clear-icon"
|
|
@@ -673,7 +561,7 @@ import{css as t,nothing as e,html as i,LitElement as r}from"lit";import{property
|
|
|
673
561
|
aria-label="Clear selection"
|
|
674
562
|
tabindex="-1"
|
|
675
563
|
></nr-icon>
|
|
676
|
-
`}renderSelectOptions(){const t=this.getFilteredOptions();if(!this.options||0===this.options.length)return
|
|
564
|
+
`}renderSelectOptions(){const t=this.getFilteredOptions();if(!this.options||0===this.options.length)return e`
|
|
677
565
|
<div class="no-options" role="option" aria-disabled="true">
|
|
678
566
|
<div class="no-options-content">
|
|
679
567
|
<nr-icon
|
|
@@ -684,38 +572,43 @@ import{css as t,nothing as e,html as i,LitElement as r}from"lit";import{property
|
|
|
684
572
|
<span class="no-options-text">${this.noOptionsMessage}</span>
|
|
685
573
|
</div>
|
|
686
574
|
</div>
|
|
687
|
-
`;if(this.searchController.hasNoResults(this.options))return this.searchController.renderNoResults();const
|
|
575
|
+
`;if(this.searchController.hasNoResults(this.options))return this.searchController.renderNoResults();const s=this.keyboardController.focusedOption;return n(t,t=>{const o=this.isOptionSelected(t),r=s&&s.value===t.value;return e`
|
|
688
576
|
<div
|
|
689
|
-
|
|
577
|
+
part="option"
|
|
578
|
+
class="${h({option:!0,selected:o,focused:r,disabled:Boolean(t.disabled)})}"
|
|
690
579
|
role="option"
|
|
691
|
-
aria-selected="${
|
|
580
|
+
aria-selected="${o}"
|
|
692
581
|
aria-disabled="${Boolean(t.disabled)}"
|
|
693
582
|
data-value="${t.value}"
|
|
694
|
-
@click=${
|
|
695
|
-
style=${
|
|
583
|
+
@click=${i=>this.handleOptionClick(i,t)}
|
|
584
|
+
style=${c(t.style?{style:t.style}:{})}
|
|
696
585
|
title="${t.title||""}"
|
|
697
586
|
>
|
|
698
587
|
<div class="option-content">
|
|
699
|
-
${t.icon?
|
|
588
|
+
${t.icon?e`<nr-icon name="${t.icon}" size="${this.size}" class="option-icon"></nr-icon>`:i}
|
|
700
589
|
<div class="option-text">
|
|
701
|
-
${t.htmlContent?
|
|
702
|
-
${t.description?
|
|
590
|
+
${t.htmlContent?e`<div>${l(t.htmlContent)}</div>`:t.label}
|
|
591
|
+
${t.description?e`<div class="option-description">${t.description}</div>`:i}
|
|
703
592
|
</div>
|
|
704
593
|
</div>
|
|
705
594
|
|
|
706
|
-
${
|
|
595
|
+
${o?e`<nr-icon name="check" size="${this.size}" class="check-icon" aria-hidden="true"></nr-icon>`:i}
|
|
707
596
|
|
|
708
|
-
${t.state&&t.message?
|
|
597
|
+
${t.state&&t.message?e`
|
|
709
598
|
<div class="option-message ${t.state}">
|
|
710
599
|
<nr-icon name="${"error"===t.state?"alert-circle":"alert-triangle"}" size="${this.size}"></nr-icon>
|
|
711
600
|
<span>${t.message}</span>
|
|
712
601
|
</div>
|
|
713
|
-
`:
|
|
602
|
+
`:i}
|
|
714
603
|
</div>
|
|
715
|
-
`})}renderSearchInput(){return this.searchController.renderSearchInput()}renderValidationMessage(){return
|
|
604
|
+
`})}renderSearchInput(){return this.searchController.renderSearchInput()}renderValidationMessage(){return function(t,s){if(!t)return i;const o=(null==s?void 0:s.cssClass)||"validation-message",r=(null==s?void 0:s.statusClass)||"",n=(null==s?void 0:s.id)||"validation-message";return e`
|
|
605
|
+
<div class="${o} ${r}" id="${n}" role="alert" aria-live="polite">
|
|
606
|
+
${t}
|
|
607
|
+
</div>
|
|
608
|
+
`}(this.validationController.validationMessage,{statusClass:this.status})}};H.styles=d,H.useShadowDom=!0,U([o({type:Array})],H.prototype,"options",void 0),U([o({type:String})],H.prototype,"placeholder",void 0),U([o({type:Boolean,reflect:!0})],H.prototype,"disabled",void 0),U([o({type:String,reflect:!0})],H.prototype,"type",void 0),U([o({type:Boolean,attribute:"multiple"})],H.prototype,"multiple",void 0),U([o({type:Boolean,reflect:!0})],H.prototype,"show",void 0),U([o({type:String,reflect:!0})],H.prototype,"status",void 0),U([o({type:String,reflect:!0})],H.prototype,"size",void 0),U([o({type:Boolean,reflect:!0})],H.prototype,"required",void 0),U([o({type:String})],H.prototype,"name",void 0),U([o()],H.prototype,"value",void 0),U([o({type:String,attribute:"no-options-message"})],H.prototype,"noOptionsMessage",void 0),U([o({type:String,attribute:"no-options-icon"})],H.prototype,"noOptionsIcon",void 0),U([o({type:Boolean,reflect:!0})],H.prototype,"searchable",void 0),U([o({type:Boolean,reflect:!0})],H.prototype,"clearable",void 0),U([o({type:String,attribute:"search-placeholder"})],H.prototype,"searchPlaceholder",void 0),U([o({type:String})],H.prototype,"searchQuery",void 0),U([o({type:Boolean,attribute:"use-custom-selected-display"})],H.prototype,"useCustomSelectedDisplay",void 0),U([o({type:String,attribute:"max-height"})],H.prototype,"maxHeight",void 0),U([o({type:Boolean,reflect:!0})],H.prototype,"block",void 0),H=U([r("nr-select")],H);
|
|
716
609
|
/**
|
|
717
610
|
* @license
|
|
718
611
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
719
612
|
* SPDX-License-Identifier: MIT
|
|
720
613
|
*/
|
|
721
|
-
const
|
|
614
|
+
const j={CHANGE:"nr-change",FOCUS:"nr-focus",BLUR:"nr-blur",DROPDOWN_OPEN:"nr-dropdown-open",DROPDOWN_CLOSE:"nr-dropdown-close",VALIDATION:"nr-validation",ERROR:"nr-controller-error"},W={WRAPPER:"wrapper",SELECT:"select",TRIGGER:"select-trigger",OPTIONS:"options",OPTION:"option",SELECTED:"selected",FOCUSED:"focused",DISABLED:"disabled",TAG:"tag",TAG_LABEL:"tag-label",TAG_CLOSE:"tag-close",ICONS_CONTAINER:"icons-container",ARROW_ICON:"arrow-icon",CLEAR_ICON:"clear-icon",STATUS_ICON:"status-icon",CHECK_ICON:"check-icon",VALIDATION_MESSAGE:"validation-message",PLACEHOLDER:"placeholder",NO_OPTIONS:"no-options",NO_OPTIONS_CONTENT:"no-options-content",NO_OPTIONS_ICON:"no-options-icon",NO_OPTIONS_TEXT:"no-options-text",SEARCH_CONTAINER:"search-container",SEARCH_INPUT:"search-input",SEARCH_ICON:"search-icon",SEARCH_CLEAR:"search-clear"},G={COMBOBOX:"combobox",LISTBOX:"listbox",OPTION:"option",EXPANDED:"aria-expanded",HASPOPUP:"aria-haspopup",MULTISELECTABLE:"aria-multiselectable",SELECTED:"aria-selected",DISABLED:"aria-disabled",REQUIRED:"aria-required",INVALID:"aria-invalid",DESCRIBEDBY:"aria-describedby",LABELLEDBY:"aria-labelledby"},q={PLACEHOLDER:"Select an option",MAX_HEIGHT:"auto",DROPDOWN_OFFSET:4,TAG_MAX_WIDTH:"150px",TRANSITION_DURATION:200,DEBOUNCE_DELAY:300},K={ENTER:"Enter",SPACE:" ",ESCAPE:"Escape",ARROW_DOWN:"ArrowDown",ARROW_UP:"ArrowUp",HOME:"Home",END:"End",TAB:"Tab"},Y="",Q=", ";export{I as BaseSelectController,C as DropdownPlacement,Y as EMPTY_STRING,H as HySelectComponent,Q as MULTIPLE_OPTIONS_SEPARATOR,O as OptionSize,G as SELECT_ARIA,W as SELECT_CLASSES,q as SELECT_DEFAULTS,j as SELECT_EVENTS,K as SELECT_KEYS,A as SearchMode,S as SelectDirection,V as SelectDropdownController,_ as SelectEventController,B as SelectFocusController,z as SelectKeyboardController,M as SelectSearchController,N as SelectSelectionController,E as SelectSize,y as SelectStatus,x as SelectType,F as SelectValidationController,$ as SelectVariant};
|