@fremtind/jokul 0.31.1 → 0.31.2

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 (54) hide show
  1. package/build/build-stats.html +1 -1
  2. package/build/cjs/components/autosuggest/BaseAutosuggest.cjs +1 -1
  3. package/build/cjs/components/autosuggest/BaseAutosuggest.cjs.map +1 -1
  4. package/build/cjs/components/autosuggest/Menu.cjs +1 -1
  5. package/build/cjs/components/autosuggest/Menu.cjs.map +1 -1
  6. package/build/cjs/components/file-input/File.cjs +1 -1
  7. package/build/cjs/components/file-input/File.cjs.map +1 -1
  8. package/build/cjs/components/file-input/FileInput.cjs +1 -1
  9. package/build/cjs/components/file-input/FileInput.cjs.map +1 -1
  10. package/build/cjs/components/file-input/internal/Dropzone.cjs +1 -1
  11. package/build/cjs/components/file-input/internal/Dropzone.cjs.map +1 -1
  12. package/build/cjs/components/file-input/internal/Thumbnail.cjs +1 -1
  13. package/build/cjs/components/file-input/internal/Thumbnail.cjs.map +1 -1
  14. package/build/es/components/autosuggest/BaseAutosuggest.js +1 -1
  15. package/build/es/components/autosuggest/BaseAutosuggest.js.map +1 -1
  16. package/build/es/components/autosuggest/Menu.js +1 -1
  17. package/build/es/components/autosuggest/Menu.js.map +1 -1
  18. package/build/es/components/file-input/File.js +1 -1
  19. package/build/es/components/file-input/File.js.map +1 -1
  20. package/build/es/components/file-input/FileInput.js +1 -1
  21. package/build/es/components/file-input/FileInput.js.map +1 -1
  22. package/build/es/components/file-input/internal/Dropzone.js +1 -1
  23. package/build/es/components/file-input/internal/Dropzone.js.map +1 -1
  24. package/build/es/components/file-input/internal/Thumbnail.js +1 -1
  25. package/build/es/components/file-input/internal/Thumbnail.js.map +1 -1
  26. package/package.json +2 -2
  27. package/styles/components/button/button.css +2 -2
  28. package/styles/components/button/button.min.css +1 -1
  29. package/styles/components/checkbox/checkbox.css +4 -4
  30. package/styles/components/checkbox/checkbox.min.css +1 -1
  31. package/styles/components/feedback/feedback.css +2 -2
  32. package/styles/components/feedback/feedback.min.css +1 -1
  33. package/styles/components/input-group/input-group.css +2 -2
  34. package/styles/components/input-group/input-group.min.css +1 -1
  35. package/styles/components/input-panel/checkbox-panel.css +2 -2
  36. package/styles/components/input-panel/checkbox-panel.min.css +1 -1
  37. package/styles/components/input-panel/radio-panel.css +2 -2
  38. package/styles/components/input-panel/radio-panel.min.css +1 -1
  39. package/styles/components/loader/loader.css +6 -6
  40. package/styles/components/loader/loader.min.css +1 -1
  41. package/styles/components/loader/skeleton-loader.css +5 -5
  42. package/styles/components/loader/skeleton-loader.min.css +1 -1
  43. package/styles/components/message/message.css +2 -2
  44. package/styles/components/message/message.min.css +1 -1
  45. package/styles/components/progress-bar/progress-bar.css +2 -2
  46. package/styles/components/progress-bar/progress-bar.min.css +1 -1
  47. package/styles/components/radio-button/radio-button.css +2 -2
  48. package/styles/components/radio-button/radio-button.min.css +1 -1
  49. package/styles/components/system-message/system-message.css +2 -2
  50. package/styles/components/system-message/system-message.min.css +1 -1
  51. package/styles/components/toast/toast.css +4 -4
  52. package/styles/components/toast/toast.min.css +1 -1
  53. package/styles/styles.css +37 -37
  54. package/styles/styles.min.css +1 -1
@@ -1,2 +1,2 @@
1
- "use strict";const e=require("react/jsx-runtime"),t=require("classnames"),s=require("downshift"),r=require("../../hooks/useId/useId.cjs"),o=require("../input-group/InputGroup.cjs"),l=require("./ControllerButton.cjs"),i=require("./Menu.cjs");module.exports=function({className:n="",label:a,labelProps:p,tooltipProps:u,supportLabelProps:d,inputId:c,labelId:g,leadText:m,errorLabel:j,helpLabel:h,density:x,variant:b="small",noHitsMessage:I,maxNumberOfHits:P,placeholder:f,itemToString:k,items:S,downshiftProps:q,showDropdownControllerButton:w=!1,onConfirm:L=(()=>{}),noHits:N}){const H=r.useId(c||"jkl-text-input",{generateSuffix:!c}),y=r.useId(g||"jkl-label",{generateSuffix:!g}),M={inputId:H,labelId:y};return e.jsx(s,{...q,...M,itemToString:k,children:({getInputProps:s,getToggleButtonProps:r,getItemProps:c,getLabelProps:g,getMenuProps:q,getRootProps:H,selectedItem:M,isOpen:T,highlightedIndex:v,clearSelection:C})=>e.jsx(o.InputGroup,{...H(),label:a,className:t("jkl-autosuggest",n),density:x,labelProps:{variant:b,...p,...g({id:y})},supportLabelProps:d,tooltipProps:u,errorLabel:j,helpLabel:h,render:o=>e.jsxs(e.Fragment,{children:[m&&e.jsx("p",{className:t("jkl-spacing-l--bottom",{"jkl-body":"compact"!==x,"jkl-small":"compact"===x}),children:m}),e.jsxs("div",{className:"jkl-text-input-wrapper","data-invalid":!!j,children:[e.jsx("input",{...o,...s({id:o.id,placeholder:f,className:"jkl-text-input__input",onKeyDown:e=>{13===e.keyCode&&!T&&L()}}),"data-testid":"autosuggest__input"}),w&&e.jsx(l,{...r(),hasSelectedItem:!!M,clearSelection:C}),T&&e.jsx(i,{downshiftProps:{getMenuProps:q,getItemProps:c},highlightedIndex:v,items:S,itemToString:k,noHitsMessage:I,maxNumberOfHits:P,noHits:N})]})]})})})};
1
+ "use strict";const e=require("react/jsx-runtime"),t=require("../../../clsx-E3yX_9sL.cjs"),s=require("downshift"),r=require("../../hooks/useId/useId.cjs"),o=require("../input-group/InputGroup.cjs"),l=require("./ControllerButton.cjs"),i=require("./Menu.cjs");module.exports=function({className:n="",label:a,labelProps:p,tooltipProps:u,supportLabelProps:d,inputId:c,labelId:g,leadText:m,errorLabel:x,helpLabel:j,density:h,variant:b="small",noHitsMessage:I,maxNumberOfHits:P,placeholder:f,itemToString:k,items:S,downshiftProps:q,showDropdownControllerButton:w=!1,onConfirm:L=(()=>{}),noHits:N}){const H=r.useId(c||"jkl-text-input",{generateSuffix:!c}),y=r.useId(g||"jkl-label",{generateSuffix:!g}),M={inputId:H,labelId:y};return e.jsx(s,{...q,...M,itemToString:k,children:({getInputProps:s,getToggleButtonProps:r,getItemProps:c,getLabelProps:g,getMenuProps:q,getRootProps:H,selectedItem:M,isOpen:T,highlightedIndex:v,clearSelection:C})=>e.jsx(o.InputGroup,{...H(),label:a,className:t.clsx("jkl-autosuggest",n),density:h,labelProps:{variant:b,...p,...g({id:y})},supportLabelProps:d,tooltipProps:u,errorLabel:x,helpLabel:j,render:o=>e.jsxs(e.Fragment,{children:[m&&e.jsx("p",{className:t.clsx("jkl-spacing-l--bottom",{"jkl-body":"compact"!==h,"jkl-small":"compact"===h}),children:m}),e.jsxs("div",{className:"jkl-text-input-wrapper","data-invalid":!!x,children:[e.jsx("input",{...o,...s({id:o.id,placeholder:f,className:"jkl-text-input__input",onKeyDown:e=>{13===e.keyCode&&!T&&L()}}),"data-testid":"autosuggest__input"}),w&&e.jsx(l,{...r(),hasSelectedItem:!!M,clearSelection:C}),T&&e.jsx(i,{downshiftProps:{getMenuProps:q,getItemProps:c},highlightedIndex:v,items:S,itemToString:k,noHitsMessage:I,maxNumberOfHits:P,noHits:N})]})]})})})};
2
2
  //# sourceMappingURL=BaseAutosuggest.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"BaseAutosuggest.cjs","sources":["../../../../src/components/autosuggest/BaseAutosuggest.tsx"],"sourcesContent":["import cn from \"classnames\";\nimport {\n Callback,\n default as Downshift,\n type DownshiftProps,\n PropGetters,\n} from \"downshift\";\nimport React, { type ReactNode } from \"react\";\nimport { useId } from \"../../hooks/useId/useId.js\";\nimport { InputGroup } from \"../input-group/InputGroup.js\";\nimport { type CommonProps } from \"./Autosuggest.js\";\nimport ControllerButton from \"./ControllerButton.js\";\nimport Menu from \"./Menu.js\";\n\nconst KEY_ENTER = 13;\n\ntype BaseAutosuggestProps<T> = CommonProps & {\n itemToString: (item: T | null) => string;\n items: T[];\n downshiftProps: DownshiftProps<T>;\n showDropdownControllerButton?: boolean;\n onConfirm?: () => void;\n noHits?: { text: ReactNode; items: T[] };\n};\ninterface Props extends PropGetters<any>, DownshiftProps<any> {\n clearSelection: (cb?: Callback) => void;\n}\n\nfunction BaseAutosuggest<T>({\n className = \"\",\n label,\n labelProps,\n tooltipProps,\n supportLabelProps,\n inputId,\n labelId,\n leadText,\n errorLabel,\n helpLabel,\n density,\n variant = \"small\",\n noHitsMessage,\n maxNumberOfHits,\n placeholder,\n itemToString,\n items,\n downshiftProps,\n showDropdownControllerButton = false,\n onConfirm = () => {\n /* noop */\n },\n noHits,\n}: BaseAutosuggestProps<T>): JSX.Element {\n const uid = useId(inputId || \"jkl-text-input\", {\n generateSuffix: !inputId,\n });\n const lid = useId(labelId || \"jkl-label\", { generateSuffix: !labelId });\n\n const customLabelProps = {\n inputId: uid,\n labelId: lid,\n };\n\n return (\n /* @ts-ignore-next-line det er noe rart og ancient med downshift */\n <Downshift\n {...downshiftProps}\n {...customLabelProps}\n itemToString={itemToString}\n >\n {({\n getInputProps,\n getToggleButtonProps,\n getItemProps,\n getLabelProps,\n getMenuProps,\n getRootProps,\n selectedItem,\n isOpen,\n highlightedIndex,\n clearSelection,\n }: Props) => {\n return (\n <InputGroup\n {...getRootProps()}\n label={label}\n className={cn(\"jkl-autosuggest\", className)}\n density={density}\n labelProps={{\n variant,\n ...labelProps,\n ...getLabelProps({\n id: lid,\n }),\n }}\n supportLabelProps={supportLabelProps}\n tooltipProps={tooltipProps}\n errorLabel={errorLabel}\n helpLabel={helpLabel}\n render={(inputProps) => (\n <>\n {leadText && (\n <p\n className={cn(\"jkl-spacing-l--bottom\", {\n \"jkl-body\": density !== \"compact\",\n \"jkl-small\": density === \"compact\",\n })}\n >\n {leadText}\n </p>\n )}\n <div\n className=\"jkl-text-input-wrapper\"\n data-invalid={!!errorLabel}\n >\n <input\n {...inputProps}\n {...getInputProps({\n id: inputProps.id,\n placeholder,\n className: \"jkl-text-input__input\",\n onKeyDown: (e) => {\n if (\n e.keyCode === KEY_ENTER &&\n !isOpen\n ) {\n onConfirm();\n }\n },\n })}\n data-testid=\"autosuggest__input\"\n />\n {showDropdownControllerButton && (\n <ControllerButton\n {...getToggleButtonProps()}\n hasSelectedItem={!!selectedItem}\n clearSelection={clearSelection}\n />\n )}\n {isOpen && (\n <Menu\n downshiftProps={{\n getMenuProps,\n getItemProps,\n }}\n highlightedIndex={highlightedIndex}\n items={items}\n itemToString={itemToString}\n noHitsMessage={noHitsMessage}\n maxNumberOfHits={maxNumberOfHits}\n noHits={noHits}\n />\n )}\n </div>\n </>\n )}\n />\n );\n }}\n </Downshift>\n );\n}\n\nexport default BaseAutosuggest;\n"],"names":["className","label","labelProps","tooltipProps","supportLabelProps","inputId","labelId","leadText","errorLabel","helpLabel","density","variant","noHitsMessage","maxNumberOfHits","placeholder","itemToString","items","downshiftProps","showDropdownControllerButton","onConfirm","noHits","uid","useId","generateSuffix","lid","customLabelProps","jsx","Downshift","children","getInputProps","getToggleButtonProps","getItemProps","getLabelProps","getMenuProps","getRootProps","selectedItem","isOpen","highlightedIndex","clearSelection","InputGroup","cn","id","render","inputProps","jsxs","Fragment","onKeyDown","e","keyCode","ControllerButton","hasSelectedItem","Menu"],"mappings":"gQA4BA,UACIA,UAAAA,EAAY,GACZC,MAAAA,EACAC,WAAAA,EACAC,aAAAA,EACAC,kBAAAA,EACAC,QAAAA,EACAC,QAAAA,EACAC,SAAAA,EACAC,WAAAA,EACAC,UAAAA,EACAC,QAAAA,EACAC,QAAAA,EAAU,QACVC,cAAAA,EACAC,gBAAAA,EACAC,YAAAA,EACAC,aAAAA,EACAC,MAAAA,EACAC,eAAAA,EACAC,6BAAAA,GAA+B,EAC/BC,UAAAA,EAAY,SAGZC,OAAAA,IAEM,MAAAC,EAAMC,EAAAA,MAAMjB,GAAW,iBAAkB,CAC3CkB,gBAAiBlB,IAEfmB,EAAMF,QAAMhB,GAAW,YAAa,CAAEiB,gBAAiBjB,IAEvDmB,EAAmB,CACrBpB,QAASgB,EACTf,QAASkB,GAGb,OAEIE,EAAAA,IAACC,EAAA,IACOV,KACAQ,EACJV,aAAAA,EAECa,SAAC,EACEC,cAAAA,EACAC,qBAAAA,EACAC,aAAAA,EACAC,cAAAA,EACAC,aAAAA,EACAC,aAAAA,EACAC,aAAAA,EACAC,OAAAA,EACAC,iBAAAA,EACAC,eAAAA,KAGIZ,EAAAA,IAACa,EAAAA,WAAA,IACOL,IACJjC,MAAAA,EACAD,UAAWwC,EAAG,kBAAmBxC,GACjCU,QAAAA,EACAR,WAAY,CACRS,QAAAA,KACGT,KACA8B,EAAc,CACbS,GAAIjB,KAGZpB,kBAAAA,EACAD,aAAAA,EACAK,WAAAA,EACAC,UAAAA,EACAiC,OAASC,GAEAC,EAAAA,KAAAC,EAAAA,SAAA,CAAAjB,SAAA,CACGrB,GAAAmB,EAAAA,IAAC,IAAA,CACG1B,UAAWwC,EAAG,wBAAyB,CACnC,WAAwB,YAAZ9B,EACZ,YAAyB,YAAZA,IAGhBkB,SAAArB,IAGTqC,EAAAA,KAAC,MAAA,CACG5C,UAAU,yBACV,iBAAgBQ,EAEhBoB,SAAA,CAAAF,EAAAA,IAAC,QAAA,IACOiB,KACAd,EAAc,CACdY,GAAIE,EAAWF,GACf3B,YAAAA,EACAd,UAAW,wBACX8C,UAAYC,IA3GtC,KA6GkCA,EAAEC,UACDZ,GAESjB,OAItB,cAAY,uBAEfD,GACGQ,EAAAA,IAACuB,EAAA,IACOnB,IACJoB,kBAAmBf,EACnBG,eAAAA,IAGPF,GACGV,EAAAA,IAACyB,EAAA,CACGlC,eAAgB,CACZgB,aAAAA,EACAF,aAAAA,GAEJM,iBAAAA,EACArB,MAAAA,EACAD,aAAAA,EACAH,cAAAA,EACAC,gBAAAA,EACAO,OAAAA,aAW5C"}
1
+ {"version":3,"file":"BaseAutosuggest.cjs","sources":["../../../../src/components/autosuggest/BaseAutosuggest.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport {\n Callback,\n default as Downshift,\n type DownshiftProps,\n PropGetters,\n} from \"downshift\";\nimport React, { type ReactNode } from \"react\";\nimport { useId } from \"../../hooks/useId/useId.js\";\nimport { InputGroup } from \"../input-group/InputGroup.js\";\nimport { type CommonProps } from \"./Autosuggest.js\";\nimport ControllerButton from \"./ControllerButton.js\";\nimport Menu from \"./Menu.js\";\n\nconst KEY_ENTER = 13;\n\ntype BaseAutosuggestProps<T> = CommonProps & {\n itemToString: (item: T | null) => string;\n items: T[];\n downshiftProps: DownshiftProps<T>;\n showDropdownControllerButton?: boolean;\n onConfirm?: () => void;\n noHits?: { text: ReactNode; items: T[] };\n};\ninterface Props extends PropGetters<any>, DownshiftProps<any> {\n clearSelection: (cb?: Callback) => void;\n}\n\nfunction BaseAutosuggest<T>({\n className = \"\",\n label,\n labelProps,\n tooltipProps,\n supportLabelProps,\n inputId,\n labelId,\n leadText,\n errorLabel,\n helpLabel,\n density,\n variant = \"small\",\n noHitsMessage,\n maxNumberOfHits,\n placeholder,\n itemToString,\n items,\n downshiftProps,\n showDropdownControllerButton = false,\n onConfirm = () => {\n /* noop */\n },\n noHits,\n}: BaseAutosuggestProps<T>): JSX.Element {\n const uid = useId(inputId || \"jkl-text-input\", {\n generateSuffix: !inputId,\n });\n const lid = useId(labelId || \"jkl-label\", { generateSuffix: !labelId });\n\n const customLabelProps = {\n inputId: uid,\n labelId: lid,\n };\n\n return (\n /* @ts-ignore-next-line det er noe rart og ancient med downshift */\n <Downshift\n {...downshiftProps}\n {...customLabelProps}\n itemToString={itemToString}\n >\n {({\n getInputProps,\n getToggleButtonProps,\n getItemProps,\n getLabelProps,\n getMenuProps,\n getRootProps,\n selectedItem,\n isOpen,\n highlightedIndex,\n clearSelection,\n }: Props) => {\n return (\n <InputGroup\n {...getRootProps()}\n label={label}\n className={clsx(\"jkl-autosuggest\", className)}\n density={density}\n labelProps={{\n variant,\n ...labelProps,\n ...getLabelProps({\n id: lid,\n }),\n }}\n supportLabelProps={supportLabelProps}\n tooltipProps={tooltipProps}\n errorLabel={errorLabel}\n helpLabel={helpLabel}\n render={(inputProps) => (\n <>\n {leadText && (\n <p\n className={clsx(\n \"jkl-spacing-l--bottom\",\n {\n \"jkl-body\":\n density !== \"compact\",\n \"jkl-small\":\n density === \"compact\",\n },\n )}\n >\n {leadText}\n </p>\n )}\n <div\n className=\"jkl-text-input-wrapper\"\n data-invalid={!!errorLabel}\n >\n <input\n {...inputProps}\n {...getInputProps({\n id: inputProps.id,\n placeholder,\n className: \"jkl-text-input__input\",\n onKeyDown: (e) => {\n if (\n e.keyCode === KEY_ENTER &&\n !isOpen\n ) {\n onConfirm();\n }\n },\n })}\n data-testid=\"autosuggest__input\"\n />\n {showDropdownControllerButton && (\n <ControllerButton\n {...getToggleButtonProps()}\n hasSelectedItem={!!selectedItem}\n clearSelection={clearSelection}\n />\n )}\n {isOpen && (\n <Menu\n downshiftProps={{\n getMenuProps,\n getItemProps,\n }}\n highlightedIndex={highlightedIndex}\n items={items}\n itemToString={itemToString}\n noHitsMessage={noHitsMessage}\n maxNumberOfHits={maxNumberOfHits}\n noHits={noHits}\n />\n )}\n </div>\n </>\n )}\n />\n );\n }}\n </Downshift>\n );\n}\n\nexport default BaseAutosuggest;\n"],"names":["className","label","labelProps","tooltipProps","supportLabelProps","inputId","labelId","leadText","errorLabel","helpLabel","density","variant","noHitsMessage","maxNumberOfHits","placeholder","itemToString","items","downshiftProps","showDropdownControllerButton","onConfirm","noHits","uid","useId","generateSuffix","lid","customLabelProps","jsx","Downshift","children","getInputProps","getToggleButtonProps","getItemProps","getLabelProps","getMenuProps","getRootProps","selectedItem","isOpen","highlightedIndex","clearSelection","InputGroup","clsx","id","render","inputProps","jsxs","Fragment","onKeyDown","e","keyCode","ControllerButton","hasSelectedItem","Menu"],"mappings":"gRA4BA,UACIA,UAAAA,EAAY,GACZC,MAAAA,EACAC,WAAAA,EACAC,aAAAA,EACAC,kBAAAA,EACAC,QAAAA,EACAC,QAAAA,EACAC,SAAAA,EACAC,WAAAA,EACAC,UAAAA,EACAC,QAAAA,EACAC,QAAAA,EAAU,QACVC,cAAAA,EACAC,gBAAAA,EACAC,YAAAA,EACAC,aAAAA,EACAC,MAAAA,EACAC,eAAAA,EACAC,6BAAAA,GAA+B,EAC/BC,UAAAA,EAAY,SAGZC,OAAAA,IAEM,MAAAC,EAAMC,EAAAA,MAAMjB,GAAW,iBAAkB,CAC3CkB,gBAAiBlB,IAEfmB,EAAMF,QAAMhB,GAAW,YAAa,CAAEiB,gBAAiBjB,IAEvDmB,EAAmB,CACrBpB,QAASgB,EACTf,QAASkB,GAGb,OAEIE,EAAAA,IAACC,EAAA,IACOV,KACAQ,EACJV,aAAAA,EAECa,SAAC,EACEC,cAAAA,EACAC,qBAAAA,EACAC,aAAAA,EACAC,cAAAA,EACAC,aAAAA,EACAC,aAAAA,EACAC,aAAAA,EACAC,OAAAA,EACAC,iBAAAA,EACAC,eAAAA,KAGIZ,EAAAA,IAACa,EAAAA,WAAA,IACOL,IACJjC,MAAAA,EACAD,UAAWwC,EAAAA,KAAK,kBAAmBxC,GACnCU,QAAAA,EACAR,WAAY,CACRS,QAAAA,KACGT,KACA8B,EAAc,CACbS,GAAIjB,KAGZpB,kBAAAA,EACAD,aAAAA,EACAK,WAAAA,EACAC,UAAAA,EACAiC,OAASC,GAEAC,EAAAA,KAAAC,EAAAA,SAAA,CAAAjB,SAAA,CACGrB,GAAAmB,EAAAA,IAAC,IAAA,CACG1B,UAAWwC,EAAAA,KACP,wBACA,CACI,WACgB,YAAZ9B,EACJ,YACgB,YAAZA,IAIXkB,SAAArB,IAGTqC,EAAAA,KAAC,MAAA,CACG5C,UAAU,yBACV,iBAAgBQ,EAEhBoB,SAAA,CAAAF,EAAAA,IAAC,QAAA,IACOiB,KACAd,EAAc,CACdY,GAAIE,EAAWF,GACf3B,YAAAA,EACAd,UAAW,wBACX8C,UAAYC,IAhHtC,KAkHkCA,EAAEC,UACDZ,GAESjB,OAItB,cAAY,uBAEfD,GACGQ,EAAAA,IAACuB,EAAA,IACOnB,IACJoB,kBAAmBf,EACnBG,eAAAA,IAGPF,GACGV,EAAAA,IAACyB,EAAA,CACGlC,eAAgB,CACZgB,aAAAA,EACAF,aAAAA,GAEJM,iBAAAA,EACArB,MAAAA,EACAD,aAAAA,EACAH,cAAAA,EACAC,gBAAAA,EACAO,OAAAA,aAW5C"}
@@ -1,2 +1,2 @@
1
- "use strict";const e=require("react/jsx-runtime"),t=require("react"),s=require("classnames");module.exports=function({downshiftProps:{getMenuProps:i,getItemProps:a},highlightedIndex:l,items:u,itemToString:n,noHitsMessage:g,maxNumberOfHits:r=1/0,noHits:m}){const o=u.length>r?u.slice(0,r):u;if(0===o.length&&!g&&!m)return null;const c=0===o.length&&m?m.items:o;return e.jsxs("div",{"data-testid":"autosuggest__menu",className:"jkl-autosuggest__menu",children:[(g||m)&&0===o.length&&e.jsx("div",{className:"jkl-autosuggest__no-hits-message","aria-live":"polite",children:g||(null==m?void 0:m.text)}),c.length>0&&e.jsx("ul",{...i({className:"jkl-autosuggest__item-list"}),children:c.map(((e,i)=>t.createElement("li",{...a({item:e,className:s("jkl-autosuggest__item",{"jkl-autosuggest__item--active":i===l})}),"data-testid":"autosuggest__item",key:n(e)},n(e))))})]})};
1
+ "use strict";const e=require("react/jsx-runtime"),t=require("react"),s=require("../../../clsx-E3yX_9sL.cjs");module.exports=function({downshiftProps:{getMenuProps:i,getItemProps:l},highlightedIndex:u,items:a,itemToString:n,noHitsMessage:g,maxNumberOfHits:r=1/0,noHits:o}){const m=a.length>r?a.slice(0,r):a;if(0===m.length&&!g&&!o)return null;const c=0===m.length&&o?o.items:m;return e.jsxs("div",{"data-testid":"autosuggest__menu",className:"jkl-autosuggest__menu",children:[(g||o)&&0===m.length&&e.jsx("div",{className:"jkl-autosuggest__no-hits-message","aria-live":"polite",children:g||(null==o?void 0:o.text)}),c.length>0&&e.jsx("ul",{...i({className:"jkl-autosuggest__item-list"}),children:c.map(((e,i)=>t.createElement("li",{...l({item:e,className:s.clsx("jkl-autosuggest__item",{"jkl-autosuggest__item--active":i===u})}),"data-testid":"autosuggest__item",key:n(e)},n(e))))})]})};
2
2
  //# sourceMappingURL=Menu.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Menu.cjs","sources":["../../../../src/components/autosuggest/Menu.tsx"],"sourcesContent":["import cn from \"classnames\";\nimport { PropGetters } from \"downshift\";\nimport React, { ReactNode } from \"react\";\n\ninterface MenuProps<T> {\n downshiftProps: Pick<PropGetters<T>, \"getMenuProps\" | \"getItemProps\">;\n highlightedIndex: number | undefined | null;\n items: T[];\n itemToString: (item: T | null) => string;\n noHitsMessage?: ReactNode;\n maxNumberOfHits?: number;\n noHits?: { items: T[]; text: ReactNode };\n}\n\nfunction Menu<T>({\n downshiftProps: { getMenuProps, getItemProps },\n highlightedIndex,\n items,\n itemToString,\n noHitsMessage,\n maxNumberOfHits = Infinity,\n noHits,\n}: MenuProps<T>): JSX.Element | null {\n const visibleItems =\n items.length > maxNumberOfHits\n ? items.slice(0, maxNumberOfHits)\n : items;\n\n if (visibleItems.length === 0 && !noHitsMessage && !noHits) {\n return null;\n }\n\n const itemList =\n visibleItems.length === 0 && noHits ? noHits.items : visibleItems;\n\n return (\n <div data-testid=\"autosuggest__menu\" className=\"jkl-autosuggest__menu\">\n {(noHitsMessage || noHits) && visibleItems.length === 0 && (\n <div\n className=\"jkl-autosuggest__no-hits-message\"\n aria-live=\"polite\"\n >\n {noHitsMessage || noHits?.text}\n </div>\n )}\n\n {itemList.length > 0 && (\n <ul\n {...getMenuProps({\n className: \"jkl-autosuggest__item-list\",\n })}\n >\n {itemList.map((item, index) => (\n <li\n {...getItemProps({\n item,\n className: cn(\"jkl-autosuggest__item\", {\n \"jkl-autosuggest__item--active\":\n index === highlightedIndex,\n }),\n })}\n data-testid=\"autosuggest__item\"\n key={itemToString(item)}\n >\n {itemToString(item)}\n </li>\n ))}\n </ul>\n )}\n </div>\n );\n}\n\nexport default Menu;\n"],"names":["downshiftProps","getMenuProps","getItemProps","highlightedIndex","items","itemToString","noHitsMessage","maxNumberOfHits","noHits","visibleItems","length","slice","itemList","jsxs","className","children","jsx","text","map","item","index","createElement","cn","key"],"mappings":"4GAcA,UACIA,gBAAkBC,aAAAA,EAAcC,aAAAA,GAChCC,iBAAAA,EACAC,MAAAA,EACAC,aAAAA,EACAC,cAAAA,EACAC,gBAAAA,EAAkB,IAClBC,OAAAA,IAEM,MAAAC,EACFL,EAAMM,OAASH,EACTH,EAAMO,MAAM,EAAGJ,GACfH,EAEV,GAA4B,IAAxBK,EAAaC,SAAiBJ,IAAkBE,EACzC,OAAA,KAGX,MAAMI,EACsB,IAAxBH,EAAaC,QAAgBF,EAASA,EAAOJ,MAAQK,EAEzD,OACKI,EAAAA,KAAA,MAAA,CAAI,cAAY,oBAAoBC,UAAU,wBACzCC,SAAA,EAAiBT,GAAAE,IAAmC,IAAxBC,EAAaC,QACvCM,EAAAA,IAAC,MAAA,CACGF,UAAU,mCACV,YAAU,SAETC,aAAiB,MAAAP,OAAAA,EAAAA,EAAQS,QAIjCL,EAASF,OAAS,GACfM,EAAAA,IAAC,KAAA,IACOf,EAAa,CACba,UAAW,+BAGdC,SAASH,EAAAM,KAAI,CAACC,EAAMC,IACjBC,EAAAA,cAAC,KAAA,IACOnB,EAAa,CACbiB,KAAAA,EACAL,UAAWQ,EAAG,wBAAyB,CACnC,gCACIF,IAAUjB,MAGtB,cAAY,oBACZoB,IAAKlB,EAAac,IAEjBd,EAAac,UAO1C"}
1
+ {"version":3,"file":"Menu.cjs","sources":["../../../../src/components/autosuggest/Menu.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { PropGetters } from \"downshift\";\nimport React, { ReactNode } from \"react\";\n\ninterface MenuProps<T> {\n downshiftProps: Pick<PropGetters<T>, \"getMenuProps\" | \"getItemProps\">;\n highlightedIndex: number | undefined | null;\n items: T[];\n itemToString: (item: T | null) => string;\n noHitsMessage?: ReactNode;\n maxNumberOfHits?: number;\n noHits?: { items: T[]; text: ReactNode };\n}\n\nfunction Menu<T>({\n downshiftProps: { getMenuProps, getItemProps },\n highlightedIndex,\n items,\n itemToString,\n noHitsMessage,\n maxNumberOfHits = Infinity,\n noHits,\n}: MenuProps<T>): JSX.Element | null {\n const visibleItems =\n items.length > maxNumberOfHits\n ? items.slice(0, maxNumberOfHits)\n : items;\n\n if (visibleItems.length === 0 && !noHitsMessage && !noHits) {\n return null;\n }\n\n const itemList =\n visibleItems.length === 0 && noHits ? noHits.items : visibleItems;\n\n return (\n <div data-testid=\"autosuggest__menu\" className=\"jkl-autosuggest__menu\">\n {(noHitsMessage || noHits) && visibleItems.length === 0 && (\n <div\n className=\"jkl-autosuggest__no-hits-message\"\n aria-live=\"polite\"\n >\n {noHitsMessage || noHits?.text}\n </div>\n )}\n\n {itemList.length > 0 && (\n <ul\n {...getMenuProps({\n className: \"jkl-autosuggest__item-list\",\n })}\n >\n {itemList.map((item, index) => (\n <li\n {...getItemProps({\n item,\n className: clsx(\"jkl-autosuggest__item\", {\n \"jkl-autosuggest__item--active\":\n index === highlightedIndex,\n }),\n })}\n data-testid=\"autosuggest__item\"\n key={itemToString(item)}\n >\n {itemToString(item)}\n </li>\n ))}\n </ul>\n )}\n </div>\n );\n}\n\nexport default Menu;\n"],"names":["downshiftProps","getMenuProps","getItemProps","highlightedIndex","items","itemToString","noHitsMessage","maxNumberOfHits","noHits","visibleItems","length","slice","itemList","jsxs","className","children","jsx","text","map","item","index","createElement","clsx","key"],"mappings":"4HAcA,UACIA,gBAAkBC,aAAAA,EAAcC,aAAAA,GAChCC,iBAAAA,EACAC,MAAAA,EACAC,aAAAA,EACAC,cAAAA,EACAC,gBAAAA,EAAkB,IAClBC,OAAAA,IAEM,MAAAC,EACFL,EAAMM,OAASH,EACTH,EAAMO,MAAM,EAAGJ,GACfH,EAEV,GAA4B,IAAxBK,EAAaC,SAAiBJ,IAAkBE,EACzC,OAAA,KAGX,MAAMI,EACsB,IAAxBH,EAAaC,QAAgBF,EAASA,EAAOJ,MAAQK,EAEzD,OACKI,EAAAA,KAAA,MAAA,CAAI,cAAY,oBAAoBC,UAAU,wBACzCC,SAAA,EAAiBT,GAAAE,IAAmC,IAAxBC,EAAaC,QACvCM,EAAAA,IAAC,MAAA,CACGF,UAAU,mCACV,YAAU,SAETC,aAAiB,MAAAP,OAAAA,EAAAA,EAAQS,QAIjCL,EAASF,OAAS,GACfM,EAAAA,IAAC,KAAA,IACOf,EAAa,CACba,UAAW,+BAGdC,SAASH,EAAAM,KAAI,CAACC,EAAMC,IACjBC,EAAAA,cAAC,KAAA,IACOnB,EAAa,CACbiB,KAAAA,EACAL,UAAWQ,OAAK,wBAAyB,CACrC,gCACIF,IAAUjB,MAGtB,cAAY,oBACZoB,IAAKlB,EAAac,IAEjBd,EAAac,UAO1C"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("classnames");require("../icon/Icon.cjs"),require("../icon/icons/animated/ArrowVerticalAnimated.cjs"),require("../icon/icons/animated/ArrowHorizontalAnimated.cjs"),require("../icon/icons/animated/PlusRemoveAnimated.cjs"),require("../icon/icons/ArrowDownIcon.cjs"),require("../icon/icons/ArrowLeftIcon.cjs"),require("../icon/icons/ArrowNorthEastIcon.cjs"),require("../icon/icons/ArrowRightIcon.cjs"),require("../icon/icons/ArrowUpIcon.cjs"),require("../icon/icons/CalendarIcon.cjs"),require("../icon/icons/CheckIcon.cjs"),require("../icon/icons/ChevronDownIcon.cjs"),require("../icon/icons/ChevronLeftIcon.cjs"),require("../icon/icons/ChevronRightIcon.cjs"),require("../icon/icons/ChevronUpIcon.cjs"),require("../icon/icons/CloseIcon.cjs"),require("../icon/icons/CopyIcon.cjs"),require("../icon/icons/DotsIcon.cjs"),require("../icon/icons/DragIcon.cjs"),require("../icon/icons/ErrorIcon.cjs"),require("../icon/icons/GreenCheckIcon.cjs"),require("../icon/icons/HamburgerIcon.cjs"),require("../icon/icons/InfoIcon.cjs"),require("../icon/icons/LinkIcon.cjs"),require("../icon/icons/PlusIcon.cjs"),require("../icon/icons/QuestionIcon.cjs"),require("../icon/icons/RedCrossIcon.cjs"),require("../icon/icons/SearchIcon.cjs");const c=require("../icon/icons/SuccessIcon.cjs");require("../icon/icons/WarningIcon.cjs"),require("../icon/icons/MinusIcon.cjs"),require("../icon/icons/ThumbDownIcon.cjs"),require("../icon/icons/ThumbUpIcon.cjs");const n=require("../icon/icons/TrashCanIcon.cjs");require("../icon/icons/PenIcon.cjs");const o=require("../icon-button/IconButton.cjs"),r=require("../input-group/SupportLabel.cjs"),s=require("../../hooks/useId/useId.cjs"),l=require("../../utilities/formatters/bytes/formatBytes.cjs"),t=require("./internal/fileInputContext.cjs"),u=require("./internal/Thumbnail.cjs");exports.File=a=>{const{children:j,fileName:q,fileType:I,fileSize:p,path:d,file:h,supportLabel:m,supportLabelType:f,state:b,onRemove:x}=a,k=s.useId("jkl-file-preview"),_=k+"-support",C=t.useFileInputContext(),w=d?"a":"div",v="error"===f||"warning"===f,g="success"===f,y=e.jsxs("div",{id:k,className:"jkl-file",children:[e.jsxs(w,{className:i("jkl-file__content",{"jkl-file__content--error":"error"===f,"jkl-file__content--warning":"warning"===f}),href:d,target:d?"_blank":void 0,children:[e.jsx(u.Thumbnail,{fileName:q,fileType:I,file:h,path:d,state:b,children:j}),e.jsxs("div",{children:[e.jsx("p",{className:"jkl-file__name",children:q}),e.jsxs("p",{className:"jkl-file__description",children:[e.jsx("span",{children:l.formatBytes(p)}),v||g?g?e.jsx(c.SuccessIcon,{variant:"small","aria-label":"Filen ble lastet opp uten feil"}):null:e.jsx(r.SupportLabel,{className:"jkl-file__support-label jkl-body",id:_,label:m,labelType:f})]}),m&&v&&e.jsx(r.SupportLabel,{className:"jkl-file__support-label",id:_,label:m,labelType:f})]})]}),x&&e.jsx(o.IconButton,{className:"jkl-file__delete",onClick:x,title:`Fjern ${q}`,children:e.jsx(n.TrashCanIcon,{})})]});return C?e.jsx("li",{children:y}):y};
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("../../../clsx-E3yX_9sL.cjs");require("../icon/Icon.cjs"),require("../icon/icons/animated/ArrowVerticalAnimated.cjs"),require("../icon/icons/animated/ArrowHorizontalAnimated.cjs"),require("../icon/icons/animated/PlusRemoveAnimated.cjs"),require("../icon/icons/ArrowDownIcon.cjs"),require("../icon/icons/ArrowLeftIcon.cjs"),require("../icon/icons/ArrowNorthEastIcon.cjs"),require("../icon/icons/ArrowRightIcon.cjs"),require("../icon/icons/ArrowUpIcon.cjs"),require("../icon/icons/CalendarIcon.cjs"),require("../icon/icons/CheckIcon.cjs"),require("../icon/icons/ChevronDownIcon.cjs"),require("../icon/icons/ChevronLeftIcon.cjs"),require("../icon/icons/ChevronRightIcon.cjs"),require("../icon/icons/ChevronUpIcon.cjs"),require("../icon/icons/CloseIcon.cjs"),require("../icon/icons/CopyIcon.cjs"),require("../icon/icons/DotsIcon.cjs"),require("../icon/icons/DragIcon.cjs"),require("../icon/icons/ErrorIcon.cjs"),require("../icon/icons/GreenCheckIcon.cjs"),require("../icon/icons/HamburgerIcon.cjs"),require("../icon/icons/InfoIcon.cjs"),require("../icon/icons/LinkIcon.cjs"),require("../icon/icons/PlusIcon.cjs"),require("../icon/icons/QuestionIcon.cjs"),require("../icon/icons/RedCrossIcon.cjs"),require("../icon/icons/SearchIcon.cjs");const i=require("../icon/icons/SuccessIcon.cjs");require("../icon/icons/WarningIcon.cjs"),require("../icon/icons/MinusIcon.cjs"),require("../icon/icons/ThumbDownIcon.cjs"),require("../icon/icons/ThumbUpIcon.cjs");const n=require("../icon/icons/TrashCanIcon.cjs");require("../icon/icons/PenIcon.cjs");const o=require("../icon-button/IconButton.cjs"),r=require("../input-group/SupportLabel.cjs"),s=require("../../hooks/useId/useId.cjs"),l=require("../../utilities/formatters/bytes/formatBytes.cjs"),t=require("./internal/fileInputContext.cjs"),u=require("./internal/Thumbnail.cjs");exports.File=a=>{const{children:j,fileName:q,fileType:I,fileSize:p,path:d,file:h,supportLabel:m,supportLabelType:f,state:b,onRemove:x}=a,k=s.useId("jkl-file-preview"),_=k+"-support",C=t.useFileInputContext(),w=d?"a":"div",v="error"===f||"warning"===f,g="success"===f,y=e.jsxs("div",{id:k,className:"jkl-file",children:[e.jsxs(w,{className:c.clsx("jkl-file__content",{"jkl-file__content--error":"error"===f,"jkl-file__content--warning":"warning"===f}),href:d,target:d?"_blank":void 0,children:[e.jsx(u.Thumbnail,{fileName:q,fileType:I,file:h,path:d,state:b,children:j}),e.jsxs("div",{children:[e.jsx("p",{className:"jkl-file__name",children:q}),e.jsxs("p",{className:"jkl-file__description",children:[e.jsx("span",{children:l.formatBytes(p)}),v||g?g?e.jsx(i.SuccessIcon,{variant:"small","aria-label":"Filen ble lastet opp uten feil"}):null:e.jsx(r.SupportLabel,{className:"jkl-file__support-label jkl-body",id:_,label:m,labelType:f})]}),m&&v&&e.jsx(r.SupportLabel,{className:"jkl-file__support-label",id:_,label:m,labelType:f})]})]}),x&&e.jsx(o.IconButton,{className:"jkl-file__delete",onClick:x,title:`Fjern ${q}`,children:e.jsx(n.TrashCanIcon,{})})]});return C?e.jsx("li",{children:y}):y};
2
2
  //# sourceMappingURL=File.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"File.cjs","sources":["../../../../src/components/file-input/File.tsx"],"sourcesContent":["import cn from \"classnames\";\nimport React, { FC, MouseEvent } from \"react\";\nimport { TrashCanIcon, SuccessIcon } from \"../../components/icon/index.js\";\nimport { IconButton } from \"../../components/icon-button/IconButton.js\";\nimport { SupportLabel } from \"../../components/input-group/SupportLabel.js\";\nimport { type WithOptionalChildren } from \"../../core/types.js\";\nimport { useId } from \"../../hooks/useId/useId.js\";\nimport { formatBytes } from \"../../utilities/formatters/bytes/formatBytes.js\";\nimport { useFileInputContext } from \"./internal/fileInputContext.js\";\nimport { Thumbnail } from \"./internal/Thumbnail.js\";\nimport { FileInputFileState } from \"./types.js\";\n\nexport interface FileProps extends WithOptionalChildren {\n fileName: string;\n fileType: string;\n fileSize: number;\n path?: string;\n file?: File;\n supportLabel?: string;\n supportLabelType?: \"help\" | \"error\" | \"warning\" | \"success\";\n state?: FileInputFileState;\n onRemove?: (e: MouseEvent<HTMLButtonElement>) => void;\n}\n\nexport const File: FC<FileProps> = (props) => {\n const {\n children,\n fileName,\n fileType,\n fileSize,\n path,\n file,\n supportLabel,\n supportLabelType,\n state,\n onRemove,\n } = props;\n\n const id = useId(\"jkl-file-preview\");\n const supportId = id + \"-support\";\n\n const context = useFileInputContext();\n\n const Component = path ? \"a\" : \"div\";\n\n const hasErrorOrWarning =\n supportLabelType === \"error\" || supportLabelType === \"warning\";\n const hasSuccess = supportLabelType === \"success\";\n\n const renderFeedbackElement = () => {\n if (!hasErrorOrWarning && !hasSuccess) {\n return (\n <SupportLabel\n className=\"jkl-file__support-label jkl-body\"\n id={supportId}\n label={supportLabel}\n labelType={supportLabelType}\n />\n );\n }\n\n if (hasSuccess)\n return (\n <SuccessIcon\n variant=\"small\"\n aria-label=\"Filen ble lastet opp uten feil\"\n />\n );\n\n return null;\n };\n\n const fileComponent = (\n <div id={id} className=\"jkl-file\">\n <Component\n className={cn(\"jkl-file__content\", {\n \"jkl-file__content--error\": supportLabelType === \"error\",\n \"jkl-file__content--warning\":\n supportLabelType === \"warning\",\n })}\n href={path}\n target={path ? \"_blank\" : undefined}\n >\n <Thumbnail\n fileName={fileName}\n fileType={fileType}\n file={file}\n path={path}\n state={state}\n >\n {children}\n </Thumbnail>\n <div>\n <p className=\"jkl-file__name\">{fileName}</p>\n <p className=\"jkl-file__description\">\n <span>{formatBytes(fileSize)}</span>\n {renderFeedbackElement()}\n </p>\n {supportLabel && hasErrorOrWarning && (\n <SupportLabel\n className=\"jkl-file__support-label\"\n id={supportId}\n label={supportLabel}\n labelType={supportLabelType}\n />\n )}\n </div>\n </Component>\n {onRemove && (\n <IconButton\n className=\"jkl-file__delete\"\n onClick={onRemove}\n title={`Fjern ${fileName}`}\n >\n <TrashCanIcon />\n </IconButton>\n )}\n </div>\n );\n\n return context ? <li>{fileComponent}</li> : fileComponent;\n};\n"],"names":["props","children","fileName","fileType","fileSize","path","file","supportLabel","supportLabelType","state","onRemove","id","useId","supportId","context","useFileInputContext","Component","hasErrorOrWarning","hasSuccess","fileComponent","jsxs","className","cn","href","target","jsx","Thumbnail","formatBytes","SuccessIcon","variant","SupportLabel","label","labelType","IconButton","onClick","title","TrashCanIcon"],"mappings":"i5DAwBoCA,IAC1B,MACFC,SAAAA,EACAC,SAAAA,EACAC,SAAAA,EACAC,SAAAA,EACAC,KAAAA,EACAC,KAAAA,EACAC,aAAAA,EACAC,iBAAAA,EACAC,MAAAA,EACAC,SAAAA,GACAV,EAEEW,EAAKC,QAAM,oBACXC,EAAYF,EAAK,WAEjBG,EAAUC,EAAAA,sBAEVC,EAAYX,EAAO,IAAM,MAEzBY,EACmB,UAArBT,GAAqD,YAArBA,EAC9BU,EAAkC,YAArBV,EAyBbW,EACFC,EAAAA,KAAC,MAAI,CAAAT,GAAAA,EAAQU,UAAU,WACnBpB,SAAA,CAAAmB,EAAAA,KAACJ,EAAA,CACGK,UAAWC,EAAG,oBAAqB,CAC/B,2BAAiD,UAArBd,EAC5B,6BACyB,YAArBA,IAERe,KAAMlB,EACNmB,OAAQnB,EAAO,cAAW,EAE1BJ,SAAA,CAAAwB,EAAAA,IAACC,EAAAA,UAAA,CACGxB,SAAAA,EACAC,SAAAA,EACAG,KAAAA,EACAD,KAAAA,EACAI,MAAAA,EAECR,SAAAA,WAEJ,MACG,CAAAA,SAAA,CAACwB,EAAAA,IAAA,IAAA,CAAEJ,UAAU,iBAAkBpB,SAASC,IACxCkB,EAAAA,KAAC,IAAE,CAAAC,UAAU,wBACTpB,SAAA,CAACwB,EAAAA,IAAA,OAAA,CAAMxB,SAAY0B,EAAAA,YAAAvB,KA7C9Ba,GAAsBC,EAWvBA,EAEIO,EAAAA,IAACG,EAAAA,YAAA,CACGC,QAAQ,QACR,aAAW,mCAIhB,KAjBCJ,EAAAA,IAACK,EAAAA,aAAA,CACGT,UAAU,mCACVV,GAAIE,EACJkB,MAAOxB,EACPyB,UAAWxB,OA0CVD,GAAgBU,GACbQ,EAAAA,IAACK,EAAAA,aAAA,CACGT,UAAU,0BACVV,GAAIE,EACJkB,MAAOxB,EACPyB,UAAWxB,UAK1BE,GACGe,EAAAA,IAACQ,EAAAA,WAAA,CACGZ,UAAU,mBACVa,QAASxB,EACTyB,MAAO,SAASjC,IAEhBD,eAACmC,EAAaA,aAAA,SAM9B,OAAOtB,EAAUW,EAAAA,IAAC,KAAI,CAAAxB,SAAAkB,IAAsBA"}
1
+ {"version":3,"file":"File.cjs","sources":["../../../../src/components/file-input/File.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { FC, MouseEvent } from \"react\";\nimport { TrashCanIcon, SuccessIcon } from \"../../components/icon/index.js\";\nimport { IconButton } from \"../../components/icon-button/IconButton.js\";\nimport { SupportLabel } from \"../../components/input-group/SupportLabel.js\";\nimport { type WithOptionalChildren } from \"../../core/types.js\";\nimport { useId } from \"../../hooks/useId/useId.js\";\nimport { formatBytes } from \"../../utilities/formatters/bytes/formatBytes.js\";\nimport { useFileInputContext } from \"./internal/fileInputContext.js\";\nimport { Thumbnail } from \"./internal/Thumbnail.js\";\nimport { FileInputFileState } from \"./types.js\";\n\nexport interface FileProps extends WithOptionalChildren {\n fileName: string;\n fileType: string;\n fileSize: number;\n path?: string;\n file?: File;\n supportLabel?: string;\n supportLabelType?: \"help\" | \"error\" | \"warning\" | \"success\";\n state?: FileInputFileState;\n onRemove?: (e: MouseEvent<HTMLButtonElement>) => void;\n}\n\nexport const File: FC<FileProps> = (props) => {\n const {\n children,\n fileName,\n fileType,\n fileSize,\n path,\n file,\n supportLabel,\n supportLabelType,\n state,\n onRemove,\n } = props;\n\n const id = useId(\"jkl-file-preview\");\n const supportId = id + \"-support\";\n\n const context = useFileInputContext();\n\n const Component = path ? \"a\" : \"div\";\n\n const hasErrorOrWarning =\n supportLabelType === \"error\" || supportLabelType === \"warning\";\n const hasSuccess = supportLabelType === \"success\";\n\n const renderFeedbackElement = () => {\n if (!hasErrorOrWarning && !hasSuccess) {\n return (\n <SupportLabel\n className=\"jkl-file__support-label jkl-body\"\n id={supportId}\n label={supportLabel}\n labelType={supportLabelType}\n />\n );\n }\n\n if (hasSuccess)\n return (\n <SuccessIcon\n variant=\"small\"\n aria-label=\"Filen ble lastet opp uten feil\"\n />\n );\n\n return null;\n };\n\n const fileComponent = (\n <div id={id} className=\"jkl-file\">\n <Component\n className={clsx(\"jkl-file__content\", {\n \"jkl-file__content--error\": supportLabelType === \"error\",\n \"jkl-file__content--warning\":\n supportLabelType === \"warning\",\n })}\n href={path}\n target={path ? \"_blank\" : undefined}\n >\n <Thumbnail\n fileName={fileName}\n fileType={fileType}\n file={file}\n path={path}\n state={state}\n >\n {children}\n </Thumbnail>\n <div>\n <p className=\"jkl-file__name\">{fileName}</p>\n <p className=\"jkl-file__description\">\n <span>{formatBytes(fileSize)}</span>\n {renderFeedbackElement()}\n </p>\n {supportLabel && hasErrorOrWarning && (\n <SupportLabel\n className=\"jkl-file__support-label\"\n id={supportId}\n label={supportLabel}\n labelType={supportLabelType}\n />\n )}\n </div>\n </Component>\n {onRemove && (\n <IconButton\n className=\"jkl-file__delete\"\n onClick={onRemove}\n title={`Fjern ${fileName}`}\n >\n <TrashCanIcon />\n </IconButton>\n )}\n </div>\n );\n\n return context ? <li>{fileComponent}</li> : fileComponent;\n};\n"],"names":["props","children","fileName","fileType","fileSize","path","file","supportLabel","supportLabelType","state","onRemove","id","useId","supportId","context","useFileInputContext","Component","hasErrorOrWarning","hasSuccess","fileComponent","jsxs","className","clsx","href","target","jsx","Thumbnail","formatBytes","SuccessIcon","variant","SupportLabel","label","labelType","IconButton","onClick","title","TrashCanIcon"],"mappings":"i6DAwBoCA,IAC1B,MACFC,SAAAA,EACAC,SAAAA,EACAC,SAAAA,EACAC,SAAAA,EACAC,KAAAA,EACAC,KAAAA,EACAC,aAAAA,EACAC,iBAAAA,EACAC,MAAAA,EACAC,SAAAA,GACAV,EAEEW,EAAKC,QAAM,oBACXC,EAAYF,EAAK,WAEjBG,EAAUC,EAAAA,sBAEVC,EAAYX,EAAO,IAAM,MAEzBY,EACmB,UAArBT,GAAqD,YAArBA,EAC9BU,EAAkC,YAArBV,EAyBbW,EACFC,EAAAA,KAAC,MAAI,CAAAT,GAAAA,EAAQU,UAAU,WACnBpB,SAAA,CAAAmB,EAAAA,KAACJ,EAAA,CACGK,UAAWC,OAAK,oBAAqB,CACjC,2BAAiD,UAArBd,EAC5B,6BACyB,YAArBA,IAERe,KAAMlB,EACNmB,OAAQnB,EAAO,cAAW,EAE1BJ,SAAA,CAAAwB,EAAAA,IAACC,EAAAA,UAAA,CACGxB,SAAAA,EACAC,SAAAA,EACAG,KAAAA,EACAD,KAAAA,EACAI,MAAAA,EAECR,SAAAA,WAEJ,MACG,CAAAA,SAAA,CAACwB,EAAAA,IAAA,IAAA,CAAEJ,UAAU,iBAAkBpB,SAASC,IACxCkB,EAAAA,KAAC,IAAE,CAAAC,UAAU,wBACTpB,SAAA,CAACwB,EAAAA,IAAA,OAAA,CAAMxB,SAAY0B,EAAAA,YAAAvB,KA7C9Ba,GAAsBC,EAWvBA,EAEIO,EAAAA,IAACG,EAAAA,YAAA,CACGC,QAAQ,QACR,aAAW,mCAIhB,KAjBCJ,EAAAA,IAACK,EAAAA,aAAA,CACGT,UAAU,mCACVV,GAAIE,EACJkB,MAAOxB,EACPyB,UAAWxB,OA0CVD,GAAgBU,GACbQ,EAAAA,IAACK,EAAAA,aAAA,CACGT,UAAU,0BACVV,GAAIE,EACJkB,MAAOxB,EACPyB,UAAWxB,UAK1BE,GACGe,EAAAA,IAACQ,EAAAA,WAAA,CACGZ,UAAU,mBACVa,QAASxB,EACTyB,MAAO,SAASjC,IAEhBD,eAACmC,EAAaA,aAAA,SAM9B,OAAOtB,EAAUW,EAAAA,IAAC,KAAI,CAAAxB,SAAAkB,IAAsBA"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("classnames"),i=require("react"),t=require("../input-group/FieldGroup.cjs"),n=require("./internal/Dropzone.cjs"),s=require("./internal/fileInputContext.cjs"),r=require("./internal/Input.cjs"),a=i.forwardRef(((i,a)=>{const{accept:c,className:u,children:o,id:p,value:d,density:j,multiple:f=!0,maxSizeBytes:x,onChange:m,variant:h,...g}=i,y=d.length>0;return"small"===h?e.jsx(s.FileInputContextProvider,{context:{accept:c,onChange:m,maxSizeBytes:x,files:d},children:e.jsxs(t.FieldGroup,{className:l("jkl-file-input","jkl-file-input--small",u,{"jkl-file-input--has-files":y}),"data-layout-density":j||"compact",...g,children:[e.jsx(n.Dropzone,{children:e.jsx("div",{className:"jkl-file-input__call-to-action",children:e.jsx(r.Input,{id:p,label:"Legg til fil",multiple:f,ref:a})})}),d.length>0&&e.jsx("ul",{className:"jkl-file-input__files",children:o})]})}):e.jsx(s.FileInputContextProvider,{context:{accept:c,onChange:m,maxSizeBytes:x,files:d},children:e.jsx(t.FieldGroup,{className:l("jkl-file-input",u,{"jkl-file-input--has-files":y}),"data-layout-density":j,...g,children:e.jsxs(n.Dropzone,{children:[d.length>0&&e.jsx("ul",{className:"jkl-file-input__files",children:o}),e.jsx("div",{className:"jkl-file-input__call-to-action",children:e.jsx(r.Input,{id:p,label:f&&y?"Legg til flere filer":"Legg til fil",multiple:f,ref:a})})]})})})}));a.displayName="FileInput",exports.FileInput=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("../../../clsx-E3yX_9sL.cjs"),i=require("react"),t=require("../input-group/FieldGroup.cjs"),n=require("./internal/Dropzone.cjs"),s=require("./internal/fileInputContext.cjs"),r=require("./internal/Input.cjs"),a=i.forwardRef(((i,a)=>{const{accept:c,className:u,children:o,id:p,value:d,density:j,multiple:x=!0,maxSizeBytes:f,onChange:h,variant:m,...g}=i,y=d.length>0;return"small"===m?e.jsx(s.FileInputContextProvider,{context:{accept:c,onChange:h,maxSizeBytes:f,files:d},children:e.jsxs(t.FieldGroup,{className:l.clsx("jkl-file-input","jkl-file-input--small",u,{"jkl-file-input--has-files":y}),"data-layout-density":j||"compact",...g,children:[e.jsx(n.Dropzone,{children:e.jsx("div",{className:"jkl-file-input__call-to-action",children:e.jsx(r.Input,{id:p,label:"Legg til fil",multiple:x,ref:a})})}),d.length>0&&e.jsx("ul",{className:"jkl-file-input__files",children:o})]})}):e.jsx(s.FileInputContextProvider,{context:{accept:c,onChange:h,maxSizeBytes:f,files:d},children:e.jsx(t.FieldGroup,{className:l.clsx("jkl-file-input",u,{"jkl-file-input--has-files":y}),"data-layout-density":j,...g,children:e.jsxs(n.Dropzone,{children:[d.length>0&&e.jsx("ul",{className:"jkl-file-input__files",children:o}),e.jsx("div",{className:"jkl-file-input__call-to-action",children:e.jsx(r.Input,{id:p,label:x&&y?"Legg til flere filer":"Legg til fil",multiple:x,ref:a})})]})})})}));a.displayName="FileInput",exports.FileInput=a;
2
2
  //# sourceMappingURL=FileInput.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"FileInput.cjs","sources":["../../../../src/components/file-input/FileInput.tsx"],"sourcesContent":["import cn from \"classnames\";\nimport React, { forwardRef } from \"react\";\nimport {\n FieldGroup,\n type FieldGroupProps,\n} from \"../../components/input-group/FieldGroup.js\";\nimport { type Density } from \"../../core/types.js\";\nimport { Dropzone } from \"./internal/Dropzone.js\";\nimport { FileInputContextProvider } from \"./internal/fileInputContext.js\";\nimport { Input } from \"./internal/Input.js\";\nimport { FileInputFile } from \"./types.js\";\n\nexport interface FileInputProps extends Omit<FieldGroupProps, \"onChange\"> {\n className?: string;\n id?: string;\n density?: Density;\n /**\n * En string som begrenser hvilke filtyper som kan velges.\n *\n * Flere filtyper kan defineres som en kommaseparert liste.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept\n */\n accept?: \"image/*\" | \".pdf\" | \"image/*,.pdf\" | HTMLInputElement[\"accept\"];\n maxSizeBytes?: number;\n /**\n * @default true\n */\n multiple?: boolean;\n value: FileInputFile[];\n variant?: \"flexible\" | \"small\";\n onChange: (\n e:\n | React.ChangeEvent<HTMLInputElement>\n | React.DragEvent<HTMLDivElement>,\n files: FileInputFile[],\n ) => void;\n}\n\nexport const FileInput = forwardRef<HTMLInputElement, FileInputProps>(\n (props, ref) => {\n const {\n accept,\n className,\n children,\n id,\n value,\n density,\n multiple = true,\n maxSizeBytes,\n onChange,\n variant,\n ...rest\n } = props;\n\n const hasFiles = value.length > 0;\n\n if (variant === \"small\") {\n return (\n <FileInputContextProvider\n context={{ accept, onChange, maxSizeBytes, files: value }}\n >\n <FieldGroup\n className={cn(\n \"jkl-file-input\",\n \"jkl-file-input--small\",\n className,\n {\n \"jkl-file-input--has-files\": hasFiles,\n },\n )}\n data-layout-density={density ? density : \"compact\"}\n {...rest}\n >\n <Dropzone>\n <div className=\"jkl-file-input__call-to-action\">\n <Input\n id={id}\n label=\"Legg til fil\"\n multiple={multiple}\n ref={ref}\n />\n </div>\n </Dropzone>\n {value.length > 0 && (\n <ul className=\"jkl-file-input__files\">\n {children}\n </ul>\n )}\n </FieldGroup>\n </FileInputContextProvider>\n );\n }\n\n return (\n <FileInputContextProvider\n context={{ accept, onChange, maxSizeBytes, files: value }}\n >\n <FieldGroup\n className={cn(\"jkl-file-input\", className, {\n \"jkl-file-input--has-files\": hasFiles,\n })}\n data-layout-density={density}\n {...rest}\n >\n <Dropzone>\n {value.length > 0 && (\n <ul className=\"jkl-file-input__files\">\n {children}\n </ul>\n )}\n <div className=\"jkl-file-input__call-to-action\">\n <Input\n id={id}\n label={\n multiple && hasFiles\n ? \"Legg til flere filer\"\n : \"Legg til fil\"\n }\n multiple={multiple}\n ref={ref}\n />\n </div>\n </Dropzone>\n </FieldGroup>\n </FileInputContextProvider>\n );\n },\n);\n\nFileInput.displayName = \"FileInput\";\n"],"names":["FileInput","forwardRef","props","ref","accept","className","children","id","value","density","multiple","maxSizeBytes","onChange","variant","rest","hasFiles","length","jsx","FileInputContextProvider","context","files","jsxs","FieldGroup","cn","Dropzone","Input","label","displayName"],"mappings":"+TAuCaA,EAAYC,EAAAA,YACrB,CAACC,EAAOC,KACE,MACFC,OAAAA,EACAC,UAAAA,EACAC,SAAAA,EACAC,GAAAA,EACAC,MAAAA,EACAC,QAAAA,EACAC,SAAAA,GAAW,EACXC,aAAAA,EACAC,SAAAA,EACAC,QAAAA,KACGC,GACHZ,EAEEa,EAAWP,EAAMQ,OAAS,EAEhC,MAAgB,UAAZH,EAEII,EAAAA,IAACC,EAAAA,yBAAA,CACGC,QAAS,CAAEf,OAAAA,EAAQQ,SAAAA,EAAUD,aAAAA,EAAcS,MAAOZ,GAElDF,SAAAe,EAAAA,KAACC,EAAAA,WAAA,CACGjB,UAAWkB,EACP,iBACA,wBACAlB,EACA,CACI,4BAA6BU,IAGrC,sBAAqBN,GAAoB,aACrCK,EAEJR,SAAA,CAAAW,MAACO,EAAAA,SACG,CAAAlB,SAAAW,EAAAA,IAAC,MAAI,CAAAZ,UAAU,iCACXC,SAAAW,EAAAA,IAACQ,EAAAA,MAAA,CACGlB,GAAAA,EACAmB,MAAM,eACNhB,SAAAA,EACAP,IAAAA,QAIXK,EAAMQ,OAAS,SACX,KAAG,CAAAX,UAAU,wBACTC,SAAAA,SASrBW,EAAAA,IAACC,EAAAA,yBAAA,CACGC,QAAS,CAAEf,OAAAA,EAAQQ,SAAAA,EAAUD,aAAAA,EAAcS,MAAOZ,GAElDF,SAAAW,EAAAA,IAACK,EAAAA,WAAA,CACGjB,UAAWkB,EAAG,iBAAkBlB,EAAW,CACvC,4BAA6BU,IAEjC,sBAAqBN,KACjBK,EAEJR,gBAACkB,WACI,CAAAlB,SAAA,CAAAE,EAAMQ,OAAS,GACZC,EAAAA,IAAC,KAAG,CAAAZ,UAAU,wBACTC,SAAAA,IAGTW,EAAAA,IAAC,MAAI,CAAAZ,UAAU,iCACXC,SAAAW,EAAAA,IAACQ,EAAAA,MAAA,CACGlB,GAAAA,EACAmB,MACIhB,GAAYK,EACN,uBACA,eAEVL,SAAAA,EACAP,IAAAA,YAIhB,IAMhBH,EAAU2B,YAAc"}
1
+ {"version":3,"file":"FileInput.cjs","sources":["../../../../src/components/file-input/FileInput.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { forwardRef } from \"react\";\nimport {\n FieldGroup,\n type FieldGroupProps,\n} from \"../../components/input-group/FieldGroup.js\";\nimport { type Density } from \"../../core/types.js\";\nimport { Dropzone } from \"./internal/Dropzone.js\";\nimport { FileInputContextProvider } from \"./internal/fileInputContext.js\";\nimport { Input } from \"./internal/Input.js\";\nimport { FileInputFile } from \"./types.js\";\n\nexport interface FileInputProps extends Omit<FieldGroupProps, \"onChange\"> {\n className?: string;\n id?: string;\n density?: Density;\n /**\n * En string som begrenser hvilke filtyper som kan velges.\n *\n * Flere filtyper kan defineres som en kommaseparert liste.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept\n */\n accept?: \"image/*\" | \".pdf\" | \"image/*,.pdf\" | HTMLInputElement[\"accept\"];\n maxSizeBytes?: number;\n /**\n * @default true\n */\n multiple?: boolean;\n value: FileInputFile[];\n variant?: \"flexible\" | \"small\";\n onChange: (\n e:\n | React.ChangeEvent<HTMLInputElement>\n | React.DragEvent<HTMLDivElement>,\n files: FileInputFile[],\n ) => void;\n}\n\nexport const FileInput = forwardRef<HTMLInputElement, FileInputProps>(\n (props, ref) => {\n const {\n accept,\n className,\n children,\n id,\n value,\n density,\n multiple = true,\n maxSizeBytes,\n onChange,\n variant,\n ...rest\n } = props;\n\n const hasFiles = value.length > 0;\n\n if (variant === \"small\") {\n return (\n <FileInputContextProvider\n context={{ accept, onChange, maxSizeBytes, files: value }}\n >\n <FieldGroup\n className={clsx(\n \"jkl-file-input\",\n \"jkl-file-input--small\",\n className,\n {\n \"jkl-file-input--has-files\": hasFiles,\n },\n )}\n data-layout-density={density ? density : \"compact\"}\n {...rest}\n >\n <Dropzone>\n <div className=\"jkl-file-input__call-to-action\">\n <Input\n id={id}\n label=\"Legg til fil\"\n multiple={multiple}\n ref={ref}\n />\n </div>\n </Dropzone>\n {value.length > 0 && (\n <ul className=\"jkl-file-input__files\">\n {children}\n </ul>\n )}\n </FieldGroup>\n </FileInputContextProvider>\n );\n }\n\n return (\n <FileInputContextProvider\n context={{ accept, onChange, maxSizeBytes, files: value }}\n >\n <FieldGroup\n className={clsx(\"jkl-file-input\", className, {\n \"jkl-file-input--has-files\": hasFiles,\n })}\n data-layout-density={density}\n {...rest}\n >\n <Dropzone>\n {value.length > 0 && (\n <ul className=\"jkl-file-input__files\">\n {children}\n </ul>\n )}\n <div className=\"jkl-file-input__call-to-action\">\n <Input\n id={id}\n label={\n multiple && hasFiles\n ? \"Legg til flere filer\"\n : \"Legg til fil\"\n }\n multiple={multiple}\n ref={ref}\n />\n </div>\n </Dropzone>\n </FieldGroup>\n </FileInputContextProvider>\n );\n },\n);\n\nFileInput.displayName = \"FileInput\";\n"],"names":["FileInput","forwardRef","props","ref","accept","className","children","id","value","density","multiple","maxSizeBytes","onChange","variant","rest","hasFiles","length","jsx","FileInputContextProvider","context","files","jsxs","FieldGroup","clsx","Dropzone","Input","label","displayName"],"mappings":"+UAuCaA,EAAYC,EAAAA,YACrB,CAACC,EAAOC,KACE,MACFC,OAAAA,EACAC,UAAAA,EACAC,SAAAA,EACAC,GAAAA,EACAC,MAAAA,EACAC,QAAAA,EACAC,SAAAA,GAAW,EACXC,aAAAA,EACAC,SAAAA,EACAC,QAAAA,KACGC,GACHZ,EAEEa,EAAWP,EAAMQ,OAAS,EAEhC,MAAgB,UAAZH,EAEII,EAAAA,IAACC,EAAAA,yBAAA,CACGC,QAAS,CAAEf,OAAAA,EAAQQ,SAAAA,EAAUD,aAAAA,EAAcS,MAAOZ,GAElDF,SAAAe,EAAAA,KAACC,EAAAA,WAAA,CACGjB,UAAWkB,EAAAA,KACP,iBACA,wBACAlB,EACA,CACI,4BAA6BU,IAGrC,sBAAqBN,GAAoB,aACrCK,EAEJR,SAAA,CAAAW,MAACO,EAAAA,SACG,CAAAlB,SAAAW,EAAAA,IAAC,MAAI,CAAAZ,UAAU,iCACXC,SAAAW,EAAAA,IAACQ,EAAAA,MAAA,CACGlB,GAAAA,EACAmB,MAAM,eACNhB,SAAAA,EACAP,IAAAA,QAIXK,EAAMQ,OAAS,SACX,KAAG,CAAAX,UAAU,wBACTC,SAAAA,SASrBW,EAAAA,IAACC,EAAAA,yBAAA,CACGC,QAAS,CAAEf,OAAAA,EAAQQ,SAAAA,EAAUD,aAAAA,EAAcS,MAAOZ,GAElDF,SAAAW,EAAAA,IAACK,EAAAA,WAAA,CACGjB,UAAWkB,EAAAA,KAAK,iBAAkBlB,EAAW,CACzC,4BAA6BU,IAEjC,sBAAqBN,KACjBK,EAEJR,gBAACkB,WACI,CAAAlB,SAAA,CAAAE,EAAMQ,OAAS,GACZC,EAAAA,IAAC,KAAG,CAAAZ,UAAU,wBACTC,SAAAA,IAGTW,EAAAA,IAAC,MAAI,CAAAZ,UAAU,iCACXC,SAAAW,EAAAA,IAACQ,EAAAA,MAAA,CACGlB,GAAAA,EACAmB,MACIhB,GAAYK,EACN,uBACA,eAEVL,SAAAA,EACAP,IAAAA,YAIhB,IAMhBH,EAAU2B,YAAc"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("classnames"),t=require("react"),n=require("./fileInputContext.cjs"),a=require("./validateFile.cjs"),i=t.forwardRef(((i,o)=>{const{children:l,...s}=i,[p,u]=t.useState(""),d=n.useFileInputContext();if(!d)return e.jsx("p",{children:"Dropzone must be placed inside a FileInputContextProvider."});const{maxSizeBytes:f,accept:c,onChange:v}=d;return e.jsx("div",{...s,ref:o,className:r("jkl-file-input__dropzone",p),onDragEnter:e=>{u("jkl-file-input__dropzone--enter"),e.preventDefault()},onDragOver:e=>{u("jkl-file-input__dropzone--enter"),e.preventDefault()},onDrop:e=>{e.preventDefault(),u(""),e.dataTransfer.files&&v(e,[...e.dataTransfer.files].map((e=>({file:e,state:"SELECTED",validation:a.validateFile(e,c,f),uploadProgress:0}))))},onDragLeave:e=>{u(""),e.preventDefault()},children:l})}));i.displayName="Dropzone",exports.Dropzone=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("../../../../clsx-E3yX_9sL.cjs"),t=require("react"),n=require("./fileInputContext.cjs"),a=require("./validateFile.cjs"),i=t.forwardRef(((i,o)=>{const{children:l,...s}=i,[p,u]=t.useState(""),d=n.useFileInputContext();if(!d)return e.jsx("p",{children:"Dropzone must be placed inside a FileInputContextProvider."});const{maxSizeBytes:c,accept:f,onChange:v}=d;return e.jsx("div",{...s,ref:o,className:r.clsx("jkl-file-input__dropzone",p),onDragEnter:e=>{u("jkl-file-input__dropzone--enter"),e.preventDefault()},onDragOver:e=>{u("jkl-file-input__dropzone--enter"),e.preventDefault()},onDrop:e=>{e.preventDefault(),u(""),e.dataTransfer.files&&v(e,[...e.dataTransfer.files].map((e=>({file:e,state:"SELECTED",validation:a.validateFile(e,f,c),uploadProgress:0}))))},onDragLeave:e=>{u(""),e.preventDefault()},children:l})}));i.displayName="Dropzone",exports.Dropzone=i;
2
2
  //# sourceMappingURL=Dropzone.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Dropzone.cjs","sources":["../../../../../src/components/file-input/internal/Dropzone.tsx"],"sourcesContent":["import cn from \"classnames\";\nimport React, { forwardRef, useState } from \"react\";\nimport { WithChildren } from \"../../../core/types.js\";\nimport { FileInputFile } from \"../types.js\";\nimport { useFileInputContext } from \"./fileInputContext.js\";\nimport { validateFile } from \"./validateFile.js\";\n\ninterface DropzoneProps extends WithChildren {}\n\nexport const Dropzone = forwardRef<HTMLDivElement, DropzoneProps>(\n (props, ref) => {\n const { children, ...rest } = props;\n const [onDragClassName, setOnDragClassName] = useState<string>(\"\");\n\n const context = useFileInputContext();\n if (!context) {\n return (\n <p>\n Dropzone must be placed inside a FileInputContextProvider.\n </p>\n );\n }\n const { maxSizeBytes, accept, onChange } = context;\n\n return (\n <div\n {...rest}\n ref={ref}\n className={cn(\"jkl-file-input__dropzone\", onDragClassName)}\n onDragEnter={(e) => {\n setOnDragClassName(\"jkl-file-input__dropzone--enter\");\n e.preventDefault();\n }}\n onDragOver={(e) => {\n /* Prevent browser from opening file in a new tab */\n setOnDragClassName(\"jkl-file-input__dropzone--enter\");\n e.preventDefault();\n }}\n onDrop={(e) => {\n e.preventDefault();\n setOnDragClassName(\"\");\n\n if (e.dataTransfer.files) {\n onChange(\n e,\n [...e.dataTransfer.files].map<FileInputFile>(\n (file) => ({\n file,\n state: \"SELECTED\",\n validation: validateFile(\n file,\n accept,\n maxSizeBytes,\n ),\n uploadProgress: 0,\n }),\n ),\n );\n }\n }}\n onDragLeave={(e) => {\n setOnDragClassName(\"\");\n e.preventDefault();\n }}\n >\n {children}\n </div>\n );\n },\n);\n\nDropzone.displayName = \"Dropzone\";\n"],"names":["Dropzone","forwardRef","props","ref","children","rest","onDragClassName","setOnDragClassName","useState","context","useFileInputContext","jsx","maxSizeBytes","accept","onChange","className","cn","onDragEnter","e","preventDefault","onDragOver","onDrop","dataTransfer","files","map","file","state","validation","validateFile","uploadProgress","onDragLeave","displayName"],"mappings":"oOASaA,EAAWC,EAAAA,YACpB,CAACC,EAAOC,KACJ,MAAQC,SAAAA,KAAaC,GAASH,GACvBI,EAAiBC,GAAsBC,WAAiB,IAEzDC,EAAUC,EAAAA,sBAChB,IAAKD,EAEG,OAAAE,EAAAA,IAAC,KAAEP,SAEH,+DAGR,MAAQQ,aAAAA,EAAcC,OAAAA,EAAQC,SAAAA,GAAaL,EAGvC,OAAAE,EAAAA,IAAC,MAAA,IACON,EACJF,IAAAA,EACAY,UAAWC,EAAG,2BAA4BV,GAC1CW,YAAcC,IACVX,EAAmB,mCACnBW,EAAEC,gBAAe,EAErBC,WAAaF,IAETX,EAAmB,mCACnBW,EAAEC,gBAAe,EAErBE,OAASH,IACLA,EAAEC,iBACFZ,EAAmB,IAEfW,EAAEI,aAAaC,OACfT,EACII,EACA,IAAIA,EAAEI,aAAaC,OAAOC,KACrBC,IAAAA,CACGA,KAAAA,EACAC,MAAO,WACPC,WAAYC,EAAAA,aACRH,EACAZ,EACAD,GAEJiB,eAAgB,MAExB,EAIZC,YAAcZ,IACVX,EAAmB,IACnBW,EAAEC,gBAAe,EAGpBf,SAAAA,GAAA,IAMjBJ,EAAS+B,YAAc"}
1
+ {"version":3,"file":"Dropzone.cjs","sources":["../../../../../src/components/file-input/internal/Dropzone.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { forwardRef, useState } from \"react\";\nimport { WithChildren } from \"../../../core/types.js\";\nimport { FileInputFile } from \"../types.js\";\nimport { useFileInputContext } from \"./fileInputContext.js\";\nimport { validateFile } from \"./validateFile.js\";\n\ninterface DropzoneProps extends WithChildren {}\n\nexport const Dropzone = forwardRef<HTMLDivElement, DropzoneProps>(\n (props, ref) => {\n const { children, ...rest } = props;\n const [onDragClassName, setOnDragClassName] = useState<string>(\"\");\n\n const context = useFileInputContext();\n if (!context) {\n return (\n <p>\n Dropzone must be placed inside a FileInputContextProvider.\n </p>\n );\n }\n const { maxSizeBytes, accept, onChange } = context;\n\n return (\n <div\n {...rest}\n ref={ref}\n className={clsx(\"jkl-file-input__dropzone\", onDragClassName)}\n onDragEnter={(e) => {\n setOnDragClassName(\"jkl-file-input__dropzone--enter\");\n e.preventDefault();\n }}\n onDragOver={(e) => {\n /* Prevent browser from opening file in a new tab */\n setOnDragClassName(\"jkl-file-input__dropzone--enter\");\n e.preventDefault();\n }}\n onDrop={(e) => {\n e.preventDefault();\n setOnDragClassName(\"\");\n\n if (e.dataTransfer.files) {\n onChange(\n e,\n [...e.dataTransfer.files].map<FileInputFile>(\n (file) => ({\n file,\n state: \"SELECTED\",\n validation: validateFile(\n file,\n accept,\n maxSizeBytes,\n ),\n uploadProgress: 0,\n }),\n ),\n );\n }\n }}\n onDragLeave={(e) => {\n setOnDragClassName(\"\");\n e.preventDefault();\n }}\n >\n {children}\n </div>\n );\n },\n);\n\nDropzone.displayName = \"Dropzone\";\n"],"names":["Dropzone","forwardRef","props","ref","children","rest","onDragClassName","setOnDragClassName","useState","context","useFileInputContext","jsx","maxSizeBytes","accept","onChange","className","clsx","onDragEnter","e","preventDefault","onDragOver","onDrop","dataTransfer","files","map","file","state","validation","validateFile","uploadProgress","onDragLeave","displayName"],"mappings":"uPASaA,EAAWC,EAAAA,YACpB,CAACC,EAAOC,KACJ,MAAQC,SAAAA,KAAaC,GAASH,GACvBI,EAAiBC,GAAsBC,WAAiB,IAEzDC,EAAUC,EAAAA,sBAChB,IAAKD,EAEG,OAAAE,EAAAA,IAAC,KAAEP,SAEH,+DAGR,MAAQQ,aAAAA,EAAcC,OAAAA,EAAQC,SAAAA,GAAaL,EAGvC,OAAAE,EAAAA,IAAC,MAAA,IACON,EACJF,IAAAA,EACAY,UAAWC,EAAAA,KAAK,2BAA4BV,GAC5CW,YAAcC,IACVX,EAAmB,mCACnBW,EAAEC,gBAAe,EAErBC,WAAaF,IAETX,EAAmB,mCACnBW,EAAEC,gBAAe,EAErBE,OAASH,IACLA,EAAEC,iBACFZ,EAAmB,IAEfW,EAAEI,aAAaC,OACfT,EACII,EACA,IAAIA,EAAEI,aAAaC,OAAOC,KACrBC,IAAAA,CACGA,KAAAA,EACAC,MAAO,WACPC,WAAYC,EAAAA,aACRH,EACAZ,EACAD,GAEJiB,eAAgB,MAExB,EAIZC,YAAcZ,IACVX,EAAmB,IACnBW,EAAEC,gBAAe,EAGpBf,SAAAA,GAAA,IAMjBJ,EAAS+B,YAAc"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("classnames");exports.Thumbnail=i=>{const{fileName:t,fileType:s,path:a,file:r,state:c,children:n}=i,m=l("jkl-file__thumbnail",{"jkl-file__thumbnail--selected":"SELECTED"===c,"jkl-file__thumbnail--uploading":"UPLOADING"===c});return s.startsWith("image/")?e.jsxs("div",{className:"jkl-file__thumbnail-wrapper",children:[e.jsx("img",{className:m,src:r?URL.createObjectURL(r):a,alt:""}),n]}):e.jsx("div",{className:m,children:e.jsx("p",{children:t.split(".").at(-1)})})};
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("../../../../clsx-E3yX_9sL.cjs");exports.Thumbnail=i=>{const{fileName:t,fileType:s,path:a,file:r,state:c,children:n}=i,m=l.clsx("jkl-file__thumbnail",{"jkl-file__thumbnail--selected":"SELECTED"===c,"jkl-file__thumbnail--uploading":"UPLOADING"===c});return s.startsWith("image/")?e.jsxs("div",{className:"jkl-file__thumbnail-wrapper",children:[e.jsx("img",{className:m,src:r?URL.createObjectURL(r):a,alt:""}),n]}):e.jsx("div",{className:m,children:e.jsx("p",{children:t.split(".").at(-1)})})};
2
2
  //# sourceMappingURL=Thumbnail.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Thumbnail.cjs","sources":["../../../../../src/components/file-input/internal/Thumbnail.tsx"],"sourcesContent":["import cn from \"classnames\";\nimport React, { FC } from \"react\";\nimport type { WithOptionalChildren } from \"../../../core/types.js\";\nimport { FileInputFileState } from \"../types.js\";\n\nexport interface ThumbnailProps extends WithOptionalChildren {\n fileName: string;\n fileType: string;\n path?: string;\n file?: File;\n state?: FileInputFileState;\n}\n\nexport const Thumbnail: FC<ThumbnailProps> = (props) => {\n const { fileName, fileType, path, file, state, children } = props;\n\n const classNames = cn(\"jkl-file__thumbnail\", {\n \"jkl-file__thumbnail--selected\": state === \"SELECTED\",\n \"jkl-file__thumbnail--uploading\": state === \"UPLOADING\",\n });\n\n if (fileType.startsWith(\"image/\")) {\n return (\n <div className=\"jkl-file__thumbnail-wrapper\">\n <img\n className={classNames}\n src={file ? URL.createObjectURL(file) : path}\n alt=\"\"\n />\n {children}\n </div>\n );\n }\n\n return (\n <div className={classNames}>\n <p>{fileName.split(\".\").at(-1)}</p>\n </div>\n );\n};\n"],"names":["props","fileName","fileType","path","file","state","children","classNames","cn","startsWith","jsxs","className","jsx","src","URL","createObjectURL","alt","split","at"],"mappings":"+JAa8CA,IAC1C,MAAQC,SAAAA,EAAUC,SAAAA,EAAUC,KAAAA,EAAMC,KAAAA,EAAMC,MAAAA,EAAOC,SAAAA,GAAaN,EAEtDO,EAAaC,EAAG,sBAAuB,CACzC,gCAA2C,aAAVH,EACjC,iCAA4C,cAAVA,IAGlC,OAAAH,EAASO,WAAW,UAEhBC,EAAAA,KAAC,MAAI,CAAAC,UAAU,8BACXL,SAAA,CAAAM,EAAAA,IAAC,MAAA,CACGD,UAAWJ,EACXM,IAAKT,EAAOU,IAAIC,gBAAgBX,GAAQD,EACxCa,IAAI,KAEPV,KAMRM,EAAAA,IAAA,MAAA,CAAID,UAAWJ,EACZD,SAACM,EAAAA,IAAA,IAAA,CAAGN,SAASL,EAAAgB,MAAM,KAAKC,IAAG,MAC/B"}
1
+ {"version":3,"file":"Thumbnail.cjs","sources":["../../../../../src/components/file-input/internal/Thumbnail.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { FC } from \"react\";\nimport type { WithOptionalChildren } from \"../../../core/types.js\";\nimport { FileInputFileState } from \"../types.js\";\n\nexport interface ThumbnailProps extends WithOptionalChildren {\n fileName: string;\n fileType: string;\n path?: string;\n file?: File;\n state?: FileInputFileState;\n}\n\nexport const Thumbnail: FC<ThumbnailProps> = (props) => {\n const { fileName, fileType, path, file, state, children } = props;\n\n const classNames = clsx(\"jkl-file__thumbnail\", {\n \"jkl-file__thumbnail--selected\": state === \"SELECTED\",\n \"jkl-file__thumbnail--uploading\": state === \"UPLOADING\",\n });\n\n if (fileType.startsWith(\"image/\")) {\n return (\n <div className=\"jkl-file__thumbnail-wrapper\">\n <img\n className={classNames}\n src={file ? URL.createObjectURL(file) : path}\n alt=\"\"\n />\n {children}\n </div>\n );\n }\n\n return (\n <div className={classNames}>\n <p>{fileName.split(\".\").at(-1)}</p>\n </div>\n );\n};\n"],"names":["props","fileName","fileType","path","file","state","children","classNames","clsx","startsWith","jsxs","className","jsx","src","URL","createObjectURL","alt","split","at"],"mappings":"kLAa8CA,IAC1C,MAAQC,SAAAA,EAAUC,SAAAA,EAAUC,KAAAA,EAAMC,KAAAA,EAAMC,MAAAA,EAAOC,SAAAA,GAAaN,EAEtDO,EAAaC,OAAK,sBAAuB,CAC3C,gCAA2C,aAAVH,EACjC,iCAA4C,cAAVA,IAGlC,OAAAH,EAASO,WAAW,UAEhBC,EAAAA,KAAC,MAAI,CAAAC,UAAU,8BACXL,SAAA,CAAAM,EAAAA,IAAC,MAAA,CACGD,UAAWJ,EACXM,IAAKT,EAAOU,IAAIC,gBAAgBX,GAAQD,EACxCa,IAAI,KAEPV,KAMRM,EAAAA,IAAA,MAAA,CAAID,UAAWJ,EACZD,SAACM,EAAAA,IAAA,IAAA,CAAGN,SAASL,EAAAgB,MAAM,KAAKC,IAAK,MACjC"}
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as t,Fragment as o}from"react/jsx-runtime";import s from"classnames";import r from"downshift";import{useId as l}from"../../hooks/useId/useId.js";import{InputGroup as a}from"../input-group/InputGroup.js";import i from"./ControllerButton.js";import n from"./Menu.js";function p({className:p="",label:m,labelProps:d,tooltipProps:u,supportLabelProps:g,inputId:c,labelId:h,leadText:f,errorLabel:b,helpLabel:I,density:P,variant:j="small",noHitsMessage:x,maxNumberOfHits:k,placeholder:S,itemToString:w,items:L,downshiftProps:N,showDropdownControllerButton:H=!1,onConfirm:y=(()=>{}),noHits:M}){const T=l(c||"jkl-text-input",{generateSuffix:!c}),v=l(h||"jkl-label",{generateSuffix:!h});return e(r,{...N,inputId:T,labelId:v,itemToString:w,children:({getInputProps:r,getToggleButtonProps:l,getItemProps:c,getLabelProps:h,getMenuProps:N,getRootProps:T,selectedItem:C,isOpen:_,highlightedIndex:B,clearSelection:O})=>e(a,{...T(),label:m,className:s("jkl-autosuggest",p),density:P,labelProps:{variant:j,...d,...h({id:v})},supportLabelProps:g,tooltipProps:u,errorLabel:b,helpLabel:I,render:a=>t(o,{children:[f&&e("p",{className:s("jkl-spacing-l--bottom",{"jkl-body":"compact"!==P,"jkl-small":"compact"===P}),children:f}),t("div",{className:"jkl-text-input-wrapper","data-invalid":!!b,children:[e("input",{...a,...r({id:a.id,placeholder:S,className:"jkl-text-input__input",onKeyDown:e=>{13===e.keyCode&&!_&&y()}}),"data-testid":"autosuggest__input"}),H&&e(i,{...l(),hasSelectedItem:!!C,clearSelection:O}),_&&e(n,{downshiftProps:{getMenuProps:N,getItemProps:c},highlightedIndex:B,items:L,itemToString:w,noHitsMessage:x,maxNumberOfHits:k,noHits:M})]})]})})})}export{p as default};
1
+ import{jsx as e,jsxs as t,Fragment as o}from"react/jsx-runtime";import{c as s}from"../../../clsx-BeLtu-UY.js";import r from"downshift";import{useId as l}from"../../hooks/useId/useId.js";import{InputGroup as i}from"../input-group/InputGroup.js";import a from"./ControllerButton.js";import n from"./Menu.js";function p({className:p="",label:m,labelProps:d,tooltipProps:u,supportLabelProps:g,inputId:c,labelId:h,leadText:f,errorLabel:b,helpLabel:j,density:I,variant:P="small",noHitsMessage:x,maxNumberOfHits:k,placeholder:S,itemToString:w,items:L,downshiftProps:N,showDropdownControllerButton:H=!1,onConfirm:y=(()=>{}),noHits:M}){const T=l(c||"jkl-text-input",{generateSuffix:!c}),v=l(h||"jkl-label",{generateSuffix:!h});return e(r,{...N,inputId:T,labelId:v,itemToString:w,children:({getInputProps:r,getToggleButtonProps:l,getItemProps:c,getLabelProps:h,getMenuProps:N,getRootProps:T,selectedItem:C,isOpen:_,highlightedIndex:B,clearSelection:O})=>e(i,{...T(),label:m,className:s("jkl-autosuggest",p),density:I,labelProps:{variant:P,...d,...h({id:v})},supportLabelProps:g,tooltipProps:u,errorLabel:b,helpLabel:j,render:i=>t(o,{children:[f&&e("p",{className:s("jkl-spacing-l--bottom",{"jkl-body":"compact"!==I,"jkl-small":"compact"===I}),children:f}),t("div",{className:"jkl-text-input-wrapper","data-invalid":!!b,children:[e("input",{...i,...r({id:i.id,placeholder:S,className:"jkl-text-input__input",onKeyDown:e=>{13===e.keyCode&&!_&&y()}}),"data-testid":"autosuggest__input"}),H&&e(a,{...l(),hasSelectedItem:!!C,clearSelection:O}),_&&e(n,{downshiftProps:{getMenuProps:N,getItemProps:c},highlightedIndex:B,items:L,itemToString:w,noHitsMessage:x,maxNumberOfHits:k,noHits:M})]})]})})})}export{p as default};
2
2
  //# sourceMappingURL=BaseAutosuggest.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BaseAutosuggest.js","sources":["../../../../src/components/autosuggest/BaseAutosuggest.tsx"],"sourcesContent":["import cn from \"classnames\";\nimport {\n Callback,\n default as Downshift,\n type DownshiftProps,\n PropGetters,\n} from \"downshift\";\nimport React, { type ReactNode } from \"react\";\nimport { useId } from \"../../hooks/useId/useId.js\";\nimport { InputGroup } from \"../input-group/InputGroup.js\";\nimport { type CommonProps } from \"./Autosuggest.js\";\nimport ControllerButton from \"./ControllerButton.js\";\nimport Menu from \"./Menu.js\";\n\nconst KEY_ENTER = 13;\n\ntype BaseAutosuggestProps<T> = CommonProps & {\n itemToString: (item: T | null) => string;\n items: T[];\n downshiftProps: DownshiftProps<T>;\n showDropdownControllerButton?: boolean;\n onConfirm?: () => void;\n noHits?: { text: ReactNode; items: T[] };\n};\ninterface Props extends PropGetters<any>, DownshiftProps<any> {\n clearSelection: (cb?: Callback) => void;\n}\n\nfunction BaseAutosuggest<T>({\n className = \"\",\n label,\n labelProps,\n tooltipProps,\n supportLabelProps,\n inputId,\n labelId,\n leadText,\n errorLabel,\n helpLabel,\n density,\n variant = \"small\",\n noHitsMessage,\n maxNumberOfHits,\n placeholder,\n itemToString,\n items,\n downshiftProps,\n showDropdownControllerButton = false,\n onConfirm = () => {\n /* noop */\n },\n noHits,\n}: BaseAutosuggestProps<T>): JSX.Element {\n const uid = useId(inputId || \"jkl-text-input\", {\n generateSuffix: !inputId,\n });\n const lid = useId(labelId || \"jkl-label\", { generateSuffix: !labelId });\n\n const customLabelProps = {\n inputId: uid,\n labelId: lid,\n };\n\n return (\n /* @ts-ignore-next-line det er noe rart og ancient med downshift */\n <Downshift\n {...downshiftProps}\n {...customLabelProps}\n itemToString={itemToString}\n >\n {({\n getInputProps,\n getToggleButtonProps,\n getItemProps,\n getLabelProps,\n getMenuProps,\n getRootProps,\n selectedItem,\n isOpen,\n highlightedIndex,\n clearSelection,\n }: Props) => {\n return (\n <InputGroup\n {...getRootProps()}\n label={label}\n className={cn(\"jkl-autosuggest\", className)}\n density={density}\n labelProps={{\n variant,\n ...labelProps,\n ...getLabelProps({\n id: lid,\n }),\n }}\n supportLabelProps={supportLabelProps}\n tooltipProps={tooltipProps}\n errorLabel={errorLabel}\n helpLabel={helpLabel}\n render={(inputProps) => (\n <>\n {leadText && (\n <p\n className={cn(\"jkl-spacing-l--bottom\", {\n \"jkl-body\": density !== \"compact\",\n \"jkl-small\": density === \"compact\",\n })}\n >\n {leadText}\n </p>\n )}\n <div\n className=\"jkl-text-input-wrapper\"\n data-invalid={!!errorLabel}\n >\n <input\n {...inputProps}\n {...getInputProps({\n id: inputProps.id,\n placeholder,\n className: \"jkl-text-input__input\",\n onKeyDown: (e) => {\n if (\n e.keyCode === KEY_ENTER &&\n !isOpen\n ) {\n onConfirm();\n }\n },\n })}\n data-testid=\"autosuggest__input\"\n />\n {showDropdownControllerButton && (\n <ControllerButton\n {...getToggleButtonProps()}\n hasSelectedItem={!!selectedItem}\n clearSelection={clearSelection}\n />\n )}\n {isOpen && (\n <Menu\n downshiftProps={{\n getMenuProps,\n getItemProps,\n }}\n highlightedIndex={highlightedIndex}\n items={items}\n itemToString={itemToString}\n noHitsMessage={noHitsMessage}\n maxNumberOfHits={maxNumberOfHits}\n noHits={noHits}\n />\n )}\n </div>\n </>\n )}\n />\n );\n }}\n </Downshift>\n );\n}\n\nexport default BaseAutosuggest;\n"],"names":["BaseAutosuggest","className","label","labelProps","tooltipProps","supportLabelProps","inputId","labelId","leadText","errorLabel","helpLabel","density","variant","noHitsMessage","maxNumberOfHits","placeholder","itemToString","items","downshiftProps","showDropdownControllerButton","onConfirm","noHits","uid","useId","generateSuffix","lid","jsx","Downshift","children","getInputProps","getToggleButtonProps","getItemProps","getLabelProps","getMenuProps","getRootProps","selectedItem","isOpen","highlightedIndex","clearSelection","InputGroup","cn","id","render","inputProps","jsxs","Fragment","onKeyDown","e","keyCode","ControllerButton","hasSelectedItem","Menu"],"mappings":"8RA4BA,SAASA,GACLC,UAAAA,EAAY,GACZC,MAAAA,EACAC,WAAAA,EACAC,aAAAA,EACAC,kBAAAA,EACAC,QAAAA,EACAC,QAAAA,EACAC,SAAAA,EACAC,WAAAA,EACAC,UAAAA,EACAC,QAAAA,EACAC,QAAAA,EAAU,QACVC,cAAAA,EACAC,gBAAAA,EACAC,YAAAA,EACAC,aAAAA,EACAC,MAAAA,EACAC,eAAAA,EACAC,6BAAAA,GAA+B,EAC/BC,UAAAA,EAAY,SAGZC,OAAAA,IAEMC,MAAAA,EAAMC,EAAMjB,GAAW,iBAAkB,CAC3CkB,gBAAiBlB,IAEfmB,EAAMF,EAAMhB,GAAW,YAAa,CAAEiB,gBAAiBjB,IAO7D,OAEImB,EAACC,EAAA,IACOT,EAPRZ,QAASgB,EACTf,QAASkB,EAQLT,aAAAA,EAECY,SAAC,EACEC,cAAAA,EACAC,qBAAAA,EACAC,aAAAA,EACAC,cAAAA,EACAC,aAAAA,EACAC,aAAAA,EACAC,aAAAA,EACAC,OAAAA,EACAC,iBAAAA,EACAC,eAAAA,KAGIZ,EAACa,EAAA,IACOL,IACJhC,MAAAA,EACAD,UAAWuC,EAAG,kBAAmBvC,GACjCU,QAAAA,EACAR,WAAY,CACRS,QAAAA,KACGT,KACA6B,EAAc,CACbS,GAAIhB,KAGZpB,kBAAAA,EACAD,aAAAA,EACAK,WAAAA,EACAC,UAAAA,EACAgC,OAASC,GAEAC,EAAAC,EAAA,CAAAjB,SAAA,CACGpB,GAAAkB,EAAC,IAAA,CACGzB,UAAWuC,EAAG,wBAAyB,CACnC,WAAwB,YAAZ7B,EACZ,YAAyB,YAAZA,IAGhBiB,SAAApB,IAGToC,EAAC,MAAA,CACG3C,UAAU,yBACV,iBAAgBQ,EAEhBmB,SAAA,CAAAF,EAAC,QAAA,IACOiB,KACAd,EAAc,CACdY,GAAIE,EAAWF,GACf1B,YAAAA,EACAd,UAAW,wBACX6C,UAAYC,IA3GtC,KA6GkCA,EAAEC,UACDZ,GAEShB,OAItB,cAAY,uBAEfD,GACGO,EAACuB,EAAA,IACOnB,IACJoB,kBAAmBf,EACnBG,eAAAA,IAGPF,GACGV,EAACyB,EAAA,CACGjC,eAAgB,CACZe,aAAAA,EACAF,aAAAA,GAEJM,iBAAAA,EACApB,MAAAA,EACAD,aAAAA,EACAH,cAAAA,EACAC,gBAAAA,EACAO,OAAAA,aAW5C"}
1
+ {"version":3,"file":"BaseAutosuggest.js","sources":["../../../../src/components/autosuggest/BaseAutosuggest.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport {\n Callback,\n default as Downshift,\n type DownshiftProps,\n PropGetters,\n} from \"downshift\";\nimport React, { type ReactNode } from \"react\";\nimport { useId } from \"../../hooks/useId/useId.js\";\nimport { InputGroup } from \"../input-group/InputGroup.js\";\nimport { type CommonProps } from \"./Autosuggest.js\";\nimport ControllerButton from \"./ControllerButton.js\";\nimport Menu from \"./Menu.js\";\n\nconst KEY_ENTER = 13;\n\ntype BaseAutosuggestProps<T> = CommonProps & {\n itemToString: (item: T | null) => string;\n items: T[];\n downshiftProps: DownshiftProps<T>;\n showDropdownControllerButton?: boolean;\n onConfirm?: () => void;\n noHits?: { text: ReactNode; items: T[] };\n};\ninterface Props extends PropGetters<any>, DownshiftProps<any> {\n clearSelection: (cb?: Callback) => void;\n}\n\nfunction BaseAutosuggest<T>({\n className = \"\",\n label,\n labelProps,\n tooltipProps,\n supportLabelProps,\n inputId,\n labelId,\n leadText,\n errorLabel,\n helpLabel,\n density,\n variant = \"small\",\n noHitsMessage,\n maxNumberOfHits,\n placeholder,\n itemToString,\n items,\n downshiftProps,\n showDropdownControllerButton = false,\n onConfirm = () => {\n /* noop */\n },\n noHits,\n}: BaseAutosuggestProps<T>): JSX.Element {\n const uid = useId(inputId || \"jkl-text-input\", {\n generateSuffix: !inputId,\n });\n const lid = useId(labelId || \"jkl-label\", { generateSuffix: !labelId });\n\n const customLabelProps = {\n inputId: uid,\n labelId: lid,\n };\n\n return (\n /* @ts-ignore-next-line det er noe rart og ancient med downshift */\n <Downshift\n {...downshiftProps}\n {...customLabelProps}\n itemToString={itemToString}\n >\n {({\n getInputProps,\n getToggleButtonProps,\n getItemProps,\n getLabelProps,\n getMenuProps,\n getRootProps,\n selectedItem,\n isOpen,\n highlightedIndex,\n clearSelection,\n }: Props) => {\n return (\n <InputGroup\n {...getRootProps()}\n label={label}\n className={clsx(\"jkl-autosuggest\", className)}\n density={density}\n labelProps={{\n variant,\n ...labelProps,\n ...getLabelProps({\n id: lid,\n }),\n }}\n supportLabelProps={supportLabelProps}\n tooltipProps={tooltipProps}\n errorLabel={errorLabel}\n helpLabel={helpLabel}\n render={(inputProps) => (\n <>\n {leadText && (\n <p\n className={clsx(\n \"jkl-spacing-l--bottom\",\n {\n \"jkl-body\":\n density !== \"compact\",\n \"jkl-small\":\n density === \"compact\",\n },\n )}\n >\n {leadText}\n </p>\n )}\n <div\n className=\"jkl-text-input-wrapper\"\n data-invalid={!!errorLabel}\n >\n <input\n {...inputProps}\n {...getInputProps({\n id: inputProps.id,\n placeholder,\n className: \"jkl-text-input__input\",\n onKeyDown: (e) => {\n if (\n e.keyCode === KEY_ENTER &&\n !isOpen\n ) {\n onConfirm();\n }\n },\n })}\n data-testid=\"autosuggest__input\"\n />\n {showDropdownControllerButton && (\n <ControllerButton\n {...getToggleButtonProps()}\n hasSelectedItem={!!selectedItem}\n clearSelection={clearSelection}\n />\n )}\n {isOpen && (\n <Menu\n downshiftProps={{\n getMenuProps,\n getItemProps,\n }}\n highlightedIndex={highlightedIndex}\n items={items}\n itemToString={itemToString}\n noHitsMessage={noHitsMessage}\n maxNumberOfHits={maxNumberOfHits}\n noHits={noHits}\n />\n )}\n </div>\n </>\n )}\n />\n );\n }}\n </Downshift>\n );\n}\n\nexport default BaseAutosuggest;\n"],"names":["BaseAutosuggest","className","label","labelProps","tooltipProps","supportLabelProps","inputId","labelId","leadText","errorLabel","helpLabel","density","variant","noHitsMessage","maxNumberOfHits","placeholder","itemToString","items","downshiftProps","showDropdownControllerButton","onConfirm","noHits","uid","useId","generateSuffix","lid","jsx","Downshift","children","getInputProps","getToggleButtonProps","getItemProps","getLabelProps","getMenuProps","getRootProps","selectedItem","isOpen","highlightedIndex","clearSelection","InputGroup","clsx","id","render","inputProps","jsxs","Fragment","onKeyDown","e","keyCode","ControllerButton","hasSelectedItem","Menu"],"mappings":"kTA4BA,SAASA,GACLC,UAAAA,EAAY,GACZC,MAAAA,EACAC,WAAAA,EACAC,aAAAA,EACAC,kBAAAA,EACAC,QAAAA,EACAC,QAAAA,EACAC,SAAAA,EACAC,WAAAA,EACAC,UAAAA,EACAC,QAAAA,EACAC,QAAAA,EAAU,QACVC,cAAAA,EACAC,gBAAAA,EACAC,YAAAA,EACAC,aAAAA,EACAC,MAAAA,EACAC,eAAAA,EACAC,6BAAAA,GAA+B,EAC/BC,UAAAA,EAAY,SAGZC,OAAAA,IAEMC,MAAAA,EAAMC,EAAMjB,GAAW,iBAAkB,CAC3CkB,gBAAiBlB,IAEfmB,EAAMF,EAAMhB,GAAW,YAAa,CAAEiB,gBAAiBjB,IAO7D,OAEImB,EAACC,EAAA,IACOT,EAPRZ,QAASgB,EACTf,QAASkB,EAQLT,aAAAA,EAECY,SAAC,EACEC,cAAAA,EACAC,qBAAAA,EACAC,aAAAA,EACAC,cAAAA,EACAC,aAAAA,EACAC,aAAAA,EACAC,aAAAA,EACAC,OAAAA,EACAC,iBAAAA,EACAC,eAAAA,KAGIZ,EAACa,EAAA,IACOL,IACJhC,MAAAA,EACAD,UAAWuC,EAAK,kBAAmBvC,GACnCU,QAAAA,EACAR,WAAY,CACRS,QAAAA,KACGT,KACA6B,EAAc,CACbS,GAAIhB,KAGZpB,kBAAAA,EACAD,aAAAA,EACAK,WAAAA,EACAC,UAAAA,EACAgC,OAASC,GAEAC,EAAAC,EAAA,CAAAjB,SAAA,CACGpB,GAAAkB,EAAC,IAAA,CACGzB,UAAWuC,EACP,wBACA,CACI,WACgB,YAAZ7B,EACJ,YACgB,YAAZA,IAIXiB,SAAApB,IAGToC,EAAC,MAAA,CACG3C,UAAU,yBACV,iBAAgBQ,EAEhBmB,SAAA,CAAAF,EAAC,QAAA,IACOiB,KACAd,EAAc,CACdY,GAAIE,EAAWF,GACf1B,YAAAA,EACAd,UAAW,wBACX6C,UAAYC,IAhHtC,KAkHkCA,EAAEC,UACDZ,GAEShB,OAItB,cAAY,uBAEfD,GACGO,EAACuB,EAAA,IACOnB,IACJoB,kBAAmBf,EACnBG,eAAAA,IAGPF,GACGV,EAACyB,EAAA,CACGjC,eAAgB,CACZe,aAAAA,EACAF,aAAAA,GAEJM,iBAAAA,EACApB,MAAAA,EACAD,aAAAA,EACAH,cAAAA,EACAC,gBAAAA,EACAO,OAAAA,aAW5C"}
@@ -1,2 +1,2 @@
1
- import{jsxs as t,jsx as e}from"react/jsx-runtime";import{createElement as s}from"react";import i from"classnames";function a({downshiftProps:{getMenuProps:a,getItemProps:l},highlightedIndex:m,items:n,itemToString:o,noHitsMessage:g,maxNumberOfHits:u=1/0,noHits:r}){const c=n.length>u?n.slice(0,u):n;if(0===c.length&&!g&&!r)return null;const d=0===c.length&&r?r.items:c;return t("div",{"data-testid":"autosuggest__menu",className:"jkl-autosuggest__menu",children:[(g||r)&&0===c.length&&e("div",{className:"jkl-autosuggest__no-hits-message","aria-live":"polite",children:g||(null==r?void 0:r.text)}),d.length>0&&e("ul",{...a({className:"jkl-autosuggest__item-list"}),children:d.map(((t,e)=>s("li",{...l({item:t,className:i("jkl-autosuggest__item",{"jkl-autosuggest__item--active":e===m})}),"data-testid":"autosuggest__item",key:o(t)},o(t))))})]})}export{a as default};
1
+ import{jsxs as t,jsx as e}from"react/jsx-runtime";import{createElement as s}from"react";import{c as i}from"../../../clsx-BeLtu-UY.js";function a({downshiftProps:{getMenuProps:a,getItemProps:l},highlightedIndex:m,items:n,itemToString:o,noHitsMessage:g,maxNumberOfHits:u=1/0,noHits:r}){const c=n.length>u?n.slice(0,u):n;if(0===c.length&&!g&&!r)return null;const d=0===c.length&&r?r.items:c;return t("div",{"data-testid":"autosuggest__menu",className:"jkl-autosuggest__menu",children:[(g||r)&&0===c.length&&e("div",{className:"jkl-autosuggest__no-hits-message","aria-live":"polite",children:g||(null==r?void 0:r.text)}),d.length>0&&e("ul",{...a({className:"jkl-autosuggest__item-list"}),children:d.map(((t,e)=>s("li",{...l({item:t,className:i("jkl-autosuggest__item",{"jkl-autosuggest__item--active":e===m})}),"data-testid":"autosuggest__item",key:o(t)},o(t))))})]})}export{a as default};
2
2
  //# sourceMappingURL=Menu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Menu.js","sources":["../../../../src/components/autosuggest/Menu.tsx"],"sourcesContent":["import cn from \"classnames\";\nimport { PropGetters } from \"downshift\";\nimport React, { ReactNode } from \"react\";\n\ninterface MenuProps<T> {\n downshiftProps: Pick<PropGetters<T>, \"getMenuProps\" | \"getItemProps\">;\n highlightedIndex: number | undefined | null;\n items: T[];\n itemToString: (item: T | null) => string;\n noHitsMessage?: ReactNode;\n maxNumberOfHits?: number;\n noHits?: { items: T[]; text: ReactNode };\n}\n\nfunction Menu<T>({\n downshiftProps: { getMenuProps, getItemProps },\n highlightedIndex,\n items,\n itemToString,\n noHitsMessage,\n maxNumberOfHits = Infinity,\n noHits,\n}: MenuProps<T>): JSX.Element | null {\n const visibleItems =\n items.length > maxNumberOfHits\n ? items.slice(0, maxNumberOfHits)\n : items;\n\n if (visibleItems.length === 0 && !noHitsMessage && !noHits) {\n return null;\n }\n\n const itemList =\n visibleItems.length === 0 && noHits ? noHits.items : visibleItems;\n\n return (\n <div data-testid=\"autosuggest__menu\" className=\"jkl-autosuggest__menu\">\n {(noHitsMessage || noHits) && visibleItems.length === 0 && (\n <div\n className=\"jkl-autosuggest__no-hits-message\"\n aria-live=\"polite\"\n >\n {noHitsMessage || noHits?.text}\n </div>\n )}\n\n {itemList.length > 0 && (\n <ul\n {...getMenuProps({\n className: \"jkl-autosuggest__item-list\",\n })}\n >\n {itemList.map((item, index) => (\n <li\n {...getItemProps({\n item,\n className: cn(\"jkl-autosuggest__item\", {\n \"jkl-autosuggest__item--active\":\n index === highlightedIndex,\n }),\n })}\n data-testid=\"autosuggest__item\"\n key={itemToString(item)}\n >\n {itemToString(item)}\n </li>\n ))}\n </ul>\n )}\n </div>\n );\n}\n\nexport default Menu;\n"],"names":["Menu","downshiftProps","getMenuProps","getItemProps","highlightedIndex","items","itemToString","noHitsMessage","maxNumberOfHits","noHits","visibleItems","length","slice","itemList","jsxs","className","children","jsx","text","map","item","index","createElement","cn","key"],"mappings":"kHAcA,SAASA,GACLC,gBAAkBC,aAAAA,EAAcC,aAAAA,GAChCC,iBAAAA,EACAC,MAAAA,EACAC,aAAAA,EACAC,cAAAA,EACAC,gBAAAA,EAAkB,IAClBC,OAAAA,IAEMC,MAAAA,EACFL,EAAMM,OAASH,EACTH,EAAMO,MAAM,EAAGJ,GACfH,EAEV,GAA4B,IAAxBK,EAAaC,SAAiBJ,IAAkBE,EACzC,OAAA,KAGX,MAAMI,EACsB,IAAxBH,EAAaC,QAAgBF,EAASA,EAAOJ,MAAQK,EAGpD,OAAAI,EAAA,MAAA,CAAI,cAAY,oBAAoBC,UAAU,wBACzCC,SAAA,EAAiBT,GAAAE,IAAmC,IAAxBC,EAAaC,QACvCM,EAAC,MAAA,CACGF,UAAU,mCACV,YAAU,SAETC,aAAiB,MAAAP,OAAA,EAAAA,EAAQS,QAIjCL,EAASF,OAAS,GACfM,EAAC,KAAA,IACOf,EAAa,CACba,UAAW,+BAGdC,SAASH,EAAAM,KAAI,CAACC,EAAMC,IACjBC,EAAC,KAAA,IACOnB,EAAa,CACbiB,KAAAA,EACAL,UAAWQ,EAAG,wBAAyB,CACnC,gCACIF,IAAUjB,MAGtB,cAAY,oBACZoB,IAAKlB,EAAac,IAEjBd,EAAac,UAO1C"}
1
+ {"version":3,"file":"Menu.js","sources":["../../../../src/components/autosuggest/Menu.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { PropGetters } from \"downshift\";\nimport React, { ReactNode } from \"react\";\n\ninterface MenuProps<T> {\n downshiftProps: Pick<PropGetters<T>, \"getMenuProps\" | \"getItemProps\">;\n highlightedIndex: number | undefined | null;\n items: T[];\n itemToString: (item: T | null) => string;\n noHitsMessage?: ReactNode;\n maxNumberOfHits?: number;\n noHits?: { items: T[]; text: ReactNode };\n}\n\nfunction Menu<T>({\n downshiftProps: { getMenuProps, getItemProps },\n highlightedIndex,\n items,\n itemToString,\n noHitsMessage,\n maxNumberOfHits = Infinity,\n noHits,\n}: MenuProps<T>): JSX.Element | null {\n const visibleItems =\n items.length > maxNumberOfHits\n ? items.slice(0, maxNumberOfHits)\n : items;\n\n if (visibleItems.length === 0 && !noHitsMessage && !noHits) {\n return null;\n }\n\n const itemList =\n visibleItems.length === 0 && noHits ? noHits.items : visibleItems;\n\n return (\n <div data-testid=\"autosuggest__menu\" className=\"jkl-autosuggest__menu\">\n {(noHitsMessage || noHits) && visibleItems.length === 0 && (\n <div\n className=\"jkl-autosuggest__no-hits-message\"\n aria-live=\"polite\"\n >\n {noHitsMessage || noHits?.text}\n </div>\n )}\n\n {itemList.length > 0 && (\n <ul\n {...getMenuProps({\n className: \"jkl-autosuggest__item-list\",\n })}\n >\n {itemList.map((item, index) => (\n <li\n {...getItemProps({\n item,\n className: clsx(\"jkl-autosuggest__item\", {\n \"jkl-autosuggest__item--active\":\n index === highlightedIndex,\n }),\n })}\n data-testid=\"autosuggest__item\"\n key={itemToString(item)}\n >\n {itemToString(item)}\n </li>\n ))}\n </ul>\n )}\n </div>\n );\n}\n\nexport default Menu;\n"],"names":["Menu","downshiftProps","getMenuProps","getItemProps","highlightedIndex","items","itemToString","noHitsMessage","maxNumberOfHits","noHits","visibleItems","length","slice","itemList","jsxs","className","children","jsx","text","map","item","index","createElement","clsx","key"],"mappings":"sIAcA,SAASA,GACLC,gBAAkBC,aAAAA,EAAcC,aAAAA,GAChCC,iBAAAA,EACAC,MAAAA,EACAC,aAAAA,EACAC,cAAAA,EACAC,gBAAAA,EAAkB,IAClBC,OAAAA,IAEMC,MAAAA,EACFL,EAAMM,OAASH,EACTH,EAAMO,MAAM,EAAGJ,GACfH,EAEV,GAA4B,IAAxBK,EAAaC,SAAiBJ,IAAkBE,EACzC,OAAA,KAGX,MAAMI,EACsB,IAAxBH,EAAaC,QAAgBF,EAASA,EAAOJ,MAAQK,EAGpD,OAAAI,EAAA,MAAA,CAAI,cAAY,oBAAoBC,UAAU,wBACzCC,SAAA,EAAiBT,GAAAE,IAAmC,IAAxBC,EAAaC,QACvCM,EAAC,MAAA,CACGF,UAAU,mCACV,YAAU,SAETC,aAAiB,MAAAP,OAAA,EAAAA,EAAQS,QAIjCL,EAASF,OAAS,GACfM,EAAC,KAAA,IACOf,EAAa,CACba,UAAW,+BAGdC,SAASH,EAAAM,KAAI,CAACC,EAAMC,IACjBC,EAAC,KAAA,IACOnB,EAAa,CACbiB,KAAAA,EACAL,UAAWQ,EAAK,wBAAyB,CACrC,gCACIF,IAAUjB,MAGtB,cAAY,oBACZoB,IAAKlB,EAAac,IAEjBd,EAAac,UAO1C"}
@@ -1,2 +1,2 @@
1
- import{jsxs as o,jsx as i}from"react/jsx-runtime";import n from"classnames";import"../icon/Icon.js";import"../icon/icons/animated/ArrowVerticalAnimated.js";import"../icon/icons/animated/ArrowHorizontalAnimated.js";import"../icon/icons/animated/PlusRemoveAnimated.js";import"../icon/icons/ArrowDownIcon.js";import"../icon/icons/ArrowLeftIcon.js";import"../icon/icons/ArrowNorthEastIcon.js";import"../icon/icons/ArrowRightIcon.js";import"../icon/icons/ArrowUpIcon.js";import"../icon/icons/CalendarIcon.js";import"../icon/icons/CheckIcon.js";import"../icon/icons/ChevronDownIcon.js";import"../icon/icons/ChevronLeftIcon.js";import"../icon/icons/ChevronRightIcon.js";import"../icon/icons/ChevronUpIcon.js";import"../icon/icons/CloseIcon.js";import"../icon/icons/CopyIcon.js";import"../icon/icons/DotsIcon.js";import"../icon/icons/DragIcon.js";import"../icon/icons/ErrorIcon.js";import"../icon/icons/GreenCheckIcon.js";import"../icon/icons/HamburgerIcon.js";import"../icon/icons/InfoIcon.js";import"../icon/icons/LinkIcon.js";import"../icon/icons/PlusIcon.js";import"../icon/icons/QuestionIcon.js";import"../icon/icons/RedCrossIcon.js";import"../icon/icons/SearchIcon.js";import{SuccessIcon as s}from"../icon/icons/SuccessIcon.js";import"../icon/icons/WarningIcon.js";import"../icon/icons/MinusIcon.js";import"../icon/icons/ThumbDownIcon.js";import"../icon/icons/ThumbUpIcon.js";import{TrashCanIcon as c}from"../icon/icons/TrashCanIcon.js";import"../icon/icons/PenIcon.js";import{IconButton as r}from"../icon-button/IconButton.js";import{SupportLabel as e}from"../input-group/SupportLabel.js";import{useId as t}from"../../hooks/useId/useId.js";import{formatBytes as l}from"../../utilities/formatters/bytes/formatBytes.js";import{useFileInputContext as a}from"./internal/fileInputContext.js";import{Thumbnail as m}from"./internal/Thumbnail.js";const p=p=>{const{children:j,fileName:I,fileType:f,fileSize:u,path:d,file:h,supportLabel:b,supportLabelType:k,state:_,onRemove:C}=p,w=t("jkl-file-preview"),v=w+"-support",T=a(),g="error"===k||"warning"===k,y="success"===k,A=o("div",{id:w,className:"jkl-file",children:[o(d?"a":"div",{className:n("jkl-file__content",{"jkl-file__content--error":"error"===k,"jkl-file__content--warning":"warning"===k}),href:d,target:d?"_blank":void 0,children:[i(m,{fileName:I,fileType:f,file:h,path:d,state:_,children:j}),o("div",{children:[i("p",{className:"jkl-file__name",children:I}),o("p",{className:"jkl-file__description",children:[i("span",{children:l(u)}),g||y?y?i(s,{variant:"small","aria-label":"Filen ble lastet opp uten feil"}):null:i(e,{className:"jkl-file__support-label jkl-body",id:v,label:b,labelType:k})]}),b&&g&&i(e,{className:"jkl-file__support-label",id:v,label:b,labelType:k})]})]}),C&&i(r,{className:"jkl-file__delete",onClick:C,title:`Fjern ${I}`,children:i(c,{})})]});return T?i("li",{children:A}):A};export{p as File};
1
+ import{jsxs as o,jsx as i}from"react/jsx-runtime";import{c as n}from"../../../clsx-BeLtu-UY.js";import"../icon/Icon.js";import"../icon/icons/animated/ArrowVerticalAnimated.js";import"../icon/icons/animated/ArrowHorizontalAnimated.js";import"../icon/icons/animated/PlusRemoveAnimated.js";import"../icon/icons/ArrowDownIcon.js";import"../icon/icons/ArrowLeftIcon.js";import"../icon/icons/ArrowNorthEastIcon.js";import"../icon/icons/ArrowRightIcon.js";import"../icon/icons/ArrowUpIcon.js";import"../icon/icons/CalendarIcon.js";import"../icon/icons/CheckIcon.js";import"../icon/icons/ChevronDownIcon.js";import"../icon/icons/ChevronLeftIcon.js";import"../icon/icons/ChevronRightIcon.js";import"../icon/icons/ChevronUpIcon.js";import"../icon/icons/CloseIcon.js";import"../icon/icons/CopyIcon.js";import"../icon/icons/DotsIcon.js";import"../icon/icons/DragIcon.js";import"../icon/icons/ErrorIcon.js";import"../icon/icons/GreenCheckIcon.js";import"../icon/icons/HamburgerIcon.js";import"../icon/icons/InfoIcon.js";import"../icon/icons/LinkIcon.js";import"../icon/icons/PlusIcon.js";import"../icon/icons/QuestionIcon.js";import"../icon/icons/RedCrossIcon.js";import"../icon/icons/SearchIcon.js";import{SuccessIcon as s}from"../icon/icons/SuccessIcon.js";import"../icon/icons/WarningIcon.js";import"../icon/icons/MinusIcon.js";import"../icon/icons/ThumbDownIcon.js";import"../icon/icons/ThumbUpIcon.js";import{TrashCanIcon as c}from"../icon/icons/TrashCanIcon.js";import"../icon/icons/PenIcon.js";import{IconButton as r}from"../icon-button/IconButton.js";import{SupportLabel as e}from"../input-group/SupportLabel.js";import{useId as t}from"../../hooks/useId/useId.js";import{formatBytes as l}from"../../utilities/formatters/bytes/formatBytes.js";import{useFileInputContext as a}from"./internal/fileInputContext.js";import{Thumbnail as m}from"./internal/Thumbnail.js";const p=p=>{const{children:j,fileName:I,fileType:f,fileSize:u,path:d,file:h,supportLabel:b,supportLabelType:k,state:_,onRemove:C}=p,w=t("jkl-file-preview"),v=w+"-support",T=a(),g="error"===k||"warning"===k,y="success"===k,A=o("div",{id:w,className:"jkl-file",children:[o(d?"a":"div",{className:n("jkl-file__content",{"jkl-file__content--error":"error"===k,"jkl-file__content--warning":"warning"===k}),href:d,target:d?"_blank":void 0,children:[i(m,{fileName:I,fileType:f,file:h,path:d,state:_,children:j}),o("div",{children:[i("p",{className:"jkl-file__name",children:I}),o("p",{className:"jkl-file__description",children:[i("span",{children:l(u)}),g||y?y?i(s,{variant:"small","aria-label":"Filen ble lastet opp uten feil"}):null:i(e,{className:"jkl-file__support-label jkl-body",id:v,label:b,labelType:k})]}),b&&g&&i(e,{className:"jkl-file__support-label",id:v,label:b,labelType:k})]})]}),C&&i(r,{className:"jkl-file__delete",onClick:C,title:`Fjern ${I}`,children:i(c,{})})]});return T?i("li",{children:A}):A};export{p as File};
2
2
  //# sourceMappingURL=File.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"File.js","sources":["../../../../src/components/file-input/File.tsx"],"sourcesContent":["import cn from \"classnames\";\nimport React, { FC, MouseEvent } from \"react\";\nimport { TrashCanIcon, SuccessIcon } from \"../../components/icon/index.js\";\nimport { IconButton } from \"../../components/icon-button/IconButton.js\";\nimport { SupportLabel } from \"../../components/input-group/SupportLabel.js\";\nimport { type WithOptionalChildren } from \"../../core/types.js\";\nimport { useId } from \"../../hooks/useId/useId.js\";\nimport { formatBytes } from \"../../utilities/formatters/bytes/formatBytes.js\";\nimport { useFileInputContext } from \"./internal/fileInputContext.js\";\nimport { Thumbnail } from \"./internal/Thumbnail.js\";\nimport { FileInputFileState } from \"./types.js\";\n\nexport interface FileProps extends WithOptionalChildren {\n fileName: string;\n fileType: string;\n fileSize: number;\n path?: string;\n file?: File;\n supportLabel?: string;\n supportLabelType?: \"help\" | \"error\" | \"warning\" | \"success\";\n state?: FileInputFileState;\n onRemove?: (e: MouseEvent<HTMLButtonElement>) => void;\n}\n\nexport const File: FC<FileProps> = (props) => {\n const {\n children,\n fileName,\n fileType,\n fileSize,\n path,\n file,\n supportLabel,\n supportLabelType,\n state,\n onRemove,\n } = props;\n\n const id = useId(\"jkl-file-preview\");\n const supportId = id + \"-support\";\n\n const context = useFileInputContext();\n\n const Component = path ? \"a\" : \"div\";\n\n const hasErrorOrWarning =\n supportLabelType === \"error\" || supportLabelType === \"warning\";\n const hasSuccess = supportLabelType === \"success\";\n\n const renderFeedbackElement = () => {\n if (!hasErrorOrWarning && !hasSuccess) {\n return (\n <SupportLabel\n className=\"jkl-file__support-label jkl-body\"\n id={supportId}\n label={supportLabel}\n labelType={supportLabelType}\n />\n );\n }\n\n if (hasSuccess)\n return (\n <SuccessIcon\n variant=\"small\"\n aria-label=\"Filen ble lastet opp uten feil\"\n />\n );\n\n return null;\n };\n\n const fileComponent = (\n <div id={id} className=\"jkl-file\">\n <Component\n className={cn(\"jkl-file__content\", {\n \"jkl-file__content--error\": supportLabelType === \"error\",\n \"jkl-file__content--warning\":\n supportLabelType === \"warning\",\n })}\n href={path}\n target={path ? \"_blank\" : undefined}\n >\n <Thumbnail\n fileName={fileName}\n fileType={fileType}\n file={file}\n path={path}\n state={state}\n >\n {children}\n </Thumbnail>\n <div>\n <p className=\"jkl-file__name\">{fileName}</p>\n <p className=\"jkl-file__description\">\n <span>{formatBytes(fileSize)}</span>\n {renderFeedbackElement()}\n </p>\n {supportLabel && hasErrorOrWarning && (\n <SupportLabel\n className=\"jkl-file__support-label\"\n id={supportId}\n label={supportLabel}\n labelType={supportLabelType}\n />\n )}\n </div>\n </Component>\n {onRemove && (\n <IconButton\n className=\"jkl-file__delete\"\n onClick={onRemove}\n title={`Fjern ${fileName}`}\n >\n <TrashCanIcon />\n </IconButton>\n )}\n </div>\n );\n\n return context ? <li>{fileComponent}</li> : fileComponent;\n};\n"],"names":["File","props","children","fileName","fileType","fileSize","path","file","supportLabel","supportLabelType","state","onRemove","id","useId","supportId","context","useFileInputContext","hasErrorOrWarning","hasSuccess","fileComponent","jsxs","className","cn","href","target","jsx","Thumbnail","formatBytes","SuccessIcon","variant","SupportLabel","label","labelType","IconButton","onClick","title","TrashCanIcon"],"mappings":"8yDAwBa,MAAAA,EAAuBC,IAC1B,MACFC,SAAAA,EACAC,SAAAA,EACAC,SAAAA,EACAC,SAAAA,EACAC,KAAAA,EACAC,KAAAA,EACAC,aAAAA,EACAC,iBAAAA,EACAC,MAAAA,EACAC,SAAAA,GACAV,EAEEW,EAAKC,EAAM,oBACXC,EAAYF,EAAK,WAEjBG,EAAUC,IAIVC,EACmB,UAArBR,GAAqD,YAArBA,EAC9BS,EAAkC,YAArBT,EAyBbU,EACFC,EAAC,MAAI,CAAAR,GAAAA,EAAQS,UAAU,WACnBnB,SAAA,CAAAkB,EA/BUd,EAAO,IAAM,MA+BtB,CACGe,UAAWC,EAAG,oBAAqB,CAC/B,2BAAiD,UAArBb,EAC5B,6BACyB,YAArBA,IAERc,KAAMjB,EACNkB,OAAQlB,EAAO,cAAW,EAE1BJ,SAAA,CAAAuB,EAACC,EAAA,CACGvB,SAAAA,EACAC,SAAAA,EACAG,KAAAA,EACAD,KAAAA,EACAI,MAAAA,EAECR,SAAAA,MAEJ,MACG,CAAAA,SAAA,CAACuB,EAAA,IAAA,CAAEJ,UAAU,iBAAkBnB,SAASC,IACxCiB,EAAC,IAAE,CAAAC,UAAU,wBACTnB,SAAA,CAACuB,EAAA,OAAA,CAAMvB,SAAYyB,EAAAtB,KA7C9BY,GAAsBC,EAWvBA,EAEIO,EAACG,EAAA,CACGC,QAAQ,QACR,aAAW,mCAIhB,KAjBCJ,EAACK,EAAA,CACGT,UAAU,mCACVT,GAAIE,EACJiB,MAAOvB,EACPwB,UAAWvB,OA0CVD,GAAgBS,GACbQ,EAACK,EAAA,CACGT,UAAU,0BACVT,GAAIE,EACJiB,MAAOvB,EACPwB,UAAWvB,UAK1BE,GACGc,EAACQ,EAAA,CACGZ,UAAU,mBACVa,QAASvB,EACTwB,MAAO,SAAShC,IAEhBD,WAACkC,EAAa,SAMvBrB,OAAAA,EAAUU,EAAC,KAAI,CAAAvB,SAAAiB,IAAsBA,CAAAA"}
1
+ {"version":3,"file":"File.js","sources":["../../../../src/components/file-input/File.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { FC, MouseEvent } from \"react\";\nimport { TrashCanIcon, SuccessIcon } from \"../../components/icon/index.js\";\nimport { IconButton } from \"../../components/icon-button/IconButton.js\";\nimport { SupportLabel } from \"../../components/input-group/SupportLabel.js\";\nimport { type WithOptionalChildren } from \"../../core/types.js\";\nimport { useId } from \"../../hooks/useId/useId.js\";\nimport { formatBytes } from \"../../utilities/formatters/bytes/formatBytes.js\";\nimport { useFileInputContext } from \"./internal/fileInputContext.js\";\nimport { Thumbnail } from \"./internal/Thumbnail.js\";\nimport { FileInputFileState } from \"./types.js\";\n\nexport interface FileProps extends WithOptionalChildren {\n fileName: string;\n fileType: string;\n fileSize: number;\n path?: string;\n file?: File;\n supportLabel?: string;\n supportLabelType?: \"help\" | \"error\" | \"warning\" | \"success\";\n state?: FileInputFileState;\n onRemove?: (e: MouseEvent<HTMLButtonElement>) => void;\n}\n\nexport const File: FC<FileProps> = (props) => {\n const {\n children,\n fileName,\n fileType,\n fileSize,\n path,\n file,\n supportLabel,\n supportLabelType,\n state,\n onRemove,\n } = props;\n\n const id = useId(\"jkl-file-preview\");\n const supportId = id + \"-support\";\n\n const context = useFileInputContext();\n\n const Component = path ? \"a\" : \"div\";\n\n const hasErrorOrWarning =\n supportLabelType === \"error\" || supportLabelType === \"warning\";\n const hasSuccess = supportLabelType === \"success\";\n\n const renderFeedbackElement = () => {\n if (!hasErrorOrWarning && !hasSuccess) {\n return (\n <SupportLabel\n className=\"jkl-file__support-label jkl-body\"\n id={supportId}\n label={supportLabel}\n labelType={supportLabelType}\n />\n );\n }\n\n if (hasSuccess)\n return (\n <SuccessIcon\n variant=\"small\"\n aria-label=\"Filen ble lastet opp uten feil\"\n />\n );\n\n return null;\n };\n\n const fileComponent = (\n <div id={id} className=\"jkl-file\">\n <Component\n className={clsx(\"jkl-file__content\", {\n \"jkl-file__content--error\": supportLabelType === \"error\",\n \"jkl-file__content--warning\":\n supportLabelType === \"warning\",\n })}\n href={path}\n target={path ? \"_blank\" : undefined}\n >\n <Thumbnail\n fileName={fileName}\n fileType={fileType}\n file={file}\n path={path}\n state={state}\n >\n {children}\n </Thumbnail>\n <div>\n <p className=\"jkl-file__name\">{fileName}</p>\n <p className=\"jkl-file__description\">\n <span>{formatBytes(fileSize)}</span>\n {renderFeedbackElement()}\n </p>\n {supportLabel && hasErrorOrWarning && (\n <SupportLabel\n className=\"jkl-file__support-label\"\n id={supportId}\n label={supportLabel}\n labelType={supportLabelType}\n />\n )}\n </div>\n </Component>\n {onRemove && (\n <IconButton\n className=\"jkl-file__delete\"\n onClick={onRemove}\n title={`Fjern ${fileName}`}\n >\n <TrashCanIcon />\n </IconButton>\n )}\n </div>\n );\n\n return context ? <li>{fileComponent}</li> : fileComponent;\n};\n"],"names":["File","props","children","fileName","fileType","fileSize","path","file","supportLabel","supportLabelType","state","onRemove","id","useId","supportId","context","useFileInputContext","hasErrorOrWarning","hasSuccess","fileComponent","jsxs","className","clsx","href","target","jsx","Thumbnail","formatBytes","SuccessIcon","variant","SupportLabel","label","labelType","IconButton","onClick","title","TrashCanIcon"],"mappings":"k0DAwBa,MAAAA,EAAuBC,IAC1B,MACFC,SAAAA,EACAC,SAAAA,EACAC,SAAAA,EACAC,SAAAA,EACAC,KAAAA,EACAC,KAAAA,EACAC,aAAAA,EACAC,iBAAAA,EACAC,MAAAA,EACAC,SAAAA,GACAV,EAEEW,EAAKC,EAAM,oBACXC,EAAYF,EAAK,WAEjBG,EAAUC,IAIVC,EACmB,UAArBR,GAAqD,YAArBA,EAC9BS,EAAkC,YAArBT,EAyBbU,EACFC,EAAC,MAAI,CAAAR,GAAAA,EAAQS,UAAU,WACnBnB,SAAA,CAAAkB,EA/BUd,EAAO,IAAM,MA+BtB,CACGe,UAAWC,EAAK,oBAAqB,CACjC,2BAAiD,UAArBb,EAC5B,6BACyB,YAArBA,IAERc,KAAMjB,EACNkB,OAAQlB,EAAO,cAAW,EAE1BJ,SAAA,CAAAuB,EAACC,EAAA,CACGvB,SAAAA,EACAC,SAAAA,EACAG,KAAAA,EACAD,KAAAA,EACAI,MAAAA,EAECR,SAAAA,MAEJ,MACG,CAAAA,SAAA,CAACuB,EAAA,IAAA,CAAEJ,UAAU,iBAAkBnB,SAASC,IACxCiB,EAAC,IAAE,CAAAC,UAAU,wBACTnB,SAAA,CAACuB,EAAA,OAAA,CAAMvB,SAAYyB,EAAAtB,KA7C9BY,GAAsBC,EAWvBA,EAEIO,EAACG,EAAA,CACGC,QAAQ,QACR,aAAW,mCAIhB,KAjBCJ,EAACK,EAAA,CACGT,UAAU,mCACVT,GAAIE,EACJiB,MAAOvB,EACPwB,UAAWvB,OA0CVD,GAAgBS,GACbQ,EAACK,EAAA,CACGT,UAAU,0BACVT,GAAIE,EACJiB,MAAOvB,EACPwB,UAAWvB,UAK1BE,GACGc,EAACQ,EAAA,CACGZ,UAAU,mBACVa,QAASvB,EACTwB,MAAO,SAAShC,IAEhBD,WAACkC,EAAa,SAMvBrB,OAAAA,EAAUU,EAAC,KAAI,CAAAvB,SAAAiB,IAAsBA,CAAAA"}
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as l}from"react/jsx-runtime";import i from"classnames";import{forwardRef as t}from"react";import{FieldGroup as a}from"../input-group/FieldGroup.js";import{Dropzone as n}from"./internal/Dropzone.js";import{FileInputContextProvider as s}from"./internal/fileInputContext.js";import{Input as r}from"./internal/Input.js";const o=t(((t,o)=>{const{accept:c,className:p,children:m,id:f,value:u,density:d,multiple:h=!0,maxSizeBytes:j,onChange:g,variant:x,...k}=t,y=u.length>0;return e(s,"small"===x?{context:{accept:c,onChange:g,maxSizeBytes:j,files:u},children:l(a,{className:i("jkl-file-input","jkl-file-input--small",p,{"jkl-file-input--has-files":y}),"data-layout-density":d||"compact",...k,children:[e(n,{children:e("div",{className:"jkl-file-input__call-to-action",children:e(r,{id:f,label:"Legg til fil",multiple:h,ref:o})})}),u.length>0&&e("ul",{className:"jkl-file-input__files",children:m})]})}:{context:{accept:c,onChange:g,maxSizeBytes:j,files:u},children:e(a,{className:i("jkl-file-input",p,{"jkl-file-input--has-files":y}),"data-layout-density":d,...k,children:l(n,{children:[u.length>0&&e("ul",{className:"jkl-file-input__files",children:m}),e("div",{className:"jkl-file-input__call-to-action",children:e(r,{id:f,label:h&&y?"Legg til flere filer":"Legg til fil",multiple:h,ref:o})})]})})})}));o.displayName="FileInput";export{o as FileInput};
1
+ import{jsx as e,jsxs as l}from"react/jsx-runtime";import{c as i}from"../../../clsx-BeLtu-UY.js";import{forwardRef as t}from"react";import{FieldGroup as a}from"../input-group/FieldGroup.js";import{Dropzone as n}from"./internal/Dropzone.js";import{FileInputContextProvider as s}from"./internal/fileInputContext.js";import{Input as r}from"./internal/Input.js";const o=t(((t,o)=>{const{accept:c,className:p,children:m,id:f,value:u,density:d,multiple:h=!0,maxSizeBytes:j,onChange:g,variant:x,...k}=t,y=u.length>0;return e(s,"small"===x?{context:{accept:c,onChange:g,maxSizeBytes:j,files:u},children:l(a,{className:i("jkl-file-input","jkl-file-input--small",p,{"jkl-file-input--has-files":y}),"data-layout-density":d||"compact",...k,children:[e(n,{children:e("div",{className:"jkl-file-input__call-to-action",children:e(r,{id:f,label:"Legg til fil",multiple:h,ref:o})})}),u.length>0&&e("ul",{className:"jkl-file-input__files",children:m})]})}:{context:{accept:c,onChange:g,maxSizeBytes:j,files:u},children:e(a,{className:i("jkl-file-input",p,{"jkl-file-input--has-files":y}),"data-layout-density":d,...k,children:l(n,{children:[u.length>0&&e("ul",{className:"jkl-file-input__files",children:m}),e("div",{className:"jkl-file-input__call-to-action",children:e(r,{id:f,label:h&&y?"Legg til flere filer":"Legg til fil",multiple:h,ref:o})})]})})})}));o.displayName="FileInput";export{o as FileInput};
2
2
  //# sourceMappingURL=FileInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FileInput.js","sources":["../../../../src/components/file-input/FileInput.tsx"],"sourcesContent":["import cn from \"classnames\";\nimport React, { forwardRef } from \"react\";\nimport {\n FieldGroup,\n type FieldGroupProps,\n} from \"../../components/input-group/FieldGroup.js\";\nimport { type Density } from \"../../core/types.js\";\nimport { Dropzone } from \"./internal/Dropzone.js\";\nimport { FileInputContextProvider } from \"./internal/fileInputContext.js\";\nimport { Input } from \"./internal/Input.js\";\nimport { FileInputFile } from \"./types.js\";\n\nexport interface FileInputProps extends Omit<FieldGroupProps, \"onChange\"> {\n className?: string;\n id?: string;\n density?: Density;\n /**\n * En string som begrenser hvilke filtyper som kan velges.\n *\n * Flere filtyper kan defineres som en kommaseparert liste.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept\n */\n accept?: \"image/*\" | \".pdf\" | \"image/*,.pdf\" | HTMLInputElement[\"accept\"];\n maxSizeBytes?: number;\n /**\n * @default true\n */\n multiple?: boolean;\n value: FileInputFile[];\n variant?: \"flexible\" | \"small\";\n onChange: (\n e:\n | React.ChangeEvent<HTMLInputElement>\n | React.DragEvent<HTMLDivElement>,\n files: FileInputFile[],\n ) => void;\n}\n\nexport const FileInput = forwardRef<HTMLInputElement, FileInputProps>(\n (props, ref) => {\n const {\n accept,\n className,\n children,\n id,\n value,\n density,\n multiple = true,\n maxSizeBytes,\n onChange,\n variant,\n ...rest\n } = props;\n\n const hasFiles = value.length > 0;\n\n if (variant === \"small\") {\n return (\n <FileInputContextProvider\n context={{ accept, onChange, maxSizeBytes, files: value }}\n >\n <FieldGroup\n className={cn(\n \"jkl-file-input\",\n \"jkl-file-input--small\",\n className,\n {\n \"jkl-file-input--has-files\": hasFiles,\n },\n )}\n data-layout-density={density ? density : \"compact\"}\n {...rest}\n >\n <Dropzone>\n <div className=\"jkl-file-input__call-to-action\">\n <Input\n id={id}\n label=\"Legg til fil\"\n multiple={multiple}\n ref={ref}\n />\n </div>\n </Dropzone>\n {value.length > 0 && (\n <ul className=\"jkl-file-input__files\">\n {children}\n </ul>\n )}\n </FieldGroup>\n </FileInputContextProvider>\n );\n }\n\n return (\n <FileInputContextProvider\n context={{ accept, onChange, maxSizeBytes, files: value }}\n >\n <FieldGroup\n className={cn(\"jkl-file-input\", className, {\n \"jkl-file-input--has-files\": hasFiles,\n })}\n data-layout-density={density}\n {...rest}\n >\n <Dropzone>\n {value.length > 0 && (\n <ul className=\"jkl-file-input__files\">\n {children}\n </ul>\n )}\n <div className=\"jkl-file-input__call-to-action\">\n <Input\n id={id}\n label={\n multiple && hasFiles\n ? \"Legg til flere filer\"\n : \"Legg til fil\"\n }\n multiple={multiple}\n ref={ref}\n />\n </div>\n </Dropzone>\n </FieldGroup>\n </FileInputContextProvider>\n );\n },\n);\n\nFileInput.displayName = \"FileInput\";\n"],"names":["FileInput","forwardRef","props","ref","accept","className","children","id","value","density","multiple","maxSizeBytes","onChange","variant","rest","hasFiles","length","jsx","FileInputContextProvider","context","files","jsxs","FieldGroup","cn","Dropzone","Input","label","displayName"],"mappings":"iVAuCO,MAAMA,EAAYC,GACrB,CAACC,EAAOC,KACE,MACFC,OAAAA,EACAC,UAAAA,EACAC,SAAAA,EACAC,GAAAA,EACAC,MAAAA,EACAC,QAAAA,EACAC,SAAAA,GAAW,EACXC,aAAAA,EACAC,SAAAA,EACAC,QAAAA,KACGC,GACHZ,EAEEa,EAAWP,EAAMQ,OAAS,EAE5BH,OAEII,EAACC,EAFO,UAAZL,EAEK,CACGM,QAAS,CAAEf,OAAAA,EAAQQ,SAAAA,EAAUD,aAAAA,EAAcS,MAAOZ,GAElDF,SAAAe,EAACC,EAAA,CACGjB,UAAWkB,EACP,iBACA,wBACAlB,EACA,CACI,4BAA6BU,IAGrC,sBAAqBN,GAAoB,aACrCK,EAEJR,SAAA,CAAAW,EAACO,EACG,CAAAlB,SAAAW,EAAC,MAAI,CAAAZ,UAAU,iCACXC,SAAAW,EAACQ,EAAA,CACGlB,GAAAA,EACAmB,MAAM,eACNhB,SAAAA,EACAP,IAAAA,QAIXK,EAAMQ,OAAS,KACX,KAAG,CAAAX,UAAU,wBACTC,SAAAA,QASpB,CACGa,QAAS,CAAEf,OAAAA,EAAQQ,SAAAA,EAAUD,aAAAA,EAAcS,MAAOZ,GAElDF,SAAAW,EAACK,EAAA,CACGjB,UAAWkB,EAAG,iBAAkBlB,EAAW,CACvC,4BAA6BU,IAEjC,sBAAqBN,KACjBK,EAEJR,WAACkB,EACI,CAAAlB,SAAA,CAAAE,EAAMQ,OAAS,GACZC,EAAC,KAAG,CAAAZ,UAAU,wBACTC,SAAAA,IAGTW,EAAC,MAAI,CAAAZ,UAAU,iCACXC,SAAAW,EAACQ,EAAA,CACGlB,GAAAA,EACAmB,MACIhB,GAAYK,EACN,uBACA,eAEVL,SAAAA,EACAP,IAAAA,YAIhB,IAMhBH,EAAU2B,YAAc"}
1
+ {"version":3,"file":"FileInput.js","sources":["../../../../src/components/file-input/FileInput.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { forwardRef } from \"react\";\nimport {\n FieldGroup,\n type FieldGroupProps,\n} from \"../../components/input-group/FieldGroup.js\";\nimport { type Density } from \"../../core/types.js\";\nimport { Dropzone } from \"./internal/Dropzone.js\";\nimport { FileInputContextProvider } from \"./internal/fileInputContext.js\";\nimport { Input } from \"./internal/Input.js\";\nimport { FileInputFile } from \"./types.js\";\n\nexport interface FileInputProps extends Omit<FieldGroupProps, \"onChange\"> {\n className?: string;\n id?: string;\n density?: Density;\n /**\n * En string som begrenser hvilke filtyper som kan velges.\n *\n * Flere filtyper kan defineres som en kommaseparert liste.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept\n */\n accept?: \"image/*\" | \".pdf\" | \"image/*,.pdf\" | HTMLInputElement[\"accept\"];\n maxSizeBytes?: number;\n /**\n * @default true\n */\n multiple?: boolean;\n value: FileInputFile[];\n variant?: \"flexible\" | \"small\";\n onChange: (\n e:\n | React.ChangeEvent<HTMLInputElement>\n | React.DragEvent<HTMLDivElement>,\n files: FileInputFile[],\n ) => void;\n}\n\nexport const FileInput = forwardRef<HTMLInputElement, FileInputProps>(\n (props, ref) => {\n const {\n accept,\n className,\n children,\n id,\n value,\n density,\n multiple = true,\n maxSizeBytes,\n onChange,\n variant,\n ...rest\n } = props;\n\n const hasFiles = value.length > 0;\n\n if (variant === \"small\") {\n return (\n <FileInputContextProvider\n context={{ accept, onChange, maxSizeBytes, files: value }}\n >\n <FieldGroup\n className={clsx(\n \"jkl-file-input\",\n \"jkl-file-input--small\",\n className,\n {\n \"jkl-file-input--has-files\": hasFiles,\n },\n )}\n data-layout-density={density ? density : \"compact\"}\n {...rest}\n >\n <Dropzone>\n <div className=\"jkl-file-input__call-to-action\">\n <Input\n id={id}\n label=\"Legg til fil\"\n multiple={multiple}\n ref={ref}\n />\n </div>\n </Dropzone>\n {value.length > 0 && (\n <ul className=\"jkl-file-input__files\">\n {children}\n </ul>\n )}\n </FieldGroup>\n </FileInputContextProvider>\n );\n }\n\n return (\n <FileInputContextProvider\n context={{ accept, onChange, maxSizeBytes, files: value }}\n >\n <FieldGroup\n className={clsx(\"jkl-file-input\", className, {\n \"jkl-file-input--has-files\": hasFiles,\n })}\n data-layout-density={density}\n {...rest}\n >\n <Dropzone>\n {value.length > 0 && (\n <ul className=\"jkl-file-input__files\">\n {children}\n </ul>\n )}\n <div className=\"jkl-file-input__call-to-action\">\n <Input\n id={id}\n label={\n multiple && hasFiles\n ? \"Legg til flere filer\"\n : \"Legg til fil\"\n }\n multiple={multiple}\n ref={ref}\n />\n </div>\n </Dropzone>\n </FieldGroup>\n </FileInputContextProvider>\n );\n },\n);\n\nFileInput.displayName = \"FileInput\";\n"],"names":["FileInput","forwardRef","props","ref","accept","className","children","id","value","density","multiple","maxSizeBytes","onChange","variant","rest","hasFiles","length","jsx","FileInputContextProvider","context","files","jsxs","FieldGroup","clsx","Dropzone","Input","label","displayName"],"mappings":"qWAuCO,MAAMA,EAAYC,GACrB,CAACC,EAAOC,KACE,MACFC,OAAAA,EACAC,UAAAA,EACAC,SAAAA,EACAC,GAAAA,EACAC,MAAAA,EACAC,QAAAA,EACAC,SAAAA,GAAW,EACXC,aAAAA,EACAC,SAAAA,EACAC,QAAAA,KACGC,GACHZ,EAEEa,EAAWP,EAAMQ,OAAS,EAE5BH,OAEII,EAACC,EAFO,UAAZL,EAEK,CACGM,QAAS,CAAEf,OAAAA,EAAQQ,SAAAA,EAAUD,aAAAA,EAAcS,MAAOZ,GAElDF,SAAAe,EAACC,EAAA,CACGjB,UAAWkB,EACP,iBACA,wBACAlB,EACA,CACI,4BAA6BU,IAGrC,sBAAqBN,GAAoB,aACrCK,EAEJR,SAAA,CAAAW,EAACO,EACG,CAAAlB,SAAAW,EAAC,MAAI,CAAAZ,UAAU,iCACXC,SAAAW,EAACQ,EAAA,CACGlB,GAAAA,EACAmB,MAAM,eACNhB,SAAAA,EACAP,IAAAA,QAIXK,EAAMQ,OAAS,KACX,KAAG,CAAAX,UAAU,wBACTC,SAAAA,QASpB,CACGa,QAAS,CAAEf,OAAAA,EAAQQ,SAAAA,EAAUD,aAAAA,EAAcS,MAAOZ,GAElDF,SAAAW,EAACK,EAAA,CACGjB,UAAWkB,EAAK,iBAAkBlB,EAAW,CACzC,4BAA6BU,IAEjC,sBAAqBN,KACjBK,EAEJR,WAACkB,EACI,CAAAlB,SAAA,CAAAE,EAAMQ,OAAS,GACZC,EAAC,KAAG,CAAAZ,UAAU,wBACTC,SAAAA,IAGTW,EAAC,MAAI,CAAAZ,UAAU,iCACXC,SAAAW,EAACQ,EAAA,CACGlB,GAAAA,EACAmB,MACIhB,GAAYK,EACN,uBACA,eAEVL,SAAAA,EACAP,IAAAA,YAIhB,IAMhBH,EAAU2B,YAAc"}
@@ -1,2 +1,2 @@
1
- import{jsx as e}from"react/jsx-runtime";import r from"classnames";import{forwardRef as t,useState as a}from"react";import{useFileInputContext as n}from"./fileInputContext.js";import{validateFile as o}from"./validateFile.js";const i=t(((t,i)=>{const{children:s,...l}=t,[p,f]=a(""),d=n();if(!d)return e("p",{children:"Dropzone must be placed inside a FileInputContextProvider."});const{maxSizeBytes:m,accept:u,onChange:c}=d;return e("div",{...l,ref:i,className:r("jkl-file-input__dropzone",p),onDragEnter:e=>{f("jkl-file-input__dropzone--enter"),e.preventDefault()},onDragOver:e=>{f("jkl-file-input__dropzone--enter"),e.preventDefault()},onDrop:e=>{e.preventDefault(),f(""),e.dataTransfer.files&&c(e,[...e.dataTransfer.files].map((e=>({file:e,state:"SELECTED",validation:o(e,u,m),uploadProgress:0}))))},onDragLeave:e=>{f(""),e.preventDefault()},children:s})}));i.displayName="Dropzone";export{i as Dropzone};
1
+ import{jsx as e}from"react/jsx-runtime";import{c as r}from"../../../../clsx-BeLtu-UY.js";import{forwardRef as t,useState as a}from"react";import{useFileInputContext as n}from"./fileInputContext.js";import{validateFile as o}from"./validateFile.js";const i=t(((t,i)=>{const{children:s,...l}=t,[p,f]=a(""),d=n();if(!d)return e("p",{children:"Dropzone must be placed inside a FileInputContextProvider."});const{maxSizeBytes:u,accept:m,onChange:c}=d;return e("div",{...l,ref:i,className:r("jkl-file-input__dropzone",p),onDragEnter:e=>{f("jkl-file-input__dropzone--enter"),e.preventDefault()},onDragOver:e=>{f("jkl-file-input__dropzone--enter"),e.preventDefault()},onDrop:e=>{e.preventDefault(),f(""),e.dataTransfer.files&&c(e,[...e.dataTransfer.files].map((e=>({file:e,state:"SELECTED",validation:o(e,m,u),uploadProgress:0}))))},onDragLeave:e=>{f(""),e.preventDefault()},children:s})}));i.displayName="Dropzone";export{i as Dropzone};
2
2
  //# sourceMappingURL=Dropzone.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Dropzone.js","sources":["../../../../../src/components/file-input/internal/Dropzone.tsx"],"sourcesContent":["import cn from \"classnames\";\nimport React, { forwardRef, useState } from \"react\";\nimport { WithChildren } from \"../../../core/types.js\";\nimport { FileInputFile } from \"../types.js\";\nimport { useFileInputContext } from \"./fileInputContext.js\";\nimport { validateFile } from \"./validateFile.js\";\n\ninterface DropzoneProps extends WithChildren {}\n\nexport const Dropzone = forwardRef<HTMLDivElement, DropzoneProps>(\n (props, ref) => {\n const { children, ...rest } = props;\n const [onDragClassName, setOnDragClassName] = useState<string>(\"\");\n\n const context = useFileInputContext();\n if (!context) {\n return (\n <p>\n Dropzone must be placed inside a FileInputContextProvider.\n </p>\n );\n }\n const { maxSizeBytes, accept, onChange } = context;\n\n return (\n <div\n {...rest}\n ref={ref}\n className={cn(\"jkl-file-input__dropzone\", onDragClassName)}\n onDragEnter={(e) => {\n setOnDragClassName(\"jkl-file-input__dropzone--enter\");\n e.preventDefault();\n }}\n onDragOver={(e) => {\n /* Prevent browser from opening file in a new tab */\n setOnDragClassName(\"jkl-file-input__dropzone--enter\");\n e.preventDefault();\n }}\n onDrop={(e) => {\n e.preventDefault();\n setOnDragClassName(\"\");\n\n if (e.dataTransfer.files) {\n onChange(\n e,\n [...e.dataTransfer.files].map<FileInputFile>(\n (file) => ({\n file,\n state: \"SELECTED\",\n validation: validateFile(\n file,\n accept,\n maxSizeBytes,\n ),\n uploadProgress: 0,\n }),\n ),\n );\n }\n }}\n onDragLeave={(e) => {\n setOnDragClassName(\"\");\n e.preventDefault();\n }}\n >\n {children}\n </div>\n );\n },\n);\n\nDropzone.displayName = \"Dropzone\";\n"],"names":["Dropzone","forwardRef","props","ref","children","rest","onDragClassName","setOnDragClassName","useState","context","useFileInputContext","jsx","maxSizeBytes","accept","onChange","className","cn","onDragEnter","e","preventDefault","onDragOver","onDrop","dataTransfer","files","map","file","state","validation","validateFile","uploadProgress","onDragLeave","displayName"],"mappings":"gOASO,MAAMA,EAAWC,GACpB,CAACC,EAAOC,KACJ,MAAQC,SAAAA,KAAaC,GAASH,GACvBI,EAAiBC,GAAsBC,EAAiB,IAEzDC,EAAUC,IAChB,IAAKD,EAEG,OAAAE,EAAC,KAAEP,SAEH,+DAGR,MAAQQ,aAAAA,EAAcC,OAAAA,EAAQC,SAAAA,GAAaL,EAGvC,OAAAE,EAAC,MAAA,IACON,EACJF,IAAAA,EACAY,UAAWC,EAAG,2BAA4BV,GAC1CW,YAAcC,IACVX,EAAmB,mCACnBW,EAAEC,gBAAe,EAErBC,WAAaF,IAETX,EAAmB,mCACnBW,EAAEC,gBAAe,EAErBE,OAASH,IACLA,EAAEC,iBACFZ,EAAmB,IAEfW,EAAEI,aAAaC,OACfT,EACII,EACA,IAAIA,EAAEI,aAAaC,OAAOC,KACrBC,IAAU,CACPA,KAAAA,EACAC,MAAO,WACPC,WAAYC,EACRH,EACAZ,EACAD,GAEJiB,eAAgB,MAExB,EAIZC,YAAcZ,IACVX,EAAmB,IACnBW,EAAEC,gBAAe,EAGpBf,SAAAA,GAAA,IAMjBJ,EAAS+B,YAAc"}
1
+ {"version":3,"file":"Dropzone.js","sources":["../../../../../src/components/file-input/internal/Dropzone.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { forwardRef, useState } from \"react\";\nimport { WithChildren } from \"../../../core/types.js\";\nimport { FileInputFile } from \"../types.js\";\nimport { useFileInputContext } from \"./fileInputContext.js\";\nimport { validateFile } from \"./validateFile.js\";\n\ninterface DropzoneProps extends WithChildren {}\n\nexport const Dropzone = forwardRef<HTMLDivElement, DropzoneProps>(\n (props, ref) => {\n const { children, ...rest } = props;\n const [onDragClassName, setOnDragClassName] = useState<string>(\"\");\n\n const context = useFileInputContext();\n if (!context) {\n return (\n <p>\n Dropzone must be placed inside a FileInputContextProvider.\n </p>\n );\n }\n const { maxSizeBytes, accept, onChange } = context;\n\n return (\n <div\n {...rest}\n ref={ref}\n className={clsx(\"jkl-file-input__dropzone\", onDragClassName)}\n onDragEnter={(e) => {\n setOnDragClassName(\"jkl-file-input__dropzone--enter\");\n e.preventDefault();\n }}\n onDragOver={(e) => {\n /* Prevent browser from opening file in a new tab */\n setOnDragClassName(\"jkl-file-input__dropzone--enter\");\n e.preventDefault();\n }}\n onDrop={(e) => {\n e.preventDefault();\n setOnDragClassName(\"\");\n\n if (e.dataTransfer.files) {\n onChange(\n e,\n [...e.dataTransfer.files].map<FileInputFile>(\n (file) => ({\n file,\n state: \"SELECTED\",\n validation: validateFile(\n file,\n accept,\n maxSizeBytes,\n ),\n uploadProgress: 0,\n }),\n ),\n );\n }\n }}\n onDragLeave={(e) => {\n setOnDragClassName(\"\");\n e.preventDefault();\n }}\n >\n {children}\n </div>\n );\n },\n);\n\nDropzone.displayName = \"Dropzone\";\n"],"names":["Dropzone","forwardRef","props","ref","children","rest","onDragClassName","setOnDragClassName","useState","context","useFileInputContext","jsx","maxSizeBytes","accept","onChange","className","clsx","onDragEnter","e","preventDefault","onDragOver","onDrop","dataTransfer","files","map","file","state","validation","validateFile","uploadProgress","onDragLeave","displayName"],"mappings":"uPASO,MAAMA,EAAWC,GACpB,CAACC,EAAOC,KACJ,MAAQC,SAAAA,KAAaC,GAASH,GACvBI,EAAiBC,GAAsBC,EAAiB,IAEzDC,EAAUC,IAChB,IAAKD,EAEG,OAAAE,EAAC,KAAEP,SAEH,+DAGR,MAAQQ,aAAAA,EAAcC,OAAAA,EAAQC,SAAAA,GAAaL,EAGvC,OAAAE,EAAC,MAAA,IACON,EACJF,IAAAA,EACAY,UAAWC,EAAK,2BAA4BV,GAC5CW,YAAcC,IACVX,EAAmB,mCACnBW,EAAEC,gBAAe,EAErBC,WAAaF,IAETX,EAAmB,mCACnBW,EAAEC,gBAAe,EAErBE,OAASH,IACLA,EAAEC,iBACFZ,EAAmB,IAEfW,EAAEI,aAAaC,OACfT,EACII,EACA,IAAIA,EAAEI,aAAaC,OAAOC,KACrBC,IAAU,CACPA,KAAAA,EACAC,MAAO,WACPC,WAAYC,EACRH,EACAZ,EACAD,GAEJiB,eAAgB,MAExB,EAIZC,YAAcZ,IACVX,EAAmB,IACnBW,EAAEC,gBAAe,EAGpBf,SAAAA,GAAA,IAMjBJ,EAAS+B,YAAc"}
@@ -1,2 +1,2 @@
1
- import{jsxs as e,jsx as l}from"react/jsx-runtime";import a from"classnames";const i=i=>{const{fileName:s,fileType:t,path:r,file:m,state:c,children:n}=i,h=a("jkl-file__thumbnail",{"jkl-file__thumbnail--selected":"SELECTED"===c,"jkl-file__thumbnail--uploading":"UPLOADING"===c});return t.startsWith("image/")?e("div",{className:"jkl-file__thumbnail-wrapper",children:[l("img",{className:h,src:m?URL.createObjectURL(m):r,alt:""}),n]}):l("div",{className:h,children:l("p",{children:s.split(".").at(-1)})})};export{i as Thumbnail};
1
+ import{jsxs as e,jsx as l}from"react/jsx-runtime";import{c as a}from"../../../../clsx-BeLtu-UY.js";const i=i=>{const{fileName:s,fileType:t,path:r,file:c,state:m,children:n}=i,h=a("jkl-file__thumbnail",{"jkl-file__thumbnail--selected":"SELECTED"===m,"jkl-file__thumbnail--uploading":"UPLOADING"===m});return t.startsWith("image/")?e("div",{className:"jkl-file__thumbnail-wrapper",children:[l("img",{className:h,src:c?URL.createObjectURL(c):r,alt:""}),n]}):l("div",{className:h,children:l("p",{children:s.split(".").at(-1)})})};export{i as Thumbnail};
2
2
  //# sourceMappingURL=Thumbnail.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Thumbnail.js","sources":["../../../../../src/components/file-input/internal/Thumbnail.tsx"],"sourcesContent":["import cn from \"classnames\";\nimport React, { FC } from \"react\";\nimport type { WithOptionalChildren } from \"../../../core/types.js\";\nimport { FileInputFileState } from \"../types.js\";\n\nexport interface ThumbnailProps extends WithOptionalChildren {\n fileName: string;\n fileType: string;\n path?: string;\n file?: File;\n state?: FileInputFileState;\n}\n\nexport const Thumbnail: FC<ThumbnailProps> = (props) => {\n const { fileName, fileType, path, file, state, children } = props;\n\n const classNames = cn(\"jkl-file__thumbnail\", {\n \"jkl-file__thumbnail--selected\": state === \"SELECTED\",\n \"jkl-file__thumbnail--uploading\": state === \"UPLOADING\",\n });\n\n if (fileType.startsWith(\"image/\")) {\n return (\n <div className=\"jkl-file__thumbnail-wrapper\">\n <img\n className={classNames}\n src={file ? URL.createObjectURL(file) : path}\n alt=\"\"\n />\n {children}\n </div>\n );\n }\n\n return (\n <div className={classNames}>\n <p>{fileName.split(\".\").at(-1)}</p>\n </div>\n );\n};\n"],"names":["Thumbnail","props","fileName","fileType","path","file","state","children","classNames","cn","startsWith","jsxs","className","jsx","src","URL","createObjectURL","alt","split","at"],"mappings":"4EAaa,MAAAA,EAAiCC,IAC1C,MAAQC,SAAAA,EAAUC,SAAAA,EAAUC,KAAAA,EAAMC,KAAAA,EAAMC,MAAAA,EAAOC,SAAAA,GAAaN,EAEtDO,EAAaC,EAAG,sBAAuB,CACzC,gCAA2C,aAAVH,EACjC,iCAA4C,cAAVA,IAGlCH,OAAAA,EAASO,WAAW,UAEhBC,EAAC,MAAI,CAAAC,UAAU,8BACXL,SAAA,CAAAM,EAAC,MAAA,CACGD,UAAWJ,EACXM,IAAKT,EAAOU,IAAIC,gBAAgBX,GAAQD,EACxCa,IAAI,KAEPV,KAMRM,EAAA,MAAA,CAAID,UAAWJ,EACZD,SAACM,EAAA,IAAA,CAAGN,SAASL,EAAAgB,MAAM,KAAKC,IAAK,MACjC"}
1
+ {"version":3,"file":"Thumbnail.js","sources":["../../../../../src/components/file-input/internal/Thumbnail.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { FC } from \"react\";\nimport type { WithOptionalChildren } from \"../../../core/types.js\";\nimport { FileInputFileState } from \"../types.js\";\n\nexport interface ThumbnailProps extends WithOptionalChildren {\n fileName: string;\n fileType: string;\n path?: string;\n file?: File;\n state?: FileInputFileState;\n}\n\nexport const Thumbnail: FC<ThumbnailProps> = (props) => {\n const { fileName, fileType, path, file, state, children } = props;\n\n const classNames = clsx(\"jkl-file__thumbnail\", {\n \"jkl-file__thumbnail--selected\": state === \"SELECTED\",\n \"jkl-file__thumbnail--uploading\": state === \"UPLOADING\",\n });\n\n if (fileType.startsWith(\"image/\")) {\n return (\n <div className=\"jkl-file__thumbnail-wrapper\">\n <img\n className={classNames}\n src={file ? URL.createObjectURL(file) : path}\n alt=\"\"\n />\n {children}\n </div>\n );\n }\n\n return (\n <div className={classNames}>\n <p>{fileName.split(\".\").at(-1)}</p>\n </div>\n );\n};\n"],"names":["Thumbnail","props","fileName","fileType","path","file","state","children","classNames","clsx","startsWith","jsxs","className","jsx","src","URL","createObjectURL","alt","split","at"],"mappings":"mGAaa,MAAAA,EAAiCC,IAC1C,MAAQC,SAAAA,EAAUC,SAAAA,EAAUC,KAAAA,EAAMC,KAAAA,EAAMC,MAAAA,EAAOC,SAAAA,GAAaN,EAEtDO,EAAaC,EAAK,sBAAuB,CAC3C,gCAA2C,aAAVH,EACjC,iCAA4C,cAAVA,IAGlCH,OAAAA,EAASO,WAAW,UAEhBC,EAAC,MAAI,CAAAC,UAAU,8BACXL,SAAA,CAAAM,EAAC,MAAA,CACGD,UAAWJ,EACXM,IAAKT,EAAOU,IAAIC,gBAAgBX,GAAQD,EACxCa,IAAI,KAEPV,KAMRM,EAAA,MAAA,CAAID,UAAWJ,EACZD,SAACM,EAAA,IAAA,CAAGN,SAASL,EAAAgB,MAAM,KAAKC,IAAK,MACjC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fremtind/jokul",
3
- "version": "0.31.1",
3
+ "version": "0.31.2",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -546,5 +546,5 @@
546
546
  "@babel/preset-react"
547
547
  ]
548
548
  },
549
- "gitHead": "27c9715cd08b9cd61551ac018ecd0b249e06fe3e"
549
+ "gitHead": "72e0a41a4018204012fe7d544bbbe24ef16174f8"
550
550
  }
@@ -139,7 +139,7 @@
139
139
  height: 1rem;
140
140
  }
141
141
  html[data-touchnavigation] .jkl-button.jkl-button--pressed::before {
142
- animation: cubic-bezier(0.6, 0.2, 0.35, 1) 250ms jkl-tertiary-flash-um5a19d;
142
+ animation: cubic-bezier(0.6, 0.2, 0.35, 1) 250ms jkl-tertiary-flash-u8muegh;
143
143
  }
144
144
  :not([data-touchnavigation]) .jkl-button--primary:hover, :not([data-touchnavigation]) .jkl-button--secondary:hover, :not([data-touchnavigation]) .jkl-button--tertiary:hover {
145
145
  scale: 1.05;
@@ -183,7 +183,7 @@ html[data-touchnavigation] .jkl-button.jkl-button--pressed::before {
183
183
  --background-color: var(--jkl-color-background-interactive-hover);
184
184
  }
185
185
 
186
- @keyframes jkl-tertiary-flash-um5a19d {
186
+ @keyframes jkl-tertiary-flash-u8muegh {
187
187
  0% {
188
188
  opacity: 0.5;
189
189
  scale: 1;