@postenbring/hedwig-react 4.2.2 → 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 (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 +26 -11
  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 +30 -15
  42. package/package.json +5 -5
  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
@@ -0,0 +1,45 @@
1
+ import type { AnchorHTMLAttributes, HTMLAttributes } from "react";
2
+ export type SuggestionsItemProps = HTMLAttributes<HTMLLIElement>;
3
+ export interface SuggestionsItemActionProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
4
+ /**
5
+ * Use the element passed as a child, merging its props and behavior.
6
+ *
7
+ * @default false
8
+ */
9
+ asChild?: boolean;
10
+ }
11
+ /**
12
+ * A single structural item in a suggestions list.
13
+ *
14
+ * Use `Suggestions.ItemAction` as the interactive child of each item.
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * <Suggestions.Item>
19
+ * <Suggestions.ItemAction href="/results">
20
+ * View results
21
+ * </Suggestions.ItemAction>
22
+ * </Suggestions.Item>
23
+ * ```
24
+ */
25
+ export declare const SuggestionsItem: import("react").ForwardRefExoticComponent<SuggestionsItemProps & import("react").RefAttributes<HTMLLIElement>>;
26
+ /**
27
+ * The interactive action within a suggestions item.
28
+ *
29
+ * Renders an anchor by default and applies the `hds-suggestions-item__action`
30
+ * class. Use `asChild` to render another interactive element, such as a button
31
+ * or router link, while preserving the action styling.
32
+ *
33
+ * @example
34
+ * ```tsx
35
+ * <Suggestions.ItemAction href="/results">
36
+ * View results
37
+ * </Suggestions.ItemAction>
38
+ *
39
+ * <Suggestions.ItemAction asChild>
40
+ * <button type="button">Select result</button>
41
+ * </Suggestions.ItemAction>
42
+ * ```
43
+ */
44
+ export declare const SuggestionsItemAction: import("react").ForwardRefExoticComponent<SuggestionsItemActionProps & import("react").RefAttributes<HTMLAnchorElement>>;
45
+ //# sourceMappingURL=suggestions-item.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suggestions-item.d.ts","sourceRoot":"","sources":["../../../src/form/suggestions/suggestions-item.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAO,MAAM,OAAO,CAAC;AAIvE,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC,aAAa,CAAC,CAAC;AAEjE,MAAM,WAAW,0BAA2B,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC;IACzF;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,eAAe,gHAI3B,CAAC;AAIF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,qBAAqB,0HAWjC,CAAC"}
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __spreadValues = (a, b) => {
10
+ for (var prop in b || (b = {}))
11
+ if (__hasOwnProp.call(b, prop))
12
+ __defNormalProp(a, prop, b[prop]);
13
+ if (__getOwnPropSymbols)
14
+ for (var prop of __getOwnPropSymbols(b)) {
15
+ if (__propIsEnum.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ }
18
+ return a;
19
+ };
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
32
+ var __export = (target, all) => {
33
+ for (var name in all)
34
+ __defProp(target, name, { get: all[name], enumerable: true });
35
+ };
36
+ var __copyProps = (to, from, except, desc) => {
37
+ if (from && typeof from === "object" || typeof from === "function") {
38
+ for (let key of __getOwnPropNames(from))
39
+ if (!__hasOwnProp.call(to, key) && key !== except)
40
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
41
+ }
42
+ return to;
43
+ };
44
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
45
+
46
+ // src/form/suggestions/suggestions-item.tsx
47
+ var suggestions_item_exports = {};
48
+ __export(suggestions_item_exports, {
49
+ SuggestionsItem: () => SuggestionsItem,
50
+ SuggestionsItemAction: () => SuggestionsItemAction
51
+ });
52
+ module.exports = __toCommonJS(suggestions_item_exports);
53
+ var import_react = require("react");
54
+ var import_typed_classname = require("@postenbring/hedwig-css/typed-classname");
55
+ var import_react_slot = require("@radix-ui/react-slot");
56
+ var import_jsx_runtime = require("react/jsx-runtime");
57
+ var SuggestionsItem = (0, import_react.forwardRef)(
58
+ (_a, ref) => {
59
+ var _b = _a, { className } = _b, rest = __objRest(_b, ["className"]);
60
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", __spreadValues({ className: (0, import_typed_classname.clsx)("hds-suggestions-item", className), ref }, rest));
61
+ }
62
+ );
63
+ SuggestionsItem.displayName = "Suggestions.Item";
64
+ var SuggestionsItemAction = (0, import_react.forwardRef)(
65
+ (_a, ref) => {
66
+ var _b = _a, { asChild, className } = _b, rest = __objRest(_b, ["asChild", "className"]);
67
+ const Component = asChild ? import_react_slot.Slot : "a";
68
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
69
+ Component,
70
+ __spreadValues({
71
+ className: (0, import_typed_classname.clsx)("hds-suggestions-item__action", className),
72
+ ref
73
+ }, rest)
74
+ );
75
+ }
76
+ );
77
+ SuggestionsItemAction.displayName = "Suggestions.ItemAction";
78
+ // Annotate the CommonJS export names for ESM import in node:
79
+ 0 && (module.exports = {
80
+ SuggestionsItem,
81
+ SuggestionsItemAction
82
+ });
83
+ //# sourceMappingURL=suggestions-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/form/suggestions/suggestions-item.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { AnchorHTMLAttributes, HTMLAttributes, Ref } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot } from \"@radix-ui/react-slot\";\n\nexport type SuggestionsItemProps = HTMLAttributes<HTMLLIElement>;\n\nexport interface SuggestionsItemActionProps extends AnchorHTMLAttributes<HTMLAnchorElement> {\n /**\n * Use the element passed as a child, merging its props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n}\n\n/**\n * A single structural item in a suggestions list.\n *\n * Use `Suggestions.ItemAction` as the interactive child of each item.\n *\n * @example\n * ```tsx\n * <Suggestions.Item>\n * <Suggestions.ItemAction href=\"/results\">\n * View results\n * </Suggestions.ItemAction>\n * </Suggestions.Item>\n * ```\n */\nexport const SuggestionsItem = forwardRef<HTMLLIElement, SuggestionsItemProps>(\n ({ className, ...rest }, ref) => (\n <li className={clsx(\"hds-suggestions-item\", className as undefined)} ref={ref} {...rest} />\n ),\n);\n\nSuggestionsItem.displayName = \"Suggestions.Item\";\n\n/**\n * The interactive action within a suggestions item.\n *\n * Renders an anchor by default and applies the `hds-suggestions-item__action`\n * class. Use `asChild` to render another interactive element, such as a button\n * or router link, while preserving the action styling.\n *\n * @example\n * ```tsx\n * <Suggestions.ItemAction href=\"/results\">\n * View results\n * </Suggestions.ItemAction>\n *\n * <Suggestions.ItemAction asChild>\n * <button type=\"button\">Select result</button>\n * </Suggestions.ItemAction>\n * ```\n */\nexport const SuggestionsItemAction = forwardRef<HTMLAnchorElement, SuggestionsItemActionProps>(\n ({ asChild, className, ...rest }, ref) => {\n const Component = asChild ? Slot : \"a\";\n return (\n <Component\n className={clsx(\"hds-suggestions-item__action\", className as undefined)}\n ref={ref as Ref<HTMLAnchorElement>}\n {...rest}\n />\n );\n },\n);\n\nSuggestionsItemAction.displayName = \"Suggestions.ItemAction\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA2B;AAE3B,6BAAqB;AACrB,wBAAqB;AA6BjB;AAFG,IAAM,sBAAkB;AAAA,EAC7B,CAAC,IAAwB,QAAK;AAA7B,iBAAE,YA/BL,IA+BG,IAAgB,iBAAhB,IAAgB,CAAd;AACD,uDAAC,uBAAG,eAAW,6BAAK,wBAAwB,SAAsB,GAAG,OAAc,KAAM;AAAA;AAE7F;AAEA,gBAAgB,cAAc;AAoBvB,IAAM,4BAAwB;AAAA,EACnC,CAAC,IAAiC,QAAQ;AAAzC,iBAAE,WAAS,UAzDd,IAyDG,IAAyB,iBAAzB,IAAyB,CAAvB,WAAS;AACV,UAAM,YAAY,UAAU,yBAAO;AACnC,WACE;AAAA,MAAC;AAAA;AAAA,QACC,eAAW,6BAAK,gCAAgC,SAAsB;AAAA,QACtE;AAAA,SACI;AAAA,IACN;AAAA,EAEJ;AACF;AAEA,sBAAsB,cAAc;","names":[]}
@@ -0,0 +1,10 @@
1
+ import {
2
+ SuggestionsItem,
3
+ SuggestionsItemAction
4
+ } from "../../chunk-FTVKPZCX.mjs";
5
+ import "../../chunk-YOSPWY5K.mjs";
6
+ export {
7
+ SuggestionsItem,
8
+ SuggestionsItemAction
9
+ };
10
+ //# sourceMappingURL=suggestions-item.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,41 @@
1
+ import type { HTMLAttributes } from "react";
2
+ export interface SuggestionsWrapperProps extends HTMLAttributes<HTMLDivElement> {
3
+ /**
4
+ * Change the rendered element for the suggestions wrapper.
5
+ *
6
+ * @default "div"
7
+ */
8
+ as?: "section" | "div";
9
+ }
10
+ /**
11
+ * A wrapper for search suggestions.
12
+ * Intended to contain a SearchWrapper and Suggestions.
13
+ *
14
+ * @example
15
+ * ```tsx
16
+ * <Suggestions.Wrapper>
17
+ * <SearchWrapper>
18
+ * <Input type="search" aria-label="Search content" />
19
+ * <Button>Search</Button>
20
+ * <Button icon aria-label="Clear search">
21
+ * <XmarkIcon />
22
+ * </Button>
23
+ * </SearchWrapper>
24
+ * <Suggestions>
25
+ * <Suggestions.Item>
26
+ * <Suggestions.ItemAction href="/">Albania</Suggestions.ItemAction>
27
+ * </Suggestions.Item>
28
+ * </Suggestions>
29
+ * </Suggestions.Wrapper>
30
+ * ```
31
+ *
32
+ * Use `as` when the wrapper needs a different semantic element:
33
+ * ```tsx
34
+ * <Suggestions.Wrapper as="section">
35
+ * <SearchWrapper>...</SearchWrapper>
36
+ * <Suggestions>...</Suggestions>
37
+ * </Suggestions.Wrapper>
38
+ * ```
39
+ */
40
+ export declare const SuggestionsWrapper: import("react").ForwardRefExoticComponent<SuggestionsWrapperProps & import("react").RefAttributes<HTMLDivElement>>;
41
+ //# sourceMappingURL=suggestions-wrapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suggestions-wrapper.d.ts","sourceRoot":"","sources":["../../../src/form/suggestions/suggestions-wrapper.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAG5C,MAAM,WAAW,uBAAwB,SAAQ,cAAc,CAAC,cAAc,CAAC;IAC7E;;;;OAIG;IACH,EAAE,CAAC,EAAE,SAAS,GAAG,KAAK,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,kBAAkB,oHAI9B,CAAC"}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __spreadValues = (a, b) => {
10
+ for (var prop in b || (b = {}))
11
+ if (__hasOwnProp.call(b, prop))
12
+ __defNormalProp(a, prop, b[prop]);
13
+ if (__getOwnPropSymbols)
14
+ for (var prop of __getOwnPropSymbols(b)) {
15
+ if (__propIsEnum.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ }
18
+ return a;
19
+ };
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
32
+ var __export = (target, all) => {
33
+ for (var name in all)
34
+ __defProp(target, name, { get: all[name], enumerable: true });
35
+ };
36
+ var __copyProps = (to, from, except, desc) => {
37
+ if (from && typeof from === "object" || typeof from === "function") {
38
+ for (let key of __getOwnPropNames(from))
39
+ if (!__hasOwnProp.call(to, key) && key !== except)
40
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
41
+ }
42
+ return to;
43
+ };
44
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
45
+
46
+ // src/form/suggestions/suggestions-wrapper.tsx
47
+ var suggestions_wrapper_exports = {};
48
+ __export(suggestions_wrapper_exports, {
49
+ SuggestionsWrapper: () => SuggestionsWrapper
50
+ });
51
+ module.exports = __toCommonJS(suggestions_wrapper_exports);
52
+ var import_react = require("react");
53
+ var import_typed_classname = require("@postenbring/hedwig-css/typed-classname");
54
+ var import_jsx_runtime = require("react/jsx-runtime");
55
+ var SuggestionsWrapper = (0, import_react.forwardRef)(
56
+ (_a, ref) => {
57
+ var _b = _a, { as: Tag = "div", className } = _b, rest = __objRest(_b, ["as", "className"]);
58
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tag, __spreadValues({ className: (0, import_typed_classname.clsx)("hds-suggestions-wrapper", className), ref }, rest));
59
+ }
60
+ );
61
+ SuggestionsWrapper.displayName = "Suggestions.Wrapper";
62
+ // Annotate the CommonJS export names for ESM import in node:
63
+ 0 && (module.exports = {
64
+ SuggestionsWrapper
65
+ });
66
+ //# sourceMappingURL=suggestions-wrapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/form/suggestions/suggestions-wrapper.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { HTMLAttributes } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\n\nexport interface SuggestionsWrapperProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Change the rendered element for the suggestions wrapper.\n *\n * @default \"div\"\n */\n as?: \"section\" | \"div\";\n}\n\n/**\n * A wrapper for search suggestions.\n * Intended to contain a SearchWrapper and Suggestions.\n *\n * @example\n * ```tsx\n * <Suggestions.Wrapper>\n * <SearchWrapper>\n * <Input type=\"search\" aria-label=\"Search content\" />\n * <Button>Search</Button>\n * <Button icon aria-label=\"Clear search\">\n * <XmarkIcon />\n * </Button>\n * </SearchWrapper>\n * <Suggestions>\n * <Suggestions.Item>\n * <Suggestions.ItemAction href=\"/\">Albania</Suggestions.ItemAction>\n * </Suggestions.Item>\n * </Suggestions>\n * </Suggestions.Wrapper>\n * ```\n *\n * Use `as` when the wrapper needs a different semantic element:\n * ```tsx\n * <Suggestions.Wrapper as=\"section\">\n * <SearchWrapper>...</SearchWrapper>\n * <Suggestions>...</Suggestions>\n * </Suggestions.Wrapper>\n * ```\n */\nexport const SuggestionsWrapper = forwardRef<HTMLDivElement, SuggestionsWrapperProps>(\n ({ as: Tag = \"div\", className, ...rest }, ref) => (\n <Tag className={clsx(\"hds-suggestions-wrapper\", className as undefined)} ref={ref} {...rest} />\n ),\n);\n\nSuggestionsWrapper.displayName = \"Suggestions.Wrapper\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA2B;AAE3B,6BAAqB;AA2CjB;AAFG,IAAM,yBAAqB;AAAA,EAChC,CAAC,IAAyC,QAAK;AAA9C,iBAAE,MAAI,MAAM,OAAO,UA5CtB,IA4CG,IAAiC,iBAAjC,IAAiC,CAA/B,MAAiB;AAClB,uDAAC,sBAAI,eAAW,6BAAK,2BAA2B,SAAsB,GAAG,OAAc,KAAM;AAAA;AAEjG;AAEA,mBAAmB,cAAc;","names":[]}
@@ -0,0 +1,8 @@
1
+ import {
2
+ SuggestionsWrapper
3
+ } from "../../chunk-HA3LRSDK.mjs";
4
+ import "../../chunk-YOSPWY5K.mjs";
5
+ export {
6
+ SuggestionsWrapper
7
+ };
8
+ //# sourceMappingURL=suggestions-wrapper.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,57 @@
1
+ import { forwardRef } from "react";
2
+ import type { HTMLAttributes } from "react";
3
+ import { SuggestionsWrapper } from "./suggestions-wrapper";
4
+ import { SuggestionsItem, SuggestionsItemAction } from "./suggestions-item";
5
+ export type { SuggestionsItemActionProps, SuggestionsItemProps } from "./suggestions-item";
6
+ export interface SuggestionsProps extends HTMLAttributes<HTMLUListElement | HTMLOListElement> {
7
+ /**
8
+ * Change the rendered list element.
9
+ *
10
+ * @default "ul"
11
+ */
12
+ as?: "ul" | "ol";
13
+ /**
14
+ * Sets the size of the items
15
+ *
16
+ * @default "default"
17
+ */
18
+ size?: "default" | "small";
19
+ }
20
+ export type SuggestionProps = SuggestionsProps;
21
+ /**
22
+ * A list of suggestions for the user while searching
23
+ *
24
+ * @example
25
+ * ```tsx
26
+ * <Suggestions>
27
+ * <Suggestions.Item>
28
+ * <Suggestions.ItemAction href="/">
29
+ * Albania
30
+ * </Suggestions.ItemAction>
31
+ * </Suggestions.Item>
32
+ * <Suggestions.Item>
33
+ * <Suggestions.ItemAction asChild>
34
+ * <button type="button">Select Albania</button>
35
+ * </Suggestions.ItemAction>
36
+ * </Suggestions.Item>
37
+ * </Suggestions>
38
+ * ```
39
+ *
40
+ * Use `as="ol"` for ordered suggestions:
41
+ * ```tsx
42
+ * <Suggestions as="ol">
43
+ * <Suggestions.Item>
44
+ * <Suggestions.ItemAction href="/">
45
+ * First result
46
+ * </Suggestions.ItemAction>
47
+ * </Suggestions.Item>
48
+ * </Suggestions>
49
+ * ```
50
+ */
51
+ export declare const Suggestions: SuggestionsType;
52
+ type SuggestionsType = ReturnType<typeof forwardRef<HTMLUListElement | HTMLOListElement, SuggestionProps>> & {
53
+ Item: typeof SuggestionsItem;
54
+ ItemAction: typeof SuggestionsItemAction;
55
+ Wrapper: typeof SuggestionsWrapper;
56
+ };
57
+ //# sourceMappingURL=suggestions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suggestions.d.ts","sourceRoot":"","sources":["../../../src/form/suggestions/suggestions.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,KAAK,EAAE,cAAc,EAAO,MAAM,OAAO,CAAC;AAEjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAE5E,YAAY,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE3F,MAAM,WAAW,gBAAiB,SAAQ,cAAc,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;IAC3F;;;;OAIG;IACH,EAAE,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACjB;;;;OAIG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;CAC5B;AAED,MAAM,MAAM,eAAe,GAAG,gBAAgB,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,WAAW,EAkBnB,eAAe,CAAC;AAErB,KAAK,eAAe,GAAG,UAAU,CAC/B,OAAO,UAAU,CAAC,gBAAgB,GAAG,gBAAgB,EAAE,eAAe,CAAC,CACxE,GAAG;IACF,IAAI,EAAE,OAAO,eAAe,CAAC;IAC7B,UAAU,EAAE,OAAO,qBAAqB,CAAC;IACzC,OAAO,EAAE,OAAO,kBAAkB,CAAC;CACpC,CAAC"}
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __spreadValues = (a, b) => {
10
+ for (var prop in b || (b = {}))
11
+ if (__hasOwnProp.call(b, prop))
12
+ __defNormalProp(a, prop, b[prop]);
13
+ if (__getOwnPropSymbols)
14
+ for (var prop of __getOwnPropSymbols(b)) {
15
+ if (__propIsEnum.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ }
18
+ return a;
19
+ };
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
32
+ var __export = (target, all) => {
33
+ for (var name in all)
34
+ __defProp(target, name, { get: all[name], enumerable: true });
35
+ };
36
+ var __copyProps = (to, from, except, desc) => {
37
+ if (from && typeof from === "object" || typeof from === "function") {
38
+ for (let key of __getOwnPropNames(from))
39
+ if (!__hasOwnProp.call(to, key) && key !== except)
40
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
41
+ }
42
+ return to;
43
+ };
44
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
45
+
46
+ // src/form/suggestions/suggestions.tsx
47
+ var suggestions_exports = {};
48
+ __export(suggestions_exports, {
49
+ Suggestions: () => Suggestions
50
+ });
51
+ module.exports = __toCommonJS(suggestions_exports);
52
+ var import_react3 = require("react");
53
+ var import_typed_classname3 = require("@postenbring/hedwig-css/typed-classname");
54
+
55
+ // src/form/suggestions/suggestions-wrapper.tsx
56
+ var import_react = require("react");
57
+ var import_typed_classname = require("@postenbring/hedwig-css/typed-classname");
58
+ var import_jsx_runtime = require("react/jsx-runtime");
59
+ var SuggestionsWrapper = (0, import_react.forwardRef)(
60
+ (_a, ref) => {
61
+ var _b = _a, { as: Tag = "div", className } = _b, rest = __objRest(_b, ["as", "className"]);
62
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tag, __spreadValues({ className: (0, import_typed_classname.clsx)("hds-suggestions-wrapper", className), ref }, rest));
63
+ }
64
+ );
65
+ SuggestionsWrapper.displayName = "Suggestions.Wrapper";
66
+
67
+ // src/form/suggestions/suggestions-item.tsx
68
+ var import_react2 = require("react");
69
+ var import_typed_classname2 = require("@postenbring/hedwig-css/typed-classname");
70
+ var import_react_slot = require("@radix-ui/react-slot");
71
+ var import_jsx_runtime2 = require("react/jsx-runtime");
72
+ var SuggestionsItem = (0, import_react2.forwardRef)(
73
+ (_a, ref) => {
74
+ var _b = _a, { className } = _b, rest = __objRest(_b, ["className"]);
75
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("li", __spreadValues({ className: (0, import_typed_classname2.clsx)("hds-suggestions-item", className), ref }, rest));
76
+ }
77
+ );
78
+ SuggestionsItem.displayName = "Suggestions.Item";
79
+ var SuggestionsItemAction = (0, import_react2.forwardRef)(
80
+ (_a, ref) => {
81
+ var _b = _a, { asChild, className } = _b, rest = __objRest(_b, ["asChild", "className"]);
82
+ const Component = asChild ? import_react_slot.Slot : "a";
83
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
84
+ Component,
85
+ __spreadValues({
86
+ className: (0, import_typed_classname2.clsx)("hds-suggestions-item__action", className),
87
+ ref
88
+ }, rest)
89
+ );
90
+ }
91
+ );
92
+ SuggestionsItemAction.displayName = "Suggestions.ItemAction";
93
+
94
+ // src/form/suggestions/suggestions.tsx
95
+ var import_jsx_runtime3 = require("react/jsx-runtime");
96
+ var Suggestions = (0, import_react3.forwardRef)(
97
+ (_a, ref) => {
98
+ var _b = _a, { as = "ul", size = "default", className } = _b, rest = __objRest(_b, ["as", "size", "className"]);
99
+ const classes = (0, import_typed_classname3.clsx)(
100
+ "hds-suggestions",
101
+ size !== "default" && `hds-suggestions--${size}`,
102
+ className
103
+ );
104
+ return as === "ol" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
105
+ "ol",
106
+ __spreadValues({
107
+ className: classes,
108
+ ref
109
+ }, rest)
110
+ ) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ul", __spreadValues({ className: classes, ref }, rest));
111
+ }
112
+ );
113
+ Suggestions.displayName = "Suggestions";
114
+ SuggestionsItem.displayName = "Suggestions.Item";
115
+ SuggestionsItemAction.displayName = "Suggestions.ItemAction";
116
+ Suggestions.Item = SuggestionsItem;
117
+ Suggestions.ItemAction = SuggestionsItemAction;
118
+ Suggestions.Wrapper = SuggestionsWrapper;
119
+ // Annotate the CommonJS export names for ESM import in node:
120
+ 0 && (module.exports = {
121
+ Suggestions
122
+ });
123
+ //# sourceMappingURL=suggestions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/form/suggestions/suggestions.tsx","../../../src/form/suggestions/suggestions-wrapper.tsx","../../../src/form/suggestions/suggestions-item.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { HTMLAttributes, Ref } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { SuggestionsWrapper } from \"./suggestions-wrapper\";\nimport { SuggestionsItem, SuggestionsItemAction } from \"./suggestions-item\";\n\nexport type { SuggestionsItemActionProps, SuggestionsItemProps } from \"./suggestions-item\";\n\nexport interface SuggestionsProps extends HTMLAttributes<HTMLUListElement | HTMLOListElement> {\n /**\n * Change the rendered list element.\n *\n * @default \"ul\"\n */\n as?: \"ul\" | \"ol\";\n /**\n * Sets the size of the items\n *\n * @default \"default\"\n */\n size?: \"default\" | \"small\";\n}\n\nexport type SuggestionProps = SuggestionsProps;\n\n/**\n * A list of suggestions for the user while searching\n *\n * @example\n * ```tsx\n * <Suggestions>\n * <Suggestions.Item>\n * <Suggestions.ItemAction href=\"/\">\n * Albania\n * </Suggestions.ItemAction>\n * </Suggestions.Item>\n * <Suggestions.Item>\n * <Suggestions.ItemAction asChild>\n * <button type=\"button\">Select Albania</button>\n * </Suggestions.ItemAction>\n * </Suggestions.Item>\n * </Suggestions>\n * ```\n *\n * Use `as=\"ol\"` for ordered suggestions:\n * ```tsx\n * <Suggestions as=\"ol\">\n * <Suggestions.Item>\n* <Suggestions.ItemAction href=\"/\">\n* First result\n* </Suggestions.ItemAction>\n * </Suggestions.Item>\n * </Suggestions>\n * ```\n */\nexport const Suggestions = forwardRef<HTMLUListElement | HTMLOListElement, SuggestionProps>(\n ({ as = \"ul\", size = \"default\", className, ...rest }, ref) => {\n const classes = clsx(\n \"hds-suggestions\",\n size !== \"default\" && `hds-suggestions--${size}`,\n className as undefined,\n );\n\n return as === \"ol\" ? (\n <ol\n className={classes}\n ref={ref as Ref<HTMLOListElement>}\n {...(rest as HTMLAttributes<HTMLOListElement>)}\n />\n ) : (\n <ul className={classes} ref={ref as Ref<HTMLUListElement>} {...rest} />\n );\n },\n) as SuggestionsType;\n\ntype SuggestionsType = ReturnType<\n typeof forwardRef<HTMLUListElement | HTMLOListElement, SuggestionProps>\n> & {\n Item: typeof SuggestionsItem;\n ItemAction: typeof SuggestionsItemAction;\n Wrapper: typeof SuggestionsWrapper;\n};\n\nSuggestions.displayName = \"Suggestions\";\nSuggestionsItem.displayName = \"Suggestions.Item\";\nSuggestionsItemAction.displayName = \"Suggestions.ItemAction\";\nSuggestions.Item = SuggestionsItem;\nSuggestions.ItemAction = SuggestionsItemAction;\nSuggestions.Wrapper = SuggestionsWrapper;\n","import { forwardRef } from \"react\";\nimport type { HTMLAttributes } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\n\nexport interface SuggestionsWrapperProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Change the rendered element for the suggestions wrapper.\n *\n * @default \"div\"\n */\n as?: \"section\" | \"div\";\n}\n\n/**\n * A wrapper for search suggestions.\n * Intended to contain a SearchWrapper and Suggestions.\n *\n * @example\n * ```tsx\n * <Suggestions.Wrapper>\n * <SearchWrapper>\n * <Input type=\"search\" aria-label=\"Search content\" />\n * <Button>Search</Button>\n * <Button icon aria-label=\"Clear search\">\n * <XmarkIcon />\n * </Button>\n * </SearchWrapper>\n * <Suggestions>\n * <Suggestions.Item>\n * <Suggestions.ItemAction href=\"/\">Albania</Suggestions.ItemAction>\n * </Suggestions.Item>\n * </Suggestions>\n * </Suggestions.Wrapper>\n * ```\n *\n * Use `as` when the wrapper needs a different semantic element:\n * ```tsx\n * <Suggestions.Wrapper as=\"section\">\n * <SearchWrapper>...</SearchWrapper>\n * <Suggestions>...</Suggestions>\n * </Suggestions.Wrapper>\n * ```\n */\nexport const SuggestionsWrapper = forwardRef<HTMLDivElement, SuggestionsWrapperProps>(\n ({ as: Tag = \"div\", className, ...rest }, ref) => (\n <Tag className={clsx(\"hds-suggestions-wrapper\", className as undefined)} ref={ref} {...rest} />\n ),\n);\n\nSuggestionsWrapper.displayName = \"Suggestions.Wrapper\";\n","import { forwardRef } from \"react\";\nimport type { AnchorHTMLAttributes, HTMLAttributes, Ref } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot } from \"@radix-ui/react-slot\";\n\nexport type SuggestionsItemProps = HTMLAttributes<HTMLLIElement>;\n\nexport interface SuggestionsItemActionProps extends AnchorHTMLAttributes<HTMLAnchorElement> {\n /**\n * Use the element passed as a child, merging its props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n}\n\n/**\n * A single structural item in a suggestions list.\n *\n * Use `Suggestions.ItemAction` as the interactive child of each item.\n *\n * @example\n * ```tsx\n * <Suggestions.Item>\n * <Suggestions.ItemAction href=\"/results\">\n * View results\n * </Suggestions.ItemAction>\n * </Suggestions.Item>\n * ```\n */\nexport const SuggestionsItem = forwardRef<HTMLLIElement, SuggestionsItemProps>(\n ({ className, ...rest }, ref) => (\n <li className={clsx(\"hds-suggestions-item\", className as undefined)} ref={ref} {...rest} />\n ),\n);\n\nSuggestionsItem.displayName = \"Suggestions.Item\";\n\n/**\n * The interactive action within a suggestions item.\n *\n * Renders an anchor by default and applies the `hds-suggestions-item__action`\n * class. Use `asChild` to render another interactive element, such as a button\n * or router link, while preserving the action styling.\n *\n * @example\n * ```tsx\n * <Suggestions.ItemAction href=\"/results\">\n * View results\n * </Suggestions.ItemAction>\n *\n * <Suggestions.ItemAction asChild>\n * <button type=\"button\">Select result</button>\n * </Suggestions.ItemAction>\n * ```\n */\nexport const SuggestionsItemAction = forwardRef<HTMLAnchorElement, SuggestionsItemActionProps>(\n ({ asChild, className, ...rest }, ref) => {\n const Component = asChild ? Slot : \"a\";\n return (\n <Component\n className={clsx(\"hds-suggestions-item__action\", className as undefined)}\n ref={ref as Ref<HTMLAnchorElement>}\n {...rest}\n />\n );\n },\n);\n\nSuggestionsItemAction.displayName = \"Suggestions.ItemAction\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,gBAA2B;AAE3B,IAAAC,0BAAqB;;;ACFrB,mBAA2B;AAE3B,6BAAqB;AA2CjB;AAFG,IAAM,yBAAqB;AAAA,EAChC,CAAC,IAAyC,QAAK;AAA9C,iBAAE,MAAI,MAAM,OAAO,UA5CtB,IA4CG,IAAiC,iBAAjC,IAAiC,CAA/B,MAAiB;AAClB,uDAAC,sBAAI,eAAW,6BAAK,2BAA2B,SAAsB,GAAG,OAAc,KAAM;AAAA;AAEjG;AAEA,mBAAmB,cAAc;;;ACjDjC,IAAAC,gBAA2B;AAE3B,IAAAC,0BAAqB;AACrB,wBAAqB;AA6BjB,IAAAC,sBAAA;AAFG,IAAM,sBAAkB;AAAA,EAC7B,CAAC,IAAwB,QAAK;AAA7B,iBAAE,YA/BL,IA+BG,IAAgB,iBAAhB,IAAgB,CAAd;AACD,wDAAC,uBAAG,eAAW,8BAAK,wBAAwB,SAAsB,GAAG,OAAc,KAAM;AAAA;AAE7F;AAEA,gBAAgB,cAAc;AAoBvB,IAAM,4BAAwB;AAAA,EACnC,CAAC,IAAiC,QAAQ;AAAzC,iBAAE,WAAS,UAzDd,IAyDG,IAAyB,iBAAzB,IAAyB,CAAvB,WAAS;AACV,UAAM,YAAY,UAAU,yBAAO;AACnC,WACE;AAAA,MAAC;AAAA;AAAA,QACC,eAAW,8BAAK,gCAAgC,SAAsB;AAAA,QACtE;AAAA,SACI;AAAA,IACN;AAAA,EAEJ;AACF;AAEA,sBAAsB,cAAc;;;AFL9B,IAAAC,sBAAA;AATC,IAAM,kBAAc;AAAA,EACzB,CAAC,IAAqD,QAAQ;AAA7D,iBAAE,OAAK,MAAM,OAAO,WAAW,UAxDlC,IAwDG,IAA6C,iBAA7C,IAA6C,CAA3C,MAAW,QAAkB;AAC9B,UAAM,cAAU;AAAA,MACd;AAAA,MACA,SAAS,aAAa,oBAAoB,IAAI;AAAA,MAC9C;AAAA,IACF;AAEA,WAAO,OAAO,OACZ;AAAA,MAAC;AAAA;AAAA,QACC,WAAW;AAAA,QACX;AAAA,SACK;AAAA,IACP,IAEA,6CAAC,uBAAG,WAAW,SAAS,OAAuC,KAAM;AAAA,EAEzE;AACF;AAUA,YAAY,cAAc;AAC1B,gBAAgB,cAAc;AAC9B,sBAAsB,cAAc;AACpC,YAAY,OAAO;AACnB,YAAY,aAAa;AACzB,YAAY,UAAU;","names":["import_react","import_typed_classname","import_react","import_typed_classname","import_jsx_runtime","import_jsx_runtime"]}
@@ -0,0 +1,10 @@
1
+ import {
2
+ Suggestions
3
+ } from "../../chunk-6D5VE3DW.mjs";
4
+ import "../../chunk-FTVKPZCX.mjs";
5
+ import "../../chunk-HA3LRSDK.mjs";
6
+ import "../../chunk-YOSPWY5K.mjs";
7
+ export {
8
+ Suggestions
9
+ };
10
+ //# sourceMappingURL=suggestions.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}