jb-select 6.0.5 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/README.md +10 -4
  2. package/dist/index.cjs.js +2 -2
  3. package/dist/index.cjs.js.br +0 -0
  4. package/dist/index.cjs.js.gz +0 -0
  5. package/dist/index.cjs.js.map +1 -1
  6. package/dist/index.d.ts +8 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +2 -2
  9. package/dist/index.js.br +0 -0
  10. package/dist/index.js.gz +0 -0
  11. package/dist/index.js.map +1 -1
  12. package/dist/index.umd.js +2 -2
  13. package/dist/index.umd.js.br +0 -0
  14. package/dist/index.umd.js.gz +0 -0
  15. package/dist/index.umd.js.map +1 -1
  16. package/dist/jb-option/jb-option.d.ts +22 -0
  17. package/dist/jb-option/jb-option.d.ts.map +1 -0
  18. package/dist/jb-option/render.d.ts +2 -0
  19. package/dist/jb-option/render.d.ts.map +1 -0
  20. package/dist/jb-option/types.d.ts +5 -0
  21. package/dist/jb-option/types.d.ts.map +1 -0
  22. package/dist/jb-option-list/jb-option-list.d.ts +11 -0
  23. package/dist/jb-option-list/jb-option-list.d.ts.map +1 -0
  24. package/dist/jb-option-list/types.d.ts +6 -0
  25. package/dist/jb-option-list/types.d.ts.map +1 -0
  26. package/dist/jb-select.d.ts +60 -0
  27. package/dist/jb-select.d.ts.map +1 -0
  28. package/dist/lib/index.d.ts +7 -0
  29. package/dist/lib/jb-option/jb-option.d.ts +21 -0
  30. package/dist/lib/jb-option/render.d.ts +1 -0
  31. package/dist/lib/jb-option/types.d.ts +4 -0
  32. package/dist/lib/jb-option-list/jb-option-list.d.ts +10 -0
  33. package/dist/lib/jb-option-list/types.d.ts +5 -0
  34. package/dist/lib/jb-select.d.ts +59 -0
  35. package/dist/lib/types.d.ts +27 -0
  36. package/dist/types.d.ts +28 -0
  37. package/dist/types.d.ts.map +1 -0
  38. package/dist/web-component/jb-select/lib/jb-select.d.ts +3 -0
  39. package/dist/web-component/jb-select/lib/types.d.ts +4 -1
  40. package/lib/global.d.ts +15 -0
  41. package/lib/jb-option/jb-option.ts +4 -0
  42. package/lib/jb-select.scss +30 -36
  43. package/lib/jb-select.ts +51 -34
  44. package/lib/types.ts +6 -3
  45. package/lib/variables.css +29 -0
  46. package/package.json +9 -4
  47. package/react/README.md +15 -55
  48. package/react/dist/JBOption.d.ts +19 -0
  49. package/react/dist/JBOptionList.d.ts +22 -0
  50. package/react/dist/JBSelect.d.ts +50 -0
  51. package/react/dist/events-hook.d.ts +16 -0
  52. package/react/dist/index.cjs.js +2 -122
  53. package/react/dist/index.cjs.js.map +1 -1
  54. package/react/dist/index.d.ts +3 -0
  55. package/react/dist/index.js +2 -118
  56. package/react/dist/index.js.map +1 -1
  57. package/react/dist/index.umd.js +2 -125
  58. package/react/dist/index.umd.js.map +1 -1
  59. package/react/dist/lib/JBOption.d.ts +19 -0
  60. package/react/dist/lib/JBOptionList.d.ts +22 -0
  61. package/react/dist/lib/JBSelect.d.ts +48 -0
  62. package/react/dist/lib/events-hook.d.ts +16 -0
  63. package/react/dist/lib/index.d.ts +3 -0
  64. package/react/dist/web-component/jb-select/react/lib/JBSelect.d.ts +15 -5
  65. package/react/dist/web-component/jb-select/react/lib/events-hook.d.ts +16 -0
  66. package/react/lib/JBSelect.tsx +12 -24
  67. package/react/lib/events-hook.ts +24 -0
  68. package/react/package.json +1 -1
  69. package/react/tsconfig.json +3 -4
  70. package/dist/jb-select.cjs.js +0 -2
  71. package/dist/jb-select.cjs.js.br +0 -0
  72. package/dist/jb-select.cjs.js.gz +0 -0
  73. package/dist/jb-select.cjs.js.map +0 -1
  74. package/dist/jb-select.js +0 -2
  75. package/dist/jb-select.js.br +0 -0
  76. package/dist/jb-select.js.gz +0 -0
  77. package/dist/jb-select.js.map +0 -1
  78. package/dist/jb-select.umd.js +0 -2
  79. package/dist/jb-select.umd.js.br +0 -0
  80. package/dist/jb-select.umd.js.gz +0 -0
  81. package/dist/jb-select.umd.js.map +0 -1
package/lib/types.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { type JBOptionWebComponent } from "./jb-option/jb-option";
2
-
1
+ import type { JBOptionWebComponent } from "./jb-option/jb-option";
2
+ import type {EventTypeWithTarget} from "jb-core";
3
+ import type{ JBSelectWebComponent } from "./jb-select";
3
4
  export type JBSelectCallbacks<TValue> = {
4
5
  getSelectedValueDOM?:(value:TValue,content:HTMLElement) => HTMLElement;
5
6
  }
@@ -23,4 +24,6 @@ export type ValidationValue<TValue> = {
23
24
  selectedOption:JBOptionWebComponent<TValue> | null,
24
25
  value:TValue | null,
25
26
  inputtedText:string
26
- }
27
+ }
28
+
29
+ export type JBSelectEventType<TEvent> = EventTypeWithTarget<TEvent,JBSelectWebComponent>
@@ -0,0 +1,29 @@
1
+ :host {
2
+ --p-middle-div-height: var(--jb-select-middle-div-height, 0px);
3
+ --p-p-color: #1e2832;
4
+ --p-border-bottom-width: var(--jb-select-border-bottom-width, var(--jb-select-border-width, 3px));
5
+ --p-base-z-index: 1;
6
+ --p-mobile-modal-z-index: 900;
7
+ --p-mobile-modal-height: var(--jb-select-mobile-modal-height, 100vh);
8
+ /**/
9
+ --border-color: var(--jb-select-border-color, var(--jb-neutral-10));
10
+ --message-color: var(--jb-textarea-message-color, var(--jb-text-secondary));
11
+ --label-color: var(--jb-select-label-color, var(--jb-text-primary));
12
+ --value-color: var(--jb-textarea-value-color, var(--jb-text-primary));
13
+ --placeholder-color: var(--jb-input-placeholder-color, var(--jb-neutral-6));
14
+ --select-box-bg-color: var(--jb-select-bgcolor, var(--jb-neutral-10));
15
+ --overlay-bg-color:var(--jb-select-overlay-bg-color, oklch(from var(--jb-neutral) l c h / calc(alpha - 0.5)));
16
+ --modal-label-color:var(--jb-select-modal-label-color, var(--jb-text-contrast));
17
+ --modal-close-color:var(--jb-select-modal-close-color, var(--jb-white));
18
+ --close-bg-color:var(--jb-select-close-bg-color, var(--jb-neutral-2));
19
+ --list-scroll-color:var(--jb-select-list-scroll-color, #c3c3c3);
20
+ --empty-list-placeholder-color:var(--jb-select-empty-list-placeholder-color, var(--jb-text-secondary))
21
+ }
22
+
23
+ :host(:state(invalid)) {
24
+ --message-color: var(--jb-textarea-message-error-color, var(--jb-red));
25
+ }
26
+
27
+ :host(:focus-within) {
28
+ --border-color: var(--jb-textarea-border-color-focus, var(--jb-neutral));
29
+ }
package/package.json CHANGED
@@ -10,9 +10,13 @@
10
10
  "jb",
11
11
  "jb-select",
12
12
  "select",
13
- "web component"
13
+ "autocomplete",
14
+ "dropdown",
15
+ "select box",
16
+ "web component",
17
+ "react component"
14
18
  ],
15
- "version": "6.0.5",
19
+ "version": "6.2.0",
16
20
  "bugs": "https://github.com/javadbat/jb-select/issues",
17
21
  "license": "MIT",
18
22
  "files": [
@@ -23,14 +27,15 @@
23
27
  "react/",
24
28
  "react/dist/"
25
29
  ],
26
- "types": "./dist/web-component/jb-select/lib/index.d.ts",
30
+ "types": "./dist/index.d.ts",
27
31
  "main": "index.js",
28
32
  "repository": {
29
33
  "type": "git",
30
34
  "url": "git@github.com:javadbat/jb-select.git"
31
35
  },
32
36
  "dependencies": {
33
- "jb-validation": ">=0.2.0"
37
+ "jb-validation": ">=0.4.0",
38
+ "jb-core":">=0.8.0"
34
39
  },
35
40
  "devDependencies": {
36
41
  "jb-form":">=0.6.10"
package/react/README.md CHANGED
@@ -19,7 +19,7 @@ import {JBSelect} from 'jb-select/react';
19
19
  <JBSelect></JBSelect>
20
20
  ```
21
21
 
22
- ### label
22
+ ## label
23
23
  use label property to describe your select component.
24
24
 
25
25
  ```jsx
@@ -120,7 +120,7 @@ render(){
120
120
  }
121
121
  ```
122
122
 
123
- ### Add Icon or Any Element into box
123
+ ## Add Icon or Any Element into box
124
124
 
125
125
  sometimes you want to add icon into the select box before value box.
126
126
  you can customize this entire section by adding a div or any other Tag with the `slot="start-section"`
@@ -135,56 +135,16 @@ like the example the below:
135
135
  </JBSelect>
136
136
  ```
137
137
 
138
- ### set custom style
139
-
140
- in some cases in your project you need to change defualt style of the component for example you need zero margin or different border-radius and etc.
141
- if you want to set a custom style to this component all you need is to set css variable.
142
- | css variable name | description |
143
- | ------------- | ------------- |
144
- | --jb-select-margin | web-component margin default is `0 0` |
145
- | --jb-select-width | change the select component width default is `100%` |
146
- | --jb-select-border-radius | web-component border-radius defualt is `16px` |
147
- | --jb-select-border-color | border color of select in normal mode |
148
- | --jb-select-border-color-selected | border color when user select a value from list |
149
- | --jb-select-bgcolor | background color of input |
150
- | --jb-select-overlay-bgcolor | background of select overlay when open in mobile and tablet screen |
151
- | --jb-select-list-max-height | max height of option list |
152
- | --jb-select-border-bottom-width | width of border bottom |
153
- | --jb-select-border-width | width of border |
154
- | --jb-select-label-color | color of label default is `#1f1735` |
155
- | --jb-input-label-font-size | label font size default is `0.8em` |
156
- | --jb-input-label-font-weight | color of label defualt is `#1f1735` |
157
- | --jb-select-option-color | change option text color |
158
- | --jb-select-option-color-hover | change option text color on hover |
159
- | --jb-select-option-background-color | background of options default is `transparent` |
160
- | --jb-select-option-background-color-hover | background of options on mouse hover default is `#1073db` |
161
- | --jb-select-input-color | color of input value |
162
- | --jb-select-bgcolor-selected | set background color for selected status |
163
- | --jb-select-selected-value-color | selected value text color default is `#1f1735` |
164
- | --jb-select-selected-value-font-size | font-size of selected value default is `1.1rem` |
165
- | --jb-select-message-color | message text color default is `#929292` |
166
- | --jb-select-message-font-size | font size of message default is `0.7em` |
167
- | --jb-select-message-font-weight | font weight of message box default is `normal` |
168
- | --jb-select-placeholder-color | placeholder color default is `initial` |
169
- | --jb-select-placeholder-font-size | placeholder font-size default is `1.1em` |
170
- | --jb-select-height | jb-select box height |
171
- | --jb-select-mobile-search-input-height | when user open select on mobile there is a search box input this var will set its height |
172
- | --jb-select-mobile-item-list-margin | when user open select on mobile there is gap between search box & list that can be customized |
173
- | --jb-select-list-padding | padding of opened list box default is `16px 0` |
174
- | --jb-select-close-bg-color | close button bg-color default is `#1f1735` |
175
- | --jb-select-close-x-color | close button x color default is `#fff` |
176
- | --jb-select-close-bg-opacity | close button bg opacity default is `0.4` |
177
- | --jb-select-mobile-input-bgcolor | background color search input when open in mobile |
178
- | --jb-select-mobile-search-border-width | when user open select on mobile, search box can have its own border width config |
179
- | --jb-select-mobile-search-border-color | when user open select on mobile, search box can have its own border color config |
180
- | --jb-select-mobile-search-border-bottom-width | when user open select on mobile, search box can have its own border bottom width config |
181
- | --jb-select-mobile-search-border-bottom-color | when user open select on mobile, search box can have its own border bottom color config |
182
- | --jb-select-mobile-search-border-radius | when user open select on mobile, search box can have its own border radius |
183
- | --jb-select-middle-div-height | separator line between input and list default is `0px` and hidden but you can cahange it |
184
- | --jb-select-middle-div-color | change separator line color |
185
- | --jb-select-middle-div-margin | change seprator line margin |
186
- | --jb-select-middle-div-mobile-margin | change separator line margin in mobile modal |
187
- | --jb-select-middle-div-radius | change separator line border-radius |
188
- | --jb-select-list-scroll-color | list item scroll color default is `#c3c3c3` |
189
- | --jb-select-list-scroll-border-radius | list item scroll border-radius default is `4px` |
190
- | --jb-select-select-box-margin | margin of internal element called select box that wrapper display element of form in one box |
138
+ ## validation
139
+
140
+ since select has a limited value options, validation have different story here. the only validation i really necessary here is required that indicate if user must select a value before he can move on. so pass `required` prop, then call `checkValidity` function like all other jb web component family. but if you need more customize validation just read [jb-validation](https://github.com/javadbat/jb-validation)
141
+
142
+ you can also set `error` attribute to pass error directly to the component
143
+
144
+ ```jsx
145
+ <JBSelect error="your error message"></JBSelect>
146
+ ```
147
+
148
+ ## set custom style
149
+
150
+ please read [jb-select](https://github.com/javadbat/jb-select) custom style section.
@@ -0,0 +1,19 @@
1
+ import React, { PropsWithChildren } from 'react';
2
+ import { JBOptionWebComponent } from 'jb-select';
3
+ type TValue = any;
4
+ declare global {
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
+ }
13
+ }
14
+ export declare const JBOption: React.ForwardRefExoticComponent<Omit<JBOptionProps<any>, "ref"> & React.RefAttributes<unknown>>;
15
+ type Props<TValue> = {
16
+ value: TValue;
17
+ };
18
+ export type JBOptionProps<TValue> = PropsWithChildren<JSX.JBOptionType & Props<TValue>>;
19
+ export {};
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { JBOptionListWebComponent } from 'jb-select';
3
+ type TOption = any;
4
+ type TValue = any;
5
+ declare global {
6
+ namespace JSX {
7
+ interface IntrinsicElements {
8
+ 'jb-option-list': JBOptionListType;
9
+ }
10
+ interface JBOptionListType extends React.DetailedHTMLProps<React.HTMLAttributes<JBOptionListWebComponent<TOption, TValue>>, JBOptionListWebComponent<TOption, TValue>> {
11
+ class?: string;
12
+ }
13
+ }
14
+ }
15
+ export declare const JBOptionList: React.ForwardRefExoticComponent<JBOptionListProps<any, any> & React.RefAttributes<unknown>>;
16
+ export type JBOptionListProps<TOption, TValue> = {
17
+ optionList: TOption[];
18
+ getTitle?: (option: TOption) => string;
19
+ getValue?: (option: TOption) => TValue;
20
+ getContentDOM?: (option: TOption) => HTMLElement;
21
+ };
22
+ export {};
@@ -0,0 +1,50 @@
1
+ import React, { CSSProperties } from 'react';
2
+ import 'jb-select';
3
+ import { JBSelectWebComponent } from 'jb-select';
4
+ import { EventProps } from './events-hook.js';
5
+ export type JBSelectEventType<T> = T & {
6
+ target: JBSelectWebComponent;
7
+ };
8
+ declare global {
9
+ namespace JSX {
10
+ interface IntrinsicElements {
11
+ 'jb-select': JBSelectType;
12
+ }
13
+ interface JBSelectType extends React.DetailedHTMLProps<React.HTMLAttributes<JBSelectWebComponent>, JBSelectWebComponent> {
14
+ class?: string;
15
+ label?: string;
16
+ name?: string;
17
+ required?: string | boolean;
18
+ message?: string;
19
+ tabindex?: string;
20
+ }
21
+ }
22
+ }
23
+ export declare const JBSelect: React.ForwardRefExoticComponent<EventProps & {
24
+ style?: CSSProperties;
25
+ label?: string;
26
+ getSelectedValueDOM?: (option: any) => HTMLElement;
27
+ value?: any;
28
+ required?: boolean;
29
+ message?: string;
30
+ placeholder?: string;
31
+ searchPlaceholder?: string;
32
+ className?: string;
33
+ children?: React.ReactNode;
34
+ name?: string;
35
+ error?: string;
36
+ } & React.RefAttributes<unknown>>;
37
+ export type Props = EventProps & {
38
+ style?: CSSProperties;
39
+ label?: string;
40
+ getSelectedValueDOM?: (option: any) => HTMLElement;
41
+ value?: any;
42
+ required?: boolean;
43
+ message?: string;
44
+ placeholder?: string;
45
+ searchPlaceholder?: string;
46
+ className?: string;
47
+ children?: React.ReactNode;
48
+ name?: string;
49
+ error?: string;
50
+ };
@@ -0,0 +1,16 @@
1
+ import { RefObject } from "react";
2
+ import type { JBSelectWebComponent, JBSelectEventType } from 'jb-select';
3
+ export type EventProps = {
4
+ /**
5
+ * 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
6
+ */
7
+ onLoad?: (e: JBSelectEventType<CustomEvent>) => void;
8
+ /**
9
+ * 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
10
+ */
11
+ onInit?: (e: JBSelectEventType<CustomEvent>) => void;
12
+ onChange?: (e: JBSelectEventType<Event>) => void;
13
+ onKeyUp?: (e: JBSelectEventType<KeyboardEvent>) => void;
14
+ onInput?: (e: JBSelectEventType<InputEvent>) => void;
15
+ };
16
+ export declare function useEvents(element: RefObject<JBSelectWebComponent>, props: EventProps): void;
@@ -1,122 +1,2 @@
1
- 'use strict';
2
-
3
- var React = require('react');
4
- require('jb-select');
5
-
6
- /* eslint-disable react/display-name */
7
- const JBOptionList = React.forwardRef((props, ref) => {
8
- const element = React.useRef(null);
9
- React.useImperativeHandle(ref, () => (element ? element.current : undefined), [element]);
10
- React.useEffect(() => {
11
- if (element.current && Array.isArray(props.optionList)) {
12
- element.current.optionList = props.optionList;
13
- }
14
- }, [props.optionList, element]);
15
- React.useEffect(() => {
16
- if (element.current && typeof props.getTitle == "function") {
17
- element.current.setCallback("getTitle", props.getTitle);
18
- }
19
- }, [props.getTitle, element]);
20
- React.useEffect(() => {
21
- if (element.current && typeof props.getValue == "function") {
22
- element.current.setCallback("getValue", props.getValue);
23
- }
24
- }, [props.getValue, element]);
25
- React.useEffect(() => {
26
- if (element.current && typeof props.getContentDOM == "function") {
27
- element.current.setCallback("getContentDOM", props.getContentDOM);
28
- }
29
- }, [props.getContentDOM, element]);
30
- return (React.createElement("jb-option-list", { ref: element }));
31
- });
32
- JBOptionList.displayName = 'JBOptionList';
33
-
34
- function useBindEvent(ref, event, handler, passive = false) {
35
- React.useEffect(() => {
36
- const dom = ref.current;
37
- if (dom) {
38
- // initiate the event handler
39
- dom.addEventListener(event, handler, passive);
40
- }
41
- // this will clean up the event every time the component is re-rendered
42
- return function cleanup() {
43
- if (dom) {
44
- dom.removeEventListener(event, handler, passive);
45
- }
46
- };
47
- }, [ref, event, handler, passive]);
48
- }
49
-
50
- /* eslint-disable react/display-name */
51
- const JBSelect = React.forwardRef((props, ref) => {
52
- const element = React.useRef(null);
53
- const [refChangeCount, refChangeCountSetter] = React.useState(0);
54
- React.useImperativeHandle(ref, () => (element ? element.current : {}), [element]);
55
- React.useEffect(() => {
56
- refChangeCountSetter(refChangeCount + 1);
57
- }, [element.current]);
58
- React.useEffect(() => {
59
- if (element.current) {
60
- element.current.value = props.value;
61
- }
62
- }, [props.value]);
63
- React.useEffect(() => {
64
- if (typeof props.getSelectedValueDOM == "function" && element.current && element.current) {
65
- element.current.callbacks.getSelectedValueDOM = props.getSelectedValueDOM;
66
- }
67
- }, [props.getSelectedValueDOM]);
68
- React.useEffect(() => {
69
- if (props.message !== null && props.message !== undefined) {
70
- element.current?.setAttribute("message", props.message);
71
- }
72
- }, [props.message]);
73
- React.useEffect(() => {
74
- if (props.placeholder !== null && props.placeholder !== undefined) {
75
- element.current?.setAttribute("placeholder", props.placeholder);
76
- }
77
- }, [props.placeholder]);
78
- React.useEffect(() => {
79
- if (props.searchPlaceholder !== null && props.searchPlaceholder !== undefined) {
80
- element.current?.setAttribute("search-placeholder", props.searchPlaceholder);
81
- }
82
- }, [props.searchPlaceholder]);
83
- function onKeyup(e) {
84
- if (typeof props.onKeyup == "function") {
85
- props.onKeyup(e);
86
- }
87
- }
88
- function onChange(e) {
89
- if (typeof props.onChange == "function") {
90
- props.onChange(e);
91
- }
92
- }
93
- function onInput(e) {
94
- if (typeof props.onInput == "function") {
95
- props.onInput(e);
96
- }
97
- }
98
- useBindEvent(element, 'keyup', onKeyup);
99
- useBindEvent(element, 'change', onChange);
100
- useBindEvent(element, 'input', onInput);
101
- return (React.createElement("jb-select", { style: props.style ? props.style : undefined, class: props.className ? props.className : "", label: props.label, ref: element, required: props.required || 'false', name: props.name ?? undefined }, props.children));
102
- });
103
- JBSelect.displayName = 'JBSelect';
104
-
105
- /* eslint-disable react/display-name */
106
- const JBOption = React.forwardRef((props, ref) => {
107
- const element = React.useRef(null);
108
- const { value, children, className, ...rest } = props;
109
- React.useImperativeHandle(ref, () => (element ? element.current : undefined), [element]);
110
- React.useEffect(() => {
111
- if (element.current && value !== undefined) {
112
- element.current.value = value;
113
- }
114
- }, [value, element]);
115
- return (React.createElement("jb-option", { class: className, ref: element, ...rest }, children));
116
- });
117
- JBOption.displayName = 'JBOption';
118
-
119
- exports.JBOption = JBOption;
120
- exports.JBOptionList = JBOptionList;
121
- exports.JBSelect = JBSelect;
122
- //# sourceMappingURL=index.cjs.js.map
1
+ "use strict";var e=Object.create,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,u=Object.getPrototypeOf,n=Object.prototype.hasOwnProperty,c=(e,u,c,a)=>{if(u&&"object"==typeof u||"function"==typeof u)for(var o,s=l(u),i=0,f=s.length;i<f;i++)o=s[i],n.call(e,o)||o===c||t(e,o,{get:(e=>u[e]).bind(null,o),enumerable:!(a=r(u,o))||a.enumerable});return e},a=(r,l,n)=>(n=null!=r?e(u(r)):{},c(!l&&r&&r.__esModule?n:t(n,"default",{value:r,enumerable:!0}),r));const o=a(require("react"));require("jb-select");const s=a(require("jb-core/react")),i=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})});i.displayName="JBOptionList";const f=o.default.forwardRef((e,t)=>{let r=(0,o.useRef)(null),[l,u]=(0,o.useState)(0);return(0,o.useImperativeHandle)(t,()=>r?r.current:{},[r]),(0,o.useEffect)(()=>{u(l+1)},[r.current]),(0,o.useEffect)(()=>{r.current&&(r.current.value=e.value)},[e.value]),(0,o.useEffect)(()=>{"function"==typeof e.getSelectedValueDOM&&r.current&&r.current&&(r.current.callbacks.getSelectedValueDOM=e.getSelectedValueDOM)},[e.getSelectedValueDOM]),(0,o.useEffect)(()=>{null!==e.message&&void 0!==e.message&&r.current?.setAttribute("message",e.message)},[e.message]),(0,o.useEffect)(()=>{null!==e.placeholder&&void 0!==e.placeholder&&r.current?.setAttribute("placeholder",e.placeholder)},[e.placeholder]),(0,o.useEffect)(()=>{null!==e.searchPlaceholder&&void 0!==e.searchPlaceholder&&r.current?.setAttribute("search-placeholder",e.searchPlaceholder)},[e.searchPlaceholder]),(0,o.useEffect)(()=>{e.error?r?.current?.setAttribute("error",e.error):r?.current?.removeAttribute("error")},[e.error]),(0,s.useEvent)(r,"load",e.onLoad,!0),(0,s.useEvent)(r,"init",e.onInit,!0),(0,s.useEvent)(r,"keyup",e.onKeyUp),(0,s.useEvent)(r,"change",e.onChange),(0,s.useEvent)(r,"input",e.onInput),o.default.createElement("jb-select",{style:e.style?e.style:void 0,class:e.className?e.className:"",label:e.label,ref:r,required:e.required||"false",name:e.name??void 0},e.children)});f.displayName="JBSelect";const d=o.default.forwardRef((e,t)=>{let r=(0,o.useRef)(null),{value:l,children:u,className:n,...c}=e;return(0,o.useImperativeHandle)(t,()=>r?r.current:void 0,[r]),(0,o.useEffect)(()=>{r.current&&void 0!==l&&(r.current.value=l)},[l,r]),o.default.createElement("jb-option",{class:n,ref:r,...c},u)});d.displayName="JBOption",exports.JBOption=d,exports.JBOptionList=i,exports.JBSelect=f;
2
+ //# sourceMappingURL=index.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../lib/JBOptionList.tsx","../../../../common/hooks/use-event.ts","../lib/JBSelect.tsx","../lib/JBOption.tsx"],"sourcesContent":["/* 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 global {\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 { useEffect } from \"react\";\r\n\r\nexport function useEvent(dom:HTMLElement, event:any, handler:any, passive = false) {\r\n useEffect(() => {\r\n if (dom) {\r\n // initiate the event handler\r\n dom.addEventListener(event, handler, passive); \r\n }\r\n // this will clean up the event every time the component is re-rendered\r\n return function cleanup() {\r\n if(dom){\r\n dom.removeEventListener(event, handler, passive);\r\n }\r\n };\r\n });\r\n}\r\nexport function useBindEvent<TRef extends React.MutableRefObject<any|null>,TEvent>(ref:TRef, event:string, handler:(e:TEvent)=>void, passive = false) {\r\n useEffect(() => {\r\n const dom = ref.current;\r\n if (dom) {\r\n // initiate the event handler\r\n dom.addEventListener(event, handler, passive); \r\n }\r\n // this will clean up the event every time the component is re-rendered\r\n return function cleanup() {\r\n if(dom){\r\n dom.removeEventListener(event, handler, passive);\r\n }\r\n };\r\n },[ref,event,handler,passive]);\r\n}","/* eslint-disable react/display-name */\r\nimport React, { useEffect, useRef, useState, useImperativeHandle,CSSProperties } from 'react';\r\nimport 'jb-select';\r\nimport { useBindEvent } from '../../../../common/hooks/use-event.js';\r\n// eslint-disable-next-line no-duplicate-imports\r\nimport { JBSelectWebComponent } from 'jb-select';\r\nexport type JBSelectEventType<T> = T & {\r\n target: JBSelectWebComponent\r\n}\r\ndeclare global {\r\n // eslint-disable-next-line @typescript-eslint/no-namespace\r\n namespace JSX {\r\n interface IntrinsicElements {\r\n 'jb-select': JBSelectType;\r\n }\r\n interface JBSelectType extends React.DetailedHTMLProps<React.HTMLAttributes<JBSelectWebComponent>, JBSelectWebComponent> {\r\n class?:string,\r\n label?: string,\r\n name?:string,\r\n required?:string | boolean,\r\n message?:string,\r\n tabindex?:string,\r\n // ref:React.RefObject<JBDateInputWebComponent>,\r\n }\r\n }\r\n}\r\n\r\nexport const JBSelect = React.forwardRef((props:JBSelectProps, ref) => {\r\n const element = useRef<JBSelectWebComponent>(null);\r\n const [refChangeCount, refChangeCountSetter] = useState(0);\r\n useImperativeHandle(\r\n ref,\r\n () => (element ? element.current : {}),\r\n [element],\r\n );\r\n useEffect(() => {\r\n refChangeCountSetter(refChangeCount + 1);\r\n }, [element.current]);\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 useEffect(() => {\r\n if (props.message !== null && props.message !== undefined ) {\r\n element.current?.setAttribute(\"message\", props.message);\r\n }\r\n }, [props.message]);\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]);\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 function onKeyup(e:JBSelectEventType<KeyboardEvent>) {\r\n if ( typeof props.onKeyup == \"function\") {\r\n props.onKeyup(e);\r\n }\r\n }\r\n function onChange(e:JBSelectEventType<Event>) {\r\n if (typeof props.onChange ==\"function\") {\r\n props.onChange(e);\r\n }\r\n }\r\n function onInput(e:JBSelectEventType<InputEvent>) {\r\n if (typeof props.onInput == \"function\") {\r\n props.onInput(e);\r\n }\r\n }\r\n useBindEvent(element, 'keyup', onKeyup);\r\n useBindEvent(element, 'change', onChange);\r\n useBindEvent(element, 'input', onInput);\r\n return (\r\n <jb-select style={props.style?props.style:undefined} class={props.className?props.className:\"\"} label={props.label} ref={element} required={props.required || 'false'} name={props.name??undefined}>\r\n {props.children}\r\n </jb-select>\r\n );\r\n});\r\n\r\nexport type JBSelectProps = {\r\n style?:CSSProperties,\r\n label?: string,\r\n getSelectedValueDOM?: (option:any)=>HTMLElement,\r\n value?: any,\r\n onChange?: (e:JBSelectEventType<Event>)=>void,\r\n onKeyup?: (e:JBSelectEventType<KeyboardEvent>)=>void,\r\n onInput?: (e:JBSelectEventType<InputEvent>)=>void,\r\n required?: boolean,\r\n message?: string,\r\n placeholder?: string,\r\n searchPlaceholder?: string,\r\n className?: string,\r\n children?:React.ReactNode,\r\n name?:string\r\n}\r\nJBSelect.displayName = 'JBSelect';","/* eslint-disable react/display-name */\r\nimport React, { useEffect, useRef, useImperativeHandle, PropsWithChildren, ComponentProps } from 'react';\r\nimport { JBOptionWebComponent } from 'jb-select';\r\n//TODO: make it generic when remove forward ref\r\ntype TValue = any;\r\n\r\ndeclare global {\r\n // eslint-disable-next-line @typescript-eslint/no-namespace\r\n namespace JSX {\r\n interface IntrinsicElements {\r\n 'jb-option': JBOptionType;\r\n }\r\n interface JBOptionType extends React.DetailedHTMLProps<React.HTMLAttributes<JBOptionWebComponent<TValue>>, JBOptionWebComponent<TValue>> {\r\n class?: string,\r\n }\r\n }\r\n}\r\nexport const JBOption = React.forwardRef((props: JBOptionProps<TValue>, ref) => {\r\n const element = useRef<JBOptionWebComponent<TValue>>(null);\r\n const {value,children,className, ...rest} = props;\r\n useImperativeHandle(\r\n ref,\r\n () => (element ? element.current : undefined),\r\n [element],\r\n );\r\n \r\n useEffect(() => {\r\n if (element.current && value !== undefined) {\r\n element.current.value = value;\r\n }\r\n }, [value, element]);\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}\r\n\r\nexport type JBOptionProps<TValue> = PropsWithChildren<JSX.JBOptionType & Props<TValue>>\r\nJBOption.displayName = 'JBOption';"],"names":["useRef","useImperativeHandle","useEffect","useState"],"mappings":";;;;;AAAA;AAmBO,MAAM,YAAY,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAwC,EAAE,GAAG,KAAI;AAC7F,IAAA,MAAM,OAAO,GAAGA,YAAM,CAA4C,IAAI,CAAC,CAAC;IACxEC,yBAAmB,CACjB,GAAG,EACH,OAAO,OAAO,GAAG,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,EAC7C,CAAC,OAAO,CAAC,CACV,CAAC;IACFC,eAAS,CAAC,MAAK;AACb,QAAA,IAAI,OAAO,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE;YACtD,OAAO,CAAC,OAAO,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;AAC/C,SAAA;KACF,EAAE,CAAC,KAAK,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;IAChCA,eAAS,CAAC,MAAK;QACb,IAAI,OAAO,CAAC,OAAO,IAAI,OAAO,KAAK,CAAC,QAAQ,IAAI,UAAU,EAAE;YAC1D,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,UAAU,EAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AACxD,SAAA;KACF,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,OAA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E,uBAAiB,iBAAA,EAAA;CACrB,GAAA,CACE,QAAG;sBAEH,MAAA;AACE,MAAA,QAAY,QAChB,SAAe,QAAA,QAAA,MAAA;KAGb,MAAA,KACD,EAAA;AACD,sBAAU,MAAG;AACX,aAAU,MAAO,uBAAmB,cAAY,QAAY,WAAA,QAAA,QAC1D,SAAQ,QAAO,UAAE,sBAA8B,MAAO;CAEzD,GAAE,CACH,MAAU;sBAEN,MAAA;AACF,MAAA,MAAA,YAAA,QAAA,MAAA,YAAA,UACE,SAAM,SAAa,aAAA,WAAA,MAAA,QAAA;WAGnB;AAEJ,sBAAU,MAAA;AACV,MAAA,MAAa,gBAAE,QAAA,MAAA,gBAAA,UACT,SAAM,SAAO,aAAA,eAAA,MAAA,YAAA;WAEV;sBAEP,MAAA;AACE,MAAA,MAAM,sBAAO,QAAA,MAAA,sBAAA,UACjB,SAAU,SAAc,aAAA,sBAAA,MAAA,kBAAA;CAMxB,GAAA,CAgBM,MAAC;;;;;;;;;;;;;;;;;;;MC3FG,yBAAuB,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,UAAQ,WAAA,CACjD,OAMA,EAAA;sBACM,MAAA;MACF,QAAQ,WAAQ,UAAa,UAC/B,SAAA,QAAA,QAAA;CAGF,GAAA,CAKA,OAOM"}
@@ -0,0 +1,3 @@
1
+ export * from './JBOptionList.js';
2
+ export * from './JBSelect.js';
3
+ export * from './JBOption.js';
@@ -1,118 +1,2 @@
1
- import React, { useRef, useImperativeHandle, useEffect, useState } from 'react';
2
- import 'jb-select';
3
-
4
- /* eslint-disable react/display-name */
5
- const JBOptionList = React.forwardRef((props, ref) => {
6
- const element = useRef(null);
7
- useImperativeHandle(ref, () => (element ? element.current : undefined), [element]);
8
- useEffect(() => {
9
- if (element.current && Array.isArray(props.optionList)) {
10
- element.current.optionList = props.optionList;
11
- }
12
- }, [props.optionList, element]);
13
- useEffect(() => {
14
- if (element.current && typeof props.getTitle == "function") {
15
- element.current.setCallback("getTitle", props.getTitle);
16
- }
17
- }, [props.getTitle, element]);
18
- useEffect(() => {
19
- if (element.current && typeof props.getValue == "function") {
20
- element.current.setCallback("getValue", props.getValue);
21
- }
22
- }, [props.getValue, element]);
23
- useEffect(() => {
24
- if (element.current && typeof props.getContentDOM == "function") {
25
- element.current.setCallback("getContentDOM", props.getContentDOM);
26
- }
27
- }, [props.getContentDOM, element]);
28
- return (React.createElement("jb-option-list", { ref: element }));
29
- });
30
- JBOptionList.displayName = 'JBOptionList';
31
-
32
- function useBindEvent(ref, event, handler, passive = false) {
33
- useEffect(() => {
34
- const dom = ref.current;
35
- if (dom) {
36
- // initiate the event handler
37
- dom.addEventListener(event, handler, passive);
38
- }
39
- // this will clean up the event every time the component is re-rendered
40
- return function cleanup() {
41
- if (dom) {
42
- dom.removeEventListener(event, handler, passive);
43
- }
44
- };
45
- }, [ref, event, handler, passive]);
46
- }
47
-
48
- /* eslint-disable react/display-name */
49
- const JBSelect = React.forwardRef((props, ref) => {
50
- const element = useRef(null);
51
- const [refChangeCount, refChangeCountSetter] = useState(0);
52
- useImperativeHandle(ref, () => (element ? element.current : {}), [element]);
53
- useEffect(() => {
54
- refChangeCountSetter(refChangeCount + 1);
55
- }, [element.current]);
56
- useEffect(() => {
57
- if (element.current) {
58
- element.current.value = props.value;
59
- }
60
- }, [props.value]);
61
- useEffect(() => {
62
- if (typeof props.getSelectedValueDOM == "function" && element.current && element.current) {
63
- element.current.callbacks.getSelectedValueDOM = props.getSelectedValueDOM;
64
- }
65
- }, [props.getSelectedValueDOM]);
66
- useEffect(() => {
67
- if (props.message !== null && props.message !== undefined) {
68
- element.current?.setAttribute("message", props.message);
69
- }
70
- }, [props.message]);
71
- useEffect(() => {
72
- if (props.placeholder !== null && props.placeholder !== undefined) {
73
- element.current?.setAttribute("placeholder", props.placeholder);
74
- }
75
- }, [props.placeholder]);
76
- useEffect(() => {
77
- if (props.searchPlaceholder !== null && props.searchPlaceholder !== undefined) {
78
- element.current?.setAttribute("search-placeholder", props.searchPlaceholder);
79
- }
80
- }, [props.searchPlaceholder]);
81
- function onKeyup(e) {
82
- if (typeof props.onKeyup == "function") {
83
- props.onKeyup(e);
84
- }
85
- }
86
- function onChange(e) {
87
- if (typeof props.onChange == "function") {
88
- props.onChange(e);
89
- }
90
- }
91
- function onInput(e) {
92
- if (typeof props.onInput == "function") {
93
- props.onInput(e);
94
- }
95
- }
96
- useBindEvent(element, 'keyup', onKeyup);
97
- useBindEvent(element, 'change', onChange);
98
- useBindEvent(element, 'input', onInput);
99
- return (React.createElement("jb-select", { style: props.style ? props.style : undefined, class: props.className ? props.className : "", label: props.label, ref: element, required: props.required || 'false', name: props.name ?? undefined }, props.children));
100
- });
101
- JBSelect.displayName = 'JBSelect';
102
-
103
- /* eslint-disable react/display-name */
104
- const JBOption = React.forwardRef((props, ref) => {
105
- const element = useRef(null);
106
- const { value, children, className, ...rest } = props;
107
- useImperativeHandle(ref, () => (element ? element.current : undefined), [element]);
108
- useEffect(() => {
109
- if (element.current && value !== undefined) {
110
- element.current.value = value;
111
- }
112
- }, [value, element]);
113
- return (React.createElement("jb-option", { class: className, ref: element, ...rest }, children));
114
- });
115
- JBOption.displayName = 'JBOption';
116
-
117
- export { JBOption, JBOptionList, JBSelect };
118
- //# sourceMappingURL=index.js.map
1
+ import e,{useEffect as t,useImperativeHandle as r,useRef as l,useState as n}from"react";import"jb-select";import{useEvent as a}from"jb-core/react";let o=e.forwardRef((n,a)=>{let o=l(null);return r(a,()=>o?o.current:void 0,[o]),t(()=>{o.current&&Array.isArray(n.optionList)&&(o.current.optionList=n.optionList)},[n.optionList,o]),t(()=>{o.current&&"function"==typeof n.getTitle&&o.current.setCallback("getTitle",n.getTitle)},[n.getTitle,o]),t(()=>{o.current&&"function"==typeof n.getValue&&o.current.setCallback("getValue",n.getValue)},[n.getValue,o]),t(()=>{o.current&&"function"==typeof n.getContentDOM&&o.current.setCallback("getContentDOM",n.getContentDOM)},[n.getContentDOM,o]),e.createElement("jb-option-list",{ref:o})});o.displayName="JBOptionList";let c=e.forwardRef((o,c)=>{let u=l(null),[i,s]=n(0);return r(c,()=>u?u.current:{},[u]),t(()=>{s(i+1)},[u.current]),t(()=>{u.current&&(u.current.value=o.value)},[o.value]),t(()=>{"function"==typeof o.getSelectedValueDOM&&u.current&&u.current&&(u.current.callbacks.getSelectedValueDOM=o.getSelectedValueDOM)},[o.getSelectedValueDOM]),t(()=>{null!==o.message&&void 0!==o.message&&u.current?.setAttribute("message",o.message)},[o.message]),t(()=>{null!==o.placeholder&&void 0!==o.placeholder&&u.current?.setAttribute("placeholder",o.placeholder)},[o.placeholder]),t(()=>{null!==o.searchPlaceholder&&void 0!==o.searchPlaceholder&&u.current?.setAttribute("search-placeholder",o.searchPlaceholder)},[o.searchPlaceholder]),t(()=>{o.error?u?.current?.setAttribute("error",o.error):u?.current?.removeAttribute("error")},[o.error]),a(u,"load",o.onLoad,!0),a(u,"init",o.onInit,!0),a(u,"keyup",o.onKeyUp),a(u,"change",o.onChange),a(u,"input",o.onInput),e.createElement("jb-select",{style:o.style?o.style:void 0,class:o.className?o.className:"",label:o.label,ref:u,required:o.required||"false",name:o.name??void 0},o.children)});c.displayName="JBSelect";let u=e.forwardRef((n,a)=>{let o=l(null),{value:c,children:u,className:i,...s}=n;return r(a,()=>o?o.current:void 0,[o]),t(()=>{o.current&&void 0!==c&&(o.current.value=c)},[c,o]),e.createElement("jb-option",{class:i,ref:o,...s},u)});u.displayName="JBOption";export{u as JBOption,o as JBOptionList,c as JBSelect};
2
+ //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../lib/JBOptionList.tsx","../../../../common/hooks/use-event.ts","../lib/JBSelect.tsx","../lib/JBOption.tsx"],"sourcesContent":["/* 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 global {\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 { useEffect } from \"react\";\r\n\r\nexport function useEvent(dom:HTMLElement, event:any, handler:any, passive = false) {\r\n useEffect(() => {\r\n if (dom) {\r\n // initiate the event handler\r\n dom.addEventListener(event, handler, passive); \r\n }\r\n // this will clean up the event every time the component is re-rendered\r\n return function cleanup() {\r\n if(dom){\r\n dom.removeEventListener(event, handler, passive);\r\n }\r\n };\r\n });\r\n}\r\nexport function useBindEvent<TRef extends React.MutableRefObject<any|null>,TEvent>(ref:TRef, event:string, handler:(e:TEvent)=>void, passive = false) {\r\n useEffect(() => {\r\n const dom = ref.current;\r\n if (dom) {\r\n // initiate the event handler\r\n dom.addEventListener(event, handler, passive); \r\n }\r\n // this will clean up the event every time the component is re-rendered\r\n return function cleanup() {\r\n if(dom){\r\n dom.removeEventListener(event, handler, passive);\r\n }\r\n };\r\n },[ref,event,handler,passive]);\r\n}","/* eslint-disable react/display-name */\r\nimport React, { useEffect, useRef, useState, useImperativeHandle,CSSProperties } from 'react';\r\nimport 'jb-select';\r\nimport { useBindEvent } from '../../../../common/hooks/use-event.js';\r\n// eslint-disable-next-line no-duplicate-imports\r\nimport { JBSelectWebComponent } from 'jb-select';\r\nexport type JBSelectEventType<T> = T & {\r\n target: JBSelectWebComponent\r\n}\r\ndeclare global {\r\n // eslint-disable-next-line @typescript-eslint/no-namespace\r\n namespace JSX {\r\n interface IntrinsicElements {\r\n 'jb-select': JBSelectType;\r\n }\r\n interface JBSelectType extends React.DetailedHTMLProps<React.HTMLAttributes<JBSelectWebComponent>, JBSelectWebComponent> {\r\n class?:string,\r\n label?: string,\r\n name?:string,\r\n required?:string | boolean,\r\n message?:string,\r\n tabindex?:string,\r\n // ref:React.RefObject<JBDateInputWebComponent>,\r\n }\r\n }\r\n}\r\n\r\nexport const JBSelect = React.forwardRef((props:JBSelectProps, ref) => {\r\n const element = useRef<JBSelectWebComponent>(null);\r\n const [refChangeCount, refChangeCountSetter] = useState(0);\r\n useImperativeHandle(\r\n ref,\r\n () => (element ? element.current : {}),\r\n [element],\r\n );\r\n useEffect(() => {\r\n refChangeCountSetter(refChangeCount + 1);\r\n }, [element.current]);\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 useEffect(() => {\r\n if (props.message !== null && props.message !== undefined ) {\r\n element.current?.setAttribute(\"message\", props.message);\r\n }\r\n }, [props.message]);\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]);\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 function onKeyup(e:JBSelectEventType<KeyboardEvent>) {\r\n if ( typeof props.onKeyup == \"function\") {\r\n props.onKeyup(e);\r\n }\r\n }\r\n function onChange(e:JBSelectEventType<Event>) {\r\n if (typeof props.onChange ==\"function\") {\r\n props.onChange(e);\r\n }\r\n }\r\n function onInput(e:JBSelectEventType<InputEvent>) {\r\n if (typeof props.onInput == \"function\") {\r\n props.onInput(e);\r\n }\r\n }\r\n useBindEvent(element, 'keyup', onKeyup);\r\n useBindEvent(element, 'change', onChange);\r\n useBindEvent(element, 'input', onInput);\r\n return (\r\n <jb-select style={props.style?props.style:undefined} class={props.className?props.className:\"\"} label={props.label} ref={element} required={props.required || 'false'} name={props.name??undefined}>\r\n {props.children}\r\n </jb-select>\r\n );\r\n});\r\n\r\nexport type JBSelectProps = {\r\n style?:CSSProperties,\r\n label?: string,\r\n getSelectedValueDOM?: (option:any)=>HTMLElement,\r\n value?: any,\r\n onChange?: (e:JBSelectEventType<Event>)=>void,\r\n onKeyup?: (e:JBSelectEventType<KeyboardEvent>)=>void,\r\n onInput?: (e:JBSelectEventType<InputEvent>)=>void,\r\n required?: boolean,\r\n message?: string,\r\n placeholder?: string,\r\n searchPlaceholder?: string,\r\n className?: string,\r\n children?:React.ReactNode,\r\n name?:string\r\n}\r\nJBSelect.displayName = 'JBSelect';","/* eslint-disable react/display-name */\r\nimport React, { useEffect, useRef, useImperativeHandle, PropsWithChildren, ComponentProps } from 'react';\r\nimport { JBOptionWebComponent } from 'jb-select';\r\n//TODO: make it generic when remove forward ref\r\ntype TValue = any;\r\n\r\ndeclare global {\r\n // eslint-disable-next-line @typescript-eslint/no-namespace\r\n namespace JSX {\r\n interface IntrinsicElements {\r\n 'jb-option': JBOptionType;\r\n }\r\n interface JBOptionType extends React.DetailedHTMLProps<React.HTMLAttributes<JBOptionWebComponent<TValue>>, JBOptionWebComponent<TValue>> {\r\n class?: string,\r\n }\r\n }\r\n}\r\nexport const JBOption = React.forwardRef((props: JBOptionProps<TValue>, ref) => {\r\n const element = useRef<JBOptionWebComponent<TValue>>(null);\r\n const {value,children,className, ...rest} = props;\r\n useImperativeHandle(\r\n ref,\r\n () => (element ? element.current : undefined),\r\n [element],\r\n );\r\n \r\n useEffect(() => {\r\n if (element.current && value !== undefined) {\r\n element.current.value = value;\r\n }\r\n }, [value, element]);\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}\r\n\r\nexport type JBOptionProps<TValue> = PropsWithChildren<JSX.JBOptionType & Props<TValue>>\r\nJBOption.displayName = 'JBOption';"],"names":[],"mappings":";;;AAAA;AAmBO,MAAM,YAAY,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAwC,EAAE,GAAG,KAAI;AAC7F,IAAA,MAAM,OAAO,GAAG,MAAM,CAA4C,IAAI,CAAC,CAAC;IACxE,mBAAmB,CACjB,GAAG,EACH,OAAO,OAAO,GAAG,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,EAC7C,CAAC,OAAO,CAAC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EAAE,GAAG,IAAI,EAAC,GAAG,KAAK,CAAC;IAClD,mBAAmB,CACjB,GAAG,EACH,OAAO,OAAO,GAAG,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,EAC7C,CAAC,OAAO,CAAC,CACV,CAAC;IAEF,SAAS,CAAC,MAAK;AACb,QAAA,IAAI,OAAO,CAAC,OAAO,IAAI,KAAK,KAAK,SAAS,EAAE;AAC1C,YAAA,OAAO,CAAC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;AAC/B,SAAA;AACH,KAAC,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;AAErB,IAAA,QACE,KAAA,CAAA,aAAA,CAAA,WAAA,EAAA,EAAW,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,KAAM,IAAI,EAAA,EAChD,QAAQ,CACC,EACZ;AACJ,CAAC,EAAE;AAOH,QAAQ,CAAC,WAAW,GAAG,UAAU;;;;"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../lib/JBOptionList.tsx","../lib/events-hook.ts","../lib/JBSelect.tsx","../lib/JBOption.tsx"],"sourcesContent":["","","",""],"mappings":";;;;;MACY,6BAAuB,MAAA,WAAqB,CAAA,OAAM,QAAO;CAkBrE,MAAO,UAAM,OAAY,KAAG;AAC1B,qBAAgB,KAAkD,MAAK,UAAA,QAAA,UAAA,WAAA,CACvE,OAKA,EAAA;WACM,MAAA;MACF,QAAQ,WAAQ,MAAA,QAAa,MAAM,WAAU,CAC/C,SAAA,QAAA,aAAA,MAAA;CAEF,GAAA,CACE,MAAI;AAGN,WAAU,MAAA;AACV,MAAA,QAAe,kBAAA,MAAA,YAAA,WACT,SAAQ,QAAO,YAAW,YAAc,MAAI,SAAU;KAGxD,MAAM,UACV;WAEI,MAAA;AACF,MAAA,QAAA,kBAAA,MAAA,YAAA,WACE,SAAM,QAAa,YAAW,YAAA,MAAA,SAAA;CAKlC,GAAA,CAQF,MAAa;;;;;;;;;;ACzCP,SAAU,UAA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