@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.
@@ -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 d, jsx as t } from "react/jsx-runtime";
2
- import { useState as p } from "react";
3
- import { Icons as n } from "../../../atoms/icons/icons.js";
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 b } from "../../../styles/typography/style.js";
9
+ import { styleMap as v } from "../../../styles/typography/style.js";
10
10
  import "../../../styles/colors/colormap.js";
11
- const w = ({
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 [c, r] = p(!1), m = () => {
18
- r(!0);
19
- }, u = () => {
20
- r(!1);
20
+ const [f, t] = x(!1), p = () => {
21
+ t(!0);
22
+ }, d = () => {
23
+ t(!1);
21
24
  };
22
- return /* @__PURE__ */ d(
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
- c && l.active,
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__ */ t(
32
- n,
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 ${b[1]}`),
41
+ className: s(`focus:outline-none w-full ${v[1]}`),
44
42
  placeholder: i,
45
- onFocus: m,
46
- onBlur: u,
47
- onChange: (f) => e == null ? void 0 : e(f.target.value),
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
- w as ContextSearch
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 R, useState as V } from "react";
3
- import { R as P, T as $, I as F, P as K, C as z, V as L, a as M } from "../../../../index-CnWyMXBX.js";
4
- import { c as U } from "../../../../index-fN7hCOo3.js";
5
- import { outlinedBorder as N, border as W } from "../../../styles/defaults/defaults.js";
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 Z, contentStyles as q } from "./styles.js";
8
- import { Badge as S } from "../../../atoms/badge/badge.js";
9
- import { Icons as k } from "../../../atoms/icons/icons.js";
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 G } from "../checkbox/checkbox.js";
13
- import { t as A } from "../../../../bundle-mjs-CAy1p0fn.js";
14
- import { getBorderClasses as H } from "../../../atoms/form/utils-for-forms/state-functions.js";
15
- import { useStickyZIndex as J } from "../../../../hooks/use-sticky-z-index.js";
16
- const fe = ({
17
- onChange: y,
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 x = R(null), O = J(x), [c, i] = V(!1), v = H(c, !1, !1, a), I = a ? `bg-surface-disabled ${N.disabled}` : "bg-surface-default", u = Array.isArray(o) ? o.length - 1 : 0;
26
- function w(e) {
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 b = (e, r) => {
30
+ const N = (e, r) => {
30
31
  if (Array.isArray(r)) {
31
32
  if (!r.length) return "";
32
- if (w(e)) {
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 (w(e)) {
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, B = (e) => typeof e == "string" ? e : e.label, m = (e) => {
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], y(r);
48
+ Array.isArray(o) && o.includes(e) ? r = [...o.filter((l) => l !== e)] : r = [...o, e], x(r);
48
49
  } else
49
- y(e);
50
- }, h = f.filter((e) => !e.hide), T = (e, r) => {
50
+ x(e);
51
+ }, h = f.filter((e) => !e.hide), j = (e, r) => {
51
52
  e.key === "Enter" && m(r);
52
- }, j = (e) => {
53
+ }, E = (e) => {
53
54
  e.key === "Escape" && i(!1);
54
- }, E = () => {
55
+ }, R = () => {
55
56
  i(!1);
56
57
  };
57
- return /* @__PURE__ */ s("div", { className: "w-full", children: /* @__PURE__ */ n(
58
- P,
58
+ return /* @__PURE__ */ s("div", { className: y("w-full", O), children: /* @__PURE__ */ n(
59
+ $,
59
60
  {
60
- value: b(f, o),
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: A(Z, I, v),
72
- ref: x,
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: b(f, o),
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 && u > 0 && /* @__PURE__ */ s(S, { text: "+" + u, color: "affirmative" })
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(F, { className: "flex-shrink-0", children: /* @__PURE__ */ s(
96
- k,
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(K, { children: /* @__PURE__ */ s(
108
- z,
108
+ /* @__PURE__ */ s(z, { children: /* @__PURE__ */ s(
109
+ L,
109
110
  {
110
- className: U(
111
- q,
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 ? N.active : W.default
115
+ c ? S.active : Z.default
115
116
  ),
116
117
  position: "popper",
117
118
  side: "bottom",
118
- onPointerDownOutside: E,
119
- onKeyDown: j,
120
- style: { minWidth: "auto", zIndex: O },
121
- children: /* @__PURE__ */ s(L, { children: h == null ? void 0 : h.map((e, r) => /* @__PURE__ */ s(
122
- M,
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: A(
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) => T(l, d(e)),
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
- G,
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(k, { ...e.icon, color: e.color ? e.color : "default" }),
143
+ e.icon && /* @__PURE__ */ s(A, { ...e.icon, color: e.color ? e.color : "default" }),
143
144
  !e.icon && e.badgeText && /* @__PURE__ */ s(
144
- S,
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: B(e),
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
- fe as DropdownFilter
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-auto flex flex-row justify-between items-center gap-xs"
6
- ), n = e(
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
- ), o = "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 ", l = "flex items-center justify-center h-[1.5rem] bg-surface-default text-glyph-active cursor-default", c = "flex items-center gap-xs self-stretch", a = {
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
- a as badgeStyleMap,
16
- n as contentStyles,
15
+ f as badgeStyleMap,
16
+ l as contentStyles,
17
17
  s as filterDropdownStyles,
18
18
  c as hintStyles,
19
- o as itemStyles,
20
- l as scrollButtonStyles,
19
+ n as itemStyles,
20
+ o as scrollButtonStyles,
21
21
  r as triggerStyles
22
22
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@temp-spotwork/ui",
3
3
  "private": false,
4
- "version": "1.4.4",
4
+ "version": "1.4.5",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",
7
7
  "types": "dist/main.d.ts",