@accelint/design-toolkit 2.2.0 → 2.3.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 +1 -0
- package/dist/components/accordion/index.d.ts +2 -2
- package/dist/components/accordion/index.js +1 -1
- package/dist/components/accordion/index.js.map +1 -1
- package/dist/components/accordion/styles.d.ts +3 -39
- package/dist/components/accordion/styles.js +1 -1
- package/dist/components/accordion/styles.js.map +1 -1
- package/dist/components/avatar/index.d.ts +4 -4
- package/dist/components/avatar/index.js +1 -1
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/badge/index.d.ts +2 -2
- package/dist/components/box/index.d.ts +3 -3
- package/dist/components/button/index.d.ts +35 -23
- package/dist/components/button/index.js +1 -1
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/button/styles.d.ts +297 -0
- package/dist/components/button/styles.js +2 -0
- package/dist/components/button/styles.js.map +1 -0
- package/dist/components/button/types.d.ts +14 -0
- package/dist/components/button/types.js +2 -0
- package/dist/components/button/types.js.map +1 -0
- 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 +25 -48
- package/dist/components/chip/index.js +1 -1
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/chip/styles.d.ts +250 -0
- package/dist/components/chip/styles.js +2 -0
- package/dist/components/chip/styles.js.map +1 -0
- package/dist/components/chip/types.d.ts +20 -0
- package/dist/components/chip/types.js +2 -0
- package/dist/components/chip/types.js.map +1 -0
- package/dist/components/classification-badge/index.d.ts +15 -16
- package/dist/components/classification-badge/index.js +1 -1
- package/dist/components/classification-badge/index.js.map +1 -1
- package/dist/components/classification-badge/styles.d.ts +51 -0
- package/dist/components/classification-badge/styles.js +2 -0
- package/dist/components/classification-badge/styles.js.map +1 -0
- package/dist/components/classification-badge/types.d.ts +9 -0
- package/dist/components/classification-badge/types.js +2 -0
- package/dist/components/classification-badge/types.js.map +1 -0
- package/dist/components/classification-banner/index.d.ts +15 -16
- package/dist/components/classification-banner/index.js +1 -2
- package/dist/components/classification-banner/index.js.map +1 -1
- package/dist/components/classification-banner/styles.d.ts +38 -0
- package/dist/components/classification-banner/styles.js +2 -0
- package/dist/components/classification-banner/styles.js.map +1 -0
- package/dist/components/classification-banner/types.d.ts +9 -0
- package/dist/components/classification-banner/types.js +2 -0
- package/dist/components/classification-banner/types.js.map +1 -0
- package/dist/components/color-picker/index.js +1 -1
- package/dist/components/color-picker/index.js.map +1 -1
- package/dist/components/combobox/index.js +1 -1
- package/dist/components/combobox/index.js.map +1 -1
- package/dist/components/date-field/index.js +1 -1
- package/dist/components/date-field/index.js.map +1 -1
- package/dist/components/dialog/index.d.ts +5 -5
- package/dist/components/dialog/index.js +1 -1
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/icon/index.d.ts +2 -2
- package/dist/components/icon/index.js +1 -1
- package/dist/components/icon/index.js.map +1 -1
- package/dist/components/icon/types.d.ts +3 -5
- package/dist/components/label/index.d.ts +10 -7
- package/dist/components/label/index.js +1 -1
- package/dist/components/label/index.js.map +1 -1
- package/dist/components/label/styles.d.ts +5 -0
- package/dist/components/label/styles.js +2 -0
- package/dist/components/label/styles.js.map +1 -0
- package/dist/components/label/types.d.ts +10 -0
- package/dist/components/label/types.js +2 -0
- package/dist/components/label/types.js.map +1 -0
- package/dist/components/options/index.d.ts +2 -2
- package/dist/components/options/index.js +1 -1
- package/dist/components/options/index.js.map +1 -1
- package/dist/components/options-item/index.js +1 -1
- package/dist/components/options-item/index.js.map +1 -1
- package/dist/components/popover/index.js +1 -1
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/popover/styles.d.ts +3 -3
- package/dist/components/query-builder/index.js +1 -1
- package/dist/components/query-builder/index.js.map +1 -1
- package/dist/components/query-builder/value-editor.js +1 -1
- package/dist/components/query-builder/value-editor.js.map +1 -1
- package/dist/components/radio/index.d.ts +11 -9
- package/dist/components/radio/index.js +1 -1
- package/dist/components/radio/index.js.map +1 -1
- package/dist/components/radio/styles.d.ts +53 -0
- package/dist/components/radio/styles.js +2 -0
- package/dist/components/radio/styles.js.map +1 -0
- package/dist/components/radio/types.d.ts +21 -0
- package/dist/components/radio/types.js +2 -0
- package/dist/components/radio/types.js.map +1 -0
- package/dist/components/search-field/index.js +1 -1
- package/dist/components/search-field/index.js.map +1 -1
- package/dist/components/slider/index.js +1 -1
- package/dist/components/slider/index.js.map +1 -1
- package/dist/components/switch/index.d.ts +10 -7
- package/dist/components/switch/index.js +1 -1
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/switch/styles.d.ts +41 -0
- package/dist/components/switch/styles.js +2 -0
- package/dist/components/switch/styles.js.map +1 -0
- package/dist/components/switch/types.d.ts +13 -0
- package/dist/components/switch/types.js +2 -0
- package/dist/components/switch/types.js.map +1 -0
- package/dist/components/tabs/index.js +1 -1
- package/dist/components/tabs/index.js.map +1 -1
- package/dist/components/text-area-field/index.d.ts +19 -0
- package/dist/components/text-area-field/index.js +2 -0
- package/dist/components/text-area-field/index.js.map +1 -0
- package/dist/components/text-area-field/styles.d.ts +113 -0
- package/dist/components/text-area-field/styles.js +2 -0
- package/dist/components/text-area-field/styles.js.map +1 -0
- package/dist/components/text-area-field/types.d.ts +23 -0
- package/dist/components/text-area-field/types.js +2 -0
- package/dist/components/text-area-field/types.js.map +1 -0
- package/dist/components/text-field/index.js +1 -1
- package/dist/components/text-field/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/index.css +122 -252
- package/dist/index.d.ts +25 -11
- package/dist/index.js +1 -1
- package/dist/lib/react.js.map +1 -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 +873 -754
- package/dist/tokens/generated/themes.css +147 -0
- package/dist/tokens/generated/themes.d.ts +2 -0
- package/dist/tokens/generated/tokens.css +119 -0
- package/dist/tokens/generated/tokens.d.ts +108 -0
- package/dist/tokens/generated/tokens.js +2 -0
- package/dist/tokens/generated/tokens.js.map +1 -0
- package/package.json +5 -5
- package/dist/components/floating-button/index.d.ts +0 -18
- package/dist/components/floating-button/index.js +0 -2
- package/dist/components/floating-button/index.js.map +0 -1
- package/dist/components/icon-button/index.d.ts +0 -20
- package/dist/components/icon-button/index.js +0 -2
- package/dist/components/icon-button/index.js.map +0 -1
- package/dist/components/text-area/index.d.ts +0 -30
- package/dist/components/text-area/index.js +0 -2
- package/dist/components/text-area/index.js.map +0 -1
- package/dist/components/toggle-icon-button/index.d.ts +0 -20
- package/dist/components/toggle-icon-button/index.js +0 -2
- package/dist/components/toggle-icon-button/index.js.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/color-picker/index.tsx"],"names":["value","parseColor","P","useMemo","parseColorFromProp","props","useControlledState","
|
1
|
+
{"version":3,"sources":["../../../src/components/color-picker/index.tsx"],"names":["value","parseColor","P","useMemo","parseColorFromProp","props","useControlledState","defaultValue","color","ref","colorFromProps","propColor","n","locale","map","useContext","ColorMapContext","m","useEffect","p","key","jsx","AriaListBoxItem","a","S","createContext","h","useContextProps","ColorSwatchPickerContext","v","state","useColorPickerState","colorMap","w","u","x","ColorPicker"],"mappings":"4WA8CE,CAAA,CAAI,CAAA,EAAA,CAAA,GAAOA,uBAEAC,OACTC,UAAA,CAAA,CAAQ,CACN,MACF,CAEF,MAAA,CAAOF,OAGF,CAAA,CAAA,CAAA,WAGCA,CAAAA,CAAQG,CAAAA,KAAcC,CAAAA,OAAmBC,CAAAA,MAAW,CAAA,CAAG,KAAO,CAAA,CAAA,CAAK,CAAC,MAGxE,IAAMD,CAAAA,OAAmBC,CAAAA,oBAAsB,EAAA,SACxC,CAAA,CAAA,CAAA,CAAA,CAAA,YAEa,EAAIC,CAAAA,CACxBN,CAAAA,CAAAA,CAAS,sBACTO,EACAF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OAAA,CAAA,IAAI,IAAS,QAE1CS,OACEE,GAAA,CAAAU,OAAA,CAAA,CAAA,sCACO5B,CAAAA,KAAM,CAAA,CACb,OAAQA,MAAM,CAAA,CAAA,CAAA,QACd,MAAA,CAAA,aAAc,CAAA,qBACM,CAAA,CAAQ,CAACyB,QAAY,CAAA,KAAA,CAAA,QAAe,CAAC,MAAI,CAAA,CAAA,CAC7D,0BAEe,EAAA,CAAA,CAAA,GAAA,QACK,CAAA,CACdA,iBAA4B,CAAC,CAAA,CAAA,IAAS,CAAC,GAAE,CAGzCA,CAAAA,CAAM,eAGZ,KACIzB,CAAAA,EAEJ,8BAA0B,CAAO2B,MAC9B,CAAA,CAAA,CAAA,QAMF,0BAEL,CAAA,CAAA,CAAA,SAEF,EAAqB,CACnB,GAAA,CAAA,CAAA,CAAA,CACEX,uBACgB,CAAAa,EAAA,CAAA,sBACV7B,EAEH,CAAA,CAAA,GAAA,CAAA,CAAA,QAAaG,CAAAA,CAAAA,CACZa,IAAC,CAA6C,EAAAE,GAAA,CAAA,CAAA,CAAOf,MACnD,CAAA,CAAA,CAAA,QAAiB,CAAAe,GAAA,CAAAY,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\n'use client';\nimport { cn } from '@/lib/utils';\nimport { useControlledState } from '@react-stately/utils';\nimport 'client-only';\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,2 +1,2 @@
|
|
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
|
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 {ChevronDown}from'@accelint/icons';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 q=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(q({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:u,placeholder:A,layoutOptions:h,size:c="medium",...x}){let b=c==="small",B=!(b||a)||s,I=a&&!s&&!r,P=!b&&u;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,isRequired:x.isRequired,children:u}),jsxs("div",{className:"relative flex items-center",children:[jsx(f,{className:o,isReadOnly:r,placeholder:A,size:c}),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(ChevronDown,{})})})]}),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 M({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=M;export{n as ComboBox,M 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","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,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,GAAA,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"]}
|
1
|
+
{"version":3,"sources":["../../../src/components/combobox/index.tsx"],"names":["w","className","isReadOnly","size","AriaInput","props","isDisabled","isInvalid","p","ComboBox","children","isSmall","shouldShowDescription","shouldShowError","shouldShowLabel","label","jsx","AriaComboBox","e","N","m","E","AriaButton","L","cn","Icon","ChevronDown","k","AriaText","description","y","errorMessage","AriaVirtualizer","AriaListLayout","T","Options","F","ComboBoxSection","jsxs","AriaListBoxSection","S","C","header","items","O"],"mappings":"kdA2CI,IAAA,CAAA,CAAAA,GAAA,CAAA,CAAA,2FACA,CAAA,6MAGA,CAAU,CACR,CAAA,QAAA,CAAA,CAAY,UACJ,CAAA,CAAA,IAAA,CAAA,uLAIR,CAAW,CACT,SAAM,CAAA,CAAA,IAAA,CAAA,uBAGE,CAAA,CAAA,MAAA,CAAA,qDAMR,CAAA,CAAA,CAAY,UACZ,CAAA,IAAW,CAAA,cACA,CAAA,SAAA,CAAA,8BAGf,CAAA,CAAA,CAAA,eACQ,CAAA,CAAA,IAGZ,CAAA,QASE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAAC,UACA,CAAA,CAAA,CAAAC,UACAC,CAAAA,CAAO,YACP,CAAA,CAAA,QAGGC,CAAAA,GACE,CAAA,CAAGC,kBACO,CAAC,YAAEC,UAAY,CAAA,CAAAC,CAAU,SAG9B,CAAA,CAAA,CAAA,GAAAC,EAAA,CAAA,CAAA,CAAA,CAAAF,UACA,CAAA,CAAAC,CAAAA,SAEA,CAAA,CAAA,CAAA,IAAA,CAAA,CAAAN,CACF,SAMJ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,4BAiBUQ,CAAiC,SAC/C,CAAAC,CAAAA,CACA,UAAAT,CAAAA,SACA,CAAA,CAAA,CAAA,WACA,CAAA,CAAA,CAAA,eACAK,UACA,CAAA,CAAAC,UACA,CAAA,CAAA,CAAAL,UAEA,CAAA,CAAA,CAAA,KAAA,CAAA,CAAA,CAAA,WACA,CAAA,CAAA,CAAA,aAC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BACpBC,YACSC,CAAAA,WACR,CAAA,CAAA,MAAA,CAAAC,UAAA,CAAA,aAEA,CAAAlB,CAAAA,CAACmB,QAAS,CAAAjB,GAAA,CAAAkB,OAAA1B,EAAS,QAGzB,CAEJ,CAEJ,CACAD,EAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,WAAc,CAEvBA,kBAOgB4B,WAAAA,CAAwC,UACtD3B,CAAAA,CACA,SACA,CAAA,CAAA,OAC0B,CAC1B,CAAA,KAAA,CACE4B,EAACC,CAAAA,CAAA,OAECnB,IAAA,CAAAoB,cAAA,CAAA,CAAA,EAAA,CAAA,CAAU,CAAA,SAAA,CAAA,0FAEVxB,CAAAA,QAAY,CAAA,CAAAE,GAAA,CAAAuB,MAAA,CAAU,CAAA,SAAA,CAAA,uDACnBC,CACH,aAC8BC,GAAAA,CAAQC,UAAA,CAAA,CAAA,KAAA,CAAAlC,EAAS,QAI5C,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,WAAc,CAAA,kBACJ2B,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\n'use client';\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';\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 isRequired={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"]}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import
|
1
|
+
import {cn}from'./../../lib/utils.js';import y from'@accelint/icons/calendar';import'client-only';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"],R=({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},T=({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(R,{...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,isRequired:m.isRequired,children:r}),jsx(V,{className:e,isDisabled:t,size:d,isReadOnly:l,isInvalid:s,children:x=>jsx(T,{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
2
|
//# sourceMappingURL=index.js.map
|
@@ -1 +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,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9C,EAAA,CAAA,CAAA,EAAA,CACEd,CAAAA,CAACiB,OACKZ,IACJ,2BACA,CAAA,CAAA,CAAA,SACA,CAAA,CAAA,CAAA,UACMI,CACN,CAAA,CAAA,IAAA,CAAA,CAAA,CAAA,SAAW,CAAA,sBAEV,CAAA,SACE,CACC,CAAA,CAAA,EAAAf,GAAA,CAAAwB,KAAA,CAAA,CAAA,wBACA,CAAA,uBACmB,CAAA,CAAA,CAAA,CAAA,UAElB,CAAAV,QAIJ,CACC,oBACA,CAAA,CAAA,CAAA,UACME,CACN,CAAA,CAAA,IAAA,CAAA,CAAA,CAAA,UACA,CAAA,CAAA,CAAA,YAEEpB,QACsB,CAAA,CAAA,EAAAI,GAAA,CAAA,CAAA,CAASJ,QAAS,CAAA,CAAA,CAAA,UAG3CsB,CACCpB,CAAAA,CAAC2B,EAAA,CACC,CAAA,CAAA,EAAAzB,GAAA,CAAA0B,IAAA,CAAA,CAAA,SACE,CAAAjB,EAAA,CAAA,CAAA,2CACc,CAAA,CAAA,EAAA,aAEX,CAAA,CAAA,CAAA,IAAA,CAAA,aAEJ,CAAAkB,SAIFC,CAAAA,CAAA,CAAW,6BAAU,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"]}
|
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","b","Label","AriaText","S","description","FieldError"],"mappings":"4UAoCE,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,GA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UAEjB,CAAAX,QAIJ,CACC,oBACA,CAAA,CAAA,CAAA,UACME,CACN,CAAA,CAAA,IAAA,CAAA,CAAA,CAAA,UACA,CAAA,CAAA,CAAA,YAEEpB,QACsB,CAAA,CAAA,EAAAI,GAAA,CAAA,CAAA,CAASJ,QAAS,CAAA,CAAA,CAAA,UAG3CsB,CACCpB,CAAAA,CAAC4B,EAAA,CACC,CAAA,CAAA,EAAA1B,GAAA,CAAA2B,IAAA,CAAA,CAAA,SACE,CAAAlB,EAAA,CAAA,CAAA,2CACc,CAAA,CAAA,EAAA,aAEX,CAAA,CAAA,CAAA,IAAA,CAAA,aAEJ,CAAAmB,SAIFC,CAAAA,CAAA,CAAW,6BAAU,CAAA,sCACnB,CAAAP,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\n'use client';\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 'client-only';\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 isRequired={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"]}
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import * as
|
1
|
+
import * as react from 'react';
|
2
2
|
import { RefObject, PropsWithChildren, ReactNode } from 'react';
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
4
4
|
import { DialogTriggerProps, DialogRenderProps } from 'react-aria-components';
|
5
|
-
import { ButtonProps } from '../button/
|
6
|
-
import '
|
7
|
-
import '
|
5
|
+
import { ButtonProps } from '../button/types.js';
|
6
|
+
import 'tailwind-variants';
|
7
|
+
import '../button/styles.js';
|
8
8
|
|
9
9
|
type DialogSize = 'sm' | 'lg';
|
10
10
|
interface DialogProps extends DialogTriggerProps {
|
@@ -28,7 +28,7 @@ declare const Dialog: {
|
|
28
28
|
Title: ({ children, className, }: PropsWithChildren<{
|
29
29
|
className?: string;
|
30
30
|
}>) => react_jsx_runtime.JSX.Element;
|
31
|
-
Body:
|
31
|
+
Body: react.ForwardRefExoticComponent<DialogBodyProps & react.RefAttributes<HTMLDivElement>>;
|
32
32
|
};
|
33
33
|
interface DialogBodyProps {
|
34
34
|
children: ReactNode | ReactNode[] | ((opts: DialogRenderProps) => ReactNode);
|
@@ -1,2 +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:
|
1
|
+
import {cn}from'./../../lib/utils.js';import {useIsSSR}from'@react-aria/ssr';import'client-only';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:y}=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&&y,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("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
2
|
//# sourceMappingURL=index.js.map
|
@@ -1 +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","butt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,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
|
+
{"version":3,"sources":["../../../src/components/dialog/index.tsx"],"names":["h","useDialogContext","useContext","DialogContext","z","ctx","size","isOpen","RACDialogTrigger","s","B","Dialog","forwardRef","v","ref","isSSR","useIsSSR","portal","setPortal","C","useState","N","useEffect","parentRef","port","node","jsx","RACModalOverlay","n","O","DialogBody","className","S","buttonSize","buttonS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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\n'use client';\nimport { cn } from '@/lib/utils';\nimport { useIsSSR } from '@react-aria/ssr';\nimport 'client-only';\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 } from '../button';\nimport type { ButtonProps } from '../button/types';\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('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,11 +1,11 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
-
import * as
|
2
|
+
import * as react from 'react';
|
3
3
|
import { ContextValue } from 'react-aria-components';
|
4
4
|
import { IconProps, IconProviderProps } from './types.js';
|
5
5
|
import './styles.js';
|
6
6
|
import 'tailwind-variants';
|
7
7
|
|
8
|
-
declare const IconContext:
|
8
|
+
declare const IconContext: react.Context<ContextValue<IconProps, HTMLSpanElement>>;
|
9
9
|
declare function IconProvider({ children, ...props }: IconProviderProps): react_jsx_runtime.JSX.Element;
|
10
10
|
declare namespace IconProvider {
|
11
11
|
var displayName: string;
|
@@ -1,2 +1,2 @@
|
|
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:
|
1
|
+
import'client-only';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:p=IconStylesDefaults.size,...l}=e;return jsx("span",{...l,ref:o,className:IconStyles({className:i,size:p}),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":["IconContext","createContext","
|
1
|
+
{"version":3,"sources":["../../../src/components/icon/index.tsx"],"names":["IconContext","createContext","children","jsx","props","IconProvider","Icon","ref","useContextProps","className","size","IconStylesDefaults","rest","IconStyles"],"mappings":"sMAkBaA,IAAAA,CACXC,CAAAA,aAAwD,CAAA,IAAI,EAE9D,UAAsB,CAAE,CAAA,QAAAC,EAAU,CAAA,GAAS,EAAsB,CAC/D,CAAA,OAAOC,GAACH,CAAAA,CAAY,CAAA,QAAZ,CAAqB,MAAOI,CAAAA,CAAQ,CAAA,QAAAF,CAAAA,CAAS,CACvD,CACAG,CAAAA,CAAa,YAAc,CAAA,eAEpB,CAAA,SAASC,CAAK,CAAE,CAAA,GAAAC,CAAAA,CAAK,IAAS,CAAA,CAAc,CACjD,CAACH,CAAAA,CAAOG,CAAG,CAAA,CAAIC,CAAAA,eAAgBJ,CAAAA,CAAOG,CAAAA,CAAAA,EAAO,IAAMP,CAAW,EAE9D,CAAA,GACE,CAAA,QAAAE,CAAAA,CACA,CAAA,SAAAO,CAAAA,CACA,KAAAC,CAAAA,CAAOC,CAAAA,kBAAmB,CAAA,IAC1B,CAAA,GACF,CAAA,CAAIP,EAEJ,CAAA,OACED,GAAC,QAAM,CAAA,GAAGS,CAAM,IAAKL,CAAAA,CAAK,CAAA,SAAWM,CAAAA,UAAW,CAAE,CAAA,SAAAJ,CAAAA,CAAW,KAAAC,CAAK,CAAC,CAAA,CAChE,CAAA,QAAAR,CAAAA,CACH,CAEJ,CACAI,CAAAA,CAAK,CAAA,WAAc,CAAA,MACnBA,CAAAA,CAAK,CAAA,QAAWD,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 { 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"]}
|
@@ -1,10 +1,8 @@
|
|
1
|
-
import { PropsWithChildren, RefAttributes } from 'react';
|
1
|
+
import { PropsWithChildren, RefAttributes, HTMLAttributes } from 'react';
|
2
2
|
import { IconStyleVariants } from './styles.js';
|
3
3
|
import 'tailwind-variants';
|
4
4
|
|
5
|
-
type IconProps = PropsWithChildren<RefAttributes<HTMLSpanElement> &
|
6
|
-
|
7
|
-
}>;
|
8
|
-
type IconProviderProps = PropsWithChildren<IconStyleVariants>;
|
5
|
+
type IconProps = PropsWithChildren<RefAttributes<HTMLSpanElement> & HTMLAttributes<HTMLSpanElement> & IconStyleVariants>;
|
6
|
+
type IconProviderProps = PropsWithChildren<Omit<IconProps, 'ref'>>;
|
9
7
|
|
10
8
|
export type { IconProps, IconProviderProps };
|
@@ -1,14 +1,17 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
-
import
|
2
|
+
import * as react from 'react';
|
3
|
+
import { ContextValue } from 'react-aria-components';
|
4
|
+
import { LabelProps, LabelProviderProps } from './types.js';
|
3
5
|
|
4
|
-
|
5
|
-
|
6
|
-
|
6
|
+
declare const LabelContext: react.Context<ContextValue<LabelProps, HTMLLabelElement>>;
|
7
|
+
declare function LabelProvider({ children, ...props }: LabelProviderProps): react_jsx_runtime.JSX.Element;
|
8
|
+
declare namespace LabelProvider {
|
9
|
+
var displayName: string;
|
7
10
|
}
|
8
|
-
declare function Label({
|
11
|
+
declare function Label({ ref, ...props }: LabelProps): react_jsx_runtime.JSX.Element;
|
9
12
|
declare namespace Label {
|
10
13
|
var displayName: string;
|
11
|
-
var
|
14
|
+
var Provider: typeof LabelProvider;
|
12
15
|
}
|
13
16
|
|
14
|
-
export { Label };
|
17
|
+
export { Label, LabelContext };
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import
|
1
|
+
import'client-only';import {createContext}from'react';import {useContextProps,Label}from'react-aria-components';import {LabelStyles}from'./styles.js';import {jsxs,jsx}from'react/jsx-runtime';var a=createContext(null);function o({children:l,...e}){return jsx(a.Provider,{value:e,children:l})}o.displayName="Label.Provider";function t({ref:l,...e}){[e,l]=useContextProps(e,l??null,a);let{children:i,className:n,isDisabled:s,isRequired:r,...b}=e;return jsxs(Label,{...b,className:LabelStyles({className:n}),"data-disabled":s||null,"data-required":r||null,children:[i,!r&&" (optional)"]})}t.displayName="Label";t.Provider=o;export{t as Label,a as LabelContext};//# sourceMappingURL=index.js.map
|
2
2
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/label/index.tsx"],"names":["
|
1
|
+
{"version":3,"sources":["../../../src/components/label/index.tsx"],"names":["LabelContext","createContext","children","jsx","props","LabelProvider","Label","ref","useContextProps","className","isDisabled","isRequired","jsxs","AriaLabel","rest","LabelStyles"],"mappings":"+LAuBaA,IAAAA,CACXC,CAAAA,aAA0D,CAAA,IAAI,EAEhE,UAAuB,CAAE,CAAA,QAAAC,CAAAA,CAAU,CAAA,GAAS,CAAA,CAAuB,CACjE,CAAA,OACEC,GAACH,CAAAA,CAAa,CAAA,QAAb,CAAsB,CAAA,KAAOI,EAAQ,CAAA,QAAAF,CAAAA,CAAS,CAEnD,CACAG,CAAAA,CAAc,CAAA,WAAc,CAAA,gBAErB,CAAA,SAASC,CAAM,CAAE,CAAA,GAAAC,CAAAA,CAAK,CAAA,GAAS,EAAe,CACnD,CAACH,CAAAA,CAAOG,CAAG,CAAA,CAAIC,CAAAA,eAAgBJ,EAAOG,CAAAA,CAAAA,EAAO,IAAMP,CAAY,CAAA,CAE/D,CAAA,GAAQ,SAAAE,CAAAA,CAAU,CAAA,SAAAO,CAAAA,CAAW,CAAA,UAAAC,CAAAA,CAAY,CAAA,UAAAC,CAAAA,CAAY,CAAA,GAAQ,CAAA,CAAIP,CAAAA,CAEjE,CAAA,OACEQ,IAACC,CAAAA,KAAA,CACE,CAAA,GAAGC,CACJ,CAAA,SAAWC,CAAAA,WAAY,CAAE,CAAA,SAAAN,CAAU,CAAC,CAAA,CACpC,CAAA,eAAeC,CAAAA,CAAAA,EAAc,IAC7B,CAAA,eAAeC,IAAc,IAE5B,CAAA,QAAA,CAAAT,CAAAA,CACA,CAACS,CAAAA,CAAAA,EAAc,aAAA,CAClB,CAEJ,CACAL,CAAAA,CAAM,CAAA,WAAc,CAAA,OACpBA,CAAAA,CAAM,CAAA,QAAWD,CAAAA,CAAAA","file":"index.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n'use client';\n\nimport 'client-only';\nimport { createContext } from 'react';\nimport {\n Label as AriaLabel,\n type ContextValue,\n useContextProps,\n} from 'react-aria-components';\nimport { LabelStyles } from './styles';\nimport type { LabelProps, LabelProviderProps } from './types';\n\nexport const LabelContext =\n createContext<ContextValue<LabelProps, HTMLLabelElement>>(null);\n\nfunction LabelProvider({ children, ...props }: LabelProviderProps) {\n return (\n <LabelContext.Provider value={props}>{children}</LabelContext.Provider>\n );\n}\nLabelProvider.displayName = 'Label.Provider';\n\nexport function Label({ ref, ...props }: LabelProps) {\n [props, ref] = useContextProps(props, ref ?? null, LabelContext);\n\n const { children, className, isDisabled, isRequired, ...rest } = props;\n\n return (\n <AriaLabel\n {...rest}\n className={LabelStyles({ className })}\n data-disabled={isDisabled || null}\n data-required={isRequired || null}\n >\n {children}\n {!isRequired && ' (optional)'}\n </AriaLabel>\n );\n}\nLabel.displayName = 'Label';\nLabel.Provider = LabelProvider;\n"]}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import * as tailwind_variants from 'tailwind-variants';
|
2
|
+
|
3
|
+
declare const LabelStyles: tailwind_variants.TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, tailwind_variants.TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
|
4
|
+
|
5
|
+
export { LabelStyles };
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../src/components/label/styles.ts"],"names":["e"],"mappings":"sCAeE,IAAA,CAAA,CAAAA,EAAM,CAAC,CAAA,IAAA,CAAA,CAAA,eAAiB,CAAA,0BAA4B,CAAA,sBACrD,CAAA,CAAA","file":"styles.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 { tv } from '@/lib/utils';\n\nexport const LabelStyles = tv({\n base: ['text-header-s', 'enabled:fg-default-light', 'disabled:fg-disabled'],\n});\n"]}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { RefAttributes, PropsWithChildren } from 'react';
|
2
|
+
import { LabelProps as LabelProps$1 } from 'react-aria-components';
|
3
|
+
|
4
|
+
type LabelProps = LabelProps$1 & RefAttributes<HTMLLabelElement> & {
|
5
|
+
isDisabled?: boolean;
|
6
|
+
isRequired?: boolean;
|
7
|
+
};
|
8
|
+
type LabelProviderProps = PropsWithChildren<LabelProps>;
|
9
|
+
|
10
|
+
export type { LabelProps, LabelProviderProps };
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"types.js"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
-
import * as
|
2
|
+
import * as react from 'react';
|
3
3
|
import { ListBoxProps, ListBoxSectionProps } from 'react-aria-components';
|
4
4
|
import { IOptionsItem, OptionsItemProps, OptionsItem } from '../options-item/index.js';
|
5
5
|
import 'cva/types';
|
@@ -14,7 +14,7 @@ interface OptionsProps<T extends IOptionsItem> extends ListBoxProps<T> {
|
|
14
14
|
size?: OptionsItemProps<T>['size'];
|
15
15
|
type?: OptionsItemProps<T>['type'];
|
16
16
|
}
|
17
|
-
declare const OptionsContext:
|
17
|
+
declare const OptionsContext: react.Context<Pick<OptionsProps<IOptionsItem>, "size" | "type">>;
|
18
18
|
declare function Options<T extends IOptionsItem>({ children, className, description, errorMessage, label, placeholder, size, type, ...props }: OptionsProps<T>): react_jsx_runtime.JSX.Element;
|
19
19
|
declare namespace Options {
|
20
20
|
var displayName: string;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import'client-only';import {createContext}from'react';import {ListBox,ListBoxSection,Header,Collection}from'react-aria-components';import {OptionsItem}from'../options-item/index.js';import {jsx,jsxs}from'react/jsx-runtime';var I=createContext({size:"large",type:"default"});function s({children:e,className:o,description:i,errorMessage:f,label:
|
1
|
+
import'client-only';import {createContext}from'react';import {ListBox,ListBoxSection,Header,Collection}from'react-aria-components';import {OptionsItem}from'../options-item/index.js';import {jsx,jsxs}from'react/jsx-runtime';var I=createContext({size:"large",type:"default"});function s({children:e,className:o,description:i,errorMessage:f,label:u,placeholder:y,size:n,type:a,...p}){return jsx(I.Provider,{value:{size:n,type:a},children:jsx(ListBox,{className:"max-h-[200px] overflow-y-auto overflow-x-clip rounded-medium bg-surface-overlay shadow-elevation-overlay outline outline-static-light",...p,children:e})})}s.displayName="Options";s.Item=OptionsItem;function r({children:e,header:o,items:i}){return jsxs(ListBoxSection,{id:o,className:"mt-s border-default-dark border-t first:border-none",children:[jsx(Header,{className:"m-xs my-s text-default-dark text-header-xs",children:o}),jsx(Collection,{items:i,children:e})]})}r.displayName="Options.Section";s.Section=r;export{s as Options,I as OptionsContext,r as OptionsSection};//# sourceMappingURL=index.js.map
|
2
2
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/options/index.tsx"],"names":["OptionsContext","createContext","Options","children","className","description","errorMessage","label","placeholder","size","type","jsx","AriaListBox","props","OptionsItem","OptionsSection","header","items","jsxs","AriaListBoxSection","AriaHeader","AriaListBoxCollection"],"mappings":"+
|
1
|
+
{"version":3,"sources":["../../../src/components/options/index.tsx"],"names":["OptionsContext","createContext","Options","children","className","description","errorMessage","label","placeholder","size","type","jsx","AriaListBox","props","OptionsItem","OptionsSection","header","items","jsxs","AriaListBoxSection","AriaHeader","AriaListBoxCollection"],"mappings":"+NAwCaA,IAAAA,CAAiBC,CAAAA,aAE5B,CACA,KAAM,CAAA,OACN,CAAA,IAAM,CAAA,SACP,CAAA,EAEM,SAASC,CAAgC,CAC9C,CAAA,QAAAC,CAAAA,CACA,CAAA,SAAAC,CAAAA,CACA,CAAA,WAAAC,CAAAA,CACA,CAAA,YAAAC,CAAAA,CACA,MAAAC,CAAAA,CACA,CAAA,WAAAC,CAAAA,CACA,CAAA,IAAAC,CAAAA,CACA,CAAA,IAAAC,CAAAA,CACA,CAAA,GACF,CAAA,CAAoB,CAClB,CAAA,OACEC,GAACX,CAAAA,CAAe,CAAA,QAAf,CAAwB,MAAO,CAAE,CAAA,IAAAS,CAAAA,CAAM,CAAA,IAAAC,CAAK,CAAA,CAC3C,CAAA,QAAAC,CAAAA,GAACC,CAAAA,OAAA,CACC,CAAA,SAAU,CAAA,uIACT,CAAA,GAAGC,CAEH,CAAA,QAAAV,CAAAA,CACH,CAAA,CACF,CAEJ,CACAD,CAAAA,CAAQ,CAAA,WAAc,CAAA,SAEtBA,CAAAA,CAAQ,CAAA,IAAOY,CAAAA,WAOR,CAAA,SAASC,CAAuC,CACrD,CAAA,QAAAZ,CAAAA,CACA,CAAA,MAAAa,CAAAA,CACA,MAAAC,CACF,CAAA,CAA2B,CACzB,CAAA,OACEC,IAACC,CAAAA,cAAA,CACC,CAAA,EAAIH,CAAAA,CACJ,CAAA,SAAU,CAAA,qDAEV,CAAA,QAAA,CAAAL,CAAAA,GAACS,CAAAA,MAAA,CAAW,CAAA,SAAU,6CACnB,CAAA,QAAAJ,CAAAA,CACH,CAAA,CACAL,CAAAA,GAACU,CAAAA,UAAA,CAAsB,CAAA,KAAOJ,CAAAA,CAAQ,CAAA,QAAAd,CAAAA,CAAS,CAAA,CAAA,CACjD,CAEJ,CACAY,CAAAA,CAAe,CAAA,WAAc,CAAA,iBAC7Bb,EAAQ,CAAA,OAAUa,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\n'use client';\nimport 'client-only';\nimport { createContext } from 'react';\nimport {\n Header as AriaHeader,\n ListBox as AriaListBox,\n Collection as AriaListBoxCollection,\n type ListBoxProps as AriaListBoxProps,\n ListBoxSection as AriaListBoxSection,\n type ListBoxSectionProps as AriaListBoxSectionProps,\n} from 'react-aria-components';\nimport {\n type IOptionsItem,\n OptionsItem,\n type OptionsItemProps,\n} from '../options-item';\n\nexport interface OptionsProps<T extends IOptionsItem>\n extends AriaListBoxProps<T> {\n className?: string;\n description?: string;\n errorMessage?: string;\n label?: string;\n placeholder?: string;\n size?: OptionsItemProps<T>['size'];\n type?: OptionsItemProps<T>['type'];\n}\n\nexport const OptionsContext = createContext<\n Pick<OptionsProps<IOptionsItem>, 'size' | 'type'>\n>({\n size: 'large',\n type: 'default',\n});\n\nexport function Options<T extends IOptionsItem>({\n children,\n className,\n description,\n errorMessage,\n label,\n placeholder,\n size,\n type,\n ...props\n}: OptionsProps<T>) {\n return (\n <OptionsContext.Provider value={{ size, type }}>\n <AriaListBox<T>\n className='max-h-[200px] overflow-y-auto overflow-x-clip rounded-medium bg-surface-overlay shadow-elevation-overlay outline outline-static-light'\n {...props}\n >\n {children}\n </AriaListBox>\n </OptionsContext.Provider>\n );\n}\nOptions.displayName = 'Options';\n\nOptions.Item = OptionsItem;\n\ninterface OptionsSectionProps<T extends IOptionsItem>\n extends AriaListBoxSectionProps<T> {\n header?: string;\n}\n\nexport function OptionsSection<T extends IOptionsItem>({\n children,\n header,\n items,\n}: OptionsSectionProps<T>) {\n return (\n <AriaListBoxSection\n id={header}\n className='mt-s border-default-dark border-t first:border-none'\n >\n <AriaHeader className='m-xs my-s text-default-dark text-header-xs'>\n {header}\n </AriaHeader>\n <AriaListBoxCollection items={items}>{children}</AriaListBoxCollection>\n </AriaListBoxSection>\n );\n}\nOptionsSection.displayName = 'Options.Section';\nOptions.Section = OptionsSection;\n"]}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import
|
1
|
+
import {mergeProps}from'@react-aria/utils';import'client-only';import {cva}from'cva';import {useContext,useMemo}from'react';import {ListBoxItem,Text}from'react-aria-components';import {Icon}from'../icon/index.js';import {OptionsContext}from'../options/index.js';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var O=cva(["fg-default-light flex items-center gap-s p-s text-body-s ","**:data-[slot=description]:fg-default-dark **:data-[slot=description]:text-body-xs","hover:fg-inverse-light hover:**:data-[slot=description]:fg-inverse-light","focus:fg-inverse-light focus:**:data-[slot=description]:fg-inverse-light ","disabled:fg-disabled disabled:**:data-[slot=description]:fg-disabled disabled:bg-transparent","hover:bg-highlight-bold focus:bg-highlight-bold"],{variants:{type:{destructive:"hover:bg-serious-bold focus:bg-serious-bold",default:"hover:bg-highlight-bold focus:bg-highlight-bold"},size:{large:"pt-s pb-s",small:"pt-xs pb-xs"}},defaultVariants:{size:"large"}});function T({children:e,className:c,description:s,prefixIcon:i,suffixIcon:o,name:a,type:r,size:n,...f}){let p=useContext(OptionsContext)??{},{size:g,type:x}=useMemo(()=>mergeProps(p,{size:n,type:r}),[p,n,r]);return jsx(ListBoxItem,{textValue:a,...f,className:O({type:x,size:g,className:c}),children:u=>typeof e=="function"?e(u):jsxs(Fragment,{children:[i&&jsx("span",{className:"flex w-[16px] items-center",children:jsx(Icon,{children:i})}),jsxs("div",{className:"flex min-w-0 flex-auto flex-col gap-xxs",children:[jsx(Text,{className:"truncate",slot:"label",children:a}),s&&jsx(Text,{className:"truncate","data-slot":"description",slot:"description",children:s})]}),o&&jsx("span",{className:"flex w-[16px] items-center",children:jsx(Icon,{size:"small",children:o})})]})})}T.displayName="OptionsItem";export{T as OptionsItem};//# sourceMappingURL=index.js.map
|
2
2
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/options-item/index.tsx"],"names":["cva","
|
1
|
+
{"version":3,"sources":["../../../src/components/options-item/index.tsx"],"names":["cva","b","children","className","prefixIcon","suffixIcon","name","typeProp","sizeProp","useContext","OptionsContext","N","size","useMemo","v","optionsContext","AriaListBoxItem","y","optionsItemStyles","type","renderProps","jsxs","Fragment","A","jsx","t","Icon","d","m","AriaText","l","description","OptionsItem"],"mappings":"wTAyBA,IAA0BA,CAAAA,CACxBC,GACE,CAAA,CAAA,2DACA,CAAA,oFACA,CAAA,0EACA,CAAA,2EACA,CAAA,8FACA,CAAA,iDAEF,CACE,C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A,QAAAJ,CAAAA,CAACK,GAAAA,CAAAC,IAAS,WAAU,CAAA,UAAW,CAAA,IAAK,CAAA,OACjC,CAAA,QAAAxB,CACH,CAAA,CACCyB,GACCP,EAACK,GAAAA,CAAAC,IACC,CAAA,CAAA,SAAU,CAAA,UACV,CAAA,yBACA,CAAA,IAAK,CAAA,aAEJ,CAAA,QAAAC,CACH,CAAA,CAAA,CAEJ,CAAA,CACC1B,GACCmB,EAACC,GAAA,CAAA,MAAK,CAAA,CAAA,SAAU,CAAA,4BACd,CAAA,QAAAD,CAACE,IAAAC,IAAK,CAAA,CAAA,IAAK,CAAA,OAAS,CAAA,QAAAtB,CAAW,CAAA,CACjC,GAEJ,CAAA,CAGN,CAEJ,CACA2B,CAAAA,CAAY,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\n'use client';\nimport { mergeProps } from '@react-aria/utils';\nimport 'client-only';\nimport { type VariantProps, cva } from 'cva';\nimport { type ReactNode, useContext, useMemo } from 'react';\nimport {\n ListBoxItem as AriaListBoxItem,\n type ListBoxItemProps as AriaListBoxItemProps,\n Text as AriaText,\n} from 'react-aria-components';\nimport { Icon } from '../icon';\nimport { OptionsContext } from '../options';\n\nconst optionsItemStyles = cva(\n [\n 'fg-default-light flex items-center gap-s p-s 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',\n 'focus:fg-inverse-light focus:**:data-[slot=description]:fg-inverse-light ',\n 'disabled:fg-disabled disabled:**:data-[slot=description]:fg-disabled disabled:bg-transparent',\n 'hover:bg-highlight-bold focus:bg-highlight-bold',\n ],\n {\n variants: {\n type: {\n destructive: 'hover:bg-serious-bold focus:bg-serious-bold',\n default: 'hover:bg-highlight-bold focus:bg-highlight-bold',\n },\n size: {\n large: 'pt-s pb-s',\n small: 'pt-xs pb-xs',\n },\n },\n defaultVariants: {\n size: 'large',\n },\n },\n);\n\nexport interface IOptionsItem {\n children?: IOptionsItem[];\n description?: string;\n prefixIcon?: ReactNode;\n suffixIcon?: ReactNode;\n id?: string | number;\n name: string;\n}\n\nexport interface OptionsItemProps<T extends IOptionsItem>\n extends VariantProps<typeof optionsItemStyles>,\n AriaListBoxItemProps<T> {\n description?: string;\n prefixIcon?: ReactNode;\n suffixIcon?: ReactNode;\n name: string;\n}\n\nexport function OptionsItem<T extends IOptionsItem>({\n children,\n className,\n description,\n prefixIcon,\n suffixIcon,\n name,\n type: typeProp,\n size: sizeProp,\n ...props\n}: OptionsItemProps<T>) {\n const optionsContext = useContext(OptionsContext) ?? {};\n\n const { size, type } = useMemo(\n () =>\n mergeProps(optionsContext, {\n size: sizeProp,\n type: typeProp,\n }),\n [optionsContext, sizeProp, typeProp],\n );\n\n return (\n <AriaListBoxItem<T>\n textValue={name}\n {...props}\n className={optionsItemStyles({ type, size, className })}\n >\n {(renderProps) => {\n if (typeof children === 'function') {\n return children(renderProps);\n }\n\n return (\n <>\n {prefixIcon && (\n <span className='flex w-[16px] items-center'>\n <Icon>{prefixIcon}</Icon>\n </span>\n )}\n <div className='flex min-w-0 flex-auto flex-col gap-xxs'>\n <AriaText className='truncate' slot='label'>\n {name}\n </AriaText>\n {description && (\n <AriaText\n className='truncate'\n data-slot='description'\n slot='description'\n >\n {description}\n </AriaText>\n )}\n </div>\n {suffixIcon && (\n <span className='flex w-[16px] items-center'>\n <Icon size='small'>{suffixIcon}</Icon>\n </span>\n )}\n </>\n );\n }}\n </AriaListBoxItem>\n );\n}\nOptionsItem.displayName = 'OptionsItem';\n"]}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import {DialogTrigger,Pressable,Popover,Dialog,Heading}from'react-aria-components';import {PopoverStyles}from'./styles.js';import {jsx}from'react/jsx-runtime';var {content:c,body:y,title:N,footer:T}=PopoverStyles(),t=({placement:r="bottom",children:o,...p})=>jsx(DialogTrigger,{...p,children:o});t.displayName="Popover";var A=({children:r,...o})=>jsx(Pressable,{...o,children:r});t.displayName="Popover.Trigger";var
|
1
|
+
import'client-only';import {DialogTrigger,Pressable,Popover,Dialog,Heading}from'react-aria-components';import {PopoverStyles}from'./styles.js';import {jsx}from'react/jsx-runtime';var {content:c,body:y,title:N,footer:T}=PopoverStyles(),t=({placement:r="bottom",children:o,...p})=>jsx(DialogTrigger,{...p,children:o});t.displayName="Popover";var A=({children:r,...o})=>jsx(Pressable,{...o,children:r});t.displayName="Popover.Trigger";var i=({children:r,className:o,...p})=>jsx(Popover,{className:c({className:o}),...p,children:jsx(Dialog,{children:r})});i.displayName="Popover.Content";var a=({children:r,className:o,...p})=>jsx(Heading,{slot:"title",className:N({className:o}),...p,children:r});a.displayName="Popover.Title";var s=({children:r,className:o})=>jsx("div",{className:y({className:o}),children:r});s.displayName="Popover.Body";var P=({children:r,className:o})=>jsx("div",{className:T({className:o}),children:r});P.displayName="Popover.Footer";t.Title=a;t.Content=i;t.Body=s;t.Footer=P;t.Trigger=A;export{t as Popover,A as PopoverTrigger};//# sourceMappingURL=index.js.map
|
2
2
|
//# sourceMappingURL=index.js.map
|