@ogcio/design-system-react 1.15.1 → 1.15.2

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,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,6 +1,6 @@
1
1
  "use client";
2
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";
3
+ import { forwardRef as H, useState as N, useEffect as A, Children as K, isValidElement as P, cloneElement as v } from "react";
4
4
  import { cn as F } from "../cn.js";
5
5
  import { translate as B } from "../i18n/utility.js";
6
6
  import { Icon as J } from "../icon/icon.js";
@@ -9,12 +9,12 @@ import { Label as U } from "../label/label.js";
9
9
  import { Spinner as W } from "../spinner/spinner.js";
10
10
  const se = H(
11
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(() => {
12
+ const [l, y] = N(""), [O, f] = N(!1), [S, w] = N([]);
13
+ A(() => {
14
14
  f(!1), m && setTimeout(() => f(!0), 0);
15
- }, [m]), K(() => {
16
- const R = P.toArray(o).filter(
17
- (a) => V(a)
15
+ }, [m]), A(() => {
16
+ const R = K.toArray(o).filter(
17
+ (a) => P(a)
18
18
  ).map((a) => {
19
19
  var L, M, T, I, k, E;
20
20
  const q = (L = a == null ? void 0 : a.type) == null ? void 0 : L.componentType, D = l.toLowerCase();
@@ -24,7 +24,7 @@ const se = H(
24
24
  if (typeof e.props.value == "string") {
25
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
26
  if (G.includes(D) || j.includes(D))
27
- return N(e, {
27
+ return v(e, {
28
28
  onChange: s,
29
29
  enableSearch: r
30
30
  });
@@ -32,19 +32,19 @@ const se = H(
32
32
  break;
33
33
  }
34
34
  case "SelectMenuGroupItem": {
35
- const e = a, C = P.toArray(
35
+ const e = a, C = K.toArray(
36
36
  e.props.children
37
- ).filter((t) => V(t)).map((t) => {
37
+ ).filter((t) => P(t)).map((t) => {
38
38
  var p;
39
- return ((p = t == null ? void 0 : t.type) == null ? void 0 : p.componentType) === "SelectMenuOption" ? N(t, { onChange: s }) : null;
39
+ return ((p = t == null ? void 0 : t.type) == null ? void 0 : p.componentType) === "SelectMenuOption" ? v(t, { onChange: s }) : null;
40
40
  }).filter(
41
41
  (t) => t !== null
42
42
  ).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()) || "";
43
+ var V, $, z;
44
+ const p = (($ = (V = t.props.children) == null ? void 0 : V.toString()) == null ? void 0 : $.toLowerCase()) || "", d = ((z = t.props.value) == null ? void 0 : z.toLowerCase()) || "";
45
45
  return (p == null ? void 0 : p.includes(l.toLowerCase())) || (d == null ? void 0 : d.includes(l.toLowerCase()));
46
46
  });
47
- return C.length > 0 || l === "" ? N(e, {
47
+ return C.length > 0 || l === "" ? v(e, {
48
48
  children: C
49
49
  }) : null;
50
50
  }
@@ -56,7 +56,9 @@ const se = H(
56
56
  }, [o, l, s]);
57
57
  const h = (x) => {
58
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 });
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", {
60
+ defaultValue: "No data found."
61
+ }) }) : /* @__PURE__ */ n("ul", { children: S });
60
62
  return /* @__PURE__ */ b("div", { ref: g, className: F("gi-select-menu-container", i), children: [
61
63
  r && /* @__PURE__ */ n("div", { className: "gi-select-menu-input-container", children: /* @__PURE__ */ n(
62
64
  Q,