@sikt/sds-combobox 2.2.0 → 3.0.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.
- package/CHANGELOG.md +21 -0
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [3.0.0](https://gitlab.sikt.no/designsystem/sds-komponentbibliotek/compare/@sikt/sds-combobox@2.2.1...@sikt/sds-combobox@3.0.0) (2025-06-25)
|
|
6
|
+
|
|
7
|
+
### ⚠ BREAKING CHANGES
|
|
8
|
+
|
|
9
|
+
- **combobox:** change label to NonNullable<ReactNode>
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
- **combobox:** change label to NonNullable<ReactNode> ([49ccc24](https://gitlab.sikt.no/designsystem/sds-komponentbibliotek/commit/49ccc2465ff16ec849630bc80be34670e373784e))
|
|
14
|
+
- **combobox:** change to ReactNode for helpText & errorText ([89039ed](https://gitlab.sikt.no/designsystem/sds-komponentbibliotek/commit/89039ed38d0d2f042f6b367ea75ce7cbd732c545))
|
|
15
|
+
- **deps:** update dependency react-aria-components to ^1.10.1 ([3410e9a](https://gitlab.sikt.no/designsystem/sds-komponentbibliotek/commit/3410e9a732fd077586885c4ad63d289d26d37276))
|
|
16
|
+
|
|
17
|
+
## [2.2.1](https://gitlab.sikt.no/designsystem/sds-komponentbibliotek/compare/@sikt/sds-combobox@2.2.0...@sikt/sds-combobox@2.2.1) (2025-06-10)
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
- **deps:** update @sikt/sds-form@4.0.1 ([deb5ace](https://gitlab.sikt.no/designsystem/sds-komponentbibliotek/commit/deb5ace25af43ef0489cde09b62deb060cf09712))
|
|
22
|
+
- **deps:** update dependency react-aria-components to ^1.10.0 ([66e4cc0](https://gitlab.sikt.no/designsystem/sds-komponentbibliotek/commit/66e4cc040db98decbed30afd4c5518d2ae157620))
|
|
23
|
+
- **deps:** update dependency react-aria-components to ^1.9.0 ([fb6ba9c](https://gitlab.sikt.no/designsystem/sds-komponentbibliotek/commit/fb6ba9c495b6646710f4e80eaa285cb0e06a097f))
|
|
24
|
+
- move help & error text back under inputs ([7db8d0a](https://gitlab.sikt.no/designsystem/sds-komponentbibliotek/commit/7db8d0a5047365808a7081aa1778cf4b9dbc4bc7))
|
|
25
|
+
|
|
5
26
|
## [2.2.0](https://gitlab.sikt.no/designsystem/sds-komponentbibliotek/compare/@sikt/sds-combobox@2.1.1...@sikt/sds-combobox@2.2.0) (2025-05-21)
|
|
6
27
|
|
|
7
28
|
### Features
|
package/dist/index.d.mts
CHANGED
|
@@ -5,13 +5,13 @@ import { ComboBoxProps, PopoverProps, ListBoxItemProps } from 'react-aria-compon
|
|
|
5
5
|
interface ComboboxBaseProps<T extends object> extends Omit<ComboBoxProps<T>, "children" | "menuTrigger" | "aria-label" | "aria-labelledby"> {
|
|
6
6
|
children: React.ReactNode | ((item: T) => React.ReactNode);
|
|
7
7
|
className?: string;
|
|
8
|
-
errorText?:
|
|
9
|
-
helpText?:
|
|
8
|
+
errorText?: ReactNode;
|
|
9
|
+
helpText?: ReactNode;
|
|
10
10
|
menuTrigger?: "focus" | "manual" | "input";
|
|
11
11
|
popoverProps?: PopoverProps;
|
|
12
12
|
}
|
|
13
13
|
type ComboboxProps<T extends object> = ComboboxBaseProps<T> & ({
|
|
14
|
-
label:
|
|
14
|
+
label: NonNullable<ReactNode>;
|
|
15
15
|
"aria-labelledby"?: never;
|
|
16
16
|
} | {
|
|
17
17
|
label?: never;
|
package/dist/index.d.ts
CHANGED
|
@@ -5,13 +5,13 @@ import { ComboBoxProps, PopoverProps, ListBoxItemProps } from 'react-aria-compon
|
|
|
5
5
|
interface ComboboxBaseProps<T extends object> extends Omit<ComboBoxProps<T>, "children" | "menuTrigger" | "aria-label" | "aria-labelledby"> {
|
|
6
6
|
children: React.ReactNode | ((item: T) => React.ReactNode);
|
|
7
7
|
className?: string;
|
|
8
|
-
errorText?:
|
|
9
|
-
helpText?:
|
|
8
|
+
errorText?: ReactNode;
|
|
9
|
+
helpText?: ReactNode;
|
|
10
10
|
menuTrigger?: "focus" | "manual" | "input";
|
|
11
11
|
popoverProps?: PopoverProps;
|
|
12
12
|
}
|
|
13
13
|
type ComboboxProps<T extends object> = ComboboxBaseProps<T> & ({
|
|
14
|
-
label:
|
|
14
|
+
label: NonNullable<ReactNode>;
|
|
15
15
|
"aria-labelledby"?: never;
|
|
16
16
|
} | {
|
|
17
17
|
label?: never;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("@sikt/sds-form"),r=require("@sikt/sds-icons"),o=require("clsx/lite"),s=require("react"),
|
|
1
|
+
"use strict";var e=require("@sikt/sds-form"),r=require("@sikt/sds-icons"),o=require("clsx/lite"),s=require("react"),t=require("react-aria-components"),a=require("react-node-to-string"),l=require("react/jsx-runtime");function i(e){return e&&e.__esModule?e:{default:e}}var c=i(a),n=Object.defineProperty,b=Object.defineProperties,x=Object.getOwnPropertyDescriptors,d=Object.getOwnPropertySymbols,m=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable,p=(e,r,o)=>r in e?n(e,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[r]=o,f=(e,r)=>{for(var o in r||(r={}))m.call(r,o)&&p(e,o,r[o]);if(d)for(var o of d(r))u.call(r,o)&&p(e,o,r[o]);return e},h=(e,r)=>b(e,x(r)),j=(e,r)=>{var o={};for(var s in e)m.call(e,s)&&r.indexOf(s)<0&&(o[s]=e[s]);if(null!=e&&d)for(var s of d(e))r.indexOf(s)<0&&u.call(e,s)&&(o[s]=e[s]);return o};exports.Combobox=function(a){var i=a,{children:n,className:b,errorText:x,helpText:d,label:m,"aria-labelledby":u,menuTrigger:p="focus",popoverProps:v}=i,_=j(i,["children","className","errorText","helpText","label","aria-labelledby","menuTrigger","popoverProps"]);const y=s.useId(),N="".concat(y,"-error-text"),g="".concat(y,"-help-text"),O=[x&&N,d&&g].filter(Boolean).join(" ")||void 0;return l.jsx(e.FormField,{className:o.clsx("sds-combobox",x&&"sds-combobox--invalid",b),label:m,errorText:x,errorTextId:N,helpText:d,helpTextId:g,htmlFor:y,children:l.jsxs(t.ComboBox,h(f({menuTrigger:p,id:y,"aria-label":c.default(m),"aria-labelledby":u},_),{children:[l.jsxs("div",{className:"sds-combobox__combobox",children:[l.jsx(t.Input,{className:"sds-combobox__combobox-input","aria-describedby":O,"aria-invalid":Boolean(x),"aria-errormessage":x?N:void 0}),l.jsx(t.Button,{className:"sds-combobox__combobox-button",children:l.jsx(r.ExpandShowAltIcon,{})})]}),l.jsx(t.Popover,h(f({className:"sds-combobox__popover"},v),{children:l.jsx(t.ListBox,{className:"sds-combobox__listbox",children:n})}))]}))})},exports.ComboboxHeader=function({children:e}){return l.jsx(t.Header,{className:"sds-combobox__header",children:e})},exports.ComboboxItem=function(e){var r=e,{className:s}=r,a=j(r,["className"]);return l.jsx(t.ListBoxItem,f({className:o.clsx("sds-combobox__item",s)},a))},exports.ComboboxSection=function({children:e}){return l.jsx(t.ListBoxSection,{children:e})};//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/Combobox.tsx"],"names":["useId","jsx","FormField","clsx","jsxs","AriaCombobox","Input","Button","ExpandShowAltIcon","Popover","ListBox","ListBoxItem","Header","ListBoxSection"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../src/Combobox.tsx"],"names":["useId","jsx","FormField","clsx","jsxs","AriaCombobox","reactNodeToString","Input","Button","ExpandShowAltIcon","Popover","ListBox","ListBoxItem","Header","ListBoxSection"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CO,SAAS,SAA2B,EAUtB,EAAA;AAVsB,EACzC,IAAA,EAAA,GAAA,EAAA,EAAA;AAAA,IAAA,QAAA;AAAA,IACA,SAAA;AAAA,IACA,SAAA;AAAA,IACA,QAAA;AAAA,IACA,KAAA;AAAA,IACA,iBAAmB,EAAA,cAAA;AAAA,IACnB,WAAc,GAAA,OAAA;AAAA,IACd;AAAA,GArDF,GA6C2C,EAStC,EAAA,KAAA,GAAA,SAAA,CATsC,EAStC,EAAA;AAAA,IARH,UAAA;AAAA,IACA,WAAA;AAAA,IACA,WAAA;AAAA,IACA,UAAA;AAAA,IACA,OAAA;AAAA,IACA,iBAAA;AAAA,IACA,aAAA;AAAA,IACA;AAAA,GAAA,CAAA;AAGA,EAAA,MAAM,KAAKA,WAAM,EAAA;AACjB,EAAM,MAAA,WAAA,GAAc,GAAG,MAAE,CAAA,EAAA,EAAA,aAAA,CAAA;AACzB,EAAM,MAAA,UAAA,GAAa,GAAG,MAAE,CAAA,EAAA,EAAA,YAAA,CAAA;AAExB,EAAA,MAAM,eACJ,GAAA,CAAC,SAAa,IAAA,WAAA,EAAa,QAAY,IAAA,UAAU,CAC9C,CAAA,MAAA,CAAO,OAAO,CAAA,CACd,IAAK,CAAA,GAAG,CAAK,IAAA,MAAA;AAElB,EACE,uBAAAC,cAAA;AAAA,IAACC,iBAAA;AAAA,IAAA;AAAA,MACC,SAAW,EAAAC,SAAA;AAAA,QACT,cAAA;AAAA,QACA,SAAa,IAAA,uBAAA;AAAA,QACb;AAAA,OACF;AAAA,MACA,KAAA;AAAA,MACA,SAAA;AAAA,MACA,WAAA;AAAA,MACA,QAAA;AAAA,MACA,UAAA;AAAA,MACA,OAAS,EAAA,EAAA;AAAA,MAET,QAAA,kBAAAC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A;AAE9E;AAEO,SAAS,cAAA,CAAe,EAAE,QAAA,EAAqC,EAAA;AACpE,EAAA,uBAAQF,cAAA,CAAAY,0BAAA,EAAA,EAAO,SAAU,EAAA,sBAAA,EAAwB,QAAS,EAAA,CAAA;AAC5D;AAEO,SAAS,eAAA,CAAgB,EAAE,QAAA,EAAqC,EAAA;AACrE,EAAO,uBAAAZ,cAAA,CAACa,sCAAgB,QAAS,EAAA,CAAA;AACnC","file":"index.js","sourcesContent":["import { FormField } from \"@sikt/sds-form\";\nimport { ExpandShowAltIcon } from \"@sikt/sds-icons\";\nimport { clsx } from \"clsx/lite\";\nimport { ReactNode, useId } from \"react\";\nimport {\n ComboBox as AriaCombobox,\n ComboBoxProps as AriaComboboxProps,\n Button,\n Header,\n Input,\n ListBox,\n ListBoxItem,\n ListBoxItemProps,\n ListBoxSection,\n Popover,\n PopoverProps,\n} from \"react-aria-components\";\nimport reactNodeToString from \"react-node-to-string\";\nimport \"./combobox.pcss\";\n\ninterface ComboboxBaseProps<T extends object>\n extends Omit<\n AriaComboboxProps<T>,\n \"children\" | \"menuTrigger\" | \"aria-label\" | \"aria-labelledby\"\n > {\n children: React.ReactNode | ((item: T) => React.ReactNode);\n className?: string;\n errorText?: ReactNode;\n helpText?: ReactNode;\n menuTrigger?: \"focus\" | \"manual\" | \"input\";\n popoverProps?: PopoverProps;\n}\n\nexport type ComboboxProps<T extends object> = ComboboxBaseProps<T> &\n (\n | {\n label: NonNullable<ReactNode>;\n \"aria-labelledby\"?: never;\n }\n | {\n label?: never;\n \"aria-labelledby\": string;\n }\n );\n\nexport function Combobox<T extends object>({\n children,\n className,\n errorText,\n helpText,\n label,\n \"aria-labelledby\": ariaLabelledBy,\n menuTrigger = \"focus\",\n popoverProps,\n ...props\n}: ComboboxProps<T>) {\n const id = useId();\n const errorTextId = `${id}-error-text`;\n const helpTextId = `${id}-help-text`;\n\n const ariaDescribedBy =\n [errorText && errorTextId, helpText && helpTextId]\n .filter(Boolean)\n .join(\" \") || undefined;\n\n return (\n <FormField\n className={clsx(\n \"sds-combobox\",\n errorText && \"sds-combobox--invalid\",\n className,\n )}\n label={label}\n errorText={errorText}\n errorTextId={errorTextId}\n helpText={helpText}\n helpTextId={helpTextId}\n htmlFor={id}\n >\n <AriaCombobox\n menuTrigger={menuTrigger}\n id={id}\n aria-label={reactNodeToString(label)}\n aria-labelledby={ariaLabelledBy}\n {...props}\n >\n <div className=\"sds-combobox__combobox\">\n <Input\n className=\"sds-combobox__combobox-input\"\n aria-describedby={ariaDescribedBy}\n aria-invalid={Boolean(errorText)}\n aria-errormessage={errorText ? errorTextId : undefined}\n />\n <Button className=\"sds-combobox__combobox-button\">\n <ExpandShowAltIcon />\n </Button>\n </div>\n <Popover className=\"sds-combobox__popover\" {...popoverProps}>\n <ListBox className=\"sds-combobox__listbox\">{children}</ListBox>\n </Popover>\n </AriaCombobox>\n </FormField>\n );\n}\n\nexport function ComboboxItem({\n className,\n ...props\n}: ListBoxItemProps & { className?: string }) {\n return (\n <ListBoxItem className={clsx(\"sds-combobox__item\", className)} {...props} />\n );\n}\n\nexport function ComboboxHeader({ children }: { children: ReactNode }) {\n return <Header className=\"sds-combobox__header\">{children}</Header>;\n}\n\nexport function ComboboxSection({ children }: { children: ReactNode }) {\n return <ListBoxSection>{children}</ListBoxSection>;\n}\n"]}
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{FormField as e}from"@sikt/sds-form";import{ExpandShowAltIcon as r}from"@sikt/sds-icons";import{clsx as o}from"clsx/lite";import{useId as a}from"react";import{ComboBox as l,Input as t,Button as
|
|
1
|
+
import{FormField as e}from"@sikt/sds-form";import{ExpandShowAltIcon as r}from"@sikt/sds-icons";import{clsx as o}from"clsx/lite";import{useId as a}from"react";import{ComboBox as l,Input as t,Button as i,Popover as s,ListBox as c,ListBoxItem as n,Header as m,ListBoxSection as b}from"react-aria-components";import d from"react-node-to-string";import{jsx as p,jsxs as x}from"react/jsx-runtime";var f=Object.defineProperty,u=Object.defineProperties,h=Object.getOwnPropertyDescriptors,v=Object.getOwnPropertySymbols,_=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable,N=(e,r,o)=>r in e?f(e,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[r]=o,g=(e,r)=>{for(var o in r||(r={}))_.call(r,o)&&N(e,o,r[o]);if(v)for(var o of v(r))y.call(r,o)&&N(e,o,r[o]);return e},O=(e,r)=>u(e,h(r)),T=(e,r)=>{var o={};for(var a in e)_.call(e,a)&&r.indexOf(a)<0&&(o[a]=e[a]);if(null!=e&&v)for(var a of v(e))r.indexOf(a)<0&&y.call(e,a)&&(o[a]=e[a]);return o};function j(n){var m=n,{children:b,className:f,errorText:u,helpText:h,label:v,"aria-labelledby":_,menuTrigger:y="focus",popoverProps:N}=m,j=T(m,["children","className","errorText","helpText","label","aria-labelledby","menuTrigger","popoverProps"]);const P=a(),w="".concat(P,"-error-text"),I="".concat(P,"-help-text"),k=[u&&w,h&&I].filter(Boolean).join(" ")||void 0;return p(e,{className:o("sds-combobox",u&&"sds-combobox--invalid",f),label:v,errorText:u,errorTextId:w,helpText:h,helpTextId:I,htmlFor:P,children:x(l,O(g({menuTrigger:y,id:P,"aria-label":d(v),"aria-labelledby":_},j),{children:[x("div",{className:"sds-combobox__combobox",children:[p(t,{className:"sds-combobox__combobox-input","aria-describedby":k,"aria-invalid":Boolean(u),"aria-errormessage":u?w:void 0}),p(i,{className:"sds-combobox__combobox-button",children:p(r,{})})]}),p(s,O(g({className:"sds-combobox__popover"},N),{children:p(c,{className:"sds-combobox__listbox",children:b})}))]}))})}function P(e){var r=e,{className:a}=r,l=T(r,["className"]);return p(n,g({className:o("sds-combobox__item",a)},l))}function w({children:e}){return p(m,{className:"sds-combobox__header",children:e})}function I({children:e}){return p(b,{children:e})}export{j as Combobox,w as ComboboxHeader,P as ComboboxItem,I as ComboboxSection};//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/Combobox.tsx"],"names":["AriaCombobox"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../src/Combobox.tsx"],"names":["AriaCombobox"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CO,SAAS,SAA2B,EAUtB,EAAA;AAVsB,EACzC,IAAA,EAAA,GAAA,EAAA,EAAA;AAAA,IAAA,QAAA;AAAA,IACA,SAAA;AAAA,IACA,SAAA;AAAA,IACA,QAAA;AAAA,IACA,KAAA;AAAA,IACA,iBAAmB,EAAA,cAAA;AAAA,IACnB,WAAc,GAAA,OAAA;AAAA,IACd;AAAA,GArDF,GA6C2C,EAStC,EAAA,KAAA,GAAA,SAAA,CATsC,EAStC,EAAA;AAAA,IARH,UAAA;AAAA,IACA,WAAA;AAAA,IACA,WAAA;AAAA,IACA,UAAA;AAAA,IACA,OAAA;AAAA,IACA,iBAAA;AAAA,IACA,aAAA;AAAA,IACA;AAAA,GAAA,CAAA;AAGA,EAAA,MAAM,KAAK,KAAM,EAAA;AACjB,EAAM,MAAA,WAAA,GAAc,GAAG,MAAE,CAAA,EAAA,EAAA,aAAA,CAAA;AACzB,EAAM,MAAA,UAAA,GAAa,GAAG,MAAE,CAAA,EAAA,EAAA,YAAA,CAAA;AAExB,EAAA,MAAM,eACJ,GAAA,CAAC,SAAa,IAAA,WAAA,EAAa,QAAY,IAAA,UAAU,CAC9C,CAAA,MAAA,CAAO,OAAO,CAAA,CACd,IAAK,CAAA,GAAG,CAAK,IAAA,MAAA;AAElB,EACE,uBAAA,GAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,SAAW,EAAA,IAAA;AAAA,QACT,cAAA;AAAA,QACA,SAAa,IAAA,uBAAA;AAAA,QACb;AAAA,OACF;AAAA,MACA,KAAA;AAAA,MACA,SAAA;AAAA,MACA,WAAA;AAAA,MACA,QAAA;AAAA,MACA,U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AsB,EAAA,SAAS,KAAO,KAAO,CAAA,CAAA;AAE9E;AAEO,SAAS,cAAA,CAAe,EAAE,QAAA,EAAqC,EAAA;AACpE,EAAA,uBAAQ,GAAA,CAAA,MAAA,EAAA,EAAO,SAAU,EAAA,sBAAA,EAAwB,QAAS,EAAA,CAAA;AAC5D;AAEO,SAAS,eAAA,CAAgB,EAAE,QAAA,EAAqC,EAAA;AACrE,EAAO,uBAAA,GAAA,CAAC,kBAAgB,QAAS,EAAA,CAAA;AACnC","file":"index.mjs","sourcesContent":["import { FormField } from \"@sikt/sds-form\";\nimport { ExpandShowAltIcon } from \"@sikt/sds-icons\";\nimport { clsx } from \"clsx/lite\";\nimport { ReactNode, useId } from \"react\";\nimport {\n ComboBox as AriaCombobox,\n ComboBoxProps as AriaComboboxProps,\n Button,\n Header,\n Input,\n ListBox,\n ListBoxItem,\n ListBoxItemProps,\n ListBoxSection,\n Popover,\n PopoverProps,\n} from \"react-aria-components\";\nimport reactNodeToString from \"react-node-to-string\";\nimport \"./combobox.pcss\";\n\ninterface ComboboxBaseProps<T extends object>\n extends Omit<\n AriaComboboxProps<T>,\n \"children\" | \"menuTrigger\" | \"aria-label\" | \"aria-labelledby\"\n > {\n children: React.ReactNode | ((item: T) => React.ReactNode);\n className?: string;\n errorText?: ReactNode;\n helpText?: ReactNode;\n menuTrigger?: \"focus\" | \"manual\" | \"input\";\n popoverProps?: PopoverProps;\n}\n\nexport type ComboboxProps<T extends object> = ComboboxBaseProps<T> &\n (\n | {\n label: NonNullable<ReactNode>;\n \"aria-labelledby\"?: never;\n }\n | {\n label?: never;\n \"aria-labelledby\": string;\n }\n );\n\nexport function Combobox<T extends object>({\n children,\n className,\n errorText,\n helpText,\n label,\n \"aria-labelledby\": ariaLabelledBy,\n menuTrigger = \"focus\",\n popoverProps,\n ...props\n}: ComboboxProps<T>) {\n const id = useId();\n const errorTextId = `${id}-error-text`;\n const helpTextId = `${id}-help-text`;\n\n const ariaDescribedBy =\n [errorText && errorTextId, helpText && helpTextId]\n .filter(Boolean)\n .join(\" \") || undefined;\n\n return (\n <FormField\n className={clsx(\n \"sds-combobox\",\n errorText && \"sds-combobox--invalid\",\n className,\n )}\n label={label}\n errorText={errorText}\n errorTextId={errorTextId}\n helpText={helpText}\n helpTextId={helpTextId}\n htmlFor={id}\n >\n <AriaCombobox\n menuTrigger={menuTrigger}\n id={id}\n aria-label={reactNodeToString(label)}\n aria-labelledby={ariaLabelledBy}\n {...props}\n >\n <div className=\"sds-combobox__combobox\">\n <Input\n className=\"sds-combobox__combobox-input\"\n aria-describedby={ariaDescribedBy}\n aria-invalid={Boolean(errorText)}\n aria-errormessage={errorText ? errorTextId : undefined}\n />\n <Button className=\"sds-combobox__combobox-button\">\n <ExpandShowAltIcon />\n </Button>\n </div>\n <Popover className=\"sds-combobox__popover\" {...popoverProps}>\n <ListBox className=\"sds-combobox__listbox\">{children}</ListBox>\n </Popover>\n </AriaCombobox>\n </FormField>\n );\n}\n\nexport function ComboboxItem({\n className,\n ...props\n}: ListBoxItemProps & { className?: string }) {\n return (\n <ListBoxItem className={clsx(\"sds-combobox__item\", className)} {...props} />\n );\n}\n\nexport function ComboboxHeader({ children }: { children: ReactNode }) {\n return <Header className=\"sds-combobox__header\">{children}</Header>;\n}\n\nexport function ComboboxSection({ children }: { children: ReactNode }) {\n return <ListBoxSection>{children}</ListBoxSection>;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sikt/sds-combobox",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"homepage": "https://designsystem.sikt.no/",
|
|
6
6
|
"repository": {
|
|
@@ -35,9 +35,10 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@sikt/sds-core": "^4.6.0",
|
|
38
|
-
"@sikt/sds-form": "^4.0.
|
|
38
|
+
"@sikt/sds-form": "^4.0.1",
|
|
39
39
|
"@sikt/sds-icons": "^3.0.0",
|
|
40
|
-
"react-aria-components": "^1.
|
|
40
|
+
"react-aria-components": "^1.10.1",
|
|
41
|
+
"react-node-to-string": "^0.1.2"
|
|
41
42
|
},
|
|
42
43
|
"peerDependencies": {
|
|
43
44
|
"@types/react": "^18.0.0 || ^19.0.0",
|