@accelint/design-toolkit 4.0.0 → 5.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/dist/components/accordion/index.d.ts +1 -1
- package/dist/components/accordion/index.js +1 -1
- package/dist/components/accordion/index.js.map +1 -1
- package/dist/components/accordion/styles.js +1 -1
- package/dist/components/accordion/styles.js.map +1 -1
- package/dist/components/accordion/types.d.ts +1 -1
- package/dist/components/action-bar/index.d.ts +10 -0
- package/dist/components/action-bar/index.js +2 -0
- package/dist/components/action-bar/index.js.map +1 -0
- package/dist/components/action-bar/styles.d.ts +5 -0
- package/dist/components/action-bar/styles.js +2 -0
- package/dist/components/action-bar/styles.js.map +1 -0
- package/dist/components/action-bar/types.d.ts +5 -0
- package/dist/components/action-bar/types.js +2 -0
- package/dist/components/action-bar/types.js.map +1 -0
- package/dist/components/avatar/index.d.ts +1 -1
- package/dist/components/avatar/index.js +1 -1
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/avatar/styles.js +1 -1
- package/dist/components/avatar/styles.js.map +1 -1
- package/dist/components/avatar/types.d.ts +1 -1
- package/dist/components/badge/index.d.ts +1 -1
- package/dist/components/badge/index.js.map +1 -1
- package/dist/components/badge/styles.js +1 -1
- package/dist/components/badge/styles.js.map +1 -1
- package/dist/components/button/index.d.ts +1 -1
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/button/styles.js +1 -1
- package/dist/components/button/styles.js.map +1 -1
- package/dist/components/button/types.d.ts +1 -1
- package/dist/components/checkbox/styles.js +1 -1
- package/dist/components/checkbox/styles.js.map +1 -1
- package/dist/components/chip/index.d.ts +1 -1
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/chip/styles.js +1 -1
- package/dist/components/chip/styles.js.map +1 -1
- package/dist/components/classification-badge/index.d.ts +1 -1
- package/dist/components/classification-badge/index.js.map +1 -1
- package/dist/components/classification-badge/styles.js +1 -1
- package/dist/components/classification-badge/styles.js.map +1 -1
- package/dist/components/classification-banner/index.d.ts +1 -1
- package/dist/components/classification-banner/index.js.map +1 -1
- package/dist/components/classification-banner/styles.js +1 -1
- package/dist/components/classification-banner/styles.js.map +1 -1
- package/dist/components/color-picker/styles.js +1 -1
- package/dist/components/color-picker/styles.js.map +1 -1
- package/dist/components/combobox-field/index.d.ts +1 -1
- package/dist/components/combobox-field/index.js.map +1 -1
- package/dist/components/combobox-field/styles.js +1 -1
- package/dist/components/combobox-field/styles.js.map +1 -1
- package/dist/components/combobox-field/types.d.ts +1 -1
- package/dist/components/date-field/index.js.map +1 -1
- package/dist/components/date-field/styles.js +1 -1
- package/dist/components/date-field/styles.js.map +1 -1
- package/dist/components/details-list/index.d.ts +1 -1
- package/dist/components/details-list/index.js +1 -1
- package/dist/components/details-list/index.js.map +1 -1
- package/dist/components/details-list/styles.js +1 -1
- package/dist/components/details-list/styles.js.map +1 -1
- package/dist/components/dialog/index.js +1 -1
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/dialog/styles.js +1 -1
- package/dist/components/dialog/styles.js.map +1 -1
- package/dist/components/drawer/index.d.ts +1 -1
- package/dist/components/drawer/index.js +1 -1
- package/dist/components/drawer/index.js.map +1 -1
- package/dist/components/drawer/styles.d.ts +2 -2
- package/dist/components/drawer/styles.js +1 -1
- package/dist/components/drawer/styles.js.map +1 -1
- package/dist/components/drawer/types.d.ts +1 -1
- package/dist/components/hero/index.js +1 -1
- package/dist/components/hero/index.js.map +1 -1
- package/dist/components/hero/styles.js +1 -1
- package/dist/components/hero/styles.js.map +1 -1
- package/dist/components/hotkey/index.d.ts +1 -1
- package/dist/components/hotkey/index.js.map +1 -1
- package/dist/components/hotkey/styles.js +1 -1
- package/dist/components/hotkey/styles.js.map +1 -1
- package/dist/components/icon/index.d.ts +1 -1
- package/dist/components/icon/index.js.map +1 -1
- package/dist/components/input/index.d.ts +1 -1
- package/dist/components/input/index.js.map +1 -1
- package/dist/components/input/styles.js +1 -1
- package/dist/components/input/styles.js.map +1 -1
- package/dist/components/label/index.d.ts +1 -1
- package/dist/components/label/index.js.map +1 -1
- package/dist/components/label/styles.js +1 -1
- package/dist/components/label/styles.js.map +1 -1
- package/dist/components/lines/index.d.ts +9 -0
- package/dist/components/lines/index.js +2 -0
- package/dist/components/lines/index.js.map +1 -0
- package/dist/components/lines/styles.d.ts +32 -0
- package/dist/components/lines/styles.js +2 -0
- package/dist/components/lines/styles.js.map +1 -0
- package/dist/components/lines/types.d.ts +10 -0
- package/dist/components/lines/types.js +2 -0
- package/dist/components/lines/types.js.map +1 -0
- package/dist/components/link/index.d.ts +17 -0
- package/dist/components/link/index.js +2 -0
- package/dist/components/link/index.js.map +1 -0
- package/dist/components/link/styles.d.ts +5 -0
- package/dist/components/link/styles.js +2 -0
- package/dist/components/link/styles.js.map +1 -0
- package/dist/components/link/types.d.ts +9 -0
- package/dist/components/link/types.js +2 -0
- package/dist/components/link/types.js.map +1 -0
- package/dist/components/menu/index.js +1 -1
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/menu/styles.js +1 -1
- package/dist/components/menu/styles.js.map +1 -1
- package/dist/components/options/index.js.map +1 -1
- package/dist/components/options/styles.js +1 -1
- package/dist/components/options/styles.js.map +1 -1
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/popover/styles.js +1 -1
- package/dist/components/popover/styles.js.map +1 -1
- package/dist/components/query-builder/action-element.js.map +1 -1
- package/dist/components/query-builder/group.js +1 -1
- package/dist/components/query-builder/group.js.map +1 -1
- package/dist/components/query-builder/index.js +1 -1
- package/dist/components/query-builder/index.js.map +1 -1
- package/dist/components/query-builder/value-editor.js.map +1 -1
- package/dist/components/query-builder/value-selector.js.map +1 -1
- package/dist/components/radio/styles.js +1 -1
- package/dist/components/radio/styles.js.map +1 -1
- package/dist/components/search-field/index.d.ts +3 -3
- package/dist/components/search-field/index.js.map +1 -1
- package/dist/components/search-field/styles.js +1 -1
- package/dist/components/search-field/styles.js.map +1 -1
- package/dist/components/select-field/index.d.ts +1 -1
- package/dist/components/select-field/index.js +1 -1
- package/dist/components/select-field/index.js.map +1 -1
- package/dist/components/select-field/styles.js +1 -1
- package/dist/components/select-field/styles.js.map +1 -1
- package/dist/components/select-field/types.d.ts +1 -1
- package/dist/components/sidenav/events.d.ts +8 -0
- package/dist/components/sidenav/events.js +2 -0
- package/dist/components/sidenav/events.js.map +1 -0
- package/dist/components/sidenav/index.d.ts +51 -0
- package/dist/components/sidenav/index.js +2 -0
- package/dist/components/sidenav/index.js.map +1 -0
- package/dist/components/sidenav/styles.d.ts +114 -0
- package/dist/components/sidenav/styles.js +2 -0
- package/dist/components/sidenav/styles.js.map +1 -0
- package/dist/components/sidenav/types.d.ts +38 -0
- package/dist/components/sidenav/types.js +2 -0
- package/dist/components/sidenav/types.js.map +1 -0
- package/dist/components/skeleton/styles.d.ts +2 -2
- package/dist/components/skeleton/styles.js +1 -1
- package/dist/components/skeleton/styles.js.map +1 -1
- package/dist/components/slider/index.js.map +1 -1
- package/dist/components/slider/styles.js +1 -1
- package/dist/components/slider/styles.js.map +1 -1
- package/dist/components/switch/index.d.ts +1 -1
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/switch/styles.js +1 -1
- package/dist/components/switch/styles.js.map +1 -1
- package/dist/components/tabs/index.d.ts +37 -36
- package/dist/components/tabs/index.js +1 -1
- package/dist/components/tabs/index.js.map +1 -1
- package/dist/components/tabs/styles.d.ts +48 -0
- package/dist/components/tabs/styles.js +2 -0
- package/dist/components/tabs/styles.js.map +1 -0
- package/dist/components/tabs/types.d.ts +6 -0
- package/dist/components/tabs/types.js +2 -0
- package/dist/components/tabs/types.js.map +1 -0
- package/dist/components/text-area-field/index.d.ts +1 -1
- package/dist/components/text-area-field/index.js.map +1 -1
- package/dist/components/text-area-field/styles.js +1 -1
- package/dist/components/text-area-field/styles.js.map +1 -1
- package/dist/components/text-field/index.js.map +1 -1
- package/dist/components/text-field/styles.js +1 -1
- package/dist/components/text-field/styles.js.map +1 -1
- package/dist/components/tooltip/index.d.ts +1 -1
- package/dist/components/tooltip/index.js +1 -1
- package/dist/components/tooltip/index.js.map +1 -1
- package/dist/components/tooltip/styles.d.ts +1 -1
- package/dist/components/tooltip/styles.js +1 -1
- package/dist/components/tooltip/styles.js.map +1 -1
- package/dist/components/tooltip/types.d.ts +3 -1
- package/dist/components/tree/index.d.ts +51 -0
- package/dist/components/tree/index.js +2 -0
- package/dist/components/tree/index.js.map +1 -0
- package/dist/components/tree/styles.d.ts +128 -0
- package/dist/components/tree/styles.js +2 -0
- package/dist/components/tree/styles.js.map +1 -0
- package/dist/components/tree/types.d.ts +41 -0
- package/dist/components/tree/types.js +2 -0
- package/dist/components/tree/types.js.map +1 -0
- package/dist/components/view-stack/index.js.map +1 -1
- package/dist/foundation/token-data.d.ts +17 -0
- package/dist/foundation/token-data.js +2 -0
- package/dist/foundation/token-data.js.map +1 -0
- package/dist/hooks/use-tree/actions/cache.d.ts +78 -0
- package/dist/hooks/use-tree/actions/cache.js +2 -0
- package/dist/hooks/use-tree/actions/cache.js.map +1 -0
- package/dist/hooks/use-tree/actions/index.d.ts +38 -0
- package/dist/hooks/use-tree/actions/index.js +2 -0
- package/dist/hooks/use-tree/actions/index.js.map +1 -0
- package/dist/hooks/use-tree/state/index.d.ts +8 -0
- package/dist/hooks/use-tree/state/index.js +2 -0
- package/dist/hooks/use-tree/state/index.js.map +1 -0
- package/dist/hooks/use-tree/state/utils.d.ts +7 -0
- package/dist/hooks/use-tree/state/utils.js +2 -0
- package/dist/hooks/use-tree/state/utils.js.map +1 -0
- package/dist/hooks/use-tree/types.d.ts +171 -0
- package/dist/hooks/use-tree/types.js +2 -0
- package/dist/hooks/use-tree/types.js.map +1 -0
- package/dist/icons/catalog.js +1 -1
- package/dist/icons/catalog.js.map +1 -1
- package/dist/index.css +9 -15
- package/dist/index.d.ts +26 -3
- package/dist/index.js +1 -1
- package/dist/lib/react.d.ts +22 -8
- package/dist/lib/react.js +8 -4
- package/dist/lib/react.js.map +1 -1
- package/dist/lib/utils.d.ts +2 -2
- package/dist/lib/utils.js +1 -1
- package/dist/lib/utils.js.map +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/providers/theme-provider.d.ts +22 -0
- package/dist/providers/theme-provider.js +2 -0
- package/dist/providers/theme-provider.js.map +1 -0
- package/dist/styles.css +1606 -904
- package/dist/tokens/themes.css +729 -53
- package/dist/tokens/tokens.css +121 -65
- package/dist/tokens/tokens.d.ts +449 -1
- package/dist/tokens/tokens.js +2 -0
- package/dist/tokens/tokens.js.map +1 -0
- package/dist/tokens/types.d.ts +299 -0
- package/dist/tokens/types.js +2 -0
- package/dist/tokens/types.js.map +1 -0
- package/dist/variants/variants.css +6 -1
- package/package.json +10 -6
- package/dist/tokens/index.d.ts +0 -123
- package/dist/tokens/index.js +0 -2
- package/dist/tokens/index.js.map +0 -1
package/dist/lib/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/utils.ts"],"names":["twMergeConfig","validators","twMerge","extendTailwindMerge","cn","inputs","clsx","PREFIX_REGEX","mergeVariants","className","prefixMap","cls","prefix","finalClassNames","key","s","_tv","createTV","tv","options","configuredStateMachine","props","classNamesOrSlots","acc","slot","callback","slotProps","isSlottedContextValue","context"],"mappings":"6HAgCA,MAAMA,EAAgB,CACpB,WAAA,CAAa,CACX,IAAA,CAAM,CAAC,CAAE,IAAA,CAAM,CAAC,EAAA,CAAIC,UAAAA,CAAW,KAAK,CAAE,CAAC,EACvC,EAAA,CAAI,CAAC,CAAE,EAAA,CAAI,CAAC,GAAIA,UAAAA,CAAW,KAAK,CAAE,CAAC,CACrC,EACA,sBAAA,CAAwB,CACtB,EAAA,CAAI,CAAC,OAAQ,YAAY,CAC3B,EACA,KAAA,CAAO,CACL,MAAO,CACL,SAAA,CACA,iBAAA,CACA,gBAAA,CACA,kBACA,kBAAA,CACA,mBAAA,CACA,sBACA,yBAAA,CACA,wBAAA,CACA,uBACA,cAAA,CACA,aAAA,CACA,aAAA,CACA,mBAAA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AAA,CAAciB,CAAAA,CAASC,CAAS,CAAC,CAAA,CAErDH,CAAAA,CAAAA,CAET,EACF,CACN,EAE0CH,CAAsB,CAClE,CAcO,SAASO,CAAAA,CACdC,EACwC,CACxC,OAAO,CAAC,CAACA,CAAAA,EAAW,UAAWA,CACjC","file":"utils.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { type ClassValue, clsx } from 'clsx';\nimport type { ForwardedRef } from 'react';\nimport type { ContextValue } from 'react-aria-components';\nimport {\n type ClassNameValue,\n extendTailwindMerge,\n validators,\n} from 'tailwind-merge';\nimport {\n type TVCompoundSlots,\n type TVCompoundVariants,\n type TVDefaultVariants,\n type TVProps,\n type TVReturnType,\n type TVVariants,\n createTV,\n} from 'tailwind-variants';\n\ntype AdditionalClassGroupIds = 'icon' | 'icon-size' | 'fg';\n\nconst twMergeConfig = {\n classGroups: {\n icon: [{ icon: ['', validators.isAny] }],\n fg: [{ fg: ['', validators.isAny] }],\n },\n conflictingClassGroups: {\n fg: ['icon', 'text-color'],\n },\n theme: {\n color: [\n 'current',\n 'surface-default',\n 'surface-raised',\n 'surface-overlay',\n 'transparent-dark',\n 'transparent-light',\n 'interactive-default',\n 'interactive-hover-light',\n 'interactive-hover-dark',\n 'interactive-disabled',\n 'static-light',\n 'static-dark',\n 'interactive',\n 'interactive-hover',\n 'highlight-bold',\n 'highlight-hover',\n 'highlight-subtle',\n 'info-bold',\n 'info-hover',\n 'info-subtle',\n 'advisory-bold',\n 'advisory-hover',\n 'advisory-subtle',\n 'normal-bold',\n 'normal-hover',\n 'normal-subtle',\n 'serious-bold',\n 'serious-hover',\n 'serious-subtle',\n 'critical-bold',\n 'critical-hover',\n 'critical-subtle',\n 'default-light',\n 'default-dark',\n 'inverse-dark',\n 'inverse-light',\n 'disabled',\n 'highlight',\n 'info',\n 'advisory',\n 'normal',\n 'serious',\n 'critical',\n 'classification-missing',\n 'classification-unclass',\n 'classification-cui',\n 'classification-confidential',\n 'classification-secret',\n 'classification-top-secret',\n ],\n font: ['primary', 'display'],\n text: [\n 'header-xxl',\n 'header-xl',\n 'header-l',\n 'header-m',\n 'header-s',\n 'header-xs',\n 'body-xl',\n 'body-l',\n 'body-m',\n 'body-s',\n 'body-xs',\n 'body-xxs',\n 'button-xl',\n 'button-l',\n 'button-m',\n 'button-s',\n 'button-xs',\n ],\n radius: ['none', 'small', 'medium', 'large', 'round'],\n shadow: ['elevation-default', 'elevation-overlay', 'elevation-raised'],\n spacing: [\n 'none',\n '0',\n 'xxs',\n 'xs',\n 's',\n 'm',\n 'l',\n 'xl',\n 'xxl',\n 'oversized',\n ],\n },\n} as const; // TODO: satisfies ?\n\nexport const twMerge = extendTailwindMerge<AdditionalClassGroupIds>({\n extend: twMergeConfig,\n});\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\nconst PREFIX_REGEX = /((?:[^:]*:)+)([^:]+)/;\n\nexport function mergeVariants(className: string) {\n if (!className) {\n return '';\n }\n\n // First build up a map of all prefixes.\n const prefixMap: Record<string, string[]> = {};\n\n for (const cls of className.split(' ')) {\n const [, prefix, className] = PREFIX_REGEX.exec(cls) ?? ['', 'BASE', cls];\n\n prefixMap[prefix] = prefixMap[prefix] ?? [];\n\n prefixMap[prefix].push(className);\n }\n\n const finalClassNames = [];\n\n for (const key of Object.keys(prefixMap)) {\n prefixMap[key] = twMerge(prefixMap[key]).split(' ');\n }\n\n for (const prefix of Object.keys(prefixMap)) {\n if (prefix === 'BASE') {\n finalClassNames.push(prefixMap[prefix]);\n } else {\n finalClassNames.push(prefixMap[prefix]?.map((s) => `${prefix}${s}`));\n }\n }\n\n return finalClassNames.flat().join(' ');\n}\n\nconst _tv = createTV({\n twMergeConfig,\n});\n\n// Copied from Tailwind Variants due to not being exported\ntype TVSlots = Record<string, ClassNameValue> | undefined;\n\nexport function tv<\n V extends TVVariants<S, B, EV>,\n // biome-ignore lint/style/useNamingConvention: Keeping consistent with OG implementation within TV\n CV extends TVCompoundVariants<V, S, B, EV, ES>,\n // biome-ignore lint/style/useNamingConvention: Keeping consistent with OG implementation within TV\n DV extends TVDefaultVariants<V, S, EV, ES>,\n B extends ClassNameValue = undefined,\n S extends TVSlots = undefined,\n // @ts-expect-error\n E extends TVReturnType = TVReturnType<\n V,\n S,\n B,\n // @ts-expect-error Keeping consistent with OG implementation within TV\n EV extends undefined ? object : EV,\n // @ts-expect-error Keeping consistent with OG implementation within TV\n ES extends undefined ? object : ES\n >,\n // biome-ignore lint/style/useNamingConvention: Keeping consistent with OG implementation within TV\n EV extends TVVariants<ES, B, E['variants'], ES> = E['variants'],\n // biome-ignore lint/style/useNamingConvention: Keeping consistent with OG implementation within TV\n ES extends TVSlots = E['slots'] extends TVSlots ? E['slots'] : undefined,\n>(options: {\n extend?: E;\n base?: B;\n slots?: S;\n variants?: V;\n compoundVariants?: CV;\n compoundSlots?: TVCompoundSlots<V, S, B>;\n defaultVariants?: DV;\n}): TVReturnType<V, S, B, EV, ES, E> {\n const configuredStateMachine = _tv<V, CV, DV, B, S, E, EV, ES>(options);\n const wrappedStateMachine = ((props) => {\n const classNamesOrSlots = configuredStateMachine(props);\n\n return typeof classNamesOrSlots === 'string'\n ? mergeVariants(classNamesOrSlots)\n : Object.entries(\n classNamesOrSlots as Record<\n string,\n (slotProps?: TVProps<V, S, EV, ES>) => string\n >,\n ).reduce(\n (\n acc: Record<string, (slotProps?: TVProps<V, S, EV, ES>) => string>,\n [slot, callback],\n ) => {\n acc[slot] = (slotProps) => mergeVariants(callback(slotProps));\n\n return acc;\n },\n {},\n );\n }) as TVReturnType<V, S, B, EV, ES, E>;\n\n return Object.assign(wrappedStateMachine, configuredStateMachine);\n}\n\n// Types copied from RAC due to not being exported\ntype WithRef<T, E> = T & {\n ref?: ForwardedRef<E>;\n};\n\ninterface SlottedValue<T> {\n slots?: Record<string | symbol, T>;\n}\n\n/**\n * A helper to narrow the type of Context Value\n */\nexport function isSlottedContextValue<T, E>(\n context: ContextValue<T, E>,\n): context is SlottedValue<WithRef<T, E>> {\n return !!context && 'slots' in context;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/lib/utils.ts"],"names":["twMergeConfig","validators","twMerge","extendTailwindMerge","cn","inputs","clsx","PREFIX_REGEX","mergeVariants","className","prefixMap","cls","prefix","finalClassNames","key","s","_tv","createTV","tv","options","configuredStateMachine","props","classNamesOrSlots","acc","slot","callback","slotProps","isSlottedContextValue","context"],"mappings":"6HAgCA,MAAMA,EAAgB,CACpB,WAAA,CAAa,CACX,IAAA,CAAM,CAAC,CAAE,IAAA,CAAM,CAAC,EAAA,CAAIC,UAAAA,CAAW,KAAK,CAAE,CAAC,EACvC,EAAA,CAAI,CAAC,CAAE,EAAA,CAAI,CAAC,GAAIA,UAAAA,CAAW,KAAK,CAAE,CAAC,CACrC,EACA,sBAAA,CAAwB,CACtB,EAAA,CAAI,CAAC,OAAQ,YAAY,CAC3B,EACA,KAAA,CAAO,CACL,MAAO,CACL,SAAA,CACA,iBAAA,CACA,gBAAA,CACA,kBACA,kBAAA,CACA,mBAAA,CACA,sBACA,yBAAA,CACA,wBAAA,CACA,uBACA,cAAA,CACA,aAAA,CACA,aAAA,CACA,mBAAA,CACA,iBACA,iBAAA,CACA,kBAAA,CACA,YACA,YAAA,CACA,aAAA,CACA,gBACA,gBAAA,CACA,iBAAA,CACA,cACA,cAAA,CACA,eAAA,CACA,eACA,eAAA,CACA,gBAAA,CACA,gBACA,gBAAA,CACA,iBAAA,CACA,gBACA,cAAA,CACA,cAAA,CACA,eAAA,CACA,UAAA,CACA,Y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actic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { type ClassValue, clsx } from 'clsx';\nimport {\n type ClassNameValue,\n extendTailwindMerge,\n validators,\n} from 'tailwind-merge';\nimport {\n createTV,\n type TVCompoundSlots,\n type TVCompoundVariants,\n type TVDefaultVariants,\n type TVProps,\n type TVReturnType,\n type TVVariants,\n} from 'tailwind-variants';\nimport type { ForwardedRef } from 'react';\nimport type { ContextValue } from 'react-aria-components';\n\ntype AdditionalClassGroupIds = 'icon' | 'icon-size' | 'fg';\n\nconst twMergeConfig = {\n classGroups: {\n icon: [{ icon: ['', validators.isAny] }],\n fg: [{ fg: ['', validators.isAny] }],\n },\n conflictingClassGroups: {\n fg: ['icon', 'text-color'],\n },\n theme: {\n color: [\n 'current',\n 'surface-default',\n 'surface-raised',\n 'surface-overlay',\n 'transparent-dark',\n 'transparent-light',\n 'interactive-default',\n 'interactive-hover-light',\n 'interactive-hover-dark',\n 'interactive-disabled',\n 'static-light',\n 'static-dark',\n 'interactive',\n 'interactive-hover',\n 'highlight-bold',\n 'highlight-hover',\n 'highlight-subtle',\n 'info-bold',\n 'info-hover',\n 'info-subtle',\n 'advisory-bold',\n 'advisory-hover',\n 'advisory-subtle',\n 'normal-bold',\n 'normal-hover',\n 'normal-subtle',\n 'serious-bold',\n 'serious-hover',\n 'serious-subtle',\n 'critical-bold',\n 'critical-hover',\n 'critical-subtle',\n 'default-light',\n 'default-dark',\n 'inverse-dark',\n 'inverse-light',\n 'disabled',\n 'highlight',\n 'info',\n 'advisory',\n 'normal',\n 'serious',\n 'critical',\n 'classification-missing',\n 'classification-unclass',\n 'classification-cui',\n 'classification-confidential',\n 'classification-secret',\n 'classification-top-secret',\n ],\n font: ['primary', 'display'],\n text: [\n 'header-xxl',\n 'header-xl',\n 'header-l',\n 'header-m',\n 'header-s',\n 'header-xs',\n 'body-xl',\n 'body-l',\n 'body-m',\n 'body-s',\n 'body-xs',\n 'body-xxs',\n 'button-xl',\n 'button-l',\n 'button-m',\n 'button-s',\n 'button-xs',\n ],\n radius: ['none', 'small', 'medium', 'large', 'round'],\n shadow: ['elevation-default', 'elevation-overlay', 'elevation-raised'],\n spacing: [\n 'none',\n '0',\n 'xxs',\n 'xs',\n 's',\n 'm',\n 'l',\n 'xl',\n 'xxl',\n 'oversized',\n ],\n },\n} as const; // TODO: satisfies ?\n\nexport const twMerge = extendTailwindMerge<AdditionalClassGroupIds>({\n extend: twMergeConfig,\n});\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\nconst PREFIX_REGEX = /((?:[^:]*:)+)([^:]+)/;\n\nexport function mergeVariants(className: string) {\n if (!className) {\n return '';\n }\n\n // First build up a map of all prefixes.\n const prefixMap: Record<string, string[]> = {};\n\n for (const cls of className.split(' ')) {\n const [, prefix, className] = PREFIX_REGEX.exec(cls) ?? ['', 'BASE', cls];\n\n prefixMap[prefix] = prefixMap[prefix] ?? [];\n\n prefixMap[prefix].push(className);\n }\n\n const finalClassNames = [];\n\n for (const key of Object.keys(prefixMap)) {\n prefixMap[key] = twMerge(prefixMap[key]).split(' ');\n }\n\n for (const prefix of Object.keys(prefixMap)) {\n if (prefix === 'BASE') {\n finalClassNames.push(prefixMap[prefix]);\n } else {\n finalClassNames.push(prefixMap[prefix]?.map((s) => `${prefix}${s}`));\n }\n }\n\n return finalClassNames.flat().join(' ');\n}\n\nconst _tv = createTV({\n twMergeConfig,\n});\n\n// Copied from Tailwind Variants due to not being exported\ntype TVSlots = Record<string, ClassNameValue> | undefined;\n\nexport function tv<\n V extends TVVariants<S, B, EV>,\n // biome-ignore lint/style/useNamingConvention: Keeping consistent with OG implementation within TV\n CV extends TVCompoundVariants<V, S, B, EV, ES>,\n // biome-ignore lint/style/useNamingConvention: Keeping consistent with OG implementation within TV\n DV extends TVDefaultVariants<V, S, EV, ES>,\n B extends ClassNameValue = undefined,\n S extends TVSlots = undefined,\n // @ts-expect-error\n E extends TVReturnType = TVReturnType<\n V,\n S,\n B,\n // @ts-expect-error Keeping consistent with OG implementation within TV\n EV extends undefined ? object : EV,\n // @ts-expect-error Keeping consistent with OG implementation within TV\n ES extends undefined ? object : ES\n >,\n // biome-ignore lint/style/useNamingConvention: Keeping consistent with OG implementation within TV\n EV extends TVVariants<ES, B, E['variants'], ES> = E['variants'],\n // biome-ignore lint/style/useNamingConvention: Keeping consistent with OG implementation within TV\n ES extends TVSlots = E['slots'] extends TVSlots ? E['slots'] : undefined,\n>(options: {\n extend?: E;\n base?: B;\n slots?: S;\n variants?: V;\n compoundVariants?: CV;\n compoundSlots?: TVCompoundSlots<V, S, B>;\n defaultVariants?: DV;\n}): TVReturnType<V, S, B, EV, ES, E> {\n const configuredStateMachine = _tv<V, CV, DV, B, S, E, EV, ES>(options);\n const wrappedStateMachine = ((props) => {\n const classNamesOrSlots = configuredStateMachine(props);\n\n return typeof classNamesOrSlots === 'string'\n ? mergeVariants(classNamesOrSlots)\n : Object.entries(\n classNamesOrSlots as Record<\n string,\n (slotProps?: TVProps<V, S, EV, ES>) => string\n >,\n ).reduce(\n (\n acc: Record<string, (slotProps?: TVProps<V, S, EV, ES>) => string>,\n [slot, callback],\n ) => {\n acc[slot] = (slotProps) => mergeVariants(callback(slotProps));\n\n return acc;\n },\n {},\n );\n }) as TVReturnType<V, S, B, EV, ES, E>;\n\n return Object.assign(wrappedStateMachine, configuredStateMachine);\n}\n\n// Types copied from RAC due to not being exported\ntype WithRef<T, E> = T & {\n ref?: ForwardedRef<E>;\n};\n\ninterface SlottedValue<T> {\n slots?: Record<string | symbol, T>;\n}\n\n/**\n * A helper to narrow the type of Context Value\n */\nexport function isSlottedContextValue<T, E>(\n context: ContextValue<T, E>,\n): context is SlottedValue<WithRef<T, E>> {\n return !!context && 'slots' in context;\n}\n"]}
|