@accelint/design-toolkit 2.6.0 → 4.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 +42 -0
- package/dist/components/accordion/index.js.map +1 -1
- package/dist/components/accordion/styles.d.ts +1 -1
- package/dist/components/accordion/styles.js +1 -1
- package/dist/components/accordion/styles.js.map +1 -1
- package/dist/components/avatar/index.d.ts +29 -0
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/avatar/styles.d.ts +1 -1
- package/dist/components/badge/index.d.ts +24 -0
- package/dist/components/badge/index.js.map +1 -1
- package/dist/components/badge/styles.d.ts +1 -1
- package/dist/components/button/index.d.ts +104 -0
- package/dist/components/button/index.js +1 -1
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/button/styles.d.ts +31 -109
- package/dist/components/button/styles.js +1 -1
- package/dist/components/button/styles.js.map +1 -1
- package/dist/components/button/types.d.ts +6 -4
- package/dist/components/checkbox/index.d.ts +33 -0
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/checkbox/styles.d.ts +4 -4
- package/dist/components/checkbox/styles.js +1 -1
- package/dist/components/checkbox/styles.js.map +1 -1
- package/dist/components/chip/index.d.ts +34 -0
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/chip/styles.d.ts +4 -4
- 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 +15 -0
- package/dist/components/classification-badge/index.js.map +1 -1
- package/dist/components/classification-banner/index.d.ts +11 -0
- package/dist/components/classification-banner/index.js.map +1 -1
- package/dist/components/color-picker/styles.d.ts +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 -0
- package/dist/components/combobox-field/styles.d.ts +6 -6
- 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 -0
- package/dist/components/date-field/index.d.ts +45 -3
- package/dist/components/date-field/index.js +1 -1
- package/dist/components/date-field/index.js.map +1 -1
- package/dist/components/date-field/styles.d.ts +41 -51
- package/dist/components/date-field/styles.js +1 -1
- package/dist/components/date-field/styles.js.map +1 -1
- package/dist/components/date-field/types.d.ts +12 -15
- package/dist/components/details-list/styles.d.ts +1 -1
- package/dist/components/dialog/index.d.ts +48 -36
- package/dist/components/dialog/index.js +1 -1
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/dialog/styles.d.ts +60 -0
- package/dist/components/dialog/styles.js +2 -0
- package/dist/components/dialog/styles.js.map +1 -0
- package/dist/components/dialog/types.d.ts +14 -0
- package/dist/components/dialog/types.js +2 -0
- package/dist/components/dialog/types.js.map +1 -0
- package/dist/components/drawer/events.d.ts +8 -0
- package/dist/components/drawer/events.js +2 -0
- package/dist/components/drawer/events.js.map +1 -0
- package/dist/components/drawer/index.d.ts +89 -43
- package/dist/components/drawer/index.js +1 -1
- package/dist/components/drawer/index.js.map +1 -1
- package/dist/components/drawer/styles.d.ts +50 -16
- package/dist/components/drawer/styles.js +1 -1
- package/dist/components/drawer/styles.js.map +1 -1
- package/dist/components/drawer/types.d.ts +154 -238
- package/dist/components/drawer/types.js +1 -1
- package/dist/components/drawer/types.js.map +1 -1
- package/dist/components/hero/styles.d.ts +1 -1
- package/dist/components/hotkey/index.d.ts +32 -1
- package/dist/components/hotkey/index.js +1 -1
- package/dist/components/hotkey/index.js.map +1 -1
- package/dist/components/hotkey/styles.d.ts +1 -1
- package/dist/components/icon/index.d.ts +29 -0
- package/dist/components/icon/index.js.map +1 -1
- package/dist/components/icon/styles.d.ts +1 -1
- package/dist/components/input/index.d.ts +19 -0
- package/dist/components/input/index.js +1 -1
- package/dist/components/input/index.js.map +1 -1
- package/dist/components/input/styles.d.ts +1 -1
- package/dist/components/input/styles.js +1 -1
- package/dist/components/input/styles.js.map +1 -1
- package/dist/components/input/types.d.ts +1 -0
- package/dist/components/label/index.d.ts +19 -0
- package/dist/components/label/index.js.map +1 -1
- package/dist/components/label/styles.d.ts +1 -1
- package/dist/components/menu/index.d.ts +69 -7
- package/dist/components/menu/index.js +1 -1
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/menu/styles.d.ts +11 -38
- package/dist/components/menu/styles.js +1 -1
- package/dist/components/menu/styles.js.map +1 -1
- package/dist/components/menu/types.d.ts +11 -16
- package/dist/components/options/index.d.ts +41 -0
- package/dist/components/options/index.js.map +1 -1
- package/dist/components/options/styles.d.ts +6 -6
- package/dist/components/options/styles.js +1 -1
- package/dist/components/options/styles.js.map +1 -1
- package/dist/components/options/types.d.ts +1 -1
- package/dist/components/popover/index.d.ts +36 -2
- package/dist/components/popover/index.js +1 -1
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/popover/styles.d.ts +1 -1
- package/dist/components/query-builder/index.d.ts +24 -0
- package/dist/components/query-builder/index.js.map +1 -1
- package/dist/components/radio/index.d.ts +31 -0
- package/dist/components/radio/index.js.map +1 -1
- package/dist/components/radio/styles.d.ts +4 -4
- package/dist/components/radio/styles.js +1 -1
- package/dist/components/radio/styles.js.map +1 -1
- package/dist/components/search-field/styles.d.ts +1 -1
- package/dist/components/search-field/styles.js +1 -1
- package/dist/components/search-field/styles.js.map +1 -1
- package/dist/components/search-field/types.d.ts +1 -0
- package/dist/components/select-field/index.d.ts +44 -0
- 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.d.ts +7 -7
- 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 -0
- package/dist/components/skeleton/styles.d.ts +1 -1
- package/dist/components/slider/index.d.ts +15 -20
- package/dist/components/slider/index.js +1 -1
- package/dist/components/slider/index.js.map +1 -1
- package/dist/components/slider/styles.d.ts +84 -0
- package/dist/components/slider/styles.js +2 -0
- package/dist/components/slider/styles.js.map +1 -0
- package/dist/components/slider/types.d.ts +22 -0
- package/dist/components/slider/types.js +2 -0
- package/dist/components/slider/types.js.map +1 -0
- package/dist/components/switch/index.d.ts +36 -0
- package/dist/components/switch/index.js +1 -1
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/switch/styles.d.ts +24 -22
- package/dist/components/switch/styles.js +1 -1
- package/dist/components/switch/styles.js.map +1 -1
- package/dist/components/switch/types.d.ts +1 -0
- package/dist/components/tabs/index.d.ts +46 -0
- package/dist/components/tabs/index.js.map +1 -1
- package/dist/components/text-area-field/index.d.ts +20 -0
- package/dist/components/text-area-field/index.js.map +1 -1
- package/dist/components/text-area-field/styles.d.ts +7 -7
- 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.d.ts +62 -0
- package/dist/components/text-field/index.js.map +1 -1
- package/dist/components/text-field/styles.d.ts +7 -7
- package/dist/components/text-field/types.d.ts +1 -0
- package/dist/components/tooltip/index.d.ts +42 -0
- 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/view-stack/events.d.ts +9 -0
- package/dist/components/view-stack/events.js +2 -0
- package/dist/components/view-stack/events.js.map +1 -0
- package/dist/components/view-stack/index.d.ts +13 -10
- package/dist/components/view-stack/index.js +1 -1
- package/dist/components/view-stack/index.js.map +1 -1
- package/dist/components/view-stack/types.d.ts +13 -9
- package/dist/index.css +3 -3
- package/dist/index.d.ts +23 -19
- package/dist/index.js +1 -1
- package/dist/lib/types.d.ts +6 -2
- package/dist/lib/utils.d.ts +15 -5
- package/dist/lib/utils.js +1 -1
- package/dist/lib/utils.js.map +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/styles.css +1449 -774
- package/dist/tokens/index.js.map +1 -1
- package/dist/tokens/themes.css +12 -0
- package/dist/tokens/tokens.css +12 -0
- package/dist/variants/variants.css +19 -5
- package/package.json +16 -9
- package/dist/components/box/index.d.ts +0 -19
- package/dist/components/box/index.js +0 -2
- package/dist/components/box/index.js.map +0 -1
- package/dist/components/drawer/context.d.ts +0 -13
- package/dist/components/drawer/context.js +0 -2
- package/dist/components/drawer/context.js.map +0 -1
- package/dist/components/drawer/state.d.ts +0 -26
- package/dist/components/drawer/state.js +0 -2
- package/dist/components/drawer/state.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/view-stack/index.tsx"],"names":["bus","Broadcast","ViewStackEventNamespace","ViewStackContext","createContext","ViewStackEventTypes","ViewStackTrigger","children","types","parent","useContext","handlePress","type","isUUID","event","target","stack","jsx","PressResponder","Pressable","ViewStackView","id","view","register","unregister","useEffect","ViewStack","defaultView","views","useRef","setStack","useState","handleBack","useCallback","data","prev","handleClear","handleReset","handlePush"],"mappings":"yTAqCA,MAAMA,CAAAA,CAAMC,SAAAA,CAAU,WAAA,EAAY,CAC5BC,CAAAA,CAA0B,WAAA,CAC1BC,CAAAA,CAAmBC,cAAqC,CAC5D,MAAA,CAAQ,IAAA,CACR,KAAA,CAAO,EAAC,CACR,IAAA,CAAM,IAAA,CACN,QAAA,CAAU,IAAG,CAAA,CAAA,CACb,UAAA,CAAY,IAAG,CAAA,CACjB,CAAC,CAAA,CAEYC,CAAAA,CAAsB,CACjC,IAAA,CAAM,CAAA,EAAGH,CAAuB,QAChC,KAAA,CAAO,CAAA,EAAGA,CAAuB,CAAA,MAAA,CAAA,CACjC,KAAA,CAAO,CAAA,EAAGA,CAAuB,CAAA,MAAA,CAAA,CACjC,IAAA,CAAM,CAAA,EAAGA,CAAuB,CAAA,KAAA,CAClC,EAEA,SAASI,CAAAA,CAAiB,CAAE,QAAA,CAAAC,CAAAA,CAAU,GAAA,CAAKC,CAAM,CAAA,CAA0B,CACzE,KAAM,CAAE,MAAA,CAAAC,CAAO,CAAA,CAAIC,UAAAA,CAAWP,CAAgB,CAAA,CAE9C,SAASQ,CAAAA,EAAc,CACrB,IAAA,M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A,CACpD,UAAA,CAAaA,CAAAA,EAAmBM,CAAAA,CAAM,OAAA,CAAQ,MAAA,CAAON,CAAI,CAC3D,CAAA,CAEC,QAAA,CAAAf,CAAAA,CACH,CAEJ,CACAmB,CAAAA,CAAU,WAAA,CAAc,WAAA,CACxBA,CAAAA,CAAU,IAAA,CAAON,CAAAA,CACjBM,CAAAA,CAAU,OAAA,CAAUpB,CAAAA","file":"index.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'use client';\n\nimport 'client-only';\nimport { Broadcast, type Payload } from '@accelint/bus';\nimport { type UniqueId, isUUID } from '@accelint/core';\nimport { PressResponder } from '@react-aria/interactions';\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport { Pressable } from 'react-aria-components';\nimport type {\n ViewStackBackEvent,\n ViewStackClearEvent,\n ViewStackContextValue,\n ViewStackProps,\n ViewStackPushEvent,\n ViewStackResetEvent,\n ViewStackTriggerProps,\n ViewStackViewProps,\n} from './types';\n\nconst bus = Broadcast.getInstance();\nconst ViewStackEventNamespace = 'ViewStack';\nconst ViewStackContext = createContext<ViewStackContextValue>({\n parent: null,\n stack: [],\n view: null,\n register: () => undefined,\n unregister: () => undefined,\n});\n\nexport const ViewStackEventTypes = {\n back: `${ViewStackEventNamespace}:back`,\n clear: `${ViewStackEventNamespace}:clear`,\n reset: `${ViewStackEventNamespace}:reset`,\n push: `${ViewStackEventNamespace}:push`,\n} as const;\n\nfunction ViewStackTrigger({ children, for: types }: ViewStackTriggerProps) {\n const { parent } = useContext(ViewStackContext);\n\n function handlePress() {\n for (const type of Array.isArray(types) ? types : [types]) {\n if (isUUID(type)) {\n bus.emit<ViewStackPushEvent>(ViewStackEventTypes.push, {\n view: type,\n });\n } else {\n const [event, target] = type.split(':') as [\n 'back' | 'clear' | 'reset',\n UniqueId | undefined,\n ];\n const stack = target ?? parent;\n\n if (stack) {\n bus.emit<\n ViewStackBackEvent | ViewStackClearEvent | ViewStackResetEvent\n >(`${ViewStackEventNamespace}:${event}`, {\n stack,\n });\n }\n }\n }\n }\n\n return (\n <PressResponder onPress={handlePress}>\n <Pressable>{children}</Pressable>\n </PressResponder>\n );\n}\nViewStackTrigger.displayName = 'ViewStack.Trigger';\n\nfunction ViewStackView({ id, children }: ViewStackViewProps) {\n const { parent, view, register, unregister } = useContext(ViewStackContext);\n\n if (!parent) {\n throw new Error('ViewStack.View must be implemented within a ViewStack');\n }\n\n if (!isUUID(id)) {\n throw new Error(`ViewStack.View's id must be a UniqueId`);\n }\n\n useEffect(() => {\n register(id);\n\n () => unregister(id);\n }, [register, unregister, id]);\n\n return view === id ? children : null;\n}\nViewStackView.displayName = 'ViewStack.View';\n\nexport function ViewStack({ id, children, defaultView }: ViewStackProps) {\n if (!isUUID(id)) {\n throw new Error(`ViewStack's id must be a UniqueId`);\n }\n\n const views = useRef(new Set<UniqueId>());\n const [stack, setStack] = useState<UniqueId[]>(\n defaultView ? [defaultView] : [],\n );\n const view = stack.at(-1) ?? null;\n\n const handleBack = useCallback(\n (data: Payload<ViewStackBackEvent>) => {\n if (id === data?.payload?.stack) {\n setStack((prev) => {\n if (prev.length <= 1) {\n return defaultView ? [defaultView] : [];\n }\n\n return prev.slice(0, -1);\n });\n }\n },\n [id, defaultView],\n );\n\n const handleClear = useCallback(\n (data: Payload<ViewStackClearEvent>) => {\n if (id === data?.payload?.stack) {\n setStack(() => []);\n }\n },\n [id],\n );\n\n const handleReset = useCallback(\n (data: Payload<ViewStackResetEvent>) => {\n if (id === data?.payload?.stack) {\n setStack(() => (defaultView ? [defaultView] : []));\n }\n },\n [id, defaultView],\n );\n\n const handlePush = useCallback((data: Payload<ViewStackPushEvent>) => {\n if (views.current.has(data?.payload?.view)) {\n setStack((prev) => [...prev, data?.payload?.view]);\n }\n }, []);\n\n useEffect(() => {\n bus.on(ViewStackEventTypes.back, handleBack);\n bus.on(ViewStackEventTypes.clear, handleClear);\n bus.on(ViewStackEventTypes.reset, handleReset);\n bus.on(ViewStackEventTypes.push, handlePush);\n\n return () => {\n bus.off(ViewStackEventTypes.back, handleBack);\n bus.off(ViewStackEventTypes.clear, handleClear);\n bus.off(ViewStackEventTypes.reset, handleReset);\n bus.off(ViewStackEventTypes.push, handlePush);\n };\n }, [handleBack, handleClear, handleReset, handlePush]);\n\n return (\n <ViewStackContext.Provider\n value={{\n parent: id,\n stack,\n view,\n register: (view: UniqueId) => views.current.add(view),\n unregister: (view: UniqueId) => views.current.delete(view),\n }}\n >\n {children}\n </ViewStackContext.Provider>\n );\n}\nViewStack.displayName = 'ViewStack';\nViewStack.View = ViewStackView;\nViewStack.Trigger = ViewStackTrigger;\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/view-stack/index.tsx"],"names":["Broadcast","h","ViewStackContext","createContext","q","ViewStackEventHandlers","bus","o","types","useContext","d","type","event","isUUID","l","id","parent","I","x","ViewStackTrigger","E","register","unregister","view","b","stack","setStack","useState","defaultView","g","useCallback","data","next","onChange","handleClear","handlePush","views","prev","handleReset","ViewStackEventTypes","off","listeners","handleBack","jsx","ViewStack"],"mappings":"iTAsCYA,MAAU,CAAA,CAAAC,SAAA,CAAA,WAETC,EAAmBC,CAAqC,CACnE,CAAAC,aAAA,CAAA,CAAA,MAAQ,CAAA,IACR,CAAA,KACA,CAAA,EAAA,CAAA,IAAM,CAAA,IACN,CAAA,QAAU,CAAG,IACb,CAAA,CAAA,CAAA,UAAY,CAAG,IAChB,CAEYC,CAAAA,CAAyB,CACpC,CAAA,CAAA,CAAA,CAAA,IAA2BC,CAAA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CAAGiC,CAAAA,EAAoB,CAAAhC,mBAAA,CAAA,KAC3BD,CAAAA,CAAI,CAAA,CAAA,CAAGiC,CAAAA,EAAoB,CAAAhC,mBAAA,CAAA,IAC3BD,CAAAA,CAAI,GAAGiC,CAAAA,EAAoB,CAAAhC,mBAAA,CAAA,KAC7B,CAEA,CAAA,CAAA,CAAA,CAAA,OAAa,IACX,CAAA,IAAA,MAAWiC,CAAOC,IACZ,CAER,CACF,CAAA,GAAIC,CAAAA,CAAYR,CAAAA,CAAaC,CAAAA,CAAYG,CAAW,CAAC,CAAA,CAGnDK,CAAAA,CAACzC,CAAAA,CAAiBe,GAAA,CAAA,CAAA,CAAA,QAChB,CAAA,CAAA,KACE,CAAA,CAAA,MACA,CAAA,CAAA,CAAA,KACA,CAAA,CAAA,CAAA,IACA,CAAA,CAAA,CAAA,QAA8BmB,CAAAA,CAAM,EAAA,CAAA,CAAA,OAAQ,CAAIb,GAChD,CAAA,CAAA,CAAA,CAAA,UAAgCa,CAAAA,CAAM,EAAA,CAAA,CAAA,OAAQ,CAAA,MAChD,CAEC,CAAA,CAAA,CAAA,CAAA,QAGP,CACAQ,CAAAA,CAAU,CAAA,CAAA,CAAA,CAAA,WAAc,CAAA,WACd,CAAA,CAAA,CAAA,IACVA,CAAU,CAAA,CAAA,CAAA,CAAA,OAAUzB,CAAAA,CAAAA","file":"index.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'use client';\n\nimport 'client-only';\nimport { Broadcast } from '@accelint/bus';\nimport { type UniqueId, isUUID } from '@accelint/core';\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport { Pressable } from 'react-aria-components';\nimport { ViewStackEventTypes } from './events';\nimport type {\n ViewStackBackEvent,\n ViewStackClearEvent,\n ViewStackContextValue,\n ViewStackEvent,\n ViewStackProps,\n ViewStackPushEvent,\n ViewStackResetEvent,\n ViewStackTriggerProps,\n ViewStackViewProps,\n} from './types';\n\nconst bus = Broadcast.getInstance<ViewStackEvent>();\n\nexport const ViewStackContext = createContext<ViewStackContextValue>({\n parent: null,\n stack: [],\n view: null,\n register: () => undefined,\n unregister: () => undefined,\n});\n\nexport const ViewStackEventHandlers = {\n back: (stack: UniqueId) => bus.emit(ViewStackEventTypes.back, { stack }),\n clear: (stack: UniqueId) => bus.emit(ViewStackEventTypes.clear, { stack }),\n push: (view: UniqueId) => bus.emit(ViewStackEventTypes.push, { view }),\n reset: (stack: UniqueId) => bus.emit(ViewStackEventTypes.reset, { stack }),\n} as const;\n\nfunction ViewStackTrigger({ children, for: types }: ViewStackTriggerProps) {\n const { parent } = useContext(ViewStackContext);\n\n function handlePress() {\n for (const type of Array.isArray(types) ? types : [types]) {\n let [event, id] = (isUUID(type) ? ['push', type] : type.split(':')) as [\n 'back' | 'clear' | 'reset' | 'push',\n UniqueId | undefined | null,\n ];\n\n id ??= parent;\n\n if (!id) {\n continue;\n }\n\n ViewStackEventHandlers[event](id);\n }\n }\n\n return <Pressable onPress={handlePress}>{children}</Pressable>;\n}\nViewStackTrigger.displayName = 'ViewStack.Trigger';\n\nfunction ViewStackView({ id, children }: ViewStackViewProps) {\n const { parent, view, register, unregister } = useContext(ViewStackContext);\n\n if (!parent) {\n throw new Error('ViewStack.View must be implemented within a ViewStack');\n }\n\n if (!isUUID(id)) {\n throw new Error(`ViewStack.View's id must be a UniqueId`);\n }\n\n useEffect(() => {\n register(id);\n\n () => unregister(id);\n }, [register, unregister, id]);\n\n return view === id ? children : null;\n}\nViewStackView.displayName = 'ViewStack.View';\n\nexport function ViewStack({\n id,\n children,\n defaultView,\n onChange,\n}: ViewStackProps) {\n if (!isUUID(id)) {\n throw new Error(`ViewStack's id must be a UniqueId`);\n }\n\n const views = useRef(new Set<UniqueId>());\n const [stack, setStack] = useState<UniqueId[]>(\n defaultView ? [defaultView] : [],\n );\n const view = stack.at(-1) ?? null;\n\n const handleBack = useCallback(\n (data: ViewStackBackEvent) => {\n if (id === data?.payload?.stack) {\n const next = stack.slice(0, -1);\n\n if (!next.length && defaultView) {\n next.push(defaultView);\n }\n\n setStack(next);\n onChange?.(next.at(-1) ?? null);\n }\n },\n [id, defaultView, onChange, stack],\n );\n\n const handleClear = useCallback(\n (data: ViewStackClearEvent) => {\n if (id === data?.payload?.stack) {\n setStack([]);\n onChange?.(null);\n }\n },\n [id, onChange],\n );\n\n const handlePush = useCallback(\n (data: ViewStackPushEvent) => {\n if (views.current.has(data?.payload?.view)) {\n setStack((prev) => [...prev, data?.payload?.view]);\n onChange?.(data?.payload?.view);\n }\n },\n [onChange],\n );\n\n const handleReset = useCallback(\n (data: ViewStackResetEvent) => {\n if (id === data?.payload?.stack) {\n setStack(defaultView ? [defaultView] : []);\n onChange?.(defaultView ?? null);\n }\n },\n [id, defaultView, onChange],\n );\n\n useEffect(() => {\n const listeners = [\n bus.on(ViewStackEventTypes.back, handleBack),\n bus.on(ViewStackEventTypes.clear, handleClear),\n bus.on(ViewStackEventTypes.push, handlePush),\n bus.on(ViewStackEventTypes.reset, handleReset),\n ];\n\n return () => {\n for (const off of listeners) {\n off();\n }\n };\n }, [handleBack, handleClear, handlePush, handleReset]);\n\n return (\n <ViewStackContext.Provider\n value={{\n parent: id,\n stack,\n view,\n register: (view: UniqueId) => views.current.add(view),\n unregister: (view: UniqueId) => views.current.delete(view),\n }}\n >\n {children}\n </ViewStackContext.Provider>\n );\n}\nViewStack.displayName = 'ViewStack';\nViewStack.View = ViewStackView;\nViewStack.Trigger = ViewStackTrigger;\n"]}
|
|
@@ -1,26 +1,30 @@
|
|
|
1
|
+
import { Payload } from '@accelint/bus';
|
|
1
2
|
import { UniqueId } from '@accelint/core';
|
|
2
3
|
import { RefAttributes, PropsWithChildren, ComponentProps } from 'react';
|
|
3
4
|
import { Pressable } from 'react-aria-components';
|
|
5
|
+
import { ViewStackEventTypes } from './events.js';
|
|
4
6
|
|
|
5
7
|
type ViewStackProps = RefAttributes<HTMLDivElement> & PropsWithChildren<{
|
|
6
8
|
id: UniqueId;
|
|
7
9
|
defaultView?: UniqueId;
|
|
10
|
+
onChange?: (view: UniqueId | null) => void;
|
|
8
11
|
}>;
|
|
9
12
|
type ViewStackViewProps = RefAttributes<HTMLDivElement> & PropsWithChildren<{
|
|
10
13
|
id: UniqueId;
|
|
11
14
|
}>;
|
|
12
|
-
type ViewStackBackEvent = {
|
|
15
|
+
type ViewStackBackEvent = Payload<typeof ViewStackEventTypes.back, {
|
|
13
16
|
stack: UniqueId;
|
|
14
|
-
}
|
|
15
|
-
type ViewStackClearEvent = {
|
|
17
|
+
}>;
|
|
18
|
+
type ViewStackClearEvent = Payload<typeof ViewStackEventTypes.clear, {
|
|
16
19
|
stack: UniqueId;
|
|
17
|
-
}
|
|
18
|
-
type ViewStackResetEvent = {
|
|
20
|
+
}>;
|
|
21
|
+
type ViewStackResetEvent = Payload<typeof ViewStackEventTypes.reset, {
|
|
19
22
|
stack: UniqueId;
|
|
20
|
-
}
|
|
21
|
-
type ViewStackPushEvent = {
|
|
23
|
+
}>;
|
|
24
|
+
type ViewStackPushEvent = Payload<typeof ViewStackEventTypes.push, {
|
|
22
25
|
view: UniqueId;
|
|
23
|
-
}
|
|
26
|
+
}>;
|
|
27
|
+
type ViewStackEvent = ViewStackBackEvent | ViewStackClearEvent | ViewStackResetEvent | ViewStackPushEvent;
|
|
24
28
|
type SimpleEvents = 'back' | 'clear' | 'reset' | UniqueId;
|
|
25
29
|
type TargetedEvents = `back:${UniqueId}` | `clear:${UniqueId}` | `reset:${UniqueId}`;
|
|
26
30
|
type ChainedEvents = (SimpleEvents | TargetedEvents)[];
|
|
@@ -55,4 +59,4 @@ type ViewStackContextValue = {
|
|
|
55
59
|
unregister: (view: UniqueId) => void;
|
|
56
60
|
};
|
|
57
61
|
|
|
58
|
-
export type { ViewStackBackEvent, ViewStackClearEvent, ViewStackContextValue, ViewStackProps, ViewStackPushEvent, ViewStackResetEvent, ViewStackTriggerProps, ViewStackViewProps };
|
|
62
|
+
export type { ViewStackBackEvent, ViewStackClearEvent, ViewStackContextValue, ViewStackEvent, ViewStackProps, ViewStackPushEvent, ViewStackResetEvent, ViewStackTriggerProps, ViewStackViewProps };
|
package/dist/index.css
CHANGED
|
@@ -182,16 +182,16 @@ body {
|
|
|
182
182
|
/*
|
|
183
183
|
* Scrollbars
|
|
184
184
|
*/
|
|
185
|
-
|
|
185
|
+
::-webkit-scrollbar {
|
|
186
186
|
width: var(--spacing-l);
|
|
187
187
|
height: var(--spacing-l);
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
|
|
190
|
+
::-webkit-scrollbar-track {
|
|
191
191
|
background: var(--color-interactive);
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
|
|
194
|
+
::-webkit-scrollbar-thumb{
|
|
195
195
|
background-color: var(--color-interactive-hover-light);
|
|
196
196
|
border-radius: var(--radius-large);
|
|
197
197
|
border: 5px solid transparent;
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ export { AvatarProps } from './components/avatar/types.js';
|
|
|
7
7
|
export { Badge, BadgeContext } from './components/badge/index.js';
|
|
8
8
|
export { BadgeStyles, BadgeStylesDefaults } from './components/badge/styles.js';
|
|
9
9
|
export { BadgeProps } from './components/badge/types.js';
|
|
10
|
-
export { Box, BoxProps } from './components/box/index.js';
|
|
11
10
|
export { Button, ButtonContext, LinkButton, LinkButtonContext, ToggleButton, ToggleButtonContext } from './components/button/index.js';
|
|
12
11
|
export { ButtonStyles, ButtonStylesDefaults, LinkButtonStyles, ToggleButtonStyles } from './components/button/styles.js';
|
|
13
12
|
export { ButtonProps, ButtonStyleVariants, LinkButtonProps, ToggleButtonProps } from './components/button/types.js';
|
|
@@ -30,21 +29,22 @@ export { ComboBoxField, ComboBoxFieldContext } from './components/combobox-field
|
|
|
30
29
|
export { ComboBoxStyles } from './components/combobox-field/styles.js';
|
|
31
30
|
export { ComboBoxFieldProps } from './components/combobox-field/types.js';
|
|
32
31
|
export { DateField } from './components/date-field/index.js';
|
|
33
|
-
export { DateFieldStyles,
|
|
34
|
-
export { DateFieldProps
|
|
32
|
+
export { DateFieldStyles, DateFieldStylesDefaults } from './components/date-field/styles.js';
|
|
33
|
+
export { DateFieldProps } from './components/date-field/types.js';
|
|
35
34
|
export { DetailsList, DetailsListContext } from './components/details-list/index.js';
|
|
36
35
|
export { DetailsListStyles, DetailsListStylesDefaults } from './components/details-list/styles.js';
|
|
37
36
|
export { DetailsListLabelProps, DetailsListProps, DetailsListValueProps } from './components/details-list/types.js';
|
|
38
|
-
export { Dialog,
|
|
39
|
-
export {
|
|
40
|
-
export {
|
|
41
|
-
export {
|
|
42
|
-
export {
|
|
43
|
-
export {
|
|
37
|
+
export { Dialog, DialogContext } from './components/dialog/index.js';
|
|
38
|
+
export { DialogStyles } from './components/dialog/styles.js';
|
|
39
|
+
export { DialogProps } from './components/dialog/types.js';
|
|
40
|
+
export { DrawerEventNamespace, DrawerEventTypes } from './components/drawer/events.js';
|
|
41
|
+
export { Drawer, DrawerContext, DrawerEventHandlers } from './components/drawer/index.js';
|
|
42
|
+
export { DrawerMenuStyles, DrawerMenuStylesDefaults, DrawerStyles, DrawerTitleStyles, DrawerTitleStylesDefaults } from './components/drawer/styles.js';
|
|
43
|
+
export { DrawerContextValue, DrawerEvent, DrawerLayoutProps, DrawerMenuItemProps, DrawerMenuProps, DrawerOpenEvent, DrawerProps, DrawerTitleProps, DrawerToggleEvent, DrawerTriggerProps } from './components/drawer/types.js';
|
|
44
44
|
export { Hero, HeroContext } from './components/hero/index.js';
|
|
45
45
|
export { HeroStyles } from './components/hero/styles.js';
|
|
46
46
|
export { HeroProps } from './components/hero/types.js';
|
|
47
|
-
export { Hotkey, HotkeyContext
|
|
47
|
+
export { Hotkey, HotkeyContext } from './components/hotkey/index.js';
|
|
48
48
|
export { HotkeyStyles, HotkeyStylesDefaults } from './components/hotkey/styles.js';
|
|
49
49
|
export { HotkeyProps, HotkeySetProps } from './components/hotkey/types.js';
|
|
50
50
|
export { Icon, IconContext } from './components/icon/index.js';
|
|
@@ -57,12 +57,12 @@ export { Label, LabelContext } from './components/label/index.js';
|
|
|
57
57
|
export { LabelStyles } from './components/label/styles.js';
|
|
58
58
|
export { LabelProps } from './components/label/types.js';
|
|
59
59
|
export { Menu, MenuContext } from './components/menu/index.js';
|
|
60
|
-
export {
|
|
61
|
-
export { MenuItemProps, MenuProps, MenuSectionProps
|
|
60
|
+
export { MenuStyles, MenuStylesDefaults } from './components/menu/styles.js';
|
|
61
|
+
export { MenuItemProps, MenuProps, MenuSectionProps } from './components/menu/types.js';
|
|
62
62
|
export { Options, OptionsContext } from './components/options/index.js';
|
|
63
63
|
export { OptionsStyles } from './components/options/styles.js';
|
|
64
64
|
export { OptionsDataItem, OptionsItemProps, OptionsItemTextProps, OptionsProps, OptionsSectionProps } from './components/options/types.js';
|
|
65
|
-
export { Popover
|
|
65
|
+
export { Popover } from './components/popover/index.js';
|
|
66
66
|
export { PopoverStyles } from './components/popover/styles.js';
|
|
67
67
|
export { PopoverBodyProps, PopoverContentProps, PopoverProps, PopoverTitleProps, PopoverTriggerProps } from './components/popover/types.js';
|
|
68
68
|
export { QueryBuilder } from './components/query-builder/index.js';
|
|
@@ -79,7 +79,9 @@ export { SelectFieldProps } from './components/select-field/types.js';
|
|
|
79
79
|
export { Skeleton } from './components/skeleton/index.js';
|
|
80
80
|
export { SkeletonStyles, SkeletonStylesDefaults } from './components/skeleton/styles.js';
|
|
81
81
|
export { SkeletonProps, SkeletonStyleVariants } from './components/skeleton/types.js';
|
|
82
|
-
export {
|
|
82
|
+
export { Slider } from './components/slider/index.js';
|
|
83
|
+
export { SliderStyles } from './components/slider/styles.js';
|
|
84
|
+
export { SliderProps } from './components/slider/types.js';
|
|
83
85
|
export { Switch, SwitchContext } from './components/switch/index.js';
|
|
84
86
|
export { SwitchStyles } from './components/switch/styles.js';
|
|
85
87
|
export { SwitchProps } from './components/switch/types.js';
|
|
@@ -93,11 +95,12 @@ export { TextFieldProps } from './components/text-field/types.js';
|
|
|
93
95
|
export { Tooltip, TooltipContext } from './components/tooltip/index.js';
|
|
94
96
|
export { TooltipStyles } from './components/tooltip/styles.js';
|
|
95
97
|
export { TooltipBodyProps, TooltipProps, TooltipTriggerProps } from './components/tooltip/types.js';
|
|
96
|
-
export {
|
|
97
|
-
export {
|
|
98
|
+
export { ViewStackEventNamespace, ViewStackEventTypes } from './components/view-stack/events.js';
|
|
99
|
+
export { ViewStack, ViewStackContext, ViewStackEventHandlers } from './components/view-stack/index.js';
|
|
100
|
+
export { ViewStackBackEvent, ViewStackClearEvent, ViewStackContextValue, ViewStackEvent, ViewStackProps, ViewStackPushEvent, ViewStackResetEvent, ViewStackTriggerProps, ViewStackViewProps } from './components/view-stack/types.js';
|
|
98
101
|
export { containsExactChildren, expectsIconWrapper } from './lib/react.js';
|
|
99
|
-
export { ChildrenRenderProps, ClassNameRenderProps, ProviderProps, RenderProps, RenderPropsChildren, RenderPropsClassName, RenderPropsStyle, SlottedValue, StylePropRenderProps, StyleRenderProps } from './lib/types.js';
|
|
100
|
-
export { cn, isSlottedContextValue, tv, twMerge } from './lib/utils.js';
|
|
102
|
+
export { AriaAttributes, AriaAttributesWithRef, ChildrenRenderProps, ClassNameRenderProps, ProviderProps, RenderProps, RenderPropsChildren, RenderPropsClassName, RenderPropsStyle, SlottedValue, StylePropRenderProps, StyleRenderProps } from './lib/types.js';
|
|
103
|
+
export { cn, isSlottedContextValue, mergeVariants, tv, twMerge } from './lib/utils.js';
|
|
101
104
|
export { RGBAColor, colorAdvisory, colorAdvisoryBold, colorAdvisoryHover, colorAdvisorySubtle, colorClassificationConfidential, colorClassificationCui, colorClassificationMissing, colorClassificationSecret, colorClassificationTopSecret, colorClassificationTsSci, colorClassificationUnclass, colorCritical, colorCriticalBold, colorCriticalHover, colorCriticalSubtle, colorDefaultDark, colorDefaultLight, colorDisabled, colorHighlight, colorHighlightBold, colorHighlightHover, colorHighlightSubtle, colorInfo, colorInfoBold, colorInfoHover, colorInfoSubtle, colorInteractive, colorInteractiveDefault, colorInteractiveDisabled, colorInteractiveHover, colorInteractiveHoverDark, colorInteractiveHoverLight, colorInverseDark, colorInverseLight, colorNormal, colorNormalBold, colorNormalHover, colorNormalSubtle, colorSerious, colorSeriousBold, colorSeriousHover, colorSeriousSubtle, colorStaticDark, colorStaticLight, colorSurfaceDefault, colorSurfaceOverlay, colorSurfaceRaised, colorTransparentDark, colorTransparentLight, fontDisplay, fontPrimary, iconSizeL, iconSizeM, iconSizeS, iconSizeXs, radiusLarge, radiusMedium, radiusNone, radiusRound, radiusSmall, shadowElevationDefault, shadowElevationOverlay, shadowElevationRaised, spacing0, spacingL, spacingM, spacingNone, spacingOversized, spacingS, spacingXl, spacingXs, spacingXxl, spacingXxs, typographyBodyLHeight, typographyBodyLSize, typographyBodyLSpacing, typographyBodyMHeight, typographyBodyMSize, typographyBodyMSpacing, typographyBodySHeight, typographyBodySSize, typographyBodySSpacing, typographyBodyXsHeight, typographyBodyXsSize, typographyBodyXsSpacing, typographyBodyXxsHeight, typographyBodyXxsSize, typographyBodyXxsSpacing, typographyButtonLHeight, typographyButtonLSize, typographyButtonLSpacing, typographyButtonMHeight, typographyButtonMSize, typographyButtonMSpacing, typographyButtonSHeight, typographyButtonSSize, typographyButtonSSpacing, typographyButtonXsHeight, typographyButtonXsSize, typographyButtonXsSpacing, typographyHeaderLHeight, typographyHeaderLSize, typographyHeaderLSpacing, typographyHeaderMHeight, typographyHeaderMSize, typographyHeaderMSpacing, typographyHeaderSHeight, typographyHeaderSSize, typographyHeaderSSpacing, typographyHeaderXlHeight, typographyHeaderXlSize, typographyHeaderXlSpacing, typographyHeaderXsHeight, typographyHeaderXsSize, typographyHeaderXsSpacing, typographyHeaderXxlHeight, typographyHeaderXxlSize, typographyHeaderXxlSpacing } from './tokens/index.js';
|
|
102
105
|
import 'react/jsx-runtime';
|
|
103
106
|
import 'react';
|
|
@@ -108,6 +111,8 @@ import '@radix-ui/react-avatar';
|
|
|
108
111
|
import '@react-types/overlays';
|
|
109
112
|
import '@react-types/shared';
|
|
110
113
|
import '@internationalized/date';
|
|
114
|
+
import '@accelint/core';
|
|
115
|
+
import '@accelint/bus';
|
|
111
116
|
import './components/query-builder/value-selector.js';
|
|
112
117
|
import 'react-querybuilder';
|
|
113
118
|
import './components/query-builder/value-editor.js';
|
|
@@ -115,5 +120,4 @@ import './components/query-builder/group.js';
|
|
|
115
120
|
import './components/query-builder/rule.js';
|
|
116
121
|
import './components/query-builder/action-element.js';
|
|
117
122
|
import 'type-fest';
|
|
118
|
-
import '@accelint/core';
|
|
119
123
|
import 'clsx';
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{Accordion,AccordionContext}from'./components/accordion/index.js';export{AccordionStyles,AccordionStylesDefaults}from'./components/accordion/styles.js';export{Avatar,AvatarContext}from'./components/avatar/index.js';export{AvatarStyles}from'./components/avatar/styles.js';export{Badge,BadgeContext}from'./components/badge/index.js';export{BadgeStyles,BadgeStylesDefaults}from'./components/badge/styles.js';export{
|
|
1
|
+
export{Accordion,AccordionContext}from'./components/accordion/index.js';export{AccordionStyles,AccordionStylesDefaults}from'./components/accordion/styles.js';export{Avatar,AvatarContext}from'./components/avatar/index.js';export{AvatarStyles}from'./components/avatar/styles.js';export{Badge,BadgeContext}from'./components/badge/index.js';export{BadgeStyles,BadgeStylesDefaults}from'./components/badge/styles.js';export{Button,ButtonContext,LinkButton,LinkButtonContext,ToggleButton,ToggleButtonContext}from'./components/button/index.js';export{ButtonStyles,ButtonStylesDefaults,LinkButtonStyles,ToggleButtonStyles}from'./components/button/styles.js';export{Checkbox,CheckboxContext,CheckboxGroupContext}from'./components/checkbox/index.js';export{CheckboxStyles}from'./components/checkbox/styles.js';export{Chip,ChipContext}from'./components/chip/index.js';export{BaseChipStyles,ChipStyles,ChipStylesDefaults,DeletableChipStyles,SelectableChipStyles}from'./components/chip/styles.js';export{ClassificationBadge,ClassificationBadgeContext}from'./components/classification-badge/index.js';export{ClassificationBadgeStyles,ClassificationBadgeStylesDefaults}from'./components/classification-badge/styles.js';export{ClassificationBanner,ClassificationBannerContext}from'./components/classification-banner/index.js';export{ClassificationBannerStyles,ClassificationBannerStylesDefaults}from'./components/classification-banner/styles.js';export{ColorPicker}from'./components/color-picker/index.js';export{ColorPickerStyles}from'./components/color-picker/styles.js';export{ComboBoxField,ComboBoxFieldContext}from'./components/combobox-field/index.js';export{ComboBoxStyles}from'./components/combobox-field/styles.js';export{DateField}from'./components/date-field/index.js';export{DateFieldStyles,DateFieldStylesDefaults}from'./components/date-field/styles.js';export{DetailsList,DetailsListContext}from'./components/details-list/index.js';export{DetailsListStyles,DetailsListStylesDefaults}from'./components/details-list/styles.js';export{Dialog,DialogContext}from'./components/dialog/index.js';export{DialogStyles}from'./components/dialog/styles.js';export{DrawerEventNamespace,DrawerEventTypes}from'./components/drawer/events.js';export{Drawer,DrawerContext,DrawerEventHandlers}from'./components/drawer/index.js';export{DrawerMenuStyles,DrawerMenuStylesDefaults,DrawerStyles,DrawerTitleStyles,DrawerTitleStylesDefaults}from'./components/drawer/styles.js';export{Hero,HeroContext}from'./components/hero/index.js';export{HeroStyles}from'./components/hero/styles.js';export{Hotkey,HotkeyContext}from'./components/hotkey/index.js';export{HotkeyStyles,HotkeyStylesDefaults}from'./components/hotkey/styles.js';export{Icon,IconContext}from'./components/icon/index.js';export{IconStyles}from'./components/icon/styles.js';export{Input,InputContext}from'./components/input/index.js';export{InputStyles,InputStylesDefaults}from'./components/input/styles.js';export{Label,LabelContext}from'./components/label/index.js';export{LabelStyles}from'./components/label/styles.js';export{Menu,MenuContext}from'./components/menu/index.js';export{MenuStyles,MenuStylesDefaults}from'./components/menu/styles.js';export{Options,OptionsContext}from'./components/options/index.js';export{OptionsStyles}from'./components/options/styles.js';export{Popover}from'./components/popover/index.js';export{PopoverStyles}from'./components/popover/styles.js';export{QueryBuilder}from'./components/query-builder/index.js';export{Radio,RadioContext}from'./components/radio/index.js';export{RadioStyles}from'./components/radio/styles.js';export{SearchField,SearchFieldContext}from'./components/search-field/index.js';export{SearchFieldStyles,SearchFieldStylesDefaults}from'./components/search-field/styles.js';export{SelectField,SelectFieldContext}from'./components/select-field/index.js';export{SelectFieldStyles}from'./components/select-field/styles.js';export{Skeleton}from'./components/skeleton/index.js';export{SkeletonStyles,SkeletonStylesDefaults}from'./components/skeleton/styles.js';export{Slider}from'./components/slider/index.js';export{SliderStyles}from'./components/slider/styles.js';export{Switch,SwitchContext}from'./components/switch/index.js';export{SwitchStyles}from'./components/switch/styles.js';export{Tabs}from'./components/tabs/index.js';export{TextAreaField,TextAreaFieldContext}from'./components/text-area-field/index.js';export{TextAreaStyles}from'./components/text-area-field/styles.js';export{TextField,TextFieldContext}from'./components/text-field/index.js';export{TextFieldStyles}from'./components/text-field/styles.js';export{Tooltip,TooltipContext}from'./components/tooltip/index.js';export{TooltipStyles}from'./components/tooltip/styles.js';export{ViewStackEventNamespace,ViewStackEventTypes}from'./components/view-stack/events.js';export{ViewStack,ViewStackContext,ViewStackEventHandlers}from'./components/view-stack/index.js';export{containsExactChildren,expectsIconWrapper}from'./lib/react.js';export{cn,isSlottedContextValue,mergeVariants,tv,twMerge}from'./lib/utils.js';export{colorAdvisory,colorAdvisoryBold,colorAdvisoryHover,colorAdvisorySubtle,colorClassificationConfidential,colorClassificationCui,colorClassificationMissing,colorClassificationSecret,colorClassificationTopSecret,colorClassificationTsSci,colorClassificationUnclass,colorCritical,colorCriticalBold,colorCriticalHover,colorCriticalSubtle,colorDefaultDark,colorDefaultLight,colorDisabled,colorHighlight,colorHighlightBold,colorHighlightHover,colorHighlightSubtle,colorInfo,colorInfoBold,colorInfoHover,colorInfoSubtle,colorInteractive,colorInteractiveDefault,colorInteractiveDisabled,colorInteractiveHover,colorInteractiveHoverDark,colorInteractiveHoverLight,colorInverseDark,colorInverseLight,colorNormal,colorNormalBold,colorNormalHover,colorNormalSubtle,colorSerious,colorSeriousBold,colorSeriousHover,colorSeriousSubtle,colorStaticDark,colorStaticLight,colorSurfaceDefault,colorSurfaceOverlay,colorSurfaceRaised,colorTransparentDark,colorTransparentLight,fontDisplay,fontPrimary,iconSizeL,iconSizeM,iconSizeS,iconSizeXs,radiusLarge,radiusMedium,radiusNone,radiusRound,radiusSmall,shadowElevationDefault,shadowElevationOverlay,shadowElevationRaised,spacing0,spacingL,spacingM,spacingNone,spacingOversized,spacingS,spacingXl,spacingXs,spacingXxl,spacingXxs,typographyBodyLHeight,typographyBodyLSize,typographyBodyLSpacing,typographyBodyMHeight,typographyBodyMSize,typographyBodyMSpacing,typographyBodySHeight,typographyBodySSize,typographyBodySSpacing,typographyBodyXsHeight,typographyBodyXsSize,typographyBodyXsSpacing,typographyBodyXxsHeight,typographyBodyXxsSize,typographyBodyXxsSpacing,typographyButtonLHeight,typographyButtonLSize,typographyButtonLSpacing,typographyButtonMHeight,typographyButtonMSize,typographyButtonMSpacing,typographyButtonSHeight,typographyButtonSSize,typographyButtonSSpacing,typographyButtonXsHeight,typographyButtonXsSize,typographyButtonXsSpacing,typographyHeaderLHeight,typographyHeaderLSize,typographyHeaderLSpacing,typographyHeaderMHeight,typographyHeaderMSize,typographyHeaderMSpacing,typographyHeaderSHeight,typographyHeaderSSize,typographyHeaderSSpacing,typographyHeaderXlHeight,typographyHeaderXlSize,typographyHeaderXlSpacing,typographyHeaderXsHeight,typographyHeaderXsSize,typographyHeaderXsSpacing,typographyHeaderXxlHeight,typographyHeaderXxlSize,typographyHeaderXxlSpacing}from'./tokens/index.js';//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/lib/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PropsWithChildren, ReactNode, CSSProperties } from 'react';
|
|
1
|
+
import { PropsWithChildren, AriaAttributes as AriaAttributes$1, AriaRole, RefAttributes, ReactNode, CSSProperties } from 'react';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Re-export due to not being exported by library
|
|
@@ -29,5 +29,9 @@ type SlottedValue<T> = {
|
|
|
29
29
|
slots?: Record<string | symbol, T>;
|
|
30
30
|
};
|
|
31
31
|
type ProviderProps<T> = PropsWithChildren<Omit<T, 'children' | 'slot'> & SlottedValue<T>>;
|
|
32
|
+
type AriaAttributes = AriaAttributes$1 & {
|
|
33
|
+
role?: AriaRole;
|
|
34
|
+
};
|
|
35
|
+
type AriaAttributesWithRef<T> = AriaAttributes & RefAttributes<T>;
|
|
32
36
|
|
|
33
|
-
export type { ChildrenRenderProps, ClassNameRenderProps, ProviderProps, RenderProps, RenderPropsChildren, RenderPropsClassName, RenderPropsStyle, SlottedValue, StylePropRenderProps, StyleRenderProps };
|
|
37
|
+
export type { AriaAttributes, AriaAttributesWithRef, ChildrenRenderProps, ClassNameRenderProps, ProviderProps, RenderProps, RenderPropsChildren, RenderPropsClassName, RenderPropsStyle, SlottedValue, StylePropRenderProps, StyleRenderProps };
|
package/dist/lib/utils.d.ts
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
|
-
import * as tailwind_variants from 'tailwind-variants';
|
|
2
|
-
import * as tailwind_merge from 'tailwind-merge';
|
|
3
1
|
import { ClassValue } from 'clsx';
|
|
4
2
|
import { ForwardedRef } from 'react';
|
|
5
3
|
import { ContextValue } from 'react-aria-components';
|
|
4
|
+
import { ClassNameValue } from 'tailwind-merge';
|
|
5
|
+
import { TVVariants, TVCompoundVariants, TVDefaultVariants, TVReturnType, TVCompoundSlots } from 'tailwind-variants';
|
|
6
6
|
|
|
7
|
-
declare const twMerge: (...classLists:
|
|
7
|
+
declare const twMerge: (...classLists: ClassNameValue[]) => string;
|
|
8
8
|
declare function cn(...inputs: ClassValue[]): string;
|
|
9
|
-
declare
|
|
9
|
+
declare function mergeVariants(className: string): string;
|
|
10
|
+
type TVSlots = Record<string, ClassNameValue> | undefined;
|
|
11
|
+
declare function tv<V extends TVVariants<S, B, EV>, CV extends TVCompoundVariants<V, S, B, EV, ES>, DV extends TVDefaultVariants<V, S, EV, ES>, B extends ClassNameValue = undefined, S extends TVSlots = undefined, E extends TVReturnType = TVReturnType<V, S, B, EV extends undefined ? object : EV, ES extends undefined ? object : ES>, EV extends TVVariants<ES, B, E['variants'], ES> = E['variants'], ES extends TVSlots = E['slots'] extends TVSlots ? E['slots'] : undefined>(options: {
|
|
12
|
+
extend?: E;
|
|
13
|
+
base?: B;
|
|
14
|
+
slots?: S;
|
|
15
|
+
variants?: V;
|
|
16
|
+
compoundVariants?: CV;
|
|
17
|
+
compoundSlots?: TVCompoundSlots<V, S, B>;
|
|
18
|
+
defaultVariants?: DV;
|
|
19
|
+
}): TVReturnType<V, S, B, EV, ES, E>;
|
|
10
20
|
type WithRef<T, E> = T & {
|
|
11
21
|
ref?: ForwardedRef<E>;
|
|
12
22
|
};
|
|
@@ -18,4 +28,4 @@ interface SlottedValue<T> {
|
|
|
18
28
|
*/
|
|
19
29
|
declare function isSlottedContextValue<T, E>(context: ContextValue<T, E>): context is SlottedValue<WithRef<T, E>>;
|
|
20
30
|
|
|
21
|
-
export { cn, isSlottedContextValue, tv, twMerge };
|
|
31
|
+
export { cn, isSlottedContextValue, mergeVariants, tv, twMerge };
|
package/dist/lib/utils.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {clsx}from'clsx';import {extendTailwindMerge
|
|
1
|
+
import {clsx}from'clsx';import {validators,extendTailwindMerge}from'tailwind-merge';import {createTV}from'tailwind-variants';const a={classGroups:{icon:[{icon:["",validators.isAny]}],fg:[{fg:["",validators.isAny]}]},conflictingClassGroups:{fg:["icon","text-color"]},theme:{color:["current","surface-default","surface-raised","surface-overlay","transparent-dark","transparent-light","interactive-default","interactive-hover-light","interactive-hover-dark","interactive-disabled","static-light","static-dark","interactive","interactive-hover","highlight-bold","highlight-hover","highlight-subtle","info-bold","info-hover","info-subtle","advisory-bold","advisory-hover","advisory-subtle","normal-bold","normal-hover","normal-subtle","serious-bold","serious-hover","serious-subtle","critical-bold","critical-hover","critical-subtle","default-light","default-dark","inverse-dark","inverse-light","disabled","highlight","info","advisory","normal","serious","critical","classification-missing","classification-unclass","classification-cui","classification-confidential","classification-secret","classification-top-secret"],font:["primary","display"],text:["header-xxl","header-xl","header-l","header-m","header-s","header-xs","body-xl","body-l","body-m","body-s","body-xs","body-xxs","button-xl","button-l","button-m","button-s","button-xs"],radius:["none","small","medium","large","round"],shadow:["elevation-default","elevation-overlay","elevation-raised"],spacing:["none","0","xxs","xs","s","m","l","xl","xxl","oversized"]}},l=extendTailwindMerge({extend:a});function g(...s){return l(clsx(s))}const h=/((?:[^:]*:)+)([^:]+)/;function d(s){if(!s)return "";const e={};for(const t of s.split(" ")){const[,o,n]=h.exec(t)??["","BASE",t];e[o]=e[o]??[],e[o].push(n);}const r=[];for(const t of Object.keys(e))e[t]=l(e[t]).split(" ");for(const t of Object.keys(e))t==="BASE"?r.push(e[t]):r.push(e[t]?.map(o=>`${t}${o}`));return r.flat().join(" ")}const E=createTV({twMergeConfig:a});function T(s){const e=E(s);return Object.assign(t=>{const o=e(t);return typeof o=="string"?d(o):Object.entries(o).reduce((n,[c,u])=>(n[c]=V=>d(u(V)),n),{})},e)}function b(s){return !!s&&"slots"in s}export{g as cn,b as isSlottedContextValue,d as mergeVariants,T as tv,l as twMerge};//# sourceMappingURL=utils.js.map
|
|
2
2
|
//# sourceMappingURL=utils.js.map
|
package/dist/lib/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/utils.ts"],"names":["twMerge","extendTailwindMerge","validators","cn","inputs","clsx","tv","createTV","isSlottedContextValue","context"],"mappings":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,QAAA,CACA,SACA,SAAA,CACA,UAAA,CACA,YACA,UAAA,CACA,UAAA,CACA,WACA,WACF,CAAA,CACA,MAAA,CAAQ,CAAC,OAAQ,OAAA,CAAS,QAAA,CAAU,OAAA,CAAS,OAAO,EACpD,MAAA,CAAQ,CAAC,mBAAA,CAAqB,mBAAA,CAAqB,kBAAkB,CAAA,CACrE,OAAA,CAAS,CACP,MAAA,CACA,GAAA,CACA,MACA,IAAA,CACA,GAAA,CACA,GAAA,CACA,GAAA,CACA,KACA,KAAA,CACA,WACF,CACF,CACF,CACF,CACF,CAAC,EAcM,SAASM,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 { extendTailwindMerge, validators } from 'tailwind-merge';\nimport { createTV } from 'tailwind-variants';\n\ntype AdditionalClassGroupIds = 'icon' | 'icon-size' | 'fg';\n\nexport const twMerge = extendTailwindMerge<AdditionalClassGroupIds>({\n extend: {\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 },\n});\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\nexport const tv = createTV({\n twMergeConfig: {\n extend: {\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 },\n },\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,YACA,MAAA,CACA,UAAA,CACA,SACA,SAAA,CACA,UAAA,CACA,yBACA,wBAAA,CACA,oBAAA,CACA,6BAAA,CACA,uBAAA,CACA,2BACF,CAAA,CACA,IAAA,CAAM,CAAC,SAAA,CAAW,SAAS,EAC3B,IAAA,CAAM,CACJ,YAAA,CACA,WAAA,CACA,WACA,UAAA,CACA,UAAA,CACA,YACA,SAAA,CACA,QAAA,CACA,SACA,QAAA,CACA,SAAA,CACA,WACA,WAAA,CACA,UAAA,CACA,WACA,UAAA,CACA,WACF,EACA,MAAA,CAAQ,CAAC,OAAQ,OAAA,CAAS,QAAA,CAAU,OAAA,CAAS,OAAO,EACpD,MAAA,CAAQ,CAAC,oBAAqB,mBAAA,CAAqB,kBAAkB,EACrE,OAAA,CAAS,CACP,MAAA,CACA,GAAA,CACA,M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CAAE,KAAK,GAAG,CACxC,CAEA,MAAMG,CAAAA,CAAMC,SAAS,CACnB,aAAA,CAAAjB,CACF,CAAC,EAKM,SAASkB,CAAAA,CAsBdC,EAQmC,CACnC,MAAMC,EAAyBJ,CAAAA,CAAgCG,CAAO,EAwBtE,OAAO,MAAA,CAAO,OAvBgBE,CAAAA,EAAU,CACtC,MAAMC,CAAAA,CAAoBF,CAAAA,CAAuBC,CAAK,CAAA,CAEtD,OAAO,OAAOC,CAAAA,EAAsB,SAChCd,CAAAA,CAAcc,CAAiB,EAC/B,MAAA,CAAO,OAAA,CACLA,CAIF,CAAA,CAAE,MAAA,CACA,CACEC,CAAAA,CACA,CAACC,CAAAA,CAAMC,CAAQ,KAEfF,CAAAA,CAAIC,CAAI,EAAKE,CAAAA,EAAclB,CAAAA,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"]}
|