@ogcio/design-system-react 1.23.0 → 1.24.0

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,11 +1,9 @@
1
- import { default as React } from 'react';
1
+ import { default as React, ComponentPropsWithRef } from 'react';
2
2
  export type AccordionItemProps = {
3
3
  children: React.ReactNode;
4
4
  label: string;
5
5
  defaultExpanded?: boolean;
6
6
  disabled?: boolean;
7
- dataTestid?: string;
8
- iconStart?: boolean;
9
7
  variant?: 'default' | 'small';
10
- };
11
- export declare const AccordionItem: ({ defaultExpanded, children, label, disabled, dataTestid, iconStart, variant, }: AccordionItemProps) => import("react/jsx-runtime").JSX.Element;
8
+ } & ComponentPropsWithRef<'div'>;
9
+ export declare const AccordionItem: ({ defaultExpanded, children, label, disabled, className, variant, ...props }: AccordionItemProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,8 @@
1
1
  "use client";
2
- import { jsxs as d, Fragment as u, jsx as i } from "react/jsx-runtime";
2
+ import { jsxs as r, Fragment as u, jsx as a } from "react/jsx-runtime";
3
+ import { c as t } from "../clsx-OuTLNxxd.js";
3
4
  import { useState as y, useRef as b } from "react";
4
5
  import { c as h } from "../index-CB-zPpNk.js";
5
- import { cn as r } from "../cn.js";
6
6
  import { Icon as w } from "../icon/icon.js";
7
7
  const I = h({
8
8
  variants: {
@@ -11,41 +11,46 @@ const I = h({
11
11
  small: "gi-py-2 gi-px-2 gi-text-sm gi-font-bold"
12
12
  }
13
13
  }
14
- }), N = ({
15
- defaultExpanded: c,
16
- children: s,
17
- label: t,
18
- disabled: e,
19
- dataTestid: l,
20
- iconStart: m,
21
- variant: n = "default"
14
+ }), j = ({
15
+ defaultExpanded: s,
16
+ children: c,
17
+ label: i,
18
+ disabled: n,
19
+ className: l,
20
+ variant: e = "default",
21
+ ...m
22
22
  }) => {
23
- const [o, a] = y(c), g = b(null), p = `${t}-button`, f = `${t}-panel`;
24
- return /* @__PURE__ */ d(u, { children: [
25
- /* @__PURE__ */ i(
23
+ const [o, d] = y(s), g = b(null), p = `${i}-button`, f = `${i}-panel`;
24
+ return /* @__PURE__ */ r(u, { children: [
25
+ /* @__PURE__ */ a(
26
26
  "div",
27
27
  {
28
+ ...m,
28
29
  ref: g,
29
- "data-testid": l,
30
- "data-disabled": !!e,
31
- "data-icon-start": !!m,
32
- onClick: () => !e && a(!o),
30
+ "data-disabled": !!n,
31
+ onClick: () => !n && d(!o),
33
32
  onKeyDown: (x) => {
34
- x.key === "Enter" && !e && a(!o);
33
+ x.key === "Enter" && !n && d(!o);
35
34
  },
36
35
  tabIndex: 0,
37
- className: "gi-accordion",
38
- children: /* @__PURE__ */ d(
36
+ className: t("gi-accordion", l),
37
+ children: /* @__PURE__ */ r(
39
38
  "div",
40
39
  {
41
- className: r("gi-accordion-header", I({ variant: n })),
40
+ className: t(
41
+ "gi-accordion-header",
42
+ I({ variant: e })
43
+ ),
42
44
  children: [
43
- t,
44
- " ",
45
- /* @__PURE__ */ i(
45
+ i,
46
+ /* @__PURE__ */ a(
46
47
  w,
47
48
  {
48
- icon: o ? "keyboard_arrow_up" : "keyboard_arrow_down"
49
+ icon: o ? "keyboard_arrow_up" : "keyboard_arrow_down",
50
+ size: "md",
51
+ className: t({
52
+ "gi-pt-[1.5px]": e === "default"
53
+ })
49
54
  }
50
55
  )
51
56
  ]
@@ -53,23 +58,23 @@ const I = h({
53
58
  )
54
59
  }
55
60
  ),
56
- /* @__PURE__ */ i(
61
+ /* @__PURE__ */ a(
57
62
  "div",
58
63
  {
59
64
  id: f,
60
65
  role: "region",
61
66
  "aria-labelledby": p,
62
- className: r("gi-px-2 gi-pb-4 gi-pt-2 gi-font-normal", {
67
+ className: t("gi-px-2 gi-pb-4 gi-pt-2 gi-font-normal", {
63
68
  "gi-block": o,
64
69
  "gi-hidden": !o,
65
- "gi-text-md": n === "default",
66
- "gi-text-sm": n === "small"
70
+ "gi-text-md": e === "default",
71
+ "gi-text-sm": e === "small"
67
72
  }),
68
- children: s
73
+ children: c
69
74
  }
70
75
  )
71
76
  ] });
72
77
  };
73
78
  export {
74
- N as AccordionItem
79
+ j as AccordionItem
75
80
  };
@@ -1,10 +1,8 @@
1
- import { ReactElement } from 'react';
1
+ import { ComponentPropsWithRef, ReactElement } from 'react';
2
2
  import { AccordionItem } from './accordion-item.js';
3
3
  export type AccordionProps = {
4
4
  children: ReactElement<typeof AccordionItem>[];
5
- iconStart?: boolean;
6
- dataTestid?: string;
7
5
  className?: string;
8
6
  variant?: 'default' | 'small';
9
- };
10
- export declare const Accordion: ({ children, iconStart, dataTestid, className, variant, }: AccordionProps) => import("react/jsx-runtime").JSX.Element;
7
+ } & ComponentPropsWithRef<'div'>;
8
+ export declare const Accordion: ({ children, className, variant, ...props }: AccordionProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,39 +1,28 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
- import { Children as i, isValidElement as c, cloneElement as p } from "react";
3
- import { cn as n } from "../cn.js";
4
- const g = ({
2
+ import { Children as t, isValidElement as c, cloneElement as d } from "react";
3
+ import { cn as i } from "../cn.js";
4
+ const b = ({
5
5
  children: r,
6
- iconStart: t,
7
- dataTestid: l,
8
- className: a,
9
- variant: s = "default"
10
- }) => /* @__PURE__ */ o(
11
- "div",
12
- {
13
- "data-testid": l,
14
- "data-icon-start": t,
15
- role: "presentation",
16
- className: n("gi-w-full", a),
17
- children: i.map(r, (e, d) => {
18
- const m = d === i.count(r) - 1;
19
- return c(e) ? /* @__PURE__ */ o(
20
- "div",
6
+ className: n,
7
+ variant: l = "default",
8
+ ...m
9
+ }) => /* @__PURE__ */ o("div", { ...m, role: "presentation", className: i("gi-w-full", n), children: t.map(r, (e, s) => {
10
+ const a = s === t.count(r) - 1;
11
+ return c(e) ? /* @__PURE__ */ o(
12
+ "div",
13
+ {
14
+ className: i("gi-border-t", {
15
+ "gi-border-b": a
16
+ }),
17
+ children: d(
18
+ e,
21
19
  {
22
- className: n("gi-border-t", {
23
- "gi-border-b": m
24
- }),
25
- children: p(
26
- e,
27
- {
28
- variant: s,
29
- iconStart: t
30
- }
31
- )
20
+ variant: l
32
21
  }
33
- ) : null;
34
- })
35
- }
36
- );
22
+ )
23
+ }
24
+ ) : null;
25
+ }) });
37
26
  export {
38
- g as Accordion
27
+ b as Accordion
39
28
  };
@@ -0,0 +1,16 @@
1
+ function a(r) {
2
+ var f, n, t = "";
3
+ if (typeof r == "string" || typeof r == "number") t += r;
4
+ else if (typeof r == "object") if (Array.isArray(r)) {
5
+ var o = r.length;
6
+ for (f = 0; f < o; f++) r[f] && (n = a(r[f])) && (t && (t += " "), t += n);
7
+ } else for (n in r) r[n] && (t && (t += " "), t += n);
8
+ return t;
9
+ }
10
+ function i() {
11
+ for (var r, f, n = 0, t = "", o = arguments.length; n < o; n++) (r = arguments[n]) && (f = a(r)) && (t && (t += " "), t += f);
12
+ return t;
13
+ }
14
+ export {
15
+ i as c
16
+ };
package/dist/cn.js CHANGED
@@ -1,19 +1,7 @@
1
- function i(r) {
2
- var f, n, t = "";
3
- if (typeof r == "string" || typeof r == "number") t += r;
4
- else if (typeof r == "object") if (Array.isArray(r)) {
5
- var o = r.length;
6
- for (f = 0; f < o; f++) r[f] && (n = i(r[f])) && (t && (t += " "), t += n);
7
- } else for (n in r) r[n] && (t && (t += " "), t += n);
8
- return t;
9
- }
10
- function u() {
11
- for (var r, f, n = 0, t = "", o = arguments.length; n < o; n++) (r = arguments[n]) && (f = i(r)) && (t && (t += " "), t += f);
12
- return t;
13
- }
14
- function a(...r) {
15
- return u(r);
1
+ import { c } from "./clsx-OuTLNxxd.js";
2
+ function o(...r) {
3
+ return c(r);
16
4
  }
17
5
  export {
18
- a as cn
6
+ o as cn
19
7
  };
@@ -1,7 +1,8 @@
1
+ import { ComponentPropsWithoutRef, MouseEventHandler } from 'react';
1
2
  import { iconIds } from './icons.js';
2
3
  export type IconId = (typeof iconIds)[number];
3
4
  export type IconSize = 'sm' | 'md' | 'lg' | 'xl';
4
- export type IconProps = React.HTMLAttributes<HTMLSpanElement> & {
5
+ export type IconProps = {
5
6
  icon: IconId;
6
7
  size?: IconSize;
7
8
  filled?: boolean;
@@ -10,6 +11,17 @@ export type IconProps = React.HTMLAttributes<HTMLSpanElement> & {
10
11
  ariaLabel?: string;
11
12
  inline?: boolean;
12
13
  className?: string;
13
- onClick?: React.MouseEventHandler<HTMLSpanElement>;
14
- };
15
- export declare function Icon({ icon, size, filled, disabled, ariaHidden, ariaLabel, inline, className, onClick, ...props }: IconProps): import("react/jsx-runtime").JSX.Element;
14
+ onClick?: MouseEventHandler<HTMLSpanElement>;
15
+ } & Omit<ComponentPropsWithoutRef<'span'>, 'children'>;
16
+ export declare const Icon: import('react').ForwardRefExoticComponent<{
17
+ icon: IconId;
18
+ size?: IconSize;
19
+ filled?: boolean;
20
+ disabled?: boolean;
21
+ ariaHidden?: boolean;
22
+ ariaLabel?: string;
23
+ inline?: boolean;
24
+ className?: string;
25
+ onClick?: MouseEventHandler<HTMLSpanElement>;
26
+ } & Omit<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref">, "children"> & import('react').RefAttributes<HTMLSpanElement>>;
27
+ export default Icon;
package/dist/icon/icon.js CHANGED
@@ -1,173 +1,86 @@
1
1
  "use client";
2
- import { jsx as e } from "react/jsx-runtime";
3
- import { cn as i } from "../cn.js";
4
- import b from "./svgs/bluesky.js";
5
- import u from "./svgs/facebook.js";
6
- import y from "./svgs/instagram.js";
7
- import z from "./svgs/linkedin.js";
8
- import N from "./svgs/placeholder.js";
9
- import h from "./svgs/threads.js";
10
- import x from "./svgs/tiktok.js";
11
- import _ from "./svgs/x.js";
12
- import n from "./svgs/youtube.js";
13
- function j({
14
- icon: t,
15
- size: g = "md",
16
- filled: c,
17
- disabled: s,
18
- ariaHidden: l,
19
- ariaLabel: a,
20
- inline: r = !1,
21
- className: k = "",
22
- onClick: m,
23
- ...f
24
- }) {
25
- let o = "24px";
26
- switch (g) {
27
- case "sm": {
28
- o = "16px";
29
- break;
2
+ import { jsx as n } from "react/jsx-runtime";
3
+ import { forwardRef as u } from "react";
4
+ import { cn as m } from "../cn.js";
5
+ import _ from "./svgs/bluesky.js";
6
+ import x from "./svgs/facebook.js";
7
+ import h from "./svgs/instagram.js";
8
+ import I from "./svgs/linkedin.js";
9
+ import S from "./svgs/placeholder.js";
10
+ import R from "./svgs/threads.js";
11
+ import z from "./svgs/tiktok.js";
12
+ import T from "./svgs/x.js";
13
+ import v from "./svgs/youtube.js";
14
+ const d = {
15
+ sm: "16px",
16
+ md: "24px",
17
+ lg: "32px",
18
+ xl: "48px"
19
+ }, w = {
20
+ social_bluesky: { Component: _, disabledClass: "gi-stroke-gray-700" },
21
+ social_facebook: { Component: x, disabledClass: "gi-stroke-gray-700" },
22
+ social_instagram: {
23
+ Component: h,
24
+ disabledClass: "gi-stroke-gray-700"
25
+ },
26
+ social_linkedin: { Component: I, disabledClass: "gi-stroke-gray-700" },
27
+ social_threads: { Component: R, disabledClass: "gi-stroke-gray-700" },
28
+ social_tiktok: { Component: z, disabledClass: "gi-stroke-gray-700" },
29
+ social_x: { Component: T, disabledClass: "gi-stroke-gray-700" },
30
+ social_youtube: { Component: v, disabledClass: "gi-stroke-gray-700" },
31
+ placeholder: { Component: S, disabledClass: "gi-fill-gray-700" }
32
+ }, M = u(
33
+ ({
34
+ icon: i,
35
+ size: g = "md",
36
+ filled: c,
37
+ disabled: e,
38
+ ariaHidden: k,
39
+ ariaLabel: a,
40
+ inline: o,
41
+ className: r,
42
+ onClick: C,
43
+ ...s
44
+ }, p) => {
45
+ const t = d[g] ?? d.md, l = w[String(i)];
46
+ if (l) {
47
+ const { Component: f, disabledClass: b } = l, y = m(
48
+ { "gi-block": !o, "gi-inline-block": o },
49
+ e && b,
50
+ r
51
+ );
52
+ return /* @__PURE__ */ n(f, { size: t, className: y });
30
53
  }
31
- case "lg": {
32
- o = "32px";
33
- break;
34
- }
35
- case "xl": {
36
- o = "48px";
37
- break;
38
- }
39
- }
40
- if (t === "social_bluesky")
41
- return /* @__PURE__ */ e(
42
- b,
43
- {
44
- size: o,
45
- className: i({
46
- "gi-block": !r,
47
- "gi-inline-block": r,
48
- "gi-stroke-gray-700": s
49
- })
50
- }
51
- );
52
- if (t === "social_facebook")
53
- return /* @__PURE__ */ e(
54
- u,
55
- {
56
- size: o,
57
- className: i({
58
- "gi-block": !r,
59
- "gi-inline-block": r,
60
- "gi-stroke-gray-700": s
61
- })
62
- }
63
- );
64
- if (t === "social_instagram")
65
- return /* @__PURE__ */ e(
66
- y,
67
- {
68
- size: o,
69
- className: i({
70
- "gi-block": !r,
71
- "gi-inline-block": r,
72
- "gi-stroke-gray-700": s
73
- })
74
- }
75
- );
76
- if (t === "social_linkedin")
77
- return /* @__PURE__ */ e(
78
- z,
79
- {
80
- size: o,
81
- className: i({
82
- "gi-block": !r,
83
- "gi-inline-block": r,
84
- "gi-stroke-gray-700": s
85
- })
86
- }
87
- );
88
- if (t === "social_threads")
89
- return /* @__PURE__ */ e(
90
- h,
54
+ return /* @__PURE__ */ n(
55
+ "span",
91
56
  {
92
- size: o,
93
- className: i({
94
- "gi-block": !r,
95
- "gi-inline-block": r,
96
- "gi-stroke-gray-700": s
97
- })
57
+ "aria-hidden": k,
58
+ "aria-label": a,
59
+ "data-testid": "govie-icon",
60
+ ...s,
61
+ ref: p,
62
+ onClick: C,
63
+ role: a ? "img" : "presentation",
64
+ className: m(
65
+ {
66
+ "gi-block": !o,
67
+ "gi-inline-block": o,
68
+ "gi-text-gray-700": e
69
+ },
70
+ "material-symbols-outlined",
71
+ r
72
+ ),
73
+ style: {
74
+ fontSize: t,
75
+ fontVariationSettings: `'FILL' ${c ? 1 : 0}, 'wght' 400, 'GRAD' 0, 'opsz' ${t}`,
76
+ ...s == null ? void 0 : s.style
77
+ },
78
+ children: i
98
79
  }
99
80
  );
100
- if (t === "social_tiktok")
101
- return /* @__PURE__ */ e(
102
- x,
103
- {
104
- size: o,
105
- className: i({
106
- "gi-block": !r,
107
- "gi-inline-block": r,
108
- "gi-stroke-gray-700": s
109
- })
110
- }
111
- );
112
- if (t === "social_x")
113
- return /* @__PURE__ */ e(
114
- _,
115
- {
116
- size: o,
117
- className: i({
118
- "gi-block": !r,
119
- "gi-inline-block": r,
120
- "gi-stroke-gray-700": s
121
- })
122
- }
123
- );
124
- if (t === "social_youtube")
125
- return /* @__PURE__ */ e(
126
- n,
127
- {
128
- size: o,
129
- className: i({
130
- "gi-block": !r,
131
- "gi-inline-block": r,
132
- "gi-stroke-gray-700": s
133
- })
134
- }
135
- );
136
- if (t === "placeholder")
137
- return /* @__PURE__ */ e(
138
- N,
139
- {
140
- size: o,
141
- className: i({
142
- "gi-block": !r,
143
- "gi-inline-block": r,
144
- "gi-fill-gray-700": s
145
- })
146
- }
147
- );
148
- const p = c ? "'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' " + o : "'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' " + o;
149
- return /* @__PURE__ */ e(
150
- "span",
151
- {
152
- "data-testid": "govie-icon",
153
- ...f,
154
- onClick: m,
155
- "aria-hidden": l || void 0,
156
- "aria-label": a,
157
- role: a ? "img" : "presentation",
158
- className: i(
159
- { "gi-block": !r, "gi-text-gray-700": s },
160
- "material-symbols-outlined",
161
- k
162
- ),
163
- style: {
164
- fontSize: o,
165
- fontVariationSettings: p
166
- },
167
- children: t
168
- }
169
- );
170
- }
81
+ }
82
+ );
171
83
  export {
172
- j as Icon
84
+ M as Icon,
85
+ M as default
173
86
  };
package/dist/index.d.ts CHANGED
@@ -102,7 +102,7 @@ export { TabPanel } from './tabs/tab-panel.js';
102
102
  export { Tabs } from './tabs/tabs.js';
103
103
  export type { TabItemProps, TabsProps, TabPanelProps } from './tabs/types.js';
104
104
  export * from './data-table/index.js';
105
- export { Tag, TagTypeEnum, type TagProps, type TagType } from './tag/tag.js';
105
+ export { Tag, TagTypeEnum, type TagProps, type TagType, type TagSize, } from './tag/tag.js';
106
106
  export { TextInput, type TextInputProps } from './text-input/text-input.js';
107
107
  export { TextArea, type TextAreaProps } from './textarea/textarea.js';
108
108
  export { toaster, ToastProvider } from './toast/toast.js';