@accelint/design-toolkit 1.0.1 → 2.1.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/README.md +16 -7
- package/dist/components/accordion/index.d.ts +21 -30
- package/dist/components/accordion/index.js +1 -1
- package/dist/components/accordion/index.js.map +1 -1
- package/dist/components/accordion/styles.d.ts +96 -0
- package/dist/components/accordion/styles.js +2 -0
- package/dist/components/accordion/styles.js.map +1 -0
- package/dist/components/accordion/types.d.ts +20 -0
- package/dist/components/avatar/index.d.ts +4 -4
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/badge/index.d.ts +2 -2
- package/dist/components/badge/index.js.map +1 -1
- package/dist/components/box/index.d.ts +3 -3
- package/dist/components/box/index.js.map +1 -1
- package/dist/components/button/index.js +1 -1
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/checkbox/index.d.ts +2 -2
- package/dist/components/checkbox/index.js +1 -1
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/chip/index.d.ts +2 -2
- package/dist/components/chip/index.js +1 -1
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/classification-badge/index.js.map +1 -1
- package/dist/components/classification-banner/index.js.map +1 -1
- package/dist/components/color-picker/index.d.ts +21 -0
- package/dist/components/color-picker/index.js +2 -0
- package/dist/components/color-picker/index.js.map +1 -0
- package/dist/components/combobox/index.d.ts +7 -16
- package/dist/components/combobox/index.js +1 -1
- package/dist/components/combobox/index.js.map +1 -1
- package/dist/components/date-field/index.d.ts +28 -0
- package/dist/components/date-field/index.js +2 -0
- package/dist/components/date-field/index.js.map +1 -0
- package/dist/components/dialog/index.d.ts +40 -0
- package/dist/components/dialog/index.js +2 -0
- package/dist/components/dialog/index.js.map +1 -0
- package/dist/components/floating-button/index.js.map +1 -1
- package/dist/components/icon/index.d.ts +15 -15
- package/dist/components/icon/index.js +1 -1
- package/dist/components/icon/index.js.map +1 -1
- package/dist/components/icon/styles.d.ts +34 -0
- package/dist/components/icon/styles.js +2 -0
- package/dist/components/icon/styles.js.map +1 -0
- package/dist/components/icon/types.d.ts +10 -0
- package/dist/components/icon/types.js +2 -0
- package/dist/components/icon/types.js.map +1 -0
- package/dist/components/icon-button/index.js +1 -1
- package/dist/components/icon-button/index.js.map +1 -1
- package/dist/components/label/index.js.map +1 -1
- package/dist/components/options/index.d.ts +32 -0
- package/dist/components/options/index.js +2 -0
- package/dist/components/options/index.js.map +1 -0
- package/dist/components/options-item/index.d.ts +30 -0
- package/dist/components/options-item/index.js +2 -0
- package/dist/components/options-item/index.js.map +1 -0
- package/dist/components/query-builder/action-element.d.ts +6 -0
- package/dist/components/query-builder/action-element.js +2 -0
- package/dist/components/query-builder/action-element.js.map +1 -0
- package/dist/components/query-builder/constants.d.ts +3 -0
- package/dist/components/query-builder/constants.js +2 -0
- package/dist/components/query-builder/constants.js.map +1 -0
- package/dist/components/query-builder/example-configuration.d.ts +30 -0
- package/dist/components/query-builder/example-configuration.js +2 -0
- package/dist/components/query-builder/example-configuration.js.map +1 -0
- package/dist/components/query-builder/group.d.ts +8 -0
- package/dist/components/query-builder/group.js +2 -0
- package/dist/components/query-builder/group.js.map +1 -0
- package/dist/components/query-builder/index.d.ts +44 -0
- package/dist/components/query-builder/index.js +2 -0
- package/dist/components/query-builder/index.js.map +1 -0
- package/dist/components/query-builder/rule.d.ts +6 -0
- package/dist/components/query-builder/rule.js +2 -0
- package/dist/components/query-builder/rule.js.map +1 -0
- package/dist/components/query-builder/utils.d.ts +14 -0
- package/dist/components/query-builder/utils.js +2 -0
- package/dist/components/query-builder/utils.js.map +1 -0
- package/dist/components/query-builder/value-editor.d.ts +6 -0
- package/dist/components/query-builder/value-editor.js +2 -0
- package/dist/components/query-builder/value-editor.js.map +1 -0
- package/dist/components/query-builder/value-selector.d.ts +6 -0
- package/dist/components/query-builder/value-selector.js +2 -0
- package/dist/components/query-builder/value-selector.js.map +1 -0
- package/dist/components/radio/index.d.ts +2 -2
- package/dist/components/radio/index.js +1 -1
- package/dist/components/radio/index.js.map +1 -1
- package/dist/components/search-field/index.d.ts +19 -0
- package/dist/components/search-field/index.js +2 -0
- package/dist/components/search-field/index.js.map +1 -0
- package/dist/components/slider/index.d.ts +23 -0
- package/dist/components/slider/index.js +2 -0
- package/dist/components/slider/index.js.map +1 -0
- package/dist/components/switch/index.d.ts +1 -1
- package/dist/components/switch/index.js +1 -1
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/tabs/index.d.ts +33 -0
- package/dist/components/tabs/index.js +2 -0
- package/dist/components/tabs/index.js.map +1 -0
- package/dist/components/text-area/index.js +1 -1
- package/dist/components/text-area/index.js.map +1 -1
- package/dist/components/text-field/index.js +1 -1
- package/dist/components/text-field/index.js.map +1 -1
- package/dist/components/toggle-icon-button/index.js +1 -1
- package/dist/components/toggle-icon-button/index.js.map +1 -1
- package/dist/components/tooltip/index.d.ts +2 -2
- package/dist/components/tooltip/index.js +1 -1
- package/dist/components/tooltip/index.js.map +1 -1
- package/dist/icons/catalog.js.map +1 -1
- package/dist/index.css +60 -6
- package/dist/index.d.ts +28 -6
- package/dist/index.js +1 -1
- package/dist/lib/react.d.ts +15 -3
- package/dist/lib/react.js +4 -1
- package/dist/lib/react.js.map +1 -1
- package/dist/lib/types.d.ts +29 -0
- package/dist/lib/types.js +2 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/utils.d.ts +15 -1
- 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 +715 -129
- package/package.json +28 -9
- package/dist/types/types.d.ts +0 -11
- /package/dist/{types → components/accordion}/types.js +0 -0
- /package/dist/{types → components/accordion}/types.js.map +0 -0
@@ -1,14 +1,14 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
2
|
import * as cva_types from 'cva/types';
|
3
3
|
import { VariantProps } from 'cva';
|
4
|
-
import
|
4
|
+
import React__default, { ReactNode } from 'react';
|
5
5
|
import { TagGroupProps, TagListProps, TagProps } from 'react-aria-components';
|
6
6
|
|
7
7
|
declare const chipStyles: (props?: ({
|
8
8
|
variant?: "info" | "advisory" | "normal" | "serious" | "critical" | null | undefined;
|
9
9
|
size?: "small" | "medium" | null | undefined;
|
10
10
|
} & cva_types.ClassProp) | undefined) => string;
|
11
|
-
interface ChipProps extends VariantProps<typeof chipStyles>, Omit<
|
11
|
+
interface ChipProps extends VariantProps<typeof chipStyles>, Omit<React__default.HTMLProps<HTMLSpanElement>, 'children' | 'size'> {
|
12
12
|
className?: string;
|
13
13
|
/** Used to add text to the badge, such as the number of unread notifications. */
|
14
14
|
children?: ReactNode;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import {cn}from'./../../lib/utils.js';import {CancelFill}from'@accelint/icons';import {cva}from'cva';import {createContext,useContext}from'react';import {Tag,Button,TagGroup,TagList}from'react-aria-components';import {Icon}from'../icon/index.js';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var
|
1
|
+
import {cn}from'./../../lib/utils.js';import {CancelFill}from'@accelint/icons';import {cva}from'cva';import {createContext,useContext}from'react';import {Tag,Button,TagGroup,TagList}from'react-aria-components';import {Icon}from'../icon/index.js';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var m=cva(cn(["fg-default-light inline-flex w-content items-center justify-center gap-xxs rounded-full outline"]),{variants:{variant:{advisory:"bg-advisory-subtle outline-advisory-bold",critical:"bg-critical-subtle outline-critical",serious:"bg-serious-subtle outline-serious",normal:"bg-normal-subtle outline-normal",info:"bg-info-subtle outline-info-bold"},size:{medium:"px-s py-xs text-body-s",small:"px-s py-xs text-body-xs"}},defaultVariants:{size:"medium",variant:"info"}}),f=createContext(false),r=({className:e,size:t="medium",variant:a="info",...o})=>{let n=useContext(f)?Tag:"span";return jsx(Icon.Provider,{size:t==="medium"?"small":"xsmall",children:jsx(n,{className:cn(m({size:t,variant:a,className:e})),...o})})};r.displayName="Chip";r.as=(e,t)=>cn(m({...e,className:t}));function b({children:e,className:t,items:a,renderEmptyState:o,...l}){return jsx(f.Provider,{value:true,children:jsx(TagGroup,{...l,children:jsx(TagList,{items:a,renderEmptyState:o,className:cn("flex flex-wrap gap-xs",t),children:e})})})}b.displayName="Chip.List";r.List=b;var A=cva(cn(["fg-default-light inline-flex w-content items-center justify-center rounded-full outline outline-interactive hover:outline-interactive-hover focus:outline-interactive-hover","dtk-selected:bg-highlight-subtle dtk-selected:outline-highlight"]),{variants:{isDisabled:{true:"fg-disabled dtk-selected:bg-transparent dtk-selected:outline-interactive-disabled outline-interactive-disabled hover:outline-interactive-disabled focus:outline-interactive-disabled",false:"cursor-pointer"},size:{medium:"px-s py-xs text-body-s",small:"px-s py-xs text-body-xs"}},defaultVariants:{isDisabled:false,size:"medium"}}),g=({className:e,isDisabled:t=false,size:a="medium",...o})=>jsx(Tag,{className:cn(A({isDisabled:t,size:a,className:e})),...o});g.displayName="Chip.Selectable";r.Selectable=g;var N=cva(cn(["fg-default-light group inline-flex w-content items-center justify-center gap-xs rounded-full outline outline-interactive hover:outline-interactive-hover focus:outline-interactive-hover"]),{variants:{isDisabled:{true:"fg-disabled outline-interactive-disabled hover:outline-interactive-disabled",false:""},size:{medium:"p-xs pl-m text-body-s",small:"p-xs pl-s text-body-xs"}},defaultVariants:{isDisabled:false,size:"medium"}}),h=({children:e,className:t,isDisabled:a=false,size:o="medium",textValue:l,...n})=>{let x=l??(typeof e=="string"?e:void 0);return jsx(Tag,{className:cn(N({isDisabled:a,size:o,className:t})),textValue:x,...n,children:({allowsRemoving:c,...y})=>{if(!c)throw new Error("You have a <Chip.Deletable> in a <Chip.List> does not specify an onRemove handler.");return jsxs(Fragment,{children:[typeof e=="function"?e({allowsRemoving:c,...y}):e,jsx(Button,{slot:"remove",className:cn(["icon-default-dark group-hover:icon-default-light group-focus:icon-default-light cursor-pointer",a&&"icon-disabled group-hover:icon-disabled cursor-not-allowed"]),children:jsx(Icon,{size:"small",children:jsx(CancelFill,{})})})]})}})};h.displayName="Chip.Deletable";r.Deletable=h;export{r as Chip,h as DeletableChip,g as SelectableChip};//# sourceMappingURL=index.js.map
|
2
2
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/chip/index.tsx"],"names":["Chip","v","size","variant","props","Component","useContext","Coordinator","C","c","jsx","a","className","cn","chipStyles","children","items","P","renderEmptyState","ChipList","cva","i","SelectableChip","p","internalTextValue","AriaTag","isDisabled","allowsRemoving","jsxs","Fragment","Button","S","L","y","DeletableChip"],"mappings":"wSA8BI,+GAGA,CAAA,CAAA,CAAA,CAAA,QACE,CAAA,CAAS,OACG,CAAA,CAAA,QAAA,CAAA,mDAEV,CAAA,qCAAA,CAAS,2CACD,CAAA,MAAA,CAAA,iCACF,CAAA,IAAA,CAAA,kCAGN,CAAQ,CAAA,IAAA,CAAA,CAAA,MAAA,CAAA,oCAEV,CAAA,KAAA,CAAA,qCAEe,CAAA,CAAA,CAAA,eACT,CAAA,CAAA,IAAA,CAAA,QACG,CAAA,OAEb,CACF,MAckC,CAAA,CAAK,EAE1BA,CAAO,CAAAC,aAAC,CACnB,KAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,SACAC,EAAO,CACP,IAAA,CAAA,CAAA,CAAA,QAAA,CAAAC,OAAU,CAAA,CACV,CAAGC,OACY,GAMf,CAAA,CAAMC,GALUC,CAAWC,KAKW,CAEtCC,UAAA,CAAA,CAAA,CAAA,CAAAC,GAAA,CAAA,MAEEC,wBAGM,CAAAC,EAAA,CAAAT,CACA,CAAA,CAAA,IAAA,CAAA,CAAA,CAAAC,OACAS,CAAAA,CAAAA,CAAAA,UAGAR,CACN,CAAA,CAEJ,CACAJ,CAAAA,GAAmB,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,WACnBA,QAEEY,CACGC,CAAAA,EAAAA,CAAAA,CAAGC,EAAW,CAAE,GAAGV,EAAO,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,CAAA,SAM/B,CAAA,CAAA,CAAA,C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,CAAAA,SAAAA,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\nimport { cn } from '@/lib/utils';\nimport { CancelFill } from '@accelint/icons';\nimport { type VariantProps, cva } from 'cva';\nimport type React from 'react';\nimport { type ReactNode, createContext, useContext } from 'react';\nimport {\n Tag as AriaTag,\n TagGroup as AriaTagGroup,\n type TagGroupProps as AriaTagGroupProps,\n TagList as AriaTagList,\n type TagListProps as AriaTagListProps,\n type TagProps as AriaTagProps,\n Button,\n} from 'react-aria-components';\nimport { Icon } from '../icon';\n\nconst chipStyles = cva(\n cn([\n 'fg-default-light inline-flex w-content items-center justify-center gap-xxs rounded-full outline',\n ]),\n {\n variants: {\n variant: {\n advisory: 'bg-advisory-subtle outline-advisory-bold',\n critical: 'bg-critical-subtle outline-critical',\n serious: 'bg-serious-subtle outline-serious',\n normal: 'bg-normal-subtle outline-normal',\n info: 'bg-info-subtle outline-info-bold',\n },\n size: {\n medium: 'icon-size-l px-s py-xs text-body-s',\n small: 'icon-size-m px-s py-xs text-body-xs',\n },\n },\n defaultVariants: {\n size: 'medium',\n variant: 'info',\n },\n },\n);\n\nexport interface ChipProps\n extends VariantProps<typeof chipStyles>,\n Omit<React.HTMLProps<HTMLSpanElement>, 'children' | 'size'> {\n className?: string;\n /** Used to add text to the badge, such as the number of unread notifications. */\n children?: ReactNode;\n}\n\n// This coordinator is used as a way for the `<Chip>` component to understand\n// whether or not it is being rendered inside of a `<Chip.List>`. This allows\n// us to opt-into using an `<AriaTag>` or a `<span>` to ensure standalone\n// functionality.\nconst Coordinator = createContext(false);\n\nexport const Chip = ({\n className,\n size = 'medium',\n variant = 'info',\n ...props\n}: ChipProps) => {\n const context = useContext(Coordinator);\n\n // If any context was returned from the `Coordinator` context, then\n // we are being rendered inside of a `Chip.List` and need to render\n // an `<AriaTag>`.\n const Component = context ? AriaTag : 'span';\n\n return (\n // @ts-expect-error we are intentionally omitting children.\n <Component\n className={cn(\n chipStyles({\n size,\n variant,\n className,\n }),\n )}\n {...props}\n />\n );\n};\nChip.displayName = 'Chip';\nChip.as = (\n props: VariantProps<typeof chipStyles>,\n className?: string | string[],\n) => cn(chipStyles({ ...props, className }));\n\nexport interface ChipListProps<T>\n extends Omit<AriaTagGroupProps, 'children'>,\n Pick<AriaTagListProps<T>, 'items' | 'children' | 'renderEmptyState'> {}\n\nfunction ChipList<T extends object>({\n children,\n className,\n items,\n renderEmptyState,\n ...props\n}: ChipListProps<T>) {\n return (\n <Coordinator.Provider value={true}>\n <AriaTagGroup {...props}>\n <AriaTagList<T>\n items={items}\n renderEmptyState={renderEmptyState}\n className={cn('flex flex-wrap gap-xs', className)}\n >\n {children}\n </AriaTagList>\n </AriaTagGroup>\n </Coordinator.Provider>\n );\n}\nChipList.displayName = 'Chip.List';\nChip.List = ChipList;\n\nconst selectableChipStyles = cva(\n cn([\n 'fg-default-light inline-flex w-content items-center justify-center rounded-full outline outline-interactive hover:outline-interactive-hover focus:outline-interactive-hover',\n 'ai-selected:bg-highlight-subtle ai-selected:outline-highlight',\n ]),\n {\n variants: {\n isDisabled: {\n true: 'fg-disabled ai-selected:bg-transparent ai-selected:outline-interactive-disabled outline-interactive-disabled hover:outline-interactive-disabled focus:outline-interactive-disabled',\n false: 'cursor-pointer',\n },\n size: {\n medium: 'px-s py-xs text-body-s',\n small: 'px-s py-xs text-body-xs',\n },\n },\n defaultVariants: {\n isDisabled: false,\n size: 'medium',\n },\n },\n);\n\ninterface SelectableChipProps\n extends VariantProps<typeof selectableChipStyles>,\n Omit<AriaTagProps, 'isDisabled'> {}\n\nexport const SelectableChip = ({\n className,\n isDisabled = false,\n size = 'medium',\n ...props\n}: SelectableChipProps) => (\n <AriaTag\n className={cn(\n selectableChipStyles({\n isDisabled,\n size,\n className,\n }),\n )}\n {...props}\n />\n);\nSelectableChip.displayName = 'Chip.Selectable';\nChip.Selectable = SelectableChip;\n\nconst deletableChipStyles = cva(\n cn([\n 'fg-default-light group inline-flex w-content items-center justify-center gap-xs rounded-full outline outline-interactive hover:outline-interactive-hover focus:outline-interactive-hover',\n ]),\n {\n variants: {\n isDisabled: {\n true: 'fg-disabled outline-interactive-disabled hover:outline-interactive-disabled',\n false: '',\n },\n size: {\n medium: 'p-xs pl-m text-body-s',\n small: 'p-xs pl-s text-body-xs',\n },\n },\n defaultVariants: {\n isDisabled: false,\n size: 'medium',\n },\n },\n);\n\ninterface DeletableChipProps\n extends VariantProps<typeof deletableChipStyles>,\n Omit<AriaTagProps, 'isDisabled'> {}\n\nexport const DeletableChip = ({\n children,\n className,\n isDisabled = false,\n size = 'medium',\n textValue,\n ...props\n}: DeletableChipProps) => {\n const internalTextValue =\n textValue ?? (typeof children === 'string' ? children : undefined);\n\n return (\n <AriaTag\n className={cn(\n deletableChipStyles({\n isDisabled,\n size,\n className,\n }),\n )}\n textValue={internalTextValue}\n {...props}\n >\n {({ allowsRemoving, ...props }) => {\n if (!allowsRemoving) {\n throw new Error(\n 'You have a <Chip.Deletable> in a <Chip.List> does not specify an onRemove handler.',\n );\n }\n\n return (\n <>\n {typeof children === 'function'\n ? children({ allowsRemoving, ...props })\n : children}\n <Button\n slot='remove'\n className={cn([\n 'icon-size-[15px] icon-default-dark group-hover:icon-default-light group-focus:icon-default-light cursor-pointer',\n isDisabled &&\n 'icon-disabled group-hover:icon-disabled cursor-not-allowed',\n ])}\n >\n <Icon>\n <CancelFill />\n </Icon>\n </Button>\n </>\n );\n }}\n </AriaTag>\n );\n};\nDeletableChip.displayName = 'Chip.Deletable';\nChip.Deletable = DeletableChip;\n"]}
|
1
|
+
{"version":3,"sources":["../../../src/components/chip/index.tsx"],"names":["p","s","Chip","P","size","variant","Component","useContext","Coordinator","AriaTag","C","d","jsx","i","u","props","className","cn","chipStyles","items","T","ChipList","selectableChipStyles","cva","SelectableChip","deletableChipStyles","internalTextValue","textValue","children","allowsRemoving","jsxs","V","D","Button","L","v","DeletableChip"],"mappings":"wSA8BI,IAAA,CAAA,CAAAA,GAAA,CAAAC,EAAA,CAAA,CAAA,iGAGA,CAAA,CAAA,CAAA,CAAA,QACE,CAAA,CAAS,iBACG,CAAA,0CACV,CAAA,8CACA,CAAS,OAAA,CAAA,mCACD,CAAA,MAAA,CAAA,iCACF,CAAA,IAAA,CAAA,kCAGN,OAAQ,CAAA,MAAA,CAAA,wBACD,CAAA,KAAA,CAAA,yBAGX,CAAA,CAAA,CAAA,eACQ,CAAA,CAAA,IAAA,CAAA,QACN,CAAS,OAEb,CACF,MAckC,CAAA,CAAK,CAAA,CAE1BC,CAAAA,CAAOC,aAAC,CACnB,KAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,SACAC,CAAAA,CAAO,CAAA,IAAA,CAAA,CAAA,CAAA,QACP,CAAAC,OAAU,CAAA,CACV,CAAA,MACF,CAAiB,GAMf,CAAA,CAAMC,GALUC,CAAWC,IAKCC,CAAU,CAAAC,UAAA,CAAA,CAAA,CAAA,CAAAC,GAEtC,CAAA,MACEC,QAAMC,GAAA,CAAAC,IAAA,CAAA,QAAeV,CAAAA,CAAAA,iBAAoB,CAAU,OAAA,CAAA,QACjD,CAAA,yBAGM,CAAAH,EAAA,CAAAG,CAAAA,CACA,CAAA,IAAA,CAAA,CAAA,CAAAC,OACA,CAAA,CAAA,CAAA,SAGH,CAAGU,EACN,CAAA,CACF,CAEJ,GACAb,CAAK,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,WACLA,CAAAA,MACEa,CACAC,CAAAA,CAAAA,EACGC,CAAAA,CAAGC,EAAW,CAAE,GAAGH,EAAAA,CA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AA,CAAA,QAAY,CACdD,GAAA,CACFsB,UAAA,CAAA,EAGN,CAAA,CACF,CAEJ,EACAC,CAAAA,CAAc,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,WAAc,CAAA,gBACvB,CAAA,CAAA,CAAA,SAAYA,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\nimport { cn } from '@/lib/utils';\nimport { CancelFill } from '@accelint/icons';\nimport { type VariantProps, cva } from 'cva';\nimport type React from 'react';\nimport { type ReactNode, createContext, useContext } from 'react';\nimport {\n Tag as AriaTag,\n TagGroup as AriaTagGroup,\n type TagGroupProps as AriaTagGroupProps,\n TagList as AriaTagList,\n type TagListProps as AriaTagListProps,\n type TagProps as AriaTagProps,\n Button,\n} from 'react-aria-components';\nimport { Icon } from '../icon';\n\nconst chipStyles = cva(\n cn([\n 'fg-default-light inline-flex w-content items-center justify-center gap-xxs rounded-full outline',\n ]),\n {\n variants: {\n variant: {\n advisory: 'bg-advisory-subtle outline-advisory-bold',\n critical: 'bg-critical-subtle outline-critical',\n serious: 'bg-serious-subtle outline-serious',\n normal: 'bg-normal-subtle outline-normal',\n info: 'bg-info-subtle outline-info-bold',\n },\n size: {\n medium: 'px-s py-xs text-body-s',\n small: 'px-s py-xs text-body-xs',\n },\n },\n defaultVariants: {\n size: 'medium',\n variant: 'info',\n },\n },\n);\n\nexport interface ChipProps\n extends VariantProps<typeof chipStyles>,\n Omit<React.HTMLProps<HTMLSpanElement>, 'children' | 'size'> {\n className?: string;\n /** Used to add text to the badge, such as the number of unread notifications. */\n children?: ReactNode;\n}\n\n// This coordinator is used as a way for the `<Chip>` component to understand\n// whether or not it is being rendered inside of a `<Chip.List>`. This allows\n// us to opt-into using an `<AriaTag>` or a `<span>` to ensure standalone\n// functionality.\nconst Coordinator = createContext(false);\n\nexport const Chip = ({\n className,\n size = 'medium',\n variant = 'info',\n ...props\n}: ChipProps) => {\n const context = useContext(Coordinator);\n\n // If any context was returned from the `Coordinator` context, then\n // we are being rendered inside of a `Chip.List` and need to render\n // an `<AriaTag>`.\n const Component = context ? AriaTag : 'span';\n\n return (\n <Icon.Provider size={size === 'medium' ? 'small' : 'xsmall'}>\n <Component\n className={cn(\n chipStyles({\n size,\n variant,\n className,\n }),\n )}\n {...props}\n />\n </Icon.Provider>\n );\n};\nChip.displayName = 'Chip';\nChip.as = (\n props: VariantProps<typeof chipStyles>,\n className?: string | string[],\n) => cn(chipStyles({ ...props, className }));\n\nexport interface ChipListProps<T>\n extends Omit<AriaTagGroupProps, 'children'>,\n Pick<AriaTagListProps<T>, 'items' | 'children' | 'renderEmptyState'> {}\n\nfunction ChipList<T extends object>({\n children,\n className,\n items,\n renderEmptyState,\n ...props\n}: ChipListProps<T>) {\n return (\n <Coordinator.Provider value={true}>\n <AriaTagGroup {...props}>\n <AriaTagList<T>\n items={items}\n renderEmptyState={renderEmptyState}\n className={cn('flex flex-wrap gap-xs', className)}\n >\n {children}\n </AriaTagList>\n </AriaTagGroup>\n </Coordinator.Provider>\n );\n}\nChipList.displayName = 'Chip.List';\nChip.List = ChipList;\n\nconst selectableChipStyles = cva(\n cn([\n 'fg-default-light inline-flex w-content items-center justify-center rounded-full outline outline-interactive hover:outline-interactive-hover focus:outline-interactive-hover',\n 'dtk-selected:bg-highlight-subtle dtk-selected:outline-highlight',\n ]),\n {\n variants: {\n isDisabled: {\n true: 'fg-disabled dtk-selected:bg-transparent dtk-selected:outline-interactive-disabled outline-interactive-disabled hover:outline-interactive-disabled focus:outline-interactive-disabled',\n false: 'cursor-pointer',\n },\n size: {\n medium: 'px-s py-xs text-body-s',\n small: 'px-s py-xs text-body-xs',\n },\n },\n defaultVariants: {\n isDisabled: false,\n size: 'medium',\n },\n },\n);\n\ninterface SelectableChipProps\n extends VariantProps<typeof selectableChipStyles>,\n Omit<AriaTagProps, 'isDisabled'> {}\n\nexport const SelectableChip = ({\n className,\n isDisabled = false,\n size = 'medium',\n ...props\n}: SelectableChipProps) => (\n <AriaTag\n className={cn(\n selectableChipStyles({\n isDisabled,\n size,\n className,\n }),\n )}\n {...props}\n />\n);\nSelectableChip.displayName = 'Chip.Selectable';\nChip.Selectable = SelectableChip;\n\nconst deletableChipStyles = cva(\n cn([\n 'fg-default-light group inline-flex w-content items-center justify-center gap-xs rounded-full outline outline-interactive hover:outline-interactive-hover focus:outline-interactive-hover',\n ]),\n {\n variants: {\n isDisabled: {\n true: 'fg-disabled outline-interactive-disabled hover:outline-interactive-disabled',\n false: '',\n },\n size: {\n medium: 'p-xs pl-m text-body-s',\n small: 'p-xs pl-s text-body-xs',\n },\n },\n defaultVariants: {\n isDisabled: false,\n size: 'medium',\n },\n },\n);\n\ninterface DeletableChipProps\n extends VariantProps<typeof deletableChipStyles>,\n Omit<AriaTagProps, 'isDisabled'> {}\n\nexport const DeletableChip = ({\n children,\n className,\n isDisabled = false,\n size = 'medium',\n textValue,\n ...props\n}: DeletableChipProps) => {\n const internalTextValue =\n textValue ?? (typeof children === 'string' ? children : undefined);\n\n return (\n <AriaTag\n className={cn(\n deletableChipStyles({\n isDisabled,\n size,\n className,\n }),\n )}\n textValue={internalTextValue}\n {...props}\n >\n {({ allowsRemoving, ...props }) => {\n if (!allowsRemoving) {\n throw new Error(\n 'You have a <Chip.Deletable> in a <Chip.List> does not specify an onRemove handler.',\n );\n }\n\n return (\n <>\n {typeof children === 'function'\n ? children({ allowsRemoving, ...props })\n : children}\n <Button\n slot='remove'\n className={cn([\n 'icon-default-dark group-hover:icon-default-light group-focus:icon-default-light cursor-pointer',\n isDisabled &&\n 'icon-disabled group-hover:icon-disabled cursor-not-allowed',\n ])}\n >\n <Icon size='small'>\n <CancelFill />\n </Icon>\n </Button>\n </>\n );\n }}\n </AriaTag>\n );\n};\nDeletableChip.displayName = 'Chip.Deletable';\nChip.Deletable = DeletableChip;\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/classification-badge/index.tsx"],"names":["size","f","
|
1
|
+
{"version":3,"sources":["../../../src/components/classification-badge/index.tsx"],"names":["size","f","t","props","ClassificationBadge","className","cn","classificationBadge"],"mappings":"0KAkBI,CAAA,CAAA,QACE,CAAA,CAAA,OACE,CAAA,CAAA,OACE,CAAA,4EACF,CAAA,YACE,CAAA,sFACG,CAAA,GAAA,CAAA,yEACL,CAAA,wGAEA,CACE,MAAA,CAAA,4FAEA,CAAA,uFACF,CAAA,QACE,CAAA,+EAEE,CACJ,OAAQ,MAAA,CAAA,0BACD,oDAIT,CAAA,CAAA,OAAS,CAAA,SACH,CAAA,IAAA,CAAA,QAYwB,CAClC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,SACA,CAAAA,CAAAA,CAAO,IAAA,CAAA,CAAA,CAAA,QACP,CAAA,OAAU,CAAA,CAAA,CAAA,SAEZ,CAAA,GACG,CAAA,CAAA,GAAAC,GAAA,CAAA,MACC,CAAA,CAAA,SAEI,CAAAC,EAAA,CAAA,CAAAF,CAAAA,CACA,IAAA,CAAA,CAAA,CAAA,mBAIH,CAAA,CAAGG,EACN,CAAA,CAEFC,GAAoB,CAAA,CAAA,EAAA,CAAA,CAAA,WAAc,CAAA,qBAEhCD,CAAAA,CACAE,CAAAA,EAAAA,CACGC,EAAGC,CAAAA,CAAoB,KAAKJ,CAAAA,CAAO,CAAA,CAAA,GAAA,CAAA,CAAA,SAAY,CAAA,CAAA,CAAA,CAAA,CAAA","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\nimport { cn } from '@/lib/utils';\nimport { type VariantProps, cva } from 'cva';\n\nconst classificationBadge = cva(\n 'inline-flex items-center justify-center rounded-full uppercase',\n {\n variants: {\n variant: {\n missing:\n \"fg-critical bg-classification-missing [&:empty]:before:content-['Missing']\",\n unclassified:\n \"fg-default-light bg-classification-unclass [&:empty]:before:content-['Unclassified']\",\n cui: \"fg-default-light bg-classification-cui [&:empty]:before:content-['CUI']\",\n confidential:\n \"fg-default-light bg-classification-confidential [&:empty]:before:content-['Confidential']\",\n secret:\n \"fg-default-light bg-classification-secret [&:empty]:before:content-['Secret']\",\n 'top-secret':\n \"fg-inverse-light bg-classification-top-secret [&:empty]:before:content-['Top_Secret']\",\n 'ts-sci':\n \"fg-inverse-light bg-classification-ts-sci [&:empty]:before:content-['TS/SCI']\",\n },\n size: {\n medium: 'px-s py-xs text-header-s',\n small: 'px-s py-xs text-header-xs',\n },\n },\n defaultVariants: {\n variant: 'missing',\n size: 'medium',\n },\n },\n);\n\nexport interface ClassificationBadgeProps\n extends VariantProps<typeof classificationBadge> {\n className?: string;\n /** If no text is provided, the system will fallback to safe defaults. You can override the text with children. */\n children?: string;\n}\n\nexport const ClassificationBadge = ({\n className,\n size = 'medium',\n variant = 'missing',\n ...props\n}: ClassificationBadgeProps) => (\n <span\n className={cn(\n classificationBadge({\n size,\n variant,\n className,\n }),\n )}\n {...props}\n />\n);\nClassificationBadge.displayName = 'ClassificationBadge';\nClassificationBadge.as = (\n props: VariantProps<typeof classificationBadge>,\n className?: string | string[],\n) => cn(classificationBadge({ ...props, className }));\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/classification-banner/index.tsx"],"names":["c","
|
1
|
+
{"version":3,"sources":["../../../src/components/classification-banner/index.tsx"],"names":["c","o","t","props","ClassificationBanner","className","cn","classificationBanner"],"mappings":"gGAiBE,IAAA,CAAA,CAAAA,GAAA,CAAA,kFAEE,CAAA,CAAA,iBAEI,CAAA,CAAA,OACE,CAAA,2FACF,CAAA,mGAEK,CAAA,GAAA,CAAA,sFAEH,CAAA,2FACF,CACE,sFACF,CAAA,YACE,CAAA,uFACF,CAAA,QACE,CAAA,wFAGN,CAAA,CAAA,CAAA,eACE,CAAA,CAAA,OAAS,CAAA,SAYsB,CACnC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,mBACU,CAAA,CAAA,CAAA,SAEZ,CAAA,GACG,CAAA,CAAA,GAAAC,GAAA,CAAA,iBAGK,CAAAC,EAAA,CAAA,CAAA,CAAA,CAAA,qBAIAC,CAAAA,CACN,CAAA,CAEFC,GAAqB,CAAA,CAAA,EAAA,CAAA,CAAA,WAAc,CAAA,sBAEjCD,EACAE,CAAAA,EAAAA,CACGC,CAAAA,CAAGC,EAAqB,GAAEL,EAAGC,EAAO,CAAA,CAAA,GAAA,CAAA,CAAA,SAAY,CAAA,CAAA,CAAA,CAAA,CAAA","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\nimport { cn } from '@/lib/utils';\nimport { type VariantProps, cva } from 'cva';\nimport type { ReactNode } from 'react';\n\nconst classificationBanner = cva(\n 'flex select-none items-center justify-center font-medium text-header-m uppercase',\n {\n variants: {\n variant: {\n missing:\n \"fg-critical bg-classification-missing [&:empty]:before:content-['Missing_Classification']\",\n unclassified:\n \"fg-default-light bg-classification-unclass [&:empty]:before:content-['Unclassified']\",\n cui: \"fg-default-light bg-classification-cui [&:empty]:before:content-['CUI']\",\n confidential:\n \"fg-default-light bg-classification-confidential [&:empty]:before:content-['Confidential']\",\n secret:\n \"fg-default-light bg-classification-secret [&:empty]:before:content-['Secret']\",\n 'top-secret':\n \"fg-inverse-light bg-classification-top-secret [&:empty]:before:content-['Top_Secret']\",\n 'ts-sci':\n \"fg-inverse-light bg-classification-ts-sci [&:empty]:before:content-['Top_Secret//SCI']\",\n },\n },\n defaultVariants: {\n variant: 'missing',\n },\n },\n);\n\nexport interface ClassificationBannerProps\n extends VariantProps<typeof classificationBanner> {\n className?: string;\n /** If no text is provided, the system will fallback to safe defaults. You can override the text with children. */\n children?: ReactNode;\n}\n\nexport const ClassificationBanner = ({\n className,\n variant = 'missing',\n ...props\n}: ClassificationBannerProps) => (\n <span\n className={cn(\n classificationBanner({\n variant,\n className,\n }),\n )}\n {...props}\n />\n);\nClassificationBanner.displayName = 'ClassificationBanner';\nClassificationBanner.as = (\n props: VariantProps<typeof classificationBanner>,\n className?: string | string[],\n) => cn(classificationBanner({ ...props, className }));\n"]}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
+
import { ForwardedRef } from 'react';
|
3
|
+
import { ColorSwatchPickerProps, ColorSwatchPickerItemProps, Color } from 'react-aria-components';
|
4
|
+
|
5
|
+
interface ColorPickerState {
|
6
|
+
/** The current color value of the color picker. */
|
7
|
+
color: Color | null;
|
8
|
+
/** Sets the current color value of the color picker. */
|
9
|
+
setColor(color: Color | null): void;
|
10
|
+
}
|
11
|
+
declare function useColorPickerState(props: ColorSwatchPickerProps): ColorPickerState;
|
12
|
+
interface ColorPickerProps extends ColorSwatchPickerProps {
|
13
|
+
options: ColorSwatchPickerItemProps['color'][];
|
14
|
+
ref?: ForwardedRef<HTMLDivElement>;
|
15
|
+
}
|
16
|
+
declare function ColorPicker({ options, className, ...props }: ColorPickerProps): react_jsx_runtime.JSX.Element;
|
17
|
+
declare namespace ColorPicker {
|
18
|
+
var displayName: string;
|
19
|
+
}
|
20
|
+
|
21
|
+
export { ColorPicker, type ColorPickerProps, useColorPickerState };
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import {cn}from'./../../lib/utils.js';import {useControlledState}from'@react-stately/utils';import {createContext,useMemo,useContext,useEffect}from'react';import {ColorSwatch,parseColor,useContextProps,ColorSwatchPickerContext,ListBox,useLocale,ListBoxItem,ColorSwatchContext}from'react-aria-components';import {jsx}from'react/jsx-runtime';var C=o=>{if(typeof o=="string")try{return parseColor(o)}catch{return}return o};function A(o){let l=useMemo(()=>C(o.value),[o.value]),r=useMemo(()=>C(o.defaultValue||"#000000"),[o.defaultValue]),[e,t]=useControlledState(l||null,r,o.onChange);return {color:e,setColor(c){t(c);}}}function I({ref:o=null,color:l,...r}){let e=l||"#0000",t=useMemo(()=>typeof e=="string"?parseColor(e):e,[e]),{locale:c}=useLocale(),a=useContext(d);return useEffect(()=>{let s=t.toString("hexa");return a?.set(s,t),()=>{a?.delete(s);}},[t,a]),jsx(ListBoxItem,{...r,ref:o,id:t.toString("hexa"),textValue:t.getColorName(c),className:"w-fit outline-none outline outline-offset-1 hover:outline-interactive-hover hover:outline-solid focus:outline-interactive-hover focus:outline-solid data-selected:outline-highlight data-selected:outline-solid",children:jsx(ColorSwatchContext.Provider,{value:{color:t},children:r.children})})}var d=createContext(null);function L({ref:o=null,className:l,children:r,...e}){[e,o]=useContextProps(e,o,ColorSwatchPickerContext);let t=A(e),c=useMemo(()=>new Map,[]);return jsx(ListBox,{className:cn("flex flex-wrap gap-s",l),style:e.style,layout:e.layout||"grid",selectionMode:"single",selectedKeys:t.color?[t.color.toString("hexa")]:void 0,onSelectionChange:a=>{a!=="all"&&(a.size>0?t.setColor(c.get([...a][0])):t.setColor(null));},...e,children:jsx(d.Provider,{value:c,children:r})})}function M({options:o,className:l,...r}){return jsx(L,{className:cn("flex flex-wrap gap-s",l),...r,children:o.map(e=>jsx(I,{color:e,children:jsx(ColorSwatch,{className:"h-[16px] w-[16px]"})},e.toString()))})}M.displayName="ColorPicker";export{M as ColorPicker,A as useColorPickerState};//# sourceMappingURL=index.js.map
|
2
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../src/components/color-picker/index.tsx"],"names":["value","parseColor","P","useMemo","parseColorFromProp","props","useControlledState","f","defaultValue","color","ref","colorFromProps","propColor","n","locale","map","useContext","ColorMapContext","useEffect","p","key","jsx","AriaListBoxItem","i","S","createContext","useContextProps","ColorSwatchPickerContext","v","state","useColorPickerState","colorMap","u","keys","x","ColorPicker"],"mappings":"oVA2C4BA,MACtB,CAAA,EAAA,CAAA,GAAOA,OAAU,CAAA,EAAA,QAEjB,CAAA,GAAA,CAAOC,OACTC,UAAA,CAAA,CAAQ,CACN,CAAA,KACF,CAEF,OAAOF,mBAMP,CAAA,CAAMA,CAAAA,CAAQG,KAAQ,CAAMC,CAAAA,OAAmBC,KAAM,CAAA,CAAK,CAAA,CAAG,KAAO,CAAA,CAAA,CAAK,CAAC,CAAA,KAGxE,CAAA,CAAA,CAAA,CAAMD,CAAAA,OAAmBC,KAAM,CAAA,CAAA,CAAA,CAAA,YAAgB,EAAA,0BAG3B,CAAA,CAAIC,CAAAA,CACxBN,GAAS,CAAA,CAAAO,kBAAA,CAAA,CACTC,EACAH,IAAM,CAAA,CAAA,CAAA,CAAA,CAAA,SAGD,CACL,OAAAI,MACA,CAAA,CAAA,CAAA,QACgB,CAChB,CACF,CACF,CAeA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,SACEC,CAAAA,CAAM,KACN,CAAA,CAAA,IAAOC,CAAAA,KAET,CAAA,CAGG,CACD,GAAA,CAAMC,CAAAA,CAAYD,KAAkB,CAAA,CAAA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AAA,CAAQ,CAACwB,KAAM,CAAA,CAAA,CAAM,eAAe,CAAC,MAAI,CAAA,CAAA,CAC7D,MAAA,CAAA,iBAEMI,CAAAA,CAAS,YACF,GAAO,EACdJ,IAAM,CAAA,CAAA,CAAA,CAAA,CAAA,QAAsB,CAAC,KAAO,CAAE,CAAC,IAGvCA,CAAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,QAGZ,CAAA,IACIxB,CAAAA,EAEJ,CAAA,CAAA,GAAA,CAAA,CAAA,QAAiB,CAAAkB,GAAA,CAAA,CAAA,CAAA,QAAS,CAAOQ,CAAAA,gBAOhC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,mBAEL,CAAA,CAAA,CAAA,SAEF,EAAqB,CACnB,GAAA,CAAA,CAAA,CAAA,CACEV,uBACgB,CAAAW,EAAA,CAAA,sBACV3B,EAEH,CAAA,CAAA,GAAA,CAAA,CAAA,QAAaI,CAAAA,CAAAA,CACZY,IAAC,CAA6C,EAAAE,GAAA,CAAA,CAAA,CAAOd,MACnD,CAAA,CAAA,CAAA,QAAiB,CAAAc,GAAA,CAAAW,WAAA,CAAA,CAAA,2CAM3BC,EAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,WAAc,CAAA,aAAA","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\nimport { cn } from '@/lib/utils';\nimport { useControlledState } from '@react-stately/utils';\nimport {\n type ForwardedRef,\n type ReactNode,\n createContext,\n useContext,\n useEffect,\n useMemo,\n} from 'react';\nimport {\n ColorSwatch as AriaColorSwatch,\n ColorSwatchContext as AriaColorSwatchContext,\n type ColorSwatchPickerItemProps as AriaColorSwatchPickerItemProps,\n type ColorSwatchPickerProps as AriaColorSwatchPickerProps,\n ListBox as AriaListBox,\n ListBoxItem as AriaListBoxItem,\n type Color,\n ColorSwatchPickerContext,\n parseColor,\n useContextProps,\n useLocale,\n} from 'react-aria-components';\n\ninterface ColorPickerState {\n /** The current color value of the color picker. */\n color: Color | null;\n /** Sets the current color value of the color picker. */\n setColor(color: Color | null): void;\n}\n\nconst parseColorFromProp = (value?: Color | string) => {\n if (typeof value === 'string') {\n try {\n return parseColor(value);\n } catch {\n return undefined;\n }\n }\n return value;\n};\n\nexport function useColorPickerState(\n props: AriaColorSwatchPickerProps,\n): ColorPickerState {\n const value = useMemo(() => parseColorFromProp(props.value), [props.value]);\n\n const defaultValue = useMemo(\n () => parseColorFromProp(props.defaultValue || '#000000'),\n [props.defaultValue],\n );\n const [color, setColor] = useControlledState(\n value || null,\n defaultValue as Color,\n props.onChange,\n );\n\n return {\n color,\n setColor(color) {\n setColor(color);\n },\n };\n}\n\n/**\n * Renders a single color swatch item for use within a color picker list.\n *\n * This component manages the registration of its color value in a shared color map context,\n * and provides the color value to its children via context. It also handles accessibility\n * and styling for selection and focus states.\n\n *\n * @remarks\n * - The component registers its color in a shared `ColorMapContext` on mount and removes it on unmount.\n * - The color is parsed and memoized for performance.\n * - The swatch item is rendered as an accessible list box item.\n */\nfunction ColorSwatchPickerItem({\n ref = null,\n color: colorFromProps,\n ...props\n}: Omit<AriaColorSwatchPickerItemProps, 'style'> & {\n children: ReactNode;\n ref?: ForwardedRef<HTMLDivElement>;\n}) {\n const propColor = colorFromProps || '#0000';\n const color = useMemo(\n () => (typeof propColor === 'string' ? parseColor(propColor) : propColor),\n [propColor],\n );\n const { locale } = useLocale();\n const map = useContext(ColorMapContext);\n\n // Register the color in the map context on mount and remove it on unmount.\n // This allows the color picker to manage its own state and selection.\n // The key is the color's hex representation, ensuring uniqueness.\n // The color is also provided to the context for use by children components.\n // This is useful for rendering the swatch or any related UI elements.\n useEffect(() => {\n const key = color.toString('hexa');\n map?.set(key, color);\n return () => {\n map?.delete(key);\n };\n }, [color, map]);\n\n return (\n <AriaListBoxItem\n {...props}\n ref={ref}\n id={color.toString('hexa')}\n textValue={color.getColorName(locale)}\n className='w-fit outline-none outline outline-offset-1 hover:outline-interactive-hover hover:outline-solid focus:outline-interactive-hover focus:outline-solid data-selected:outline-highlight data-selected:outline-solid'\n >\n <AriaColorSwatchContext.Provider value={{ color }}>\n {props.children}\n </AriaColorSwatchContext.Provider>\n </AriaListBoxItem>\n );\n}\n\nconst ColorMapContext = createContext<Map<string, Color> | null>(null);\n\nexport interface ColorPickerProps extends AriaColorSwatchPickerProps {\n options: AriaColorSwatchPickerItemProps['color'][];\n ref?: ForwardedRef<HTMLDivElement>;\n}\n\ninterface ColorSwatchPickerProps extends Omit<ColorPickerProps, 'options'> {\n children?: ReactNode;\n}\n\nfunction ColorSwatchPicker({\n ref = null,\n className,\n children,\n ...props\n}: ColorSwatchPickerProps) {\n [props, ref] = useContextProps(props, ref, ColorSwatchPickerContext);\n const state = useColorPickerState(props);\n const colorMap = useMemo(() => new Map(), []);\n return (\n <AriaListBox\n className={cn('flex flex-wrap gap-s', className)}\n style={props.style}\n layout={props.layout || 'grid'}\n selectionMode='single'\n selectedKeys={state.color ? [state.color.toString('hexa')] : undefined}\n onSelectionChange={(keys) => {\n // single select, 'all' cannot occur.\n if (keys !== 'all') {\n if (keys.size > 0) {\n state.setColor(colorMap.get([...keys][0]));\n } else {\n // If no keys are selected, we can set the color to null or a default value\n state.setColor(null);\n }\n }\n }}\n {...props}\n >\n <ColorMapContext.Provider value={colorMap}>\n {children}\n </ColorMapContext.Provider>\n </AriaListBox>\n );\n}\n\nexport function ColorPicker({\n options,\n className,\n ...props\n}: ColorPickerProps) {\n return (\n <ColorSwatchPicker\n className={cn('flex flex-wrap gap-s', className)}\n {...props}\n >\n {options.map((color) => (\n <ColorSwatchPickerItem key={color.toString()} color={color}>\n <AriaColorSwatch className='h-[16px] w-[16px]' />\n </ColorSwatchPickerItem>\n ))}\n </ColorSwatchPicker>\n );\n}\nColorPicker.displayName = 'ColorPicker';\n"]}
|
@@ -1,16 +1,16 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
2
|
import * as cva_types from 'cva/types';
|
3
|
-
import { ComboBoxProps as ComboBoxProps$1, VirtualizerProps, ListLayoutOptions,
|
4
|
-
import { MenuItem } from '../../types/types.js';
|
3
|
+
import { ComboBoxProps as ComboBoxProps$1, VirtualizerProps, ListLayoutOptions, ListBoxSectionProps } from 'react-aria-components';
|
5
4
|
import { VariantProps } from 'cva';
|
6
5
|
import { ReactNode } from 'react';
|
6
|
+
import { IOptionsItem, OptionsItem } from '../options-item/index.js';
|
7
7
|
|
8
8
|
declare const textFieldStyles: (props?: ({
|
9
9
|
isDisabled?: boolean | null | undefined;
|
10
10
|
isInvalid?: boolean | null | undefined;
|
11
11
|
size?: "small" | "medium" | null | undefined;
|
12
12
|
} & cva_types.ClassProp) | undefined) => string;
|
13
|
-
interface ComboBoxProps<T extends
|
13
|
+
interface ComboBoxProps<T extends IOptionsItem> extends Omit<VariantProps<typeof textFieldStyles>, 'isDisabled' | 'isInvalid' | 'isReadOnly'>, Omit<ComboBoxProps$1<T>, 'children'>, Pick<VirtualizerProps<ListLayoutOptions>, 'layoutOptions'> {
|
14
14
|
className?: string;
|
15
15
|
children: ReactNode | ((item: T) => ReactNode);
|
16
16
|
description?: string;
|
@@ -18,24 +18,15 @@ interface ComboBoxProps<T extends MenuItem> extends Omit<VariantProps<typeof tex
|
|
18
18
|
label?: string;
|
19
19
|
placeholder?: string;
|
20
20
|
}
|
21
|
-
declare function ComboBox<T extends
|
21
|
+
declare function ComboBox<T extends IOptionsItem>({ children, className, description, errorMessage, isDisabled, isInvalid, isReadOnly, label, placeholder, layoutOptions, size, ...props }: ComboBoxProps<T>): react_jsx_runtime.JSX.Element;
|
22
22
|
declare namespace ComboBox {
|
23
23
|
var displayName: string;
|
24
|
-
var Item: typeof
|
24
|
+
var Item: typeof OptionsItem;
|
25
25
|
var Section: typeof ComboBoxSection;
|
26
26
|
}
|
27
|
-
interface
|
28
|
-
description?: string;
|
29
|
-
icon?: ReactNode;
|
30
|
-
name: string;
|
31
|
-
}
|
32
|
-
declare function ComboBoxItem<T extends MenuItem>({ children, className, description, icon, name, ...props }: ComboBoxItemProps<T>): react_jsx_runtime.JSX.Element;
|
33
|
-
declare namespace ComboBoxItem {
|
34
|
-
var displayName: string;
|
35
|
-
}
|
36
|
-
interface ComboBoxSectionProps<T extends MenuItem> extends ListBoxSectionProps<T> {
|
27
|
+
interface ComboBoxSectionProps<T extends IOptionsItem> extends ListBoxSectionProps<T> {
|
37
28
|
header?: string;
|
38
29
|
}
|
39
|
-
declare function ComboBoxSection<T extends
|
30
|
+
declare function ComboBoxSection<T extends IOptionsItem>({ children, header, items, }: ComboBoxSectionProps<T>): react_jsx_runtime.JSX.Element;
|
40
31
|
|
41
32
|
export { ComboBox, type ComboBoxProps, ComboBoxSection };
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import'client-only';import {ComboBox,Button,Text,Popover,Virtualizer,ListLayout,
|
1
|
+
import'client-only';import {ComboBox,Button,Text,Popover,Virtualizer,ListLayout,ListBoxSection,Header,Collection,Input}from'react-aria-components';import {cn}from'./../../lib/utils.js';import k from'@accelint/icons/chevron-down';import {cva}from'cva';import {Icon}from'../icon/index.js';import {Label}from'../label/index.js';import {Options}from'../options/index.js';import {OptionsItem}from'../options-item/index.js';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var M=cva(["block w-full rounded-medium py-xs pr-[32px] pl-s font-display outline outline-interactive","not-disabled:read-only:rounded-none not-disabled:read-only:p-0 not-disabled:read-only:outline-transparent not-disabled:read-only:hover:outline-transparent not-disabled:read-only:focus:outline-transparent"],{variants:{isDisabled:{true:"text-disabled outline-interactive-disabled placeholder:text-disabled",false:"text-default-light placeholder:text-default-dark hover:outline-interactive-hover focus:outline-highlight"},isInvalid:{true:"outline-serious"},size:{medium:"text-body-s",small:"text-body-xs"}},compoundVariants:[{isDisabled:true,isInvalid:true,className:"outline-interactive-disabled"}],defaultVariants:{size:"medium"}}),f=({className:t,isReadOnly:o=false,size:i="medium",...l})=>jsx(Input,{...l,className:({isDisabled:s,isInvalid:a})=>cn(M({isDisabled:s,isInvalid:a,size:i,className:t}))});f.displayName="ComboBox.Input";function n({children:t,className:o,description:i,errorMessage:l,isDisabled:s,isInvalid:a,isReadOnly:r,label:c,placeholder:A,layoutOptions:h,size:u="medium",...x}){let b=u==="small",B=!(b||a)||s,I=a&&!s&&!r,P=!b&&c;return jsx(ComboBox,{...x,isDisabled:s,isInvalid:a,isReadOnly:r,className:"flex flex-col gap-xs",children:({isDisabled:d,isOpen:g})=>jsxs(Fragment,{children:[P&&jsx(Label,{className:"empty:hidden",isDisabled:d,isOptional:!x.isRequired,children:c}),jsxs("div",{className:"relative flex items-center",children:[jsx(f,{className:o,isReadOnly:r,placeholder:A,size:u}),jsx(Button,{className:cn(["fg-default-light absolute right-xs transform",d&&"fg-disabled",g&&"rotate-180",r&&"hidden"]),children:jsx(Icon,{className:"block",size:"large",children:jsx(k,{})})})]}),B&&jsx(Text,{className:cn(["fg-default-dark text-body-xs empty:hidden",d&&"fg-disabled"]),slot:"description",children:i}),I&&jsx(Text,{className:"fg-serious text-body-xs empty:hidden",slot:"errorMessage",children:l}),jsx(Popover,{className:"w-(--trigger-width)",children:jsx(Virtualizer,{layout:ListLayout,layoutOptions:h,children:jsx(Options,{children:t})})})]})})}n.displayName="ComboBox";n.Item=OptionsItem;function q({children:t,header:o,items:i}){return jsxs(ListBoxSection,{id:o,className:"col-span-2 mt-s grid grid-cols-[auto_1fr] border-default-dark border-t first:border-none",children:[jsx(Header,{className:"col-span-2 m-xs my-s text-default-dark text-header-xs",children:o}),jsx(Collection,{items:i,children:t})]})}n.displayName="ComboBox.Section";n.Section=q;export{n as ComboBox,q as ComboBoxSection};//# sourceMappingURL=index.js.map
|
2
2
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/combobox/index.tsx"],"names":["className","isReadOnly","size","jsx","e","V","isDisabled","isInvalid","Input","ComboBox","children","description","errorMessage","label","isSmall","shouldShowDescription","shouldShowError","AriaComboBox","T","isOpen","jsxs","Label","H","n","C","g","AriaText","d","R","AriaListLayout","k","z","b","ComboBoxItem","AriaListBoxItem","name","comboBoxItemStyles","renderProps","Fragment","B","icon","ComboBoxSection","header","items","AriaListBoxSection","M","S"],"mappings":"2YA4CI,sGAEF,CAAA,6MAEE,CAAA,CAAA,CAAU,QACR,CAAA,CAAA,UAEE,CAAA,CAAA,IAAA,CAAA,sEAEF,CAAA,KAAA,CAAA,0GACW,CAAA,CAAA,SAEX,CAAA,CAAA,IAAA,CAAA,iBAEU,CAAA,CAAA,IAAA,CAAA,CAAA,MAAA,CAAA,aACD,CAAA,KAAA,CAAA,cAGO,CAAA,CAAA,CAAA,gBAEd,CAAA,CAAA,CAAA,UACW,CAAA,IAAA,CAAA,SACA,CAAA,IAAA,CAAA,SAAA,CAAA,8BAGE,CAAA,CAAA,CAAA,eACT,CAAA,CAAA,IACR,CACF,QAUAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,SACAC,CAAAA,CAAAA,CAAAA,UACA,CAAA,CAAAC,CAAO,KAAA,CAAA,IAAA,CAAA,CAAA,CACP,QAGEC,CAAAA,GAAC,CACE,IACDC,GAAA,CAAAC,KAAA,CAAA,CAAA,GAAA,CAAA,CAAA,SAAcC,CAAAA,CAAAA,CAAAA,UAAYC,CAAAA,CAAAA,CAAAA,SAEN,CAAA,CACd,CAAAD,GAAAA,EAAAA,CAAAA,CAAAA,CAAAA,CAAAA,sBAGA,CAAA,CAAA,CAAA,IAAA,CAAA,CAAA,CAAA,SAOZE,CA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AAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,WACTD,CAAAA,kBAAmBgC,CAAAA,CAAAA,CAAAA,OAAAA,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\nimport 'client-only';\nimport {\n Button as AriaButton,\n ComboBox as AriaComboBox,\n type ComboBoxProps as AriaComboBoxProps,\n Header as AriaHeader,\n Input as AriaInput,\n type InputProps as AriaInputProps,\n ListBox as AriaListBox,\n Collection as AriaListBoxCollection,\n ListBoxItem as AriaListBoxItem,\n type ListBoxItemProps as AriaListBoxItemProps,\n ListBoxSection as AriaListBoxSection,\n type ListBoxSectionProps as AriaListBoxSectionProps,\n ListLayout as AriaListLayout,\n type ListLayoutOptions as AriaListLayoutOptions,\n Popover as AriaPopover,\n Text as AriaText,\n Virtualizer as AriaVirtualizer,\n type VirtualizerProps as AriaVirtualizerProps,\n} from 'react-aria-components';\n\nimport { cn } from '@/lib/utils';\nimport type { MenuItem } from '@/types/types';\nimport ChevronDown from '@accelint/icons/chevron-down';\nimport { type VariantProps, cva } from 'cva';\nimport type { ReactNode } from 'react';\nimport { Icon } from '../icon';\nimport { Label } from '../label';\n\nconst textFieldStyles = cva(\n [\n 'block w-full rounded-medium py-xs pr-[32px] pl-s font-display outline outline-interactive',\n 'not-disabled:read-only:rounded-none not-disabled:read-only:p-0 not-disabled:read-only:outline-transparent not-disabled:read-only:hover:outline-transparent not-disabled:read-only:focus:outline-transparent',\n ],\n {\n variants: {\n isDisabled: {\n true: 'text-disabled outline-interactive-disabled placeholder:text-disabled',\n false:\n 'text-default-light placeholder:text-default-dark hover:outline-interactive-hover focus:outline-highlight',\n },\n isInvalid: {\n true: 'outline-serious',\n },\n size: {\n medium: 'text-body-s',\n small: 'text-body-xs',\n },\n },\n compoundVariants: [\n {\n isDisabled: true,\n isInvalid: true,\n className: 'outline-interactive-disabled',\n },\n ],\n defaultVariants: {\n size: 'medium',\n },\n },\n);\n\ninterface InputProps\n extends VariantProps<typeof textFieldStyles>,\n Omit<AriaInputProps, 'size'> {\n isReadOnly?: boolean;\n}\n\nconst Input = ({\n className,\n isReadOnly = false,\n size = 'medium',\n ...props\n}: InputProps) => {\n return (\n <AriaInput\n {...props}\n className={({ isDisabled, isInvalid }) =>\n cn(\n textFieldStyles({\n isDisabled,\n isInvalid,\n size,\n className,\n }),\n )\n }\n />\n );\n};\nInput.displayName = 'ComboBox.Input';\n\nexport interface ComboBoxProps<T extends MenuItem>\n extends Omit<\n VariantProps<typeof textFieldStyles>,\n 'isDisabled' | 'isInvalid' | 'isReadOnly'\n >,\n Omit<AriaComboBoxProps<T>, 'children'>,\n Pick<AriaVirtualizerProps<AriaListLayoutOptions>, 'layoutOptions'> {\n className?: string;\n children: ReactNode | ((item: T) => ReactNode);\n description?: string;\n errorMessage?: string;\n label?: string;\n placeholder?: string;\n}\n\nexport function ComboBox<T extends MenuItem>({\n children,\n className,\n description,\n errorMessage,\n isDisabled,\n isInvalid,\n isReadOnly,\n label,\n placeholder,\n layoutOptions,\n size = 'medium',\n ...props\n}: ComboBoxProps<T>) {\n const isSmall = size === 'small';\n const shouldShowDescription = !(isSmall || isInvalid) || isDisabled;\n const shouldShowError = isInvalid && !isDisabled && !isReadOnly;\n\n return (\n <AriaComboBox<T>\n {...props}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n isReadOnly={isReadOnly}\n className='flex flex-col gap-xs'\n >\n {({ isDisabled, isOpen }) => (\n <>\n {!isSmall && (\n <Label\n className='empty:hidden'\n isDisabled={isDisabled}\n isOptional={!props.isRequired}\n >\n {label}\n </Label>\n )}\n <div className='relative flex items-center'>\n <Input\n className={className}\n isReadOnly={isReadOnly}\n placeholder={placeholder}\n size={size}\n />\n <AriaButton\n className={cn([\n 'fg-default-light icon-size-xl absolute right-xs transform',\n isDisabled && 'fg-disabled',\n isOpen && 'rotate-180',\n isReadOnly && 'hidden',\n ])}\n >\n <Icon className='block'>\n <ChevronDown />\n </Icon>\n </AriaButton>\n </div>\n {shouldShowDescription && (\n <AriaText\n className={cn([\n 'fg-default-dark text-body-xs empty:hidden',\n isDisabled && 'fg-disabled',\n ])}\n slot='description'\n >\n {description}\n </AriaText>\n )}\n {shouldShowError && (\n <AriaText\n className='fg-serious text-body-xs empty:hidden'\n slot='errorMessage'\n >\n {errorMessage}\n </AriaText>\n )}\n <AriaPopover className='w-(--trigger-width)'>\n <AriaVirtualizer\n layout={AriaListLayout}\n layoutOptions={layoutOptions}\n >\n <AriaListBox className='grid max-h-[200px] grid-cols-[auto_1fr] overflow-y-auto overflow-x-clip rounded-medium bg-surface-overlay shadow-elevation-overlay outline outline-static-light'>\n {/* @ts-expect-error package version mismatch TODO */}\n {children}\n </AriaListBox>\n </AriaVirtualizer>\n </AriaPopover>\n </>\n )}\n </AriaComboBox>\n );\n}\nComboBox.displayName = 'ComboBox';\n\nconst comboBoxItemStyles = cva([\n 'fg-default-light icon-size-l col-span-2 grid grid-cols-subgrid items-center p-s pl-xs text-body-s',\n '**:data-[slot=description]:fg-default-dark **:data-[slot=description]:text-body-xs',\n 'hover:fg-inverse-light hover:**:data-[slot=description]:fg-inverse-light hover:bg-highlight-bold',\n 'ai-focus:fg-inverse-light ai-focus:**:data-[slot=description]:fg-inverse-light ai-focus:bg-highlight-bold',\n 'ai-disabled:fg-disabled ai-disabled:**:data-[slot=description]:fg-disabled ai-disabled:bg-transparent',\n]);\n\ninterface ComboBoxItemProps<T extends MenuItem>\n extends AriaListBoxItemProps<T> {\n description?: string;\n icon?: ReactNode;\n name: string;\n}\n\nfunction ComboBoxItem<T extends MenuItem>({\n children,\n className,\n description,\n icon,\n name,\n ...props\n}: ComboBoxItemProps<T>) {\n return (\n <AriaListBoxItem<T>\n textValue={name}\n {...props}\n className={comboBoxItemStyles({ className })}\n >\n {(renderProps) => {\n if (typeof children === 'function') {\n return children(renderProps);\n }\n\n return (\n <>\n {icon && (\n <span className='mr-xs'>\n <Icon>{icon}</Icon>\n </span>\n )}\n <div className='col-start-2 flex flex-col gap-xxs'>\n <AriaText slot='label'>{name}</AriaText>\n {description && (\n <AriaText data-slot='description' slot='description'>\n {description}\n </AriaText>\n )}\n </div>\n </>\n );\n }}\n </AriaListBoxItem>\n );\n}\nComboBoxItem.displayName = 'ComboBox.Item';\n\nComboBox.Item = ComboBoxItem;\n\ninterface ComboBoxSectionProps<T extends MenuItem>\n extends AriaListBoxSectionProps<T> {\n header?: string;\n}\n\nexport function ComboBoxSection<T extends MenuItem>({\n children,\n header,\n items,\n}: ComboBoxSectionProps<T>) {\n return (\n <AriaListBoxSection\n id={header}\n className='col-span-2 mt-s grid grid-cols-[auto_1fr] border-default-dark border-t first:border-none'\n >\n <AriaHeader className='col-span-2 m-xs my-s text-default-dark text-header-xs'>\n {header}\n </AriaHeader>\n <AriaListBoxCollection items={items}>{children}</AriaListBoxCollection>\n </AriaListBoxSection>\n );\n}\nComboBox.displayName = 'ComboBox.Section';\nComboBox.Section = ComboBoxSection;\n"]}
|
1
|
+
{"version":3,"sources":["../../../src/components/combobox/index.tsx"],"names":["className","isReadOnly","size","AriaInput","props","e","O","isDisabled","isInvalid","p","ComboBox","children","isSmall","shouldShowDescription","shouldShowError","shouldShowLabel","label","jsx","AriaComboBox","D","m","AriaButton","L","cn","Icon","ChevronDown","AriaText","description","y","errorMessage","AriaVirtualizer","AriaListLayout","T","Options","F","ComboBoxSection","jsxs","AriaListBoxSection","S","C","header","items","v"],"mappings":"0jBA2CI,CAAA,6MAGA,CAAU,CACR,WAAY,uFAGR,CAAA,KAAA,CAAA,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,CAAAkC,MAAA,CAAU,CAAA,SAAA,CAAA,uDACnBC,CACH,aAC8BC,GAAAA,CAAQC,UAAA,CAAA,CAAA,KAAA,CAAA/B,EAAS,QAI5C,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,WAAc,CAAA,kBACJwB,CAAAA,CAAAA,CAAAA,OAAAA,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\nimport 'client-only';\nimport {\n Button as AriaButton,\n ComboBox as AriaComboBox,\n type ComboBoxProps as AriaComboBoxProps,\n Header as AriaHeader,\n Input as AriaInput,\n type InputProps as AriaInputProps,\n Collection as AriaListBoxCollection,\n ListBoxSection as AriaListBoxSection,\n type ListBoxSectionProps as AriaListBoxSectionProps,\n ListLayout as AriaListLayout,\n type ListLayoutOptions as AriaListLayoutOptions,\n Popover as AriaPopover,\n Text as AriaText,\n Virtualizer as AriaVirtualizer,\n type VirtualizerProps as AriaVirtualizerProps,\n} from 'react-aria-components';\n\nimport { cn } from '@/lib/utils';\nimport ChevronDown from '@accelint/icons/chevron-down';\nimport { type VariantProps, cva } from 'cva';\nimport type { ReactNode } from 'react';\nimport { Icon } from '../icon';\nimport { Label } from '../label';\nimport { Options } from '../options';\nimport { type IOptionsItem, OptionsItem } from '../options-item';\n\nconst textFieldStyles = cva(\n [\n 'block w-full rounded-medium py-xs pr-[32px] pl-s font-display outline outline-interactive',\n 'not-disabled:read-only:rounded-none not-disabled:read-only:p-0 not-disabled:read-only:outline-transparent not-disabled:read-only:hover:outline-transparent not-disabled:read-only:focus:outline-transparent',\n ],\n {\n variants: {\n isDisabled: {\n true: 'text-disabled outline-interactive-disabled placeholder:text-disabled',\n false:\n 'text-default-light placeholder:text-default-dark hover:outline-interactive-hover focus:outline-highlight',\n },\n isInvalid: {\n true: 'outline-serious',\n },\n size: {\n medium: 'text-body-s',\n small: 'text-body-xs',\n },\n },\n compoundVariants: [\n {\n isDisabled: true,\n isInvalid: true,\n className: 'outline-interactive-disabled',\n },\n ],\n defaultVariants: {\n size: 'medium',\n },\n },\n);\n\ninterface InputProps\n extends VariantProps<typeof textFieldStyles>,\n Omit<AriaInputProps, 'size'> {\n isReadOnly?: boolean;\n}\n\nconst Input = ({\n className,\n isReadOnly = false,\n size = 'medium',\n ...props\n}: InputProps) => {\n return (\n <AriaInput\n {...props}\n className={({ isDisabled, isInvalid }) =>\n cn(\n textFieldStyles({\n isDisabled,\n isInvalid,\n size,\n className,\n }),\n )\n }\n />\n );\n};\nInput.displayName = 'ComboBox.Input';\n\nexport interface ComboBoxProps<T extends IOptionsItem>\n extends Omit<\n VariantProps<typeof textFieldStyles>,\n 'isDisabled' | 'isInvalid' | 'isReadOnly'\n >,\n Omit<AriaComboBoxProps<T>, 'children'>,\n Pick<AriaVirtualizerProps<AriaListLayoutOptions>, 'layoutOptions'> {\n className?: string;\n children: ReactNode | ((item: T) => ReactNode);\n description?: string;\n errorMessage?: string;\n label?: string;\n placeholder?: string;\n}\n\nexport function ComboBox<T extends IOptionsItem>({\n children,\n className,\n description,\n errorMessage,\n isDisabled,\n isInvalid,\n isReadOnly,\n label,\n placeholder,\n layoutOptions,\n size = 'medium',\n ...props\n}: ComboBoxProps<T>) {\n const isSmall = size === 'small';\n const shouldShowDescription = !(isSmall || isInvalid) || isDisabled;\n const shouldShowError = isInvalid && !isDisabled && !isReadOnly;\n const shouldShowLabel = !isSmall && label;\n\n return (\n <AriaComboBox<T>\n {...props}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n isReadOnly={isReadOnly}\n className='flex flex-col gap-xs'\n >\n {({ isDisabled, isOpen }) => (\n <>\n {shouldShowLabel && (\n <Label\n className='empty:hidden'\n isDisabled={isDisabled}\n isOptional={!props.isRequired}\n >\n {label}\n </Label>\n )}\n <div className='relative flex items-center'>\n <Input\n className={className}\n isReadOnly={isReadOnly}\n placeholder={placeholder}\n size={size}\n />\n <AriaButton\n className={cn([\n 'fg-default-light absolute right-xs transform',\n isDisabled && 'fg-disabled',\n isOpen && 'rotate-180',\n isReadOnly && 'hidden',\n ])}\n >\n <Icon className='block' size='large'>\n <ChevronDown />\n </Icon>\n </AriaButton>\n </div>\n {shouldShowDescription && (\n <AriaText\n className={cn([\n 'fg-default-dark text-body-xs empty:hidden',\n isDisabled && 'fg-disabled',\n ])}\n slot='description'\n >\n {description}\n </AriaText>\n )}\n {shouldShowError && (\n <AriaText\n className='fg-serious text-body-xs empty:hidden'\n slot='errorMessage'\n >\n {errorMessage}\n </AriaText>\n )}\n <AriaPopover className='w-(--trigger-width)'>\n <AriaVirtualizer\n layout={AriaListLayout}\n layoutOptions={layoutOptions}\n >\n <Options>{children}</Options>\n </AriaVirtualizer>\n </AriaPopover>\n </>\n )}\n </AriaComboBox>\n );\n}\nComboBox.displayName = 'ComboBox';\n\nComboBox.Item = OptionsItem;\n\ninterface ComboBoxSectionProps<T extends IOptionsItem>\n extends AriaListBoxSectionProps<T> {\n header?: string;\n}\n\nexport function ComboBoxSection<T extends IOptionsItem>({\n children,\n header,\n items,\n}: ComboBoxSectionProps<T>) {\n return (\n <AriaListBoxSection\n id={header}\n className='col-span-2 mt-s grid grid-cols-[auto_1fr] border-default-dark border-t first:border-none'\n >\n <AriaHeader className='col-span-2 m-xs my-s text-default-dark text-header-xs'>\n {header}\n </AriaHeader>\n <AriaListBoxCollection items={items}>{children}</AriaListBoxCollection>\n </AriaListBoxSection>\n );\n}\nComboBox.displayName = 'ComboBox.Section';\nComboBox.Section = ComboBoxSection;\n"]}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
+
import * as cva_types from 'cva/types';
|
3
|
+
import { DateValue } from '@internationalized/date';
|
4
|
+
import { VariantProps } from 'cva';
|
5
|
+
import { DateFieldProps as DateFieldProps$1, DateInputProps } from 'react-aria-components';
|
6
|
+
|
7
|
+
declare const dateFieldStyles: (props?: ({
|
8
|
+
isDisabled?: boolean | null | undefined;
|
9
|
+
isInvalid?: boolean | null | undefined;
|
10
|
+
isReadOnly?: boolean | null | undefined;
|
11
|
+
size?: "small" | "medium" | null | undefined;
|
12
|
+
} & cva_types.ClassProp) | undefined) => string;
|
13
|
+
interface DateFieldProps<T extends DateValue> extends Omit<VariantProps<typeof dateFieldStyles>, 'isDisabled' | 'isInvalid' | 'isReadOnly'>, Omit<DateFieldProps$1<T>, 'className' | 'style'>, // Exclude className to avoid conflict with cva
|
14
|
+
Omit<DateInputProps, 'className' | 'children' | 'style'> {
|
15
|
+
isDisabled?: boolean;
|
16
|
+
isInvalid?: boolean;
|
17
|
+
isReadOnly?: boolean;
|
18
|
+
size?: 'small' | 'medium';
|
19
|
+
className?: string;
|
20
|
+
description?: string;
|
21
|
+
errorMessage?: string;
|
22
|
+
label?: string;
|
23
|
+
placeholder?: string;
|
24
|
+
shortMonth?: boolean;
|
25
|
+
}
|
26
|
+
declare function DateField<T extends DateValue>({ className, description, errorMessage, isDisabled, isInvalid, isReadOnly, label, placeholder, slot, size, shortMonth, ...props }: DateFieldProps<T>): react_jsx_runtime.JSX.Element;
|
27
|
+
|
28
|
+
export { DateField, type DateFieldProps };
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import'client-only';import {cn}from'./../../lib/utils.js';import y from'@accelint/icons/calendar';import {cva}from'cva';import {DateField,Text,FieldError,DateInput,DateSegment}from'react-aria-components';import {Icon}from'../icon/index.js';import {Label}from'../label/index.js';import {jsxs,jsx,Fragment}from'react/jsx-runtime';var I=["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"],T=({value:e,isFocused:o,isPlaceholder:i,placeholder:t,isReadOnly:s,shortMonth:l})=>{if(i)return t;let r=`${e}`;return !s&&o?r=r.padStart(2,"0"):l&&(r=I[(e??0)-1]),r},R=({segment:e,shortMonth:o,...i})=>e.type==="literal"&&e.text!==":"?jsx(Fragment,{}):jsx(DateSegment,{segment:e,className:"focus:bg-highlight focus:text-inverse-light focus:outline-none",...i,children:e.type==="month"?t=>jsx(T,{...t,shortMonth:o}):e.text}),O=cva(["flex w-full gap-xs rounded-medium px-s py-xs font-display outline outline-interactive"],{variants:{isDisabled:{true:"text-disabled outline-interactive-disabled placeholder:text-disabled",false:"text-default-light placeholder:text-default-dark focus-within:outline-highlight hover:outline-interactive-hover"},isInvalid:{true:"outline-serious"},isReadOnly:{true:"rounded-none p-0 outline-none"},size:{medium:["text-body-s","pl-[32px]"],small:"text-body-xs"}},compoundVariants:[{isDisabled:true,isInvalid:true,className:"outline-interactive-disabled"},{isDisabled:false,size:"medium"}],defaultVariants:{size:"medium"}}),V=({className:e,ref:o=null,size:i="medium",isReadOnly:t,...s})=>jsxs("div",{className:"relative flex",children:[i==="medium"?jsx(Icon,{className:cn(["-translate-y-1/2 absolute top-1/2 left-s",s.isDisabled?"text-disabled":"text-default-light"]),children:jsx(y,{})}):null,jsx(DateInput,{...s,className:({isDisabled:l,isInvalid:r})=>cn(O({isDisabled:l,isInvalid:r,isReadOnly:t,size:i,className:e}))})]});function q({className:e,description:o,errorMessage:i,isDisabled:t,isInvalid:s,isReadOnly:l,label:r,placeholder:E,slot:c,size:d="medium",shortMonth:f=true,...m}){let p=d==="small",D=o&&(!(p||s)||t),h=i&&s&&!t&&!l;return jsxs(DateField,{...m,isDisabled:t,isInvalid:s,isReadOnly:l,slot:c,className:"flex flex-col gap-xs",children:[!p&&jsx(Label,{className:"empty:hidden",isDisabled:t,isOptional:!m.isRequired,children:r}),jsx(V,{className:e,isDisabled:t,size:d,isReadOnly:l,isInvalid:s,children:x=>jsx(R,{segment:x,shortMonth:f})}),D&&jsx(Text,{className:cn(["fg-default-dark text-body-xs empty:hidden",t&&"fg-disabled"]),slot:"description",children:o}),h&&jsx(FieldError,{className:"fg-serious text-body-xs empty:hidden",children:i})]})}export{q as DateField};//# sourceMappingURL=index.js.map
|
2
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../src/components/date-field/index.tsx"],"names":["value","isPlaceholder","placeholder","isReadOnly","displayValue","months","FormattedDateSegment","segment","Fragment","jsx","DateSegment","a","F","renderProps","dateFieldStyles","cva","g","jsxs","u","v","n","AriaDateInput","props","P","DateField","label","slot","size","isSmall","shouldShowDescription","isInvalid","isDisabled","shouldShowError","errorMessage","AriaDateField","N","AriaText","S","description","FieldError"],"mappings":"4UAmCE,CAAA,CAAA,CAAA,KACA,CAAA,KACA,CAAA,KACA,CAAA,KACA,CAAA,KACA,CAAA,WAEA,CAAA,KACA,CAAA,WAEA,CAAA,MAGuB,KACvB,CAAA,CAAA,CAAAA,CAAAA,CACA,CAAA,KAAA,CAAA,CAAA,CAAA,yBAEA,CAAA,CAAA,CAAA,WACA,CAAA,CAAA,CAAA,uBAGA,CAAIC,CAAAA,CACF,GAAA,CAAA,GAAOC,EAGT,SAA0CF,IAE1C,MAAI,CAACG,CAAAA,CAAAA,OACYC,CAAa,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,WAErCA,GAAeC,CAAAA,CAAQL,IAAS,CAAA,CAAK,CAAC,CAAA,CAAA,CAGjCI,EACT,CAOME,EAAuB,CAAC,CAC5B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAAC,QACA,CAAA,CAAA,CAAA,UAEF,CAAA,CACMA,IAAQ,CAAA,CAAA,GAAS,CAAA,CAAA,IAAA,GAAA,SAAqB,EAAS,CAAA,CAAA,IAC1CC,GAAA,GAIPC,CAAAA,GAACC,CAAAA,QAAA,CACC,EAAA,CAAA,CAA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,CAAA,sCACnB,CAAAN,QAKX,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA","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\nimport 'client-only';\nimport { cn } from '@/lib/utils';\nimport Calendar from '@accelint/icons/calendar';\nimport type { DateValue } from '@internationalized/date';\nimport type { DateSegment as TDateSegment } from '@react-stately/datepicker';\nimport { type VariantProps, cva } from 'cva';\nimport type { ForwardedRef } from 'react';\nimport {\n DateField as AriaDateField,\n type DateFieldProps as AriaDateFieldProps,\n DateInput as AriaDateInput,\n type DateInputProps as AriaDateInputProps,\n type DateSegmentProps as AriaDateSegmentProps,\n Text as AriaText,\n DateSegment,\n type DateSegmentRenderProps,\n FieldError,\n} from 'react-aria-components';\nimport { Icon } from '../icon';\nimport { Label } from '../label';\n\nconst months = [\n 'JAN',\n 'FEB',\n 'MAR',\n 'APR',\n 'MAY',\n 'JUN',\n 'JUL',\n 'AUG',\n 'SEP',\n 'OCT',\n 'NOV',\n 'DEC',\n];\n\nconst MonthDateSegment = ({\n value,\n isFocused,\n isPlaceholder,\n placeholder,\n isReadOnly,\n shortMonth,\n}: DateSegmentRenderProps & { shortMonth?: boolean }) => {\n if (isPlaceholder) {\n return placeholder;\n }\n\n let displayValue: string | undefined = `${value}`;\n\n if (!isReadOnly && isFocused) {\n displayValue = displayValue.padStart(2, '0');\n } else if (shortMonth) {\n displayValue = months[(value ?? 0) - 1];\n }\n\n return displayValue;\n};\n\ninterface FormattedDateSegmentProps extends AriaDateSegmentProps {\n segment: TDateSegment;\n shortMonth?: boolean;\n}\n\nconst FormattedDateSegment = ({\n segment,\n shortMonth,\n ...props\n}: FormattedDateSegmentProps) => {\n if (segment.type === 'literal' && segment.text !== ':') {\n return <></>;\n }\n\n return (\n <DateSegment\n segment={segment}\n className='focus:bg-highlight focus:text-inverse-light focus:outline-none' // Ensure caret color is visible, RAC sets the style prop and it is not overridable. Thanks for that.\n {...props}\n >\n {segment.type === 'month'\n ? (renderProps) => (\n <MonthDateSegment {...renderProps} shortMonth={shortMonth} />\n )\n : segment.text}\n </DateSegment>\n );\n};\n\nconst dateFieldStyles = cva(\n [\n 'flex w-full gap-xs rounded-medium px-s py-xs font-display outline outline-interactive',\n ],\n {\n variants: {\n isDisabled: {\n true: 'text-disabled outline-interactive-disabled placeholder:text-disabled',\n false:\n 'text-default-light placeholder:text-default-dark focus-within:outline-highlight hover:outline-interactive-hover',\n },\n isInvalid: {\n true: 'outline-serious',\n },\n isReadOnly: {\n true: 'rounded-none p-0 outline-none',\n },\n size: {\n medium: ['text-body-s', 'pl-[32px]'],\n small: 'text-body-xs',\n },\n },\n compoundVariants: [\n {\n isDisabled: true,\n isInvalid: true,\n className: 'outline-interactive-disabled',\n },\n {\n isDisabled: false,\n size: 'medium',\n },\n ],\n defaultVariants: {\n size: 'medium',\n },\n },\n);\n\ninterface DateInputProps\n extends VariantProps<typeof dateFieldStyles>,\n Omit<AriaDateInputProps, 'size'> {\n ref?: ForwardedRef<HTMLDivElement>;\n}\n\nconst DateInput = ({\n className,\n ref = null,\n size = 'medium',\n isReadOnly,\n ...props\n}: DateInputProps) => {\n return (\n <div className='relative flex'>\n {size === 'medium' ? (\n <Icon\n className={cn([\n '-translate-y-1/2 absolute top-1/2 left-s',\n props.isDisabled ? 'text-disabled' : 'text-default-light',\n ])}\n >\n <Calendar />\n </Icon>\n ) : null}\n <AriaDateInput\n {...props}\n className={({ isDisabled, isInvalid }) =>\n cn(\n dateFieldStyles({\n isDisabled,\n isInvalid,\n isReadOnly: isReadOnly,\n size,\n className,\n }),\n )\n }\n />\n </div>\n );\n};\n\nexport interface DateFieldProps<T extends DateValue>\n extends Omit<\n VariantProps<typeof dateFieldStyles>,\n 'isDisabled' | 'isInvalid' | 'isReadOnly'\n >,\n Omit<AriaDateFieldProps<T>, 'className' | 'style'>, // Exclude className to avoid conflict with cva\n Omit<AriaDateInputProps, 'className' | 'children' | 'style'> {\n isDisabled?: boolean;\n isInvalid?: boolean;\n isReadOnly?: boolean;\n size?: 'small' | 'medium';\n className?: string;\n description?: string;\n errorMessage?: string;\n label?: string;\n placeholder?: string;\n shortMonth?: boolean;\n}\n\nexport function DateField<T extends DateValue>({\n className,\n description,\n errorMessage,\n isDisabled,\n isInvalid,\n isReadOnly,\n label,\n placeholder,\n slot,\n size = 'medium',\n shortMonth = true,\n ...props\n}: DateFieldProps<T>) {\n const isSmall = size === 'small';\n const shouldShowDescription =\n description && (!(isSmall || isInvalid) || isDisabled);\n const shouldShowError =\n errorMessage && isInvalid && !isDisabled && !isReadOnly;\n\n return (\n <AriaDateField<T>\n {...props}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n isReadOnly={isReadOnly}\n slot={slot}\n className={'flex flex-col gap-xs'}\n >\n {!isSmall && (\n <Label\n className='empty:hidden'\n isDisabled={isDisabled}\n isOptional={!props.isRequired}\n >\n {label}\n </Label>\n )}\n\n <DateInput\n className={className}\n isDisabled={isDisabled}\n size={size}\n isReadOnly={isReadOnly}\n isInvalid={isInvalid}\n >\n {(segment) => (\n <FormattedDateSegment segment={segment} shortMonth={shortMonth} />\n )}\n </DateInput>\n {shouldShowDescription && (\n <AriaText\n className={cn([\n 'fg-default-dark text-body-xs empty:hidden',\n isDisabled && 'fg-disabled',\n ])}\n slot='description'\n >\n {description}\n </AriaText>\n )}\n {shouldShowError && (\n <FieldError className='fg-serious text-body-xs empty:hidden'>\n {errorMessage}\n </FieldError>\n )}\n </AriaDateField>\n );\n}\n"]}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { RefObject, PropsWithChildren, ReactNode } from 'react';
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
4
|
+
import { DialogTriggerProps, DialogRenderProps } from 'react-aria-components';
|
5
|
+
import { ButtonProps } from '../button/index.js';
|
6
|
+
import 'cva/types';
|
7
|
+
import 'cva';
|
8
|
+
|
9
|
+
type DialogSize = 'sm' | 'lg';
|
10
|
+
interface DialogProps extends DialogTriggerProps {
|
11
|
+
size?: DialogSize;
|
12
|
+
isDismissable?: boolean;
|
13
|
+
isKeyboardDismissDisabled?: boolean;
|
14
|
+
isOpen?: boolean;
|
15
|
+
onOpenChange?: (isOpen: boolean) => void;
|
16
|
+
parentRef?: RefObject<HTMLElement | null>;
|
17
|
+
}
|
18
|
+
declare const Dialog: {
|
19
|
+
({ children, size, isOpen, onOpenChange, isDismissable, isKeyboardDismissDisabled, parentRef, }: DialogProps): react_jsx_runtime.JSX.Element;
|
20
|
+
displayName: string;
|
21
|
+
Button: ({ children, className, ...props }: ButtonProps) => react_jsx_runtime.JSX.Element;
|
22
|
+
Content: ({ children, className, }: PropsWithChildren<{
|
23
|
+
className?: string;
|
24
|
+
}>) => react_jsx_runtime.JSX.Element;
|
25
|
+
Footer: ({ children, className, }: PropsWithChildren<{
|
26
|
+
className?: string;
|
27
|
+
}>) => react_jsx_runtime.JSX.Element;
|
28
|
+
Title: ({ children, className, }: PropsWithChildren<{
|
29
|
+
className?: string;
|
30
|
+
}>) => react_jsx_runtime.JSX.Element;
|
31
|
+
Body: React.ForwardRefExoticComponent<DialogBodyProps & React.RefAttributes<HTMLDivElement>>;
|
32
|
+
};
|
33
|
+
interface DialogBodyProps {
|
34
|
+
children: ReactNode | ReactNode[] | ((opts: DialogRenderProps) => ReactNode);
|
35
|
+
}
|
36
|
+
declare const DialogTitle: ({ children, className, }: PropsWithChildren<{
|
37
|
+
className?: string;
|
38
|
+
}>) => react_jsx_runtime.JSX.Element;
|
39
|
+
|
40
|
+
export { Dialog, type DialogProps, DialogTitle };
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import {cn}from'./../../lib/utils.js';import {useIsSSR}from'@react-aria/ssr';import {cva}from'cva';import {createContext,forwardRef,useState,useEffect,useContext}from'react';import {ModalOverlay,Modal,Dialog,DialogTrigger,Heading}from'react-aria-components';import {Button}from'../button/index.js';import {jsx}from'react/jsx-runtime';var M=cva("flex flex-col align-end font-light text-body-m text-default-dark",{variants:{size:{sm:"min-w-[280px] max-w-[280px] rounded-medium p-l",lg:"min-w-[320px] max-w-[720px] rounded-large p-xl"},defaultVariants:{size:"sm"}}}),E={sm:"small",lg:"medium"},b=createContext({size:"sm"}),r=()=>{let e=useContext(b);if(!e)throw new Error("Dialog components must be used within <Dialog>");return e},l=({children:e,size:t,isOpen:o,onOpenChange:i,isDismissable:a=true,isKeyboardDismissDisabled:m=true,parentRef:p})=>jsx(DialogTrigger,{children:jsx(b.Provider,{value:{size:t??"sm",isDismissable:a,isOpen:o,onOpenChange:i,parentRef:p,isKeyboardDismissDisabled:m},children:e})});l.displayName="Dialog";var x=forwardRef(({children:e,...t},o)=>{let{size:i,isDismissable:a,isOpen:m,onOpenChange:p,parentRef:c,isKeyboardDismissDisabled:C}=r(),d=useIsSSR(),[u,D]=useState(d?null:document.body);return useEffect(()=>{let f=c?.current,g=d?null:document.createElement("div");return f&&g&&(f.appendChild(g),D(g)),()=>{g?.remove(),D(d?null:document.body);}},[d,c]),u?jsx(ModalOverlay,{UNSTABLE_portalContainer:u,isKeyboardDismissDisabled:!a&&C,isOpen:m,onOpenChange:p,isDismissable:a,className:"absolute inset-0 flex items-center justify-center",...t,children:jsx(Modal,{ref:o,className:cn("flex flex-col justify-center bg-surface-overlay align-start",i==="sm"&&"rounded-medium",i==="lg"&&"rounded-large"),children:jsx(Dialog,{className:M({size:i}),children:e})})}):null});x.displayName="DialogBody";var H=({children:e,className:t})=>{let{size:o}=r();return jsx("div",{className:cn("flex flex-col",o==="sm"&&"gap-xs",o==="lg"&&"gap-l",t),children:e})},j=({children:e,className:t})=>{let{size:o}=r();return jsx(Heading,{slot:"title",className:cn("text-default-light",o==="sm"&&"mb-s text-header-m",o==="lg"&&"mb-m text-header-l",t),children:e})},K=({children:e,className:t,...o})=>{let{size:i}=r(),a=E[i];return jsx(Button,{size:a,...o,className:cn("dtk-pressed:bg-initial",t),children:e})},L=({children:e,className:t})=>{let{size:o}=r();return jsx("div",{className:cn("flex justify-end gap-xs",o==="sm"&&"mt-l",o==="lg"&&"mt-xl",t),children:e})};l.Button=K;l.Content=H;l.Footer=L;l.Title=j;l.Body=x;export{l as Dialog,j as DialogTitle};//# sourceMappingURL=index.js.map
|
2
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../src/components/dialog/index.tsx"],"names":["R","h","useDialogContext","useContext","DialogContext","z","ctx","size","isOpen","RACDialogTrigger","s","B","Dialog","forwardRef","ref","isSSR","useIsSSR","portal","setPortal","y","useState","N","useEffect","P","parentRef","port","node","jsx","RACModalOverlay","T","n","DialogBody","className","S","buttonSize","buttonSizes","dialogSize","DialogButton","DialogContent","DialogFooter","DialogTitle"],"mappings":"8UAqCE,IAAA,CAAA,CAAAA,GAAA,CAAA,4EAIM,CAAA,CAAA,IAAI,CAAA,CAAA,EAAA,CAAA,oGAGN,CAAA,CAAA,eACQ,CAAA,CAAA,IAId,CAAA,IAGE,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CACJ,OAAI,CAAA,EAAA,CACN,QAa0D,CAAA,CAAA,CAAA,CAAMC,mBAE1DC,CAAAA,IAAmB,CAAM,CAC7B,CAAA,CAAA,CAAA,IAAYC,CAAWC,IACvB,CAAA,CAAIC,UAACC,CAAAA,CACH,MAAM,CAAA,CAAA,MAAI,IAAM,KAAA,CAAA,gDAElB,CAAOA,CACT,OAYE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,QACAC,CAAAA,CACA,CAAA,IAAA,CAA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AAU,EACzC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACET,CAAAA,OACEjB,GAAA,CAAMwB,MAAAA,CACL,CAAA,IAGD,CAAA,CAAA,CAAA,GAAA,CAAA,CAAA,SAAc,CAAAJ,EAAA,CAAA,wBAEb,CAAA,CAAA,CAAA,CAAA,QAKc,CAAC,CACpB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,QACA,CAAA,CAAA,CAAA,SAEA,CAAA,CAAM,CAAE,GAAA,CAAA,IAAS5B,IACjB,CAAA,CAAA,CAAA,CAAA,CAAA,EACEyB,CAAAA,OAACjB,GACC,CAAA,KAAA,CAAA,CAAA,SACE,CAAAoB,EAAA,CAAA,yBACS,CAAA,CAAA,GAAQ,IAAA,EACjBvB,MAAS,CAAA,CAAA,SACTyB,OAGD,CAAA,CAAA,CAAA,CAAA,QAKA,CAAA,CAAA,CAAA,CAAA,EAAA,CAASK,CAAAA,MACT,CAAA,CAAA,CAAA,CAAA,CAAUC,OACV,CAAA,CAAA,CAAA,CAASC,CAAAA,MACT,CAAA,CAAA,CAAQC,CAAAA,CACf5B,KAAO,CAAA,CAAOmB,CAAAA,CAAAA,CAAAA,IAAAA,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\nimport { cn } from '@/lib/utils';\nimport { useIsSSR } from '@react-aria/ssr';\nimport { cva } from 'cva';\nimport {\n type PropsWithChildren,\n type ReactNode,\n type RefObject,\n createContext,\n forwardRef,\n useContext,\n useEffect,\n useState,\n} from 'react';\nimport {\n type DialogRenderProps,\n type DialogTriggerProps,\n Dialog as RACDialog,\n DialogTrigger as RACDialogTrigger,\n Heading as RACHeading,\n Modal as RACModal,\n ModalOverlay as RACModalOverlay,\n} from 'react-aria-components';\nimport { Button, type ButtonProps } from '../button';\n\nconst dialogClasses = cva(\n 'flex flex-col align-end font-light text-body-m text-default-dark',\n {\n variants: {\n size: {\n sm: 'min-w-[280px] max-w-[280px] rounded-medium p-l',\n lg: 'min-w-[320px] max-w-[720px] rounded-large p-xl',\n },\n defaultVariants: {\n size: 'sm',\n },\n },\n },\n);\n\nconst buttonSizes: Record<string, ButtonProps['size']> = {\n sm: 'small',\n lg: 'medium',\n};\n\ntype DialogSize = 'sm' | 'lg';\n\ninterface DialogContextValue {\n size: DialogSize;\n isDismissable?: boolean;\n isKeyboardDismissDisabled?: boolean;\n isOpen?: boolean;\n onOpenChange?: (isOpen: boolean) => void;\n parentRef?: RefObject<HTMLElement | null>;\n}\n\nconst DialogContext = createContext<DialogContextValue>({ size: 'sm' });\n\nconst useDialogContext = () => {\n const ctx = useContext(DialogContext);\n if (!ctx) {\n throw new Error('Dialog components must be used within <Dialog>');\n }\n return ctx;\n};\n\nexport interface DialogProps extends DialogTriggerProps {\n size?: DialogSize;\n isDismissable?: boolean;\n isKeyboardDismissDisabled?: boolean;\n isOpen?: boolean;\n onOpenChange?: (isOpen: boolean) => void;\n parentRef?: RefObject<HTMLElement | null>;\n}\n\nexport const Dialog = ({\n children,\n size,\n isOpen,\n onOpenChange,\n isDismissable = true,\n isKeyboardDismissDisabled = true,\n parentRef,\n}: DialogProps) => {\n return (\n <RACDialogTrigger>\n <DialogContext.Provider\n value={{\n size: size ?? 'sm',\n isDismissable,\n isOpen,\n onOpenChange,\n parentRef,\n isKeyboardDismissDisabled,\n }}\n >\n {children}\n </DialogContext.Provider>\n </RACDialogTrigger>\n );\n};\nDialog.displayName = 'Dialog';\n\ninterface DialogBodyProps {\n children: ReactNode | ReactNode[] | ((opts: DialogRenderProps) => ReactNode);\n}\n\nconst DialogBody = forwardRef<HTMLDivElement, DialogBodyProps>(\n ({ children, ...rest }, ref) => {\n const {\n size,\n isDismissable,\n isOpen,\n onOpenChange,\n parentRef,\n isKeyboardDismissDisabled,\n } = useDialogContext();\n const isSSR = useIsSSR();\n const [portal, setPortal] = useState(isSSR ? null : document.body);\n\n useEffect(() => {\n const node = parentRef?.current;\n /* Ensure proper ssr hydration TODO */\n const port = isSSR ? null : document.createElement('div');\n\n if (node && port) {\n node.appendChild(port);\n setPortal(port);\n }\n\n return () => {\n port?.remove();\n\n setPortal(isSSR ? null : document.body);\n };\n }, [isSSR, parentRef]);\n\n return portal ? (\n <RACModalOverlay\n UNSTABLE_portalContainer={portal}\n isKeyboardDismissDisabled={!isDismissable && isKeyboardDismissDisabled}\n isOpen={isOpen}\n onOpenChange={onOpenChange}\n isDismissable={isDismissable}\n className='absolute inset-0 flex items-center justify-center'\n {...rest}\n >\n <RACModal\n ref={ref}\n className={cn(\n 'flex flex-col justify-center bg-surface-overlay align-start',\n size === 'sm' && 'rounded-medium',\n size === 'lg' && 'rounded-large',\n )}\n >\n <RACDialog className={dialogClasses({ size })}>{children}</RACDialog>\n </RACModal>\n </RACModalOverlay>\n ) : null;\n },\n);\nDialogBody.displayName = 'DialogBody';\n\nconst DialogContent = ({\n children,\n className,\n}: PropsWithChildren<{ className?: string }>) => {\n const { size } = useDialogContext();\n return (\n <div\n className={cn(\n 'flex flex-col',\n size === 'sm' && 'gap-xs',\n size === 'lg' && 'gap-l',\n className,\n )}\n >\n {children}\n </div>\n );\n};\n\nexport const DialogTitle = ({\n children,\n className,\n}: PropsWithChildren<{ className?: string }>) => {\n const { size } = useDialogContext();\n return (\n <RACHeading\n slot='title'\n className={cn(\n 'text-default-light',\n size === 'sm' && 'mb-s text-header-m',\n size === 'lg' && 'mb-m text-header-l',\n className,\n )}\n >\n {children}\n </RACHeading>\n );\n};\n\nconst DialogButton = ({ children, className, ...props }: ButtonProps) => {\n const { size: dialogSize } = useDialogContext();\n const buttonSize = buttonSizes[dialogSize];\n return (\n <Button\n size={buttonSize}\n {...props}\n //overriding the style to deal with rac's pressed state inherited\n //from the trigger state\n className={cn('dtk-pressed:bg-initial', className)}\n >\n {children}\n </Button>\n );\n};\n\nconst DialogFooter = ({\n children,\n className,\n}: PropsWithChildren<{ className?: string }>) => {\n const { size } = useDialogContext();\n return (\n <div\n className={cn(\n 'flex justify-end gap-xs',\n size === 'sm' && 'mt-l',\n size === 'lg' && 'mt-xl',\n className,\n )}\n >\n {children}\n </div>\n );\n};\n\nDialog.Button = DialogButton;\nDialog.Content = DialogContent;\nDialog.Footer = DialogFooter;\nDialog.Title = DialogTitle;\nDialog.Body = DialogBody;\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/floating-button/index.tsx"],"names":["s","FloatingButton","AriaButton","
|
1
|
+
{"version":3,"sources":["../../../src/components/floating-button/index.tsx"],"names":["s","FloatingButton","AriaButton","u","l","className","cn","floatingButtonStyles","i","props"],"mappings":"8JAsBI,IAAA,CAAA,CAAAA,GAAA,CAAA,CAAA,iMACA,CAAA,8IAEA,CAAA,0FAGA,CAAA,CAAA,CAAA,oBAEU,oPACC,CAAA,KAGX,CAAA,EAAA,CAAA,CAAA,CAAA,eACE,CAAA,CAAA,UAUOC,MAAkB,CAC7B,gBACA,CAAA,CAAA,CAAA,UAEF,MACGC,CAAAA,CAAA,GACCC,GAAA,CAAAC,MAAA,CAAA,CAAA,SAA0CC,CACxCC,kBAAAA,CACEC,EAAqB,CACnB,EAAAC,EAAA,CAAA,CAAA,CAAA,CAAA,SACA,CAAA,CAAA,CAAA,UAIN,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,UACIC,CACN,CAAA,CAEFR,GAAe,CAAA,CAAA,EAAA,CAAA,CAAA,WAAc,CAAA,gBAE3BQ,EACAJ,CAAAA,EAAAA,CACGC,CAAAA,CAAGC,EAAqB,GAAEC,EAAGC,EAAO,CAAA,CAAA,GAAA,CAAA,CAAA,SAAY,CAAA,CAAA,CAAA,CAAA,CAAA","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\nimport { cn } from '@/lib/utils';\nimport { type VariantProps, cva } from 'cva';\nimport {\n Button as AriaButton,\n type ButtonProps as AriaButtonProps,\n composeRenderProps,\n} from 'react-aria-components';\n\nconst floatingButtonStyles = cva(\n [\n 'absolute right-[20px] bottom-[20px] inline-flex size-[32px] cursor-pointer items-center justify-center rounded-full bg-transparent shadow-elevation-overlay outline outline-interactive-default',\n 'icon-default-dark [--icon-size:var(--spacing-xl)]',\n 'hover:icon-default-light hover:bg-interactive-hover-dark hover:outline-interactive-hover',\n 'focus:icon-default-light focus:bg-interactive-hover-dark focus:outline-interactive-hover',\n ],\n {\n variants: {\n isDisabled: {\n true: 'icon-disabled hover:icon-disabled cursor-not-allowed bg-interactive-disabled outline-interactive-disabled hover:bg-interactive-disabled hover:outline-interactive-disabled focus:bg-interactive-disabled focus:outline-interactive-disabled',\n false: '',\n },\n },\n defaultVariants: {\n isDisabled: false,\n },\n },\n);\n\nexport interface FloatingButtonProps\n extends Omit<AriaButtonProps, 'isDisabled'> {\n isDisabled?: boolean;\n}\n\nexport const FloatingButton = ({\n className,\n isDisabled,\n ...props\n}: FloatingButtonProps) => (\n <AriaButton\n className={composeRenderProps(className, (className) =>\n cn(\n floatingButtonStyles({\n className,\n isDisabled,\n }),\n ),\n )}\n isDisabled={isDisabled}\n {...props}\n />\n);\nFloatingButton.displayName = 'FloatingButton';\nFloatingButton.as = (\n props: VariantProps<typeof floatingButtonStyles>,\n className?: string | string[],\n) => cn(floatingButtonStyles({ ...props, className }));\n"]}
|
@@ -1,19 +1,19 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
-
import * as
|
3
|
-
import {
|
4
|
-
import {
|
2
|
+
import * as React from 'react';
|
3
|
+
import { ContextValue } from 'react-aria-components';
|
4
|
+
import { IconProps, IconProviderProps } from './types.js';
|
5
|
+
import './styles.js';
|
6
|
+
import 'tailwind-variants';
|
5
7
|
|
6
|
-
declare const
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
declare const IconContext: React.Context<ContextValue<IconProps, HTMLSpanElement>>;
|
9
|
+
declare function IconProvider({ children, ...props }: IconProviderProps): react_jsx_runtime.JSX.Element;
|
10
|
+
declare namespace IconProvider {
|
11
|
+
var displayName: string;
|
12
|
+
}
|
13
|
+
declare function Icon({ ref, ...props }: IconProps): react_jsx_runtime.JSX.Element;
|
14
|
+
declare namespace Icon {
|
15
|
+
var displayName: string;
|
16
|
+
var Provider: typeof IconProvider;
|
12
17
|
}
|
13
|
-
declare const Icon: {
|
14
|
-
({ children, className, size, ...rest }: IconProps): react_jsx_runtime.JSX.Element;
|
15
|
-
displayName: string;
|
16
|
-
as(props: VariantProps<typeof iconStyles>, className?: string | string[]): string;
|
17
|
-
};
|
18
18
|
|
19
|
-
export { Icon,
|
19
|
+
export { Icon, IconContext };
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import {
|
1
|
+
import {createContext}from'react';import {useContextProps}from'react-aria-components';import {IconStylesDefaults,IconStyles}from'./styles.js';import {jsx}from'react/jsx-runtime';var n=createContext(null);function r({children:o,...e}){return jsx(n.Provider,{value:e,children:o})}r.displayName="Icon.Provider";function t({ref:o,...e}){[e,o]=useContextProps(e,o??null,n);let{children:c,className:i,size:l=IconStylesDefaults.size,...p}=e;return jsx("span",{...p,ref:o,className:IconStyles({className:i,size:l}),children:c})}t.displayName="Icon";t.Provider=r;export{t as Icon,n as IconContext};//# sourceMappingURL=index.js.map
|
2
2
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/icon/index.tsx"],"names":["
|
1
|
+
{"version":3,"sources":["../../../src/components/icon/index.tsx"],"names":["IconContext","createContext","IconProvider","children","jsx","props","Icon","ref","useContextProps","className","size","IconStylesDefaults","rest","IconStyles"],"mappings":"kLAiBaA,KACXC,CAAAA,aAAwD,CAAA,IAAI,EAE9D,SAASC,CAAa,CAAE,SAAAC,CAAAA,CAAU,CAAA,GAAS,CAAA,CAAsB,CAC/D,QAAOC,GAACJ,CAAAA,CAAY,CAAA,QAAZ,CAAqB,CAAA,KAAOK,CAAAA,CAAQ,SAAAF,CAAAA,CAAS,CACvD,CACAD,CAAAA,CAAa,CAAA,WAAc,gBAEpB,CAAA,SAASI,CAAK,CAAE,CAAA,GAAAC,CAAAA,CAAK,CAAA,GAAS,CAAA,CAAc,CACjD,CAACF,CAAAA,CAAOE,CAAG,EAAIC,CAAAA,eAAgBH,CAAAA,CAAOE,CAAAA,CAAAA,EAAO,IAAMP,CAAW,CAAA,CAE9D,IACE,CAAA,QAAAG,EACA,CAAA,SAAAM,CAAAA,CACA,KAAAC,CAAAA,CAAOC,CAAAA,kBAAmB,CAAA,IAC1B,CAAA,GACF,CAAA,CAAIN,EAEJ,CAAA,OACED,GAAC,QAAM,CAAA,GAAGQ,CAAM,IAAKL,CAAAA,CAAK,CAAA,SAAWM,CAAAA,UAAW,CAAE,CAAA,SAAAJ,CAAAA,CAAW,KAAAC,CAAK,CAAC,CAAA,CAChE,CAAA,QAAAP,CAAAA,CACH,CAEJ,CACAG,CAAAA,CAAK,CAAA,WAAc,CAAA,MACnBA,CAAAA,CAAK,CAAA,QAAWJ,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\nimport { createContext } from 'react';\nimport { type ContextValue, useContextProps } from 'react-aria-components';\nimport { IconStyles, IconStylesDefaults } from './styles';\nimport type { IconProps, IconProviderProps } from './types';\n\nexport const IconContext =\n createContext<ContextValue<IconProps, HTMLSpanElement>>(null);\n\nfunction IconProvider({ children, ...props }: IconProviderProps) {\n return <IconContext.Provider value={props}>{children}</IconContext.Provider>;\n}\nIconProvider.displayName = 'Icon.Provider';\n\nexport function Icon({ ref, ...props }: IconProps) {\n [props, ref] = useContextProps(props, ref ?? null, IconContext);\n\n const {\n children,\n className,\n size = IconStylesDefaults.size,\n ...rest\n } = props;\n\n return (\n <span {...rest} ref={ref} className={IconStyles({ className, size })}>\n {children}\n </span>\n );\n}\nIcon.displayName = 'Icon';\nIcon.Provider = IconProvider;\n"]}
|