jb-select 7.1.0 → 7.1.2

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.
Files changed (46) hide show
  1. package/dist/index.cjs.js +1 -1
  2. package/dist/index.cjs.js.br +0 -0
  3. package/dist/index.cjs.js.gz +0 -0
  4. package/dist/index.cjs.js.map +1 -1
  5. package/dist/index.js +1 -1
  6. package/dist/index.js.br +0 -0
  7. package/dist/index.js.gz +0 -0
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.umd.js +1 -1
  10. package/dist/index.umd.js.br +0 -0
  11. package/dist/index.umd.js.gz +0 -0
  12. package/dist/index.umd.js.map +1 -1
  13. package/dist/jb-option/jb-option.d.ts +2 -2
  14. package/dist/jb-option/jb-option.d.ts.map +1 -1
  15. package/dist/jb-option/types.d.ts +7 -0
  16. package/dist/jb-option/types.d.ts.map +1 -1
  17. package/dist/jb-option-list/jb-option-list.d.ts +1 -1
  18. package/dist/jb-option-list/jb-option-list.d.ts.map +1 -1
  19. package/dist/jb-select.d.ts +6 -5
  20. package/dist/jb-select.d.ts.map +1 -1
  21. package/dist/types.d.ts +1 -1
  22. package/dist/types.d.ts.map +1 -1
  23. package/lib/jb-option/jb-option.ts +7 -7
  24. package/lib/jb-option/types.ts +8 -0
  25. package/lib/jb-option-list/jb-option-list.ts +5 -3
  26. package/lib/jb-select.ts +41 -35
  27. package/lib/types.ts +1 -1
  28. package/lib/variables.css +1 -1
  29. package/package.json +3 -3
  30. package/react/dist/JBOption.d.ts +5 -11
  31. package/react/dist/JBSelect.d.ts +2 -21
  32. package/react/dist/attributes-hook.d.ts +1 -1
  33. package/react/dist/events-hook.d.ts +1 -1
  34. package/react/dist/index.cjs.js +1 -1
  35. package/react/dist/index.cjs.js.map +1 -1
  36. package/react/dist/index.js +1 -1
  37. package/react/dist/index.js.map +1 -1
  38. package/react/dist/index.umd.js +1 -1
  39. package/react/dist/index.umd.js.map +1 -1
  40. package/react/dist/module-declaration.d.ts +22 -0
  41. package/react/lib/JBOption.tsx +12 -26
  42. package/react/lib/JBSelect.tsx +6 -24
  43. package/react/lib/attributes-hook.ts +1 -1
  44. package/react/lib/events-hook.ts +1 -1
  45. package/react/lib/module-declaration.ts +23 -0
  46. package/react/tsconfig.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { JBOptionWebComponent } from "../jb-option/jb-option";
2
- import { type OptionListCallbacks } from "./types";
2
+ import type { OptionListCallbacks } from "./types";
3
3
 
4
4
  //TOption is the type of option, TValue is the type of value we extract from option
5
5
  export class JBOptionListWebComponent<TOption, TValue> extends HTMLElement {
@@ -62,10 +62,10 @@ export class JBOptionListWebComponent<TOption, TValue> extends HTMLElement {
62
62
  }
63
63
  //
64
64
  #initOptionList(optionList: TOption[]) {
65
- this.shadowRoot.innerHTML = "";
65
+ this.shadowRoot!.innerHTML = "";
66
66
  optionList.forEach((option) => {
67
67
  const dom = this.#createOptionDOM(option);
68
- this.shadowRoot.appendChild(dom);
68
+ this.shadowRoot!.appendChild(dom);
69
69
  this.#optionPairMap.set(option, dom);
70
70
  });
71
71
  }
@@ -85,6 +85,8 @@ export class JBOptionListWebComponent<TOption, TValue> extends HTMLElement {
85
85
  option
86
86
  );
87
87
  }
88
+ // just to quite typescript
89
+ return undefined as unknown as TValue;
88
90
  }
89
91
  #getOptionTitle(option: TOption): string {
90
92
  if (typeof this.#callbacks.getTitle == "function") {
package/lib/jb-select.ts CHANGED
@@ -26,29 +26,29 @@ import { JBPopoverWebComponent } from "jb-popover";
26
26
  */
27
27
 
28
28
  // biome-ignore lint/suspicious/noExplicitAny: <we support any type of value and there is no limitation on value type>
29
- 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> {
30
30
  static get formAssociated() {
31
31
  return true;
32
32
  }
33
33
  // we keep selected option here by option but we return TValue when user demand
34
- #value: TValue| null;
34
+ #value: TValue | null = null;
35
35
  #textValue = "";
36
36
  // if user set value and current option list is not contain the option.
37
37
  // we hold it in _notFoundedValue and select value when option value get updated
38
- #notFoundedValue: TValue = null;
38
+ #notFoundedValue: TValue | null = null;
39
39
  #optionList = new Set<JBOptionWebComponent<TValue>>()
40
40
  //keep selected option dom
41
41
  #selectedOption: JBOptionWebComponent<TValue> | null = null;
42
42
  callbacks: JBSelectCallbacks<TValue> = {}
43
43
  elements!: JBSelectElements;
44
- get value(): TValue {
44
+ get value() {
45
45
  if (this.#value !== null && this.#value !== undefined) {
46
46
  return this.#value;
47
47
  } else {
48
48
  return null;
49
49
  }
50
50
  }
51
- set value(value: TValue | null | undefined) {
51
+ set value(value: TValue | null) {
52
52
  this.#setValueFromOutside(value);
53
53
  }
54
54
  get textValue() {
@@ -61,11 +61,14 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
61
61
  }
62
62
  get selectedOptionTitle() {
63
63
  if (this.value) {
64
- return this.#selectedOption.optionContentText;
64
+ return this.#selectedOption?.optionContentText;
65
65
  } else {
66
66
  return "";
67
67
  }
68
68
  }
69
+ get form() {
70
+ return this.#internals.form;
71
+ }
69
72
  #placeholder = "";
70
73
  get placeholder() {
71
74
  return this.#placeholder;
@@ -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,7 +481,7 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
478
481
  }
479
482
  }
480
483
  focus() {
481
- if(this.#disabled){
484
+ if (this.#disabled) {
482
485
  return;
483
486
  }
484
487
  this.elements.input.focus();
@@ -516,7 +519,7 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
516
519
  const event = new CustomEvent("filter-change", { detail: { filterText }, bubbles: false, cancelable: false, composed: false });
517
520
  this.dispatchEvent(event);
518
521
  }
519
- #onOptionSelect(e: CustomEvent) {
522
+ #onOptionSelect(e: Event) {
520
523
  const prevValue = this.#value;
521
524
  const prevOption = this.#selectedOption;
522
525
  //because jb-option may be in another shadow dom like jb-option-list we have to get first composed element as a target
@@ -528,7 +531,7 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
528
531
  const dispatchedEvent = this.#dispatchOnChangeEvent();
529
532
  if (dispatchedEvent.defaultPrevented) {
530
533
  e.preventDefault();
531
- this.#selectOption(prevValue, prevOption);
534
+ this.#selectOption(prevValue, prevOption!);
532
535
  }
533
536
  }
534
537
 
@@ -540,7 +543,7 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
540
543
  target.addEventListener("jb-option-disconnected", this.#onOptionDisconnected.bind(this), { once: true, passive: true });
541
544
  target.setSelectElement(this);
542
545
  this.#optionList.add(target);
543
- if (this.#notFoundedValue) {
546
+ if (this.#notFoundedValue !== null) {
544
547
  this.#setValueOnOptionListChanged();
545
548
  }
546
549
  this.#updateListEmptyPlaceholder();
@@ -555,7 +558,7 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
555
558
  }
556
559
  }
557
560
 
558
- #selectOption(value: TValue, optionDom: JBOptionWebComponent<TValue>) {
561
+ #selectOption(value: TValue | null, optionDom: JBOptionWebComponent<TValue>) {
559
562
  this.#setValue(value, optionDom);
560
563
  this.#checkValidity(true);
561
564
  }
@@ -566,18 +569,21 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
566
569
  showValidationError(error: ShowValidationErrorParameters | string) {
567
570
  const message = typeof error == "string" ? error : error.message;
568
571
  this.elements.messageBox.innerHTML = message;
569
- this.elements.messageBox.classList.add("--error");
572
+ //invalid state is used for ui purpose
573
+ this.#internals.states?.add("invalid");
574
+ this.#internals.ariaInvalid = "true"
570
575
  }
571
576
  clearValidationError() {
572
577
  this.elements.messageBox.innerHTML = this.getAttribute("message") || "";
573
- this.elements.messageBox.classList.remove("--error");
578
+ this.#internals.states?.delete("invalid");
579
+ this.#internals.ariaInvalid = "false"
574
580
  }
575
581
  #dispatchOnChangeEvent() {
576
582
  const event = new Event("change", { bubbles: true, cancelable: true });
577
583
  this.dispatchEvent(event);
578
584
  return event;
579
585
  }
580
- #setSelectedOptionDom(value: TValue) {
586
+ #setSelectedOptionDom(value: TValue | null) {
581
587
  //when user select option or value changed in any condition we set selected option DOM
582
588
  this.elements.selectedValueWrapper.innerHTML = "";
583
589
  //if value was null or undefined it remain empty
@@ -606,10 +612,10 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
606
612
  }
607
613
  #getInsideValidation() {
608
614
  const validationList: ValidationItem<ValidationValue<TValue>>[] = [];
609
- if (this.getAttribute("error") !== null && this.getAttribute("error").trim().length > 0) {
615
+ if (this.getAttribute("error") !== null && (this.getAttribute("error") ?? "").trim().length > 0) {
610
616
  validationList.push({
611
617
  validator: undefined,
612
- message: this.getAttribute("error"),
618
+ message: this.getAttribute("error")!,
613
619
  stateType: "customError"
614
620
  });
615
621
  }
@@ -673,7 +679,7 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
673
679
  } else {
674
680
  states["customError"] = true;
675
681
  }
676
- if (message == '') { message = res.message; }
682
+ if (message == '') { message = res.message ?? ""; }
677
683
 
678
684
  }
679
685
  });
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
@@ -31,7 +31,7 @@
31
31
  }
32
32
 
33
33
  :host(:state(invalid)) {
34
- --message-color: var(--jb-select-message-error-color, var(--jb-red));
34
+ --message-color: var(--jb-select-message-color-error, var(--jb-red));
35
35
  }
36
36
  :host(:state(disabled)) {
37
37
  cursor: not-allowed;
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "web component",
17
17
  "react component"
18
18
  ],
19
- "version": "7.1.0",
19
+ "version": "7.1.2",
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,9 +38,9 @@
38
38
  "jb-validation": ">=0.4.0",
39
39
  "jb-button": ">=3.9.1",
40
40
  "jb-popover": ">=1.6.1",
41
- "jb-core":">=0.25.0"
41
+ "jb-core":">=0.26.0"
42
42
  },
43
43
  "devDependencies": {
44
- "jb-form":">=0.9.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 {};
@@ -4,32 +4,13 @@ import type { JBSelectWebComponent, SizeVariants } from 'jb-select';
4
4
  import { type EventProps } from './events-hook.js';
5
5
  import { type JBSelectAttributes } from './attributes-hook.js';
6
6
  import type { JBElementStandardProps } from 'jb-core/react';
7
+ import './module-declaration.js';
7
8
  export type JBSelectEventType<T> = T & {
8
9
  target: JBSelectWebComponent;
9
10
  };
10
- declare module "react" {
11
- namespace JSX {
12
- interface IntrinsicElements {
13
- 'jb-select': JBSelectType;
14
- }
15
- interface JBSelectType extends React.DetailedHTMLProps<React.HTMLAttributes<JBSelectWebComponent>, JBSelectWebComponent> {
16
- class?: string;
17
- label?: string;
18
- name?: string;
19
- required?: string | boolean;
20
- message?: string;
21
- tabindex?: string;
22
- size?: string;
23
- "hide-clean"?: string;
24
- }
25
- }
26
- }
27
11
  export declare function JBSelect<TValue>(props: Props<TValue>): React.JSX.Element;
28
- export declare namespace JBSelect {
29
- var displayName: string;
30
- }
31
12
  export type Props<TValue> = PropsWithChildren<EventProps & JBSelectAttributes<TValue>> & JBElementStandardProps<JBSelectWebComponent, keyof EventProps & JBSelectAttributes<TValue>> & {
32
- ref?: React.RefObject<JBSelectWebComponent>;
13
+ ref?: React.ForwardedRef<JBSelectWebComponent | null | undefined>;
33
14
  size?: SizeVariants;
34
15
  name?: string;
35
16
  disabled?: boolean;
@@ -13,4 +13,4 @@ export type JBSelectAttributes<TValue> = {
13
13
  hideClear?: boolean;
14
14
  getSelectedValueDOM?: (option: any) => HTMLElement;
15
15
  };
16
- export declare function useJBSelectAttribute<TValue>(element: RefObject<JBSelectWebComponent>, props: JBSelectAttributes<TValue>): void;
16
+ export declare function useJBSelectAttribute<TValue>(element: RefObject<JBSelectWebComponent | null>, props: JBSelectAttributes<TValue>): void;
@@ -13,4 +13,4 @@ export type EventProps = {
13
13
  onKeyUp?: (e: JBSelectEventType<KeyboardEvent>) => void;
14
14
  onInput?: (e: JBSelectEventType<InputEvent>) => void;
15
15
  };
16
- export declare function useEvents(element: RefObject<JBSelectWebComponent>, props: EventProps): void;
16
+ export declare function useEvents(element: RefObject<JBSelectWebComponent | null>, props: EventProps): void;
@@ -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,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){let t=(0,o.useRef)(null),{children:r,ref:u,className:l,...n}=e;return(0,o.useImperativeHandle)(u,()=>t.current??void 0,[t]),o.default.createElement("jb-option",{class:l,ref:t,...n},r)}s.displayName="JBOptionList",f.displayName="JBOption",exports.JBOption=f,exports.JBOptionList=s,exports.JBSelect=function(e){var t,r;let u=(0,o.useRef)(null),{onChange:l,onInit:n,onInput:c,onKeyUp:a,onLoad:s,ref:f,error:d,getSelectedValueDOM:p,label:b,required:v,message:g,placeholder:h,searchPlaceholder:m,validationList:E,value:O,hideClear:y,...A}=e;return(0,o.useImperativeHandle)(f,()=>u.current??void 0,[u]),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:d,getSelectedValueDOM:p,label:b,required:v,message:g,placeholder:h,searchPlaceholder:m,validationList:E,value:O,hideClear:y},(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,...A},e.children)};
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,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AAA,YAAA,GAAA;AAClE,WAAA,SAAA;EACA;EAKF;EAAC;EAQO;;;;;;;;;;;;;;;;;;;;;;;;ACnDR,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.cjs.js","names":[],"sources":["../../../../../../../../../../../../Home/NeveshtAfzar/work/Azad/source/design-system/design-system/web-component/jb-select/react/lib/JBOptionList.tsx","../../../../../../../../../../../../Home/NeveshtAfzar/work/Azad/source/design-system/design-system/web-component/jb-select/react/lib/events-hook.ts","../../../../../../../../../../../../Home/NeveshtAfzar/work/Azad/source/design-system/design-system/web-component/jb-select/react/lib/attributes-hook.ts","../../../../../../../../../../../../Home/NeveshtAfzar/work/Azad/source/design-system/design-system/web-component/jb-select/react/lib/JBSelect.tsx","../../../../../../../../../../../../Home/NeveshtAfzar/work/Azad/source/design-system/design-system/web-component/jb-select/react/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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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;;;;;;;;;;;;;AC1EjC,SAAO,SAAA,OAAyB;CAIhC,MAAM,UAAU,kBAAiB,KAAoB;CACnD,MAAM,EAAA,UAAU,QAA6B,SAAK,SAAA,QAAA,KAAA,OAAA,qBAAA,OAAA,UAAA,SAAA,aAAA,mBAAA,gBAAA,OAAA,UAAA,GAAA,YAAA,GAAA;AAClD,gCAAkB,KAAM,MAAE,QAAS,mBAAsB,CACzD,OAKA,EAAA;AACA,WAAA,SAAA;EACA;EAKF;EAAC;;;;;;;;;;;;;;;;;;;;;;;;ACpBD,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,o;let c=l(null),{onChange:a,onInit:s,onInput:d,onKeyUp:p,onLoad:b,ref:g,error:h,getSelectedValueDOM:m,label:v,required:f,message:A,placeholder:O,searchPlaceholder:C,validationList:y,value:L,hideClear:D,...M}=u;return r(g,()=>c.current??void 0,[c]),n(c,"load",(i={onChange:a,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),o={error:h,getSelectedValueDOM:m,label:v,required:f,message:A,placeholder:O,searchPlaceholder:C,validationList:y,value:L,hideClear:D},t(()=>{null!==o.message&&void 0!==o.message?c.current?.setAttribute("message",o.message):c.current?.removeAttribute("message")},[o.message]),t(()=>{c?.current&&(c.current.validation.list=o.validationList||[])},[c.current,o.validationList]),t(()=>{null!==o.label&&void 0!==o.label?c.current?.setAttribute("label",o.label):c.current?.removeAttribute("label")},[o.label,c.current]),t(()=>{null!==o.required&&void 0!==o.required?c.current?.setAttribute("required",""):c.current?.removeAttribute("required")},[o.required,c]),t(()=>{null!==o.hideClear&&void 0!==o.hideClear?c.current?.setAttribute("hide-clear",""):c.current?.removeAttribute("hide-clear")},[o.hideClear,c]),t(()=>{null!==o.placeholder&&void 0!==o.placeholder&&c.current?.setAttribute("placeholder",o.placeholder)},[o.placeholder,c]),t(()=>{null!==o.searchPlaceholder&&void 0!==o.searchPlaceholder&&c.current?.setAttribute("search-placeholder",o.searchPlaceholder)},[o.searchPlaceholder]),t(()=>{o.error?c?.current?.setAttribute("error",o.error):c?.current?.removeAttribute("error")},[o.error]),t(()=>{c.current&&(c.current.value=o.value)},[o.value]),t(()=>{"function"==typeof o.getSelectedValueDOM&&c.current&&c.current&&(c.current.callbacks.getSelectedValueDOM=o.getSelectedValueDOM)},[o.getSelectedValueDOM]),e.createElement("jb-select",{ref:c,...M},u.children)}function o(t){let n=l(null),{children:u,ref:i,className:o,...c}=t;return r(i,()=>n.current??void 0,[n]),e.createElement("jb-option",{class:o,ref:n,...c},u)}u.displayName="JBOptionList",o.displayName="JBOption";export{o 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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AAQ,SAAQ,aAAc,sBAAK,MAAA,kBAAA;CAEtC,GAAE,CACH,MAAU;WAEN,MAAA;AACF,MAAA,MAAA,MACE,UAAM,SAAA,aAAqB,SAAA,MAAA,MAAA;;;;;;;;;;;;;AC5EjC,SAAS,SAAA,OAA+C;CAuBxD,MAAM,UAAU,OAAiB,KAAoB;AACnD,qBAAgB,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;;;;;;;;;;;;;;;;;;;;;;;;ACnDR,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":["../../../../../../../../../../../../Home/NeveshtAfzar/work/Azad/source/design-system/design-system/web-component/jb-select/react/lib/JBOptionList.tsx","../../../../../../../../../../../../Home/NeveshtAfzar/work/Azad/source/design-system/design-system/web-component/jb-select/react/lib/events-hook.ts","../../../../../../../../../../../../Home/NeveshtAfzar/work/Azad/source/design-system/design-system/web-component/jb-select/react/lib/attributes-hook.ts","../../../../../../../../../../../../Home/NeveshtAfzar/work/Azad/source/design-system/design-system/web-component/jb-select/react/lib/JBSelect.tsx","../../../../../../../../../../../../Home/NeveshtAfzar/work/Azad/source/design-system/design-system/web-component/jb-select/react/lib/JBOption.tsx"],"sourcesContent":[],"mappings":";;;;;AAEA,MAAY,+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,GAAA;MAEX,SAAQ,SAAS,gBAAa,WAAc;WAE5C,UACF,OACD,EAAA;AAED,WAAU,MAAG;AACX,MAAI,MAAM,cAAW,QAAS,MAAI,qBAChC,SAAQ,SAAS,aAAa,cAAa,GAAE;MAE7C,SAAM,SAAY,gBAAS,aAAA;WAI3B,WACF,OACD,EAAA;AACD,WAAU,MAAG;AACX,MAAI,MAAM,gBAAO,QAAA,MAAA,uBACf,SAAO,SAAS,aAAc,eAAe,MAAM,YAAC;WAEpD,aACF,OACD,EAAA;AACD,WAAU,MAAG;AACX,MAAI,MAAA,sBAAiB,QAAA,MAAA,6BACnB,SAAQ,SAAQ,aAAc,sBAAK,MAAA,kBAAA;CAEtC,GAAE,CACH,MAAU;WAEN,MAAA;AACF,MAAA,MAAA,MACE,UAAM,SAAA,aAAqB,SAAA,MAAA,MAAA;;;;;;;;;;;;;AC1EjC,SAAO,SAAA,OAAyB;CAIhC,MAAM,UAAU,OAAiB,KAAoB;CACnD,MAAM,EAAA,UAAU,QAA6B,SAAK,SAAA,QAAA,KAAA,OAAA,qBAAA,OAAA,UAAA,SAAA,aAAA,mBAAA,gBAAA,OAAA,UAAA,GAAA,YAAA,GAAA;AAClD,qBAAkB,KAAM,MAAE,QAAS,mBAAsB,CACzD,OAKA,EAAA;AACA,WAAA,SAAA;EACA;EAKF;EAAC;;;;;;;;;;;;;;;;;;;;;;;;ACpBD,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){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="JBOption",e.JBOption=p,e.JBOptionList=d,e.JBSelect=function(e){var r,u;let n=(0,t.useRef)(null),{onChange:c,onInit:a,onInput:o,onKeyUp:i,onLoad:s,ref:f,error:d,getSelectedValueDOM:p,label:b,required:v,message:g,placeholder:h,searchPlaceholder:m,validationList:y,value:E,hideClear:O,...j}=e;return(0,t.useImperativeHandle)(f,()=>n.current??void 0,[n]),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:d,getSelectedValueDOM:p,label:b,required:v,message:g,placeholder:h,searchPlaceholder:m,validationList:y,value:E,hideClear:O},(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,...j},e.children)}},"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,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,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;;;;;;;;;;;;;ACnDR,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":["../../../../../../../../../../../../Home/NeveshtAfzar/work/Azad/source/design-system/design-system/web-component/jb-select/react/lib/JBOptionList.tsx","../../../../../../../../../../../../Home/NeveshtAfzar/work/Azad/source/design-system/design-system/web-component/jb-select/react/lib/events-hook.ts","../../../../../../../../../../../../Home/NeveshtAfzar/work/Azad/source/design-system/design-system/web-component/jb-select/react/lib/attributes-hook.ts","../../../../../../../../../../../../Home/NeveshtAfzar/work/Azad/source/design-system/design-system/web-component/jb-select/react/lib/JBSelect.tsx","../../../../../../../../../../../../Home/NeveshtAfzar/work/Azad/source/design-system/design-system/web-component/jb-select/react/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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BAAK,MAAA,kBAAA;CAEtC,GAAE,CACH,MAAU;sBAEN,MAAA;AACF,MAAA,MAAA,MACE,UAAM,SAAA,aAAqB,SAAA,MAAA,MAAA;;;;;;;;;;;;;AC1EjC,SAAO,SAAA,OAAyB;CAIhC,MAAM,UAAU,kBAAiB,KAAoB;CACnD,MAAM,EAAA,UAAU,QAA6B,SAAK,SAAA,QAAA,KAAA,OAAA,qBAAA,OAAA,UAAA,SAAA,aAAA,mBAAA,gBAAA,OAAA,UAAA,GAAA,YAAA,GAAA;AAClD,gCAAkB,KAAM,MAAE,QAAS,mBAAsB,CACzD,OAKA,EAAA;AACA,WAAA,SAAA;EACA;EAKF;EAAC;;;;;;;;;;;;;;;;;;;;;;;;ACpBD,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,22 @@
1
+ import type { JBOptionWebComponent, JBSelectWebComponent } from "jb-select";
2
+ declare module "react" {
3
+ namespace JSX {
4
+ interface IntrinsicElements {
5
+ 'jb-option': JBOptionType;
6
+ 'jb-select': JBSelectType;
7
+ }
8
+ interface JBOptionType extends React.DetailedHTMLProps<React.HTMLAttributes<JBOptionWebComponent<any>>, JBOptionWebComponent<any>> {
9
+ class?: string;
10
+ }
11
+ interface JBSelectType extends React.DetailedHTMLProps<React.HTMLAttributes<JBSelectWebComponent>, JBSelectWebComponent> {
12
+ class?: string;
13
+ label?: string;
14
+ name?: string;
15
+ required?: string | boolean;
16
+ message?: string;
17
+ tabindex?: string;
18
+ size?: string;
19
+ "hide-clean"?: string;
20
+ }
21
+ }
22
+ }
@@ -1,45 +1,31 @@
1
1
  'use client'
2
- /* eslint-disable react/display-name */
3
- import React, { useEffect, useRef, useImperativeHandle, PropsWithChildren, ComponentProps } from 'react';
2
+ // biome-ignore lint/style/useImportType: <explanation>
3
+ import React, { useRef, useImperativeHandle, PropsWithChildren } from 'react';
4
4
  import { JBOptionWebComponent } from 'jb-select';
5
- //TODO: make it generic when remove forward ref
6
- type TValue = any;
5
+ import './module-declaration.js';
7
6
 
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) => {
7
+
8
+
9
+ export function JBOption<TValue> (props: JBOptionProps<TValue>){
20
10
  const element = useRef<JBOptionWebComponent<TValue>>(null);
21
- const {value,children,className, ...rest} = props;
11
+ // value is inside ...rest
12
+ const {children, ref,className, ...rest} = props;
22
13
  useImperativeHandle(
23
14
  ref,
24
- () => (element ? element.current : undefined),
15
+ () => (element.current??undefined),
25
16
  [element],
26
17
  );
27
-
28
- useEffect(() => {
29
- if (element.current && value !== undefined) {
30
- element.current.value = value;
31
- }
32
- }, [value, element]);
33
18
 
34
19
  return (
35
20
  <jb-option class={className} ref={element} {...rest}>
36
21
  {children}
37
22
  </jb-option>
38
23
  );
39
- });
24
+ };
40
25
 
41
26
  type Props<TValue> = {
42
- value:TValue
27
+ value:TValue,
28
+ ref?: React.ForwardedRef<JBOptionWebComponent<TValue> | undefined>
43
29
  }
44
30
 
45
31
  export type JBOptionProps<TValue> = PropsWithChildren<React.JSX.JBOptionType & Props<TValue>>