@postenbring/hedwig-react 4.2.2 → 4.3.1

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 (49) 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-FTVKPZCX.mjs +37 -0
  5. package/dist/chunk-FTVKPZCX.mjs.map +1 -0
  6. package/dist/chunk-HA3LRSDK.mjs +21 -0
  7. package/dist/chunk-HA3LRSDK.mjs.map +1 -0
  8. package/dist/chunk-XSID7YR7.mjs +1 -0
  9. package/dist/chunk-XSID7YR7.mjs.map +1 -0
  10. package/dist/form/index.d.ts +1 -0
  11. package/dist/form/index.d.ts.map +1 -1
  12. package/dist/form/index.js +82 -5
  13. package/dist/form/index.js.map +1 -1
  14. package/dist/form/index.mjs +16 -1
  15. package/dist/form/suggestions/index.d.ts +7 -0
  16. package/dist/form/suggestions/index.d.ts.map +1 -0
  17. package/dist/form/suggestions/index.js +131 -0
  18. package/dist/form/suggestions/index.js.map +1 -0
  19. package/dist/form/suggestions/index.mjs +19 -0
  20. package/dist/form/suggestions/index.mjs.map +1 -0
  21. package/dist/form/suggestions/suggestions-item.d.ts +45 -0
  22. package/dist/form/suggestions/suggestions-item.d.ts.map +1 -0
  23. package/dist/form/suggestions/suggestions-item.js +83 -0
  24. package/dist/form/suggestions/suggestions-item.js.map +1 -0
  25. package/dist/form/suggestions/suggestions-item.mjs +10 -0
  26. package/dist/form/suggestions/suggestions-item.mjs.map +1 -0
  27. package/dist/form/suggestions/suggestions-wrapper.d.ts +41 -0
  28. package/dist/form/suggestions/suggestions-wrapper.d.ts.map +1 -0
  29. package/dist/form/suggestions/suggestions-wrapper.js +66 -0
  30. package/dist/form/suggestions/suggestions-wrapper.js.map +1 -0
  31. package/dist/form/suggestions/suggestions-wrapper.mjs +8 -0
  32. package/dist/form/suggestions/suggestions-wrapper.mjs.map +1 -0
  33. package/dist/form/suggestions/suggestions.d.ts +57 -0
  34. package/dist/form/suggestions/suggestions.d.ts.map +1 -0
  35. package/dist/form/suggestions/suggestions.js +123 -0
  36. package/dist/form/suggestions/suggestions.js.map +1 -0
  37. package/dist/form/suggestions/suggestions.mjs +10 -0
  38. package/dist/form/suggestions/suggestions.mjs.map +1 -0
  39. package/dist/index.js +356 -279
  40. package/dist/index.js.map +1 -1
  41. package/dist/index.mjs +24 -9
  42. package/package.json +7 -7
  43. package/src/form/index.tsx +1 -0
  44. package/src/form/suggestions/index.tsx +6 -0
  45. package/src/form/suggestions/suggestions-item.tsx +70 -0
  46. package/src/form/suggestions/suggestions-wrapper.tsx +50 -0
  47. package/src/form/suggestions/suggestions.tsx +89 -0
  48. package/dist/chunk-CVE23PMJ.mjs +0 -1
  49. /package/dist/{chunk-CVE23PMJ.mjs.map → chunk-5J5LYE6Z.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
@@ -104,7 +104,22 @@ import {
104
104
  FooterLinkSections,
105
105
  FooterLogo
106
106
  } from "./chunk-QDG2QLFV.mjs";
107
- import "./chunk-CVE23PMJ.mjs";
107
+ import "./chunk-CFAH2LID.mjs";
108
+ import {
109
+ HelpText
110
+ } from "./chunk-INDTHGWZ.mjs";
111
+ import "./chunk-5J5LYE6Z.mjs";
112
+ import "./chunk-XSID7YR7.mjs";
113
+ import {
114
+ Suggestions
115
+ } from "./chunk-6D5VE3DW.mjs";
116
+ import {
117
+ SuggestionsItem,
118
+ SuggestionsItemAction
119
+ } from "./chunk-FTVKPZCX.mjs";
120
+ import {
121
+ SuggestionsWrapper
122
+ } from "./chunk-HA3LRSDK.mjs";
108
123
  import "./chunk-AGZHQDCQ.mjs";
109
124
  import {
110
125
  Textarea
@@ -175,10 +190,6 @@ import {
175
190
  OrderedList,
176
191
  UnorderedList
177
192
  } from "./chunk-3QHKPEXO.mjs";
178
- import "./chunk-CFAH2LID.mjs";
179
- import {
180
- HelpText
181
- } from "./chunk-INDTHGWZ.mjs";
182
193
  import "./chunk-ISAHCU7C.mjs";
183
194
  import "./chunk-HT2EIJAD.mjs";
184
195
  import {
@@ -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.2",
3
+ "version": "4.3.1",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -17,10 +17,10 @@
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
- "eslint-config-custom": "0.0.1",
23
- "hedwig-tsconfig": "0.0.0"
22
+ "hedwig-tsconfig": "0.0.0",
23
+ "eslint-config-custom": "0.0.1"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "@types/react": "^17.0.0 || ^18.0.0 || ^19.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.2"
32
+ "@radix-ui/react-popover": "1.1.23",
33
+ "@radix-ui/react-slot": "1.3.3",
34
+ "@postenbring/hedwig-css": "4.3.1"
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