@temp-spotwork/ui 1.4.4 → 1.4.5
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/dist/components/molecules/filter/context-search/context-search.d.ts +15 -1
- package/dist/components/molecules/filter/context-search/context-search.js +27 -28
- package/dist/components/molecules/filter/dropdown-selector/dropdown-selector.d.ts +2 -1
- package/dist/components/molecules/filter/dropdown-selector/dropdown-selector.js +53 -52
- package/dist/components/molecules/filter/dropdown-selector/styles.js +7 -7
- package/package.json +1 -1
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
1
3
|
export type ContextSearchProps = {
|
|
2
4
|
/**
|
|
3
5
|
* value of the input
|
|
@@ -15,5 +17,17 @@ export type ContextSearchProps = {
|
|
|
15
17
|
* disabled
|
|
16
18
|
*/
|
|
17
19
|
disabled?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* class name for the container
|
|
22
|
+
*/
|
|
23
|
+
className?: string;
|
|
24
|
+
/**
|
|
25
|
+
* css styles for the input
|
|
26
|
+
*/
|
|
27
|
+
style?: React.CSSProperties;
|
|
28
|
+
/**
|
|
29
|
+
* prevent browser suggestions
|
|
30
|
+
*/
|
|
31
|
+
preventBrowserSuggestions?: boolean;
|
|
18
32
|
};
|
|
19
|
-
export declare const ContextSearch: ({ value, onChange, placeholder, disabled, }: ContextSearchProps) => import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
export declare const ContextSearch: ({ value, onChange, placeholder, disabled, className, style, preventBrowserSuggestions, }: ContextSearchProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,52 +1,51 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { Icons as
|
|
1
|
+
import { jsxs as b, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useState as x } from "react";
|
|
3
|
+
import { Icons as g } from "../../../atoms/icons/icons.js";
|
|
4
4
|
import "../../../atoms/icons/iconsSVGs/Large/Profile.js";
|
|
5
5
|
import "../../../atoms/icons/iconsSVGs/Small/Profile.js";
|
|
6
6
|
import { t as s } from "../../../../bundle-mjs-CAy1p0fn.js";
|
|
7
7
|
import { outlinedBorder as l } from "../../../styles/defaults/defaults.js";
|
|
8
8
|
import "../../../../purify.es-eYFoHPwR.js";
|
|
9
|
-
import { styleMap as
|
|
9
|
+
import { styleMap as v } from "../../../styles/typography/style.js";
|
|
10
10
|
import "../../../styles/colors/colormap.js";
|
|
11
|
-
const
|
|
11
|
+
const $ = ({
|
|
12
12
|
value: a,
|
|
13
13
|
onChange: e,
|
|
14
14
|
placeholder: i,
|
|
15
|
-
disabled: o = !1
|
|
15
|
+
disabled: o = !1,
|
|
16
|
+
className: c,
|
|
17
|
+
style: m,
|
|
18
|
+
preventBrowserSuggestions: u = !1
|
|
16
19
|
}) => {
|
|
17
|
-
const [
|
|
18
|
-
|
|
19
|
-
},
|
|
20
|
-
|
|
20
|
+
const [f, t] = x(!1), p = () => {
|
|
21
|
+
t(!0);
|
|
22
|
+
}, d = () => {
|
|
23
|
+
t(!1);
|
|
21
24
|
};
|
|
22
|
-
return /* @__PURE__ */
|
|
25
|
+
return /* @__PURE__ */ b(
|
|
23
26
|
"div",
|
|
24
27
|
{
|
|
25
28
|
className: s(
|
|
26
29
|
`h-[3rem] flex items-center gap-xs px-xs bg-surface-default ${l.base} border-bcolor-default `,
|
|
27
|
-
|
|
28
|
-
o && "bg-surface-disabled border-bcolor-disabled"
|
|
30
|
+
f && l.active,
|
|
31
|
+
o && "bg-surface-disabled border-bcolor-disabled",
|
|
32
|
+
c
|
|
29
33
|
),
|
|
34
|
+
style: m,
|
|
30
35
|
children: [
|
|
31
|
-
/* @__PURE__ */
|
|
32
|
-
|
|
33
|
-
{
|
|
34
|
-
disabled: !0,
|
|
35
|
-
icon: "MagnifyingGlassSmall",
|
|
36
|
-
color: o ? "disabled" : "active"
|
|
37
|
-
}
|
|
38
|
-
),
|
|
39
|
-
/* @__PURE__ */ t(
|
|
36
|
+
/* @__PURE__ */ r(g, { disabled: !0, icon: "MagnifyingGlassSmall", color: o ? "disabled" : "active" }),
|
|
37
|
+
/* @__PURE__ */ r(
|
|
40
38
|
"input",
|
|
41
39
|
{
|
|
42
40
|
type: "text",
|
|
43
|
-
className: s(`focus:outline-none w-full ${
|
|
41
|
+
className: s(`focus:outline-none w-full ${v[1]}`),
|
|
44
42
|
placeholder: i,
|
|
45
|
-
onFocus:
|
|
46
|
-
onBlur:
|
|
47
|
-
onChange: (
|
|
43
|
+
onFocus: p,
|
|
44
|
+
onBlur: d,
|
|
45
|
+
onChange: (n) => e == null ? void 0 : e(n.target.value),
|
|
48
46
|
value: a,
|
|
49
|
-
disabled: o
|
|
47
|
+
disabled: o,
|
|
48
|
+
autoComplete: u ? "off" : "on"
|
|
50
49
|
}
|
|
51
50
|
)
|
|
52
51
|
]
|
|
@@ -54,5 +53,5 @@ const w = ({
|
|
|
54
53
|
);
|
|
55
54
|
};
|
|
56
55
|
export {
|
|
57
|
-
|
|
56
|
+
$ as ContextSearch
|
|
58
57
|
};
|
|
@@ -19,5 +19,6 @@ export type DropdownFilterProps = {
|
|
|
19
19
|
multiselect?: boolean;
|
|
20
20
|
disabled?: boolean;
|
|
21
21
|
minWidth?: string | number;
|
|
22
|
+
className?: string;
|
|
22
23
|
};
|
|
23
|
-
export declare const DropdownFilter: ({ onChange, value, placeholder, options, multiselect, disabled, minWidth, }: DropdownFilterProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export declare const DropdownFilter: ({ onChange, value, placeholder, options, multiselect, disabled, minWidth, className, }: DropdownFilterProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,63 +1,64 @@
|
|
|
1
1
|
import { jsx as s, jsxs as n } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { R as
|
|
4
|
-
import { c as
|
|
5
|
-
import { outlinedBorder as
|
|
2
|
+
import { useRef as V, useState as P } from "react";
|
|
3
|
+
import { R as $, T as F, I as K, P as z, C as L, V as M, a as U } from "../../../../index-CnWyMXBX.js";
|
|
4
|
+
import { c as W } from "../../../../index-fN7hCOo3.js";
|
|
5
|
+
import { outlinedBorder as S, border as Z } from "../../../styles/defaults/defaults.js";
|
|
6
6
|
import { Typography as g } from "../../../styles/typography/typography.js";
|
|
7
|
-
import { filterDropdownStyles as
|
|
8
|
-
import { Badge as
|
|
9
|
-
import { Icons as
|
|
7
|
+
import { filterDropdownStyles as q, contentStyles as G } from "./styles.js";
|
|
8
|
+
import { Badge as k } from "../../../atoms/badge/badge.js";
|
|
9
|
+
import { Icons as A } from "../../../atoms/icons/icons.js";
|
|
10
10
|
import "../../../atoms/icons/iconsSVGs/Large/Profile.js";
|
|
11
11
|
import "../../../atoms/icons/iconsSVGs/Small/Profile.js";
|
|
12
|
-
import { CheckboxFilter as
|
|
13
|
-
import { t as
|
|
14
|
-
import { getBorderClasses as
|
|
15
|
-
import { useStickyZIndex as
|
|
16
|
-
const
|
|
17
|
-
onChange:
|
|
12
|
+
import { CheckboxFilter as H } from "../checkbox/checkbox.js";
|
|
13
|
+
import { t as y } from "../../../../bundle-mjs-CAy1p0fn.js";
|
|
14
|
+
import { getBorderClasses as J } from "../../../atoms/form/utils-for-forms/state-functions.js";
|
|
15
|
+
import { useStickyZIndex as Q } from "../../../../hooks/use-sticky-z-index.js";
|
|
16
|
+
const me = ({
|
|
17
|
+
onChange: x,
|
|
18
18
|
value: o,
|
|
19
19
|
placeholder: C = "Select value",
|
|
20
20
|
options: f,
|
|
21
21
|
multiselect: t = !1,
|
|
22
22
|
disabled: a = !1,
|
|
23
|
-
minWidth: D
|
|
23
|
+
minWidth: D,
|
|
24
|
+
className: O
|
|
24
25
|
}) => {
|
|
25
|
-
const
|
|
26
|
-
function
|
|
26
|
+
const u = V(null), v = Q(u), [c, i] = P(!1), I = J(c, !1, !1, a), B = a ? `bg-surface-disabled ${S.disabled}` : "bg-surface-default", w = Array.isArray(o) ? o.length - 1 : 0;
|
|
27
|
+
function b(e) {
|
|
27
28
|
return Array.isArray(e) && typeof e[0] == "object" && e[0] !== null && "label" in e[0] && "value" in e[0];
|
|
28
29
|
}
|
|
29
|
-
const
|
|
30
|
+
const N = (e, r) => {
|
|
30
31
|
if (Array.isArray(r)) {
|
|
31
32
|
if (!r.length) return "";
|
|
32
|
-
if (
|
|
33
|
+
if (b(e)) {
|
|
33
34
|
const l = e.find((p) => p.value === r[0]);
|
|
34
35
|
return l ? l.label : "";
|
|
35
36
|
}
|
|
36
37
|
return r[0];
|
|
37
38
|
} else {
|
|
38
|
-
if (
|
|
39
|
+
if (b(e)) {
|
|
39
40
|
const l = e.find((p) => p.value === r);
|
|
40
41
|
return l ? l.label : "";
|
|
41
42
|
}
|
|
42
43
|
return r;
|
|
43
44
|
}
|
|
44
|
-
}, d = (e) => typeof e == "string" ? e : e.value,
|
|
45
|
+
}, d = (e) => typeof e == "string" ? e : e.value, T = (e) => typeof e == "string" ? e : e.label, m = (e) => {
|
|
45
46
|
if (t) {
|
|
46
47
|
let r = [];
|
|
47
|
-
Array.isArray(o) && o.includes(e) ? r = [...o.filter((l) => l !== e)] : r = [...o, e],
|
|
48
|
+
Array.isArray(o) && o.includes(e) ? r = [...o.filter((l) => l !== e)] : r = [...o, e], x(r);
|
|
48
49
|
} else
|
|
49
|
-
|
|
50
|
-
}, h = f.filter((e) => !e.hide),
|
|
50
|
+
x(e);
|
|
51
|
+
}, h = f.filter((e) => !e.hide), j = (e, r) => {
|
|
51
52
|
e.key === "Enter" && m(r);
|
|
52
|
-
},
|
|
53
|
+
}, E = (e) => {
|
|
53
54
|
e.key === "Escape" && i(!1);
|
|
54
|
-
},
|
|
55
|
+
}, R = () => {
|
|
55
56
|
i(!1);
|
|
56
57
|
};
|
|
57
|
-
return /* @__PURE__ */ s("div", { className: "w-full", children: /* @__PURE__ */ n(
|
|
58
|
-
|
|
58
|
+
return /* @__PURE__ */ s("div", { className: y("w-full", O), children: /* @__PURE__ */ n(
|
|
59
|
+
$,
|
|
59
60
|
{
|
|
60
|
-
value:
|
|
61
|
+
value: N(f, o),
|
|
61
62
|
onValueChange: (e) => !t && m(e),
|
|
62
63
|
open: c,
|
|
63
64
|
onOpenChange: (e) => {
|
|
@@ -66,10 +67,10 @@ const fe = ({
|
|
|
66
67
|
disabled: a,
|
|
67
68
|
children: [
|
|
68
69
|
/* @__PURE__ */ n(
|
|
69
|
-
|
|
70
|
+
F,
|
|
70
71
|
{
|
|
71
|
-
className:
|
|
72
|
-
ref:
|
|
72
|
+
className: y(q, B, I),
|
|
73
|
+
ref: u,
|
|
73
74
|
style: { height: "3rem", padding: "0.75rem", minWidth: D },
|
|
74
75
|
children: [
|
|
75
76
|
o && o.length !== 0 ? /* @__PURE__ */ n("div", { className: "min-w-0 flex gap-xxs items-center", children: [
|
|
@@ -77,12 +78,12 @@ const fe = ({
|
|
|
77
78
|
g,
|
|
78
79
|
{
|
|
79
80
|
swStyle: 1,
|
|
80
|
-
children:
|
|
81
|
+
children: N(f, o),
|
|
81
82
|
className: "whitespace-nowrap overflow-hidden text-ellipsis",
|
|
82
83
|
color: a ? "disabled" : "default"
|
|
83
84
|
}
|
|
84
85
|
),
|
|
85
|
-
t &&
|
|
86
|
+
t && w > 0 && /* @__PURE__ */ s(k, { text: "+" + w, color: "affirmative" })
|
|
86
87
|
] }) : /* @__PURE__ */ s(
|
|
87
88
|
g,
|
|
88
89
|
{
|
|
@@ -92,8 +93,8 @@ const fe = ({
|
|
|
92
93
|
className: "whitespace-nowrap overflow-hidden text-ellipsis"
|
|
93
94
|
}
|
|
94
95
|
),
|
|
95
|
-
/* @__PURE__ */ s(
|
|
96
|
-
|
|
96
|
+
/* @__PURE__ */ s(K, { className: "flex-shrink-0", children: /* @__PURE__ */ s(
|
|
97
|
+
A,
|
|
97
98
|
{
|
|
98
99
|
id: "dropdown-icon",
|
|
99
100
|
disabled: !0,
|
|
@@ -104,44 +105,44 @@ const fe = ({
|
|
|
104
105
|
]
|
|
105
106
|
}
|
|
106
107
|
),
|
|
107
|
-
/* @__PURE__ */ s(
|
|
108
|
-
|
|
108
|
+
/* @__PURE__ */ s(z, { children: /* @__PURE__ */ s(
|
|
109
|
+
L,
|
|
109
110
|
{
|
|
110
|
-
className:
|
|
111
|
-
|
|
111
|
+
className: W(
|
|
112
|
+
G,
|
|
112
113
|
"max-h-[27.3rem]",
|
|
113
114
|
// to fit 9 items in timesheet filter (with border width)
|
|
114
|
-
c ?
|
|
115
|
+
c ? S.active : Z.default
|
|
115
116
|
),
|
|
116
117
|
position: "popper",
|
|
117
118
|
side: "bottom",
|
|
118
|
-
onPointerDownOutside:
|
|
119
|
-
onKeyDown:
|
|
120
|
-
style: { minWidth: "auto", zIndex:
|
|
121
|
-
children: /* @__PURE__ */ s(
|
|
122
|
-
|
|
119
|
+
onPointerDownOutside: R,
|
|
120
|
+
onKeyDown: E,
|
|
121
|
+
style: { minWidth: "auto", zIndex: v },
|
|
122
|
+
children: /* @__PURE__ */ s(M, { children: h == null ? void 0 : h.map((e, r) => /* @__PURE__ */ s(
|
|
123
|
+
U,
|
|
123
124
|
{
|
|
124
|
-
className:
|
|
125
|
+
className: y(
|
|
125
126
|
"flex flex-row items-center gap-xs py-sm cursor-pointer hover:bg-surface-active hover:outline-none focus:bg-surface-active focus:outline-none",
|
|
126
127
|
e.hasTopBorder && "border-t border-e-bcolor-subdued",
|
|
127
128
|
t ? "pr-xs" : "px-md"
|
|
128
129
|
),
|
|
129
130
|
value: d(e),
|
|
130
131
|
onClick: () => t && m(d(e)),
|
|
131
|
-
onKeyDown: (l) =>
|
|
132
|
+
onKeyDown: (l) => j(l, d(e)),
|
|
132
133
|
style: { height: "3rem" },
|
|
133
134
|
children: /* @__PURE__ */ n("div", { className: "flex items-center", style: { height: "100%" }, children: [
|
|
134
135
|
t && /* @__PURE__ */ s(
|
|
135
|
-
|
|
136
|
+
H,
|
|
136
137
|
{
|
|
137
138
|
"data-testid": `checkbox-${r}`,
|
|
138
139
|
checked: o ? o.includes(d(e)) : !1
|
|
139
140
|
}
|
|
140
141
|
),
|
|
141
142
|
/* @__PURE__ */ n("div", { className: "flex items-center gap-xxs", children: [
|
|
142
|
-
e.icon && /* @__PURE__ */ s(
|
|
143
|
+
e.icon && /* @__PURE__ */ s(A, { ...e.icon, color: e.color ? e.color : "default" }),
|
|
143
144
|
!e.icon && e.badgeText && /* @__PURE__ */ s(
|
|
144
|
-
|
|
145
|
+
k,
|
|
145
146
|
{
|
|
146
147
|
text: e.badgeText,
|
|
147
148
|
color: e.color ? e.color : "default"
|
|
@@ -151,7 +152,7 @@ const fe = ({
|
|
|
151
152
|
g,
|
|
152
153
|
{
|
|
153
154
|
swStyle: 1,
|
|
154
|
-
children:
|
|
155
|
+
children: T(e),
|
|
155
156
|
color: e.color ? e.color : "default",
|
|
156
157
|
className: "whitespace-nowrap overflow-hidden text-ellipsis"
|
|
157
158
|
}
|
|
@@ -168,5 +169,5 @@ const fe = ({
|
|
|
168
169
|
) });
|
|
169
170
|
};
|
|
170
171
|
export {
|
|
171
|
-
|
|
172
|
+
me as DropdownFilter
|
|
172
173
|
};
|
|
@@ -2,21 +2,21 @@ import { c as e } from "../../../../index-fN7hCOo3.js";
|
|
|
2
2
|
const r = e(
|
|
3
3
|
"px-md h-[4rem] w-full flex flex-row justify-between items-center gap-md"
|
|
4
4
|
), s = e(
|
|
5
|
-
"px-md h-[4rem] w-
|
|
6
|
-
),
|
|
5
|
+
"px-md h-[4rem] w-full flex flex-row justify-between items-center gap-xs"
|
|
6
|
+
), l = e(
|
|
7
7
|
"overflow-hidden bg-surface-default rounded-lg my-[0.3rem] border-[0.15rem] outline-none"
|
|
8
|
-
),
|
|
8
|
+
), n = "flex flex-row items-center gap-xs py-sm px-md cursor-pointer hover:bg-surface-active hover:outline-none focus:bg-surface-active focus:outline-none ", o = "flex items-center justify-center h-[1.5rem] bg-surface-default text-glyph-active cursor-default", c = "flex items-center gap-xs self-stretch", f = {
|
|
9
9
|
default: "affirmative",
|
|
10
10
|
warning: "warning",
|
|
11
11
|
error: "alert",
|
|
12
12
|
disabled: "disabled"
|
|
13
13
|
};
|
|
14
14
|
export {
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
f as badgeStyleMap,
|
|
16
|
+
l as contentStyles,
|
|
17
17
|
s as filterDropdownStyles,
|
|
18
18
|
c as hintStyles,
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
n as itemStyles,
|
|
20
|
+
o as scrollButtonStyles,
|
|
21
21
|
r as triggerStyles
|
|
22
22
|
};
|