jb-select 7.0.4 → 7.0.5

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/lib/jb-select.css CHANGED
@@ -1,11 +1,10 @@
1
- /* @use "~jb-core/styles/medias.scss" as *; */
2
-
3
1
  @custom-media --tablet-until (max-width: 768px);
4
2
  @custom-media --tablet-from (min-width: 769px);
5
3
 
6
4
  :host {
7
5
  display: block;
8
6
  margin: var(--jb-select-margin, 0 0);
7
+ width: var(--jb-select-width, 100%);
9
8
  }
10
9
 
11
10
  :host(:focus),
@@ -14,7 +13,7 @@
14
13
  }
15
14
 
16
15
  .jb-select-web-component {
17
- width: var(--jb-select-width, 100%);
16
+ width: 100%;
18
17
  box-sizing: border-box;
19
18
  container-type: inline-size;
20
19
  &.--has-value {
@@ -30,19 +29,16 @@
30
29
  }
31
30
  }
32
31
 
33
- .label-wrapper {
34
- label {
35
- width: 100%;
36
- margin: var(--label-margin);
37
- display: block;
38
- font-size: var(--label-font-size);
39
- color: var(--label-color);
40
-
41
- font-weight: var(--jb-input-label-font-weight, 300);
32
+ label {
33
+ width: 100%;
34
+ margin: var(--label-margin);
35
+ display: block;
36
+ font-size: var(--label-font-size);
37
+ color: var(--label-color);
38
+ font-weight: var(--jb-input-label-font-weight, 300);
42
39
 
43
- &.--hide {
44
- display: none;
45
- }
40
+ &:empty {
41
+ display: none;
46
42
  }
47
43
  }
48
44
 
@@ -64,7 +60,7 @@
64
60
  border-bottom: solid var(--border-bottom-width) var(--border-color);
65
61
  border-radius: var(--box-border-radius);
66
62
  background-color: var(--select-box-bg-color);
67
- margin: var(--jb-select-select-box-margin, 4px 0px 0px 0px);
63
+ margin: var(--jb-select-box-margin, 0px);
68
64
  overflow: hidden;
69
65
  display: grid;
70
66
  grid-template-rows: minmax(0, 1fr);
@@ -94,7 +90,7 @@
94
90
  height: 100%;
95
91
  border-radius: inherit;
96
92
  overflow: hidden;
97
- z-index: 1;
93
+ z-index: var(--base-z-index);
98
94
 
99
95
  &.--search-typed {
100
96
  opacity: 0;
@@ -125,7 +121,7 @@
125
121
  height: 100%;
126
122
  border-radius: inherit;
127
123
  overflow: hidden;
128
- z-index: 2;
124
+ z-index: calc(var(--base-z-index) + 1);
129
125
 
130
126
  .search-input {
131
127
  height: 100%;
@@ -135,6 +131,7 @@
135
131
  margin: 0;
136
132
  border-radius: 0;
137
133
  font-size: var(--input-font-size);
134
+
138
135
  &:focus {
139
136
  outline: none;
140
137
  }
@@ -152,6 +149,7 @@
152
149
  gap: 1.5rem;
153
150
  align-items: center;
154
151
  padding-inline-start: 0.5rem;
152
+
155
153
  .arrow-icon {
156
154
  margin: var(--jb-select-arrow-icon-margin, 0 0 0 0);
157
155
  }
@@ -271,6 +269,7 @@
271
269
  color: var(--empty-list-placeholder-color);
272
270
  font-style: italic;
273
271
  font-size: var(--input-font-size);
272
+
274
273
  &.--show {
275
274
  display: block;
276
275
  }
package/lib/jb-select.ts CHANGED
@@ -194,6 +194,7 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
194
194
  const shadowRoot = this.attachShadow({
195
195
  mode: "open",
196
196
  delegatesFocus: true,
197
+ serializable:true
197
198
  });
198
199
  registerDefaultVariables();
199
200
  const html = `<style>${CSS} ${VariablesCSS}</style>\n${renderHTML()}`;
@@ -210,10 +211,7 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
210
211
  optionListSlot: shadowRoot.querySelector(".select-list-wrapper .select-list slot")!,
211
212
  arrowIcon: shadowRoot.querySelector(".arrow-icon")!,
212
213
  clearButton: shadowRoot.querySelector(".clear-button") as JBButtonWebComponent,
213
- label: {
214
- wrapper: shadowRoot.querySelector("label")!,
215
- text: shadowRoot.querySelector("label .label-value")!,
216
- },
214
+ label:shadowRoot.querySelector("label"),
217
215
  emptyListPlaceholder: shadowRoot.querySelector(".empty-list-placeholder")!,
218
216
  mobileSearchInputWrapper: shadowRoot.querySelector(".mobile-search-input-wrapper"),
219
217
  frontBox: shadowRoot.querySelector(".front-box"),
@@ -279,13 +277,8 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
279
277
  #onAttributeChange(name: string, value: string) {
280
278
  switch (name) {
281
279
  case "label":
282
- this.elements.label.text.innerHTML = value;
280
+ this.elements.label.innerHTML = value;
283
281
  this.#internals.ariaLabel = value;
284
- if (value == null || value == undefined || value == "") {
285
- this.elements.label.wrapper.classList.add("--hide");
286
- } else {
287
- this.elements.label.wrapper.classList.remove("--hide");
288
- }
289
282
  break;
290
283
  case "message":
291
284
  this.#internals.ariaDescription = value;
package/lib/render.ts CHANGED
@@ -1,9 +1,7 @@
1
1
  export function renderHTML(): string {
2
2
  return /* html */ `
3
3
  <div class="jb-select-web-component">
4
- <div class="label-wrapper">
5
- <label class="--hide"><span class="label-value"></span></label>
6
- </div>
4
+ <label class="label-value"></label>
7
5
  <div class="select-box">
8
6
  <div class="start-section">
9
7
  <slot name="start-section"></slot>
package/lib/types.ts CHANGED
@@ -17,10 +17,7 @@ export type JBSelectElements = {
17
17
  optionListSlot:HTMLSlotElement,
18
18
  arrowIcon: HTMLDivElement,
19
19
  clearButton: JBButtonWebComponent,
20
- label:{
21
- wrapper: HTMLLabelElement,
22
- text: HTMLSpanElement
23
- },
20
+ label:HTMLLabelElement,
24
21
  emptyListPlaceholder: HTMLDivElement,
25
22
  mobileSearchInputWrapper:HTMLDivElement,
26
23
  frontBox:HTMLDivElement,
package/lib/variables.css CHANGED
@@ -7,7 +7,7 @@
7
7
  --list-border-radius: 0 0 var(--rounded) var(--rounded);
8
8
  --border-width: var(--jb-select-border-width, 1px);
9
9
  --border-bottom-width: var(--jb-select-border-bottom-width, var(--jb-select-border-width, 3px));
10
- --base-z-index: 1;
10
+ --base-z-index: var(--jb-select-base-z-index, 1);
11
11
  --selected-value-font-size:var(--jb-select-selected-value-font-size, 1rem);
12
12
  --input-font-size:var(--jb-select-input-font-size, 1rem);
13
13
  --selected-value-padding:var(--jb-select-selected-value-padding, 0.125rem 0.75rem 0 0.75rem);
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "web component",
17
17
  "react component"
18
18
  ],
19
- "version": "7.0.4",
19
+ "version": "7.0.5",
20
20
  "bugs": "https://github.com/javadbat/jb-select/issues",
21
21
  "homepage": "https://javadbat.github.io/design-system/?path=/story/components-form-elements-jbselect",
22
22
  "license": "MIT",
@@ -38,7 +38,7 @@
38
38
  "jb-validation": ">=0.4.0",
39
39
  "jb-button": ">=3.8.0",
40
40
  "jb-popover": ">=1.6.0",
41
- "jb-core":">=0.24.0"
41
+ "jb-core":">=0.25.0"
42
42
  },
43
43
  "devDependencies": {
44
44
  "jb-form":">=0.7.1"