@energysage/es-ds-components 3.6.1 → 3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/components/es-dropdown-select.vue +27 -12
- package/components/es-form-msg.vue +6 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [3.7.0](https://github.com/EnergySage/es-ds/compare/es-ds-components-v3.6.2...es-ds-components-v3.7.0) (2025-09-04)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* dropdown tweaks ([#1660](https://github.com/EnergySage/es-ds/issues/1660)) ([42ffeac](https://github.com/EnergySage/es-ds/commit/42ffeac51b89969cd55b936d744be598e769e1a5))
|
|
9
|
+
|
|
10
|
+
## [3.6.2](https://github.com/EnergySage/es-ds/compare/es-ds-components-v3.6.1...es-ds-components-v3.6.2) (2025-08-25)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* remove unoverridable margin from form message ([#1656](https://github.com/EnergySage/es-ds/issues/1656)) ([6d93853](https://github.com/EnergySage/es-ds/commit/6d93853df13156de9c7b5f938b345d64c295017a))
|
|
16
|
+
|
|
3
17
|
## [3.6.1](https://github.com/EnergySage/es-ds/compare/es-ds-components-v3.6.0...es-ds-components-v3.6.1) (2025-08-21)
|
|
4
18
|
|
|
5
19
|
|
|
@@ -5,6 +5,7 @@ interface Props {
|
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
label?: string;
|
|
7
7
|
modelValue?: any;
|
|
8
|
+
noOptionsText?: string;
|
|
8
9
|
options?: string[] | { label: string; value: string }[];
|
|
9
10
|
placeholder?: string;
|
|
10
11
|
required?: boolean;
|
|
@@ -13,6 +14,7 @@ interface Props {
|
|
|
13
14
|
const props = withDefaults(defineProps<Props>(), {
|
|
14
15
|
disabled: false,
|
|
15
16
|
modelValue: undefined,
|
|
17
|
+
noOptionsText: 'No available options',
|
|
16
18
|
options: () => [],
|
|
17
19
|
placeholder: '',
|
|
18
20
|
label: '',
|
|
@@ -29,6 +31,7 @@ const isOpen = ref(false);
|
|
|
29
31
|
const isFocused = ref(false);
|
|
30
32
|
const isInputClicked = ref(false);
|
|
31
33
|
const isLabelClicked = ref(false);
|
|
34
|
+
const isDisabled = computed(() => props.disabled || props.options.length === 0);
|
|
32
35
|
|
|
33
36
|
const isSelected = (option: any) => option === props.modelValue;
|
|
34
37
|
|
|
@@ -72,29 +75,30 @@ const hide = () => {
|
|
|
72
75
|
<dropdown
|
|
73
76
|
:input-id="id"
|
|
74
77
|
:class="[
|
|
75
|
-
'es-dropdown es-form-input form-control
|
|
78
|
+
'es-dropdown es-form-input form-control align-items-center d-flex justify-content-between position-relative',
|
|
76
79
|
{
|
|
77
|
-
disabled:
|
|
80
|
+
disabled: isDisabled,
|
|
78
81
|
focused: isFocused && !isInputClicked && !isOpen && !isLabelClicked,
|
|
79
82
|
'focused-on-click': isOpen || isLabelClicked || isInputClicked,
|
|
80
83
|
'is-invalid': state === false,
|
|
81
84
|
},
|
|
82
85
|
]"
|
|
86
|
+
append-to="self"
|
|
83
87
|
:aria-labelledby="labelId"
|
|
84
|
-
:disabled="
|
|
88
|
+
:disabled="isDisabled"
|
|
85
89
|
:focus-on-hover="false"
|
|
86
90
|
:model-value="modelValue"
|
|
87
91
|
:option-label="options.length > 0 && typeof options[0] === 'object' ? 'label' : undefined"
|
|
88
92
|
:option-value="options.length > 0 && typeof options[0] === 'object' ? 'value' : undefined"
|
|
89
93
|
:options="options"
|
|
90
|
-
:placeholder="placeholder"
|
|
94
|
+
:placeholder="options.length === 0 ? props.noOptionsText : placeholder"
|
|
91
95
|
:pt="{
|
|
92
|
-
panel: { class: 'es-dropdown-panel bg-white rounded-xs' },
|
|
96
|
+
panel: { class: 'es-dropdown-panel bg-white rounded-xs w-100' },
|
|
93
97
|
wrapper: { class: 'es-dropdown-wrapper' },
|
|
94
|
-
list: { class: '
|
|
98
|
+
list: { class: 'list-unstyled m-0 p-0' },
|
|
95
99
|
input: {
|
|
96
100
|
class: [
|
|
97
|
-
'es-dropdown-input',
|
|
101
|
+
'es-dropdown-input h-100 text-truncate',
|
|
98
102
|
{
|
|
99
103
|
'es-dropdown-input--placeholder': modelValue === undefined && state !== false,
|
|
100
104
|
},
|
|
@@ -102,12 +106,13 @@ const hide = () => {
|
|
|
102
106
|
},
|
|
103
107
|
item: {
|
|
104
108
|
class: [
|
|
105
|
-
'es-dropdown-item d-flex justify-content-between p-100 pl-200',
|
|
109
|
+
'es-dropdown-item align-items-center d-flex justify-content-between p-100 pl-200 position-relative',
|
|
106
110
|
{
|
|
107
111
|
'input-focused position-relative': isFocused && !isInputClicked && !isLabelClicked,
|
|
108
112
|
},
|
|
109
113
|
],
|
|
110
114
|
},
|
|
115
|
+
trigger: { class: 'h-100' },
|
|
111
116
|
}"
|
|
112
117
|
scroll-height="15.75rem"
|
|
113
118
|
v-bind="$attrs"
|
|
@@ -123,17 +128,19 @@ const hide = () => {
|
|
|
123
128
|
height="1.125rem"
|
|
124
129
|
:class="[
|
|
125
130
|
{
|
|
126
|
-
'text-gray-500':
|
|
127
|
-
'text-gray-900': !
|
|
131
|
+
'text-gray-500': isDisabled,
|
|
132
|
+
'text-gray-900': !isDisabled && state !== false,
|
|
128
133
|
},
|
|
129
134
|
]" />
|
|
130
135
|
</template>
|
|
131
136
|
<template #option="slotProps">
|
|
132
|
-
<span
|
|
137
|
+
<span class="option-label pr-200">{{
|
|
138
|
+
slotProps.option.label ? slotProps.option.label : slotProps.option
|
|
139
|
+
}}</span>
|
|
133
140
|
<icon-check
|
|
134
141
|
v-if="isSelected(slotProps.option)"
|
|
135
142
|
height="1.5rem"
|
|
136
|
-
class="text-gray-700" />
|
|
143
|
+
class="icon-check position-absolute text-gray-700" />
|
|
137
144
|
</template>
|
|
138
145
|
</dropdown>
|
|
139
146
|
<small
|
|
@@ -220,6 +227,14 @@ const hide = () => {
|
|
|
220
227
|
cursor: pointer;
|
|
221
228
|
transition: background-color 0.15s ease-in-out;
|
|
222
229
|
|
|
230
|
+
.icon-check {
|
|
231
|
+
right: 1rem;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.option-label {
|
|
235
|
+
overflow-wrap: anywhere;
|
|
236
|
+
}
|
|
237
|
+
|
|
223
238
|
&:hover,
|
|
224
239
|
&:not(.input-focused)[data-p-focused='true'] {
|
|
225
240
|
background-color: variables.$blue-50;
|
|
@@ -42,7 +42,7 @@ watch(
|
|
|
42
42
|
role="alert"
|
|
43
43
|
aria-live="polite"
|
|
44
44
|
aria-atomic="true"
|
|
45
|
-
class="alert es-form-msg
|
|
45
|
+
class="alert es-form-msg alert-dismissible"
|
|
46
46
|
:class="`alert-${variant}`">
|
|
47
47
|
<div class="d-flex pr-100">
|
|
48
48
|
<div class="icon-wrapper flex-shrink-0 mr-100">
|
|
@@ -64,6 +64,11 @@ watch(
|
|
|
64
64
|
</template>
|
|
65
65
|
|
|
66
66
|
<style lang="scss" scoped>
|
|
67
|
+
.es-form-msg {
|
|
68
|
+
margin-bottom: 1rem;
|
|
69
|
+
margin-top: 1rem;
|
|
70
|
+
}
|
|
71
|
+
|
|
67
72
|
.form-msg {
|
|
68
73
|
flex: 0 0 100%;
|
|
69
74
|
padding-right: 2.5rem;
|