@ogcio/design-system-react 1.28.0 → 1.30.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.
Files changed (80) hide show
  1. package/README.md +11 -33
  2. package/dist/alert/variants.d.ts +78 -2
  3. package/dist/assets/logos/LogoBlack.d.ts +3 -0
  4. package/dist/assets/logos/LogoBlack.js +322 -0
  5. package/dist/assets/logos/LogoGoldGreen.d.ts +3 -0
  6. package/dist/assets/logos/LogoGoldGreen.js +322 -0
  7. package/dist/assets/logos/LogoGoldWhite.d.ts +3 -0
  8. package/dist/assets/logos/LogoGoldWhite.js +82 -0
  9. package/dist/assets/logos/LogoHarpBlack.d.ts +3 -0
  10. package/dist/assets/logos/{harp/harp-white.js → LogoHarpBlack.js} +24 -21
  11. package/dist/assets/logos/LogoHarpWhite.d.ts +3 -0
  12. package/dist/assets/logos/LogoHarpWhite.js +60 -0
  13. package/dist/assets/logos/LogoWhite.d.ts +3 -0
  14. package/dist/assets/logos/LogoWhite.js +322 -0
  15. package/dist/assets/logos/index.d.ts +6 -0
  16. package/dist/assets/logos/index.js +14 -0
  17. package/dist/atoms/DsButton.d.ts +194 -0
  18. package/dist/atoms/DsButton.js +329 -0
  19. package/dist/atoms/icons/Close.d.ts +3 -0
  20. package/dist/atoms/icons/Close.js +22 -0
  21. package/dist/atoms/icons/KeyboardArrowDown.d.ts +3 -0
  22. package/dist/atoms/icons/KeyboardArrowDown.js +22 -0
  23. package/dist/atoms/icons/KeyboardArrowUp.d.ts +3 -0
  24. package/dist/atoms/icons/KeyboardArrowUp.js +22 -0
  25. package/dist/atoms/icons/Visibility.d.ts +3 -0
  26. package/dist/atoms/icons/Visibility.js +22 -0
  27. package/dist/atoms/icons/VisibilityOff.d.ts +3 -0
  28. package/dist/atoms/icons/VisibilityOff.js +22 -0
  29. package/dist/atoms/icons/index.d.ts +6 -0
  30. package/dist/atoms/icons/index.js +12 -0
  31. package/dist/atoms/icons/types.d.ts +10 -0
  32. package/dist/atoms/icons/types.js +1 -0
  33. package/dist/atoms/index.d.ts +2 -0
  34. package/dist/atoms/index.js +14 -0
  35. package/dist/autocomplete/autocomplete.js +131 -115
  36. package/dist/combo-box/dropdown-item.js +39 -40
  37. package/dist/data-table/data-table-footer.js +57 -51
  38. package/dist/data-table/data-table-header.d.ts +7 -7
  39. package/dist/data-table/data-table-header.js +97 -110
  40. package/dist/data-table/data-table-selected-rows.d.ts +1 -0
  41. package/dist/data-table/data-table-selected-rows.js +15 -19
  42. package/dist/footer/footer.js +9 -9
  43. package/dist/forms/form-field/form-field.d.ts +2 -2
  44. package/dist/forms/form-field/form-field.js +40 -30
  45. package/dist/forms/form-field/types.d.ts +10 -3
  46. package/dist/header/components/header-slot.js +33 -32
  47. package/dist/header/header-legacy.js +41 -41
  48. package/dist/header/variants.d.ts +220 -20
  49. package/dist/heading/heading.d.ts +70 -2
  50. package/dist/hooks/use-breakpoint.js +15 -12
  51. package/dist/icon/icon.d.ts +10 -0
  52. package/dist/icon/icon.js +64 -52
  53. package/dist/icon/icons.d.ts +1 -1
  54. package/dist/index.d.ts +1 -0
  55. package/dist/index.js +174 -171
  56. package/dist/input-password/input-password.js +13 -12
  57. package/dist/input-text/input-text.js +18 -16
  58. package/dist/label/label.d.ts +43 -0
  59. package/dist/label/label.js +7 -6
  60. package/dist/modal/modal.js +8 -7
  61. package/dist/spinner/spinner.d.ts +30 -2
  62. package/dist/styles.css +12 -2
  63. package/dist/table/table.d.ts +22 -2
  64. package/dist/tabs/tab-item.d.ts +2 -2
  65. package/dist/text-input/text-input.d.ts +1 -1
  66. package/dist/textarea/textarea.js +27 -28
  67. package/dist/toast/ds-toast.d.ts +78 -2
  68. package/dist/utils/placeholder.d.ts +2 -0
  69. package/dist/utils/placeholder.js +24 -0
  70. package/fonts.css +10 -0
  71. package/package.json +21 -8
  72. package/dist/assets/logos/gov-of-ireland/harp-black.d.ts +0 -2
  73. package/dist/assets/logos/gov-of-ireland/harp-black.js +0 -322
  74. package/dist/assets/logos/gov-of-ireland/harp-gold-text-green.d.ts +0 -2
  75. package/dist/assets/logos/gov-of-ireland/harp-gold-text-green.js +0 -322
  76. package/dist/assets/logos/gov-of-ireland/harp-white.d.ts +0 -2
  77. package/dist/assets/logos/gov-of-ireland/harp-white.js +0 -322
  78. package/dist/assets/logos/harp/harp-black.d.ts +0 -2
  79. package/dist/assets/logos/harp/harp-black.js +0 -63
  80. package/dist/assets/logos/harp/harp-white.d.ts +0 -2
@@ -7,13 +7,6 @@ interface DataTableHeaderProps extends HTMLAttributes<HTMLDivElement> {
7
7
  showHeader?: boolean;
8
8
  showFilter?: boolean;
9
9
  }
10
- export declare const DataTableHeader: React.FC<DataTableHeaderProps>;
11
- export declare const DataTableHeaderSearch: React.FC<DataTableHeaderTypeProps>;
12
- export declare const DataTableHeaderActions: React.FC<DataTableHeaderTypeProps>;
13
- export declare const DataTableHeaderFilter: React.FC<DataTableHeaderTypeProps>;
14
- export declare const DataTableHeaderFilterContent: React.FC<DataTableHeaderTypeProps>;
15
- export declare const DataTableHeaderFilterContentTitle: React.FC<DataTableHeaderTypeProps>;
16
- export declare const DataTableHeaderFilterActions: React.FC<DataTableHeaderTypeProps>;
17
10
  type DataTableHeaderFilterListProps = {
18
11
  filters: {
19
12
  id: string;
@@ -23,5 +16,12 @@ type DataTableHeaderFilterListProps = {
23
16
  onClear?: () => void;
24
17
  className?: string;
25
18
  };
19
+ export declare const DataTableHeader: React.FC<DataTableHeaderProps>;
20
+ export declare const DataTableHeaderSearch: React.FC<DataTableHeaderTypeProps>;
21
+ export declare const DataTableHeaderActions: React.FC<DataTableHeaderTypeProps>;
22
+ export declare const DataTableHeaderFilter: React.FC<DataTableHeaderTypeProps>;
23
+ export declare const DataTableHeaderFilterContent: React.FC<DataTableHeaderTypeProps>;
24
+ export declare const DataTableHeaderFilterContentTitle: React.FC<DataTableHeaderTypeProps>;
25
+ export declare const DataTableHeaderFilterActions: React.FC<DataTableHeaderTypeProps>;
26
26
  export declare const DataTableHeaderFilterList: React.FC<DataTableHeaderFilterListProps>;
27
27
  export {};
@@ -1,137 +1,124 @@
1
- import { jsxs as o, jsx as l } from "react/jsx-runtime";
2
- import { useMemo as O, Children as P, isValidElement as C } from "react";
3
- import { Button as x } from "../button/button.js";
4
- import { Chip as L } from "../chip/chip.js";
5
- import { cn as i } from "../cn.js";
6
- import { translate as g } from "../i18n/utility.js";
7
- const d = (e, a) => C(e) && e.type === a, h = ({
1
+ import { jsxs as d, jsx as i } from "react/jsx-runtime";
2
+ import { useMemo as A, Children as L, isValidElement as O } from "react";
3
+ import { c as P } from "../index-CB-zPpNk.js";
4
+ import { Button as w } from "../button/button.js";
5
+ import { Chip as S } from "../chip/chip.js";
6
+ import { cn as n } from "../cn.js";
7
+ import { translate as x } from "../i18n/utility.js";
8
+ const N = ({
8
9
  children: e,
9
- className: a,
10
- showHeader: t = !0,
11
- showFilter: s = !0,
12
- ...c
10
+ className: t,
11
+ showHeader: a = !0,
12
+ showFilter: c = !0,
13
+ ...p
13
14
  }) => {
14
- const { search: n, filter: j, filterList: u, actions: A } = O(() => {
15
- let f = null, H = null, y = null, D = null;
16
- return P.forEach(e, (r) => {
17
- d(r, p) ? f = r : d(r, m) ? H = r : d(r, T) ? y = r : d(r, b) && (D = r);
18
- }), { search: f, filter: H, filterList: y, actions: D };
15
+ const { search: s, filter: j, filterList: T, actions: C } = A(() => {
16
+ let b = null, y = null, H = null, D = null;
17
+ return L.forEach(e, (r) => {
18
+ o(r, f) ? b = r : o(r, g) ? y = r : o(r, u) ? H = r : o(r, m) && (D = r);
19
+ }), { search: b, filter: y, filterList: H, actions: D };
19
20
  }, [e]);
20
- return /* @__PURE__ */ o("div", { ...c, className: i("gi-data-table-header", a), children: [
21
- t && /* @__PURE__ */ o("div", { className: "gi-flex gi-flex-1 gi-gap-4 gi-items-center", children: [
22
- n,
21
+ return /* @__PURE__ */ d("div", { ...p, className: n(l.root(), t), children: [
22
+ a && /* @__PURE__ */ d("div", { className: l.headerRow(), children: [
23
+ s,
23
24
  j,
24
- A
25
+ C
25
26
  ] }),
26
- u && s && /* @__PURE__ */ l("div", { className: "gi-w-full", children: u })
27
+ T && c && /* @__PURE__ */ i("div", { className: l.filterListWrapper(), children: T })
27
28
  ] });
28
- }, p = ({
29
+ }, f = ({
29
30
  children: e,
30
- className: a,
31
- ...t
32
- }) => /* @__PURE__ */ l("div", { className: i("gi-data-table-header-search", a), ...t, children: e }), b = ({
31
+ className: t,
32
+ ...a
33
+ }) => /* @__PURE__ */ i("div", { className: n(l.search(), t), ...a, children: e }), m = ({
33
34
  children: e,
34
- className: a,
35
- ...t
36
- }) => /* @__PURE__ */ l("div", { className: i("gi-data-table-header-actions", a), ...t, children: e }), m = ({
35
+ className: t,
36
+ ...a
37
+ }) => /* @__PURE__ */ i("div", { className: n(l.actions(), t), ...a, children: e }), g = ({
37
38
  children: e,
38
- className: a,
39
- ...t
40
- }) => /* @__PURE__ */ l("div", { className: i("gi-data-table-header-filter", a), ...t, children: e }), N = ({ children: e, className: a, ...t }) => /* @__PURE__ */ l(
41
- "div",
42
- {
43
- className: i("gi-data-table-header-filter-content", a),
44
- ...t,
45
- children: e
46
- }
47
- ), F = ({ children: e, className: a, ...t }) => /* @__PURE__ */ l(
48
- "div",
49
- {
50
- className: i("gi-data-table-header-filter-content-title", a),
51
- ...t,
52
- children: e
53
- }
54
- ), v = ({ children: e, className: a, ...t }) => /* @__PURE__ */ l(
55
- "div",
56
- {
57
- className: i("gi-data-table-header-filter-actions", a),
58
- ...t,
59
- children: e
60
- }
61
- ), T = ({ filters: e, onRemove: a, onClear: t, className: s, ...c }) => !e || e.length === 0 ? null : /* @__PURE__ */ o(
62
- "div",
63
- {
64
- className: i("gi-data-table-header-filter-list", s),
65
- ...c,
66
- children: [
67
- /* @__PURE__ */ l("span", { className: "gi-text-sm", children: g("dataTableHeader.filtersApplied", {
68
- length: e.length,
69
- defaultValue: `Filters applied ${e.length}:`
70
- }) }),
71
- e.map((n) => /* @__PURE__ */ l(
72
- L,
73
- {
74
- onClose: () => a == null ? void 0 : a(n.id),
75
- label: n.label
76
- },
77
- n.id
78
- )),
79
- /* @__PURE__ */ l(
80
- x,
81
- {
82
- appearance: "dark",
83
- size: "medium",
84
- variant: "flat",
85
- onClick: () => {
86
- t == null || t();
87
- },
88
- children: g("dataTableHeader.clearAllFilters", {
89
- defaultValue: "Clear all filters"
90
- })
91
- }
92
- )
93
- ]
94
- }
95
- );
96
- h.displayName = "DataTableHeader";
97
- p.displayName = "DataTableHeaderSearch";
98
- b.displayName = "DataTableHeaderActions";
99
- m.displayName = "DataTableHeaderFilter";
100
- T.displayName = "DataTableHeaderFilterList";
101
- N.displayName = "DataTableHeaderFilterContent";
102
- F.displayName = "DataTableHeaderFilterContentTitle";
103
- v.displayName = "DataTableHeaderFilterActions";
104
- Object.defineProperty(h, "componentType", {
39
+ className: t,
40
+ ...a
41
+ }) => /* @__PURE__ */ i("div", { className: n(l.filter(), t), ...a, children: e }), F = ({ children: e, className: t, ...a }) => /* @__PURE__ */ i("div", { className: n(l.filterContent(), t), ...a, children: e }), v = ({ children: e, className: t, ...a }) => /* @__PURE__ */ i("div", { className: n(l.filterContentTitle(), t), ...a, children: e }), h = ({ children: e, className: t, ...a }) => /* @__PURE__ */ i("div", { className: n(l.filterActions(), t), ...a, children: e }), u = ({ filters: e, onRemove: t, onClear: a, className: c, ...p }) => !e || e.length === 0 ? null : /* @__PURE__ */ d("div", { className: n(l.filterList(), c), ...p, children: [
42
+ /* @__PURE__ */ i("span", { className: "gi-text-sm", children: x("dataTableHeader.filtersApplied", {
43
+ length: e.length,
44
+ defaultValue: `Filters applied ${e.length}:`
45
+ }) }),
46
+ e.map((s) => /* @__PURE__ */ i(
47
+ S,
48
+ {
49
+ onClose: () => t == null ? void 0 : t(s.id),
50
+ label: s.label
51
+ },
52
+ s.id
53
+ )),
54
+ /* @__PURE__ */ i(
55
+ w,
56
+ {
57
+ appearance: "dark",
58
+ size: "medium",
59
+ variant: "flat",
60
+ onClick: () => {
61
+ a == null || a();
62
+ },
63
+ children: x("dataTableHeader.clearAllFilters", {
64
+ defaultValue: "Clear all filters"
65
+ })
66
+ }
67
+ )
68
+ ] });
69
+ N.displayName = "DataTableHeader";
70
+ f.displayName = "DataTableHeaderSearch";
71
+ m.displayName = "DataTableHeaderActions";
72
+ g.displayName = "DataTableHeaderFilter";
73
+ u.displayName = "DataTableHeaderFilterList";
74
+ F.displayName = "DataTableHeaderFilterContent";
75
+ v.displayName = "DataTableHeaderFilterContentTitle";
76
+ h.displayName = "DataTableHeaderFilterActions";
77
+ Object.defineProperty(N, "componentType", {
105
78
  value: "DataTableHeader"
106
79
  });
107
- Object.defineProperty(p, "componentType", {
80
+ Object.defineProperty(f, "componentType", {
108
81
  value: "DataTableHeaderSearch"
109
82
  });
110
- Object.defineProperty(b, "componentType", {
83
+ Object.defineProperty(m, "componentType", {
111
84
  value: "DataTableHeaderActions"
112
85
  });
113
- Object.defineProperty(m, "componentType", {
86
+ Object.defineProperty(g, "componentType", {
114
87
  value: "DataTableHeaderFilter"
115
88
  });
116
- Object.defineProperty(T, "componentType", {
89
+ Object.defineProperty(u, "componentType", {
117
90
  value: "DataTableHeaderFilterList"
118
91
  });
119
- Object.defineProperty(N, "componentType", {
92
+ Object.defineProperty(F, "componentType", {
120
93
  value: "DataTableHeaderFilterContent"
121
94
  });
122
- Object.defineProperty(F, "componentType", {
95
+ Object.defineProperty(v, "componentType", {
123
96
  value: "DataTableHeaderFilterContentTitle"
124
97
  });
125
- Object.defineProperty(v, "componentType", {
98
+ Object.defineProperty(h, "componentType", {
126
99
  value: "DataTableHeaderFilterActions"
127
100
  });
101
+ const l = P({
102
+ slots: {
103
+ root: "gi-flex gi-flex-wrap gi-items-center gi-w-full gi-gap-4 gi-mb-2",
104
+ headerRow: "gi-flex gi-flex-1 gi-gap-4 gi-items-center",
105
+ search: "gi-flex gi-flex-1",
106
+ filter: "gi-flex gi-items-center",
107
+ actions: "gi-flex gi-items-center gi-ml-auto gi-gap-4 gi-flex-shrink",
108
+ filterListWrapper: "gi-w-full",
109
+ filterList: "gi-flex gi-items-center gi-gap-2 gi-flex-wrap",
110
+ filterContentTitle: "gi-py-2 gi-font-medium",
111
+ filterContent: "gi-flex gi-flex-col gi-gap-2 gi-px-6 gi-py-4 gi-flex-1 gi-overflow-auto",
112
+ filterActions: "gi-flex gi-justify-end gi-gap-2 gi-p-6"
113
+ }
114
+ })(), o = (e, t) => O(e) && e.type === t;
128
115
  export {
129
- h as DataTableHeader,
130
- b as DataTableHeaderActions,
131
- m as DataTableHeaderFilter,
132
- v as DataTableHeaderFilterActions,
133
- N as DataTableHeaderFilterContent,
134
- F as DataTableHeaderFilterContentTitle,
135
- T as DataTableHeaderFilterList,
136
- p as DataTableHeaderSearch
116
+ N as DataTableHeader,
117
+ m as DataTableHeaderActions,
118
+ g as DataTableHeaderFilter,
119
+ h as DataTableHeaderFilterActions,
120
+ F as DataTableHeaderFilterContent,
121
+ v as DataTableHeaderFilterContentTitle,
122
+ u as DataTableHeaderFilterList,
123
+ f as DataTableHeaderSearch
137
124
  };
@@ -1,3 +1,4 @@
1
+ import { default as React } from 'react';
1
2
  export type DataTableSelectedRowsBannerProps = {
2
3
  selectedCount: number;
3
4
  actions?: React.ReactNode;
@@ -1,23 +1,19 @@
1
- import { jsxs as r, jsx as i } from "react/jsx-runtime";
1
+ import { jsxs as r, jsx as t } from "react/jsx-runtime";
2
+ import { c as o } from "../index-CB-zPpNk.js";
2
3
  import { cn as g } from "../cn.js";
3
- import { translate as l } from "../i18n/utility.js";
4
- const o = ({ selectedCount: e, actions: t, className: a, ...s }) => /* @__PURE__ */ r(
5
- "div",
6
- {
7
- className: g(
8
- "gi-w-full gi-flex gi-items-center gi-justify-between gi-px-3 gi-py-2 gi-bg-gray-900 gi-rounded-md",
9
- a
10
- ),
11
- ...s,
12
- children: [
13
- /* @__PURE__ */ i("span", { className: "gi-text-sm gi-font-medium gi-text-white", children: l("dataTable.selectedRows", {
14
- count: e,
15
- defaultValue: ` (${e} Row${e === 1 ? "" : "s"} selected)`
16
- }) }),
17
- /* @__PURE__ */ i("div", { className: "gi-flex gi-gap-4", children: t })
18
- ]
4
+ import { translate as m } from "../i18n/utility.js";
5
+ const p = ({ selectedCount: e, actions: s, className: a, ...l }) => /* @__PURE__ */ r("div", { className: g(i.root(), a), ...l, children: [
6
+ /* @__PURE__ */ t("span", { className: i.label(), children: m("dataTable.selectedRows", {
7
+ count: e,
8
+ defaultValue: ` (${e} Row${e === 1 ? "" : "s"} selected)`
9
+ }) }),
10
+ /* @__PURE__ */ t("div", { className: "gi-flex gi-gap-4", children: s })
11
+ ] }), i = o({
12
+ slots: {
13
+ root: "gi-w-full gi-flex gi-items-center gi-justify-between gi-px-3 gi-py-2 gi-bg-gray-900 gi-rounded-md",
14
+ label: "gi-text-sm gi-font-medium gi-text-white"
19
15
  }
20
- );
16
+ })();
21
17
  export {
22
- o as DataTableSelectedRowsBanner
18
+ p as DataTableSelectedRowsBanner
23
19
  };
@@ -1,15 +1,15 @@
1
1
  "use client";
2
2
  import { jsxs as i, jsx as t, Fragment as u } from "react/jsx-runtime";
3
3
  import { renderToStaticMarkup as c } from "react-dom/server";
4
- import h from "../assets/logos/gov-of-ireland/harp-gold-text-green.js";
5
- import p from "../assets/logos/harp/harp-white.js";
4
+ import { LogoGoldGreen as h } from "../assets/logos/LogoGoldGreen.js";
5
+ import { LogoHarpWhite as g } from "../assets/logos/LogoHarpWhite.js";
6
6
  import { cn as v } from "../cn.js";
7
7
  import { Container as b } from "../container/container.js";
8
8
  import { translate as a } from "../i18n/utility.js";
9
- import g from "../primitives/anchor.js";
10
- import { SectionBreak as k } from "../section-break/section-break.js";
9
+ import p from "../primitives/anchor.js";
10
+ import { SectionBreak as L } from "../section-break/section-break.js";
11
11
  function l({ logo: e }) {
12
- const n = `data:image/svg+xml;base64,${btoa(c(/* @__PURE__ */ t(p, {})))}`, s = `data:image/svg+xml;base64,${btoa(
12
+ const n = `data:image/svg+xml;base64,${btoa(c(/* @__PURE__ */ t(g, {})))}`, s = `data:image/svg+xml;base64,${btoa(
13
13
  c(/* @__PURE__ */ t(h, {}))
14
14
  )}`;
15
15
  return /* @__PURE__ */ i("picture", { children: [
@@ -24,7 +24,7 @@ function l({ logo: e }) {
24
24
  )
25
25
  ] });
26
26
  }
27
- function H({
27
+ function M({
28
28
  primarySlot: e,
29
29
  secondarySlot: o,
30
30
  utilitySlot: n,
@@ -35,7 +35,7 @@ function H({
35
35
  }) {
36
36
  const f = () => /* @__PURE__ */ i(u, { children: [
37
37
  (r == null ? void 0 : r.href) && /* @__PURE__ */ t(
38
- g,
38
+ p,
39
39
  {
40
40
  href: r.href,
41
41
  "aria-label": a("footer.goToHomePage", {
@@ -69,7 +69,7 @@ function H({
69
69
  }
70
70
  ),
71
71
  e && o && /* @__PURE__ */ t(
72
- k,
72
+ L,
73
73
  {
74
74
  color: "gi-border-color-border-system-neutral-subtle",
75
75
  size: "lg"
@@ -104,5 +104,5 @@ function H({
104
104
  );
105
105
  }
106
106
  export {
107
- H as Footer
107
+ M as Footer
108
108
  };
@@ -1,9 +1,9 @@
1
1
  import { ErrorTextProps } from '../../error-text/types.js';
2
2
  import { HintTextProps } from '../../hint-text/types.js';
3
- import { FormFieldProps, FormFiledLabelProps } from './types.js';
3
+ import { FormFieldLabelProps, FormFieldProps } from './types.js';
4
4
  declare const FormField: (props: FormFieldProps) => import("react/jsx-runtime").JSX.Element;
5
5
  declare const FormFieldLabel: {
6
- ({ children, text, size, htmlFor, className, secondaryLabel, ...props }: FormFiledLabelProps): import("react/jsx-runtime").JSX.Element;
6
+ ({ children, text, size, htmlFor, className, secondaryLabel, ...props }: FormFieldLabelProps): import("react/jsx-runtime").JSX.Element;
7
7
  displayName: string;
8
8
  };
9
9
  declare const FormFieldHint: {
@@ -1,19 +1,19 @@
1
1
  "use client";
2
- import { jsx as l, jsxs as a, Fragment as p } from "react/jsx-runtime";
3
- import { S as x } from "../../index-D_wwt4P0.js";
4
- import { createContext as v, useContext as N, Children as C } from "react";
5
- import { cn as c } from "../../cn.js";
2
+ import { jsx as l, jsxs as m, Fragment as x } from "react/jsx-runtime";
3
+ import { S as p } from "../../index-D_wwt4P0.js";
4
+ import { createContext as N, useContext as v, Children as C } from "react";
5
+ import { cn as d } from "../../cn.js";
6
6
  import { ErrorText as L } from "../../error-text/error-text.js";
7
7
  import { HintText as E } from "../../hint-text/hint-text.js";
8
- import { Label as H } from "../../label/label.js";
9
- import { getSpecialComponentType as F, isSpecialComponent as P } from "../../utils/utilities.js";
10
- const f = v(null);
8
+ import { Label as H, styles as P } from "../../label/label.js";
9
+ import { getSpecialComponentType as F, isSpecialComponent as w } from "../../utils/utilities.js";
10
+ const f = N(null);
11
11
  function b(e) {
12
- N(f) || console.error(`[${e}] must be used within a <FormField>.`);
12
+ v(f) || console.error(`[${e}] must be used within a <FormField>.`);
13
13
  }
14
- const I = (e) => ["error", "hint", "label"].some((r) => r in e) ? (console.warn(
14
+ const U = (e) => ["error", "hint", "label"].some((r) => r in e) ? (console.warn(
15
15
  "[FormField] Using legacy props. Please migrate to the new composable API."
16
- ), /* @__PURE__ */ l(f.Provider, { value: !0, children: /* @__PURE__ */ a(y, { ...e, children: [
16
+ ), /* @__PURE__ */ l(f.Provider, { value: !0, children: /* @__PURE__ */ m(y, { ...e, children: [
17
17
  e.label && /* @__PURE__ */ l(u, { ...e.label }),
18
18
  e.hint && /* @__PURE__ */ l(h, { ...e.hint }),
19
19
  e.error && /* @__PURE__ */ l(g, { ...e.error }),
@@ -25,31 +25,31 @@ const I = (e) => ["error", "hint", "label"].some((r) => r in e) ? (console.warn(
25
25
  }) => {
26
26
  const r = C.toArray(e), n = r.find(
27
27
  (t) => F(t) === "FormFieldLabel"
28
- ), m = r.find(
28
+ ), c = r.find(
29
29
  (t) => F(t) === "FormFieldHint"
30
- ), d = r.find(
30
+ ), a = r.find(
31
31
  (t) => F(t) === "FormFieldError"
32
32
  ), s = r.filter(
33
- (t) => !P(t, [
33
+ (t) => !w(t, [
34
34
  "FormFieldLabel",
35
35
  "FormFieldHint",
36
36
  "FormFieldError"
37
37
  ])
38
38
  );
39
- return /* @__PURE__ */ a(
39
+ return /* @__PURE__ */ m(
40
40
  "fieldset",
41
41
  {
42
- className: c({ "gi-error-state": !!d }, i),
42
+ className: d({ "gi-error-state": !!a }, i),
43
43
  ...o,
44
44
  children: [
45
- /* @__PURE__ */ a("div", { className: "gi-pb-3 gi-flex gi-flex-col gi-gap-1", children: [
46
- /* @__PURE__ */ a("div", { children: [
45
+ /* @__PURE__ */ m("div", { className: "gi-pb-3 gi-flex gi-flex-col gi-gap-1", children: [
46
+ /* @__PURE__ */ m("div", { children: [
47
47
  n,
48
- m
48
+ c
49
49
  ] }),
50
- d
50
+ a
51
51
  ] }),
52
- /* @__PURE__ */ l(x, { children: s })
52
+ /* @__PURE__ */ l(p, { children: s })
53
53
  ]
54
54
  }
55
55
  );
@@ -59,21 +59,31 @@ const I = (e) => ["error", "hint", "label"].some((r) => r in e) ? (console.warn(
59
59
  size: o,
60
60
  htmlFor: r,
61
61
  className: n,
62
- secondaryLabel: m,
63
- ...d
62
+ secondaryLabel: c,
63
+ ...a
64
64
  }) => {
65
65
  b("FormFieldLabel");
66
- const s = /* @__PURE__ */ a(p, { children: [
66
+ const s = /* @__PURE__ */ m(x, { children: [
67
67
  i ?? e,
68
- m ? /* @__PURE__ */ l("span", { className: "gi-secondary-label", children: m }) : null
68
+ c ? /* @__PURE__ */ l("span", { className: "gi-secondary-label", children: c }) : null
69
69
  ] });
70
- return /* @__PURE__ */ l(
70
+ return r ? /* @__PURE__ */ l(
71
71
  H,
72
72
  {
73
73
  size: o,
74
74
  htmlFor: r,
75
- className: c("gi-font-bold", n),
76
- ...d,
75
+ className: d("gi-font-bold", n),
76
+ ...a,
77
+ children: s
78
+ }
79
+ ) : /* @__PURE__ */ l(
80
+ "legend",
81
+ {
82
+ className: P({
83
+ size: o,
84
+ className: d("gi-font-bold", n)
85
+ }),
86
+ ...a,
77
87
  children: s
78
88
  }
79
89
  );
@@ -84,7 +94,7 @@ Object.defineProperty(u, "componentType", {
84
94
  enumerable: !1
85
95
  });
86
96
  u.displayName = "FormFieldLabel";
87
- const h = ({ children: e, text: i, size: o, className: r }) => (b("FormFieldHint"), /* @__PURE__ */ l(E, { text: i, size: o, className: c("gi-mb-1", r), children: e }));
97
+ const h = ({ children: e, text: i, size: o, className: r }) => (b("FormFieldHint"), /* @__PURE__ */ l(E, { text: i, size: o, className: d("gi-mb-1", r), children: e }));
88
98
  Object.defineProperty(h, "componentType", {
89
99
  value: "FormFieldHint",
90
100
  writable: !1,
@@ -102,7 +112,7 @@ const g = ({
102
112
  {
103
113
  text: i,
104
114
  size: o,
105
- className: c("gi-mb-1", r),
115
+ className: d("gi-mb-1", r),
106
116
  ...n,
107
117
  children: e
108
118
  }
@@ -114,7 +124,7 @@ Object.defineProperty(g, "componentType", {
114
124
  });
115
125
  g.displayName = "FormFieldError";
116
126
  export {
117
- I as FormField,
127
+ U as FormField,
118
128
  g as FormFieldError,
119
129
  h as FormFieldHint,
120
130
  u as FormFieldLabel
@@ -1,10 +1,17 @@
1
- import { FieldsetHTMLAttributes } from 'react';
1
+ import { FieldsetHTMLAttributes, PropsWithChildren } from 'react';
2
2
  import { ErrorTextProps } from '../../error-text/types.js';
3
3
  import { HintTextProps } from '../../hint-text/types.js';
4
- import { LabelTextProps } from '../../label/types.js';
5
- export type FormFiledLabelProps = LabelTextProps & {
4
+ import { LabelSizeType, LabelTextProps } from '../../label/types.js';
5
+ export type LegendProps = PropsWithChildren<React.HTMLAttributes<HTMLLegendElement> & {
6
+ text?: string | React.ReactElement;
7
+ size?: LabelSizeType;
8
+ secondaryLabel?: React.ReactNode;
9
+ htmlFor?: never;
10
+ }>;
11
+ export type LabelProps = LabelTextProps & {
6
12
  secondaryLabel?: React.ReactNode;
7
13
  };
14
+ export type FormFieldLabelProps = LabelProps | LegendProps;
8
15
  export type FormFieldProps = {
9
16
  /** @deprecated Use <FormFieldError> instead */
10
17
  error?: ErrorTextProps;