jb-select 7.3.1 → 7.3.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.
- package/README.md +435 -293
- package/custom-elements.json +515 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.br +0 -0
- package/dist/index.cjs.js.gz +0 -0
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.br +0 -0
- package/dist/index.umd.js.gz +0 -0
- package/dist/index.umd.js.map +1 -1
- package/dist/jb-select.d.ts.map +1 -1
- package/lib/jb-option/README.md +32 -0
- package/lib/jb-select.css +2 -2
- package/lib/jb-select.ts +19 -12
- package/package.json +5 -3
- package/react/README.md +64 -11
- package/react/dist/index.cjs.js.map +1 -1
- package/react/dist/index.js.map +1 -1
- package/react/dist/index.umd.js.map +1 -1
package/lib/jb-select.ts
CHANGED
|
@@ -457,7 +457,7 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
|
|
|
457
457
|
#setSelectedOption(options: JBOptionWebComponent<TValue>[]): void
|
|
458
458
|
#setSelectedOption(option: JBOptionWebComponent<TValue> | null): void
|
|
459
459
|
#setSelectedOption(option: JBOptionWebComponent<TValue>[] | JBOptionWebComponent<TValue> | null): void {
|
|
460
|
-
if (option)
|
|
460
|
+
if (option) {
|
|
461
461
|
if (this.multiple) {
|
|
462
462
|
const selectOption = (op: JBOptionWebComponent<TValue>) => {
|
|
463
463
|
op.selected = true;
|
|
@@ -467,10 +467,17 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
|
|
|
467
467
|
} else {
|
|
468
468
|
// single select
|
|
469
469
|
if (Array.isArray(option)) return;
|
|
470
|
-
this.#
|
|
470
|
+
this.#deSelectAllOptions();
|
|
471
471
|
option.selected = true;
|
|
472
472
|
this.#selectedOption = option;
|
|
473
473
|
}
|
|
474
|
+
}else if(option === null){
|
|
475
|
+
// we only call with null when value set null and all option must deselect.
|
|
476
|
+
this.#deSelectAllOptions();
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
#deSelectAllOptions(){
|
|
480
|
+
this.#optionList.forEach((x) => { x.selected = false });
|
|
474
481
|
}
|
|
475
482
|
#setValue(value: null, option: null): void
|
|
476
483
|
#setValue(value: TValue, option: JBOptionWebComponent<TValue>): void
|
|
@@ -479,7 +486,7 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
|
|
|
479
486
|
this.#notFoundedValue = null;
|
|
480
487
|
this.#value = value;
|
|
481
488
|
if (value === null || value === undefined || (Array.isArray(value) && value.length === 0)) {
|
|
482
|
-
if(!this.multiple){this.textValue = "";}
|
|
489
|
+
if (!this.multiple) { this.textValue = ""; }
|
|
483
490
|
this.#updateSelectedOptionDom();
|
|
484
491
|
//will deselect all option
|
|
485
492
|
this.#setSelectedOption(null);
|
|
@@ -489,8 +496,8 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
|
|
|
489
496
|
this.elements.input.placeholder = this.placeholder;
|
|
490
497
|
}
|
|
491
498
|
} else {
|
|
492
|
-
|
|
493
|
-
if(!this.multiple){this.textValue = "";}
|
|
499
|
+
|
|
500
|
+
if (!this.multiple) { this.textValue = ""; }
|
|
494
501
|
//for typescript error
|
|
495
502
|
Array.isArray(option) ? this.#setSelectedOption(option) : this.#setSelectedOption(option);
|
|
496
503
|
this.#updateSelectedOptionDom();
|
|
@@ -501,7 +508,7 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
|
|
|
501
508
|
}
|
|
502
509
|
}
|
|
503
510
|
//if user select an option we rest filter so user see all option again when open a select
|
|
504
|
-
if(!this.multiple){
|
|
511
|
+
if (!this.multiple) {
|
|
505
512
|
this.#updateOptionList("");
|
|
506
513
|
}
|
|
507
514
|
}
|
|
@@ -557,7 +564,7 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
|
|
|
557
564
|
break;
|
|
558
565
|
case "Enter":
|
|
559
566
|
this.#optionList.forEach(x => {
|
|
560
|
-
if (x.active) {x.toggleOption();}
|
|
567
|
+
if (x.active) { x.toggleOption(); }
|
|
561
568
|
})
|
|
562
569
|
break;
|
|
563
570
|
}
|
|
@@ -731,7 +738,7 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
|
|
|
731
738
|
this.#setValueOnOptionListChanged();
|
|
732
739
|
}
|
|
733
740
|
this.#updateListEmptyPlaceholder();
|
|
734
|
-
target.addEventListener("mouseenter",this.#onOptionHover)
|
|
741
|
+
target.addEventListener("mouseenter", this.#onOptionHover)
|
|
735
742
|
}
|
|
736
743
|
#onOptionDisconnected(e: CustomEvent) {
|
|
737
744
|
e.stopPropagation();
|
|
@@ -741,12 +748,12 @@ export class JBSelectWebComponent<TValue = any> extends HTMLElement implements W
|
|
|
741
748
|
if (target.value == this.#value) {
|
|
742
749
|
this.#setValueOnOptionListChanged();
|
|
743
750
|
}
|
|
744
|
-
target.removeEventListener("mouseenter",this.#onOptionHover)
|
|
751
|
+
target.removeEventListener("mouseenter", this.#onOptionHover)
|
|
745
752
|
}
|
|
746
|
-
#onOptionHover = (e:MouseEvent)=>{
|
|
753
|
+
#onOptionHover = (e: MouseEvent) => {
|
|
747
754
|
const target = e.target as JBOptionWebComponent<TValue>;
|
|
748
|
-
if(!target.active){
|
|
749
|
-
this.#optionList.forEach(x=>{x.active = false});
|
|
755
|
+
if (!target.active) {
|
|
756
|
+
this.#optionList.forEach(x => { x.active = false });
|
|
750
757
|
}
|
|
751
758
|
target.active = true;
|
|
752
759
|
}
|
package/package.json
CHANGED
|
@@ -16,13 +16,14 @@
|
|
|
16
16
|
"web component",
|
|
17
17
|
"react component"
|
|
18
18
|
],
|
|
19
|
-
"version": "7.3.
|
|
19
|
+
"version": "7.3.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",
|
|
23
23
|
"files": [
|
|
24
24
|
"LICENSE",
|
|
25
25
|
"README.md",
|
|
26
|
+
"custom-elements.json",
|
|
26
27
|
"lib/",
|
|
27
28
|
"dist/",
|
|
28
29
|
"react/",
|
|
@@ -30,6 +31,7 @@
|
|
|
30
31
|
],
|
|
31
32
|
"types": "./dist/index.d.ts",
|
|
32
33
|
"main": "index.js",
|
|
34
|
+
"customElements": "custom-elements.json",
|
|
33
35
|
"repository": {
|
|
34
36
|
"type": "git",
|
|
35
37
|
"url": "git@github.com:javadbat/jb-select.git"
|
|
@@ -38,9 +40,9 @@
|
|
|
38
40
|
"jb-validation": ">=0.4.0",
|
|
39
41
|
"jb-button": ">=3.9.1",
|
|
40
42
|
"jb-popover": ">=1.12.0",
|
|
41
|
-
"jb-core":">=0.
|
|
43
|
+
"jb-core":">=0.28.0"
|
|
42
44
|
},
|
|
43
45
|
"devDependencies": {
|
|
44
46
|
"jb-form":">=0.11.0"
|
|
45
47
|
}
|
|
46
|
-
}
|
|
48
|
+
}
|
package/react/README.md
CHANGED
|
@@ -1,25 +1,64 @@
|
|
|
1
1
|
# jb-select-react
|
|
2
2
|
|
|
3
|
+
[](https://www.webcomponents.org/element/jb-select)
|
|
4
|
+
[](https://raw.githubusercontent.com/javadbat/jb-select/main/LICENSE)
|
|
5
|
+
[](https://www.npmjs.com/package/jb-select-react)
|
|
6
|
+

|
|
7
|
+
|
|
3
8
|
select component for react
|
|
4
9
|
|
|
5
10
|
> this component is a react wrapper for [jb-select](https://github.com/javadbat/jb-select)
|
|
6
11
|
|
|
7
|
-
Demo
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
Demo: [codeSandbox preview](https://3f63dj.csb.app/samples/jb-select) for just see the demo and [codeSandbox editor](https://codesandbox.io/p/sandbox/jb-design-system-3f63dj?file=%2Fsrc%2Fsamples%2FJBSelect.tsx) if you want to see and play with code
|
|
13
|
+
|
|
14
|
+
Storybook: [JBSelect docs](https://javadbat.github.io/design-system/?path=/story/components-form-elements-jbselect)
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
11
17
|
```sh
|
|
12
18
|
npm install jb-select
|
|
13
19
|
```
|
|
14
20
|
|
|
15
|
-
##
|
|
16
|
-
|
|
21
|
+
## Usage
|
|
17
22
|
use below syntax in your render function.
|
|
18
23
|
```jsx
|
|
19
24
|
import {JBSelect} from 'jb-select/react';
|
|
20
25
|
|
|
21
|
-
<JBSelect></JBSelect>
|
|
22
|
-
```
|
|
26
|
+
<JBSelect></JBSelect>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## When to use
|
|
30
|
+
|
|
31
|
+
Use `JBSelect` when the user must choose one or more values from a known option list and you need search, validation, custom option content, mobile-friendly popover behavior, or form association.
|
|
32
|
+
|
|
33
|
+
## Props
|
|
34
|
+
|
|
35
|
+
| prop | type | description |
|
|
36
|
+
| --- | --- | --- |
|
|
37
|
+
| `value` | `TValue` | Controlled selected value. In multiple mode, pass an array. |
|
|
38
|
+
| `label` | `string` | Visible label text and accessible label. |
|
|
39
|
+
| `message` | `string` | Helper text shown when no validation error is visible. |
|
|
40
|
+
| `placeholder` | `string` | Placeholder when no value is selected. |
|
|
41
|
+
| `searchPlaceholder` | `string` | Placeholder used by the mobile search input. |
|
|
42
|
+
| `required` | `boolean` | Enables required validation. |
|
|
43
|
+
| `error` | `string` | External validation error message. |
|
|
44
|
+
| `validationList` | `ValidationItem<ValidationValue<TValue>>[]` | Custom validation rules from `jb-validation`. |
|
|
45
|
+
| `hideClear` | `boolean` | Hides the clear button. |
|
|
46
|
+
| `getSelectedValueDOM` | `(option: any) => HTMLElement` | Custom selected value renderer. |
|
|
47
|
+
| `multiple` | `boolean` | Enables multiple selection. See the [multiple selection guide](https://javadbat.github.io/design-system/?path=/docs/components-form-elements-jbselect-multiple-selection--docs). |
|
|
48
|
+
| `size` | `'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl'` | Visual size variant. |
|
|
49
|
+
| `name` | `string` | Form field name. |
|
|
50
|
+
| `disabled` | `boolean` | Disables the select. |
|
|
51
|
+
| `popoverPosition` | `'fixed' \| 'absolute'` | Controls popover positioning. |
|
|
52
|
+
|
|
53
|
+
## Events
|
|
54
|
+
|
|
55
|
+
| prop | event |
|
|
56
|
+
| --- | --- |
|
|
57
|
+
| `onChange` | `change` |
|
|
58
|
+
| `onInput` | `input` |
|
|
59
|
+
| `onKeyUp` | `keyup` |
|
|
60
|
+
| `onLoad` | `load` |
|
|
61
|
+
| `onInit` | `init` |
|
|
23
62
|
|
|
24
63
|
## label
|
|
25
64
|
use label property to describe your select component.
|
|
@@ -28,8 +67,10 @@ use label property to describe your select component.
|
|
|
28
67
|
<JBSelect label='your label name' ></JBSelect>
|
|
29
68
|
```
|
|
30
69
|
|
|
31
|
-
## option list
|
|
32
|
-
if you want to add option to jb-select, you have 2 way:
|
|
70
|
+
## option list
|
|
71
|
+
if you want to add option to jb-select, you have 2 way:
|
|
72
|
+
|
|
73
|
+
For help choosing between `JBOption` and `JBOptionList`, see the [options guide](https://javadbat.github.io/design-system/?path=/docs/components-form-elements-jbselect-options--docs).
|
|
33
74
|
|
|
34
75
|
- use `<JBOption>`
|
|
35
76
|
- use `<jbOptionList>`
|
|
@@ -149,4 +190,16 @@ you can also set `error` attribute to pass error directly to the component
|
|
|
149
190
|
|
|
150
191
|
## set custom style
|
|
151
192
|
|
|
152
|
-
please read [jb-select](https://github.com/javadbat/jb-select) custom style section.
|
|
193
|
+
please read [jb-select](https://github.com/javadbat/jb-select) custom style section.
|
|
194
|
+
|
|
195
|
+
## Shared Documentation
|
|
196
|
+
|
|
197
|
+
For web-component behavior, events, slots, and CSS variables, see [`jb-select`](https://github.com/javadbat/jb-select).
|
|
198
|
+
|
|
199
|
+
## AI agent notes
|
|
200
|
+
|
|
201
|
+
- Import `JBSelect`, `JBOption`, and `JBOptionList` from `jb-select/react`.
|
|
202
|
+
- Use `JBOption` for static JSX options and `JBOptionList` for array-driven options.
|
|
203
|
+
- Use `searchPlaceholder`, `hideClear`, and `getSelectedValueDOM` in React; the wrapper maps them to the underlying web-component API.
|
|
204
|
+
- Use `multiple` when `value` should be an array.
|
|
205
|
+
- Use `error` for externally controlled validation errors.
|
|
@@ -1 +1 @@
|
|
|
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;sBAEI,MAAA;AACF,MAAA,QAAA,kBAAA,MAAA,YAAA,WACE,SAAM,QAAa,YAAW,YAAA,MAAA,SAAA;CAKlC,GAAA,CAQF,MAAa;;;;;;;;;;AC1Cb,SAAgB,UAAU,SAA+C,OAAiB;AACxF,6BAAS,SAA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;;;;;;;;;;;;;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;AAElD,gCAAA,KAAA,MAAA,QAAA,mBAAA,CACA,OAKA,EAAA;AACA,WAAA,SAAA;EACA;EAKF;EAAC;;;;;;;;;;;;;;;;;;;;;;;;ACrBD,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
|
+
{"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":["'use client'\r\n/* eslint-disable react/display-name */\r\nimport React, { useEffect, useRef, useImperativeHandle } from 'react';\r\n// eslint-disable-next-line no-duplicate-imports\r\nimport { JBOptionListWebComponent } from 'jb-select';\r\ntype TOption = any;\r\ntype TValue = any;\r\n\r\ndeclare module \"react\" {\r\n // eslint-disable-next-line @typescript-eslint/no-namespace\r\n namespace JSX {\r\n interface IntrinsicElements {\r\n 'jb-option-list': JBOptionListType;\r\n }\r\n interface JBOptionListType extends React.DetailedHTMLProps<React.HTMLAttributes<JBOptionListWebComponent<TOption, TValue>>, JBOptionListWebComponent<TOption, TValue>> {\r\n class?: string,\r\n // ref:React.RefObject<JBDateInputWebComponent>,\r\n }\r\n }\r\n}\r\nexport const JBOptionList = React.forwardRef((props: JBOptionListProps<TOption,TValue>, ref) => {\r\n const element = useRef<JBOptionListWebComponent<TOption, TValue>>(null);\r\n useImperativeHandle(\r\n ref,\r\n () => (element ? element.current : undefined),\r\n [element],\r\n );\r\n useEffect(() => {\r\n if (element.current && Array.isArray(props.optionList)) {\r\n element.current.optionList = props.optionList;\r\n }\r\n }, [props.optionList, element]);\r\n useEffect(() => {\r\n if (element.current && typeof props.getTitle == \"function\") {\r\n element.current.setCallback(\"getTitle\",props.getTitle);\r\n }\r\n }, [props.getTitle, element]);\r\n useEffect(() => {\r\n if (element.current && typeof props.getValue == \"function\") {\r\n element.current.setCallback(\"getValue\",props.getValue);\r\n }\r\n }, [props.getValue, element]);\r\n useEffect(() => {\r\n if (element.current && typeof props.getContentDOM == \"function\") {\r\n element.current.setCallback(\"getContentDOM\",props.getContentDOM);\r\n }\r\n }, [props.getContentDOM, element]);\r\n return (\r\n <jb-option-list ref={element}>\r\n </jb-option-list>\r\n );\r\n});\r\n\r\nexport type JBOptionListProps<TOption,TValue> = {\r\n optionList: TOption[],\r\n getTitle?: (option: TOption) => string,\r\n getValue?: (option: TOption) => TValue,\r\n getContentDOM?: (option: TOption) => HTMLElement,\r\n}\r\nJBOptionList.displayName = 'JBOptionList';","import { useEvent } from \"jb-core/react\";\r\nimport type { RefObject } from \"react\";\r\nimport type { JBSelectWebComponent, JBSelectEventType } from 'jb-select';\r\n\r\nexport type EventProps = {\r\n /**\r\n * when component loaded, in most cases component is already loaded before react mount so you dont need this but if you load web-component dynamically with lazy load it will be called after react mount\r\n */\r\n onLoad?: (e: JBSelectEventType<CustomEvent>) => void,\r\n /**\r\n * when all property set and ready to use, in most cases component is already loaded before react mount so you dont need this but if you load web-component dynamically with lazy load it will be called after react mount\r\n */\r\n onInit?: (e: JBSelectEventType<CustomEvent>) => void,\r\n onChange?: (e: JBSelectEventType<Event>) => void,\r\n onKeyUp?: (e: JBSelectEventType<KeyboardEvent>) => void,\r\n onInput?: (e: JBSelectEventType<InputEvent>) => void,\r\n}\r\nexport function useEvents(element: RefObject<JBSelectWebComponent|null>, props: EventProps) {\r\n useEvent(element, 'load', props.onLoad, true);\r\n useEvent(element, 'init', props.onInit, true);\r\n useEvent(element, 'keyup', props.onKeyUp);\r\n useEvent(element, 'change', props.onChange);\r\n useEvent(element, 'input', props.onInput);\r\n}","import type { JBSelectWebComponent, ValidationValue } from \"jb-select\";\r\nimport type { ValidationItem } from \"jb-validation\";\r\nimport { type RefObject, useEffect } from \"react\";\r\n\r\nexport type JBSelectAttributes<TValue> = {\r\n validationList?: ValidationItem<ValidationValue<TValue>>[],\r\n label?: string,\r\n error?: string,\r\n value?: TValue,\r\n message?: string,\r\n placeholder?: string,\r\n searchPlaceholder?: string,\r\n required?: boolean,\r\n hideClear?:boolean,\r\n getSelectedValueDOM?: (option: any) => HTMLElement,\r\n\r\n}\r\nexport function useJBSelectAttribute<TValue>(element: RefObject<JBSelectWebComponent|null>, props: JBSelectAttributes<TValue>) {\r\n useEffect(() => {\r\n if (props.message !== null && props.message !== undefined) {\r\n element.current?.setAttribute(\"message\", props.message);\r\n } else {\r\n element.current?.removeAttribute(\"message\");\r\n }\r\n }, [props.message]);\r\n\r\n useEffect(() => {\r\n if (element?.current) {\r\n element.current.validation.list = props.validationList || [];\r\n }\r\n }, [element.current, props.validationList]);\r\n\r\n useEffect(() => {\r\n if (props.label !== null && props.label !== undefined) {\r\n element.current?.setAttribute(\"label\", props.label);\r\n } else {\r\n element.current?.removeAttribute(\"label\");\r\n }\r\n }, [props.label, element.current]);\r\n\r\n useEffect(() => {\r\n if (props.required !== null && props.required !== undefined) {\r\n element.current?.setAttribute(\"required\", \"\");\r\n } else {\r\n element.current?.removeAttribute(\"required\");\r\n }\r\n }, [props.required, element]);\r\n\r\n useEffect(() => {\r\n if (props.hideClear !== null && props.hideClear !== undefined) {\r\n element.current?.setAttribute(\"hide-clear\", \"\");\r\n } else {\r\n element.current?.removeAttribute(\"hide-clear\");\r\n }\r\n }, [props.hideClear, element]);\r\n\r\n useEffect(() => {\r\n if (props.placeholder !== null && props.placeholder !== undefined) {\r\n element.current?.setAttribute(\"placeholder\", props.placeholder);\r\n }\r\n }, [props.placeholder,element]);\r\n\r\n useEffect(() => {\r\n if (props.searchPlaceholder !== null && props.searchPlaceholder !== undefined) {\r\n element.current?.setAttribute(\"search-placeholder\", props.searchPlaceholder);\r\n }\r\n }, [props.searchPlaceholder]);\r\n useEffect(() => {\r\n if (props.error) {\r\n element?.current?.setAttribute('error', props.error);\r\n } else {\r\n element?.current?.removeAttribute('error');\r\n }\r\n }, [props.error]);\r\n useEffect(() => {\r\n if (element.current) {\r\n element.current.value = props.value;\r\n }\r\n }, [props.value]);\r\n useEffect(() => {\r\n if (typeof props.getSelectedValueDOM == \"function\" && element.current && element.current) {\r\n element.current.callbacks.getSelectedValueDOM = props.getSelectedValueDOM;\r\n }\r\n }, [props.getSelectedValueDOM]);\r\n}","'use client'\r\n/* eslint-disable react/display-name */\r\nimport React, { useRef, useImperativeHandle, type PropsWithChildren } from 'react';\r\nimport 'jb-select';\r\n// eslint-disable-next-line no-duplicate-imports\r\nimport type { JBSelectWebComponent, PopoverPosition, SizeVariants } from 'jb-select';\r\nimport { type EventProps, useEvents } from './events-hook.js';\r\nimport { useJBSelectAttribute, type JBSelectAttributes } from './attributes-hook.js';\r\nimport type { JBElementStandardProps } from 'jb-core/react';\r\nimport './module-declaration.js';\r\nexport type JBSelectEventType<T> = T & {\r\n target: JBSelectWebComponent\r\n}\r\nexport function JBSelect<TValue>(props: Props<TValue>) {\r\n const element = useRef<JBSelectWebComponent>(null);\r\n const { onChange, onInit, onInput, onKeyUp, onLoad, ref, error, getSelectedValueDOM, label, required, message, placeholder, searchPlaceholder, validationList, value, hideClear, ...otherProps } = props;\r\n // biome-ignore lint/correctness/useExhaustiveDependencies: <we need element for merging>\r\n useImperativeHandle(\r\n ref,\r\n () => (element.current??undefined),\r\n [element],\r\n );\r\n useEvents(element, { onChange, onInit, onInput, onKeyUp, onLoad });\r\n useJBSelectAttribute(element, { error, getSelectedValueDOM, label, required, message, placeholder, searchPlaceholder, validationList, value, hideClear });\r\n return (\r\n <jb-select ref={element} {...otherProps}>\r\n {props.children}\r\n </jb-select>\r\n );\r\n};\r\n\r\nexport type Props<TValue> = PropsWithChildren<EventProps & JBSelectAttributes<TValue>> & JBElementStandardProps<JBSelectWebComponent, keyof EventProps & JBSelectAttributes<TValue>> & {\r\n ref?: React.ForwardedRef<JBSelectWebComponent|null|undefined>,\r\n multiple?:boolean\r\n size?: SizeVariants,\r\n name?: string,\r\n disabled?:boolean,\r\n popoverPosition?:PopoverPosition\r\n}","'use client'\r\n// biome-ignore lint/style/useImportType: <explanation>\r\nimport React, { useRef, useImperativeHandle, PropsWithChildren } from 'react';\r\nimport { JBOptionWebComponent } from 'jb-select';\r\nimport './module-declaration.js';\r\n\r\n\r\n\r\nexport function JBOption<TValue> (props: JBOptionProps<TValue>){\r\n const element = useRef<JBOptionWebComponent<TValue>>(null);\r\n // value is inside ...rest\r\n const {children, ref,className, ...rest} = props;\r\n useImperativeHandle(\r\n ref,\r\n () => (element.current??undefined),\r\n [element],\r\n );\r\n\r\n return (\r\n <jb-option class={className} ref={element} {...rest}>\r\n {children}\r\n </jb-option>\r\n );\r\n};\r\n\r\ntype Props<TValue> = {\r\n value:TValue,\r\n ref?: React.ForwardedRef<JBOptionWebComponent<TValue> | undefined>\r\n}\r\n\r\nexport type JBOptionProps<TValue> = PropsWithChildren<React.JSX.JBOptionType & Props<TValue>>\r\nJBOption.displayName = 'JBOption';"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAa,+BAA6B,cAAM,WAAW,CAAC,OAAO,QAAG;CAClE,MAAM,UAAU,kBAAO,KAAK;AAC5B,gCAAoB,KAAK,MAAI,UAAU,QAAQ,kBAAE,CAC7C,OACH,EAAC;AACN,sBAAA,MAAA;AACQ,MAAI,QAAQ,WAAI,MAAA,QAAA,MAAA,WAAA,CACZ,SAAQ,QAAQ,aAAa,MAAM;CAE1C,GAAE,CACC,MAAM,YACT,OACA,EAAC;AACF,sBAAU,MAAI;AACV,MAAI,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;EACf;EACA;EACA;EACA;EACA;CACH,EAAC;AACF,sBAAU,SAAA;EACV;EACI;EACA;EACA;EACA;EACA;EACA;EACJ;EACF;EACF;CACK,EAAC;AACF,wBAAqB,cAAM,cAAc,aAAa;EAClD,KAAK;EACL,GAAG;CACN,GAAE,MAAM,SAAG;AACf;;;;AChCD,SAAgB,SAAS,OAAO;CAChC,MAAA,UAAA,kBAAA,KAAA;CAEA,MAAA,EAAA,UAAA,KAAA,UAAA,GAAA,MAAA,GAAA;AACI,gCAAoB,KAAK,MAAI,QAAQ,mBAAsB,CACvD,OACH,EAAC;AACF,wBAAqB,cAAM,cAAc,aAAM;EAC3C,OAAO;EACP,KAAA;EACA,GAAG;CACN,GAAE,SAAO;AACb;AACD,SAAA,cAAA"}
|
package/react/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,+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;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AO,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;AAElD,qBAAA,KAAA,MAAA,QAAA,mBAAA,CACA,OAKA,EAAA;AACA,WAAA,SAAA;EACA;EAKF;EAAC;;;;;;;;;;;;;;;;;;;;;;;;ACrBD,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
|
+
{"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":["'use client'\r\n/* eslint-disable react/display-name */\r\nimport React, { useEffect, useRef, useImperativeHandle } from 'react';\r\n// eslint-disable-next-line no-duplicate-imports\r\nimport { JBOptionListWebComponent } from 'jb-select';\r\ntype TOption = any;\r\ntype TValue = any;\r\n\r\ndeclare module \"react\" {\r\n // eslint-disable-next-line @typescript-eslint/no-namespace\r\n namespace JSX {\r\n interface IntrinsicElements {\r\n 'jb-option-list': JBOptionListType;\r\n }\r\n interface JBOptionListType extends React.DetailedHTMLProps<React.HTMLAttributes<JBOptionListWebComponent<TOption, TValue>>, JBOptionListWebComponent<TOption, TValue>> {\r\n class?: string,\r\n // ref:React.RefObject<JBDateInputWebComponent>,\r\n }\r\n }\r\n}\r\nexport const JBOptionList = React.forwardRef((props: JBOptionListProps<TOption,TValue>, ref) => {\r\n const element = useRef<JBOptionListWebComponent<TOption, TValue>>(null);\r\n useImperativeHandle(\r\n ref,\r\n () => (element ? element.current : undefined),\r\n [element],\r\n );\r\n useEffect(() => {\r\n if (element.current && Array.isArray(props.optionList)) {\r\n element.current.optionList = props.optionList;\r\n }\r\n }, [props.optionList, element]);\r\n useEffect(() => {\r\n if (element.current && typeof props.getTitle == \"function\") {\r\n element.current.setCallback(\"getTitle\",props.getTitle);\r\n }\r\n }, [props.getTitle, element]);\r\n useEffect(() => {\r\n if (element.current && typeof props.getValue == \"function\") {\r\n element.current.setCallback(\"getValue\",props.getValue);\r\n }\r\n }, [props.getValue, element]);\r\n useEffect(() => {\r\n if (element.current && typeof props.getContentDOM == \"function\") {\r\n element.current.setCallback(\"getContentDOM\",props.getContentDOM);\r\n }\r\n }, [props.getContentDOM, element]);\r\n return (\r\n <jb-option-list ref={element}>\r\n </jb-option-list>\r\n );\r\n});\r\n\r\nexport type JBOptionListProps<TOption,TValue> = {\r\n optionList: TOption[],\r\n getTitle?: (option: TOption) => string,\r\n getValue?: (option: TOption) => TValue,\r\n getContentDOM?: (option: TOption) => HTMLElement,\r\n}\r\nJBOptionList.displayName = 'JBOptionList';","import { useEvent } from \"jb-core/react\";\r\nimport type { RefObject } from \"react\";\r\nimport type { JBSelectWebComponent, JBSelectEventType } from 'jb-select';\r\n\r\nexport type EventProps = {\r\n /**\r\n * when component loaded, in most cases component is already loaded before react mount so you dont need this but if you load web-component dynamically with lazy load it will be called after react mount\r\n */\r\n onLoad?: (e: JBSelectEventType<CustomEvent>) => void,\r\n /**\r\n * when all property set and ready to use, in most cases component is already loaded before react mount so you dont need this but if you load web-component dynamically with lazy load it will be called after react mount\r\n */\r\n onInit?: (e: JBSelectEventType<CustomEvent>) => void,\r\n onChange?: (e: JBSelectEventType<Event>) => void,\r\n onKeyUp?: (e: JBSelectEventType<KeyboardEvent>) => void,\r\n onInput?: (e: JBSelectEventType<InputEvent>) => void,\r\n}\r\nexport function useEvents(element: RefObject<JBSelectWebComponent|null>, props: EventProps) {\r\n useEvent(element, 'load', props.onLoad, true);\r\n useEvent(element, 'init', props.onInit, true);\r\n useEvent(element, 'keyup', props.onKeyUp);\r\n useEvent(element, 'change', props.onChange);\r\n useEvent(element, 'input', props.onInput);\r\n}","import type { JBSelectWebComponent, ValidationValue } from \"jb-select\";\r\nimport type { ValidationItem } from \"jb-validation\";\r\nimport { type RefObject, useEffect } from \"react\";\r\n\r\nexport type JBSelectAttributes<TValue> = {\r\n validationList?: ValidationItem<ValidationValue<TValue>>[],\r\n label?: string,\r\n error?: string,\r\n value?: TValue,\r\n message?: string,\r\n placeholder?: string,\r\n searchPlaceholder?: string,\r\n required?: boolean,\r\n hideClear?:boolean,\r\n getSelectedValueDOM?: (option: any) => HTMLElement,\r\n\r\n}\r\nexport function useJBSelectAttribute<TValue>(element: RefObject<JBSelectWebComponent|null>, props: JBSelectAttributes<TValue>) {\r\n useEffect(() => {\r\n if (props.message !== null && props.message !== undefined) {\r\n element.current?.setAttribute(\"message\", props.message);\r\n } else {\r\n element.current?.removeAttribute(\"message\");\r\n }\r\n }, [props.message]);\r\n\r\n useEffect(() => {\r\n if (element?.current) {\r\n element.current.validation.list = props.validationList || [];\r\n }\r\n }, [element.current, props.validationList]);\r\n\r\n useEffect(() => {\r\n if (props.label !== null && props.label !== undefined) {\r\n element.current?.setAttribute(\"label\", props.label);\r\n } else {\r\n element.current?.removeAttribute(\"label\");\r\n }\r\n }, [props.label, element.current]);\r\n\r\n useEffect(() => {\r\n if (props.required !== null && props.required !== undefined) {\r\n element.current?.setAttribute(\"required\", \"\");\r\n } else {\r\n element.current?.removeAttribute(\"required\");\r\n }\r\n }, [props.required, element]);\r\n\r\n useEffect(() => {\r\n if (props.hideClear !== null && props.hideClear !== undefined) {\r\n element.current?.setAttribute(\"hide-clear\", \"\");\r\n } else {\r\n element.current?.removeAttribute(\"hide-clear\");\r\n }\r\n }, [props.hideClear, element]);\r\n\r\n useEffect(() => {\r\n if (props.placeholder !== null && props.placeholder !== undefined) {\r\n element.current?.setAttribute(\"placeholder\", props.placeholder);\r\n }\r\n }, [props.placeholder,element]);\r\n\r\n useEffect(() => {\r\n if (props.searchPlaceholder !== null && props.searchPlaceholder !== undefined) {\r\n element.current?.setAttribute(\"search-placeholder\", props.searchPlaceholder);\r\n }\r\n }, [props.searchPlaceholder]);\r\n useEffect(() => {\r\n if (props.error) {\r\n element?.current?.setAttribute('error', props.error);\r\n } else {\r\n element?.current?.removeAttribute('error');\r\n }\r\n }, [props.error]);\r\n useEffect(() => {\r\n if (element.current) {\r\n element.current.value = props.value;\r\n }\r\n }, [props.value]);\r\n useEffect(() => {\r\n if (typeof props.getSelectedValueDOM == \"function\" && element.current && element.current) {\r\n element.current.callbacks.getSelectedValueDOM = props.getSelectedValueDOM;\r\n }\r\n }, [props.getSelectedValueDOM]);\r\n}","'use client'\r\n/* eslint-disable react/display-name */\r\nimport React, { useRef, useImperativeHandle, type PropsWithChildren } from 'react';\r\nimport 'jb-select';\r\n// eslint-disable-next-line no-duplicate-imports\r\nimport type { JBSelectWebComponent, PopoverPosition, SizeVariants } from 'jb-select';\r\nimport { type EventProps, useEvents } from './events-hook.js';\r\nimport { useJBSelectAttribute, type JBSelectAttributes } from './attributes-hook.js';\r\nimport type { JBElementStandardProps } from 'jb-core/react';\r\nimport './module-declaration.js';\r\nexport type JBSelectEventType<T> = T & {\r\n target: JBSelectWebComponent\r\n}\r\nexport function JBSelect<TValue>(props: Props<TValue>) {\r\n const element = useRef<JBSelectWebComponent>(null);\r\n const { onChange, onInit, onInput, onKeyUp, onLoad, ref, error, getSelectedValueDOM, label, required, message, placeholder, searchPlaceholder, validationList, value, hideClear, ...otherProps } = props;\r\n // biome-ignore lint/correctness/useExhaustiveDependencies: <we need element for merging>\r\n useImperativeHandle(\r\n ref,\r\n () => (element.current??undefined),\r\n [element],\r\n );\r\n useEvents(element, { onChange, onInit, onInput, onKeyUp, onLoad });\r\n useJBSelectAttribute(element, { error, getSelectedValueDOM, label, required, message, placeholder, searchPlaceholder, validationList, value, hideClear });\r\n return (\r\n <jb-select ref={element} {...otherProps}>\r\n {props.children}\r\n </jb-select>\r\n );\r\n};\r\n\r\nexport type Props<TValue> = PropsWithChildren<EventProps & JBSelectAttributes<TValue>> & JBElementStandardProps<JBSelectWebComponent, keyof EventProps & JBSelectAttributes<TValue>> & {\r\n ref?: React.ForwardedRef<JBSelectWebComponent|null|undefined>,\r\n multiple?:boolean\r\n size?: SizeVariants,\r\n name?: string,\r\n disabled?:boolean,\r\n popoverPosition?:PopoverPosition\r\n}","'use client'\r\n// biome-ignore lint/style/useImportType: <explanation>\r\nimport React, { useRef, useImperativeHandle, PropsWithChildren } from 'react';\r\nimport { JBOptionWebComponent } from 'jb-select';\r\nimport './module-declaration.js';\r\n\r\n\r\n\r\nexport function JBOption<TValue> (props: JBOptionProps<TValue>){\r\n const element = useRef<JBOptionWebComponent<TValue>>(null);\r\n // value is inside ...rest\r\n const {children, ref,className, ...rest} = props;\r\n useImperativeHandle(\r\n ref,\r\n () => (element.current??undefined),\r\n [element],\r\n );\r\n\r\n return (\r\n <jb-option class={className} ref={element} {...rest}>\r\n {children}\r\n </jb-option>\r\n );\r\n};\r\n\r\ntype Props<TValue> = {\r\n value:TValue,\r\n ref?: React.ForwardedRef<JBOptionWebComponent<TValue> | undefined>\r\n}\r\n\r\nexport type JBOptionProps<TValue> = PropsWithChildren<React.JSX.JBOptionType & Props<TValue>>\r\nJBOption.displayName = 'JBOption';"],"mappings":";;;;;AAEA,MAAa,+BAA6B,MAAM,WAAW,CAAC,OAAO,QAAG;CAClE,MAAM,UAAU,OAAO,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AAK;CAC5B,MAAM,EAAE,UAAU,QAAQ,SAAS,SAAS,QAAQ,KAAI,OAAA,qBAAA,OAAA,UAAA,SAAA,aAAA,mBAAA,gBAAA,OAAA,UAAA,GAAA,YAAA,GAAA;AAExD,qBAAoB,KAAK,MAAI,QAAO,mBAAA,CAChC,OACP,EAAA;AACG,WAAU,SAAS;EACf;EACA;EACA;EACA;EACA;CACH,EAAC;AACF,sBAAU,SAAA;EACV;EACI;EACA;EACA;EACA;EACA;EACA;EACJ;EACF;EACF;CACK,EAAC;AACF,wBAAqB,MAAM,cAAc,aAAa;EAClD,KAAK;EACL,GAAG;CACN,GAAE,MAAM,SAAG;AACf;;;;AChCD,SAAgB,SAAS,OAAO;CAChC,MAAA,UAAA,OAAA,KAAA;CAEA,MAAA,EAAA,UAAA,KAAA,UAAA,GAAA,MAAA,GAAA;AACI,qBAAoB,KAAK,MAAI,QAAQ,mBAAsB,CACvD,OACH,EAAC;AACF,wBAAqB,MAAM,cAAc,aAAM;EAC3C,OAAO;EACP,KAAA;EACA,GAAG;CACN,GAAE,SAAO;AACb;AACD,SAAA,cAAA"}
|
|
@@ -1 +1 @@
|
|
|
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,WAA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GAAA;MAEX,SAAQ,SAAS,gBAAa,WAAc;WAE5C,UACF,OACD,EAAA;AAED,sBAAU,MAAG;AACX,MAAI,MAAM,cAAW,QAAS,MAAI,qBAChC,SAAQ,SAAS,aAAa,cAAa,GAAE;MAE7C,SAAM,SAAY,gBAAS,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;;;;;;;;;;;;;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;AAElD,gCAAA,KAAA,MAAA,QAAA,mBAAA,CACA,OAKA,EAAA;AACA,WAAA,SAAA;EACA;EAKF;EAAC;;;;;;;;;;;;;;;;;;;;;;;;ACrBD,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
|
+
{"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":["'use client'\r\n/* eslint-disable react/display-name */\r\nimport React, { useEffect, useRef, useImperativeHandle } from 'react';\r\n// eslint-disable-next-line no-duplicate-imports\r\nimport { JBOptionListWebComponent } from 'jb-select';\r\ntype TOption = any;\r\ntype TValue = any;\r\n\r\ndeclare module \"react\" {\r\n // eslint-disable-next-line @typescript-eslint/no-namespace\r\n namespace JSX {\r\n interface IntrinsicElements {\r\n 'jb-option-list': JBOptionListType;\r\n }\r\n interface JBOptionListType extends React.DetailedHTMLProps<React.HTMLAttributes<JBOptionListWebComponent<TOption, TValue>>, JBOptionListWebComponent<TOption, TValue>> {\r\n class?: string,\r\n // ref:React.RefObject<JBDateInputWebComponent>,\r\n }\r\n }\r\n}\r\nexport const JBOptionList = React.forwardRef((props: JBOptionListProps<TOption,TValue>, ref) => {\r\n const element = useRef<JBOptionListWebComponent<TOption, TValue>>(null);\r\n useImperativeHandle(\r\n ref,\r\n () => (element ? element.current : undefined),\r\n [element],\r\n );\r\n useEffect(() => {\r\n if (element.current && Array.isArray(props.optionList)) {\r\n element.current.optionList = props.optionList;\r\n }\r\n }, [props.optionList, element]);\r\n useEffect(() => {\r\n if (element.current && typeof props.getTitle == \"function\") {\r\n element.current.setCallback(\"getTitle\",props.getTitle);\r\n }\r\n }, [props.getTitle, element]);\r\n useEffect(() => {\r\n if (element.current && typeof props.getValue == \"function\") {\r\n element.current.setCallback(\"getValue\",props.getValue);\r\n }\r\n }, [props.getValue, element]);\r\n useEffect(() => {\r\n if (element.current && typeof props.getContentDOM == \"function\") {\r\n element.current.setCallback(\"getContentDOM\",props.getContentDOM);\r\n }\r\n }, [props.getContentDOM, element]);\r\n return (\r\n <jb-option-list ref={element}>\r\n </jb-option-list>\r\n );\r\n});\r\n\r\nexport type JBOptionListProps<TOption,TValue> = {\r\n optionList: TOption[],\r\n getTitle?: (option: TOption) => string,\r\n getValue?: (option: TOption) => TValue,\r\n getContentDOM?: (option: TOption) => HTMLElement,\r\n}\r\nJBOptionList.displayName = 'JBOptionList';","import { useEvent } from \"jb-core/react\";\r\nimport type { RefObject } from \"react\";\r\nimport type { JBSelectWebComponent, JBSelectEventType } from 'jb-select';\r\n\r\nexport type EventProps = {\r\n /**\r\n * when component loaded, in most cases component is already loaded before react mount so you dont need this but if you load web-component dynamically with lazy load it will be called after react mount\r\n */\r\n onLoad?: (e: JBSelectEventType<CustomEvent>) => void,\r\n /**\r\n * when all property set and ready to use, in most cases component is already loaded before react mount so you dont need this but if you load web-component dynamically with lazy load it will be called after react mount\r\n */\r\n onInit?: (e: JBSelectEventType<CustomEvent>) => void,\r\n onChange?: (e: JBSelectEventType<Event>) => void,\r\n onKeyUp?: (e: JBSelectEventType<KeyboardEvent>) => void,\r\n onInput?: (e: JBSelectEventType<InputEvent>) => void,\r\n}\r\nexport function useEvents(element: RefObject<JBSelectWebComponent|null>, props: EventProps) {\r\n useEvent(element, 'load', props.onLoad, true);\r\n useEvent(element, 'init', props.onInit, true);\r\n useEvent(element, 'keyup', props.onKeyUp);\r\n useEvent(element, 'change', props.onChange);\r\n useEvent(element, 'input', props.onInput);\r\n}","import type { JBSelectWebComponent, ValidationValue } from \"jb-select\";\r\nimport type { ValidationItem } from \"jb-validation\";\r\nimport { type RefObject, useEffect } from \"react\";\r\n\r\nexport type JBSelectAttributes<TValue> = {\r\n validationList?: ValidationItem<ValidationValue<TValue>>[],\r\n label?: string,\r\n error?: string,\r\n value?: TValue,\r\n message?: string,\r\n placeholder?: string,\r\n searchPlaceholder?: string,\r\n required?: boolean,\r\n hideClear?:boolean,\r\n getSelectedValueDOM?: (option: any) => HTMLElement,\r\n\r\n}\r\nexport function useJBSelectAttribute<TValue>(element: RefObject<JBSelectWebComponent|null>, props: JBSelectAttributes<TValue>) {\r\n useEffect(() => {\r\n if (props.message !== null && props.message !== undefined) {\r\n element.current?.setAttribute(\"message\", props.message);\r\n } else {\r\n element.current?.removeAttribute(\"message\");\r\n }\r\n }, [props.message]);\r\n\r\n useEffect(() => {\r\n if (element?.current) {\r\n element.current.validation.list = props.validationList || [];\r\n }\r\n }, [element.current, props.validationList]);\r\n\r\n useEffect(() => {\r\n if (props.label !== null && props.label !== undefined) {\r\n element.current?.setAttribute(\"label\", props.label);\r\n } else {\r\n element.current?.removeAttribute(\"label\");\r\n }\r\n }, [props.label, element.current]);\r\n\r\n useEffect(() => {\r\n if (props.required !== null && props.required !== undefined) {\r\n element.current?.setAttribute(\"required\", \"\");\r\n } else {\r\n element.current?.removeAttribute(\"required\");\r\n }\r\n }, [props.required, element]);\r\n\r\n useEffect(() => {\r\n if (props.hideClear !== null && props.hideClear !== undefined) {\r\n element.current?.setAttribute(\"hide-clear\", \"\");\r\n } else {\r\n element.current?.removeAttribute(\"hide-clear\");\r\n }\r\n }, [props.hideClear, element]);\r\n\r\n useEffect(() => {\r\n if (props.placeholder !== null && props.placeholder !== undefined) {\r\n element.current?.setAttribute(\"placeholder\", props.placeholder);\r\n }\r\n }, [props.placeholder,element]);\r\n\r\n useEffect(() => {\r\n if (props.searchPlaceholder !== null && props.searchPlaceholder !== undefined) {\r\n element.current?.setAttribute(\"search-placeholder\", props.searchPlaceholder);\r\n }\r\n }, [props.searchPlaceholder]);\r\n useEffect(() => {\r\n if (props.error) {\r\n element?.current?.setAttribute('error', props.error);\r\n } else {\r\n element?.current?.removeAttribute('error');\r\n }\r\n }, [props.error]);\r\n useEffect(() => {\r\n if (element.current) {\r\n element.current.value = props.value;\r\n }\r\n }, [props.value]);\r\n useEffect(() => {\r\n if (typeof props.getSelectedValueDOM == \"function\" && element.current && element.current) {\r\n element.current.callbacks.getSelectedValueDOM = props.getSelectedValueDOM;\r\n }\r\n }, [props.getSelectedValueDOM]);\r\n}","'use client'\r\n/* eslint-disable react/display-name */\r\nimport React, { useRef, useImperativeHandle, type PropsWithChildren } from 'react';\r\nimport 'jb-select';\r\n// eslint-disable-next-line no-duplicate-imports\r\nimport type { JBSelectWebComponent, PopoverPosition, SizeVariants } from 'jb-select';\r\nimport { type EventProps, useEvents } from './events-hook.js';\r\nimport { useJBSelectAttribute, type JBSelectAttributes } from './attributes-hook.js';\r\nimport type { JBElementStandardProps } from 'jb-core/react';\r\nimport './module-declaration.js';\r\nexport type JBSelectEventType<T> = T & {\r\n target: JBSelectWebComponent\r\n}\r\nexport function JBSelect<TValue>(props: Props<TValue>) {\r\n const element = useRef<JBSelectWebComponent>(null);\r\n const { onChange, onInit, onInput, onKeyUp, onLoad, ref, error, getSelectedValueDOM, label, required, message, placeholder, searchPlaceholder, validationList, value, hideClear, ...otherProps } = props;\r\n // biome-ignore lint/correctness/useExhaustiveDependencies: <we need element for merging>\r\n useImperativeHandle(\r\n ref,\r\n () => (element.current??undefined),\r\n [element],\r\n );\r\n useEvents(element, { onChange, onInit, onInput, onKeyUp, onLoad });\r\n useJBSelectAttribute(element, { error, getSelectedValueDOM, label, required, message, placeholder, searchPlaceholder, validationList, value, hideClear });\r\n return (\r\n <jb-select ref={element} {...otherProps}>\r\n {props.children}\r\n </jb-select>\r\n );\r\n};\r\n\r\nexport type Props<TValue> = PropsWithChildren<EventProps & JBSelectAttributes<TValue>> & JBElementStandardProps<JBSelectWebComponent, keyof EventProps & JBSelectAttributes<TValue>> & {\r\n ref?: React.ForwardedRef<JBSelectWebComponent|null|undefined>,\r\n multiple?:boolean\r\n size?: SizeVariants,\r\n name?: string,\r\n disabled?:boolean,\r\n popoverPosition?:PopoverPosition\r\n}","'use client'\r\n// biome-ignore lint/style/useImportType: <explanation>\r\nimport React, { useRef, useImperativeHandle, PropsWithChildren } from 'react';\r\nimport { JBOptionWebComponent } from 'jb-select';\r\nimport './module-declaration.js';\r\n\r\n\r\n\r\nexport function JBOption<TValue> (props: JBOptionProps<TValue>){\r\n const element = useRef<JBOptionWebComponent<TValue>>(null);\r\n // value is inside ...rest\r\n const {children, ref,className, ...rest} = props;\r\n useImperativeHandle(\r\n ref,\r\n () => (element.current??undefined),\r\n [element],\r\n );\r\n\r\n return (\r\n <jb-option class={className} ref={element} {...rest}>\r\n {children}\r\n </jb-option>\r\n );\r\n};\r\n\r\ntype Props<TValue> = {\r\n value:TValue,\r\n ref?: React.ForwardedRef<JBOptionWebComponent<TValue> | undefined>\r\n}\r\n\r\nexport type JBOptionProps<TValue> = PropsWithChildren<React.JSX.JBOptionType & Props<TValue>>\r\nJBOption.displayName = 'JBOption';"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAa,+BAA6B,cAAM,WAAW,CAAC,OAAO,QAAG;CAClE,MAAM,UAAU,kBAAO,KAAK;AAC5B,gCAAoB,KAAK,MAAI,UAAU,QAAQ,kBAAE,CAC7C,OACH,EAAC;AACN,sBAAA,MAAA;AACQ,MAAI,QAAQ,WAAI,MAAA,QAAA,MAAA,WAAA,CACZ,SAAQ,QAAQ,aAAa,MAAM;CAE1C,GAAE,CACC,MAAM,YACT,OACA,EAAC;AACF,sBAAU,MAAI;AACV,MAAI,QAAQ,kBAAkB,MAAM,YAAU,WACjD,SAAA,QAAA,YAAA,YAAA,MAAA,SAAA;CAEJ,GAAA,CACO,MAAM,UACN,OACH,EAAC;AACF,sBAAI,MAAA;AACA,MAAI,QAAQ,kBAAkB,MAAM,YAAM,WACtC,SAAE,QAAA,YAAA,YAAA,MAAA,SAAA;CAET,GAAE,CACC,MAAM,UACN,OACH,EAAA;AACD,sBAAU,MAAI;AACV,MAAI,QAAO,kBAAA,MAAA,iBAAA,WACP,SAAQ,QAAQ,YAAY,iBAAiB,MAAM,cAAE;CAE5D,GAAA,CACG,MAAM,eACN,OACH,EAAC;AACF,wBAAqB,cAAM,cAAc,kBAAgB,EACxD,KAAA,QACA,EAAC;AACL,EAAC;AACF,aAAa,cAAc;;;;AC1C3B,SAAgB,UAAU,SAAS,OAAI;AACnC,6BAAS,SAAS,QAAQ,MAAM,QAAQ,KAAK;AACjD,6BAAA,SAAA,QAAA,MAAA,QAAA,KAAA;AACI,6BAAS,SAAS,SAAI,MAAA,QAAA;AACtB,6BAAC,SAAA,UAAA,MAAA,SAAA;AACD,6BAAS,SAAS,SAAS,MAAM,QA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