@arkyn/components 1.3.143 → 1.3.145
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/bundle.js +33678 -11526
- package/dist/bundle.umd.cjs +658 -108
- package/dist/components/ImageUpload/HasFileContent/index.js +1 -1
- package/dist/components/Select/getConfig.d.ts +2 -0
- package/dist/components/Select/getConfig.d.ts.map +1 -1
- package/dist/components/Select/index.d.ts.map +1 -1
- package/dist/components/Select/index.js +16 -4
- package/package.json +1 -1
- package/src/components/ImageUpload/HasFileContent/index.tsx +1 -1
- package/src/components/Select/getConfig.tsx +0 -1
- package/src/components/Select/index.tsx +37 -16
@@ -15,6 +15,6 @@ function HasFileContent(props) {
|
|
15
15
|
};
|
16
16
|
input.click();
|
17
17
|
}
|
18
|
-
return (_jsxs("div", { className: "arkynImageUploadHasFileContent", style: { backgroundImage: `url(${filePath})` }, children: [reSendImage && (_jsx(Tooltip, { orientation: "bottom", text: "Reenviar imagem", children: _jsx(IconButton, { type: "button", "aria-label": "resend image", variant: "outline", scheme: "danger", size: "sm", isLoading: isLoading, onClick: reSendImage, icon: RefreshCw }) })), _jsx(Button, { isLoading: isLoading, onClick: handleClick, variant: "outline", size: "sm", type: "button", children: changeImageButtonText })] }));
|
18
|
+
return (_jsxs("div", { className: "arkynImageUploadHasFileContent", style: { backgroundImage: `url("${filePath}")` }, children: [reSendImage && (_jsx(Tooltip, { orientation: "bottom", text: "Reenviar imagem", children: _jsx(IconButton, { type: "button", "aria-label": "resend image", variant: "outline", scheme: "danger", size: "sm", isLoading: isLoading, onClick: reSendImage, icon: RefreshCw }) })), _jsx(Button, { isLoading: isLoading, onClick: handleClick, variant: "outline", size: "sm", type: "button", children: changeImageButtonText })] }));
|
19
19
|
}
|
20
20
|
export { HasFileContent };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getConfig.d.ts","sourceRoot":"","sources":["../../../src/components/Select/getConfig.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAK3C,iBAAS,SAAS,CAAC,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO
|
1
|
+
{"version":3,"file":"getConfig.d.ts","sourceRoot":"","sources":["../../../src/components/Select/getConfig.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAK3C,iBAAS,SAAS,CAAC,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2CxD;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Select/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Select/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAUhD,OAAO,cAAc,CAAC;AAEtB,iBAAS,MAAM,CAAC,KAAK,EAAE,WAAW,2CAgKjC;AAED,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
@@ -1,16 +1,18 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
2
|
-
import { Check, ChevronDown } from "lucide-react";
|
2
|
+
import { Check, ChevronDown, Search } from "lucide-react";
|
3
3
|
import { useRef, useState } from "react";
|
4
4
|
import { getConfig } from "./getConfig";
|
5
|
-
import "./styles.css";
|
6
5
|
import { useFormController } from "../../components/Form/FormController";
|
6
|
+
import { Input } from "../Input";
|
7
|
+
import "./styles.css";
|
7
8
|
function Select(props) {
|
9
|
+
const [search, setSearch] = useState("");
|
8
10
|
const [isFocused, setIsFocused] = useState(false);
|
9
11
|
const { inputRef, id, error } = useFormController();
|
10
12
|
const baseRef = useRef(null);
|
11
13
|
const ref = inputRef || baseRef;
|
12
14
|
const isError = props.isError || !!error;
|
13
|
-
const { disabled, title, style, className, prefix, iconSize, isLoading, LeftIcon, value: baseValue = null, defaultValue = "", onFocus, onBlur, Spinner, name, placeholder, onSelect, options, optionMaxHeight, closeOnSelect, ...rest } = getConfig({ ...props, id, isError }, isFocused);
|
15
|
+
const { disabled, title, style, className, prefix, iconSize, isLoading, LeftIcon, value: baseValue = null, defaultValue = "", onFocus, onBlur, Spinner, name, placeholder, onSelect, options, optionMaxHeight, closeOnSelect, isSearchable, onSearch, ...rest } = getConfig({ ...props, id, isError }, isFocused);
|
14
16
|
const [selectedValue, setSelectedValue] = useState(defaultValue);
|
15
17
|
function handleSectionClick() {
|
16
18
|
if (disabled || !ref?.current || isFocused)
|
@@ -53,7 +55,17 @@ function Select(props) {
|
|
53
55
|
if (isFocused && !currentLabel)
|
54
56
|
return false;
|
55
57
|
};
|
56
|
-
return (_jsxs(_Fragment, { children: [_jsxs("section", { title: title, style: style, onClick: handleSectionClick, className: `${className} placeholder_dark_${placeholderDark()}`, children: [prefix, LeftIcon && _jsx(LeftIcon, { size: iconSize, strokeWidth: 2.5 }), _jsx("input", { disabled: disabled, readOnly: true, placeholder: currentLabel || placeholder, onFocus: handleFocus, ...rest }), _jsx("input", { type: "hidden", ref: ref, name: name, value: currentValue || "", readOnly: true }), isFocused && (_jsxs("div", { className: "arkyn_select_content", style: { overflow: "auto", maxHeight: optionMaxHeight }, children: [
|
58
|
+
return (_jsxs(_Fragment, { children: [_jsxs("section", { title: title, style: style, onClick: handleSectionClick, className: `${className} placeholder_dark_${placeholderDark()}`, children: [prefix, LeftIcon && _jsx(LeftIcon, { size: iconSize, strokeWidth: 2.5 }), _jsx("input", { disabled: disabled, readOnly: true, placeholder: currentLabel || placeholder, onFocus: handleFocus, ...rest }), _jsx("input", { type: "hidden", ref: ref, name: name, value: currentValue || "", readOnly: true }), isFocused && (_jsxs("div", { className: "arkyn_select_content", style: { overflow: "auto", maxHeight: optionMaxHeight }, children: [isSearchable && (_jsx(Input, { type: "search", name: "search-select", variant: "underline", leftIcon: Search, onChange: (e) => setSearch(e.target.value) })), options
|
59
|
+
.filter((option) => {
|
60
|
+
if (props.onSearch)
|
61
|
+
return true;
|
62
|
+
if (!props.isSearchable)
|
63
|
+
return true;
|
64
|
+
if (option.label.toLowerCase().includes(search.toLowerCase()))
|
65
|
+
return true;
|
66
|
+
return false;
|
67
|
+
})
|
68
|
+
.map(({ label, value }) => (_jsxs("div", { onClick: () => handleChangeValue({ label, value }), className: currentValue === value
|
57
69
|
? "arkyn_select_option active"
|
58
70
|
: "arkyn_select_option", children: [label, " ", _jsx(Check, {})] }, value))), options.length <= 0 && _jsx("p", { children: "Sem op\u00E7\u00F5es dispon\u00EDveis" })] })), !isLoading && (_jsx(ChevronDown, { className: "arkyn_select_arrow", size: iconSize, strokeWidth: 2.5 })), isLoading && Spinner] }), isFocused && (_jsx("aside", { className: "arkyn_select_overlay", onClick: handleBlur }))] }));
|
59
71
|
}
|
package/package.json
CHANGED
@@ -31,7 +31,7 @@ function HasFileContent(props: HasFileContentProps) {
|
|
31
31
|
return (
|
32
32
|
<div
|
33
33
|
className="arkynImageUploadHasFileContent"
|
34
|
-
style={{ backgroundImage: `url(${filePath})` }}
|
34
|
+
style={{ backgroundImage: `url("${filePath}")` }}
|
35
35
|
>
|
36
36
|
{reSendImage && (
|
37
37
|
<Tooltip orientation="bottom" text="Reenviar imagem">
|
@@ -1,15 +1,17 @@
|
|
1
1
|
import type { SelectProps } from "@arkyn/types";
|
2
2
|
import type { FocusEvent } from "react";
|
3
3
|
|
4
|
-
import { Check, ChevronDown } from "lucide-react";
|
4
|
+
import { Check, ChevronDown, Search } from "lucide-react";
|
5
5
|
import { useRef, useState } from "react";
|
6
6
|
|
7
7
|
import { getConfig } from "./getConfig";
|
8
8
|
|
9
|
-
import "./styles.css";
|
10
9
|
import { useFormController } from "../../components/Form/FormController";
|
10
|
+
import { Input } from "../Input";
|
11
|
+
import "./styles.css";
|
11
12
|
|
12
13
|
function Select(props: SelectProps) {
|
14
|
+
const [search, setSearch] = useState("");
|
13
15
|
const [isFocused, setIsFocused] = useState(false);
|
14
16
|
const { inputRef, id, error } = useFormController();
|
15
17
|
|
@@ -38,7 +40,8 @@ function Select(props: SelectProps) {
|
|
38
40
|
options,
|
39
41
|
optionMaxHeight,
|
40
42
|
closeOnSelect,
|
41
|
-
|
43
|
+
isSearchable,
|
44
|
+
onSearch,
|
42
45
|
...rest
|
43
46
|
} = getConfig({ ...props, id, isError }, isFocused);
|
44
47
|
|
@@ -116,19 +119,37 @@ function Select(props: SelectProps) {
|
|
116
119
|
className="arkyn_select_content"
|
117
120
|
style={{ overflow: "auto", maxHeight: optionMaxHeight }}
|
118
121
|
>
|
119
|
-
{
|
120
|
-
<
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
122
|
+
{isSearchable && (
|
123
|
+
<Input
|
124
|
+
type="search"
|
125
|
+
name="search-select"
|
126
|
+
variant="underline"
|
127
|
+
leftIcon={Search}
|
128
|
+
onChange={(e) => setSearch(e.target.value)}
|
129
|
+
/>
|
130
|
+
)}
|
131
|
+
|
132
|
+
{options
|
133
|
+
.filter((option) => {
|
134
|
+
if (props.onSearch) return true;
|
135
|
+
if (!props.isSearchable) return true;
|
136
|
+
if (option.label.toLowerCase().includes(search.toLowerCase()))
|
137
|
+
return true;
|
138
|
+
return false;
|
139
|
+
})
|
140
|
+
.map(({ label, value }) => (
|
141
|
+
<div
|
142
|
+
key={value}
|
143
|
+
onClick={() => handleChangeValue({ label, value })}
|
144
|
+
className={
|
145
|
+
currentValue === value
|
146
|
+
? "arkyn_select_option active"
|
147
|
+
: "arkyn_select_option"
|
148
|
+
}
|
149
|
+
>
|
150
|
+
{label} <Check />
|
151
|
+
</div>
|
152
|
+
))}
|
132
153
|
|
133
154
|
{options.length <= 0 && <p>Sem opções disponíveis</p>}
|
134
155
|
</div>
|