@arkyn/components 3.0.1-beta.69 → 3.0.1-beta.70

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 (31) hide show
  1. package/dist/bundle.js +1791 -1583
  2. package/dist/bundle.umd.cjs +28 -28
  3. package/dist/components/select/index.d.ts +125 -0
  4. package/dist/components/select/index.d.ts.map +1 -0
  5. package/dist/components/select/index.js +168 -0
  6. package/dist/components/select/selectChevron/index.d.ts +11 -0
  7. package/dist/components/select/selectChevron/index.d.ts.map +1 -0
  8. package/dist/components/select/selectChevron/index.js +13 -0
  9. package/dist/components/select/selectContainer/index.d.ts +19 -0
  10. package/dist/components/select/selectContainer/index.d.ts.map +1 -0
  11. package/dist/components/select/selectContainer/index.js +11 -0
  12. package/dist/components/select/selectContent/index.d.ts +9 -0
  13. package/dist/components/select/selectContent/index.d.ts.map +1 -0
  14. package/dist/components/select/selectContent/index.js +8 -0
  15. package/dist/components/select/selectOption/index.d.ts +11 -0
  16. package/dist/components/select/selectOption/index.d.ts.map +1 -0
  17. package/dist/components/select/selectOption/index.js +10 -0
  18. package/dist/components/select/selectOptionsContainer/index.d.ts +12 -0
  19. package/dist/components/select/selectOptionsContainer/index.d.ts.map +1 -0
  20. package/dist/components/select/selectOptionsContainer/index.js +44 -0
  21. package/dist/components/select/selectOverlay/index.d.ts +8 -0
  22. package/dist/components/select/selectOverlay/index.d.ts.map +1 -0
  23. package/dist/components/select/selectOverlay/index.js +9 -0
  24. package/dist/components/select/selectSpinner/index.d.ts +8 -0
  25. package/dist/components/select/selectSpinner/index.d.ts.map +1 -0
  26. package/dist/components/select/selectSpinner/index.js +10 -0
  27. package/dist/index.d.ts +1 -0
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +1 -0
  30. package/dist/style.css +1 -1
  31. package/package.json +1 -1
@@ -0,0 +1,125 @@
1
+ import { LucideIcon } from "lucide-react";
2
+ import { FocusEvent } from "react";
3
+ type SelectProps = {
4
+ name: string;
5
+ options: {
6
+ label: string;
7
+ value: string;
8
+ }[];
9
+ id?: string;
10
+ value?: string;
11
+ defaultValue?: string;
12
+ showAsterisk?: boolean;
13
+ label?: string;
14
+ errorMessage?: string;
15
+ placeholder?: string;
16
+ notFoundText?: string;
17
+ className?: string;
18
+ disabled?: boolean;
19
+ readOnly?: boolean;
20
+ isLoading?: boolean;
21
+ isSearchable?: boolean;
22
+ closeOnSelect?: boolean;
23
+ onSearch?: (value: string) => void;
24
+ onChange?: (value: string) => void;
25
+ onFocus?: () => void;
26
+ onBlur?: (e: FocusEvent<HTMLDivElement>) => void;
27
+ size?: "md" | "lg";
28
+ variant?: "solid" | "outline" | "underline";
29
+ prefix?: string | LucideIcon;
30
+ leftIcon?: LucideIcon;
31
+ optionMaxHeight?: number;
32
+ };
33
+ /**
34
+ * Select component - used for selecting sle options from a dropdown list with support for search, labels, and validation
35
+ *
36
+ * @param props - Select component properties
37
+ * @param props.name - Required field name for form handling
38
+ * @param props.options - Array of options with label and value properties
39
+ * @param props.id - Optional unique identifier for the component
40
+ * @param props.value - Controlled value of selected option
41
+ * @param props.defaultValue - Default selected value. Default: ""
42
+ * @param props.showAsterisk - Whether to show asterisk on label for required fields
43
+ * @param props.label - Optional label text to display above the select
44
+ * @param props.errorMessage - Error message to display below the select
45
+ * @param props.placeholder - Placeholder text when no options are selected. Default: "Selecione..."
46
+ * @param props.notFoundText - Text to display when no options match search. Default: "Sem opções disponíveis"
47
+ * @param props.className - Additional CSS classes to apply
48
+ * @param props.disabled - Whether the select is disabled. Default: false
49
+ * @param props.readOnly - Whether the select is read-only. Default: false
50
+ * @param props.isLoading - Controls loading state with spinner. Default: false
51
+ * @param props.isSearchable - Whether the select supports search functionality. Default: false
52
+ * @param props.closeOnSelect - Whether to close dropdown after selecting an option. Default: false
53
+ * @param props.onSearch - Callback function called when search value changes
54
+ * @param props.onChange - Callback function called when selected value changes
55
+ * @param props.onFocus - Callback function called when select gains focus
56
+ * @param props.onBlur - Callback function called when select loses focus
57
+ * @param props.size - Select size. Default: "md"
58
+ * @param props.variant - Visual variant of the select. Default: "solid"
59
+ * @param props.prefix - Text or icon to display at the beginning of the select
60
+ * @param props.leftIcon - Optional icon to display on the left side
61
+ * @param props.optionMaxHeight - Maximum height for the options dropdown
62
+ *
63
+ * @returns Select JSX element wrapped in FieldWrapper with optional label and error
64
+ *
65
+ * @example
66
+ * ```tsx
67
+ * // Basic select
68
+ * <Select
69
+ * name="category:"
70
+ * options={[
71
+ * { label: "Technology", value: "tech" },
72
+ * { label: "Design", value: "design" },
73
+ * { label: "Marketing", value: "marketing" }
74
+ * ]}
75
+ * />
76
+ *
77
+ * // Select with label and validation
78
+ * <Select
79
+ * name="skill"
80
+ * label="Select your skill:"
81
+ * showAsterisk
82
+ * errorMessage="Please select at least one skill"
83
+ * options={skillOptions}
84
+ * placeholder="Choose your skills..."
85
+ * />
86
+ *
87
+ * // Searchable select with custom styling
88
+ * <Select
89
+ * name="country"
90
+ * label="Country:"
91
+ * isSearchable
92
+ * variant="outline"
93
+ * size="lg"
94
+ * leftIcon={GlobeIcon}
95
+ * options={countryOptions}
96
+ * notFoundText="No countries found"
97
+ * />
98
+ *
99
+ * // Controlled select with callbacks
100
+ * <Select
101
+ * name="tag"
102
+ * label="Tag:"
103
+ * value={selectedTag}
104
+ * onChange={setSelectedTag}
105
+ * onSearch={handleSearch}
106
+ * closeOnSelect={false}
107
+ * isLoading={isLoadingTags}
108
+ * options={tagOptions}
109
+ * />
110
+ *
111
+ * // Select with prefix and custom behavior
112
+ * <Select
113
+ * name="department"
114
+ * label="Department:"
115
+ * prefix="Dept:"
116
+ * closeOnSelect={true}
117
+ * variant="underline"
118
+ * defaultValue="hr"
119
+ * options={departmentOptions}
120
+ * />
121
+ * ```
122
+ */
123
+ declare function Select(props: SelectProps): import("react/jsx-runtime").JSX.Element;
124
+ export { Select };
125
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sour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7B,QAAQ,CAAC,EAAE,UAAU,CAAC;IAEtB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyFG;AAEH,iBAAS,MAAM,CAAC,KAAK,EAAE,WAAW,2CAkKjC;AAED,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -0,0 +1,168 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useId, useRef, useState } from "react";
3
+ import { useForm } from "../../hooks/useForm";
4
+ import { IconRenderer } from "../../services/iconRenderer";
5
+ import { FieldError } from "../fieldError";
6
+ import { FieldLabel } from "../fieldLabel";
7
+ import { FieldWrapper } from "../fieldWrapper";
8
+ import { SelectChevron } from "./selectChevron";
9
+ import { SelectContainer } from "./selectContainer";
10
+ import { SelectContent } from "./selectContent";
11
+ import { SelectOption } from "./selectOption";
12
+ import { SelectOptionsContainer } from "./selectOptionsContainer";
13
+ import { SelectOverlay } from "./selectOverlay";
14
+ import { SelectSpinner } from "./selectSpinner";
15
+ /**
16
+ * Select component - used for selecting sle options from a dropdown list with support for search, labels, and validation
17
+ *
18
+ * @param props - Select component properties
19
+ * @param props.name - Required field name for form handling
20
+ * @param props.options - Array of options with label and value properties
21
+ * @param props.id - Optional unique identifier for the component
22
+ * @param props.value - Controlled value of selected option
23
+ * @param props.defaultValue - Default selected value. Default: ""
24
+ * @param props.showAsterisk - Whether to show asterisk on label for required fields
25
+ * @param props.label - Optional label text to display above the select
26
+ * @param props.errorMessage - Error message to display below the select
27
+ * @param props.placeholder - Placeholder text when no options are selected. Default: "Selecione..."
28
+ * @param props.notFoundText - Text to display when no options match search. Default: "Sem opções disponíveis"
29
+ * @param props.className - Additional CSS classes to apply
30
+ * @param props.disabled - Whether the select is disabled. Default: false
31
+ * @param props.readOnly - Whether the select is read-only. Default: false
32
+ * @param props.isLoading - Controls loading state with spinner. Default: false
33
+ * @param props.isSearchable - Whether the select supports search functionality. Default: false
34
+ * @param props.closeOnSelect - Whether to close dropdown after selecting an option. Default: false
35
+ * @param props.onSearch - Callback function called when search value changes
36
+ * @param props.onChange - Callback function called when selected value changes
37
+ * @param props.onFocus - Callback function called when select gains focus
38
+ * @param props.onBlur - Callback function called when select loses focus
39
+ * @param props.size - Select size. Default: "md"
40
+ * @param props.variant - Visual variant of the select. Default: "solid"
41
+ * @param props.prefix - Text or icon to display at the beginning of the select
42
+ * @param props.leftIcon - Optional icon to display on the left side
43
+ * @param props.optionMaxHeight - Maximum height for the options dropdown
44
+ *
45
+ * @returns Select JSX element wrapped in FieldWrapper with optional label and error
46
+ *
47
+ * @example
48
+ * ```tsx
49
+ * // Basic select
50
+ * <Select
51
+ * name="category:"
52
+ * options={[
53
+ * { label: "Technology", value: "tech" },
54
+ * { label: "Design", value: "design" },
55
+ * { label: "Marketing", value: "marketing" }
56
+ * ]}
57
+ * />
58
+ *
59
+ * // Select with label and validation
60
+ * <Select
61
+ * name="skill"
62
+ * label="Select your skill:"
63
+ * showAsterisk
64
+ * errorMessage="Please select at least one skill"
65
+ * options={skillOptions}
66
+ * placeholder="Choose your skills..."
67
+ * />
68
+ *
69
+ * // Searchable select with custom styling
70
+ * <Select
71
+ * name="country"
72
+ * label="Country:"
73
+ * isSearchable
74
+ * variant="outline"
75
+ * size="lg"
76
+ * leftIcon={GlobeIcon}
77
+ * options={countryOptions}
78
+ * notFoundText="No countries found"
79
+ * />
80
+ *
81
+ * // Controlled select with callbacks
82
+ * <Select
83
+ * name="tag"
84
+ * label="Tag:"
85
+ * value={selectedTag}
86
+ * onChange={setSelectedTag}
87
+ * onSearch={handleSearch}
88
+ * closeOnSelect={false}
89
+ * isLoading={isLoadingTags}
90
+ * options={tagOptions}
91
+ * />
92
+ *
93
+ * // Select with prefix and custom behavior
94
+ * <Select
95
+ * name="department"
96
+ * label="Department:"
97
+ * prefix="Dept:"
98
+ * closeOnSelect={true}
99
+ * variant="underline"
100
+ * defaultValue="hr"
101
+ * options={departmentOptions}
102
+ * />
103
+ * ```
104
+ */
105
+ function Select(props) {
106
+ const { name, options, className = "", placeholder = "Selecione...", closeOnSelect = false, defaultValue = "", errorMessage: baseErrorMessage, isLoading = false, readOnly = false, isSearchable = false, id, label, optionMaxHeight, showAsterisk, leftIcon: LeftIcon, onSearch, onChange, onBlur, notFoundText = "Sem opções disponíveis", onFocus, disabled: baseDisabled = false, prefix, size = "md", value, variant = "solid", } = props;
107
+ const { fieldErrors } = useForm();
108
+ const selectRef = useRef(null);
109
+ const selectId = id || useId();
110
+ const errorMessage = baseErrorMessage || fieldErrors?.[name];
111
+ const isError = !!errorMessage;
112
+ const disabled = baseDisabled || isLoading || readOnly;
113
+ const iconSizes = { md: 20, lg: 20 };
114
+ const iconSize = iconSizes[size];
115
+ const [search, setSearch] = useState("");
116
+ const [isFocused, setIsFocused] = useState(false);
117
+ const [selectedOptions, setSelectedOptions] = useState(defaultValue);
118
+ const forceSelectedOptions = value || selectedOptions;
119
+ function optionHasSelected(value) {
120
+ return forceSelectedOptions === value;
121
+ }
122
+ function getOptionLabel(value) {
123
+ const option = options.find((option) => option.value === value);
124
+ return option?.label || "";
125
+ }
126
+ function handleContainerFocus() {
127
+ if (disabled || !selectRef?.current || isFocused)
128
+ return;
129
+ setIsFocused(true);
130
+ selectRef.current.focus();
131
+ onFocus && onFocus();
132
+ }
133
+ function handleBlur() {
134
+ setIsFocused(false);
135
+ if (onBlur && selectRef.current)
136
+ selectRef.current.blur();
137
+ }
138
+ function handleSearch(value) {
139
+ setSearch(value);
140
+ if (onSearch)
141
+ onSearch(value);
142
+ }
143
+ function handleChangeValue(value) {
144
+ if (optionHasSelected(value)) {
145
+ setSelectedOptions("");
146
+ if (onChange)
147
+ onChange("");
148
+ }
149
+ else {
150
+ setSelectedOptions(value);
151
+ if (onChange)
152
+ onChange(value);
153
+ }
154
+ if (closeOnSelect)
155
+ handleBlur();
156
+ }
157
+ const mappedOptions = options.filter((option) => {
158
+ if (props.onSearch)
159
+ return true;
160
+ if (!props.isSearchable)
161
+ return true;
162
+ if (option.label.toLowerCase().includes(search.toLowerCase()))
163
+ return true;
164
+ return false;
165
+ });
166
+ return (_jsxs(FieldWrapper, { children: [label && _jsx(FieldLabel, { showAsterisk: showAsterisk, children: label }), _jsxs(SelectContainer, { handleContainerFocus: handleContainerFocus, disabled: disabled, isError: isError, isFocused: isFocused, isLoading: isLoading, readOnly: readOnly, size: size, variant: variant, className: className, prefixExists: !!prefix, id: selectId, children: [_jsx("input", { ref: selectRef, name: name, value: JSON.stringify(forceSelectedOptions), type: "hidden" }), _jsx(IconRenderer, { iconSize: iconSize, icon: prefix, className: "prefix" }), LeftIcon && _jsx(LeftIcon, { size: iconSize, strokeWidth: 2.5 }), _jsxs(SelectContent, { size: size, children: [forceSelectedOptions !== "" && (_jsx("p", { children: getOptionLabel(forceSelectedOptions) })), forceSelectedOptions === "" && _jsx("p", { children: placeholder })] }), _jsxs(SelectOptionsContainer, { isFocused: isFocused, isSearchable: isSearchable, search: search, onSearch: handleSearch, children: [mappedOptions.map(({ label, value }) => (_jsx(SelectOption, { label: label, value: value, size: size, handleChangeValue: handleChangeValue, optionHasSelected: optionHasSelected }, value))), mappedOptions.length <= 0 && _jsx("p", { children: notFoundText })] }), _jsx(SelectChevron, { disabled: disabled, isFocused: isFocused, readOnly: readOnly, iconSize: iconSize, isLoading: isLoading }), _jsx(SelectSpinner, { iconSize: iconSize, isLoading: isLoading }), _jsx(SelectOverlay, { handleBlur: handleBlur, isFocused: isFocused })] }), errorMessage && _jsx(FieldError, { children: errorMessage })] }));
167
+ }
168
+ export { Select };
@@ -0,0 +1,11 @@
1
+ import "./styles.css";
2
+ type SelectChevronProps = {
3
+ isLoading: boolean;
4
+ iconSize: number;
5
+ disabled: boolean;
6
+ readOnly: boolean;
7
+ isFocused: boolean;
8
+ };
9
+ declare function SelectChevron(props: SelectChevronProps): import("react/jsx-runtime").JSX.Element;
10
+ export { SelectChevron };
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/select/selectChevron/index.tsx"],"names":[],"mappings":"AACA,OAAO,cAAc,CAAC;AAEtB,KAAK,kBAAkB,GAAG;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,iBAAS,aAAa,CAAC,KAAK,EAAE,kBAAkB,2CAY/C;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
+ import { ChevronDown } from "lucide-react";
3
+ import "./styles.css";
4
+ function SelectChevron(props) {
5
+ const { iconSize, isLoading, disabled, readOnly, isFocused } = props;
6
+ const notAnimate = disabled || readOnly ? "notAnimate" : "";
7
+ const focused = isFocused ? "focused" : "";
8
+ const className = `arkynSelectChevron ${notAnimate} ${focused}`;
9
+ if (isLoading)
10
+ return _jsx(_Fragment, {});
11
+ return (_jsx(ChevronDown, { className: className, size: iconSize, strokeWidth: 2.5 }));
12
+ }
13
+ export { SelectChevron };
@@ -0,0 +1,19 @@
1
+ import { ReactNode } from "react";
2
+ import "./styles.css";
3
+ type SelectContainerProps = {
4
+ children: ReactNode;
5
+ handleContainerFocus: () => void;
6
+ prefixExists: boolean;
7
+ isError: boolean;
8
+ disabled: boolean;
9
+ readOnly: boolean;
10
+ isLoading: boolean;
11
+ isFocused: boolean;
12
+ className?: string;
13
+ id: string;
14
+ variant: "solid" | "outline" | "underline";
15
+ size: "md" | "lg";
16
+ };
17
+ declare function SelectContainer(props: SelectContainerProps): import("react/jsx-runtime").JSX.Element;
18
+ export { SelectContainer };
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/select/selectContainer/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,cAAc,CAAC;AAEtB,KAAK,oBAAoB,GAAG;IAC1B,QAAQ,EAAE,SAAS,CAAC;IACpB,oBAAoB,EAAE,MAAM,IAAI,CAAC;IACjC,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,WAAW,CAAC;IAC3C,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;CACnB,CAAC;AAEF,iBAAS,eAAe,CAAC,KAAK,EAAE,oBAAoB,2CA8BnD;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "./styles.css";
3
+ function SelectContainer(props) {
4
+ const { children, handleContainerFocus, disabled, isError, isLoading, isFocused, className, readOnly, variant, size, id, prefixExists, } = props;
5
+ const hasPrefix = prefixExists ? "hasPrefix" : "";
6
+ const errored = isError ? "errored" : "";
7
+ const opacity = disabled || readOnly || isLoading ? "opacity" : "";
8
+ const focused = isFocused ? "focused" : "";
9
+ return (_jsx("section", { id: id, className: `arkynSelectContainer ${hasPrefix} ${variant} ${size} ${opacity} ${errored} ${focused} ${className}`, onClick: handleContainerFocus, children: children }));
10
+ }
11
+ export { SelectContainer };
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from "react";
2
+ import "./styles.css";
3
+ type SelectContentProps = {
4
+ children: ReactNode;
5
+ size: "md" | "lg";
6
+ };
7
+ declare function SelectContent(props: SelectContentProps): import("react/jsx-runtime").JSX.Element;
8
+ export { SelectContent };
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/select/selectContent/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,cAAc,CAAC;AAEtB,KAAK,kBAAkB,GAAG;IACxB,QAAQ,EAAE,SAAS,CAAC;IACpB,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;CACnB,CAAC;AAEF,iBAAS,aAAa,CAAC,KAAK,EAAE,kBAAkB,2CAI/C;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "./styles.css";
3
+ function SelectContent(props) {
4
+ const { children, size } = props;
5
+ const className = `arkynSelectContent ${size}`;
6
+ return _jsx("div", { className: className, children: children });
7
+ }
8
+ export { SelectContent };
@@ -0,0 +1,11 @@
1
+ import "./styles.css";
2
+ type SelectOptionProps = {
3
+ value: string;
4
+ label: string;
5
+ size: "md" | "lg";
6
+ optionHasSelected: (value: string) => boolean;
7
+ handleChangeValue: (value: string) => void;
8
+ };
9
+ declare function SelectOption(props: SelectOptionProps): import("react/jsx-runtime").JSX.Element;
10
+ export { SelectOption };
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/select/selectOption/index.tsx"],"names":[],"mappings":"AACA,OAAO,cAAc,CAAC;AAEtB,KAAK,iBAAiB,GAAG;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;IAC9C,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C,CAAC;AAEF,iBAAS,YAAY,CAAC,KAAK,EAAE,iBAAiB,2CAW7C;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Check } from "lucide-react";
3
+ import "./styles.css";
4
+ function SelectOption(props) {
5
+ const { label, optionHasSelected, handleChangeValue, value, size } = props;
6
+ const hasActive = optionHasSelected(value) ? "active" : "";
7
+ const className = `arkynSelectOption ${size} ${hasActive}`;
8
+ return (_jsxs("div", { onClick: () => handleChangeValue(value), className: className, children: [label, " ", _jsx(Check, {})] }));
9
+ }
10
+ export { SelectOption };
@@ -0,0 +1,12 @@
1
+ import { ReactNode } from "react";
2
+ import "./styles.css";
3
+ type SelectOptionsContainerProps = {
4
+ isFocused: boolean;
5
+ isSearchable: boolean;
6
+ children: ReactNode;
7
+ search: string;
8
+ onSearch: (value: string) => void;
9
+ };
10
+ declare function SelectOptionsContainer(props: SelectOptionsContainerProps): import("react/jsx-runtime").JSX.Element;
11
+ export { SelectOptionsContainer };
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/select/selectOptionsContainer/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAe,SAAS,EAA+B,MAAM,OAAO,CAAC;AAK5E,OAAO,cAAc,CAAC;AAEtB,KAAK,2BAA2B,GAAG;IACjC,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;IACtB,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC,CAAC;AAEF,iBAAS,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,2CA8DjE;AAED,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
@@ -0,0 +1,44 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Search } from "lucide-react";
3
+ import { useEffect, useRef, useState } from "react";
4
+ import { useScrollLock } from "../../../hooks/useScrollLock";
5
+ import { Input } from "../../input";
6
+ import "./styles.css";
7
+ function SelectOptionsContainer(props) {
8
+ const { children, isFocused, isSearchable, search, onSearch } = props;
9
+ const containerRef = useRef(null);
10
+ const [position, setPosition] = useState("bottom");
11
+ useScrollLock(isFocused);
12
+ useEffect(() => {
13
+ if (!isFocused)
14
+ return;
15
+ const checkContainerPosition = () => {
16
+ if (!containerRef.current)
17
+ return;
18
+ const parentElement = containerRef.current.parentElement;
19
+ if (!parentElement)
20
+ return;
21
+ const parentRect = parentElement.getBoundingClientRect();
22
+ const viewportHeight = window.innerHeight;
23
+ const estimatedContainerHeight = 300;
24
+ const spaceBelow = viewportHeight - parentRect.bottom;
25
+ if (spaceBelow < estimatedContainerHeight &&
26
+ parentRect.top > estimatedContainerHeight) {
27
+ setPosition("top");
28
+ }
29
+ else {
30
+ setPosition("bottom");
31
+ }
32
+ };
33
+ checkContainerPosition();
34
+ }, [isFocused]);
35
+ function handleSearch(e) {
36
+ if (!isSearchable)
37
+ return;
38
+ onSearch(e.target.value);
39
+ }
40
+ if (!isFocused)
41
+ return _jsx(_Fragment, {});
42
+ return (_jsxs("div", { ref: containerRef, className: `arkynSelectOptionsContainer ${position}`, children: [isSearchable && (_jsx(Input, { type: "search", name: "search-select", variant: "underline", leftIcon: Search, value: search, onChange: handleSearch })), children] }));
43
+ }
44
+ export { SelectOptionsContainer };
@@ -0,0 +1,8 @@
1
+ import "./styles.css";
2
+ type SelectOverlayProps = {
3
+ isFocused: boolean;
4
+ handleBlur: () => void;
5
+ };
6
+ declare function SelectOverlay(props: SelectOverlayProps): import("react/jsx-runtime").JSX.Element;
7
+ export { SelectOverlay };
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/select/selectOverlay/index.tsx"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAEtB,KAAK,kBAAkB,GAAG;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB,CAAC;AAEF,iBAAS,aAAa,CAAC,KAAK,EAAE,kBAAkB,2CAI/C;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
+ import "./styles.css";
3
+ function SelectOverlay(props) {
4
+ const { isFocused, handleBlur } = props;
5
+ if (!isFocused)
6
+ return _jsx(_Fragment, {});
7
+ return _jsx("aside", { className: "arkynSelectOverlay", onClick: handleBlur });
8
+ }
9
+ export { SelectOverlay };
@@ -0,0 +1,8 @@
1
+ import "./styles.css";
2
+ type SelectSpinnerProps = {
3
+ iconSize: number;
4
+ isLoading: boolean;
5
+ };
6
+ declare function SelectSpinner(props: SelectSpinnerProps): import("react/jsx-runtime").JSX.Element;
7
+ export { SelectSpinner };
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/select/selectSpinner/index.tsx"],"names":[],"mappings":"AACA,OAAO,cAAc,CAAC;AAEtB,KAAK,kBAAkB,GAAG;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,iBAAS,aAAa,CAAC,KAAK,EAAE,kBAAkB,2CAO/C;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
+ import { Loader2 } from "lucide-react";
3
+ import "./styles.css";
4
+ function SelectSpinner(props) {
5
+ const { iconSize, isLoading } = props;
6
+ if (!isLoading)
7
+ return _jsx(_Fragment, {});
8
+ return (_jsx(Loader2, { className: "arkynSelectSpinner", size: iconSize, strokeWidth: 2.5 }));
9
+ }
10
+ export { SelectSpinner };
package/dist/index.d.ts CHANGED
@@ -31,6 +31,7 @@ export { PhoneInput } from "./components/phoneInput";
31
31
  export { Popover } from "./components/popover";
32
32
  export { RadioBox } from "./components/radio/radioBox";
33
33
  export { RadioGroup } from "./components/radio/radioGroup";
34
+ export { Select } from "./components/select";
34
35
  export { Slider } from "./components/slider";
35
36
  export { Switch } from "./components/switch";
36
37
  export { TabButton } from "./components/tab/tabButton";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,OAAO,EA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AAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAG1D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC"}
package/dist/index.js CHANGED
@@ -32,6 +32,7 @@ export { PhoneInput } from "./components/phoneInput";
32
32
  export { Popover } from "./components/popover";
33
33
  export { RadioBox } from "./components/radio/radioBox";
34
34
  export { RadioGroup } from "./components/radio/radioGroup";
35
+ export { Select } from "./components/select";
35
36
  export { Slider } from "./components/slider";
36
37
  export { Switch } from "./components/switch";
37
38
  export { TabButton } from "./components/tab/tabButton";