@postenbring/hedwig-react 4.2.1 → 4.3.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 (64) hide show
  1. package/dist/chunk-5J5LYE6Z.mjs +1 -0
  2. package/dist/chunk-6D5VE3DW.mjs +44 -0
  3. package/dist/chunk-6D5VE3DW.mjs.map +1 -0
  4. package/dist/{chunk-WMSOBRKN.mjs → chunk-DOW6EHBI.mjs} +2 -2
  5. package/dist/chunk-FTVKPZCX.mjs +37 -0
  6. package/dist/chunk-FTVKPZCX.mjs.map +1 -0
  7. package/dist/chunk-HA3LRSDK.mjs +21 -0
  8. package/dist/chunk-HA3LRSDK.mjs.map +1 -0
  9. package/dist/{chunk-JKKH77UC.mjs → chunk-JGYPZ7ET.mjs} +2 -2
  10. package/dist/{chunk-SQNGMF3D.mjs → chunk-QER35NXN.mjs} +5 -5
  11. package/dist/{chunk-DNCWDWK2.mjs → chunk-QOIBRXYT.mjs} +4 -4
  12. package/dist/chunk-XSID7YR7.mjs +1 -0
  13. package/dist/chunk-XSID7YR7.mjs.map +1 -0
  14. package/dist/form/checkbox/checkbox.mjs +3 -3
  15. package/dist/form/checkbox/index.mjs +3 -3
  16. package/dist/form/fieldset/fieldset.mjs +2 -2
  17. package/dist/form/fieldset/index.mjs +4 -4
  18. package/dist/form/index.d.ts +1 -0
  19. package/dist/form/index.d.ts.map +1 -1
  20. package/dist/form/index.js +82 -5
  21. package/dist/form/index.js.map +1 -1
  22. package/dist/form/index.mjs +35 -20
  23. package/dist/form/radio-button/index.mjs +4 -4
  24. package/dist/form/radio-button/radio-button.mjs +4 -4
  25. package/dist/form/radio-button/radio-group.mjs +3 -3
  26. package/dist/form/suggestions/index.d.ts +7 -0
  27. package/dist/form/suggestions/index.d.ts.map +1 -0
  28. package/dist/form/suggestions/index.js +131 -0
  29. package/dist/form/suggestions/index.js.map +1 -0
  30. package/dist/form/suggestions/index.mjs +19 -0
  31. package/dist/form/suggestions/index.mjs.map +1 -0
  32. package/dist/form/suggestions/suggestions-item.d.ts +45 -0
  33. package/dist/form/suggestions/suggestions-item.d.ts.map +1 -0
  34. package/dist/form/suggestions/suggestions-item.js +83 -0
  35. package/dist/form/suggestions/suggestions-item.js.map +1 -0
  36. package/dist/form/suggestions/suggestions-item.mjs +10 -0
  37. package/dist/form/suggestions/suggestions-item.mjs.map +1 -0
  38. package/dist/form/suggestions/suggestions-wrapper.d.ts +41 -0
  39. package/dist/form/suggestions/suggestions-wrapper.d.ts.map +1 -0
  40. package/dist/form/suggestions/suggestions-wrapper.js +66 -0
  41. package/dist/form/suggestions/suggestions-wrapper.js.map +1 -0
  42. package/dist/form/suggestions/suggestions-wrapper.mjs +8 -0
  43. package/dist/form/suggestions/suggestions-wrapper.mjs.map +1 -0
  44. package/dist/form/suggestions/suggestions.d.ts +57 -0
  45. package/dist/form/suggestions/suggestions.d.ts.map +1 -0
  46. package/dist/form/suggestions/suggestions.js +123 -0
  47. package/dist/form/suggestions/suggestions.js.map +1 -0
  48. package/dist/form/suggestions/suggestions.mjs +10 -0
  49. package/dist/form/suggestions/suggestions.mjs.map +1 -0
  50. package/dist/index.js +356 -279
  51. package/dist/index.js.map +1 -1
  52. package/dist/index.mjs +43 -28
  53. package/package.json +5 -5
  54. package/src/form/index.tsx +1 -0
  55. package/src/form/suggestions/index.tsx +6 -0
  56. package/src/form/suggestions/suggestions-item.tsx +70 -0
  57. package/src/form/suggestions/suggestions-wrapper.tsx +50 -0
  58. package/src/form/suggestions/suggestions.tsx +89 -0
  59. package/dist/chunk-CVE23PMJ.mjs +0 -1
  60. /package/dist/{chunk-CVE23PMJ.mjs.map → chunk-5J5LYE6Z.mjs.map} +0 -0
  61. /package/dist/{chunk-WMSOBRKN.mjs.map → chunk-DOW6EHBI.mjs.map} +0 -0
  62. /package/dist/{chunk-JKKH77UC.mjs.map → chunk-JGYPZ7ET.mjs.map} +0 -0
  63. /package/dist/{chunk-SQNGMF3D.mjs.map → chunk-QER35NXN.mjs.map} +0 -0
  64. /package/dist/{chunk-DNCWDWK2.mjs.map → chunk-QOIBRXYT.mjs.map} +0 -0
package/dist/index.mjs CHANGED
@@ -6,14 +6,14 @@ import "./chunk-3D2MWIEX.mjs";
6
6
  import {
7
7
  WarningBanner
8
8
  } from "./chunk-EMQB6JIS.mjs";
9
- import "./chunk-JKCVB5TR.mjs";
10
- import {
11
- StyledHtml
12
- } from "./chunk-I76U35YW.mjs";
13
9
  import "./chunk-3LYJRAOC.mjs";
14
10
  import {
15
11
  Table
16
12
  } from "./chunk-ZOZPWP3N.mjs";
13
+ import "./chunk-JKCVB5TR.mjs";
14
+ import {
15
+ StyledHtml
16
+ } from "./chunk-I76U35YW.mjs";
17
17
  import "./chunk-7YWW46R3.mjs";
18
18
  import {
19
19
  Tabs
@@ -27,6 +27,10 @@ import {
27
27
  TabsTab
28
28
  } from "./chunk-WVCJV74B.mjs";
29
29
  import "./chunk-KQITCS3U.mjs";
30
+ import "./chunk-SRLM3K2X.mjs";
31
+ import {
32
+ ShowMoreButton
33
+ } from "./chunk-JUHJZLH2.mjs";
30
34
  import "./chunk-JTZPQHKD.mjs";
31
35
  import {
32
36
  Skeleton
@@ -35,10 +39,6 @@ import "./chunk-AJFQHFQT.mjs";
35
39
  import {
36
40
  Spinner
37
41
  } from "./chunk-ZTZAPNZB.mjs";
38
- import "./chunk-SRLM3K2X.mjs";
39
- import {
40
- ShowMoreButton
41
- } from "./chunk-JUHJZLH2.mjs";
42
42
  import "./chunk-TJH5QJMS.mjs";
43
43
  import {
44
44
  StepIndicator
@@ -104,19 +104,26 @@ import {
104
104
  FooterLinkSections,
105
105
  FooterLogo
106
106
  } from "./chunk-QDG2QLFV.mjs";
107
- import "./chunk-CVE23PMJ.mjs";
107
+ import "./chunk-5J5LYE6Z.mjs";
108
+ import "./chunk-XSID7YR7.mjs";
109
+ import {
110
+ Suggestions
111
+ } from "./chunk-6D5VE3DW.mjs";
112
+ import {
113
+ SuggestionsItem,
114
+ SuggestionsItemAction
115
+ } from "./chunk-FTVKPZCX.mjs";
116
+ import {
117
+ SuggestionsWrapper
118
+ } from "./chunk-HA3LRSDK.mjs";
108
119
  import "./chunk-AGZHQDCQ.mjs";
109
120
  import {
110
121
  Textarea
111
122
  } from "./chunk-OQD4GKOS.mjs";
112
- import "./chunk-XAFNJELJ.mjs";
113
- import {
114
- RadioButton
115
- } from "./chunk-WMSOBRKN.mjs";
123
+ import "./chunk-7LPYJC6S.mjs";
116
124
  import {
117
- RadioGroup,
118
- useRadioGroupContext
119
- } from "./chunk-SQNGMF3D.mjs";
125
+ Input
126
+ } from "./chunk-62VLFCXX.mjs";
120
127
  import "./chunk-CAIGPMDS.mjs";
121
128
  import {
122
129
  SearchWrapper
@@ -125,27 +132,30 @@ import "./chunk-BYEJZSG5.mjs";
125
132
  import {
126
133
  Select
127
134
  } from "./chunk-JGQTAIEP.mjs";
128
- import "./chunk-7LPYJC6S.mjs";
135
+ import "./chunk-KPPLVGZ3.mjs";
136
+ import "./chunk-XAFNJELJ.mjs";
129
137
  import {
130
- Input
131
- } from "./chunk-62VLFCXX.mjs";
138
+ RadioButton
139
+ } from "./chunk-DOW6EHBI.mjs";
140
+ import {
141
+ RadioGroup,
142
+ useRadioGroupContext
143
+ } from "./chunk-QER35NXN.mjs";
132
144
  import "./chunk-YJOOSTJC.mjs";
133
145
  import {
134
146
  Checkbox
135
- } from "./chunk-JKKH77UC.mjs";
147
+ } from "./chunk-JGYPZ7ET.mjs";
136
148
  import "./chunk-CSIXGT7P.mjs";
137
149
  import {
138
150
  Fieldset,
139
151
  useFieldsetContext
140
- } from "./chunk-DNCWDWK2.mjs";
152
+ } from "./chunk-QOIBRXYT.mjs";
153
+ import {
154
+ FieldsetDescription
155
+ } from "./chunk-D2XZT2RA.mjs";
141
156
  import {
142
157
  FieldsetLegend
143
158
  } from "./chunk-CD4LCDK3.mjs";
144
- import "./chunk-KPPLVGZ3.mjs";
145
- import {
146
- ErrorSummary
147
- } from "./chunk-NAXSP4VU.mjs";
148
- import "./chunk-CKAL5ZJZ.mjs";
149
159
  import "./chunk-TDLSHJ4Z.mjs";
150
160
  import {
151
161
  DatePicker
@@ -161,8 +171,9 @@ import {
161
171
  ValidationMessage
162
172
  } from "./chunk-F23MNQCK.mjs";
163
173
  import {
164
- FieldsetDescription
165
- } from "./chunk-D2XZT2RA.mjs";
174
+ ErrorSummary
175
+ } from "./chunk-NAXSP4VU.mjs";
176
+ import "./chunk-CKAL5ZJZ.mjs";
166
177
  import "./chunk-XLLYMQLW.mjs";
167
178
  import {
168
179
  Link
@@ -330,6 +341,10 @@ export {
330
341
  Stack,
331
342
  StepIndicator,
332
343
  StyledHtml,
344
+ Suggestions,
345
+ SuggestionsItem,
346
+ SuggestionsItemAction,
347
+ SuggestionsWrapper,
333
348
  Table,
334
349
  Tabs,
335
350
  TabsContent,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@postenbring/hedwig-react",
3
- "version": "4.2.1",
3
+ "version": "4.3.0",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -17,7 +17,7 @@
17
17
  "@types/react-dom": "^18.3.1",
18
18
  "react": "^18.3.1",
19
19
  "react-dom": "18.3.1",
20
- "tsup": "^8.5.0",
20
+ "tsup": "^8.5.1",
21
21
  "typescript": "^5.8.3",
22
22
  "eslint-config-custom": "0.0.1",
23
23
  "hedwig-tsconfig": "0.0.0"
@@ -29,9 +29,9 @@
29
29
  "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
30
30
  },
31
31
  "dependencies": {
32
- "@radix-ui/react-popover": "1.1.14",
33
- "@radix-ui/react-slot": "1.2.3",
34
- "@postenbring/hedwig-css": "4.2.1"
32
+ "@radix-ui/react-popover": "1.1.23",
33
+ "@radix-ui/react-slot": "1.3.3",
34
+ "@postenbring/hedwig-css": "4.3.0"
35
35
  },
36
36
  "publishConfig": {
37
37
  "access": "public"
@@ -7,5 +7,6 @@ export * from "./input";
7
7
  export * from "./radio-button";
8
8
  export * from "./search-wrapper";
9
9
  export * from "./select";
10
+ export * from "./suggestions";
10
11
  export * from "./textarea";
11
12
  export * from "./validation-message";
@@ -0,0 +1,6 @@
1
+ export { Suggestions } from "./suggestions";
2
+ export type * from "./suggestions";
3
+ export { SuggestionsItem, SuggestionsItemAction } from "./suggestions-item";
4
+ export type * from "./suggestions-item";
5
+ export { SuggestionsWrapper } from "./suggestions-wrapper";
6
+ export type * from "./suggestions-wrapper";
@@ -0,0 +1,70 @@
1
+ import { forwardRef } from "react";
2
+ import type { AnchorHTMLAttributes, HTMLAttributes, Ref } from "react";
3
+ import { clsx } from "@postenbring/hedwig-css/typed-classname";
4
+ import { Slot } from "@radix-ui/react-slot";
5
+
6
+ export type SuggestionsItemProps = HTMLAttributes<HTMLLIElement>;
7
+
8
+ export interface SuggestionsItemActionProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
9
+ /**
10
+ * Use the element passed as a child, merging its props and behavior.
11
+ *
12
+ * @default false
13
+ */
14
+ asChild?: boolean;
15
+ }
16
+
17
+ /**
18
+ * A single structural item in a suggestions list.
19
+ *
20
+ * Use `Suggestions.ItemAction` as the interactive child of each item.
21
+ *
22
+ * @example
23
+ * ```tsx
24
+ * <Suggestions.Item>
25
+ * <Suggestions.ItemAction href="/results">
26
+ * View results
27
+ * </Suggestions.ItemAction>
28
+ * </Suggestions.Item>
29
+ * ```
30
+ */
31
+ export const SuggestionsItem = forwardRef<HTMLLIElement, SuggestionsItemProps>(
32
+ ({ className, ...rest }, ref) => (
33
+ <li className={clsx("hds-suggestions-item", className as undefined)} ref={ref} {...rest} />
34
+ ),
35
+ );
36
+
37
+ SuggestionsItem.displayName = "Suggestions.Item";
38
+
39
+ /**
40
+ * The interactive action within a suggestions item.
41
+ *
42
+ * Renders an anchor by default and applies the `hds-suggestions-item__action`
43
+ * class. Use `asChild` to render another interactive element, such as a button
44
+ * or router link, while preserving the action styling.
45
+ *
46
+ * @example
47
+ * ```tsx
48
+ * <Suggestions.ItemAction href="/results">
49
+ * View results
50
+ * </Suggestions.ItemAction>
51
+ *
52
+ * <Suggestions.ItemAction asChild>
53
+ * <button type="button">Select result</button>
54
+ * </Suggestions.ItemAction>
55
+ * ```
56
+ */
57
+ export const SuggestionsItemAction = forwardRef<HTMLAnchorElement, SuggestionsItemActionProps>(
58
+ ({ asChild, className, ...rest }, ref) => {
59
+ const Component = asChild ? Slot : "a";
60
+ return (
61
+ <Component
62
+ className={clsx("hds-suggestions-item__action", className as undefined)}
63
+ ref={ref as Ref<HTMLAnchorElement>}
64
+ {...rest}
65
+ />
66
+ );
67
+ },
68
+ );
69
+
70
+ SuggestionsItemAction.displayName = "Suggestions.ItemAction";
@@ -0,0 +1,50 @@
1
+ import { forwardRef } from "react";
2
+ import type { HTMLAttributes } from "react";
3
+ import { clsx } from "@postenbring/hedwig-css/typed-classname";
4
+
5
+ export interface SuggestionsWrapperProps extends HTMLAttributes<HTMLDivElement> {
6
+ /**
7
+ * Change the rendered element for the suggestions wrapper.
8
+ *
9
+ * @default "div"
10
+ */
11
+ as?: "section" | "div";
12
+ }
13
+
14
+ /**
15
+ * A wrapper for search suggestions.
16
+ * Intended to contain a SearchWrapper and Suggestions.
17
+ *
18
+ * @example
19
+ * ```tsx
20
+ * <Suggestions.Wrapper>
21
+ * <SearchWrapper>
22
+ * <Input type="search" aria-label="Search content" />
23
+ * <Button>Search</Button>
24
+ * <Button icon aria-label="Clear search">
25
+ * <XmarkIcon />
26
+ * </Button>
27
+ * </SearchWrapper>
28
+ * <Suggestions>
29
+ * <Suggestions.Item>
30
+ * <Suggestions.ItemAction href="/">Albania</Suggestions.ItemAction>
31
+ * </Suggestions.Item>
32
+ * </Suggestions>
33
+ * </Suggestions.Wrapper>
34
+ * ```
35
+ *
36
+ * Use `as` when the wrapper needs a different semantic element:
37
+ * ```tsx
38
+ * <Suggestions.Wrapper as="section">
39
+ * <SearchWrapper>...</SearchWrapper>
40
+ * <Suggestions>...</Suggestions>
41
+ * </Suggestions.Wrapper>
42
+ * ```
43
+ */
44
+ export const SuggestionsWrapper = forwardRef<HTMLDivElement, SuggestionsWrapperProps>(
45
+ ({ as: Tag = "div", className, ...rest }, ref) => (
46
+ <Tag className={clsx("hds-suggestions-wrapper", className as undefined)} ref={ref} {...rest} />
47
+ ),
48
+ );
49
+
50
+ SuggestionsWrapper.displayName = "Suggestions.Wrapper";
@@ -0,0 +1,89 @@
1
+ import { forwardRef } from "react";
2
+ import type { HTMLAttributes, Ref } from "react";
3
+ import { clsx } from "@postenbring/hedwig-css/typed-classname";
4
+ import { SuggestionsWrapper } from "./suggestions-wrapper";
5
+ import { SuggestionsItem, SuggestionsItemAction } from "./suggestions-item";
6
+
7
+ export type { SuggestionsItemActionProps, SuggestionsItemProps } from "./suggestions-item";
8
+
9
+ export interface SuggestionsProps extends HTMLAttributes<HTMLUListElement | HTMLOListElement> {
10
+ /**
11
+ * Change the rendered list element.
12
+ *
13
+ * @default "ul"
14
+ */
15
+ as?: "ul" | "ol";
16
+ /**
17
+ * Sets the size of the items
18
+ *
19
+ * @default "default"
20
+ */
21
+ size?: "default" | "small";
22
+ }
23
+
24
+ export type SuggestionProps = SuggestionsProps;
25
+
26
+ /**
27
+ * A list of suggestions for the user while searching
28
+ *
29
+ * @example
30
+ * ```tsx
31
+ * <Suggestions>
32
+ * <Suggestions.Item>
33
+ * <Suggestions.ItemAction href="/">
34
+ * Albania
35
+ * </Suggestions.ItemAction>
36
+ * </Suggestions.Item>
37
+ * <Suggestions.Item>
38
+ * <Suggestions.ItemAction asChild>
39
+ * <button type="button">Select Albania</button>
40
+ * </Suggestions.ItemAction>
41
+ * </Suggestions.Item>
42
+ * </Suggestions>
43
+ * ```
44
+ *
45
+ * Use `as="ol"` for ordered suggestions:
46
+ * ```tsx
47
+ * <Suggestions as="ol">
48
+ * <Suggestions.Item>
49
+ * <Suggestions.ItemAction href="/">
50
+ * First result
51
+ * </Suggestions.ItemAction>
52
+ * </Suggestions.Item>
53
+ * </Suggestions>
54
+ * ```
55
+ */
56
+ export const Suggestions = forwardRef<HTMLUListElement | HTMLOListElement, SuggestionProps>(
57
+ ({ as = "ul", size = "default", className, ...rest }, ref) => {
58
+ const classes = clsx(
59
+ "hds-suggestions",
60
+ size !== "default" && `hds-suggestions--${size}`,
61
+ className as undefined,
62
+ );
63
+
64
+ return as === "ol" ? (
65
+ <ol
66
+ className={classes}
67
+ ref={ref as Ref<HTMLOListElement>}
68
+ {...(rest as HTMLAttributes<HTMLOListElement>)}
69
+ />
70
+ ) : (
71
+ <ul className={classes} ref={ref as Ref<HTMLUListElement>} {...rest} />
72
+ );
73
+ },
74
+ ) as SuggestionsType;
75
+
76
+ type SuggestionsType = ReturnType<
77
+ typeof forwardRef<HTMLUListElement | HTMLOListElement, SuggestionProps>
78
+ > & {
79
+ Item: typeof SuggestionsItem;
80
+ ItemAction: typeof SuggestionsItemAction;
81
+ Wrapper: typeof SuggestionsWrapper;
82
+ };
83
+
84
+ Suggestions.displayName = "Suggestions";
85
+ SuggestionsItem.displayName = "Suggestions.Item";
86
+ SuggestionsItemAction.displayName = "Suggestions.ItemAction";
87
+ Suggestions.Item = SuggestionsItem;
88
+ Suggestions.ItemAction = SuggestionsItemAction;
89
+ Suggestions.Wrapper = SuggestionsWrapper;
@@ -1 +0,0 @@
1
- //# sourceMappingURL=chunk-CVE23PMJ.mjs.map