@purr-react-styled-components/components.select 0.0.6 → 0.0.8
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/package.json +11 -11
- package/dist/_components/_menu.d.ts +0 -4
- package/dist/_components/_option.d.ts +0 -4
- package/dist/_components/index.d.ts +0 -4
- package/dist/_menu-CSgQeF40.js +0 -29
- package/dist/_menu-Mw9ayM10.cjs +0 -1
- package/dist/_style.d.ts +0 -35
- package/dist/_types.d.ts +0 -51
- package/dist/index-CiHv3F2P.js +0 -142
- package/dist/index-W-_2mM5B.cjs +0 -1
- package/dist/index.cjs +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@purr-react-styled-components/components.select",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -26,16 +26,14 @@
|
|
|
26
26
|
"styled-components": "*",
|
|
27
27
|
"clsx": "*",
|
|
28
28
|
"react-hook-form": "*",
|
|
29
|
-
"@purr-react-styled-components/components.
|
|
30
|
-
"@purr-react-styled-components/
|
|
31
|
-
"@purr-
|
|
32
|
-
"@purr-react-styled-components/
|
|
33
|
-
"@purr-core/
|
|
34
|
-
"@purr-
|
|
35
|
-
"@purr-core/
|
|
36
|
-
"@purr-core/hooks.block": "0.0.
|
|
37
|
-
"@purr-core/hooks.not-click-on-elements": "0.0.7",
|
|
38
|
-
"@purr-core/hooks.sync-state-with-props": "0.0.7"
|
|
29
|
+
"@purr-react-styled-components/components.post-adornment": "0.0.8",
|
|
30
|
+
"@purr-react-styled-components/utils.helpers": "0.0.7",
|
|
31
|
+
"@purr-core/utils.definitions": "0.0.11",
|
|
32
|
+
"@purr-react-styled-components/components.icon": "0.0.8",
|
|
33
|
+
"@purr-core/components.portal": "0.0.8",
|
|
34
|
+
"@purr-core/hooks.not-click-on-elements": "0.0.8",
|
|
35
|
+
"@purr-core/hooks.sync-state-with-props": "0.0.8",
|
|
36
|
+
"@purr-core/hooks.block": "0.0.10"
|
|
39
37
|
},
|
|
40
38
|
"author": "@DinhThienPhuc",
|
|
41
39
|
"license": "ISC",
|
|
@@ -44,6 +42,8 @@
|
|
|
44
42
|
"scripts": {
|
|
45
43
|
"dev": "vite build --watch",
|
|
46
44
|
"build": "tsc && vite build",
|
|
45
|
+
"build:vite": "tsc && vite build",
|
|
46
|
+
"build:tsup": "tsup",
|
|
47
47
|
"lint": "eslint . --ext ts,tsx --max-warnings 0"
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
import { ISelectOptionProps } from '../_types';
|
|
3
|
-
|
|
4
|
-
export declare const SelectOption: React.MemoExoticComponent<({ value, displayedValue, label, disabled, htmlAttributes, handleSelectOption, }: ISelectOptionProps) => React.JSX.Element>;
|
package/dist/_menu-CSgQeF40.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import h from "clsx";
|
|
3
|
-
import { memo as b, createElement as w, forwardRef as y, useMemo as O } from "react";
|
|
4
|
-
import { S as f } from "./index-CiHv3F2P.js";
|
|
5
|
-
const $ = b(({
|
|
6
|
-
value: t,
|
|
7
|
-
displayedValue: e,
|
|
8
|
-
label: l,
|
|
9
|
-
disabled: c,
|
|
10
|
-
htmlAttributes: d,
|
|
11
|
-
handleSelectOption: m
|
|
12
|
-
}) => /* @__PURE__ */ w(f.Option, { ...d, $selected: t === e, $disabled: c, key: t, className: h("select-option", t === e && "select-option--selected", c && "select-option--disabled"), onClick: m(t), title: typeof l == "string" ? l : void 0 }, l));
|
|
13
|
-
$.displayName = "SelectOption";
|
|
14
|
-
const g = y(({
|
|
15
|
-
options: t,
|
|
16
|
-
position: e,
|
|
17
|
-
isShowed: l,
|
|
18
|
-
currentValue: c,
|
|
19
|
-
optionGroupClassName: d,
|
|
20
|
-
htmlAttributes: m,
|
|
21
|
-
selectOption: s
|
|
22
|
-
}, u) => {
|
|
23
|
-
const S = O(() => t.map((r) => /* @__PURE__ */ a($, { value: r.value, displayedValue: c, label: r.label, disabled: !!r.disabled, htmlAttributes: r.htmlAttributes, handleSelectOption: s }, r.value)), [c, t, s]);
|
|
24
|
-
return /* @__PURE__ */ a(f.OptionGroup, { ...m, $position: e, $isShowed: l, ref: u, className: h("select-options", !!(e != null && e.top) && `select-options--position-top-${e.top}`, !!(e != null && e.left) && `select-options--position-left-${e.left}`, !!(e != null && e.height) && `select-options--position-height-${e.height}`, !!(e != null && e.width) && `select-options--position-width-${e.width}`, l && "select-options--showed", d), children: S });
|
|
25
|
-
});
|
|
26
|
-
g.displayName = "SelectMenu";
|
|
27
|
-
export {
|
|
28
|
-
g as SelectMenu
|
|
29
|
-
};
|
package/dist/_menu-Mw9ayM10.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react/jsx-runtime"),m=require("clsx"),s=require("react"),n=require("./index-W-_2mM5B.cjs"),S=s.memo(({value:t,displayedValue:e,label:l,disabled:c,htmlAttributes:d,handleSelectOption:a})=>s.createElement(n.Styled.Option,{...d,$selected:t===e,$disabled:c,key:t,className:m("select-option",t===e&&"select-option--selected",c&&"select-option--disabled"),onClick:a(t),title:typeof l=="string"?l:void 0},l));S.displayName="SelectOption";const y=s.forwardRef(({options:t,position:e,isShowed:l,currentValue:c,optionGroupClassName:d,htmlAttributes:a,selectOption:u},$)=>{const b=s.useMemo(()=>t.map(r=>h.jsx(S,{value:r.value,displayedValue:c,label:r.label,disabled:!!r.disabled,htmlAttributes:r.htmlAttributes,handleSelectOption:u},r.value)),[c,t,u]);return h.jsx(n.Styled.OptionGroup,{...a,$position:e,$isShowed:l,ref:$,className:m("select-options",!!(e!=null&&e.top)&&`select-options--position-top-${e.top}`,!!(e!=null&&e.left)&&`select-options--position-left-${e.left}`,!!(e!=null&&e.height)&&`select-options--position-height-${e.height}`,!!(e!=null&&e.width)&&`select-options--position-width-${e.width}`,l&&"select-options--showed",d),children:b})});y.displayName="SelectMenu";exports.SelectMenu=y;
|
package/dist/_style.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { TSelectVariant } from './_types';
|
|
2
|
-
|
|
3
|
-
export declare const Styled: {
|
|
4
|
-
Container: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
5
|
-
$fullWidth: boolean;
|
|
6
|
-
}>> & string;
|
|
7
|
-
Option: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
|
|
8
|
-
$selected: boolean;
|
|
9
|
-
$disabled?: boolean;
|
|
10
|
-
}>> & string;
|
|
11
|
-
OptionGroup: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
12
|
-
$isShowed: boolean;
|
|
13
|
-
$position: {
|
|
14
|
-
left: number;
|
|
15
|
-
top: number;
|
|
16
|
-
width: number;
|
|
17
|
-
} | null;
|
|
18
|
-
}>> & string;
|
|
19
|
-
Box: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
20
|
-
$fullWidth: boolean;
|
|
21
|
-
$disabled: boolean;
|
|
22
|
-
$variant: TSelectVariant;
|
|
23
|
-
$isError: boolean;
|
|
24
|
-
}>> & string;
|
|
25
|
-
InnerBox: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
|
|
26
|
-
$hasLabel: boolean;
|
|
27
|
-
$variant: TSelectVariant;
|
|
28
|
-
$disabled: boolean;
|
|
29
|
-
}>> & string;
|
|
30
|
-
FakeSelect: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>, never>> & string;
|
|
31
|
-
PostAdornmentContentWrapper: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
32
|
-
$isShowed: boolean;
|
|
33
|
-
$disabled?: boolean;
|
|
34
|
-
}>> & string;
|
|
35
|
-
};
|
package/dist/_types.d.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { HTMLAttributes, MouseEvent, MouseEventHandler, ReactNode } from 'react';
|
|
2
|
-
import { FieldError } from 'react-hook-form';
|
|
3
|
-
import { IExtendable } from '@purr-core/utils.definitions';
|
|
4
|
-
import { IHelperTextProps } from '@purr-react-styled-components/components.helper-text';
|
|
5
|
-
import { ILabelProps } from '@purr-react-styled-components/components.label';
|
|
6
|
-
import { IPostAdornmentProps } from '@purr-react-styled-components/components.post-adornment';
|
|
7
|
-
|
|
8
|
-
export interface ISelectOption {
|
|
9
|
-
value: string;
|
|
10
|
-
label: ReactNode;
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
htmlAttributes?: HTMLAttributes<HTMLSpanElement> & IExtendable;
|
|
13
|
-
}
|
|
14
|
-
export interface ISelectOptionProps extends ISelectOption {
|
|
15
|
-
displayedValue?: string;
|
|
16
|
-
handleSelectOption: (value: string) => MouseEventHandler<HTMLSpanElement>;
|
|
17
|
-
}
|
|
18
|
-
export type TSelectVariant = "standard" | "outlined" | "filled";
|
|
19
|
-
export interface ISelectMenuProps {
|
|
20
|
-
options: ISelectOption[];
|
|
21
|
-
position: {
|
|
22
|
-
left: number;
|
|
23
|
-
top: number;
|
|
24
|
-
width: number;
|
|
25
|
-
height: number;
|
|
26
|
-
} | null;
|
|
27
|
-
isShowed: boolean;
|
|
28
|
-
currentValue?: string;
|
|
29
|
-
optionGroupClassName?: string;
|
|
30
|
-
htmlAttributes?: HTMLAttributes<HTMLDivElement> & IExtendable;
|
|
31
|
-
selectOption: (value: string) => MouseEventHandler<HTMLSpanElement>;
|
|
32
|
-
}
|
|
33
|
-
export interface ISelectProps {
|
|
34
|
-
optionGroupClassName?: string;
|
|
35
|
-
options: ISelectOption[];
|
|
36
|
-
value?: string;
|
|
37
|
-
variant?: TSelectVariant;
|
|
38
|
-
labelProps?: ILabelProps;
|
|
39
|
-
postAdornmentProps?: IPostAdornmentProps;
|
|
40
|
-
helperTextProps?: IHelperTextProps;
|
|
41
|
-
htmlAttributes?: HTMLAttributes<HTMLDivElement> & IExtendable;
|
|
42
|
-
menuHtmlAttributes?: HTMLAttributes<HTMLDivElement> & IExtendable;
|
|
43
|
-
tabIndex?: number;
|
|
44
|
-
className?: string;
|
|
45
|
-
fullWidth?: boolean;
|
|
46
|
-
disabled?: boolean;
|
|
47
|
-
required?: boolean;
|
|
48
|
-
error?: FieldError;
|
|
49
|
-
isStandalone?: boolean;
|
|
50
|
-
onChange?: (value: string, e: MouseEvent<HTMLSpanElement>) => void;
|
|
51
|
-
}
|
package/dist/index-CiHv3F2P.js
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import { jsx as n, jsxs as I } from "react/jsx-runtime";
|
|
2
|
-
import u from "clsx";
|
|
3
|
-
import { lazy as w, forwardRef as Y, useRef as B, useState as L, useMemo as $, Suspense as g, useCallback as J } from "react";
|
|
4
|
-
import { Portal as K } from "@purr-core/components.portal";
|
|
5
|
-
import Q from "@purr-core/hooks.block";
|
|
6
|
-
import U from "@purr-core/hooks.not-click-on-elements";
|
|
7
|
-
import X from "@purr-core/hooks.sync-state-with-props";
|
|
8
|
-
import x, { css as z } from "styled-components";
|
|
9
|
-
import { getVariantStyle as Z } from "@purr-react-styled-components/utils.helpers";
|
|
10
|
-
const q = (e) => e.$variant === "standard" ? z(["padding:0px 35px 0px 0px;"]) : z(["padding:0px 35px 0px 14px;"]), p = {
|
|
11
|
-
Container: x.div.withConfig({
|
|
12
|
-
displayName: "_style__Container",
|
|
13
|
-
componentId: "sc-1ikgo6d-0"
|
|
14
|
-
})(["position:relative;width:", ";min-width:210px;"], ({
|
|
15
|
-
$fullWidth: e
|
|
16
|
-
}) => e ? "100%" : "fit-content"),
|
|
17
|
-
Option: x.span.withConfig({
|
|
18
|
-
displayName: "_style__Option",
|
|
19
|
-
componentId: "sc-1ikgo6d-1"
|
|
20
|
-
})(["display:block;transition:all 200ms ease-in-out;cursor:pointer;padding:0px 14px;height:36px;line-height:36px;background-color:", ";color:", ';overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-family:"Verdana",sans-serif;font-size:16px;&:hover{background-color:#ffffff14;}'], ({
|
|
21
|
-
$selected: e,
|
|
22
|
-
$disabled: h
|
|
23
|
-
}) => h ? "#121212" : e ? "#90caf929" : "transparent", ({
|
|
24
|
-
$disabled: e
|
|
25
|
-
}) => e ? "#ffffff80" : "#ffffff"),
|
|
26
|
-
OptionGroup: x.div.withConfig({
|
|
27
|
-
displayName: "_style__OptionGroup",
|
|
28
|
-
componentId: "sc-1ikgo6d-2"
|
|
29
|
-
})(["position:absolute;display:", ";top:", "px;left:", "px;width:", "px;padding:6px 0px;z-index:999;background-color:rgb(18,18,18);min-width:120px;border-radius:4px;box-shadow:rgb(0 0 0 / 20%) 0px 5px 5px -3px,rgb(0 0 0 / 14%) 0px 8px 10px 1px,rgb(0 0 0 / 12%) 0px 3px 14px 2px;background-image:linear-gradient(#ffffff1f,#ffffff1f);"], ({
|
|
30
|
-
$isShowed: e
|
|
31
|
-
}) => e ? "block" : "none", ({
|
|
32
|
-
$position: e
|
|
33
|
-
}) => (e == null ? void 0 : e.top) || 0, ({
|
|
34
|
-
$position: e
|
|
35
|
-
}) => (e == null ? void 0 : e.left) || 0, ({
|
|
36
|
-
$position: e
|
|
37
|
-
}) => (e == null ? void 0 : e.width) || 0),
|
|
38
|
-
Box: x.div.withConfig({
|
|
39
|
-
displayName: "_style__Box",
|
|
40
|
-
componentId: "sc-1ikgo6d-3"
|
|
41
|
-
})(["transition:all 200ms ease-in-out;position:relative;width:", ";height:56px;", ";"], ({
|
|
42
|
-
$fullWidth: e
|
|
43
|
-
}) => e ? "100%" : "210px", Z),
|
|
44
|
-
InnerBox: x.span.withConfig({
|
|
45
|
-
displayName: "_style__InnerBox",
|
|
46
|
-
componentId: "sc-1ikgo6d-4"
|
|
47
|
-
})(["position:absolute;transition:all 200ms ease-in-out;box-sizing:border-box;width:100%;height:", ";line-height:", ";top:", ";left:0px;background-color:transparent;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color:", ';font-family:"Verdana",sans-serif;font-size:16px;', ";&:focus-visible{outline:none;}"], ({
|
|
48
|
-
$hasLabel: e
|
|
49
|
-
}) => e ? "44px" : "56px", ({
|
|
50
|
-
$hasLabel: e
|
|
51
|
-
}) => e ? "44px" : "56px", ({
|
|
52
|
-
$hasLabel: e
|
|
53
|
-
}) => e ? "12px" : "0px", ({
|
|
54
|
-
$disabled: e
|
|
55
|
-
}) => e ? "#ffffff80" : "#ffffff", q),
|
|
56
|
-
FakeSelect: x.select.withConfig({
|
|
57
|
-
displayName: "_style__FakeSelect",
|
|
58
|
-
componentId: "sc-1ikgo6d-5"
|
|
59
|
-
})(["width:100%;height:100%;opacity:0;cursor:pointer;"]),
|
|
60
|
-
PostAdornmentContentWrapper: x.div.withConfig({
|
|
61
|
-
displayName: "_style__PostAdornmentContentWrapper",
|
|
62
|
-
componentId: "sc-1ikgo6d-6"
|
|
63
|
-
})(["display:flex;transition:all 350ms ease-in-out;width:20px;height:20px;color:", ";transform:", ";"], ({
|
|
64
|
-
$disabled: e
|
|
65
|
-
}) => e ? "#ffffff80" : "#ffffff", ({
|
|
66
|
-
$isShowed: e
|
|
67
|
-
}) => e ? "rotate(180deg)" : "none")
|
|
68
|
-
}, A = w(() => import("@purr-react-styled-components/components.helper-text").then((e) => ({
|
|
69
|
-
default: e.HelperText
|
|
70
|
-
}))), T = w(() => import("@purr-react-styled-components/components.icon").then((e) => ({
|
|
71
|
-
default: e.Icon
|
|
72
|
-
}))), P = w(() => import("@purr-react-styled-components/components.label").then((e) => ({
|
|
73
|
-
default: e.Label
|
|
74
|
-
}))), ee = w(() => import("@purr-react-styled-components/components.post-adornment").then((e) => ({
|
|
75
|
-
default: e.PostAdornment
|
|
76
|
-
}))), te = w(() => import("./_menu-CSgQeF40.js").then((e) => ({
|
|
77
|
-
default: e.SelectMenu
|
|
78
|
-
}))), ne = (e, h = !0) => {
|
|
79
|
-
var f;
|
|
80
|
-
const t = (f = e.current) == null ? void 0 : f.getBoundingClientRect();
|
|
81
|
-
return {
|
|
82
|
-
left: (t == null ? void 0 : t.x) || 0,
|
|
83
|
-
top: ((t == null ? void 0 : t.y) || 0) + (h && (window == null ? void 0 : window.scrollY) || 0),
|
|
84
|
-
width: (t == null ? void 0 : t.width) || 0,
|
|
85
|
-
height: (t == null ? void 0 : t.height) || 0
|
|
86
|
-
};
|
|
87
|
-
}, ie = Y(({
|
|
88
|
-
optionGroupClassName: e,
|
|
89
|
-
options: h,
|
|
90
|
-
value: t,
|
|
91
|
-
variant: f = "standard",
|
|
92
|
-
labelProps: c,
|
|
93
|
-
postAdornmentProps: o,
|
|
94
|
-
helperTextProps: s,
|
|
95
|
-
className: R,
|
|
96
|
-
fullWidth: y = !1,
|
|
97
|
-
disabled: i = !1,
|
|
98
|
-
required: v = !1,
|
|
99
|
-
error: r = null,
|
|
100
|
-
isStandalone: V = !1,
|
|
101
|
-
tabIndex: E = -1,
|
|
102
|
-
menuHtmlAttributes: F,
|
|
103
|
-
htmlAttributes: O,
|
|
104
|
-
onChange: _
|
|
105
|
-
}, fe) => {
|
|
106
|
-
const S = B(null), C = B(null), [l, k] = L(!1), [W, M] = L(null), {
|
|
107
|
-
currentValue: b,
|
|
108
|
-
setCurrentValue: N
|
|
109
|
-
} = X(t, V);
|
|
110
|
-
U([S, C], () => {
|
|
111
|
-
l && k(!1);
|
|
112
|
-
});
|
|
113
|
-
const j = (m) => {
|
|
114
|
-
if (m.preventDefault(), !i) {
|
|
115
|
-
if (!l) {
|
|
116
|
-
const d = ne(S);
|
|
117
|
-
M({
|
|
118
|
-
...d,
|
|
119
|
-
top: d.top + d.height
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
k((d) => !d);
|
|
123
|
-
}
|
|
124
|
-
}, G = Q(() => !!(i || l || b)), a = h.find((m) => m.value === b), H = $(() => /* @__PURE__ */ n(p.PostAdornmentContentWrapper, { $isShowed: l, $disabled: i, className: u("select-post-adornment-content", l && "select-post-adornment-content--showed", i && "select-post-adornment-content--disabled"), children: (o == null ? void 0 : o.children) ?? /* @__PURE__ */ n(g, { children: /* @__PURE__ */ n(T, { name: "chevron-down" }) }) }), [i, l, o == null ? void 0 : o.children]), D = J((m) => (d) => {
|
|
125
|
-
_ == null || _(m, d), k(!1), N(m);
|
|
126
|
-
}, [_, N, k]);
|
|
127
|
-
return /* @__PURE__ */ I(p.Container, { ...O, $fullWidth: y, className: u("select", y && "select--fullWidth", R), children: [
|
|
128
|
-
/* @__PURE__ */ I(p.Box, { $variant: f, $disabled: i, $fullWidth: y, $isError: !!r, ref: S, onClick: j, tabIndex: E, className: u("select-box", y && "select-box--full-width", i && "select-box--disabled", !!r && "select-box--error", `select-box--variant-${f}`), children: [
|
|
129
|
-
/* @__PURE__ */ n(g, { children: !!(c != null && c.children) && /* @__PURE__ */ n(P, { ...c, required: v, disabled: i, variant: f, isLabelCollapsed: G, isFocused: l, isError: !!r }) }),
|
|
130
|
-
/* @__PURE__ */ n(p.FakeSelect, { required: v, disabled: i }),
|
|
131
|
-
/* @__PURE__ */ n(p.InnerBox, { $hasLabel: !!(c != null && c.children), $variant: f, $disabled: i, className: u("select-inner-box", `select-inner-box--variant-${f}`, !!(c != null && c.children) && "select-inner-box--hasLabel", i && "select-inner-box--disabled"), title: typeof (a == null ? void 0 : a.label) == "string" ? a == null ? void 0 : a.label : void 0, children: a == null ? void 0 : a.label }),
|
|
132
|
-
/* @__PURE__ */ n(g, { children: !!(o != null && o.children) && /* @__PURE__ */ n(ee, { ...o, variant: f, children: H }) }),
|
|
133
|
-
/* @__PURE__ */ n(g, { children: !!(s != null && s.children) && /* @__PURE__ */ n(A, { ...s, isError: !!r, variant: f, children: (r == null ? void 0 : r.message) ?? (s == null ? void 0 : s.children) ?? "" }) })
|
|
134
|
-
] }),
|
|
135
|
-
/* @__PURE__ */ n(K, { className: u("portal-select", e), children: /* @__PURE__ */ n(g, { children: l && /* @__PURE__ */ n(te, { ref: C, options: h, position: W, isShowed: l, optionGroupClassName: e, currentValue: b, htmlAttributes: F, selectOption: D }) }) })
|
|
136
|
-
] });
|
|
137
|
-
});
|
|
138
|
-
ie.displayName = "Select";
|
|
139
|
-
export {
|
|
140
|
-
p as S,
|
|
141
|
-
ie as a
|
|
142
|
-
};
|
package/dist/index-W-_2mM5B.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var G=Object.create;var N=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var Y=Object.getPrototypeOf,$=Object.prototype.hasOwnProperty;var J=(e,s,t,l)=>{if(s&&typeof s=="object"||typeof s=="function")for(let i of D(s))!$.call(e,i)&&i!==t&&N(e,i,{get:()=>s[i],enumerable:!(l=H(s,i))||l.enumerable});return e};var _=(e,s,t)=>(t=e!=null?G(Y(e)):{},J(s||!e||!e.__esModule?N(t,"default",{value:e,enumerable:!0}):t,e));const c=require("react/jsx-runtime"),m=require("clsx"),n=require("react"),K=require("@purr-core/components.portal"),Q=require("@purr-core/hooks.block"),U=require("@purr-core/hooks.not-click-on-elements"),X=require("@purr-core/hooks.sync-state-with-props"),d=require("styled-components"),Z=require("@purr-react-styled-components/utils.helpers"),A=e=>e.$variant==="standard"?d.css(["padding:0px 35px 0px 0px;"]):d.css(["padding:0px 35px 0px 14px;"]),p={Container:d.div.withConfig({displayName:"_style__Container",componentId:"sc-1ikgo6d-0"})(["position:relative;width:",";min-width:210px;"],({$fullWidth:e})=>e?"100%":"fit-content"),Option:d.span.withConfig({displayName:"_style__Option",componentId:"sc-1ikgo6d-1"})(["display:block;transition:all 200ms ease-in-out;cursor:pointer;padding:0px 14px;height:36px;line-height:36px;background-color:",";color:",';overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-family:"Verdana",sans-serif;font-size:16px;&:hover{background-color:#ffffff14;}'],({$selected:e,$disabled:s})=>s?"#121212":e?"#90caf929":"transparent",({$disabled:e})=>e?"#ffffff80":"#ffffff"),OptionGroup:d.div.withConfig({displayName:"_style__OptionGroup",componentId:"sc-1ikgo6d-2"})(["position:absolute;display:",";top:","px;left:","px;width:","px;padding:6px 0px;z-index:999;background-color:rgb(18,18,18);min-width:120px;border-radius:4px;box-shadow:rgb(0 0 0 / 20%) 0px 5px 5px -3px,rgb(0 0 0 / 14%) 0px 8px 10px 1px,rgb(0 0 0 / 12%) 0px 3px 14px 2px;background-image:linear-gradient(#ffffff1f,#ffffff1f);"],({$isShowed:e})=>e?"block":"none",({$position:e})=>(e==null?void 0:e.top)||0,({$position:e})=>(e==null?void 0:e.left)||0,({$position:e})=>(e==null?void 0:e.width)||0),Box:d.div.withConfig({displayName:"_style__Box",componentId:"sc-1ikgo6d-3"})(["transition:all 200ms ease-in-out;position:relative;width:",";height:56px;",";"],({$fullWidth:e})=>e?"100%":"210px",Z.getVariantStyle),InnerBox:d.span.withConfig({displayName:"_style__InnerBox",componentId:"sc-1ikgo6d-4"})(["position:absolute;transition:all 200ms ease-in-out;box-sizing:border-box;width:100%;height:",";line-height:",";top:",";left:0px;background-color:transparent;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color:",';font-family:"Verdana",sans-serif;font-size:16px;',";&:focus-visible{outline:none;}"],({$hasLabel:e})=>e?"44px":"56px",({$hasLabel:e})=>e?"44px":"56px",({$hasLabel:e})=>e?"12px":"0px",({$disabled:e})=>e?"#ffffff80":"#ffffff",A),FakeSelect:d.select.withConfig({displayName:"_style__FakeSelect",componentId:"sc-1ikgo6d-5"})(["width:100%;height:100%;opacity:0;cursor:pointer;"]),PostAdornmentContentWrapper:d.div.withConfig({displayName:"_style__PostAdornmentContentWrapper",componentId:"sc-1ikgo6d-6"})(["display:flex;transition:all 350ms ease-in-out;width:20px;height:20px;color:",";transform:",";"],({$disabled:e})=>e?"#ffffff80":"#ffffff",({$isShowed:e})=>e?"rotate(180deg)":"none")},T=n.lazy(()=>import("@purr-react-styled-components/components.helper-text").then(e=>({default:e.HelperText}))),P=n.lazy(()=>import("@purr-react-styled-components/components.icon").then(e=>({default:e.Icon}))),ee=n.lazy(()=>import("@purr-react-styled-components/components.label").then(e=>({default:e.Label}))),te=n.lazy(()=>import("@purr-react-styled-components/components.post-adornment").then(e=>({default:e.PostAdornment}))),ne=n.lazy(()=>Promise.resolve().then(()=>require("./_menu-Mw9ayM10.cjs")).then(e=>({default:e.SelectMenu}))),ie=(e,s=!0)=>{var l;const t=(l=e.current)==null?void 0:l.getBoundingClientRect();return{left:(t==null?void 0:t.x)||0,top:((t==null?void 0:t.y)||0)+(s&&(window==null?void 0:window.scrollY)||0),width:(t==null?void 0:t.width)||0,height:(t==null?void 0:t.height)||0}},I=n.forwardRef(({optionGroupClassName:e,options:s,value:t,variant:l="standard",labelProps:i,postAdornmentProps:o,helperTextProps:x,className:q,fullWidth:w=!1,disabled:f=!1,required:v=!1,error:u=null,isStandalone:z=!1,tabIndex:B=-1,menuHtmlAttributes:R,htmlAttributes:L,onChange:y},ce)=>{const k=n.useRef(null),b=n.useRef(null),[a,S]=n.useState(!1),[V,E]=n.useState(null),{currentValue:j,setCurrentValue:C}=X(t,z);U([k,b],()=>{a&&S(!1)});const F=g=>{if(g.preventDefault(),!f){if(!a){const h=ie(k);E({...h,top:h.top+h.height})}S(h=>!h)}},O=Q(()=>!!(f||a||j)),r=s.find(g=>g.value===j),W=n.useMemo(()=>c.jsx(p.PostAdornmentContentWrapper,{$isShowed:a,$disabled:f,className:m("select-post-adornment-content",a&&"select-post-adornment-content--showed",f&&"select-post-adornment-content--disabled"),children:(o==null?void 0:o.children)??c.jsx(n.Suspense,{children:c.jsx(P,{name:"chevron-down"})})}),[f,a,o==null?void 0:o.children]),M=n.useCallback(g=>h=>{y==null||y(g,h),S(!1),C(g)},[y,C,S]);return c.jsxs(p.Container,{...L,$fullWidth:w,className:m("select",w&&"select--fullWidth",q),children:[c.jsxs(p.Box,{$variant:l,$disabled:f,$fullWidth:w,$isError:!!u,ref:k,onClick:F,tabIndex:B,className:m("select-box",w&&"select-box--full-width",f&&"select-box--disabled",!!u&&"select-box--error",`select-box--variant-${l}`),children:[c.jsx(n.Suspense,{children:!!(i!=null&&i.children)&&c.jsx(ee,{...i,required:v,disabled:f,variant:l,isLabelCollapsed:O,isFocused:a,isError:!!u})}),c.jsx(p.FakeSelect,{required:v,disabled:f}),c.jsx(p.InnerBox,{$hasLabel:!!(i!=null&&i.children),$variant:l,$disabled:f,className:m("select-inner-box",`select-inner-box--variant-${l}`,!!(i!=null&&i.children)&&"select-inner-box--hasLabel",f&&"select-inner-box--disabled"),title:typeof(r==null?void 0:r.label)=="string"?r==null?void 0:r.label:void 0,children:r==null?void 0:r.label}),c.jsx(n.Suspense,{children:!!(o!=null&&o.children)&&c.jsx(te,{...o,variant:l,children:W})}),c.jsx(n.Suspense,{children:!!(x!=null&&x.children)&&c.jsx(T,{...x,isError:!!u,variant:l,children:(u==null?void 0:u.message)??(x==null?void 0:x.children)??""})})]}),c.jsx(K.Portal,{className:m("portal-select",e),children:c.jsx(n.Suspense,{children:a&&c.jsx(ne,{ref:b,options:s,position:V,isShowed:a,optionGroupClassName:e,currentValue:j,htmlAttributes:R,selectOption:M})})})]})});I.displayName="Select";exports.Select=I;exports.Styled=p;
|
package/dist/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-W-_2mM5B.cjs");exports.Select=e.Select;
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED