jb-select 7.0.6 → 7.1.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/lib/jb-select.ts CHANGED
@@ -19,7 +19,6 @@ import { i18n } from "jb-core/i18n";
19
19
  import type { JBButtonWebComponent } from "jb-button";
20
20
  import { JBPopoverWebComponent } from "jb-popover";
21
21
 
22
- //TODO: add clean button to empty the select box after value selection
23
22
  //TODO: add IncludeInputInList or freeSolo so user can select item that he wrote without even it exist in select list
24
23
  //TODO: handleHomeEndKeys to move focus inside the popup with the Home and End keys.
25
24
  /**
@@ -27,29 +26,29 @@ import { JBPopoverWebComponent } from "jb-popover";
27
26
  */
28
27
 
29
28
  // biome-ignore lint/suspicious/noExplicitAny: <we support any type of value and there is no limitation on value type>
30
- export class JBSelectWebComponent<TValue = any> extends HTMLElement implements WithValidation<ValidationValue<TValue>>, JBFormInputStandards<TValue> {
29
+ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements WithValidation<ValidationValue<TValue>>, JBFormInputStandards<TValue | null> {
31
30
  static get formAssociated() {
32
31
  return true;
33
32
  }
34
33
  // we keep selected option here by option but we return TValue when user demand
35
- #value: TValue| null;
34
+ #value: TValue | null = null;
36
35
  #textValue = "";
37
36
  // if user set value and current option list is not contain the option.
38
37
  // we hold it in _notFoundedValue and select value when option value get updated
39
- #notFoundedValue: TValue = null;
38
+ #notFoundedValue: TValue | null = null;
40
39
  #optionList = new Set<JBOptionWebComponent<TValue>>()
41
40
  //keep selected option dom
42
41
  #selectedOption: JBOptionWebComponent<TValue> | null = null;
43
42
  callbacks: JBSelectCallbacks<TValue> = {}
44
43
  elements!: JBSelectElements;
45
- get value(): TValue {
44
+ get value() {
46
45
  if (this.#value !== null && this.#value !== undefined) {
47
46
  return this.#value;
48
47
  } else {
49
48
  return null;
50
49
  }
51
50
  }
52
- set value(value: TValue | null | undefined) {
51
+ set value(value: TValue | null) {
53
52
  this.#setValueFromOutside(value);
54
53
  }
55
54
  get textValue() {
@@ -62,11 +61,14 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
62
61
  }
63
62
  get selectedOptionTitle() {
64
63
  if (this.value) {
65
- return this.#selectedOption.optionContentText;
64
+ return this.#selectedOption?.optionContentText;
66
65
  } else {
67
66
  return "";
68
67
  }
69
68
  }
69
+ get form(){
70
+ return this.#internals.form;
71
+ }
70
72
  #placeholder = "";
71
73
  get placeholder() {
72
74
  return this.#placeholder;
@@ -123,6 +125,7 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
123
125
  if (value) {
124
126
  this.#internals.states?.add("disabled");
125
127
  this.#internals.ariaDisabled = "true";
128
+ this.#hideOptionList();
126
129
  } else {
127
130
  this.#internals.states?.delete("disabled");
128
131
  this.#internals.ariaDisabled = "false";
@@ -137,7 +140,7 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
137
140
  get required() {
138
141
  return this.#required;
139
142
  }
140
- #internals?: ElementInternals;
143
+ #internals!: ElementInternals;
141
144
  /**
142
145
  * @description will determine if component trigger jb-validation mechanism automatically on user event or it just let user-developer handle validation mechanism by himself
143
146
  */
@@ -149,9 +152,9 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
149
152
  return this.getAttribute('name') || '';
150
153
  }
151
154
  set name(value: string) {
152
- if(value){
155
+ if (value) {
153
156
  this.setAttribute('name', value);
154
- }else{
157
+ } else {
155
158
  this.removeAttribute('name');
156
159
  }
157
160
  }
@@ -176,11 +179,11 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
176
179
  if (this.elements.optionListWrapper instanceof JBPopoverWebComponent) {
177
180
  this.#setupPopover();
178
181
  } else {
179
- customElements.whenDefined("jb-popover").then(() =>this.#setupPopover())
182
+ customElements.whenDefined("jb-popover").then(() => this.#setupPopover())
180
183
  }
181
184
  }
182
- #setupPopover(){
183
- this.elements.optionListWrapper.bindTarget(this.elements.selectBox);
185
+ #setupPopover() {
186
+ this.elements.optionListWrapper.bindTarget(this.elements.selectBox);
184
187
  }
185
188
  #callOnInitEvent() {
186
189
  const event = new CustomEvent("init", { bubbles: true, composed: true });
@@ -194,7 +197,7 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
194
197
  const shadowRoot = this.attachShadow({
195
198
  mode: "open",
196
199
  delegatesFocus: true,
197
- serializable:true
200
+ serializable: true
198
201
  });
199
202
  registerDefaultVariables();
200
203
  const html = `<style>${CSS} ${VariablesCSS}</style>\n${renderHTML()}`;
@@ -211,11 +214,11 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
211
214
  optionListSlot: shadowRoot.querySelector(".select-list-wrapper .select-list slot")!,
212
215
  arrowIcon: shadowRoot.querySelector(".arrow-icon")!,
213
216
  clearButton: shadowRoot.querySelector(".clear-button") as JBButtonWebComponent,
214
- label:shadowRoot.querySelector("label"),
217
+ label: shadowRoot.querySelector("label")!,
215
218
  emptyListPlaceholder: shadowRoot.querySelector(".empty-list-placeholder")!,
216
- mobileSearchInputWrapper: shadowRoot.querySelector(".mobile-search-input-wrapper"),
217
- frontBox: shadowRoot.querySelector(".front-box"),
218
- selectBox: shadowRoot.querySelector(".select-box")
219
+ mobileSearchInputWrapper: shadowRoot.querySelector(".mobile-search-input-wrapper")!,
220
+ frontBox: shadowRoot.querySelector(".front-box")!,
221
+ selectBox: shadowRoot.querySelector(".select-box")!
219
222
  };
220
223
  this.#registerEventListener();
221
224
  this.#updateListEmptyPlaceholder();
@@ -305,9 +308,9 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
305
308
  this.reportValidity();
306
309
  break;
307
310
  case 'hide-clear':
308
- if(value === '' || value === 'true'){
311
+ if (value === '' || value === 'true') {
309
312
  this.elements.clearButton.style.display = 'none'
310
- }else{
313
+ } else {
311
314
  this.elements.clearButton.style.display = 'block'
312
315
  }
313
316
  break;
@@ -331,7 +334,7 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
331
334
  #setValueOnOptionListChanged() {
332
335
  //when option list changed we see if current value is valid for new optionlist we set it if not we reset value to null.
333
336
  //in some scenario value is set before optionList attached so we store it on this.#notFoundedValue and after option list set we set value from this.#notFoundedValue
334
- if (this.#notFoundedValue) {
337
+ if (this.#notFoundedValue !== null) {
335
338
  //if select has no prev value or pending not found value we don't set it because user may input some search terms in input box and developer-user update list base on that value
336
339
  //if we set it to null the search term and this.textValue will become null and empty too and it make impossible for user to search in dynamic back-end provided searchable list so we put this condition to prevent it
337
340
  const isSet = this.#setValueFromOutside(this.#notFoundedValue);
@@ -350,13 +353,13 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
350
353
  return true;
351
354
  }
352
355
  let matchedOption: JBOptionWebComponent<TValue> | null = null;
353
- this.#optionList.forEach((option) => {
356
+ for (const option of this.#optionList) {
354
357
  // if we have value mapper we set selected value by object that match mapper
355
358
  if (option.value == value) {
356
359
  matchedOption = option;
357
360
  }
358
- });
359
- if (matchedOption) {
361
+ }
362
+ if (matchedOption !== null) {
360
363
  this.#setValue(matchedOption.value, matchedOption);
361
364
  return true;
362
365
  } else {
@@ -372,7 +375,7 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
372
375
  this.#selectedOption = option;
373
376
  }
374
377
  }
375
- #setValue(value: TValue, option: JBOptionWebComponent<TValue> | null) {
378
+ #setValue(value: TValue | null, option: JBOptionWebComponent<TValue> | null) {
376
379
  this.#notFoundedValue = null;
377
380
  this.#value = value;
378
381
  if (value === null || value === undefined) {
@@ -478,6 +481,9 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
478
481
  }
479
482
  }
480
483
  focus() {
484
+ if (this.#disabled) {
485
+ return;
486
+ }
481
487
  this.elements.input.focus();
482
488
  this.#showOptionList();
483
489
  this.elements.optionListWrapper.open();
@@ -502,16 +508,18 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
502
508
  this.elements.input.blur();
503
509
  }
504
510
  #showOptionList() {
511
+ this.#internals.states.add("open")
505
512
  this.elements.optionListWrapper.classList.add("--show");
506
513
  }
507
514
  #hideOptionList() {
515
+ this.#internals.states.delete("open")
508
516
  this.elements.optionListWrapper.classList.remove("--show");
509
517
  }
510
518
  #updateOptionList(filterText: string) {
511
519
  const event = new CustomEvent("filter-change", { detail: { filterText }, bubbles: false, cancelable: false, composed: false });
512
520
  this.dispatchEvent(event);
513
521
  }
514
- #onOptionSelect(e: CustomEvent) {
522
+ #onOptionSelect(e: Event) {
515
523
  const prevValue = this.#value;
516
524
  const prevOption = this.#selectedOption;
517
525
  //because jb-option may be in another shadow dom like jb-option-list we have to get first composed element as a target
@@ -523,7 +531,7 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
523
531
  const dispatchedEvent = this.#dispatchOnChangeEvent();
524
532
  if (dispatchedEvent.defaultPrevented) {
525
533
  e.preventDefault();
526
- this.#selectOption(prevValue, prevOption);
534
+ this.#selectOption(prevValue, prevOption!);
527
535
  }
528
536
  }
529
537
 
@@ -535,7 +543,7 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
535
543
  target.addEventListener("jb-option-disconnected", this.#onOptionDisconnected.bind(this), { once: true, passive: true });
536
544
  target.setSelectElement(this);
537
545
  this.#optionList.add(target);
538
- if (this.#notFoundedValue) {
546
+ if (this.#notFoundedValue !== null) {
539
547
  this.#setValueOnOptionListChanged();
540
548
  }
541
549
  this.#updateListEmptyPlaceholder();
@@ -550,7 +558,7 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
550
558
  }
551
559
  }
552
560
 
553
- #selectOption(value: TValue, optionDom: JBOptionWebComponent<TValue>) {
561
+ #selectOption(value: TValue | null, optionDom: JBOptionWebComponent<TValue>) {
554
562
  this.#setValue(value, optionDom);
555
563
  this.#checkValidity(true);
556
564
  }
@@ -572,7 +580,7 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
572
580
  this.dispatchEvent(event);
573
581
  return event;
574
582
  }
575
- #setSelectedOptionDom(value: TValue) {
583
+ #setSelectedOptionDom(value: TValue | null) {
576
584
  //when user select option or value changed in any condition we set selected option DOM
577
585
  this.elements.selectedValueWrapper.innerHTML = "";
578
586
  //if value was null or undefined it remain empty
@@ -601,10 +609,10 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
601
609
  }
602
610
  #getInsideValidation() {
603
611
  const validationList: ValidationItem<ValidationValue<TValue>>[] = [];
604
- if (this.getAttribute("error") !== null && this.getAttribute("error").trim().length > 0) {
612
+ if (this.getAttribute("error") !== null && (this.getAttribute("error") ?? "").trim().length > 0) {
605
613
  validationList.push({
606
614
  validator: undefined,
607
- message: this.getAttribute("error"),
615
+ message: this.getAttribute("error")!,
608
616
  stateType: "customError"
609
617
  });
610
618
  }
@@ -668,7 +676,7 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
668
676
  } else {
669
677
  states["customError"] = true;
670
678
  }
671
- if (message == '') { message = res.message; }
679
+ if (message == '') { message = res.message ?? ""; }
672
680
 
673
681
  }
674
682
  });
package/lib/types.ts CHANGED
@@ -4,7 +4,7 @@ import type{ JBSelectWebComponent } from "./jb-select";
4
4
  import type {JBButtonWebComponent} from "jb-button";
5
5
  import type { JBPopoverWebComponent } from "jb-popover";
6
6
  export type JBSelectCallbacks<TValue> = {
7
- getSelectedValueDOM?:(value:TValue,content:HTMLElement) => HTMLElement;
7
+ getSelectedValueDOM?:(value:TValue|null,content:HTMLElement|null) => HTMLElement;
8
8
  }
9
9
 
10
10
  export type JBSelectElements = {
package/lib/variables.css CHANGED
@@ -33,8 +33,12 @@
33
33
  :host(:state(invalid)) {
34
34
  --message-color: var(--jb-select-message-error-color, var(--jb-red));
35
35
  }
36
-
37
- :host(:focus-within) {
36
+ :host(:state(disabled)) {
37
+ cursor: not-allowed;
38
+ --select-box-bg-color: var(--jb-select-bg-color-disabled, hsl(from var(--jb-neutral-10) h 12% 66.1));
39
+ --value-color:var(--jb-select-value-color-disabled, var(--jb-neutral-3));
40
+ }
41
+ :host(:focus-within:not(:state(disabled))) {
38
42
  --border-color: var(--jb-select-border-color-focus, var(--jb-neutral));
39
43
  }
40
44
 
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "web component",
17
17
  "react component"
18
18
  ],
19
- "version": "7.0.6",
19
+ "version": "7.1.1",
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",
@@ -36,11 +36,11 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "jb-validation": ">=0.4.0",
39
- "jb-button": ">=3.8.0",
40
- "jb-popover": ">=1.6.0",
41
- "jb-core":">=0.25.0"
39
+ "jb-button": ">=3.9.1",
40
+ "jb-popover": ">=1.6.1",
41
+ "jb-core":">=0.26.0"
42
42
  },
43
43
  "devDependencies": {
44
- "jb-form":">=0.7.1"
44
+ "jb-form":">=0.11.0"
45
45
  }
46
46
  }
@@ -1,19 +1,13 @@
1
1
  import React, { PropsWithChildren } from 'react';
2
2
  import { JBOptionWebComponent } from 'jb-select';
3
- type TValue = any;
4
- declare module "react" {
5
- namespace JSX {
6
- interface IntrinsicElements {
7
- 'jb-option': JBOptionType;
8
- }
9
- interface JBOptionType extends React.DetailedHTMLProps<React.HTMLAttributes<JBOptionWebComponent<TValue>>, JBOptionWebComponent<TValue>> {
10
- class?: string;
11
- }
12
- }
3
+ import './module-declaration.js';
4
+ export declare function JBOption<TValue>(props: JBOptionProps<TValue>): React.JSX.Element;
5
+ export declare namespace JBOption {
6
+ var displayName: string;
13
7
  }
14
- export declare const JBOption: React.ForwardRefExoticComponent<Omit<JBOptionProps<any>, "ref"> & React.RefAttributes<unknown>>;
15
8
  type Props<TValue> = {
16
9
  value: TValue;
10
+ ref?: React.ForwardedRef<JBOptionWebComponent<TValue> | undefined>;
17
11
  };
18
12
  export type JBOptionProps<TValue> = PropsWithChildren<React.JSX.JBOptionType & Props<TValue>>;
19
13
  export {};
@@ -32,4 +32,5 @@ export type Props<TValue> = PropsWithChildren<EventProps & JBSelectAttributes<TV
32
32
  ref?: React.RefObject<JBSelectWebComponent>;
33
33
  size?: SizeVariants;
34
34
  name?: string;
35
+ disabled?: boolean;
35
36
  };
@@ -1,2 +1,2 @@
1
- var e=Object.create,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyNames,l=Object.getPrototypeOf,n=Object.prototype.hasOwnProperty,c=(e,l,c,a)=>{if(l&&"object"==typeof l||"function"==typeof l)for(var o,i=u(l),s=0,f=i.length;s<f;s++)o=i[s],n.call(e,o)||o===c||t(e,o,{get:(e=>l[e]).bind(null,o),enumerable:!(a=r(l,o))||a.enumerable});return e},a=(r,u,n)=>(n=null!=r?e(l(r)):{},c(!u&&r&&r.__esModule?n:t(n,"default",{value:r,enumerable:!0}),r));const o=a(require("react"));require("jb-select");const i=a(require("jb-core/react")),s=o.default.forwardRef((e,t)=>{let r=(0,o.useRef)(null);return(0,o.useImperativeHandle)(t,()=>r?r.current:void 0,[r]),(0,o.useEffect)(()=>{r.current&&Array.isArray(e.optionList)&&(r.current.optionList=e.optionList)},[e.optionList,r]),(0,o.useEffect)(()=>{r.current&&"function"==typeof e.getTitle&&r.current.setCallback("getTitle",e.getTitle)},[e.getTitle,r]),(0,o.useEffect)(()=>{r.current&&"function"==typeof e.getValue&&r.current.setCallback("getValue",e.getValue)},[e.getValue,r]),(0,o.useEffect)(()=>{r.current&&"function"==typeof e.getContentDOM&&r.current.setCallback("getContentDOM",e.getContentDOM)},[e.getContentDOM,r]),o.default.createElement("jb-option-list",{ref:r})});function f(e){var t,r;let u=(0,o.useRef)(null);(0,o.useImperativeHandle)(e.ref,()=>u?u.current:void 0,[u]);let{onChange:l,onInit:n,onInput:c,onKeyUp:a,onLoad:s,error:f,getSelectedValueDOM:d,label:p,required:b,message:v,placeholder:g,searchPlaceholder:h,validationList:m,value:E,hideClear:O,...y}=e;return t={onChange:l,onInit:n,onInput:c,onKeyUp:a,onLoad:s},(0,i.useEvent)(u,"load",t.onLoad,!0),(0,i.useEvent)(u,"init",t.onInit,!0),(0,i.useEvent)(u,"keyup",t.onKeyUp),(0,i.useEvent)(u,"change",t.onChange),(0,i.useEvent)(u,"input",t.onInput),r={error:f,getSelectedValueDOM:d,label:p,required:b,message:v,placeholder:g,searchPlaceholder:h,validationList:m,value:E,hideClear:O},(0,o.useEffect)(()=>{null!==r.message&&void 0!==r.message?u.current?.setAttribute("message",r.message):u.current?.removeAttribute("message")},[r.message]),(0,o.useEffect)(()=>{u?.current&&(u.current.validation.list=r.validationList||[])},[u.current,r.validationList]),(0,o.useEffect)(()=>{null!==r.label&&void 0!==r.label?u.current?.setAttribute("label",r.label):u.current?.removeAttribute("label")},[r.label,u.current]),(0,o.useEffect)(()=>{null!==r.required&&void 0!==r.required?u.current?.setAttribute("required",""):u.current?.removeAttribute("required")},[r.required,u]),(0,o.useEffect)(()=>{null!==r.hideClear&&void 0!==r.hideClear?u.current?.setAttribute("hide-clear",""):u.current?.removeAttribute("hide-clear")},[r.hideClear,u]),(0,o.useEffect)(()=>{null!==r.placeholder&&void 0!==r.placeholder&&u.current?.setAttribute("placeholder",r.placeholder)},[r.placeholder,u]),(0,o.useEffect)(()=>{null!==r.searchPlaceholder&&void 0!==r.searchPlaceholder&&u.current?.setAttribute("search-placeholder",r.searchPlaceholder)},[r.searchPlaceholder]),(0,o.useEffect)(()=>{r.error?u?.current?.setAttribute("error",r.error):u?.current?.removeAttribute("error")},[r.error]),(0,o.useEffect)(()=>{u.current&&(u.current.value=r.value)},[r.value]),(0,o.useEffect)(()=>{"function"==typeof r.getSelectedValueDOM&&u.current&&u.current&&(u.current.callbacks.getSelectedValueDOM=r.getSelectedValueDOM)},[r.getSelectedValueDOM]),o.default.createElement("jb-select",{ref:u,...y},e.children)}s.displayName="JBOptionList",f.displayName="JBSelect";const d=o.default.forwardRef((e,t)=>{let r=(0,o.useRef)(null),{value:u,children:l,className:n,...c}=e;return(0,o.useImperativeHandle)(t,()=>r?r.current:void 0,[r]),(0,o.useEffect)(()=>{r.current&&void 0!==u&&(r.current.value=u)},[u,r]),o.default.createElement("jb-option",{class:n,ref:r,...c},l)});d.displayName="JBOption",exports.JBOption=d,exports.JBOptionList=s,exports.JBSelect=f;
1
+ var e=Object.create,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,u=Object.getPrototypeOf,n=Object.prototype.hasOwnProperty,c=(e,u,c,a)=>{if(u&&"object"==typeof u||"function"==typeof u)for(var o,i=l(u),s=0,f=i.length;s<f;s++)o=i[s],n.call(e,o)||o===c||t(e,o,{get:(e=>u[e]).bind(null,o),enumerable:!(a=r(u,o))||a.enumerable});return e},a=(r,l,n)=>(n=null!=r?e(u(r)):{},c(!l&&r&&r.__esModule?n:t(n,"default",{value:r,enumerable:!0}),r));const o=a(require("react"));require("jb-select");const i=a(require("jb-core/react")),s=o.default.forwardRef((e,t)=>{let r=(0,o.useRef)(null);return(0,o.useImperativeHandle)(t,()=>r?r.current:void 0,[r]),(0,o.useEffect)(()=>{r.current&&Array.isArray(e.optionList)&&(r.current.optionList=e.optionList)},[e.optionList,r]),(0,o.useEffect)(()=>{r.current&&"function"==typeof e.getTitle&&r.current.setCallback("getTitle",e.getTitle)},[e.getTitle,r]),(0,o.useEffect)(()=>{r.current&&"function"==typeof e.getValue&&r.current.setCallback("getValue",e.getValue)},[e.getValue,r]),(0,o.useEffect)(()=>{r.current&&"function"==typeof e.getContentDOM&&r.current.setCallback("getContentDOM",e.getContentDOM)},[e.getContentDOM,r]),o.default.createElement("jb-option-list",{ref:r})});function f(e){var t,r;let l=(0,o.useRef)(null);(0,o.useImperativeHandle)(e.ref,()=>l?l.current:void 0,[l]);let{onChange:u,onInit:n,onInput:c,onKeyUp:a,onLoad:s,error:f,getSelectedValueDOM:d,label:p,required:b,message:v,placeholder:g,searchPlaceholder:h,validationList:m,value:E,hideClear:O,...y}=e;return t={onChange:u,onInit:n,onInput:c,onKeyUp:a,onLoad:s},(0,i.useEvent)(l,"load",t.onLoad,!0),(0,i.useEvent)(l,"init",t.onInit,!0),(0,i.useEvent)(l,"keyup",t.onKeyUp),(0,i.useEvent)(l,"change",t.onChange),(0,i.useEvent)(l,"input",t.onInput),r={error:f,getSelectedValueDOM:d,label:p,required:b,message:v,placeholder:g,searchPlaceholder:h,validationList:m,value:E,hideClear:O},(0,o.useEffect)(()=>{null!==r.message&&void 0!==r.message?l.current?.setAttribute("message",r.message):l.current?.removeAttribute("message")},[r.message]),(0,o.useEffect)(()=>{l?.current&&(l.current.validation.list=r.validationList||[])},[l.current,r.validationList]),(0,o.useEffect)(()=>{null!==r.label&&void 0!==r.label?l.current?.setAttribute("label",r.label):l.current?.removeAttribute("label")},[r.label,l.current]),(0,o.useEffect)(()=>{null!==r.required&&void 0!==r.required?l.current?.setAttribute("required",""):l.current?.removeAttribute("required")},[r.required,l]),(0,o.useEffect)(()=>{null!==r.hideClear&&void 0!==r.hideClear?l.current?.setAttribute("hide-clear",""):l.current?.removeAttribute("hide-clear")},[r.hideClear,l]),(0,o.useEffect)(()=>{null!==r.placeholder&&void 0!==r.placeholder&&l.current?.setAttribute("placeholder",r.placeholder)},[r.placeholder,l]),(0,o.useEffect)(()=>{null!==r.searchPlaceholder&&void 0!==r.searchPlaceholder&&l.current?.setAttribute("search-placeholder",r.searchPlaceholder)},[r.searchPlaceholder]),(0,o.useEffect)(()=>{r.error?l?.current?.setAttribute("error",r.error):l?.current?.removeAttribute("error")},[r.error]),(0,o.useEffect)(()=>{l.current&&(l.current.value=r.value)},[r.value]),(0,o.useEffect)(()=>{"function"==typeof r.getSelectedValueDOM&&l.current&&l.current&&(l.current.callbacks.getSelectedValueDOM=r.getSelectedValueDOM)},[r.getSelectedValueDOM]),o.default.createElement("jb-select",{ref:l,...y},e.children)}function d(e){let t=(0,o.useRef)(null),{children:r,ref:l,className:u,...n}=e;return(0,o.useImperativeHandle)(l,()=>t.current??void 0,[t]),o.default.createElement("jb-option",{class:u,ref:t,...n},r)}s.displayName="JBOptionList",f.displayName="JBSelect",d.displayName="JBOption",exports.JBOption=d,exports.JBOptionList=s,exports.JBSelect=f;
2
2
  //# sourceMappingURL=index.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","names":[],"sources":["../lib/JBOptionList.tsx","../lib/events-hook.ts","../lib/attributes-hook.ts","../lib/JBSelect.tsx","../lib/JBOption.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAY,+BAAuB,cAAA,WAAqB,CAAA,OAAM,QAAO;CAkBrE,MAAO,UAAM,kBAAY,KAAG;AAC1B,gCAAgB,KAAkD,MAAK,UAAA,QAAA,kBAAA,CACvE,OAKA,EAAA;sBACM,MAAA;MACF,QAAQ,WAAQ,MAAA,QAAa,MAAM,WAAU,CAC/C,SAAA,QAAA,aAAA,MAAA;CAEF,GAAA,CACE,MAAI;AAGN,sBAAU,MAAA;AACV,MAAA,QAAe,kBAAA,MAAA,YAAA,WACT,SAAQ,QAAO,YAAW,YAAc,MAAI,SAAU;KAGxD,MAAM,UACV;sBAEI,MAAA;AACF,MAAA,QAAA,kBAAA,MAAA,YAAA,WACE,SAAM,QAAa,YAAW,YAAA,MAAA,SAAA;CAKlC,GAAA,CAQF,MAAa;;;;;;;;;;AC1Cb,SAAgB,UAAU,SAA0C,OAAiB;AACnF,6BAAS,SAAS,QAAQ,MAAM,QAAQ,KAAK;AAC7C,6BAAS,SAAS,QAAQ,MAAM,QAAQ,KAAK;AAC7C,6BAAS,SAAS,SAAS,MAAM,QAAQ;AACzC,6BAAS,SAAS,UAAU,MAAM,SAAS;AAC3C,6BAAS,SAAS,SAAS,MAAM,QAAQ;AAC3C;;;;ACNA,SAAgB,qBAA6B,SAA0C,OAAiC;AACtH,sBAAU,MAAG;AACX,MAAI,MAAM,YAAY,QAAQ,MAAM,mBAClC,SAAQ,SAAS,aAAa,WAAW,MAAM,QAAQ;eAClD,SAAA,gBAAA,UAAA;KAGL,MAAM,OAEV,EAAA;sBACM,M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AAO;CAgBxG,MAAO,UAAM,kBAAW,KAAM;CAC5B,MAAM,EAAA,OAAO,UAAwC,UAAK,GAAA,MAAA,GAAA;AAC1D,gCAAa,KAAS,MAAA,UAAc,QAAK,kBAAQ,CACjD,OAMA,EAAA;sBACM,MAAA;MACF,QAAQ,WAAQ,iBAClB,SAAA,QAAA,QAAA;CAGF,GAAA,CAKA,OAOM"}
1
+ {"version":3,"file":"index.cjs.js","names":[],"sources":["../lib/JBOptionList.tsx","../lib/events-hook.ts","../lib/attributes-hook.ts","../lib/JBSelect.tsx","../lib/JBOption.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAY,+BAAuB,cAAA,WAAqB,CAAA,OAAM,QAAO;CAkBrE,MAAO,UAAM,kBAAY,KAAG;AAC1B,gCAAgB,KAAkD,MAAK,UAAA,QAAA,kBAAA,CACvE,OAKA,EAAA;sBACM,MAAA;MACF,QAAQ,WAAQ,MAAA,QAAa,MAAM,WAAU,CAC/C,SAAA,QAAA,aAAA,MAAA;CAEF,GAAA,CACE,MAAI;AAGN,sBAAU,MAAA;AACV,MAAA,QAAe,kBAAA,MAAA,YAAA,WACT,SAAQ,QAAO,YAAW,YAAc,MAAI,SAAU;KAGxD,MAAM,UACV;sBAEI,MAAA;AACF,MAAA,QAAA,kBAAA,MAAA,YAAA,WACE,SAAM,QAAa,YAAW,YAAA,MAAA,SAAA;CAKlC,GAAA,CAQF,MAAa;;;;;;;;;;AC1Cb,SAAgB,UAAU,SAA0C,OAAiB;AACnF,6BAAS,SAAS,QAAQ,MAAM,QAAQ,KAAK;AAC7C,6BAAS,SAAS,QAAQ,MAAM,QAAQ,KAAK;AAC7C,6BAAS,SAAS,SAAS,MAAM,QAAQ;AACzC,6BAAS,SAAS,UAAU,MAAM,SAAS;AAC3C,6BAAS,SAAS,SAAS,MAAM,QAAQ;AAC3C;;;;ACNA,SAAgB,qBAA6B,SAA0C,OAAiC;AACtH,sBAAU,MAAG;AAC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,GAAA,YAAA,GAAA;AAClE,WAAA,SAAA;EACA;EAKF;EAAC;EAQO;;;;;;;;;;;;;;;;;;;;;;;;AC9CR,SAAgB,SAAkB,OAA4B;CAC5D,MAAM,UAAU,kBAAqC,KAAK;CAE1D,MAAM,EAAC,UAAU,KAAI,UAAW,GAAG,MAAK,GAAG;AAC3C,gCACE,KACA,MAAG,QAAI,mBAAiB,CAI1B,OAKF,EAAA;AAAC,wBAAA,cAAA,cAAA,aAAA;EAQO,OAAC"}
@@ -1,2 +1,2 @@
1
- import e,{useEffect as t,useImperativeHandle as r,useRef as l}from"react";import"jb-select";import{useEvent as n}from"jb-core/react";let u=e.forwardRef((n,u)=>{let a=l(null);return r(u,()=>a?a.current:void 0,[a]),t(()=>{a.current&&Array.isArray(n.optionList)&&(a.current.optionList=n.optionList)},[n.optionList,a]),t(()=>{a.current&&"function"==typeof n.getTitle&&a.current.setCallback("getTitle",n.getTitle)},[n.getTitle,a]),t(()=>{a.current&&"function"==typeof n.getValue&&a.current.setCallback("getValue",n.getValue)},[n.getValue,a]),t(()=>{a.current&&"function"==typeof n.getContentDOM&&a.current.setCallback("getContentDOM",n.getContentDOM)},[n.getContentDOM,a]),e.createElement("jb-option-list",{ref:a})});function a(u){var a,i;let c=l(null);r(u.ref,()=>c?c.current:void 0,[c]);let{onChange:o,onInit:s,onInput:d,onKeyUp:p,onLoad:b,error:g,getSelectedValueDOM:h,label:v,required:m,message:f,placeholder:A,searchPlaceholder:O,validationList:y,value:C,hideClear:L,...D}=u;return n(c,"load",(a={onChange:o,onInit:s,onInput:d,onKeyUp:p,onLoad:b}).onLoad,!0),n(c,"init",a.onInit,!0),n(c,"keyup",a.onKeyUp),n(c,"change",a.onChange),n(c,"input",a.onInput),i={error:g,getSelectedValueDOM:h,label:v,required:m,message:f,placeholder:A,searchPlaceholder:O,validationList:y,value:C,hideClear:L},t(()=>{null!==i.message&&void 0!==i.message?c.current?.setAttribute("message",i.message):c.current?.removeAttribute("message")},[i.message]),t(()=>{c?.current&&(c.current.validation.list=i.validationList||[])},[c.current,i.validationList]),t(()=>{null!==i.label&&void 0!==i.label?c.current?.setAttribute("label",i.label):c.current?.removeAttribute("label")},[i.label,c.current]),t(()=>{null!==i.required&&void 0!==i.required?c.current?.setAttribute("required",""):c.current?.removeAttribute("required")},[i.required,c]),t(()=>{null!==i.hideClear&&void 0!==i.hideClear?c.current?.setAttribute("hide-clear",""):c.current?.removeAttribute("hide-clear")},[i.hideClear,c]),t(()=>{null!==i.placeholder&&void 0!==i.placeholder&&c.current?.setAttribute("placeholder",i.placeholder)},[i.placeholder,c]),t(()=>{null!==i.searchPlaceholder&&void 0!==i.searchPlaceholder&&c.current?.setAttribute("search-placeholder",i.searchPlaceholder)},[i.searchPlaceholder]),t(()=>{i.error?c?.current?.setAttribute("error",i.error):c?.current?.removeAttribute("error")},[i.error]),t(()=>{c.current&&(c.current.value=i.value)},[i.value]),t(()=>{"function"==typeof i.getSelectedValueDOM&&c.current&&c.current&&(c.current.callbacks.getSelectedValueDOM=i.getSelectedValueDOM)},[i.getSelectedValueDOM]),e.createElement("jb-select",{ref:c,...D},u.children)}u.displayName="JBOptionList",a.displayName="JBSelect";let i=e.forwardRef((n,u)=>{let a=l(null),{value:i,children:c,className:o,...s}=n;return r(u,()=>a?a.current:void 0,[a]),t(()=>{a.current&&void 0!==i&&(a.current.value=i)},[i,a]),e.createElement("jb-option",{class:o,ref:a,...s},c)});i.displayName="JBOption";export{i as JBOption,u as JBOptionList,a as JBSelect};
1
+ import e,{useEffect as t,useImperativeHandle as r,useRef as l}from"react";import"jb-select";import{useEvent as n}from"jb-core/react";let u=e.forwardRef((n,u)=>{let i=l(null);return r(u,()=>i?i.current:void 0,[i]),t(()=>{i.current&&Array.isArray(n.optionList)&&(i.current.optionList=n.optionList)},[n.optionList,i]),t(()=>{i.current&&"function"==typeof n.getTitle&&i.current.setCallback("getTitle",n.getTitle)},[n.getTitle,i]),t(()=>{i.current&&"function"==typeof n.getValue&&i.current.setCallback("getValue",n.getValue)},[n.getValue,i]),t(()=>{i.current&&"function"==typeof n.getContentDOM&&i.current.setCallback("getContentDOM",n.getContentDOM)},[n.getContentDOM,i]),e.createElement("jb-option-list",{ref:i})});function i(u){var i,a;let c=l(null);r(u.ref,()=>c?c.current:void 0,[c]);let{onChange:o,onInit:s,onInput:d,onKeyUp:p,onLoad:b,error:g,getSelectedValueDOM:h,label:m,required:v,message:f,placeholder:A,searchPlaceholder:O,validationList:y,value:C,hideClear:L,...D}=u;return n(c,"load",(i={onChange:o,onInit:s,onInput:d,onKeyUp:p,onLoad:b}).onLoad,!0),n(c,"init",i.onInit,!0),n(c,"keyup",i.onKeyUp),n(c,"change",i.onChange),n(c,"input",i.onInput),a={error:g,getSelectedValueDOM:h,label:m,required:v,message:f,placeholder:A,searchPlaceholder:O,validationList:y,value:C,hideClear:L},t(()=>{null!==a.message&&void 0!==a.message?c.current?.setAttribute("message",a.message):c.current?.removeAttribute("message")},[a.message]),t(()=>{c?.current&&(c.current.validation.list=a.validationList||[])},[c.current,a.validationList]),t(()=>{null!==a.label&&void 0!==a.label?c.current?.setAttribute("label",a.label):c.current?.removeAttribute("label")},[a.label,c.current]),t(()=>{null!==a.required&&void 0!==a.required?c.current?.setAttribute("required",""):c.current?.removeAttribute("required")},[a.required,c]),t(()=>{null!==a.hideClear&&void 0!==a.hideClear?c.current?.setAttribute("hide-clear",""):c.current?.removeAttribute("hide-clear")},[a.hideClear,c]),t(()=>{null!==a.placeholder&&void 0!==a.placeholder&&c.current?.setAttribute("placeholder",a.placeholder)},[a.placeholder,c]),t(()=>{null!==a.searchPlaceholder&&void 0!==a.searchPlaceholder&&c.current?.setAttribute("search-placeholder",a.searchPlaceholder)},[a.searchPlaceholder]),t(()=>{a.error?c?.current?.setAttribute("error",a.error):c?.current?.removeAttribute("error")},[a.error]),t(()=>{c.current&&(c.current.value=a.value)},[a.value]),t(()=>{"function"==typeof a.getSelectedValueDOM&&c.current&&c.current&&(c.current.callbacks.getSelectedValueDOM=a.getSelectedValueDOM)},[a.getSelectedValueDOM]),e.createElement("jb-select",{ref:c,...D},u.children)}function a(t){let n=l(null),{children:u,ref:i,className:a,...c}=t;return r(i,()=>n.current??void 0,[n]),e.createElement("jb-option",{class:a,ref:n,...c},u)}u.displayName="JBOptionList",i.displayName="JBSelect",a.displayName="JBOption";export{a as JBOption,u as JBOptionList,i as JBSelect};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../lib/JBOptionList.tsx","../lib/events-hook.ts","../lib/attributes-hook.ts","../lib/JBSelect.tsx","../lib/JBOption.tsx"],"sourcesContent":[],"mappings":";;;;;AAEA,MAAY,+BAAuB,MAAA,WAAqB,CAAA,OAAM,QAAO;CAkBrE,MAAO,UAAM,OAAY,KAAG;AAC1B,qBAAgB,KAAkD,MAAK,UAAA,QAAA,kBAAA,CACvE,OAKA,EAAA;WACM,MAAA;MACF,QAAQ,WAAQ,MAAA,QAAa,MAAM,WAAU,CAC/C,SAAA,QAAA,aAAA,MAAA;CAEF,GAAA,CACE,MAAI;AAGN,WAAU,MAAA;AACV,MAAA,QAAe,kBAAA,MAAA,YAAA,WACT,SAAQ,QAAO,YAAW,YAAc,MAAI,SAAU;KAGxD,MAAM,UACV;WAEI,MAAA;AACF,MAAA,QAAA,kBAAA,MAAA,YAAA,WACE,SAAM,QAAa,YAAW,YAAA,MAAA,SAAA;CAKlC,GAAA,CAQF,MAAa;;;;;;;;;;AC1Cb,SAAgB,UAAU,SAA0C,OAAiB;AACnF,UAAS,SAAS,QAAQ,MAAM,QAAQ,KAAK;AAC7C,UAAS,SAAS,QAAQ,MAAM,QAAQ,KAAK;AAC7C,UAAS,SAAS,SAAS,MAAM,QAAQ;AACzC,UAAS,SAAS,UAAU,MAAM,SAAS;AAC3C,UAAS,SAAS,SAAS,MAAM,QAAQ;AAC3C;;;;ACNA,SAAgB,qBAA6B,SAA0C,OAAiC;AACtH,WAAU,MAAG;AACX,MAAI,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;AAClE,WAAA,SAAA;EACA;EAKF;EAAC;EAOO;;;;;;;;;;;;;;;;;;;;;;;;AClDR,MAAY,2BAAuB,MAAA,WAAmB,CAAqC,OAAM,QAAO;CAgBxG,MAAO,UAAM,OAAW,KAAM;CAC5B,MAAM,EAAA,OAAO,UAAwC,UAAK,GAAA,MAAA,GAAA;AAC1D,qBAAa,KAAS,MAAA,UAAc,QAAK,kBAAQ,CACjD,OAMA,EAAA;WACM,MAAA;MACF,QAAQ,WAAQ,iBAClB,SAAA,QAAA,QAAA;CAGF,GAAA,CAKA,OAOM"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../lib/JBOptionList.tsx","../lib/events-hook.ts","../lib/attributes-hook.ts","../lib/JBSelect.tsx","../lib/JBOption.tsx"],"sourcesContent":[],"mappings":";;;;;AAEA,MAAY,+BAAuB,MAAA,WAAqB,CAAA,OAAM,QAAO;CAkBrE,MAAO,UAAM,OAAY,KAAG;AAC1B,qBAAgB,KAAkD,MAAK,UAAA,QAAA,kBAAA,CACvE,OAKA,EAAA;WACM,MAAA;MACF,QAAQ,WAAQ,MAAA,QAAa,MAAM,WAAU,CAC/C,SAAA,QAAA,aAAA,MAAA;CAEF,GAAA,CACE,MAAI;AAGN,WAAU,MAAA;AACV,MAAA,QAAe,kBAAA,MAAA,YAAA,WACT,SAAQ,QAAO,YAAW,YAAc,MAAI,SAAU;KAGxD,MAAM,UACV;WAEI,MAAA;AACF,MAAA,QAAA,kBAAA,MAAA,YAAA,WACE,SAAM,QAAa,YAAW,YAAA,MAAA,SAAA;CAKlC,GAAA,CAQF,MAAa;;;;;;;;;;AC1Cb,SAAgB,UAAU,SAA0C,OAAiB;AACnF,UAAS,SAAS,QAAQ,MAAM,QAAQ,KAAK;AAC7C,UAAS,SAAS,QAAQ,MAAM,QAAQ,KAAK;AAC7C,UAAS,SAAS,SAAS,MAAM,QAAQ;AACzC,UAAS,SAAS,UAAU,MAAM,SAAS;AAC3C,UAAS,SAAS,SAAS,MAAM,QAA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AAS,qBAAS,OAAA,UAAA,SAAA,aAAA,mBAAA,gBAAA,OAAA,UAAA,GAAA,YAAA,GAAA;AAClE,WAAA,SAAA;EACA;EAKF;EAAC;EAQO;;;;;;;;;;;;;;;;;;;;;;;;AC9CR,SAAgB,SAAkB,OAA4B;CAC5D,MAAM,UAAU,OAAqC,KAAK;CAE1D,MAAM,EAAC,UAAU,KAAI,UAAW,GAAG,MAAK,GAAG;AAC3C,qBACE,KACA,MAAG,QAAI,mBAAiB,CAI1B,OAKF,EAAA;AAAC,wBAAA,MAAA,cAAA,aAAA;EAQO,OAAC"}
@@ -1,2 +1,2 @@
1
- var e,t;e=this,t=function(e,t,r,l){var u=Object.create,n=Object.defineProperty,c=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,i=Object.prototype.hasOwnProperty,s=(e,t,r,l)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var u,o=a(t),s=0,f=o.length;s<f;s++)u=o[s],i.call(e,u)||u===r||n(e,u,{get:(e=>t[e]).bind(null,u),enumerable:!(l=c(t,u))||l.enumerable});return e},f=(e,t,r)=>(r=null!=e?u(o(e)):{},s(!t&&e&&e.__esModule?r:n(r,"default",{value:e,enumerable:!0}),e));t=f(t),l=f(l);let d=t.default.forwardRef((e,r)=>{let l=(0,t.useRef)(null);return(0,t.useImperativeHandle)(r,()=>l?l.current:void 0,[l]),(0,t.useEffect)(()=>{l.current&&Array.isArray(e.optionList)&&(l.current.optionList=e.optionList)},[e.optionList,l]),(0,t.useEffect)(()=>{l.current&&"function"==typeof e.getTitle&&l.current.setCallback("getTitle",e.getTitle)},[e.getTitle,l]),(0,t.useEffect)(()=>{l.current&&"function"==typeof e.getValue&&l.current.setCallback("getValue",e.getValue)},[e.getValue,l]),(0,t.useEffect)(()=>{l.current&&"function"==typeof e.getContentDOM&&l.current.setCallback("getContentDOM",e.getContentDOM)},[e.getContentDOM,l]),t.default.createElement("jb-option-list",{ref:l})});function p(e){var r,u;let n=(0,t.useRef)(null);(0,t.useImperativeHandle)(e.ref,()=>n?n.current:void 0,[n]);let{onChange:c,onInit:a,onInput:o,onKeyUp:i,onLoad:s,error:f,getSelectedValueDOM:d,label:p,required:b,message:v,placeholder:g,searchPlaceholder:h,validationList:m,value:y,hideClear:E,...O}=e;return r={onChange:c,onInit:a,onInput:o,onKeyUp:i,onLoad:s},(0,l.useEvent)(n,"load",r.onLoad,!0),(0,l.useEvent)(n,"init",r.onInit,!0),(0,l.useEvent)(n,"keyup",r.onKeyUp),(0,l.useEvent)(n,"change",r.onChange),(0,l.useEvent)(n,"input",r.onInput),u={error:f,getSelectedValueDOM:d,label:p,required:b,message:v,placeholder:g,searchPlaceholder:h,validationList:m,value:y,hideClear:E},(0,t.useEffect)(()=>{null!==u.message&&void 0!==u.message?n.current?.setAttribute("message",u.message):n.current?.removeAttribute("message")},[u.message]),(0,t.useEffect)(()=>{n?.current&&(n.current.validation.list=u.validationList||[])},[n.current,u.validationList]),(0,t.useEffect)(()=>{null!==u.label&&void 0!==u.label?n.current?.setAttribute("label",u.label):n.current?.removeAttribute("label")},[u.label,n.current]),(0,t.useEffect)(()=>{null!==u.required&&void 0!==u.required?n.current?.setAttribute("required",""):n.current?.removeAttribute("required")},[u.required,n]),(0,t.useEffect)(()=>{null!==u.hideClear&&void 0!==u.hideClear?n.current?.setAttribute("hide-clear",""):n.current?.removeAttribute("hide-clear")},[u.hideClear,n]),(0,t.useEffect)(()=>{null!==u.placeholder&&void 0!==u.placeholder&&n.current?.setAttribute("placeholder",u.placeholder)},[u.placeholder,n]),(0,t.useEffect)(()=>{null!==u.searchPlaceholder&&void 0!==u.searchPlaceholder&&n.current?.setAttribute("search-placeholder",u.searchPlaceholder)},[u.searchPlaceholder]),(0,t.useEffect)(()=>{u.error?n?.current?.setAttribute("error",u.error):n?.current?.removeAttribute("error")},[u.error]),(0,t.useEffect)(()=>{n.current&&(n.current.value=u.value)},[u.value]),(0,t.useEffect)(()=>{"function"==typeof u.getSelectedValueDOM&&n.current&&n.current&&(n.current.callbacks.getSelectedValueDOM=u.getSelectedValueDOM)},[u.getSelectedValueDOM]),t.default.createElement("jb-select",{ref:n,...O},e.children)}d.displayName="JBOptionList",p.displayName="JBSelect";let b=t.default.forwardRef((e,r)=>{let l=(0,t.useRef)(null),{value:u,children:n,className:c,...a}=e;return(0,t.useImperativeHandle)(r,()=>l?l.current:void 0,[l]),(0,t.useEffect)(()=>{l.current&&void 0!==u&&(l.current.value=u)},[u,l]),t.default.createElement("jb-option",{class:c,ref:l,...a},n)});b.displayName="JBOption",e.JBOption=b,e.JBOptionList=d,e.JBSelect=p},"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("jb-select"),require("jb-core/react")):"function"==typeof define&&define.amd?define(["exports","react","jb-select","jb-core/react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).JBSelectReact={},e.React,e.JBSelect,e.JBCoreReact);
1
+ var e,t;e=this,t=function(e,t,r,l){var u=Object.create,n=Object.defineProperty,c=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,i=Object.prototype.hasOwnProperty,s=(e,t,r,l)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var u,o=a(t),s=0,f=o.length;s<f;s++)u=o[s],i.call(e,u)||u===r||n(e,u,{get:(e=>t[e]).bind(null,u),enumerable:!(l=c(t,u))||l.enumerable});return e},f=(e,t,r)=>(r=null!=e?u(o(e)):{},s(!t&&e&&e.__esModule?r:n(r,"default",{value:e,enumerable:!0}),e));t=f(t),l=f(l);let d=t.default.forwardRef((e,r)=>{let l=(0,t.useRef)(null);return(0,t.useImperativeHandle)(r,()=>l?l.current:void 0,[l]),(0,t.useEffect)(()=>{l.current&&Array.isArray(e.optionList)&&(l.current.optionList=e.optionList)},[e.optionList,l]),(0,t.useEffect)(()=>{l.current&&"function"==typeof e.getTitle&&l.current.setCallback("getTitle",e.getTitle)},[e.getTitle,l]),(0,t.useEffect)(()=>{l.current&&"function"==typeof e.getValue&&l.current.setCallback("getValue",e.getValue)},[e.getValue,l]),(0,t.useEffect)(()=>{l.current&&"function"==typeof e.getContentDOM&&l.current.setCallback("getContentDOM",e.getContentDOM)},[e.getContentDOM,l]),t.default.createElement("jb-option-list",{ref:l})});function p(e){var r,u;let n=(0,t.useRef)(null);(0,t.useImperativeHandle)(e.ref,()=>n?n.current:void 0,[n]);let{onChange:c,onInit:a,onInput:o,onKeyUp:i,onLoad:s,error:f,getSelectedValueDOM:d,label:p,required:b,message:v,placeholder:g,searchPlaceholder:h,validationList:m,value:y,hideClear:E,...O}=e;return r={onChange:c,onInit:a,onInput:o,onKeyUp:i,onLoad:s},(0,l.useEvent)(n,"load",r.onLoad,!0),(0,l.useEvent)(n,"init",r.onInit,!0),(0,l.useEvent)(n,"keyup",r.onKeyUp),(0,l.useEvent)(n,"change",r.onChange),(0,l.useEvent)(n,"input",r.onInput),u={error:f,getSelectedValueDOM:d,label:p,required:b,message:v,placeholder:g,searchPlaceholder:h,validationList:m,value:y,hideClear:E},(0,t.useEffect)(()=>{null!==u.message&&void 0!==u.message?n.current?.setAttribute("message",u.message):n.current?.removeAttribute("message")},[u.message]),(0,t.useEffect)(()=>{n?.current&&(n.current.validation.list=u.validationList||[])},[n.current,u.validationList]),(0,t.useEffect)(()=>{null!==u.label&&void 0!==u.label?n.current?.setAttribute("label",u.label):n.current?.removeAttribute("label")},[u.label,n.current]),(0,t.useEffect)(()=>{null!==u.required&&void 0!==u.required?n.current?.setAttribute("required",""):n.current?.removeAttribute("required")},[u.required,n]),(0,t.useEffect)(()=>{null!==u.hideClear&&void 0!==u.hideClear?n.current?.setAttribute("hide-clear",""):n.current?.removeAttribute("hide-clear")},[u.hideClear,n]),(0,t.useEffect)(()=>{null!==u.placeholder&&void 0!==u.placeholder&&n.current?.setAttribute("placeholder",u.placeholder)},[u.placeholder,n]),(0,t.useEffect)(()=>{null!==u.searchPlaceholder&&void 0!==u.searchPlaceholder&&n.current?.setAttribute("search-placeholder",u.searchPlaceholder)},[u.searchPlaceholder]),(0,t.useEffect)(()=>{u.error?n?.current?.setAttribute("error",u.error):n?.current?.removeAttribute("error")},[u.error]),(0,t.useEffect)(()=>{n.current&&(n.current.value=u.value)},[u.value]),(0,t.useEffect)(()=>{"function"==typeof u.getSelectedValueDOM&&n.current&&n.current&&(n.current.callbacks.getSelectedValueDOM=u.getSelectedValueDOM)},[u.getSelectedValueDOM]),t.default.createElement("jb-select",{ref:n,...O},e.children)}function b(e){let r=(0,t.useRef)(null),{children:l,ref:u,className:n,...c}=e;return(0,t.useImperativeHandle)(u,()=>r.current??void 0,[r]),t.default.createElement("jb-option",{class:n,ref:r,...c},l)}d.displayName="JBOptionList",p.displayName="JBSelect",b.displayName="JBOption",e.JBOption=b,e.JBOptionList=d,e.JBSelect=p},"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("jb-select"),require("jb-core/react")):"function"==typeof define&&define.amd?define(["exports","react","jb-select","jb-core/react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).JBSelectReact={},e.React,e.JBSelect,e.JBCoreReact);
2
2
  //# sourceMappingURL=index.umd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.umd.js","names":[],"sources":["../lib/JBOptionList.tsx","../lib/events-hook.ts","../lib/attributes-hook.ts","../lib/JBSelect.tsx","../lib/JBOption.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAY,+BAAuB,cAAA,WAAqB,CAAA,OAAM,QAAO;CAkBrE,MAAO,UAAM,kBAAY,KAAG;AAC1B,gCAAgB,KAAkD,MAAK,UAAA,QAAA,kBAAA,CACvE,OAKA,EAAA;sBACM,MAAA;MACF,QAAQ,WAAQ,MAAA,QAAa,MAAM,WAAU,CAC/C,SAAA,QAAA,aAAA,MAAA;CAEF,GAAA,CACE,MAAI;AAGN,sBAAU,MAAA;AACV,MAAA,QAAe,kBAAA,MAAA,YAAA,WACT,SAAQ,QAAO,YAAW,YAAc,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ACD,EAAA;AACD,sBAAU,MAAG;AACX,MAAI,MAAA,sBAAiB,QAAA,MAAA,6BACnB,SAAQ,SAAQ,aAAc,sBAAK,MAAA,kBAAA;CAEtC,GAAE,CACH,MAAU;sBAEN,MAAA;AACF,MAAA,MAAA,MACE,UAAM,SAAA,aAAqB,SAAA,MAAA,MAAA;;;;;;;;;;;;;AC5EjC,SAAS,SAAA,OAA+C;CAuBxD,MAAM,UAAU,kBAAiB,KAAoB;AACnD,gCAAgB,MAA6B,KAAK,MAAA,UAAA,QAAA,kBAAA,CAClD,OAKA,EAAA;CACA,MAAA,EAAA,UAAiB,QAAI,SAAU,SAAQ,QAAS,OAAS,qBAAS,OAAA,UAAA,SAAA,aAAA,mBAAA,gBAAA,OAAA,UAAA,GAAA,YAAA,GAAA;AAClE,WAAA,SAAA;EACA;EAKF;EAAC;EAOO;;;;;;;;;;;;;;;;;;;;;;;;AClDR,MAAY,2BAAuB,cAAA,WAAmB,CAAqC,OAAM,QAAO;CAgBxG,MAAO,UAAM,kBAAW,KAAM;CAC5B,MAAM,EAAA,OAAO,UAAwC,UAAK,GAAA,MAAA,GAAA;AAC1D,gCAAa,KAAS,MAAA,UAAc,QAAK,kBAAQ,CACjD,OAMA,EAAA;sBACM,MAAA;MACF,QAAQ,WAAQ,iBAClB,SAAA,QAAA,QAAA;CAGF,GAAA,CAKA,OAOM"}
1
+ {"version":3,"file":"index.umd.js","names":[],"sources":["../lib/JBOptionList.tsx","../lib/events-hook.ts","../lib/attributes-hook.ts","../lib/JBSelect.tsx","../lib/JBOption.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAY,+BAAuB,cAAA,WAAqB,CAAA,OAAM,QAAO;CAkBrE,MAAO,UAAM,kBAAY,KAAG;AAC1B,gCAAgB,KAAkD,MAAK,UAAA,QAAA,kBAAA,CACvE,OAKA,EAAA;sBACM,MAAA;MACF,QAAQ,WAAQ,MAAA,QAAa,MAAM,WAAU,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,aAAA;WAI3B,WACF,OACD,EAAA;AACD,sBAAU,MAAG;AACX,MAAI,MAAM,gBAAO,QAAA,MAAA,uBACf,SAAO,SAAS,aAAc,eAAe,MAAM,YAAC;WAEpD,aACF,OACD,EAAA;AACD,sBAAU,MAAG;AACX,MAAI,MAAA,sBAAiB,QAAA,MAAA,6BACnB,SAAQ,SAAQ,aAAc,sBAAK,MAAA,kBAAA;CAEtC,GAAE,CACH,MAAU;sBAEN,MAAA;AACF,MAAA,MAAA,MACE,UAAM,SAAA,aAAqB,SAAA,MAAA,MAAA;;;;;;;;;;;;;AC5EjC,SAAS,SAAA,OAA+C;CAuBxD,MAAM,UAAU,kBAAiB,KAAoB;AACnD,gCAAgB,MAA6B,KAAK,MAAA,UAAA,QAAA,kBAAA,CAClD,OAKA,EAAA;CACA,MAAA,EAAA,UAAiB,QAAI,SAAU,SAAQ,QAAS,OAAS,qBAAS,OAAA,UAAA,SAAA,aAAA,mBAAA,gBAAA,OAAA,UAAA,GAAA,YAAA,GAAA;AAClE,WAAA,SAAA;EACA;EAKF;EAAC;EAQO;;;;;;;;;;;;;;;;;;;;;;;;AC9CR,SAAgB,SAAkB,OAA4B;CAC5D,MAAM,UAAU,kBAAqC,KAAK;CAE1D,MAAM,EAAC,UAAU,KAAI,UAAW,GAAG,MAAK,GAAG;AAC3C,gCACE,KACA,MAAG,QAAI,mBAAiB,CAI1B,OAKF,EAAA;AAAC,wBAAA,cAAA,cAAA,aAAA;EAQO,OAAC"}
@@ -0,0 +1,11 @@
1
+ import type { JBOptionWebComponent } from "jb-select";
2
+ declare module "react" {
3
+ namespace JSX {
4
+ interface IntrinsicElements {
5
+ 'jb-option': JBOptionType;
6
+ }
7
+ interface JBOptionType extends React.DetailedHTMLProps<React.HTMLAttributes<JBOptionWebComponent<any>>, JBOptionWebComponent<any>> {
8
+ class?: string;
9
+ }
10
+ }
11
+ }
@@ -1,45 +1,30 @@
1
1
  'use client'
2
- /* eslint-disable react/display-name */
3
- import React, { useEffect, useRef, useImperativeHandle, PropsWithChildren, ComponentProps } from 'react';
2
+ import React, { useEffect, useRef, useImperativeHandle, PropsWithChildren, ComponentProps, type RefObject } from 'react';
4
3
  import { JBOptionWebComponent } from 'jb-select';
5
- //TODO: make it generic when remove forward ref
6
- type TValue = any;
4
+ import './module-declaration.js';
7
5
 
8
- declare module "react" {
9
- // eslint-disable-next-line @typescript-eslint/no-namespace
10
- namespace JSX {
11
- interface IntrinsicElements {
12
- 'jb-option': JBOptionType;
13
- }
14
- interface JBOptionType extends React.DetailedHTMLProps<React.HTMLAttributes<JBOptionWebComponent<TValue>>, JBOptionWebComponent<TValue>> {
15
- class?: string,
16
- }
17
- }
18
- }
19
- export const JBOption = React.forwardRef((props: JBOptionProps<TValue>, ref) => {
6
+
7
+
8
+ export function JBOption<TValue> (props: JBOptionProps<TValue>){
20
9
  const element = useRef<JBOptionWebComponent<TValue>>(null);
21
- const {value,children,className, ...rest} = props;
10
+ // value is inside ...rest
11
+ const {children, ref,className, ...rest} = props;
22
12
  useImperativeHandle(
23
13
  ref,
24
- () => (element ? element.current : undefined),
14
+ () => (element.current??undefined),
25
15
  [element],
26
16
  );
27
-
28
- useEffect(() => {
29
- if (element.current && value !== undefined) {
30
- element.current.value = value;
31
- }
32
- }, [value, element]);
33
17
 
34
18
  return (
35
19
  <jb-option class={className} ref={element} {...rest}>
36
20
  {children}
37
21
  </jb-option>
38
22
  );
39
- });
23
+ };
40
24
 
41
25
  type Props<TValue> = {
42
- value:TValue
26
+ value:TValue,
27
+ ref?: React.ForwardedRef<JBOptionWebComponent<TValue> | undefined>
43
28
  }
44
29
 
45
30
  export type JBOptionProps<TValue> = PropsWithChildren<React.JSX.JBOptionType & Props<TValue>>
@@ -49,5 +49,6 @@ export type Props<TValue> = PropsWithChildren<EventProps & JBSelectAttributes<TV
49
49
  ref?: React.RefObject<JBSelectWebComponent>,
50
50
  size?: SizeVariants,
51
51
  name?: string,
52
+ disabled?:boolean,
52
53
  }
53
54
  JBSelect.displayName = 'JBSelect';
@@ -0,0 +1,12 @@
1
+ import type { JBOptionWebComponent } from "jb-select";
2
+
3
+ declare module "react" {
4
+ namespace JSX {
5
+ interface IntrinsicElements {
6
+ 'jb-option': JBOptionType;
7
+ }
8
+ interface JBOptionType extends React.DetailedHTMLProps<React.HTMLAttributes<JBOptionWebComponent<any>>, JBOptionWebComponent<any>> {
9
+ class?: string,
10
+ }
11
+ }
12
+ }