@mattilsynet/design 1.3.13 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/mtds/alert/alert.js.map +1 -1
- package/mtds/app/app-observer.js +1 -1
- package/mtds/app/app-observer.js.map +1 -1
- package/mtds/app/app.js.map +1 -1
- package/mtds/avatar/avatar.js.map +1 -1
- package/mtds/breadcrumbs/breadcrumbs.js.map +1 -1
- package/mtds/card/card.js.map +1 -1
- package/mtds/chip/chip.js.map +1 -1
- package/mtds/external/@u-elements/u-combobox/dist/u-combobox.js +86 -86
- package/mtds/external/@u-elements/u-combobox/dist/u-combobox.js.map +1 -1
- package/mtds/external/@u-elements/u-datalist/dist/u-datalist.js +2 -2
- package/mtds/external/@u-elements/u-datalist/dist/u-datalist.js.map +1 -1
- package/mtds/field/field-observer.js +35 -33
- package/mtds/field/field-observer.js.map +1 -1
- package/mtds/field/field.d.ts +2 -0
- package/mtds/field/field.js +95 -89
- package/mtds/field/field.js.map +1 -1
- package/mtds/index.d.ts +2 -2
- package/mtds/index.iife.js +6 -6
- package/mtds/index.js +11 -11
- package/mtds/logo/logo.js.map +1 -1
- package/mtds/package.json.js +1 -1
- package/mtds/popover/popover-observer.js.map +1 -1
- package/mtds/popover/popover.js.map +1 -1
- package/mtds/skeleton/skeleton.js.map +1 -1
- package/mtds/styles.css +1 -1
- package/mtds/tag/tag.js.map +1 -1
- package/mtds/typography/typography.js.map +1 -1
- package/package.json +3 -3
package/mtds/alert/alert.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert.js","sources":["../../designsystem/alert/alert.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { type JSX
|
|
1
|
+
{"version":3,"file":"alert.js","sources":["../../designsystem/alert/alert.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef, type JSX } from \"react\";\nimport type {\n\tPolymorphicComponentPropWithRef,\n\tPolymorphicRef,\n} from \"../react-types\";\nimport styles from \"../styles.module.css\";\n\nexport type AlertProps<As extends React.ElementType = \"output\"> =\n\tPolymorphicComponentPropWithRef<\n\t\tAs,\n\t\t{\n\t\t\t\"data-color\"?: \"info\" | \"success\" | \"warning\" | \"danger\" | \"neutral\";\n\t\t}\n\t>;\n\ntype AlertComponent = <As extends React.ElementType = \"output\">(\n\tprops: AlertProps<As>,\n) => JSX.Element;\n\nexport const Alert: AlertComponent = forwardRef<null>(function Alert<\n\tAs extends React.ElementType = \"output\",\n>({ as, className, ...rest }: AlertProps<As>, ref?: PolymorphicRef<As>) {\n\tconst Tag = as || \"output\";\n\n\tif (!rest.role && Tag !== \"output\") Object.assign(rest, { role: \"alert\" }); // Ensure role is set to 'alert' if not <output>\n\n\treturn <Tag className={clsx(styles.alert, className)} ref={ref} {...rest} />;\n}) as AlertComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n"],"names":["Alert","forwardRef","as","className","rest","ref","Tag","jsx","clsx","styles"],"mappings":";;;;AAoBa,MAAAA,IAAwBC,EAAiB,SAEpD,EAAE,IAAAC,GAAI,WAAAC,GAAW,GAAGC,EAAK,GAAmBC,GAA0B;AACvE,QAAMC,IAAMJ,KAAM;AAEd,SAAA,CAACE,EAAK,QAAQE,MAAQ,YAAiB,OAAA,OAAOF,GAAM,EAAE,MAAM,QAAA,CAAS,GAElE,gBAAAG,EAACD,GAAI,EAAA,WAAWE,EAAKC,EAAO,OAAON,CAAS,GAAG,KAAAE,GAAW,GAAGD,EAAM,CAAA;AAC3E,CAAC;"}
|
package/mtds/app/app-observer.js
CHANGED
|
@@ -9,7 +9,7 @@ const g = S.app.split(" ")[0], h = S.sticky.split(" ")[0], I = '[data-command="t
|
|
|
9
9
|
);
|
|
10
10
|
function k({ target: t, defaultPrevented: i }) {
|
|
11
11
|
const f = t?.closest?.("a");
|
|
12
|
-
if (f?.closest("dialog
|
|
12
|
+
if (f?.closest("dialog") && f?.closest(y))
|
|
13
13
|
return T();
|
|
14
14
|
if (i || !(t instanceof HTMLButtonElement) || !t.matches(I))
|
|
15
15
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-observer.js","sources":["../../designsystem/app/app-observer.ts"],"sourcesContent":["import styles from \"../styles.module.css\";\nimport { debounce, on, onLoaded, onMutation, QUICK_EVENT } from \"../utils\";\nimport \"./app-toggle\";\n\nconst CSS_APP = styles.app.split(\" \")[0];\nconst CSS_STICKY = styles.sticky.split(\" \")[0];\nconst CSS_TOGGLE = '[data-command=\"toggle-app-expanded\"]';\nconst CSS_SIDEBAR = `.${CSS_APP} > dialog,.${CSS_APP} dialog ~ main`;\n\nconst useTransition = (callback: () => void) => {\n\tif (!document.startViewTransition) callback();\n\telse document.startViewTransition(callback);\n};\n\nexport const toggleAppExpanded = (force?: boolean) =>\n\t// @ts-expect-error window.mtdsAppToggle comes from app-toggle.js\n\tuseTransition(() => window.mtdsToggleAppExpanded?.(force));\n\nfunction handleToggleClick({ target: el, defaultPrevented: stop }: Event) {\n\tconst link = (el as Element)?.closest?.(\"a\");\n\tif (link?.closest(\"dialog
|
|
1
|
+
{"version":3,"file":"app-observer.js","sources":["../../designsystem/app/app-observer.ts"],"sourcesContent":["import styles from \"../styles.module.css\";\nimport { debounce, on, onLoaded, onMutation, QUICK_EVENT } from \"../utils\";\nimport \"./app-toggle\";\n\nconst CSS_APP = styles.app.split(\" \")[0];\nconst CSS_STICKY = styles.sticky.split(\" \")[0];\nconst CSS_TOGGLE = '[data-command=\"toggle-app-expanded\"]';\nconst CSS_SIDEBAR = `.${CSS_APP} > dialog,.${CSS_APP} dialog ~ main`;\n\nconst useTransition = (callback: () => void) => {\n\tif (!document.startViewTransition) callback();\n\telse document.startViewTransition(callback);\n};\n\nexport const toggleAppExpanded = (force?: boolean) =>\n\t// @ts-expect-error window.mtdsAppToggle comes from app-toggle.js\n\tuseTransition(() => window.mtdsToggleAppExpanded?.(force));\n\nfunction handleToggleClick({ target: el, defaultPrevented: stop }: Event) {\n\tconst link = (el as Element)?.closest?.(\"a\");\n\tif (link?.closest(\"dialog\") && link?.closest(CSS_SIDEBAR))\n\t\treturn closeSidebar(); // Close sidebar if link is clicked inside sidebar\n\n\tif (stop || !(el instanceof HTMLButtonElement) || !el.matches(CSS_TOGGLE))\n\t\treturn;\n\tconst isDesktop = getComputedStyle(el).position === \"sticky\";\n\n\tif (isDesktop) toggleAppExpanded();\n\telse\n\t\tuseTransition(() => {\n\t\t\tconst sidebar = document.querySelector<HTMLDialogElement>(CSS_SIDEBAR);\n\t\t\tsidebar?.setAttribute(\"data-closedby\", \"any\"); // Allow closing by clicking outside\n\t\t\tsidebar?.showModal();\n\t\t});\n}\n\nfunction closeSidebar() {\n\tdocument.querySelector<HTMLDialogElement>(CSS_SIDEBAR)?.close();\n}\n\n// Scroll state\nlet MIN_Y = 0; // Offset to avoid scroll jump when sticky is set to relative\nlet SCROLL_UP: boolean;\nlet STICK = 0; // -1 = stick top, 0 = relative, 1 = stick bottom\nlet STICK_EL: HTMLElement;\nlet STICK_H = 0;\nlet STICK_Y = 0;\nlet STUCK = false; // Used to figure if nav is larger than viewport\nlet WIN_H = 0;\nlet WIN_Y = 0;\n\nfunction handleMutation([sticky]: HTMLCollectionOf<HTMLElement>) {\n\tSTICK_EL = sticky;\n\thandleScroll(); // Run on connect\n}\n\nfunction handleScroll() {\n\tif (!STICK_EL?.isConnected) return;\n\tconst NEXT_Y = window.scrollY;\n\tconst NEXT_UP = NEXT_Y < WIN_Y;\n\tWIN_Y = NEXT_Y;\n\n\t// Only calculate if scroll direction has changed\n\tif (NEXT_UP !== SCROLL_UP) {\n\t\tMIN_Y = (STICK_EL.parentElement?.getBoundingClientRect().top || 0) + WIN_Y;\n\t\tSCROLL_UP = NEXT_UP;\n\t\tSTICK_H = STICK_EL.offsetHeight;\n\t\tSTICK_Y = STICK_EL.getBoundingClientRect().top + WIN_Y;\n\t\tSTUCK = STICK_EL.offsetHeight <= window.innerHeight;\n\t\tWIN_H = window.innerHeight;\n\t}\n\n\tif (STICK === -1 && STUCK) return; // Allways sticky when sidebar is smaller than viewport\n\tif (STICK !== -1 && (STUCK || (SCROLL_UP && WIN_Y <= STICK_Y))) {\n\t\tSTICK_EL.style.setProperty(\"--pos\", \"sticky\");\n\t\tSTICK_EL.style.setProperty(\"--top\", \"0px\");\n\t\tSTICK = -1; // Not sticking to top and sidebar is smaller than viewport or scrolling up\n\t} else if (STICK === -1 && !SCROLL_UP) {\n\t\tSTICK_EL.style.setProperty(\"--pos\", \"relative\");\n\t\tSTICK_EL.style.setProperty(\"--top\", `${Math.max(0, WIN_Y - MIN_Y)}px`);\n\t\tSTICK = 0; // Sticking to top and scrolling down\n\t} else if (STICK !== 1 && !SCROLL_UP && WIN_Y + WIN_H >= STICK_Y + STICK_H) {\n\t\tSTICK_EL.style.setProperty(\"--pos\", \"sticky\");\n\t\tSTICK_EL.style.setProperty(\"--top\", `${WIN_H - STICK_H}px`);\n\t\tSTICK = 1; // Not sticking to bottom and scrolling down\n\t} else if (STICK === 1 && SCROLL_UP) {\n\t\tSTICK_EL.style.setProperty(\"--pos\", \"relative\");\n\t\tSTICK_EL.style.setProperty(\"--top\", `${STICK_Y - MIN_Y}px`);\n\t\tSTICK = 0; // Sticking to bottom and scrolling up\n\t}\n}\n\nonLoaded(() => {\n\tonMutation(document.documentElement, CSS_STICKY, handleMutation);\n\ton(document, \"click\", handleToggleClick, QUICK_EVENT);\n\ton(window, \"resize\", debounce(closeSidebar, 100), QUICK_EVENT);\n\ton(window, \"scroll\", handleScroll, QUICK_EVENT);\n});\n"],"names":["CSS_APP","styles","CSS_STICKY","CSS_TOGGLE","CSS_SIDEBAR","useTransition","callback","toggleAppExpanded","force","handleToggleClick","el","stop","link","closeSidebar","sidebar","MIN_Y","SCROLL_UP","STICK","STICK_EL","STICK_H","STICK_Y","STUCK","WIN_H","WIN_Y","handleMutation","sticky","handleScroll","NEXT_Y","NEXT_UP","onLoaded","onMutation","on","QUICK_EVENT","debounce"],"mappings":";;;AAIA,MAAMA,IAAUC,EAAO,IAAI,MAAM,GAAG,EAAE,CAAC,GACjCC,IAAaD,EAAO,OAAO,MAAM,GAAG,EAAE,CAAC,GACvCE,IAAa,wCACbC,IAAc,IAAIJ,CAAO,cAAcA,CAAO,kBAE9CK,IAAgB,CAACC,MAAyB;AAC3C,EAAC,SAAS,sBACT,SAAS,oBAAoBA,CAAQ,IADEA,EAAA;AAE7C,GAEaC,IAAoB,CAACC;AAAA;AAAA,EAEjCH,EAAc,MAAM,OAAO,wBAAwBG,CAAK,CAAC;AAAA;AAE1D,SAASC,EAAkB,EAAE,QAAQC,GAAI,kBAAkBC,KAAe;AACnE,QAAAC,IAAQF,GAAgB,UAAU,GAAG;AAC3C,MAAIE,GAAM,QAAQ,QAAQ,KAAKA,GAAM,QAAQR,CAAW;AACvD,WAAOS,EAAa;AAErB,MAAIF,KAAQ,EAAED,aAAc,sBAAsB,CAACA,EAAG,QAAQP,CAAU;AACvE;AAGD,EAFkB,iBAAiBO,CAAE,EAAE,aAAa,WAEnBH,EAAA,IAEhCF,EAAc,MAAM;AACb,UAAAS,IAAU,SAAS,cAAiCV,CAAW;AAC5D,IAAAU,GAAA,aAAa,iBAAiB,KAAK,GAC5CA,GAAS,UAAU;AAAA,EAAA,CACnB;AACH;AAEA,SAASD,IAAe;AACd,WAAA,cAAiCT,CAAW,GAAG,MAAM;AAC/D;AAGA,IAAIW,IAAQ,GACRC,GACAC,IAAQ,GACRC,GACAC,IAAU,GACVC,IAAU,GACVC,IAAQ,IACRC,IAAQ,GACRC,IAAQ;AAEZ,SAASC,EAAe,CAACC,CAAM,GAAkC;AACrD,EAAAP,IAAAO,GACEC,EAAA;AACd;AAEA,SAASA,IAAe;AACnB,MAAA,CAACR,GAAU,YAAa;AAC5B,QAAMS,IAAS,OAAO,SAChBC,IAAUD,IAASJ;AAarB,EAZIA,IAAAI,GAGJC,MAAYZ,MACfD,KAASG,EAAS,eAAe,sBAAsB,EAAE,OAAO,KAAKK,GACzDP,IAAAY,GACZT,IAAUD,EAAS,cACTE,IAAAF,EAAS,sBAAsB,EAAE,MAAMK,GACzCF,IAAAH,EAAS,gBAAgB,OAAO,aACxCI,IAAQ,OAAO,cAGZ,EAAAL,MAAU,MAAMI,OAChBJ,MAAU,OAAOI,KAAUL,KAAaO,KAASH,MAC3CF,EAAA,MAAM,YAAY,SAAS,QAAQ,GACnCA,EAAA,MAAM,YAAY,SAAS,KAAK,GACjCD,IAAA,MACEA,MAAU,MAAM,CAACD,KAClBE,EAAA,MAAM,YAAY,SAAS,UAAU,GACrCA,EAAA,MAAM,YAAY,SAAS,GAAG,KAAK,IAAI,GAAGK,IAAQR,CAAK,CAAC,IAAI,GAC7DE,IAAA,KACEA,MAAU,KAAK,CAACD,KAAaO,IAAQD,KAASF,IAAUD,KACzDD,EAAA,MAAM,YAAY,SAAS,QAAQ,GAC5CA,EAAS,MAAM,YAAY,SAAS,GAAGI,IAAQH,CAAO,IAAI,GAClDF,IAAA,KACEA,MAAU,KAAKD,MAChBE,EAAA,MAAM,YAAY,SAAS,UAAU,GAC9CA,EAAS,MAAM,YAAY,SAAS,GAAGE,IAAUL,CAAK,IAAI,GAClDE,IAAA;AAEV;AAEAY,EAAS,MAAM;AACH,EAAAC,EAAA,SAAS,iBAAiB5B,GAAYsB,CAAc,GAC5DO,EAAA,UAAU,SAAStB,GAAmBuB,CAAW,GACpDD,EAAG,QAAQ,UAAUE,EAASpB,GAAc,GAAG,GAAGmB,CAAW,GAC1DD,EAAA,QAAQ,UAAUL,GAAcM,CAAW;AAC/C,CAAC;"}
|
package/mtds/app/app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sources":["../../designsystem/app/app.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { type JSX
|
|
1
|
+
{"version":3,"file":"app.js","sources":["../../designsystem/app/app.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef, type JSX } from \"react\";\nimport { Button, type ButtonProps } from \"../react\";\nimport type {\n\tPolymorphicComponentPropWithRef,\n\tPolymorphicRef,\n} from \"../react-types\";\nimport styles from \"../styles.module.css\";\nimport script from \"./app-toggle.js?raw\";\n\nexport type AppHeaderProps = React.ComponentPropsWithoutRef<\"header\">;\nexport type AppSidebarProps = React.ComponentPropsWithoutRef<\"dialog\">;\nexport type AppStickyProps = React.ComponentPropsWithoutRef<\"div\">;\nexport type AppMainProps = React.ComponentPropsWithoutRef<\"main\">;\nexport type AppFooterProps = React.ComponentPropsWithoutRef<\"footer\">;\nexport type AppProps<As extends React.ElementType = \"div\"> =\n\tPolymorphicComponentPropWithRef<As>;\n\ntype AppComponent = <As extends React.ElementType = \"div\">(\n\tprops: AppProps<As>,\n) => JSX.Element;\n\nconst AppComp = forwardRef<null>(function App<\n\tAs extends React.ElementType = \"div\",\n>({ as, className, ...rest }: AppProps<As>, ref?: PolymorphicRef<As>) {\n\tconst Tag = as || \"div\";\n\n\treturn <Tag className={clsx(styles.app, className)} ref={ref} {...rest} />;\n}) as AppComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n\nconst AppSticky = forwardRef<null>(function App<\n\tAs extends React.ElementType = \"div\",\n>({ as, className, ...rest }: AppProps<As>, ref?: PolymorphicRef<As>) {\n\tconst Tag = as || \"div\";\n\n\treturn <Tag className={clsx(styles.sticky, className)} ref={ref} {...rest} />;\n}) as AppComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n\nexport const App = Object.assign(AppComp, {\n\tHeader: forwardRef<HTMLElement, AppHeaderProps>(\n\t\tfunction AppHeader(rest, ref) {\n\t\t\treturn <header ref={ref} {...rest} />;\n\t\t},\n\t),\n\tSidebar: forwardRef<HTMLDialogElement, AppSidebarProps>(\n\t\tfunction AppSidebar(rest, ref) {\n\t\t\treturn <dialog role=\"navigation\" ref={ref} {...rest} />;\n\t\t},\n\t),\n\tSticky: AppSticky,\n\tToggle: forwardRef<HTMLButtonElement, ButtonProps<\"button\">>(\n\t\tfunction AppToggle({ children, ...rest }: ButtonProps<\"button\">, ref) {\n\t\t\treturn (\n\t\t\t\t<Button\n\t\t\t\t\tdata-command=\"toggle-app-expanded\"\n\t\t\t\t\tdata-tooltip=\"Vis meny\"\n\t\t\t\t\tref={ref as React.Ref<HTMLAnchorElement>}\n\t\t\t\t\t{...rest}\n\t\t\t\t>\n\t\t\t\t\t{children ?? \"Skjul meny\"}\n\t\t\t\t</Button>\n\t\t\t);\n\t\t},\n\t),\n\tMain: forwardRef<HTMLElement, AppMainProps>(function AppMain(rest, ref) {\n\t\treturn <main ref={ref} {...rest} />;\n\t}),\n\tFooter: forwardRef<HTMLElement, AppFooterProps>(\n\t\tfunction AppFooter(rest, ref) {\n\t\t\treturn <footer ref={ref} {...rest} />;\n\t\t},\n\t),\n\t// Needed to avoid flash of unstyled content and still be Next.js hydration compatible\n\tScript: () => <script id=\"mtds-app-script\">{script}</script>,\n});\n"],"names":["AppComp","forwardRef","as","className","rest","ref","jsx","clsx","styles","AppSticky","App","children","Button","script"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAMA,IAAUC,EAAiB,SAE/B,EAAE,IAAAC,GAAI,WAAAC,GAAW,GAAGC,EAAK,GAAiBC,GAA0B;AAG9D,SAAA,gBAAAC,EAFKJ,KAAM,OAEN,EAAA,WAAWK,EAAKC,EAAO,KAAKL,CAAS,GAAG,KAAAE,GAAW,GAAGD,EAAM,CAAA;AACzE,CAAC,GAEKK,IAAYR,EAAiB,SAEjC,EAAE,IAAAC,GAAI,WAAAC,GAAW,GAAGC,EAAK,GAAiBC,GAA0B;AAG9D,SAAA,gBAAAC,EAFKJ,KAAM,OAEN,EAAA,WAAWK,EAAKC,EAAO,QAAQL,CAAS,GAAG,KAAAE,GAAW,GAAGD,EAAM,CAAA;AAC5E,CAAC,GAEYM,IAAM,OAAO,OAAOV,GAAS;AAAA,EACzC,QAAQC;AAAA,IACP,SAAmBG,GAAMC,GAAK;AAC7B,aAAQ,gBAAAC,EAAA,UAAA,EAAO,KAAAD,GAAW,GAAGD,EAAM,CAAA;AAAA,IAAA;AAAA,EAErC;AAAA,EACA,SAASH;AAAA,IACR,SAAoBG,GAAMC,GAAK;AAC9B,+BAAQ,UAAO,EAAA,MAAK,cAAa,KAAAA,GAAW,GAAGD,GAAM;AAAA,IAAA;AAAA,EAEvD;AAAA,EACA,QAAQK;AAAA,EACR,QAAQR;AAAA,IACP,SAAmB,EAAE,UAAAU,GAAU,GAAGP,EAAA,GAA+BC,GAAK;AAEpE,aAAA,gBAAAC;AAAA,QAACM;AAAA,QAAA;AAAA,UACA,gBAAa;AAAA,UACb,gBAAa;AAAA,UACb,KAAAP;AAAA,UACC,GAAGD;AAAA,UAEH,UAAYO,KAAA;AAAA,QAAA;AAAA,MACd;AAAA,IAAA;AAAA,EAGH;AAAA,EACA,MAAMV,EAAsC,SAAiBG,GAAMC,GAAK;AACvE,WAAQ,gBAAAC,EAAA,QAAA,EAAK,KAAAD,GAAW,GAAGD,EAAM,CAAA;AAAA,EAAA,CACjC;AAAA,EACD,QAAQH;AAAA,IACP,SAAmBG,GAAMC,GAAK;AAC7B,aAAQ,gBAAAC,EAAA,UAAA,EAAO,KAAAD,GAAW,GAAGD,EAAM,CAAA;AAAA,IAAA;AAAA,EAErC;AAAA;AAAA,EAEA,QAAQ,MAAM,gBAAAE,EAAC,UAAO,EAAA,IAAG,mBAAmB,UAAOO,EAAA,CAAA;AACpD,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar.js","sources":["../../designsystem/avatar/avatar.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { type JSX
|
|
1
|
+
{"version":3,"file":"avatar.js","sources":["../../designsystem/avatar/avatar.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef, type JSX } from \"react\";\nimport type {\n\tPolymorphicComponentPropWithRef,\n\tPolymorphicRef,\n} from \"../react-types\";\nimport styles from \"../styles.module.css\";\n\ntype AvatarBaseProps<Href> = {\n\thref?: Href;\n};\n\nexport type AvatarProps<\n\tHref,\n\tAs extends React.ElementType = Href extends string ? \"a\" : \"span\",\n> = PolymorphicComponentPropWithRef<As, AvatarBaseProps<Href>>;\n\ntype AvatarComponent = <\n\tHref,\n\tAs extends React.ElementType = Href extends string ? \"a\" : \"span\",\n>(\n\tprops: AvatarProps<Href, As>,\n) => JSX.Element;\n\nexport const Avatar: AvatarComponent = forwardRef<null>(function Avatar<\n\tHref,\n\tAs extends React.ElementType = Href extends string ? \"a\" : \"span\",\n>({ as, className, ...rest }: AvatarProps<Href, As>, ref?: PolymorphicRef<As>) {\n\tconst Tag = as || (rest.href ? \"a\" : \"span\");\n\n\treturn <Tag className={clsx(styles.avatar, className)} ref={ref} {...rest} />;\n}) as AvatarComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n"],"names":["Avatar","forwardRef","as","className","rest","ref","Tag","jsx","clsx","styles"],"mappings":";;;;AAwBa,MAAAA,IAA0BC,EAAiB,SAGtD,EAAE,IAAAC,GAAI,WAAAC,GAAW,GAAGC,EAAK,GAA0BC,GAA0B;AAC9E,QAAMC,IAAMJ,MAAOE,EAAK,OAAO,MAAM;AAE9B,SAAA,gBAAAG,EAACD,GAAI,EAAA,WAAWE,EAAKC,EAAO,QAAQN,CAAS,GAAG,KAAAE,GAAW,GAAGD,EAAM,CAAA;AAC5E,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumbs.js","sources":["../../designsystem/breadcrumbs/breadcrumbs.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { type JSX
|
|
1
|
+
{"version":3,"file":"breadcrumbs.js","sources":["../../designsystem/breadcrumbs/breadcrumbs.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef, type JSX } from \"react\";\nimport type {\n\tPolymorphicComponentPropWithRef,\n\tPolymorphicRef,\n} from \"../react-types\";\nimport styles from \"../styles.module.css\";\n\nexport type BreadcrumbsProps<As extends React.ElementType = \"nav\"> =\n\tPolymorphicComponentPropWithRef<As, { \"aria-label\"?: string }>;\n\ntype BreadcrumbsComponent = <As extends React.ElementType = \"nav\">(\n\tprops: BreadcrumbsProps<As>,\n) => JSX.Element;\n\nexport const Breadcrumbs: BreadcrumbsComponent = forwardRef<null>(\n\tfunction Breadcrumbs<As extends React.ElementType = \"nav\">(\n\t\t{ as, className, ...rest }: BreadcrumbsProps<As>,\n\t\tref?: PolymorphicRef<As>,\n\t) {\n\t\tconst Tag = as || \"nav\";\n\n\t\treturn (\n\t\t\t<Tag\n\t\t\t\taria-label={rest[\"aria-label\"] || \"Du er her:\"}\n\t\t\t\tclassName={clsx(styles.breadcrumbs, className)}\n\t\t\t\tref={ref}\n\t\t\t\t{...rest}\n\t\t\t/>\n\t\t);\n\t},\n) as BreadcrumbsComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n"],"names":["Breadcrumbs","forwardRef","as","className","rest","ref","jsx","clsx","styles"],"mappings":";;;;AAeO,MAAMA,IAAoCC;AAAA,EAChD,SACC,EAAE,IAAAC,GAAI,WAAAC,GAAW,GAAGC,KACpBC,GACC;AAIA,WAAA,gBAAAC;AAAA,MAHWJ,KAAM;AAAA,MAGhB;AAAA,QACA,cAAYE,EAAK,YAAY,KAAK;AAAA,QAClC,WAAWG,EAAKC,EAAO,aAAaL,CAAS;AAAA,QAC7C,KAAAE;AAAA,QACC,GAAGD;AAAA,MAAA;AAAA,IACL;AAAA,EAAA;AAGH;"}
|
package/mtds/card/card.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.js","sources":["../../designsystem/card/card.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { type JSX
|
|
1
|
+
{"version":3,"file":"card.js","sources":["../../designsystem/card/card.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef, type JSX } from \"react\";\nimport type {\n\tPolymorphicComponentPropWithRef,\n\tPolymorphicRef,\n} from \"../react-types\";\nimport styles from \"../styles.module.css\";\n\ntype CardBaseProps<Href> = {\n\thref?: Href;\n};\n\nexport type CardProps<\n\tHref,\n\tAs extends React.ElementType = Href extends string ? \"a\" : \"div\",\n> = PolymorphicComponentPropWithRef<As, CardBaseProps<Href>>;\n\ntype CardComponent = <\n\tHref,\n\tAs extends React.ElementType = Href extends string ? \"a\" : \"div\",\n>(\n\tprops: CardProps<Href, As>,\n) => JSX.Element;\n\nexport const Card: CardComponent = forwardRef<null>(function Card<\n\tHref,\n\tAs extends React.ElementType = Href extends string ? \"a\" : \"div\",\n>({ as, className, ...rest }: CardProps<Href, As>, ref?: PolymorphicRef<As>) {\n\tconst Tag = as || (rest.href ? \"a\" : \"div\");\n\n\treturn <Tag className={clsx(styles.card, className)} ref={ref} {...rest} />;\n}) as CardComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n\nexport type GroupProps<As extends React.ElementType = \"div\"> =\n\tPolymorphicComponentPropWithRef<As>;\n\ntype GroupComponent = <As extends React.ElementType = \"div\">(\n\tprops: GroupProps<As>,\n) => JSX.Element;\n\nexport const Group: GroupComponent = forwardRef<null>(function Group<\n\tAs extends React.ElementType = \"div\",\n>({ as, className, ...rest }: GroupProps<As>, ref?: PolymorphicRef<As>) {\n\tconst Tag = as || \"div\";\n\n\treturn <Tag className={clsx(styles.group, className)} ref={ref} {...rest} />;\n}) as GroupComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n"],"names":["Card","forwardRef","as","className","rest","ref","Tag","jsx","clsx","styles","Group"],"mappings":";;;;AAwBa,MAAAA,IAAsBC,EAAiB,SAGlD,EAAE,IAAAC,GAAI,WAAAC,GAAW,GAAGC,EAAK,GAAwBC,GAA0B;AAC5E,QAAMC,IAAMJ,MAAOE,EAAK,OAAO,MAAM;AAE9B,SAAA,gBAAAG,EAACD,GAAI,EAAA,WAAWE,EAAKC,EAAO,MAAMN,CAAS,GAAG,KAAAE,GAAW,GAAGD,EAAM,CAAA;AAC1E,CAAC,GASYM,IAAwBT,EAAiB,SAEpD,EAAE,IAAAC,GAAI,WAAAC,GAAW,GAAGC,EAAK,GAAmBC,GAA0B;AAGhE,SAAA,gBAAAE,EAFKL,KAAM,OAEN,EAAA,WAAWM,EAAKC,EAAO,OAAON,CAAS,GAAG,KAAAE,GAAW,GAAGD,EAAM,CAAA;AAC3E,CAAC;"}
|
package/mtds/chip/chip.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chip.js","sources":["../../designsystem/chip/chip.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { type JSX
|
|
1
|
+
{"version":3,"file":"chip.js","sources":["../../designsystem/chip/chip.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef, type JSX } from \"react\";\nimport type {\n\tPolymorphicComponentPropWithRef,\n\tPolymorphicRef,\n} from \"../react-types\";\nimport styles from \"../styles.module.css\";\n\ntype ChipBaseProps<Removable> = {\n\thref?: Removable;\n\t\"data-removable\"?: boolean;\n};\n\nexport type ChipProps<\n\tRemovable,\n\tAs extends React.ElementType = Removable extends true ? \"button\" : \"label\",\n> = PolymorphicComponentPropWithRef<As, ChipBaseProps<Removable>>;\n\ntype ChipComponent = <\n\tRemovable,\n\tAs extends React.ElementType = Removable extends true ? \"button\" : \"label\",\n>(\n\tprops: ChipProps<Removable, As>,\n) => JSX.Element;\n\nexport const Chip: ChipComponent = forwardRef<null>(function Chip<\n\tHref,\n\tAs extends React.ElementType = Href extends string ? \"a\" : \"div\",\n>({ as, className, ...rest }: ChipProps<Href, As>, ref?: PolymorphicRef<As>) {\n\tconst Tag = as || (rest[\"data-removable\"] ? \"button\" : \"label\");\n\n\treturn <Tag className={clsx(styles.chip, className)} ref={ref} {...rest} />;\n}) as ChipComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n"],"names":["Chip","forwardRef","as","className","rest","ref","Tag","jsx","clsx","styles"],"mappings":";;;;AAyBa,MAAAA,IAAsBC,EAAiB,SAGlD,EAAE,IAAAC,GAAI,WAAAC,GAAW,GAAGC,EAAK,GAAwBC,GAA0B;AAC5E,QAAMC,IAAMJ,MAAOE,EAAK,gBAAgB,IAAI,WAAW;AAEhD,SAAA,gBAAAG,EAACD,GAAI,EAAA,WAAWE,EAAKC,EAAO,MAAMN,CAAS,GAAG,KAAAE,GAAW,GAAGD,EAAM,CAAA;AAC1E,CAAC;"}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
var J = Object.defineProperty,
|
|
1
|
+
var J = Object.defineProperty, B = Object.getOwnPropertySymbols, Q = Object.prototype.hasOwnProperty, Z = Object.prototype.propertyIsEnumerable, j = (t, e, o) => e in t ? J(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o, tt = (t, e) => {
|
|
2
2
|
for (var o in e || (e = {}))
|
|
3
|
-
Q.call(e, o) &&
|
|
4
|
-
if (
|
|
5
|
-
for (var o of
|
|
6
|
-
Z.call(e, o) &&
|
|
3
|
+
Q.call(e, o) && j(t, o, e[o]);
|
|
4
|
+
if (B)
|
|
5
|
+
for (var o of B(e))
|
|
6
|
+
Z.call(e, o) && j(t, o, e[o]);
|
|
7
7
|
return t;
|
|
8
|
-
},
|
|
9
|
-
|
|
10
|
-
/^Mac/i.test(((
|
|
8
|
+
}, x = typeof window < "u" && typeof window.document < "u" && typeof window.navigator < "u", K = x && /android/i.test(navigator.userAgent), et = x && /firefox/i.test(navigator.userAgent), ot = x && /iPad|iPhone|iPod/.test(navigator.userAgent), V;
|
|
9
|
+
x && // @ts-expect-error Typescript has not implemented userAgentData yet https://stackoverflow.com/a/71392474
|
|
10
|
+
/^Mac/i.test(((V = navigator.userAgentData) == null ? void 0 : V.platform) || navigator.platform);
|
|
11
11
|
var it = "outline: 1px dotted; outline: 5px auto Highlight; outline: 5px auto -webkit-focus-ring-color", nt = typeof HTMLElement > "u" ? class {
|
|
12
12
|
} : HTMLElement;
|
|
13
13
|
function s(t, e, o) {
|
|
14
14
|
return o === void 0 ? t.getAttribute(e) : (o === null ? t.removeAttribute(e) : t.getAttribute(e) !== o && t.setAttribute(e, o), null);
|
|
15
15
|
}
|
|
16
|
-
var
|
|
16
|
+
var U = (t, e, o) => {
|
|
17
17
|
for (const n of o[0].split(","))
|
|
18
18
|
o[0] = n, Element.prototype[`${t}EventListener`].apply(e, o);
|
|
19
|
-
},
|
|
20
|
-
if (e === void 0) return
|
|
19
|
+
}, $ = (t, ...e) => U("add", t, e), at = (t, ...e) => U("remove", t, e), C = /* @__PURE__ */ new WeakMap(), M = (t, e) => {
|
|
20
|
+
if (e === void 0) return C.get(t);
|
|
21
21
|
try {
|
|
22
|
-
|
|
22
|
+
C.get(t).disconnect(), C.delete(t);
|
|
23
23
|
} catch {
|
|
24
24
|
}
|
|
25
25
|
if (e) {
|
|
26
26
|
const o = new MutationObserver(
|
|
27
27
|
(n) => t.handleEvent({ type: "mutation", detail: n })
|
|
28
28
|
);
|
|
29
|
-
o.observe(t, e),
|
|
29
|
+
o.observe(t, e), C.set(t, o);
|
|
30
30
|
}
|
|
31
31
|
}, rt = (t) => {
|
|
32
32
|
const e = "key" in t && (t.key === " " || t.key === "Enter");
|
|
@@ -35,19 +35,19 @@ var K = (t, e, o) => {
|
|
|
35
35
|
var e;
|
|
36
36
|
const o = ((e = t.getRootNode) == null ? void 0 : e.call(t)) || t.ownerDocument;
|
|
37
37
|
return o instanceof Document || o instanceof ShadowRoot ? o : document;
|
|
38
|
-
}, st = 0, ut = (t) => t ? (t.id || (t.id = `:${t.nodeName.toLowerCase()}${(++st).toString(32)}`), t.id) : "",
|
|
38
|
+
}, st = 0, ut = (t) => t ? (t.id || (t.id = `:${t.nodeName.toLowerCase()}${(++st).toString(32)}`), t.id) : "", O = (t, e, o) => {
|
|
39
39
|
const n = document.createElement(t);
|
|
40
40
|
if (e && (n.textContent = e), o) for (const [i, a] of Object.entries(o)) s(n, i, a);
|
|
41
41
|
return n;
|
|
42
42
|
}, ct = {
|
|
43
|
-
define: (t, e) => !
|
|
44
|
-
}, y, dt = 0,
|
|
45
|
-
y || (y =
|
|
46
|
-
},
|
|
43
|
+
define: (t, e) => !x || window.customElements.get(t) || window.customElements.define(t, e)
|
|
44
|
+
}, y, dt = 0, R = (t) => {
|
|
45
|
+
y || (y = O("div"), y.style.cssText = "position:fixed;overflow:hidden;width:1px;white-space:nowrap", s(y, "aria-live", "assertive")), y.isConnected || document.body.append(y), t && (y.textContent = `${t}${dt++ % 2 ? " " : ""}`);
|
|
46
|
+
}, X = (t, e, o = "") => {
|
|
47
47
|
var n, i;
|
|
48
48
|
const a = { bubbles: !0, composed: !0, data: e, inputType: o }, r = HTMLInputElement.prototype;
|
|
49
49
|
t.dispatchEvent(new InputEvent("beforeinput", a)), (i = (n = Object.getOwnPropertyDescriptor(r, "value")) == null ? void 0 : n.set) == null || i.call(t, e), t.dispatchEvent(new InputEvent("input", a)), t.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
50
|
-
},
|
|
50
|
+
}, D = !1, N = (t) => (t?.type === "mouseup" && (D = !1), t?.type === "mousedown" && (D = !0, $(document, "mouseup", N, { once: !0 })), D), q = "beforeinput,blur,focus,click,input,keydown,mousedown", W = { once: !0, passive: !0 }, vt = et && !K, pt = K || ot, I = "false", T = {
|
|
51
51
|
added: "Added",
|
|
52
52
|
empty: "No selected",
|
|
53
53
|
found: "Navigate left to find %d selected",
|
|
@@ -57,10 +57,10 @@ var K = (t, e, o) => {
|
|
|
57
57
|
removed: "Removed"
|
|
58
58
|
}, ft = class extends nt {
|
|
59
59
|
constructor() {
|
|
60
|
-
super(), this._item = "", this._speak = "", this._texts = tt({},
|
|
61
|
-
|
|
60
|
+
super(), this._item = "", this._speak = "", this._texts = tt({}, T), this._value = "", this.attachShadow({ mode: "open" }).append(
|
|
61
|
+
O("slot"),
|
|
62
62
|
// Content slot
|
|
63
|
-
|
|
63
|
+
O(
|
|
64
64
|
"style",
|
|
65
65
|
`:host(:not([hidden])) { display: block; -webkit-tap-highlight-color: rgba(0, 0, 0, 0) } /* Must be display block in Safari to allow focus inside */
|
|
66
66
|
:host(:not([data-multiple])) ::slotted(data),
|
|
@@ -76,10 +76,10 @@ var K = (t, e, o) => {
|
|
|
76
76
|
// Locally store value to store value before input-click
|
|
77
77
|
// Using ES2015 syntax for backwards compatibility
|
|
78
78
|
static get observedAttributes() {
|
|
79
|
-
return Object.keys(
|
|
79
|
+
return Object.keys(T).map((t) => `data-sr-${t}`);
|
|
80
80
|
}
|
|
81
81
|
connectedCallback() {
|
|
82
|
-
this._root = lt(this),
|
|
82
|
+
this._root = lt(this), $(this, q, this, !0), M(this, {
|
|
83
83
|
attributeFilter: ["value", "id"],
|
|
84
84
|
// Respond to changes in <data> value or change of id for <datalist> to reconnect with input
|
|
85
85
|
attributes: !0,
|
|
@@ -87,29 +87,29 @@ var K = (t, e, o) => {
|
|
|
87
87
|
// Respond to changes in <data> textContent
|
|
88
88
|
childList: !0,
|
|
89
89
|
subtree: !0
|
|
90
|
-
}), setTimeout(
|
|
90
|
+
}), setTimeout(S, 0, this), setTimeout(A, 0, this);
|
|
91
91
|
}
|
|
92
92
|
attributeChangedCallback(t, e, o) {
|
|
93
93
|
const n = t.split("data-sr-")[1];
|
|
94
|
-
|
|
94
|
+
T[n] && (this._texts[n] = o || T[n]);
|
|
95
95
|
}
|
|
96
96
|
disconnectedCallback() {
|
|
97
|
-
|
|
97
|
+
M(this, !1), at(this, q, this, !0), this._items = this._clear = this._focus = this._control = void 0, this._list = this._options = this._root = void 0;
|
|
98
98
|
}
|
|
99
99
|
handleEvent(t) {
|
|
100
100
|
const e = t.target;
|
|
101
|
-
P(this) || (t.type === "beforeinput" && (this._value = e?.value || ""), t.type === "blur" && ht(this), t.type === "click" &&
|
|
101
|
+
P(this) || (t.type === "beforeinput" && (this._value = e?.value || ""), t.type === "blur" && ht(this), t.type === "click" && _t(this, t), t.type === "focus" && mt(this, t), t.type === "input" && gt(this, t), t.type === "keydown" && yt(this, t), t.type === "mousedown" && N(t), t.type === "mutation" && S(this, t));
|
|
102
102
|
}
|
|
103
103
|
get multiple() {
|
|
104
104
|
var t;
|
|
105
|
-
return ((t = s(this, "data-multiple")) != null ? t :
|
|
105
|
+
return ((t = s(this, "data-multiple")) != null ? t : I) !== I;
|
|
106
106
|
}
|
|
107
107
|
set multiple(t) {
|
|
108
108
|
s(this, "data-multiple", t ? "" : null);
|
|
109
109
|
}
|
|
110
110
|
get creatable() {
|
|
111
111
|
var t;
|
|
112
|
-
return ((t = s(this, "data-creatable")) != null ? t :
|
|
112
|
+
return ((t = s(this, "data-creatable")) != null ? t : I) !== I;
|
|
113
113
|
}
|
|
114
114
|
set creatable(t) {
|
|
115
115
|
s(this, "data-creatable", t ? "" : null);
|
|
@@ -143,79 +143,79 @@ var K = (t, e, o) => {
|
|
|
143
143
|
}, b = (t) => {
|
|
144
144
|
var e;
|
|
145
145
|
return ((e = t?.textContent) == null ? void 0 : e.trim()) || "";
|
|
146
|
-
},
|
|
146
|
+
}, L = (t) => t instanceof HTMLDataElement, P = ({ control: t }) => t?.disabled || t?.readOnly || !1, S = (t, e) => {
|
|
147
147
|
var o, n;
|
|
148
148
|
const { _focus: i, _texts: a, items: r, control: l, list: d, multiple: u } = t;
|
|
149
|
-
let
|
|
149
|
+
let p = `${b((o = l?.labels) == null ? void 0 : o[0])}${u ? `, ${r.length ? a.found.replace("%d", `${r.length}`) : a.empty}` : ""}`;
|
|
150
150
|
const c = [];
|
|
151
|
-
for (const { addedNodes: m, removedNodes:
|
|
152
|
-
for (const
|
|
153
|
-
for (const
|
|
154
|
-
}
|
|
155
|
-
const
|
|
156
|
-
if (i && l &&
|
|
157
|
-
const m = s(l, "inputmode"),
|
|
158
|
-
t._speak = `${a[
|
|
159
|
-
var
|
|
160
|
-
s(l, "aria-expanded",
|
|
151
|
+
for (const { addedNodes: m, removedNodes: g } of e?.detail || []) {
|
|
152
|
+
for (const v of m) L(v) && c.unshift(v);
|
|
153
|
+
for (const v of g) L(v) && c.push(v);
|
|
154
|
+
}
|
|
155
|
+
const _ = u ? c.length === 1 : c[0] === i;
|
|
156
|
+
if (i && l && _) {
|
|
157
|
+
const m = s(l, "aria-expanded"), g = s(l, "inputmode"), v = L(i) ? l : i, E = !c[0].isConnected;
|
|
158
|
+
t._speak = `${a[E ? "removed" : "added"]} ${b(c[0])}, `, (pt || i === l) && R(t._speak), l !== v && (s(l, "aria-expanded", null), s(l, "inputmode", "none"), p = " ", l.focus()), setTimeout(() => {
|
|
159
|
+
var k;
|
|
160
|
+
s(l, "aria-expanded", m), s(l, "inputmode", E ? "none" : g), (k = v?.focus) == null || k.call(v), s(l, "inputmode", g), t._speak = "", vt ? $(t, "blur", () => S(t), W) : setTimeout(S, 100, t);
|
|
161
161
|
}, 100);
|
|
162
162
|
}
|
|
163
163
|
let f = 0;
|
|
164
|
-
const
|
|
164
|
+
const h = t.querySelector("select"), G = P(t) ? "" : `${a.remove}, `;
|
|
165
165
|
for (const m of r) {
|
|
166
|
-
const
|
|
167
|
-
s(m, "role", "button"), s(m, "value",
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
for (const m of [...
|
|
171
|
-
!u && f > 1 && console.warn("u-combobox: Multiple <data> found in single mode."), d && s(d, "aria-multiselectable", `${u}`), l && s(l, "list", ut(d)), l && s(l, "aria-label", `${t._speak}${
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
},
|
|
166
|
+
const g = h?.options[f], v = b(m), E = m.value || v, k = `${t._speak}${v}, ${G}${++f} ${a.of} ${r.length}`;
|
|
167
|
+
s(m, "role", "button"), s(m, "value", E), s(m, "tabindex", "-1"), s(m, "aria-label", k), g ? Object.assign(g, { textContent: v, value: E }) : h?.appendChild(new Option(v, E, !0, !0));
|
|
168
|
+
}
|
|
169
|
+
h && s(h, "multiple", u ? "" : null);
|
|
170
|
+
for (const m of [...h?.options || []].slice(f)) m.remove();
|
|
171
|
+
!u && f > 1 && console.warn("u-combobox: Multiple <data> found in single mode."), d && s(d, "aria-multiselectable", `${u}`), l && s(l, "list", ut(d)), l && s(l, "aria-label", `${t._speak}${p}`);
|
|
172
|
+
const H = b(r[0]);
|
|
173
|
+
H !== t._item && A(t), t._item = H, Y(t), z(t), (n = M(t)) == null || n.takeRecords();
|
|
174
|
+
}, Y = (t) => {
|
|
175
175
|
var e;
|
|
176
176
|
t.clear && s(t.clear, "role", "button"), t.clear && (t.clear.hidden = !((e = t.control) != null && e.value) || P(t));
|
|
177
|
-
},
|
|
177
|
+
}, z = (t) => {
|
|
178
178
|
var e;
|
|
179
179
|
const { _speak: o, options: n = [], values: i } = t;
|
|
180
180
|
for (const a of n) {
|
|
181
181
|
const r = (e = s(a, "value")) != null ? e : b(a);
|
|
182
182
|
s(a, "aria-label", o ? `${o}${b(a)}` : null), s(a, "selected", i.includes(r) ? "" : null);
|
|
183
183
|
}
|
|
184
|
-
},
|
|
184
|
+
}, A = (t) => {
|
|
185
185
|
const { multiple: e, control: o, items: n } = t, i = b(n[0]);
|
|
186
|
-
!e && o && i !== o.value &&
|
|
187
|
-
},
|
|
186
|
+
!e && o && i !== o.value && X(o, i, i ? "insertText" : "deleteContent");
|
|
187
|
+
}, F = (t, e = !0) => {
|
|
188
188
|
var o;
|
|
189
|
-
const { _texts: n, options: i = [], creatable: a, control: r, items: l, multiple: d } = t, u = ((o = r?.value) == null ? void 0 : o.trim()) || "",
|
|
189
|
+
const { _texts: n, options: i = [], creatable: a, control: r, items: l, multiple: d } = t, u = ((o = r?.value) == null ? void 0 : o.trim()) || "", p = u.toLowerCase() || null;
|
|
190
190
|
let c = [...i].find(
|
|
191
|
-
(f) => (s(f, "label") || b(f)).trim().toLowerCase() ===
|
|
191
|
+
(f) => (s(f, "label") || b(f)).trim().toLowerCase() === p
|
|
192
192
|
);
|
|
193
|
-
const
|
|
194
|
-
if (t.dispatchEvent(new CustomEvent("
|
|
195
|
-
return
|
|
193
|
+
const _ = { bubbles: !0, cancelable: !0, detail: c };
|
|
194
|
+
if (t.dispatchEvent(new CustomEvent("comboboxbeforematch", _)) || (c = [...i].find((f) => f.selected)), e)
|
|
195
|
+
return z(t), c ? w(t, c, !1) : a && u ? w(t, { value: u }, !1) : (!d && !u && l[0] ? w(t, l[0]) : A(t), R(n.invalid));
|
|
196
196
|
for (const f of i) f.selected = f === c;
|
|
197
|
-
},
|
|
198
|
-
const { control: n, items: i, multiple: a } = t, r =
|
|
197
|
+
}, w = (t, e, o = !0) => {
|
|
198
|
+
const { control: n, items: i, multiple: a } = t, r = O("data", e.label || e.value, {
|
|
199
199
|
value: e.value
|
|
200
|
-
}), l = [...i].find((
|
|
201
|
-
if (l && !o) return
|
|
202
|
-
if (t.dispatchEvent(new CustomEvent("
|
|
203
|
-
if (!a) for (const
|
|
204
|
-
l ? l.remove() : n?.insertAdjacentElement("beforebegin", r), t.dispatchEvent(new CustomEvent("
|
|
200
|
+
}), l = [...i].find((p) => p.value === e.value), d = { bubbles: !0, cancelable: !0, detail: l || r };
|
|
201
|
+
if (l && !o) return A(t);
|
|
202
|
+
if (t.dispatchEvent(new CustomEvent("comboboxbeforeselect", d))) {
|
|
203
|
+
if (!a) for (const p of [...i]) p.remove();
|
|
204
|
+
l ? l.remove() : n?.insertAdjacentElement("beforebegin", r), t.dispatchEvent(new CustomEvent("comboboxafterselect", d));
|
|
205
205
|
}
|
|
206
206
|
}, mt = (t, { target: e }) => {
|
|
207
|
-
e instanceof HTMLElement && (t._focus = e),
|
|
208
|
-
}, ht = (t) => N() || setTimeout(
|
|
207
|
+
e instanceof HTMLElement && (t._focus = e), R();
|
|
208
|
+
}, ht = (t) => N() || setTimeout(bt, 0, t), bt = (t) => {
|
|
209
209
|
var e;
|
|
210
|
-
!t._focus || t.contains((e = t._root) == null ? void 0 : e.activeElement) || (t.multiple ||
|
|
211
|
-
},
|
|
210
|
+
!t._focus || t.contains((e = t._root) == null ? void 0 : e.activeElement) || (t.multiple || F(t), t._focus = void 0);
|
|
211
|
+
}, _t = (t, e) => {
|
|
212
212
|
const { clientX: o, clientY: n, target: i } = e, { clear: a, control: r, items: l } = t;
|
|
213
213
|
if (a?.contains(i))
|
|
214
|
-
return r &&
|
|
214
|
+
return r && X(r, "", "deleteContentBackward"), r?.focus();
|
|
215
215
|
for (const d of l) {
|
|
216
|
-
const { top: u, right:
|
|
217
|
-
if (d.contains(i)) return
|
|
218
|
-
if (n >= u && n <= c && o >=
|
|
216
|
+
const { top: u, right: p, bottom: c, left: _ } = d.getBoundingClientRect();
|
|
217
|
+
if (d.contains(i)) return w(t, d);
|
|
218
|
+
if (n >= u && n <= c && o >= _ && o <= p) return d.focus();
|
|
219
219
|
}
|
|
220
220
|
i === t && r?.focus();
|
|
221
221
|
}, gt = (t, e) => {
|
|
@@ -225,22 +225,22 @@ var K = (t, e, o) => {
|
|
|
225
225
|
e.stopImmediatePropagation(), i && (i.value = t._value);
|
|
226
226
|
for (const d of n)
|
|
227
227
|
if (d.value && d.value === r)
|
|
228
|
-
return
|
|
229
|
-
} else a ||
|
|
230
|
-
|
|
228
|
+
return w(t, d, a);
|
|
229
|
+
} else a || F(t, !1);
|
|
230
|
+
Y(t);
|
|
231
231
|
}, yt = (t, e) => {
|
|
232
232
|
var o;
|
|
233
233
|
if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) return;
|
|
234
|
-
const { clear: n, control: i, items: a } = t, { key: r, repeat: l, target: d } = e, u = i && i === d,
|
|
234
|
+
const { clear: n, control: i, items: a } = t, { key: r, repeat: l, target: d } = e, u = i && i === d, p = u && i?.selectionEnd;
|
|
235
235
|
let c = u ? a.length : [...a].indexOf(d);
|
|
236
|
-
if (u && r === "Tab" && n && !n.hidden && (e.preventDefault(), n.tabIndex = -1, n.focus(),
|
|
236
|
+
if (u && r === "Tab" && n && !n.hidden && (e.preventDefault(), n.tabIndex = -1, n.focus(), $(n, "blur", () => s(n, "tabindex", null), W)), !(!u && rt(e) || c === -1)) {
|
|
237
237
|
if (r === "ArrowRight" && !u) c += 1;
|
|
238
|
-
else if (r === "ArrowLeft" && !
|
|
238
|
+
else if (r === "ArrowLeft" && !p) c -= 1;
|
|
239
239
|
else if (r === "Enter" && u) {
|
|
240
|
-
const
|
|
241
|
-
return s(i, "form", "#"), requestAnimationFrame(() => s(i, "form",
|
|
242
|
-
} else if ((r === "Backspace" || r === "Delete") && !
|
|
243
|
-
if (e.preventDefault(), !l && a[c]) return
|
|
240
|
+
const _ = s(i, "form");
|
|
241
|
+
return s(i, "form", "#"), requestAnimationFrame(() => s(i, "form", _)), F(t);
|
|
242
|
+
} else if ((r === "Backspace" || r === "Delete") && !p) {
|
|
243
|
+
if (e.preventDefault(), !l && a[c]) return w(t, a[c]);
|
|
244
244
|
u && (c -= 1);
|
|
245
245
|
} else return u || i?.focus();
|
|
246
246
|
e.preventDefault(), (o = a[Math.max(0, c)] || i) == null || o.focus();
|