@ogcio/design-system-react 1.15.1 → 1.15.3

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,5 +1,7 @@
1
1
  import { FC } from 'react';
2
2
  import { InnerStepProps, ProgressStepperProps, StepItemProps } from './types.js';
3
- export declare const Step: ({ isCurrentStep, isCompleted, isLastStep, stepNumber, orientation, children, indicator, verticalSlot, defaultOpen, dataTestId, ariaLabel, verticalGap, }: InnerStepProps) => import("react/jsx-runtime").JSX.Element;
3
+ export declare const Step: ({ isCurrentStep, isCompleted, isLastStep, isDisabled, stepNumber, orientation, children, indicator, verticalSlot, defaultOpen, dataTestId, ariaLabel, verticalGap, }: InnerStepProps & {
4
+ isDisabled?: boolean;
5
+ }) => import("react/jsx-runtime").JSX.Element;
4
6
  export declare const StepItem: FC<StepItemProps>;
5
- export declare const ProgressStepper: ({ children, currentStepIndex, orientation, indicator, completeAll, dataTestId, className, verticalGap, }: ProgressStepperProps) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const ProgressStepper: ({ children, currentStepIndex, orientation, indicator, completeAll, stepStates, dataTestId, className, verticalGap, }: ProgressStepperProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,111 +1,113 @@
1
- import { jsxs as v, jsx as r } from "react/jsx-runtime";
2
- import { Children as P } from "react";
3
- import { cn as $ } from "../cn.js";
4
- import { Icon as z } from "../icon/icon.js";
5
- import { ProgressStepperIndicator as f } from "./types.js";
6
- const j = (e) => `calc(100% + ${e * 4 - 36}px)`, k = ({
1
+ import { jsxs as v, jsx as o } from "react/jsx-runtime";
2
+ import { Children as k } from "react";
3
+ import { cn as H } from "../cn.js";
4
+ import { Icon as L } from "../icon/icon.js";
5
+ import { ProgressStepperIndicator as u } from "./types.js";
6
+ const V = (e) => `calc(100% + ${e * 4 - 36}px)`, B = ({
7
7
  isNextStep: e,
8
8
  orientation: t = "horizontal",
9
- isCurrentStep: s,
10
- isCompleted: a,
9
+ isCurrentStep: a,
10
+ isCompleted: c,
11
11
  verticalGap: l
12
12
  }) => {
13
- const o = t === "vertical" ? { height: j(l) } : void 0;
13
+ const s = t === "vertical" ? { height: V(l) } : void 0;
14
14
  return /* @__PURE__ */ v(
15
15
  "div",
16
16
  {
17
17
  "data-orientation": t,
18
18
  "data-next": e,
19
- "data-completed": a,
20
- "data-current": s,
19
+ "data-completed": c,
20
+ "data-current": a,
21
21
  className: "gi-progress-stepper-step-connector",
22
22
  "aria-hidden": "true",
23
- style: o,
23
+ style: s,
24
24
  children: [
25
- /* @__PURE__ */ r("span", {}),
26
- s ? /* @__PURE__ */ r("span", {}) : null
25
+ /* @__PURE__ */ o("span", {}),
26
+ a ? /* @__PURE__ */ o("span", {}) : null
27
27
  ]
28
28
  }
29
29
  );
30
- }, x = (e) => ({
31
- [f.Hashtag]: {
32
- completed: /* @__PURE__ */ r(z, { icon: "check" }),
30
+ }, I = (e) => ({
31
+ [u.Hashtag]: {
32
+ completed: /* @__PURE__ */ o(L, { icon: "check" }),
33
33
  current: () => "#",
34
34
  next: () => "#"
35
35
  },
36
- [f.Number]: {
37
- completed: /* @__PURE__ */ r(z, { icon: "check" }),
38
- current: (s) => s,
39
- next: (s) => s
36
+ [u.Number]: {
37
+ completed: /* @__PURE__ */ o(L, { icon: "check" }),
38
+ current: (a) => a,
39
+ next: (a) => a
40
40
  }
41
- })[e], V = (e, t, s, a) => {
42
- const { current: l, completed: o, next: i } = x(
43
- e || f.Hashtag
41
+ })[e], q = (e, t, a, c) => {
42
+ const { current: l, completed: s, next: i } = I(
43
+ e || u.Hashtag
44
44
  );
45
- return s ? o : a ? l(t) : i(t);
46
- }, B = ({
45
+ return a ? s : c ? l(t) : i(t);
46
+ }, x = ({
47
47
  isCurrentStep: e,
48
48
  isCompleted: t,
49
- isLastStep: s,
50
- stepNumber: a,
51
- orientation: l,
52
- children: o,
53
- indicator: i,
49
+ isLastStep: a,
50
+ isDisabled: c = !1,
51
+ stepNumber: l,
52
+ orientation: s,
53
+ children: i,
54
+ indicator: d,
54
55
  verticalSlot: n,
55
- defaultOpen: d,
56
- dataTestId: u,
57
- ariaLabel: g,
58
- verticalGap: h
56
+ defaultOpen: g,
57
+ dataTestId: b,
58
+ ariaLabel: h,
59
+ verticalGap: m
59
60
  }) => {
60
- const m = !t && !e, c = l === "vertical" && (e || d || t), p = !!o;
61
- return /* @__PURE__ */ v("div", { className: "gi-relative", children: [
61
+ const f = !t && !e, r = s === "vertical" && (e || g || t), p = !!i;
62
+ return /* @__PURE__ */ v("div", { className: `gi-relative ${c ? "gi-disabled" : ""}`, children: [
62
63
  /* @__PURE__ */ v(
63
64
  "div",
64
65
  {
65
66
  className: "gi-progress-stepper-step-container",
66
- "data-orientation": l,
67
+ "data-orientation": s,
67
68
  "data-current": e,
68
69
  "data-completed": t,
69
- "data-next": m,
70
- "data-indicator": i,
71
- "aria-labelledby": `step-label-${a}`,
72
- "data-testid": u || `step-label-${a}`,
73
- "aria-label": p ? void 0 : g,
70
+ "data-disabled": c,
71
+ "data-next": f,
72
+ "data-indicator": d,
73
+ "aria-labelledby": `step-label-${l}`,
74
+ "data-testid": b || `step-label-${l}`,
75
+ "aria-label": p ? void 0 : h,
74
76
  children: [
75
- /* @__PURE__ */ r("div", { className: "gi-progress-stepper-step", "data-indicator": i, children: V(
76
- i || f.Hashtag,
77
- a,
77
+ /* @__PURE__ */ o("div", { className: "gi-progress-stepper-step", "data-indicator": d, children: q(
78
+ d || u.Hashtag,
79
+ l,
78
80
  t,
79
81
  e
80
82
  ) }),
81
- p && /* @__PURE__ */ r(
83
+ p && /* @__PURE__ */ o(
82
84
  "div",
83
85
  {
84
86
  className: "gi-progress-stepper-step-label",
85
- "data-orientation": l,
86
- id: `step-label-${a}`,
87
- children: o
87
+ "data-orientation": s,
88
+ id: `step-label-${l}`,
89
+ children: i
88
90
  }
89
91
  )
90
92
  ]
91
93
  }
92
94
  ),
93
- s ? null : /* @__PURE__ */ r(
94
- k,
95
+ a ? null : /* @__PURE__ */ o(
96
+ B,
95
97
  {
96
98
  isCurrentStep: e,
97
- isNextStep: m,
99
+ isNextStep: f,
98
100
  isCompleted: t,
99
- orientation: l,
100
- stepNumber: a,
101
- verticalGap: h
101
+ orientation: s,
102
+ stepNumber: l,
103
+ verticalGap: m
102
104
  }
103
105
  ),
104
- c && n && /* @__PURE__ */ r(
106
+ r && n && /* @__PURE__ */ o(
105
107
  "div",
106
108
  {
107
- "data-testid": `vertical-step-slot-${a - 1}`,
108
- className: $("gi-ml-10", {
109
+ "data-testid": `vertical-step-slot-${l - 1}`,
110
+ className: H("gi-ml-10", {
109
111
  "gi-pt-5": p,
110
112
  "-gi-mt-[34px]": !p && n
111
113
  }),
@@ -113,78 +115,79 @@ const j = (e) => `calc(100% + ${e * 4 - 36}px)`, k = ({
113
115
  }
114
116
  )
115
117
  ] });
116
- }, I = () => null, J = ({
118
+ }, M = () => null, Q = ({
117
119
  children: e,
118
120
  currentStepIndex: t = 0,
119
- orientation: s = "horizontal",
120
- indicator: a = "number",
121
+ orientation: a = "horizontal",
122
+ indicator: c = "number",
121
123
  completeAll: l,
122
- dataTestId: o,
123
- className: i,
124
+ stepStates: s,
125
+ dataTestId: i,
126
+ className: d,
124
127
  verticalGap: n = 14
125
128
  }) => {
126
- var g, h;
127
- const d = (h = (g = e[t]) == null ? void 0 : g.props) == null ? void 0 : h.children, u = s === "horizontal" && d;
129
+ var h, m;
130
+ const g = (m = (h = e[t]) == null ? void 0 : h.props) == null ? void 0 : m.children, b = a === "horizontal" && g;
128
131
  return /* @__PURE__ */ v(
129
132
  "div",
130
133
  {
131
134
  role: "presentation",
132
- className: $("gi-w-full", {
133
- "gi-flex": s === "vertical"
135
+ className: H("gi-w-full", {
136
+ "gi-flex": a === "vertical"
134
137
  }),
135
138
  children: [
136
- /* @__PURE__ */ r(
139
+ /* @__PURE__ */ o(
137
140
  "div",
138
141
  {
139
142
  "data-testid": "progress-stepper",
140
- className: $(
143
+ className: H(
141
144
  "gi-progress-stepper",
142
145
  {
143
- [`gi-gap-${n}`]: s === "vertical"
146
+ [`gi-gap-${n}`]: a === "vertical"
144
147
  },
145
- i
148
+ d
146
149
  ),
147
- "data-orientation": s,
150
+ "data-orientation": a,
148
151
  role: "list",
149
152
  "aria-live": "polite",
150
- children: P.map(e, (m, c) => {
151
- var b, N;
153
+ children: k.map(e, (f, r) => {
154
+ var w, y;
152
155
  const {
153
156
  label: p = "",
154
- defaultOpen: H,
155
- ariaLabel: w
156
- } = m.props, [y, L, O] = [
157
- !l && t === c,
158
- c === e.length - 1,
159
- l || c < t && c !== t
160
- ];
161
- return /* @__PURE__ */ r("div", { className: "gi-w-full", role: "listitem", children: /* @__PURE__ */ r(
162
- B,
157
+ defaultOpen: O,
158
+ ariaLabel: P
159
+ } = f.props;
160
+ let $, N, z;
161
+ s && s[r] ? ($ = !!s[r].current, N = !!s[r].completed, z = !!s[r].disabled) : ($ = !l && t === r, N = l || r < t, z = !1);
162
+ const j = r === e.length - 1;
163
+ return /* @__PURE__ */ o("div", { className: "gi-w-full", role: "listitem", children: /* @__PURE__ */ o(
164
+ x,
163
165
  {
164
- stepNumber: c + 1,
165
- isCurrentStep: y,
166
- isCompleted: O,
167
- orientation: s,
168
- isLastStep: L,
169
- verticalSlot: (N = (b = e[c]) == null ? void 0 : b.props) == null ? void 0 : N.children,
170
- defaultOpen: H,
171
- indicator: a,
172
- dataTestId: o,
173
- ariaLabel: w,
166
+ stepNumber: r + 1,
167
+ isCurrentStep: $,
168
+ isCompleted: N,
169
+ isDisabled: z,
170
+ orientation: a,
171
+ isLastStep: j,
172
+ verticalSlot: (y = (w = e[r]) == null ? void 0 : w.props) == null ? void 0 : y.children,
173
+ defaultOpen: O,
174
+ indicator: c,
175
+ dataTestId: i,
176
+ ariaLabel: P,
174
177
  verticalGap: n,
175
178
  children: p
176
179
  },
177
- o || `progress-stepper-step-${c}`
180
+ i || `progress-stepper-step-${r}`
178
181
  ) });
179
182
  })
180
183
  }
181
184
  ),
182
- u && /* @__PURE__ */ r(
185
+ b && /* @__PURE__ */ o(
183
186
  "div",
184
187
  {
185
188
  className: "gi-h-full",
186
189
  "data-testid": `horizontal-step-slot-${t}`,
187
- children: d
190
+ children: g
188
191
  }
189
192
  )
190
193
  ]
@@ -192,7 +195,7 @@ const j = (e) => `calc(100% + ${e * 4 - 36}px)`, k = ({
192
195
  );
193
196
  };
194
197
  export {
195
- J as ProgressStepper,
196
- B as Step,
197
- I as StepItem
198
+ Q as ProgressStepper,
199
+ x as Step,
200
+ M as StepItem
198
201
  };
@@ -23,6 +23,11 @@ export type ProgressStepperProps = {
23
23
  indicator?: ProgressStepperIndicatorType;
24
24
  className?: string;
25
25
  verticalGap?: number;
26
+ stepStates?: {
27
+ completed?: boolean;
28
+ current?: boolean;
29
+ disabled?: boolean;
30
+ }[];
26
31
  };
27
32
  export type InnerStepProps = {
28
33
  children: string;
@@ -1,30 +1,28 @@
1
1
  "use client";
2
- import { jsxs as b, jsx as n } from "react/jsx-runtime";
3
- import { forwardRef as H, useState as v, useEffect as K, Children as P, isValidElement as V, cloneElement as N } from "react";
4
- import { cn as F } from "../cn.js";
5
- import { translate as B } from "../i18n/utility.js";
6
- import { Icon as J } from "../icon/icon.js";
7
- import { InputText as Q } from "../input-text/input-text.js";
8
- import { Label as U } from "../label/label.js";
9
- import { Spinner as W } from "../spinner/spinner.js";
10
- const se = H(
11
- ({ children: o, className: i, onChange: s, enableSearch: r, isLoading: c, showNoData: m }, g) => {
12
- const [l, y] = v(""), [O, f] = v(!1), [S, w] = v([]);
13
- K(() => {
14
- f(!1), m && setTimeout(() => f(!0), 0);
15
- }, [m]), K(() => {
16
- const R = P.toArray(o).filter(
17
- (a) => V(a)
2
+ import { jsxs as N, jsx as n } from "react/jsx-runtime";
3
+ import { forwardRef as F, useState as $, useEffect as R, Children as z, isValidElement as A, cloneElement as v } from "react";
4
+ import { cn as P } from "../cn.js";
5
+ import { translate as K } from "../i18n/utility.js";
6
+ import { Icon as q } from "../icon/icon.js";
7
+ import { InputText as H } from "../input-text/input-text.js";
8
+ import { Label as J } from "../label/label.js";
9
+ import { Spinner as Q } from "../spinner/spinner.js";
10
+ const re = F(
11
+ ({ children: o, className: i, onChange: s, enableSearch: r, isLoading: c, showNoData: d }, g) => {
12
+ const [l, O] = $(""), [S, w] = $([]);
13
+ R(() => {
14
+ const u = z.toArray(o).filter(
15
+ (a) => A(a)
18
16
  ).map((a) => {
19
- var L, M, T, I, k, E;
20
- const q = (L = a == null ? void 0 : a.type) == null ? void 0 : L.componentType, D = l.toLowerCase();
21
- switch (q) {
17
+ var x, L, M, I, T, k;
18
+ const B = (x = a == null ? void 0 : a.type) == null ? void 0 : x.componentType, b = l.toLowerCase();
19
+ switch (B) {
22
20
  case "SelectMenuOption": {
23
21
  const e = a;
24
22
  if (typeof e.props.value == "string") {
25
- const G = ((I = (T = (M = e == null ? void 0 : e.props) == null ? void 0 : M.children) == null ? void 0 : T.toString()) == null ? void 0 : I.toLowerCase()) || "", j = (E = (k = e == null ? void 0 : e.props) == null ? void 0 : k.value) == null ? void 0 : E.toLowerCase();
26
- if (G.includes(D) || j.includes(D))
27
- return N(e, {
23
+ const D = ((I = (M = (L = e == null ? void 0 : e.props) == null ? void 0 : L.children) == null ? void 0 : M.toString()) == null ? void 0 : I.toLowerCase()) || "", E = (k = (T = e == null ? void 0 : e.props) == null ? void 0 : T.value) == null ? void 0 : k.toLowerCase();
24
+ if (D.includes(b) || E.includes(b))
25
+ return v(e, {
28
26
  onChange: s,
29
27
  enableSearch: r
30
28
  });
@@ -32,114 +30,116 @@ const se = H(
32
30
  break;
33
31
  }
34
32
  case "SelectMenuGroupItem": {
35
- const e = a, C = P.toArray(
33
+ const e = a, G = z.toArray(
36
34
  e.props.children
37
- ).filter((t) => V(t)).map((t) => {
35
+ ).filter((t) => A(t)).map((t) => {
38
36
  var p;
39
- return ((p = t == null ? void 0 : t.type) == null ? void 0 : p.componentType) === "SelectMenuOption" ? N(t, { onChange: s }) : null;
37
+ return ((p = t == null ? void 0 : t.type) == null ? void 0 : p.componentType) === "SelectMenuOption" ? v(t, { onChange: s }) : null;
40
38
  }).filter(
41
39
  (t) => t !== null
42
40
  ).filter((t) => {
43
- var $, z, A;
44
- const p = ((z = ($ = t.props.children) == null ? void 0 : $.toString()) == null ? void 0 : z.toLowerCase()) || "", d = ((A = t.props.value) == null ? void 0 : A.toLowerCase()) || "";
45
- return (p == null ? void 0 : p.includes(l.toLowerCase())) || (d == null ? void 0 : d.includes(l.toLowerCase()));
41
+ var j, C, V;
42
+ const p = ((C = (j = t.props.children) == null ? void 0 : j.toString()) == null ? void 0 : C.toLowerCase()) || "", f = ((V = t.props.value) == null ? void 0 : V.toLowerCase()) || "";
43
+ return (p == null ? void 0 : p.includes(l.toLowerCase())) || (f == null ? void 0 : f.includes(l.toLowerCase()));
46
44
  });
47
- return C.length > 0 || l === "" ? N(e, {
48
- children: C
45
+ return G.length > 0 || l === "" ? v(e, {
46
+ children: G
49
47
  }) : null;
50
48
  }
51
49
  default:
52
50
  return null;
53
51
  }
54
52
  }).filter(Boolean);
55
- w(R);
53
+ w(u);
56
54
  }, [o, l, s]);
57
- const h = (x) => {
58
- y(x.target.value);
59
- }, u = () => c ? /* @__PURE__ */ n("div", { className: "gi-select-menu-loading", children: /* @__PURE__ */ n(W, { size: "md" }) }) : O ? /* @__PURE__ */ n("div", { className: "gi-select-menu-option-not-found", children: B("autocomplete.noData") }) : /* @__PURE__ */ n("ul", { children: S });
60
- return /* @__PURE__ */ b("div", { ref: g, className: F("gi-select-menu-container", i), children: [
55
+ const y = (m) => {
56
+ O(m.target.value);
57
+ }, h = () => c ? /* @__PURE__ */ n("div", { className: "gi-select-menu-loading", children: /* @__PURE__ */ n(Q, { size: "md" }) }) : d ? /* @__PURE__ */ n("div", { className: "gi-select-menu-option-not-found", children: K("autocomplete.noData", {
58
+ defaultValue: "No data found."
59
+ }) }) : /* @__PURE__ */ n("ul", { children: S });
60
+ return /* @__PURE__ */ N("div", { ref: g, className: P("gi-select-menu-container", i), children: [
61
61
  r && /* @__PURE__ */ n("div", { className: "gi-select-menu-input-container", children: /* @__PURE__ */ n(
62
- Q,
62
+ H,
63
63
  {
64
64
  tabIndex: 0,
65
- placeholder: B("input.search"),
65
+ placeholder: K("input.search"),
66
66
  iconEnd: "search",
67
- onChange: h,
67
+ onChange: y,
68
68
  value: l
69
69
  }
70
70
  ) }),
71
- /* @__PURE__ */ n("div", { className: "gi-select-menu-option-container", children: u() })
71
+ /* @__PURE__ */ n("div", { className: "gi-select-menu-option-container", children: h() })
72
72
  ] });
73
73
  }
74
- ), X = ({
74
+ ), U = ({
75
75
  children: o,
76
76
  value: i,
77
77
  selected: s,
78
78
  onChange: r,
79
79
  disabled: c,
80
- dataTestid: m,
80
+ dataTestid: d,
81
81
  className: g,
82
82
  hidden: l,
83
- enableSearch: y,
84
- isHighlighted: O,
85
- index: f,
86
- ...S
83
+ enableSearch: O,
84
+ isHighlighted: S,
85
+ index: w,
86
+ ...y
87
87
  }) => {
88
- const w = (u) => {
88
+ const h = (u) => {
89
89
  (u.key === "Enter" || u.key === " ") && (u.preventDefault(), r == null || r(i));
90
- }, h = () => {
90
+ }, m = () => {
91
91
  c || r == null || r(i);
92
92
  };
93
- return l ? null : /* @__PURE__ */ b(
93
+ return l ? null : /* @__PURE__ */ N(
94
94
  "li",
95
95
  {
96
96
  role: "option",
97
97
  tabIndex: c ? -1 : 0,
98
- "data-index": f,
98
+ "data-index": w,
99
99
  "aria-selected": s,
100
100
  "aria-label": o == null ? void 0 : o.toString(),
101
101
  "aria-disabled": c,
102
- onKeyDown: w,
103
- onClick: h,
104
- className: F(
102
+ onKeyDown: h,
103
+ onClick: m,
104
+ className: P(
105
105
  "gi-select-option-item",
106
106
  {
107
107
  "gi-select-option-item-disabled": c,
108
- "gi-select-option-item-highlighted": O
108
+ "gi-select-option-item-highlighted": S
109
109
  },
110
110
  g
111
111
  ),
112
- "data-search-enabled": y,
113
- "data-testid": m || `option-${i}`,
114
- ...S,
112
+ "data-search-enabled": O,
113
+ "data-testid": d || `option-${i}`,
114
+ ...y,
115
115
  children: [
116
116
  /* @__PURE__ */ n("span", { className: "gi-text-sm", children: o }),
117
- s && /* @__PURE__ */ n(J, { icon: "check" })
117
+ s && /* @__PURE__ */ n(q, { icon: "check" })
118
118
  ]
119
119
  },
120
120
  `${o}-${i}`
121
121
  );
122
122
  };
123
- Object.defineProperty(X, "componentType", {
123
+ Object.defineProperty(U, "componentType", {
124
124
  value: "SelectMenuOption",
125
125
  writable: !1,
126
126
  enumerable: !1
127
127
  });
128
- const Y = ({
128
+ const W = ({
129
129
  children: o,
130
130
  label: i,
131
131
  ...s
132
- }) => /* @__PURE__ */ b("div", { ...s, role: "group", className: "gi-px-3", children: [
133
- /* @__PURE__ */ n(U, { text: i, size: "sm", className: "gi-font-bold gi-pb-1" }),
132
+ }) => /* @__PURE__ */ N("div", { ...s, role: "group", className: "gi-px-3", children: [
133
+ /* @__PURE__ */ n(J, { text: i, size: "sm", className: "gi-font-bold gi-pb-1" }),
134
134
  o
135
135
  ] });
136
- Object.defineProperty(Y, "componentType", {
136
+ Object.defineProperty(W, "componentType", {
137
137
  value: "SelectMenuGroupItem",
138
138
  writable: !1,
139
139
  enumerable: !1
140
140
  });
141
141
  export {
142
- se as SelectMenu,
143
- Y as SelectMenuGroupItem,
144
- X as SelectMenuOption
142
+ re as SelectMenu,
143
+ W as SelectMenuGroupItem,
144
+ U as SelectMenuOption
145
145
  };