@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/slider/index.tsx"],"names":["e","cva","layout","label","isRange","sliderValue","rangeValue","sliderDefaultValue","defaultRangeValue","defaultValue","jsxs","c","L","V","Label","jsx","a","RACSliderTrack","O","state","minValue","startPercent","index","Fragment","h","orientation","sizeInPercent","I","Tooltip","f","Text","x","RangeSlider","value","Slider","props","useContext","SliderStateContext","labelProps","useSlottedContext","LabelContext","B","F","$","NumberField","j","C"],"mappings":"+VA+BE,CAAA,CAAA,QACE,CAAQ,CACN,QAAS,OACT,CAAA,EAAQ,OAEV,CAAA,EAAA,CAAA,CAAA,WACE,CAAA,CAAA,QAAU,CAAA,yBACE,CAAA,aAGhB,CAAA,CAAA,CAAA,gBAEI,CAAA,CAAQ,CAAA,MAAA,CAAA,SACR,CAAA,wBACA,CAAA,SAAW,CAAA,sDAGX,CAAA,CAAQ,gBACR,CAAA,WAAa,CAAA,YACb,CAAA,SAAW,CAAA,gEAGH,CAAA,MAAA,CAAA,SACR,CAAA,sBACA,CAAA,SAAW,CAAA,2DAGX,CAAA,CAAQ,CAAA,MAAA,CAAA,QACR,CAAA,WAAa,CAAA,UACb,CAAA,qEAKuB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AAA,CAAA,CAAA,WACpD,CAAA,CAAA,CAAA,CAAA,CAAA,SAEF,CAAK,CAAA,CAAA,CAAAc,GAAA,CAAKe,UAAM,CAAA,KAAA,CAAA,SAA8B,CAAA,CAAA,CAAA7B,CAAAA,oBAC5C,CAAA,CAAA,CAAA,CAAA,CAAA,QAIT,CAUa8B,GAAc,CAAC,CAC1B,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,YACA,CAAAC,CAAAA,CACA,KACF,CAAA,CAAA,CAEIlB,GAACmB,CAAA,CACE,GAAGC,GAAAA,CACJ,CAAA,CAAA,CAAA,GAAA,CAAA,CAAO,OACP,CAAA,IAAA,CAAA,iBACA,CAAA,CAAA,CAAA,UAKN,CAAA,CAAA,CAAA,EAAA,SAAuB,CAAA,CAAA,CAAA,SACrB,CAAMhB,CAAAA,CAAQiB,CAAAA,CAAWC,IACnBC,CAAaC,CAAAA,UAAkBC,CAAYC,kBAAA,CACjD,CAAA,CAAA,CAAAC,iBAAA,CAAAC,YAAA,CACE5B,8BACU,CAAA,CAAA,QAA2BO,IACjCP,CAAAA,CAAC6B,CAAAA,CAAA,CAEC,GAAA5B,GAAA,CAAA6B,WAAA,CAAA,CAAA,iBACA,CAAA,CAAA,EAAA,EAAOZ,CACP,KAAA,CAAA,CAAA,CAAA,QAAuB,CAAA,CAAA,EAAA,CAAA,CAAA,2BAGrB,CAAAjB,GAAA,CAAA8B,KAAA,CAAA,CAAA,SACE,CAAAjC,EAAA,CAAA,+HAP+B,MAAQ,CAAA,CAAA,KAW7C,CACD,KAGP,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 { cn } from '@/lib/utils';\nimport { cva } from 'cva';\nimport { useContext } from 'react';\nimport {\n Input,\n Label,\n LabelContext,\n NumberField,\n Slider as RACSlider,\n type SliderProps as RACSliderProps,\n SliderTrack as RACSliderTrack,\n SliderStateContext,\n SliderThumb,\n Text,\n useSlottedContext,\n} from 'react-aria-components';\nimport { Tooltip } from '../tooltip';\n\nconst sliderVariants = cva('grid gap-s', {\n variants: {\n layout: {\n stacked: '',\n inline: '',\n },\n orientation: {\n vertical: 'h-full w-fit',\n horizontal: 'h-xl w-full',\n },\n },\n compoundVariants: [\n {\n layout: 'stacked',\n orientation: 'horizontal',\n className: 'grid-cols-[auto_1fr_auto] grid-rows-[auto_auto_auto]',\n },\n {\n layout: 'inline',\n orientation: 'horizontal',\n className: 'grid-cols-[auto_auto_1fr_auto_auto] grid-rows-1 items-center',\n },\n {\n layout: 'stacked',\n orientation: 'vertical',\n className: 'grid-cols-[auto_auto_auto] grid-rows-[auto_auto_1fr_auto]',\n },\n {\n layout: 'inline',\n orientation: 'vertical',\n className: 'grid-cols-[auto_1fr_auto] grid-rows-[auto_auto_1fr_auto]',\n },\n ],\n});\n\nconst minValueVariants = cva('font-display text-body-m text-default-dark', {\n variants: {\n orientation: {\n horizontal: '',\n vertical: 'col-start-1 row-start-4',\n },\n layout: {\n inline: '',\n stacked: '',\n },\n },\n compoundVariants: [\n {\n layout: 'stacked',\n orientation: 'horizontal',\n className: 'col-start-1 row-start-3',\n },\n {\n layout: 'inline',\n orientation: 'horizontal',\n className: 'order-2',\n },\n {\n layout: 'stacked',\n orientation: 'vertical',\n className: 'self-end justify-self-end',\n },\n {\n layout: 'inline',\n orientation: 'vertical',\n className: 'justify-self-center',\n },\n ],\n});\n\nconst maxValueVariants = cva('font-display text-body-m text-default-dark', {\n variants: {\n orientation: {\n horizontal: '',\n vertical: 'col-start-1 row-start-2',\n },\n layout: {\n inline: '',\n stacked: '',\n },\n },\n compoundVariants: [\n {\n layout: 'stacked',\n orientation: 'horizontal',\n className: 'col-start-3 row-start-3 justify-self-end',\n },\n {\n layout: 'inline',\n orientation: 'horizontal',\n className: 'order-4',\n },\n {\n layout: 'stacked',\n orientation: 'vertical',\n className: 'justify-self-end',\n },\n ],\n});\n\nconst sliderTrackVariants = cva('relative', {\n variants: {\n orientation: {\n horizontal: 'h-s w-full',\n vertical: 'h-full w-s',\n },\n layout: {\n inline: '',\n stacked: '',\n },\n },\n compoundVariants: [\n {\n orientation: 'horizontal',\n layout: 'stacked',\n className: 'col-span-3 row-start-2',\n },\n {\n orientation: 'horizontal',\n layout: 'inline',\n className: 'order-3',\n },\n {\n orientation: 'vertical',\n layout: 'stacked',\n className: 'col-start-2 row-span-3 row-start-2',\n },\n {\n orientation: 'vertical',\n layout: 'inline',\n className: 'col-start-1 row-start-3 justify-self-center',\n },\n ],\n});\n\nconst inputVariants = cva('flex gap-s', {\n variants: {\n orientation: {\n horizontal: 'flex-row',\n vertical: 'flex-col-reverse',\n },\n layout: {\n inline: 'order-5',\n stacked: 'col-start-3 row-start-1',\n },\n },\n compoundVariants: [\n {\n layout: 'inline',\n orientation: 'horizontal',\n className: 'order-5',\n },\n {\n layout: 'inline',\n orientation: 'vertical',\n className: 'col-span-3 col-start-1',\n },\n {\n layout: 'stacked',\n orientation: 'vertical',\n className: 'row-start-4',\n },\n ],\n});\n\nconst labelVariants = cva('text-default-light', {\n variants: {\n orientation: {\n horizontal: '',\n vertical: '',\n },\n layout: {\n inline: 'order-1',\n stacked: 'col-start-1',\n },\n },\n compoundVariants: [\n {\n layout: 'stacked',\n orientation: 'vertical',\n className: 'col-span-2',\n },\n {\n layout: 'inline',\n orientation: 'vertical',\n className: 'col-span-3',\n },\n ],\n});\n\nconst sliderThumbVariants = cva(\n 'h-m w-m rounded-full bg-highlight-bold outline-highlight-bold/40 hover:outline-4 focus:outline-4',\n {\n variants: {\n orientation: {\n horizontal: 'translate-y-[50%]',\n vertical: 'translate-x-[40%]',\n },\n },\n },\n);\n\nconst sliderTrackBackgroundVariants = cva(\n 'absolute rounded-full bg-default-light/40',\n {\n variants: {\n orientation: {\n horizontal: 'top-[50%] h-xxs w-full translate-y-[50%]',\n vertical: 'left-[50%] h-full w-xxs ',\n },\n },\n },\n);\n\nconst sliderTrackValueVariants = cva('absolute rounded-full bg-highlight', {\n variants: {\n orientation: {\n horizontal: 'top-1/2 h-xxs translate-y-1/2',\n vertical: 'left-1/2 w-xxs',\n },\n },\n});\n\nexport interface SliderProps\n extends Omit<\n RACSliderProps,\n 'value' | 'defaultValue' | 'showOutput' | 'slot' | 'style' | 'formatOptions'\n > {\n className?: string;\n showInput?: boolean;\n showLabel?: boolean;\n layout: 'stacked' | 'inline';\n value?: number;\n defaultValue?: number;\n rangeValue?: [number, number];\n defaultRangeValue?: [number, number];\n isRange?: boolean;\n label: string;\n}\n\nexport const Slider = ({\n children,\n className,\n showInput = false,\n showLabel = true,\n layout = 'stacked',\n value,\n defaultValue,\n label,\n defaultRangeValue,\n rangeValue,\n minValue = 0,\n maxValue = 100,\n isRange = false,\n orientation = 'horizontal',\n ...props\n}: SliderProps) => {\n const sliderValue = isRange ? rangeValue : value;\n const sliderDefaultValue = isRange ? defaultRangeValue : defaultValue;\n\n return (\n <RACSlider\n className={cn(sliderVariants({ orientation, layout }))}\n minValue={minValue}\n maxValue={maxValue}\n orientation={orientation}\n value={sliderValue}\n defaultValue={sliderDefaultValue}\n {...props}\n >\n {showLabel && (\n <Label className={labelVariants({ orientation, layout })}>\n {label}\n </Label>\n )}\n {showInput && (\n <div className={inputVariants({ orientation, layout })}>\n <SliderInput />\n </div>\n )}\n <RACSliderTrack className={sliderTrackVariants({ layout, orientation })}>\n {({ state }) => {\n const minValue = state.getThumbPercent(0);\n const maxValue = state.getThumbPercent(1) || minValue;\n const sizeInPercent = `${(state.values.length === 2 ? maxValue - minValue : minValue) * 100}%`;\n const startPercent =\n state.values.length === 2 ? `${Math.floor(minValue * 100)}%` : '0';\n return (\n <>\n <div className={sliderTrackBackgroundVariants({ orientation })} />\n {state.values.map((_, index) => {\n return (\n <>\n <div\n key={`slider-${index === 0 ? 'min' : 'max'}`}\n className={sliderTrackValueVariants({ orientation })}\n style={\n orientation === 'horizontal'\n ? {\n left: startPercent,\n width: sizeInPercent,\n }\n : {\n bottom: startPercent,\n height: sizeInPercent,\n }\n }\n />\n\n <SliderThumb\n key={`slider-thumb-${index === 0 ? 'min' : 'max'}`}\n index={index}\n className={sliderThumbVariants({ orientation })}\n >\n {!showInput && (\n <Tooltip>\n <Tooltip.Trigger>\n <div className='size-full' />\n </Tooltip.Trigger>\n <Tooltip.Body placement='top'>\n {state.getThumbValue(index)}\n </Tooltip.Body>\n </Tooltip>\n )}\n </SliderThumb>\n </>\n );\n })}\n </>\n );\n }}\n </RACSliderTrack>\n <Text slot='min' className={minValueVariants({ layout, orientation })}>\n {minValue}\n </Text>\n <Text slot='max' className={maxValueVariants({ layout, orientation })}>\n {maxValue}\n </Text>\n </RACSlider>\n );\n};\n\nexport type RangeSliderProps = Omit<\n SliderProps,\n 'isRange' | 'defaultRangeValue' | 'rangeValue' | 'defaultValue' | 'value'\n> & {\n defaultValue: SliderProps['defaultRangeValue'];\n value: SliderProps['rangeValue'];\n};\n\nexport const RangeSlider = ({\n defaultValue,\n value,\n ...props\n}: RangeSliderProps) => {\n return (\n <Slider\n {...props}\n isRange\n defaultRangeValue={defaultValue}\n rangeValue={value}\n />\n );\n};\n\nfunction SliderInput({ className }: { className?: string }) {\n const state = useContext(SliderStateContext);\n const labelProps = useSlottedContext(LabelContext);\n return (\n <>\n {state?.values.map((value: number, index: number) => (\n <NumberField\n key={`number-field-${index === 0 ? 'min' : 'max'}`}\n aria-labelledby={labelProps?.id}\n value={value}\n onChange={(v) => state.setThumbValue(0, v)}\n >\n <Input\n className={cn(\n 'w-[50px] rounded-medium border border-interactive px-s py-xs font-display text-body-m text-default-light',\n className,\n )}\n />\n </NumberField>\n ))}\n </>\n );\n}\n"]}
|
1
|
+
{"version":3,"sources":["../../../src/components/slider/index.tsx"],"names":["e","cva","layout","value","label","isRange","sliderValue","rangeValue","sliderDefaultValue","defaultRangeValue","defaultValue","jsxs","c","L","Label","a","A","jsx","RACSliderTrack","O","state","minValue","startPercent","index","Fragment","h","orientation","sizeInPercent","I","Tooltip","f","Text","x","RangeSlider","Slider","props","useContext","SliderStateContext","labelProps","useSlottedContext","LabelContext","B","F","$","NumberField","j","C","V"],"mappings":"6VAgC2B,IAAA,CAAA,CAAAA,GAAA,CAAA,YACzB,CAAA,CAAA,SACU,CACN,MAAA,CAAA,CAAS,OACT,CAAA,EAAQ,CAAA,MAEV,CAAA,EAAA,CAAA,CAAA,qBACY,CAAA,cACV,CAAA,wBAGJ,CAAA,CAAA,CAAA,gBAEI,CAAA,CAAQ,iBACR,CAAA,WAAa,CAAA,sBACF,CAAA,sDAGX,CAAA,CAAQ,CAAA,MAAA,CAAA,QACR,CAAA,WAAa,CAAA,YACb,CAAA,SAAW,CAAA,8DAGX,CAAA,CAAQ,iBACR,CAAA,WAAa,CAAA,oBACF,CAAA,2DAGX,CAAA,CAAQ,CAAA,MAAA,CAAA,QACR,CAAA,sBACA,CAAA,SAAW,CAAA,0DAKQC,CAAI,sDAC3B,CAAA,CAAA,QACE,CAAA,CAAA,uBAEE,CAAA,EAAA,CAAA,kCAEF,CAAQ,CACN,MAAA,CAAQ,CAAA,MACR,CAAA,EAAA,CAAS,+BAKD,CAAA,MAAA,CAAA,SACR,CAAA,wBACA,CAAA,SAAW,CAAA,yBAGX,CAAA,CAAQ,gBACR,CAAA,WAAa,CAAA,sBACF,CAAA,SAGX,CAAA,CAAQ,CAAA,MAAA,CAAA,SACR,CAAA,sBACA,CAAA,SAAW,CAAA,2BAGX,CAAA,CAAQ,gBACR,CAAA,WAAa,CAAA,oBACF,CAAA,qBAKQA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAAD,G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AAA,CACJ,CAAA,CAAA,CAAA,GAAA,CAAA,CAAO,OACP,CAAA,IAAA,CAAA,iBACA,CAAA,CAAA,CAAA,UAKN,CAAA,CAAA,CAAA,EAAA,SAAuB,CAAA,CAAA,CAAA,SACrB,CAAMf,CAAAA,CAAQgB,CAAAA,CAAWC,IACnBC,CAAaC,CAAAA,UAAkBC,CAAYC,kBAAA,CACjD,CAAA,CAAA,CAAAC,iBAAA,CAAAC,YAAA,CACE1B,8BACU,CAAA,CAAA,QAA2BM,IACjCN,CAAAA,CAAC2B,CAAAA,CAAA,CAEC,GAAA7B,GAAA,CAAA8B,WAAA,CAAA,CAAA,iBACA,CAAA,CAAA,EAAA,EAAO1C,CACP,KAAA,CAAA,CAAA,CAAA,QAAuB,CAAA,CAAA,EAAA,CAAA,CAAA,2BAGrB,CAAAY,GAAA,CAAA+B,KAAA,CAAA,CAAA,SACE,CAAAC,EAAA,CAAA,+HAP+B,MAAQ,CAAA,CAAA,KAW7C,CACD,KAGP,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 'client-only';\nimport { cva } from 'cva';\nimport { useContext } from 'react';\nimport {\n Input,\n Label,\n LabelContext,\n NumberField,\n Slider as RACSlider,\n type SliderProps as RACSliderProps,\n SliderTrack as RACSliderTrack,\n SliderStateContext,\n SliderThumb,\n Text,\n useSlottedContext,\n} from 'react-aria-components';\nimport { Tooltip } from '../tooltip';\n\nconst sliderVariants = cva('grid gap-s', {\n variants: {\n layout: {\n stacked: '',\n inline: '',\n },\n orientation: {\n vertical: 'h-full w-fit',\n horizontal: 'h-xl w-full',\n },\n },\n compoundVariants: [\n {\n layout: 'stacked',\n orientation: 'horizontal',\n className: 'grid-cols-[auto_1fr_auto] grid-rows-[auto_auto_auto]',\n },\n {\n layout: 'inline',\n orientation: 'horizontal',\n className: 'grid-cols-[auto_auto_1fr_auto_auto] grid-rows-1 items-center',\n },\n {\n layout: 'stacked',\n orientation: 'vertical',\n className: 'grid-cols-[auto_auto_auto] grid-rows-[auto_auto_1fr_auto]',\n },\n {\n layout: 'inline',\n orientation: 'vertical',\n className: 'grid-cols-[auto_1fr_auto] grid-rows-[auto_auto_1fr_auto]',\n },\n ],\n});\n\nconst minValueVariants = cva('font-display text-body-m text-default-dark', {\n variants: {\n orientation: {\n horizontal: '',\n vertical: 'col-start-1 row-start-4',\n },\n layout: {\n inline: '',\n stacked: '',\n },\n },\n compoundVariants: [\n {\n layout: 'stacked',\n orientation: 'horizontal',\n className: 'col-start-1 row-start-3',\n },\n {\n layout: 'inline',\n orientation: 'horizontal',\n className: 'order-2',\n },\n {\n layout: 'stacked',\n orientation: 'vertical',\n className: 'self-end justify-self-end',\n },\n {\n layout: 'inline',\n orientation: 'vertical',\n className: 'justify-self-center',\n },\n ],\n});\n\nconst maxValueVariants = cva('font-display text-body-m text-default-dark', {\n variants: {\n orientation: {\n horizontal: '',\n vertical: 'col-start-1 row-start-2',\n },\n layout: {\n inline: '',\n stacked: '',\n },\n },\n compoundVariants: [\n {\n layout: 'stacked',\n orientation: 'horizontal',\n className: 'col-start-3 row-start-3 justify-self-end',\n },\n {\n layout: 'inline',\n orientation: 'horizontal',\n className: 'order-4',\n },\n {\n layout: 'stacked',\n orientation: 'vertical',\n className: 'justify-self-end',\n },\n ],\n});\n\nconst sliderTrackVariants = cva('relative', {\n variants: {\n orientation: {\n horizontal: 'h-s w-full',\n vertical: 'h-full w-s',\n },\n layout: {\n inline: '',\n stacked: '',\n },\n },\n compoundVariants: [\n {\n orientation: 'horizontal',\n layout: 'stacked',\n className: 'col-span-3 row-start-2',\n },\n {\n orientation: 'horizontal',\n layout: 'inline',\n className: 'order-3',\n },\n {\n orientation: 'vertical',\n layout: 'stacked',\n className: 'col-start-2 row-span-3 row-start-2',\n },\n {\n orientation: 'vertical',\n layout: 'inline',\n className: 'col-start-1 row-start-3 justify-self-center',\n },\n ],\n});\n\nconst inputVariants = cva('flex gap-s', {\n variants: {\n orientation: {\n horizontal: 'flex-row',\n vertical: 'flex-col-reverse',\n },\n layout: {\n inline: 'order-5',\n stacked: 'col-start-3 row-start-1',\n },\n },\n compoundVariants: [\n {\n layout: 'inline',\n orientation: 'horizontal',\n className: 'order-5',\n },\n {\n layout: 'inline',\n orientation: 'vertical',\n className: 'col-span-3 col-start-1',\n },\n {\n layout: 'stacked',\n orientation: 'vertical',\n className: 'row-start-4',\n },\n ],\n});\n\nconst labelVariants = cva('text-default-light', {\n variants: {\n orientation: {\n horizontal: '',\n vertical: '',\n },\n layout: {\n inline: 'order-1',\n stacked: 'col-start-1',\n },\n },\n compoundVariants: [\n {\n layout: 'stacked',\n orientation: 'vertical',\n className: 'col-span-2',\n },\n {\n layout: 'inline',\n orientation: 'vertical',\n className: 'col-span-3',\n },\n ],\n});\n\nconst sliderThumbVariants = cva(\n 'h-m w-m rounded-full bg-highlight-bold outline-highlight-bold/40 hover:outline-4 focus:outline-4',\n {\n variants: {\n orientation: {\n horizontal: 'translate-y-[50%]',\n vertical: 'translate-x-[40%]',\n },\n },\n },\n);\n\nconst sliderTrackBackgroundVariants = cva(\n 'absolute rounded-full bg-default-light/40',\n {\n variants: {\n orientation: {\n horizontal: 'top-[50%] h-xxs w-full translate-y-[50%]',\n vertical: 'left-[50%] h-full w-xxs ',\n },\n },\n },\n);\n\nconst sliderTrackValueVariants = cva('absolute rounded-full bg-highlight', {\n variants: {\n orientation: {\n horizontal: 'top-1/2 h-xxs translate-y-1/2',\n vertical: 'left-1/2 w-xxs',\n },\n },\n});\n\nexport interface SliderProps\n extends Omit<\n RACSliderProps,\n 'value' | 'defaultValue' | 'showOutput' | 'slot' | 'style' | 'formatOptions'\n > {\n className?: string;\n showInput?: boolean;\n showLabel?: boolean;\n layout: 'stacked' | 'inline';\n value?: number;\n defaultValue?: number;\n rangeValue?: [number, number];\n defaultRangeValue?: [number, number];\n isRange?: boolean;\n label: string;\n}\n\nexport const Slider = ({\n children,\n className,\n showInput = false,\n showLabel = true,\n layout = 'stacked',\n value,\n defaultValue,\n label,\n defaultRangeValue,\n rangeValue,\n minValue = 0,\n maxValue = 100,\n isRange = false,\n orientation = 'horizontal',\n ...props\n}: SliderProps) => {\n const sliderValue = isRange ? rangeValue : value;\n const sliderDefaultValue = isRange ? defaultRangeValue : defaultValue;\n\n return (\n <RACSlider\n className={cn(sliderVariants({ orientation, layout }))}\n minValue={minValue}\n maxValue={maxValue}\n orientation={orientation}\n value={sliderValue}\n defaultValue={sliderDefaultValue}\n {...props}\n >\n {showLabel && (\n <Label className={labelVariants({ orientation, layout })}>\n {label}\n </Label>\n )}\n {showInput && (\n <div className={inputVariants({ orientation, layout })}>\n <SliderInput />\n </div>\n )}\n <RACSliderTrack className={sliderTrackVariants({ layout, orientation })}>\n {({ state }) => {\n const minValue = state.getThumbPercent(0);\n const maxValue = state.getThumbPercent(1) || minValue;\n const sizeInPercent = `${(state.values.length === 2 ? maxValue - minValue : minValue) * 100}%`;\n const startPercent =\n state.values.length === 2 ? `${Math.floor(minValue * 100)}%` : '0';\n return (\n <>\n <div className={sliderTrackBackgroundVariants({ orientation })} />\n {state.values.map((_, index) => {\n return (\n <>\n <div\n key={`slider-${index === 0 ? 'min' : 'max'}`}\n className={sliderTrackValueVariants({ orientation })}\n style={\n orientation === 'horizontal'\n ? {\n left: startPercent,\n width: sizeInPercent,\n }\n : {\n bottom: startPercent,\n height: sizeInPercent,\n }\n }\n />\n\n <SliderThumb\n key={`slider-thumb-${index === 0 ? 'min' : 'max'}`}\n index={index}\n className={sliderThumbVariants({ orientation })}\n >\n {!showInput && (\n <Tooltip>\n <Tooltip.Trigger>\n <div className='size-full' />\n </Tooltip.Trigger>\n <Tooltip.Body placement='top'>\n {state.getThumbValue(index)}\n </Tooltip.Body>\n </Tooltip>\n )}\n </SliderThumb>\n </>\n );\n })}\n </>\n );\n }}\n </RACSliderTrack>\n <Text slot='min' className={minValueVariants({ layout, orientation })}>\n {minValue}\n </Text>\n <Text slot='max' className={maxValueVariants({ layout, orientation })}>\n {maxValue}\n </Text>\n </RACSlider>\n );\n};\n\nexport type RangeSliderProps = Omit<\n SliderProps,\n 'isRange' | 'defaultRangeValue' | 'rangeValue' | 'defaultValue' | 'value'\n> & {\n defaultValue: SliderProps['defaultRangeValue'];\n value: SliderProps['rangeValue'];\n};\n\nexport const RangeSlider = ({\n defaultValue,\n value,\n ...props\n}: RangeSliderProps) => {\n return (\n <Slider\n {...props}\n isRange\n defaultRangeValue={defaultValue}\n rangeValue={value}\n />\n );\n};\n\nfunction SliderInput({ className }: { className?: string }) {\n const state = useContext(SliderStateContext);\n const labelProps = useSlottedContext(LabelContext);\n return (\n <>\n {state?.values.map((value: number, index: number) => (\n <NumberField\n key={`number-field-${index === 0 ? 'min' : 'max'}`}\n aria-labelledby={labelProps?.id}\n value={value}\n onChange={(v) => state.setThumbValue(0, v)}\n >\n <Input\n className={cn(\n 'w-[50px] rounded-medium border border-interactive px-s py-xs font-display text-body-m text-default-light',\n className,\n )}\n />\n </NumberField>\n ))}\n </>\n );\n}\n"]}
|
@@ -1,14 +1,17 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
-
import
|
3
|
-
import {
|
2
|
+
import * as react from 'react';
|
3
|
+
import { ContextValue } from 'react-aria-components';
|
4
|
+
import { SwitchProps, SwitchProviderProps } from './types.js';
|
4
5
|
|
5
|
-
|
6
|
-
|
6
|
+
declare const SwitchContext: react.Context<ContextValue<SwitchProps, HTMLLabelElement>>;
|
7
|
+
declare function SwitchProvider({ children, ...props }: SwitchProviderProps): react_jsx_runtime.JSX.Element;
|
8
|
+
declare namespace SwitchProvider {
|
9
|
+
var displayName: string;
|
7
10
|
}
|
8
|
-
declare function Switch({
|
11
|
+
declare function Switch({ ref, ...props }: SwitchProps): react_jsx_runtime.JSX.Element;
|
9
12
|
declare namespace Switch {
|
10
13
|
var displayName: string;
|
11
|
-
var
|
14
|
+
var Provider: typeof SwitchProvider;
|
12
15
|
}
|
13
16
|
|
14
|
-
export { Switch,
|
17
|
+
export { Switch, SwitchContext };
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import
|
1
|
+
import'client-only';import {createContext}from'react';import {useContextProps,Switch,composeRenderProps}from'react-aria-components';import {SwitchStyles}from'./styles.js';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var {switch:P,control:d,label:u}=SwitchStyles(),c=createContext(null);function a({children:t,...e}){return jsx(c.Provider,{value:e,children:t})}a.displayName="Switch.Provider";function l({ref:t,...e}){[e,t]=useContextProps(e,t??null,c);let{children:n,classNames:s,...m}=e;return jsx(Switch,{...m,ref:t,className:composeRenderProps(s?.switch,o=>P({className:o})),children:composeRenderProps(n,o=>jsxs(Fragment,{children:[jsx("span",{className:d({className:s?.control})}),o&&jsx("span",{className:u({className:s?.label}),children:o})]}))})}l.displayName="Switch";l.Provider=a;export{l as Switch,c as SwitchContext};//# sourceMappingURL=index.js.map
|
2
2
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/switch/index.tsx"],"names":["
|
1
|
+
{"version":3,"sources":["../../../src/components/switch/index.tsx"],"names":["switchClassNames","control","label","SwitchStyles","SwitchContext","createContext","SwitchProvider","children","jsx","props","Switch","ref","useContextProps","classNames","AriaSwitch","composeRenderProps","className","jsxs","Fragment"],"mappings":"6NAyBM,IAAE,CAAA,MAAQA,CAAAA,CAAkB,QAAAC,CAAAA,CAAS,CAAA,KAAAC,CAAM,CAAA,CAAIC,aAAa,EAErD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* 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 Switch as AriaSwitch,\n type ContextValue,\n composeRenderProps,\n useContextProps,\n} from 'react-aria-components';\nimport { SwitchStyles } from './styles';\nimport type { SwitchProps, SwitchProviderProps } from './types';\n\n// \"switch\" is a reserved term in JS\nconst { switch: switchClassNames, control, label } = SwitchStyles();\n\nexport const SwitchContext =\n createContext<ContextValue<SwitchProps, HTMLLabelElement>>(null);\n\nfunction SwitchProvider({ children, ...props }: SwitchProviderProps) {\n return (\n <SwitchContext.Provider value={props}>{children}</SwitchContext.Provider>\n );\n}\nSwitchProvider.displayName = 'Switch.Provider';\n\nexport function Switch({ ref, ...props }: SwitchProps) {\n [props, ref] = useContextProps(props, ref ?? null, SwitchContext);\n\n const { children, classNames, ...rest } = props;\n\n return (\n <AriaSwitch\n {...rest}\n ref={ref}\n className={composeRenderProps(classNames?.switch, (className) =>\n switchClassNames({ className }),\n )}\n >\n {composeRenderProps(children, (children) => (\n <>\n <span className={control({ className: classNames?.control })} />\n {children && (\n <span className={label({ className: classNames?.label })}>\n {children}\n </span>\n )}\n </>\n ))}\n </AriaSwitch>\n );\n}\nSwitch.displayName = 'Switch';\nSwitch.Provider = SwitchProvider;\n"]}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import * as tailwind_variants from 'tailwind-variants';
|
2
|
+
|
3
|
+
declare const SwitchStyles: tailwind_variants.TVReturnType<{
|
4
|
+
[key: string]: {
|
5
|
+
[key: string]: tailwind_variants.ClassValue | {
|
6
|
+
switch?: tailwind_variants.ClassValue;
|
7
|
+
label?: tailwind_variants.ClassValue;
|
8
|
+
control?: tailwind_variants.ClassValue;
|
9
|
+
};
|
10
|
+
};
|
11
|
+
} | {
|
12
|
+
[x: string]: {
|
13
|
+
[x: string]: tailwind_variants.ClassValue | {
|
14
|
+
switch?: tailwind_variants.ClassValue;
|
15
|
+
label?: tailwind_variants.ClassValue;
|
16
|
+
control?: tailwind_variants.ClassValue;
|
17
|
+
};
|
18
|
+
};
|
19
|
+
} | {}, {
|
20
|
+
switch: string;
|
21
|
+
control: string[];
|
22
|
+
label: string[];
|
23
|
+
}, undefined, {
|
24
|
+
[key: string]: {
|
25
|
+
[key: string]: tailwind_variants.ClassValue | {
|
26
|
+
switch?: tailwind_variants.ClassValue;
|
27
|
+
label?: tailwind_variants.ClassValue;
|
28
|
+
control?: tailwind_variants.ClassValue;
|
29
|
+
};
|
30
|
+
};
|
31
|
+
} | {}, {
|
32
|
+
switch: string;
|
33
|
+
control: string[];
|
34
|
+
label: string[];
|
35
|
+
}, tailwind_variants.TVReturnType<unknown, {
|
36
|
+
switch: string;
|
37
|
+
control: string[];
|
38
|
+
label: string[];
|
39
|
+
}, undefined, unknown, unknown, undefined>>;
|
40
|
+
|
41
|
+
export { SwitchStyles };
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import {tv}from'./../../lib/utils.js';var o=tv({slots:{switch:"group flex cursor-pointer items-center gap-s disabled:cursor-not-allowed",control:["flex rounded-round bg-transparent p-xxs outline outline-interactive before:mr-l before:block before:size-m before:rounded-full before:bg-default-dark","group-enabled:group-focus:bg-interactive-hover-dark group-enabled:group-focus:outline-interactive-hover group-enabled:group-focus:before:bg-interactive-hover","group-enabled:group-hover:bg-interactive-hover-dark group-enabled:group-hover:outline-interactive-hover group-enabled:group-hover:before:bg-interactive-hover","group-enabled:group-selected:outline-highlight group-selected:before:mr-0 group-selected:before:ml-l group-enabled:group-selected:before:bg-highlight","group-enabled:group-selected:group-focus:bg-highlight-subtle group-enabled:group-selected:group-focus:outline-interactive-hover group-enabled:group-selected:group-focus:before:bg-highlight","group-enabled:group-selected:group-hover:bg-highlight-subtle group-enabled:group-selected:group-hover:outline-highlight group-enabled:group-selected:group-hover:before:bg-highlight","group-disabled:bg-interactive-disabled group-disabled:outline-interactive-disabled group-disabled:before:bg-disabled"],label:["text-body-s text-interactive-default","group-disabled:text-interactive-disabled"]}});export{o as SwitchStyles};//# sourceMappingURL=styles.js.map
|
2
|
+
//# sourceMappingURL=styles.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../src/components/switch/styles.ts"],"names":["e"],"mappings":"sCAeE,IAAA,CAAA,CAAAA,EAAA,CAAO,CACL,KAAA,CAAA,CACE,MAAA,CAAA,0EACF,CAAA,OACE,CAAA,CAAA,uJACA,CAAA,+JACA,CAAA,+JACA,CAAA,uJACA,CAAA,8LACA,CAAA,sLACA,CAAA,sHAEF,CAAO,CACL,KAAA,CAAA,CAAA,sCACA,CAAA,0CAGL,CAAA,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 SwitchStyles = tv({\n slots: {\n switch:\n 'group flex cursor-pointer items-center gap-s disabled:cursor-not-allowed',\n control: [\n 'flex rounded-round bg-transparent p-xxs outline outline-interactive before:mr-l before:block before:size-m before:rounded-full before:bg-default-dark',\n 'group-enabled:group-focus:bg-interactive-hover-dark group-enabled:group-focus:outline-interactive-hover group-enabled:group-focus:before:bg-interactive-hover',\n 'group-enabled:group-hover:bg-interactive-hover-dark group-enabled:group-hover:outline-interactive-hover group-enabled:group-hover:before:bg-interactive-hover',\n 'group-enabled:group-selected:outline-highlight group-selected:before:mr-0 group-selected:before:ml-l group-enabled:group-selected:before:bg-highlight',\n 'group-enabled:group-selected:group-focus:bg-highlight-subtle group-enabled:group-selected:group-focus:outline-interactive-hover group-enabled:group-selected:group-focus:before:bg-highlight',\n 'group-enabled:group-selected:group-hover:bg-highlight-subtle group-enabled:group-selected:group-hover:outline-highlight group-enabled:group-selected:group-hover:before:bg-highlight',\n 'group-disabled:bg-interactive-disabled group-disabled:outline-interactive-disabled group-disabled:before:bg-disabled',\n ],\n label: [\n 'text-body-s text-interactive-default',\n 'group-disabled:text-interactive-disabled',\n ],\n },\n});\n"]}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { RefAttributes, PropsWithChildren } from 'react';
|
2
|
+
import { SwitchProps as SwitchProps$1 } from 'react-aria-components';
|
3
|
+
|
4
|
+
type SwitchProps = Omit<SwitchProps$1, 'className'> & RefAttributes<HTMLLabelElement> & {
|
5
|
+
classNames?: {
|
6
|
+
switch?: SwitchProps$1['className'];
|
7
|
+
control?: string;
|
8
|
+
label?: string;
|
9
|
+
};
|
10
|
+
};
|
11
|
+
type SwitchProviderProps = PropsWithChildren<SwitchProps>;
|
12
|
+
|
13
|
+
export type { SwitchProps, SwitchProviderProps };
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"types.js"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import {containsExactChildren}from'./../../lib/react.js';import {cn}from'./../../lib/utils.js';import {cva}from'cva';import {Tabs,TabList,Tab,TabPanel}from'react-aria-components';import {jsx}from'react/jsx-runtime';var s=({children:
|
1
|
+
import {containsExactChildren}from'./../../lib/react.js';import {cn}from'./../../lib/utils.js';import'client-only';import {cva}from'cva';import {Tabs,TabList,Tab,TabPanel}from'react-aria-components';import {jsx}from'react/jsx-runtime';var s=({children:a,className:e,orientation:r="horizontal",isDisabled:t=false,...o})=>(containsExactChildren({children:a,componentName:s.displayName,restrictions:{[n.displayName]:{min:1,max:1}}}),jsx(Tabs,{orientation:r,isDisabled:t,className:cn("group flex w-content flex-row orientation-horizontal:flex-col",e),...o,children:a}));s.displayName="Tabs";var x=cva("flex orientation-horizontal:flex-row flex-col",{variants:{variant:{icons:"[&>*]:p-xs orientation-horizontal:[&>*]:pr-s orientation-horizontal:[&>*]:pl-s [&>*]:leading-[0]",default:"[&>*]:p-s [&>*]:text-header-m"},drawer:{left:"orientation-vertical:gap-xs rounded-r-large bg-surface-default p-s",right:"orientation-vertical:gap-xs rounded-l-large bg-surface-default p-s",top:"orientation-vertical:gap-xs rounded-b-large bg-surface-default p-s",bottom:"orientation-vertical:gap-xs rounded-t-large bg-surface-default p-s"}}}),n=({children:a,className:e,variant:r="default",drawer:t=void 0,...o})=>(containsExactChildren({children:a,componentName:n.displayName,restrictions:{[d.displayName]:{min:1}}}),jsx(TabList,{className:cn(x({variant:r,drawer:t}),e),...o,children:a}));n.displayName="Tabs.List";s.List=n;var z=cn("fg-default-dark cursor-pointer p-s outline-none","rounded-medium group-orientation-horizontal:rounded-small group-orientation-horizontal:rounded-b-none","group-orientation-horizontal:border-static-light group-orientation-horizontal:border-b","group-orientation-vertical:border group-orientation-vertical:border-transparent"),N=cva(z,{variants:{isSelected:{true:"fg-highlight bg-highlight-subtle group-orientation-horizontal:border-highlight"},isHovered:{true:"fg-default-light group-orientation-horizontal:border-interactive-hover"},isFocused:{true:"fg-default-light group-orientation-horizontal:border-interactive-hover"},isDisabled:{true:"fg-disabled cursor-not-allowed group-orientation-horizontal:border-interactive-disabled"}},compoundVariants:[{isSelected:true,isHovered:true,className:"fg-highlight group-orientation-horizontal:border-highlight"},{isSelected:true,isFocused:true,className:"fg-highlight group-orientation-horizontal:border-interactive-hover group-orientation-vertical:border-interactive-hover"},{isDisabled:true,isSelected:true,className:"fg-disabled bg-interactive-disabled group-orientation-horizontal:border-interactive-disabled"}]}),d=({id:a,children:e,className:r,isDisabled:t=false,...o})=>jsx(Tab,{id:a,className:({isSelected:c,isHovered:g,isFocused:h,isDisabled:f})=>cn(N({isSelected:c,isHovered:g,isFocused:h,isDisabled:f}),r),isDisabled:t,...o,children:e});d.displayName="Tabs.Tab";s.Tab=d;var u=({id:a,children:e,className:r,...t})=>jsx(TabPanel,{id:a,className:cn("fg-default-light p-s group-orientation-vertical:pt-0 group-orientation-horizontal:pl-0",r),...t,children:e});u.displayName="Tabs.Panel";s.Panel=u;export{s as Tabs};//# sourceMappingURL=index.js.map
|
2
2
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/tabs/index.tsx"],"names":["children","
|
1
|
+
{"version":3,"sources":["../../../src/components/tabs/index.tsx"],"names":["children","orientation","containsExactChildren","p","Tabs","jsx","AriaTabs","l","v","isDisabled","cn","i","cva","className","TabList","AriaTabList","tabListStyles","variant","tabBaseStyles","b","AriaTab","id","T","isSelected","isHovered","isFocused","Tab","TabPanel","AriaTabPanel","P"],"mappings":"2OA+BEA,IAAAA,CACA,CAAA,CAAA,CAAA,SACA,CAAA,CAAA,SAAA,CAAAC,CAAAA,CAAc,aACd,CAAA,YAAa,CAAA,UAEf,CACEC,CAAAA,CAAsB,KACpB,CAAA,GAAA,CAAA,CAAA,IACAC,qBAAA,CAAA,CAAA,QAAA,CAAA,CAAA,CAAeC,aAAK,CACpB,CAAA,CAAA,WAAc,CACZ,cAAoB,CAAA,CAAG,CAAE,WAAe,EAE5C,CAAC,GAGCC,CAACC,CAAAA,CAAA,GACC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAAC,GAAA,CAAAC,IAAaP,CAAAA,CACb,WAAYQ,CAAAA,CACZ,WAAWC,CACT,CAAA,CAAA,SAAA,CAAAC,EAAA,CAAA,+DAKD,CAAA,CAAA,CAAA,CAAAX,GACH,CAAA,CAIJI,cAAmB,CAAA,CAAA,WASGQ,C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,GACZ,UAAW,CAAA,IACX,UACE,CAAA,IAAA,CAAA,SAAA,CAAA,wHAGU,GACZ,UAAA,CAAY,IAAA,CACZ,UACE,CAAA,IAAA,CAAA,SAAA,CAAA,8FASN,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAAnB,EACA,WAAAa,CACA,CAAA,CAAA,SAAAJ,CAAAA,CAAa,CAAA,UAIXJ,CAAAA,CAACe,CAAAA,KACC,CAAA,GAAIC,CACJ,CAAA,GAAAd,GAAA,CAAAe,GAAA,CAAA,CAAA,EAAY,CAAE,CAAA,CAAA,SAAAC,CAAAA,CAAY,WAAAC,CAAW,CAAA,CAAA,UAAW,CAAA,CAAA,SAAAf,CAAW,CAAA,CAAA,UAE3C,CAAA,CAAA,CAAA,GAAAE,EAAA,CAAAY,CAAAA,CAAY,CAAA,WAAW,CAAA,CAAA,SAAAE,CAAW,CAAA,CAAA,SAAAhB,CAAW,CAAC,CAAA,UAI9D,CAAA,CAAA,CAAA,CAAA,CAAYA,CAAAA,CACX,WAEA,CAAA,CAAA,CAAAT,GACH,CAIJ0B,SAAI,CAAA,CAAA,CAAA,CAAA,CAAc,CAAA,CAAA,WACb,CAAA,UAICC,CAAW,CAAC,CAAE,GAAAN,CAAAA,CAAI,CAAA,IAAA,CAAA,CAAA,CAAA,CAAArB,EAAU,CAAA,CAAA,CAAA,QAAAa,CAAW,WAExCe,CAAA,CACC,CAAA,GAAIP,CACJ,CAAA,GAAAd,GAAA,CAAAsB,QAAA,CAAA,CAAA,EAAWnB,CACT,2GAKDV,GACH,CAIJ2B,SAAS,CAAA,CAAA,CAAA,CAAA,CAAc,CAAA,CAAA,WACvBvB,aAAauB,CAAAA,CAAAA,CAAAA,KAAAA,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 { containsExactChildren } from '@/lib/react';\nimport { cn } from '@/lib/utils';\nimport 'client-only';\nimport { cva } from 'cva';\nimport {\n Tab as AriaTab,\n TabList as AriaTabList,\n type TabListProps as AriaTabListProps,\n TabPanel as AriaTabPanel,\n type TabPanelProps as AriaTabPanelProps,\n type TabProps as AriaTabProps,\n Tabs as AriaTabs,\n type TabsProps as AriaTabsProps,\n} from 'react-aria-components';\n\nexport interface TabsProps extends AriaTabsProps {}\n\nexport const Tabs = ({\n children,\n className,\n orientation = 'horizontal',\n isDisabled = false,\n ...rest\n}: TabsProps) => {\n containsExactChildren({\n children,\n componentName: Tabs.displayName,\n restrictions: {\n [TabList.displayName]: { min: 1, max: 1 },\n },\n });\n\n return (\n <AriaTabs\n orientation={orientation}\n isDisabled={isDisabled}\n className={cn(\n 'group flex w-content flex-row orientation-horizontal:flex-col',\n className,\n )}\n {...rest}\n >\n {children}\n </AriaTabs>\n );\n};\n\nTabs.displayName = 'Tabs';\n\nexport interface TabListProps extends AriaTabListProps<object> {\n /** Whether the tabs are displaying iconography or text. */\n variant?: 'default' | 'icons';\n /** Whether the tabs are used as drawer controls. */\n drawer?: 'left' | 'right' | 'top' | 'bottom';\n}\n\nconst tabListStyles = cva('flex orientation-horizontal:flex-row flex-col', {\n variants: {\n variant: {\n icons:\n '[&>*]:p-xs orientation-horizontal:[&>*]:pr-s orientation-horizontal:[&>*]:pl-s [&>*]:leading-[0]',\n default: '[&>*]:p-s [&>*]:text-header-m',\n },\n drawer: {\n left: 'orientation-vertical:gap-xs rounded-r-large bg-surface-default p-s',\n right:\n 'orientation-vertical:gap-xs rounded-l-large bg-surface-default p-s',\n top: 'orientation-vertical:gap-xs rounded-b-large bg-surface-default p-s',\n bottom:\n 'orientation-vertical:gap-xs rounded-t-large bg-surface-default p-s',\n },\n },\n});\n\nconst TabList = ({\n children,\n className,\n variant = 'default',\n drawer = undefined,\n ...rest\n}: TabListProps) => {\n containsExactChildren({\n children,\n componentName: TabList.displayName,\n restrictions: {\n [Tab.displayName]: { min: 1 },\n },\n });\n\n return (\n <AriaTabList\n className={cn(tabListStyles({ variant, drawer }), className)}\n {...rest}\n >\n {children}\n </AriaTabList>\n );\n};\n\nTabList.displayName = 'Tabs.List';\nTabs.List = TabList;\n\nconst tabBaseStyles = cn(\n 'fg-default-dark cursor-pointer p-s outline-none',\n 'rounded-medium group-orientation-horizontal:rounded-small group-orientation-horizontal:rounded-b-none',\n 'group-orientation-horizontal:border-static-light group-orientation-horizontal:border-b',\n 'group-orientation-vertical:border group-orientation-vertical:border-transparent',\n);\n\nconst tabStyles = cva(tabBaseStyles, {\n variants: {\n isSelected: {\n true: 'fg-highlight bg-highlight-subtle group-orientation-horizontal:border-highlight',\n },\n isHovered: {\n true: 'fg-default-light group-orientation-horizontal:border-interactive-hover',\n },\n isFocused: {\n true: 'fg-default-light group-orientation-horizontal:border-interactive-hover',\n },\n isDisabled: {\n true: 'fg-disabled cursor-not-allowed group-orientation-horizontal:border-interactive-disabled',\n },\n },\n compoundVariants: [\n {\n isSelected: true,\n isHovered: true,\n className: 'fg-highlight group-orientation-horizontal:border-highlight',\n },\n {\n isSelected: true,\n isFocused: true,\n className:\n 'fg-highlight group-orientation-horizontal:border-interactive-hover group-orientation-vertical:border-interactive-hover',\n },\n {\n isDisabled: true,\n isSelected: true,\n className:\n 'fg-disabled bg-interactive-disabled group-orientation-horizontal:border-interactive-disabled',\n },\n ],\n});\n\nexport interface TabProps extends AriaTabProps {}\n\nconst Tab = ({\n id,\n children,\n className,\n isDisabled = false,\n ...rest\n}: TabProps) => {\n return (\n <AriaTab\n id={id}\n className={({ isSelected, isHovered, isFocused, isDisabled }) =>\n cn(\n tabStyles({ isSelected, isHovered, isFocused, isDisabled }),\n className,\n )\n }\n isDisabled={isDisabled}\n {...rest}\n >\n {children}\n </AriaTab>\n );\n};\n\nTab.displayName = 'Tabs.Tab';\nTabs.Tab = Tab;\n\nexport interface TabPanelProps extends AriaTabPanelProps {}\n\nconst TabPanel = ({ id, children, className, ...rest }: TabPanelProps) => {\n return (\n <AriaTabPanel\n id={id}\n className={cn(\n 'fg-default-light p-s group-orientation-vertical:pt-0 group-orientation-horizontal:pl-0',\n className,\n )}\n {...rest}\n >\n {children}\n </AriaTabPanel>\n );\n};\n\nTabPanel.displayName = 'Tabs.Panel';\nTabs.Panel = TabPanel;\n"]}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
+
import * as react from 'react';
|
3
|
+
import { ContextValue } from 'react-aria-components';
|
4
|
+
import { TextAreaFieldProps, TextAreaFieldProviderProps } from './types.js';
|
5
|
+
import 'tailwind-variants';
|
6
|
+
import './styles.js';
|
7
|
+
|
8
|
+
declare const TextAreaFieldContext: react.Context<ContextValue<TextAreaFieldProviderProps, HTMLDivElement>>;
|
9
|
+
declare function TextAreaFieldProvider({ children, ...props }: TextAreaFieldProviderProps): react_jsx_runtime.JSX.Element;
|
10
|
+
declare namespace TextAreaFieldProvider {
|
11
|
+
var displayName: string;
|
12
|
+
}
|
13
|
+
declare function TextAreaField({ ref, ...props }: TextAreaFieldProps): react_jsx_runtime.JSX.Element;
|
14
|
+
declare namespace TextAreaField {
|
15
|
+
var displayName: string;
|
16
|
+
var Provider: typeof TextAreaFieldProvider;
|
17
|
+
}
|
18
|
+
|
19
|
+
export { TextAreaField, TextAreaFieldContext };
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import'client-only';import {createContext}from'react';import {useContextProps,TextField,composeRenderProps,TextArea,Text,FieldError}from'react-aria-components';import {Label}from'../label/index.js';import {TextAreaStyles,TextAreaStylesDefaults}from'./styles.js';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var {field:z,label:O,input:V,description:H,error:h}=TextAreaStyles(),P=createContext(null);function T({children:d,...l}){return jsx(P.Provider,{value:l,children:d})}T.displayName="TextAreaField.Provider";function F({ref:d,...l}){[l,d]=useContextProps(l,d??null,P);let{classNames:o,description:p,errorMessage:A,label:x,inputRef:f,inputProps:v,size:i=TextAreaStylesDefaults.size,isDisabled:e,isInvalid:N,isReadOnly:t,isRequired:m,...b}=l,c=A||null,y=N??(c?true:void 0),u=i==="small";return jsx(TextField,{...b,className:composeRenderProps(o?.field,(r,{isInvalid:a})=>z({className:r,size:i,isDisabled:e,isInvalid:a,isReadOnly:t})),isDisabled:e,isInvalid:y,isReadOnly:t,isRequired:m,children:({isInvalid:r})=>jsxs(Fragment,{children:[!u&&!!x&&jsx(Label,{className:O({className:o?.label,size:i,isDisabled:e,isInvalid:r,isReadOnly:t}),isDisabled:e,isRequired:m,children:x}),jsx(TextArea,{ref:f,...v,className:composeRenderProps(o?.input,a=>V({className:a,size:i,isDisabled:e,isInvalid:r,isReadOnly:t}))}),!(u||r)&&!!p&&jsx(Text,{slot:"description",className:H({className:o?.description,size:i,isDisabled:e,isInvalid:r,isReadOnly:t}),children:p}),jsx(FieldError,{className:composeRenderProps(o?.error,a=>h({className:a,size:i,isDisabled:e,isInvalid:r,isReadOnly:t})),children:c})]})})}F.displayName="TextAreaField";F.Provider=T;export{F as TextAreaField,P as TextAreaFieldContext};//# sourceMappingURL=index.js.map
|
2
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../src/components/text-area-field/index.tsx"],"names":["field","label","input","description","TextAreaStyles","L","TextAreaFieldContext","createContext","R","children","props","TextAreaFieldProvider","ref","useContextProps","classNames","descriptionProp","errorMessageProp","inputRef","inputProps","size","TextAreaStylesDefaults","S","isDisabled","isInvalidProp","isRequired","errorMessage","isSmall","TextField","g","className","isInvalid","Fragment","k","labelProp","jsx","Label","E","TextArea","M","composeRenderProps","Text","D","FieldError","C","error","Text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mBzB,kBAAAA,CAAAA,CAAY,EAAA,OACxC8B,EAAM,CACJ,CAAA,CAAA,SAAAf,CACA,MAAAV,CACA,CAAA,CAAA,UAAAG,CACA,CAAA,CAAA,UACA,CAAA,CAAA,UACF,CAAC,CACH,EAEC,CAAA,CAAA,QAAAG,CACH,CAAA,CAAA,CACF,CAAA,CAEJ,CAEJ,CACAoB,CAAAA,CAAc,CAAA,CAAA,WAAc,CAAA,gBACd,CAAA,CAAA,QAAWlC,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';\n\nimport 'client-only';\nimport { createContext } from 'react';\nimport {\n type ContextValue,\n FieldError,\n Text,\n TextArea,\n TextField,\n composeRenderProps,\n useContextProps,\n} from 'react-aria-components';\nimport { Label } from '../label';\nimport { TextAreaStyles, TextAreaStylesDefaults } from './styles';\nimport type { TextAreaFieldProps, TextAreaFieldProviderProps } from './types';\n\nconst { field, label, input, description, error } = TextAreaStyles();\n\nexport const TextAreaFieldContext =\n createContext<ContextValue<TextAreaFieldProviderProps, HTMLDivElement>>(null);\n\nfunction TextAreaFieldProvider({\n children,\n ...props\n}: TextAreaFieldProviderProps) {\n return (\n <TextAreaFieldContext.Provider value={props}>\n {children}\n </TextAreaFieldContext.Provider>\n );\n}\nTextAreaFieldProvider.displayName = 'TextAreaField.Provider';\n\nexport function TextAreaField({ ref, ...props }: TextAreaFieldProps) {\n [props, ref] = useContextProps(props, ref ?? null, TextAreaFieldContext);\n\n const {\n classNames,\n description: descriptionProp,\n errorMessage: errorMessageProp,\n label: labelProp,\n inputRef,\n inputProps,\n size = TextAreaStylesDefaults.size,\n isDisabled,\n isInvalid: isInvalidProp,\n isReadOnly,\n isRequired,\n ...rest\n } = props;\n const errorMessage = errorMessageProp || null; // Protect against empty string\n const isInvalid = isInvalidProp ?? (errorMessage ? true : undefined); // Leave uncontrolled if possible to fallback to validation state\n const isSmall = size === 'small';\n\n return (\n <TextField\n {...rest}\n className={composeRenderProps(\n classNames?.field,\n (className, { isInvalid }) =>\n field({ className, size, isDisabled, isInvalid, isReadOnly }),\n )}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n isReadOnly={isReadOnly}\n isRequired={isRequired}\n >\n {(\n { isInvalid }, // Rely on internal state, not props, since validation result could differ from props\n ) => (\n <>\n {!isSmall && !!labelProp && (\n <Label\n className={label({\n className: classNames?.label,\n size,\n isDisabled,\n isInvalid,\n isReadOnly,\n })}\n isDisabled={isDisabled}\n isRequired={isRequired}\n >\n {labelProp}\n </Label>\n )}\n <TextArea\n ref={inputRef}\n {...inputProps}\n className={composeRenderProps(classNames?.input, (className) =>\n input({\n className,\n size,\n isDisabled,\n isInvalid,\n isReadOnly,\n }),\n )}\n />\n {!(isSmall || isInvalid) && !!descriptionProp && (\n <Text\n slot='description'\n className={description({\n className: classNames?.description,\n size,\n isDisabled,\n isInvalid,\n isReadOnly,\n })}\n >\n {descriptionProp}\n </Text>\n )}\n <FieldError\n className={composeRenderProps(classNames?.error, (className) =>\n error({\n className,\n size,\n isDisabled,\n isInvalid,\n isReadOnly,\n }),\n )}\n >\n {errorMessage}\n </FieldError>\n </>\n )}\n </TextField>\n );\n}\nTextAreaField.displayName = 'TextAreaField';\nTextAreaField.Provider = TextAreaFieldProvider;\n"]}
|
@@ -0,0 +1,113 @@
|
|
1
|
+
import * as tailwind_variants from 'tailwind-variants';
|
2
|
+
|
3
|
+
declare const TextAreaStylesDefaults: {
|
4
|
+
readonly size: "medium";
|
5
|
+
readonly isDisabled: false;
|
6
|
+
readonly isInvalid: false;
|
7
|
+
readonly isReadOnly: false;
|
8
|
+
};
|
9
|
+
declare const TextAreaStyles: tailwind_variants.TVReturnType<{
|
10
|
+
size: {
|
11
|
+
medium: {
|
12
|
+
input: string;
|
13
|
+
};
|
14
|
+
small: {
|
15
|
+
input: string;
|
16
|
+
};
|
17
|
+
};
|
18
|
+
isInvalid: {
|
19
|
+
false: string;
|
20
|
+
true: {
|
21
|
+
input: string;
|
22
|
+
};
|
23
|
+
};
|
24
|
+
isReadOnly: {
|
25
|
+
false: string;
|
26
|
+
true: {
|
27
|
+
input: string;
|
28
|
+
};
|
29
|
+
};
|
30
|
+
isDisabled: {
|
31
|
+
false: string;
|
32
|
+
true: {
|
33
|
+
input: string;
|
34
|
+
description: string;
|
35
|
+
};
|
36
|
+
};
|
37
|
+
}, {
|
38
|
+
field: string;
|
39
|
+
label: string;
|
40
|
+
input: string[];
|
41
|
+
description: string;
|
42
|
+
error: string;
|
43
|
+
}, undefined, {
|
44
|
+
size: {
|
45
|
+
medium: {
|
46
|
+
input: string;
|
47
|
+
};
|
48
|
+
small: {
|
49
|
+
input: string;
|
50
|
+
};
|
51
|
+
};
|
52
|
+
isInvalid: {
|
53
|
+
false: string;
|
54
|
+
true: {
|
55
|
+
input: string;
|
56
|
+
};
|
57
|
+
};
|
58
|
+
isReadOnly: {
|
59
|
+
false: string;
|
60
|
+
true: {
|
61
|
+
input: string;
|
62
|
+
};
|
63
|
+
};
|
64
|
+
isDisabled: {
|
65
|
+
false: string;
|
66
|
+
true: {
|
67
|
+
input: string;
|
68
|
+
description: string;
|
69
|
+
};
|
70
|
+
};
|
71
|
+
}, {
|
72
|
+
field: string;
|
73
|
+
label: string;
|
74
|
+
input: string[];
|
75
|
+
description: string;
|
76
|
+
error: string;
|
77
|
+
}, tailwind_variants.TVReturnType<{
|
78
|
+
size: {
|
79
|
+
medium: {
|
80
|
+
input: string;
|
81
|
+
};
|
82
|
+
small: {
|
83
|
+
input: string;
|
84
|
+
};
|
85
|
+
};
|
86
|
+
isInvalid: {
|
87
|
+
false: string;
|
88
|
+
true: {
|
89
|
+
input: string;
|
90
|
+
};
|
91
|
+
};
|
92
|
+
isReadOnly: {
|
93
|
+
false: string;
|
94
|
+
true: {
|
95
|
+
input: string;
|
96
|
+
};
|
97
|
+
};
|
98
|
+
isDisabled: {
|
99
|
+
false: string;
|
100
|
+
true: {
|
101
|
+
input: string;
|
102
|
+
description: string;
|
103
|
+
};
|
104
|
+
};
|
105
|
+
}, {
|
106
|
+
field: string;
|
107
|
+
label: string;
|
108
|
+
input: string[];
|
109
|
+
description: string;
|
110
|
+
error: string;
|
111
|
+
}, undefined, unknown, unknown, undefined>>;
|
112
|
+
|
113
|
+
export { TextAreaStyles, TextAreaStylesDefaults };
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import {tv}from'./../../lib/utils.js';var t={size:"medium",isDisabled:false,isInvalid:false,isReadOnly:false},l=tv({slots:{field:"flex flex-col gap-xs",label:"",input:["block w-full rounded-medium p-s font-display outline outline-interactive","text-default-light placeholder:text-default-dark hover:outline-interactive-hover focus:outline-highlight"],description:"fg-default-dark text-body-xs",error:"fg-serious text-body-xs"},variants:{size:{medium:{input:"text-body-s"},small:{input:"text-body-xs"}},isInvalid:{false:"",true:{input:"outline-serious"}},isReadOnly:{false:"",true:{input:"rounded-none p-0 outline-none"}},isDisabled:{false:"",true:{input:"text-disabled outline-interactive-disabled placeholder:text-disabled",description:"fg-disabled"}}},defaultVariants:t});export{l as TextAreaStyles,t as TextAreaStylesDefaults};//# sourceMappingURL=styles.js.map
|
2
|
+
//# sourceMappingURL=styles.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../src/components/text-area-field/styles.ts"],"names":["tv","e"],"mappings":"2CAeQ,CAAA,CAAA,IAAA,CAAA,QACN,CAAA,UACA,CAAA,KAAA,CAAA,SACA,CAAA,KAAA,CAAA,UAG4BA,CAAAA,KAC5B,CAAA,CAAA,CAAA,CAAAC,EAAA,CAAO,CACL,KAAA,CAAO,CAAA,KAAA,CAAA,sBACA,CAAA,KACP,CAAA,EAAO,CACL,KAAA,CAAA,CAAA,0EACA,CAAA,0GAEF,CAAA,CAAA,WAAa,CAAA,8BACN,CAAA,KAAA,CAAA,yBAET,CAAA,CAAA,QACQ,CACJ,CAAA,IAAA,CAAA,CAAQ,MACN,CAAO,CAAA,KAAA,CAAA,aAET,CAAO,CACL,KAAA,CAAO,CAAA,KAAA,CAAA,cAGX,CAAA,CAAA,CAAA,SACE,CAAO,CAAA,KACP,CAAA,EACE,MAAO,CAAA,KAAA,CAAA,iBAGX,CAAA,CAAA,CAAA,WACS,CAAA,KACP,CAAA,EACE,CAAA,IAAA,CAAO,mDAIT,CAAO,MACP,CAAA,EACE,CAAA,IAAA,CACE,CAAA,KAAA,CAAA,kFACW,CAAA,aAInB,CAAA,CAAA,CAAA,CAAA,eACD,CAAA,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 TextAreaStylesDefaults = {\n size: 'medium',\n isDisabled: false,\n isInvalid: false,\n isReadOnly: false,\n} as const;\n\nexport const TextAreaStyles = tv({\n slots: {\n field: 'flex flex-col gap-xs',\n label: '',\n input: [\n 'block w-full rounded-medium p-s font-display outline outline-interactive',\n 'text-default-light placeholder:text-default-dark hover:outline-interactive-hover focus:outline-highlight',\n ],\n description: 'fg-default-dark text-body-xs',\n error: 'fg-serious text-body-xs',\n },\n variants: {\n size: {\n medium: {\n input: 'text-body-s',\n },\n small: {\n input: 'text-body-xs',\n },\n },\n isInvalid: {\n false: '',\n true: {\n input: 'outline-serious',\n },\n },\n isReadOnly: {\n false: '',\n true: {\n input: 'rounded-none p-0 outline-none',\n },\n },\n isDisabled: {\n false: '',\n true: {\n input:\n 'text-disabled outline-interactive-disabled placeholder:text-disabled',\n description: 'fg-disabled',\n },\n },\n },\n defaultVariants: TextAreaStylesDefaults,\n});\n"]}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { RefAttributes, Ref, PropsWithChildren } from 'react';
|
2
|
+
import { TextFieldProps, TextAreaProps, FieldErrorProps } from 'react-aria-components';
|
3
|
+
import { VariantProps } from 'tailwind-variants';
|
4
|
+
import { TextAreaStyles } from './styles.js';
|
5
|
+
|
6
|
+
type TextAreaStyleVariants = VariantProps<typeof TextAreaStyles>;
|
7
|
+
type TextAreaFieldProps = Omit<TextFieldProps, 'children'> & RefAttributes<HTMLDivElement> & TextAreaStyleVariants & {
|
8
|
+
classNames?: {
|
9
|
+
field?: TextFieldProps['className'];
|
10
|
+
label?: string;
|
11
|
+
input?: TextAreaProps['className'];
|
12
|
+
description?: string;
|
13
|
+
error?: FieldErrorProps['className'];
|
14
|
+
};
|
15
|
+
label?: string;
|
16
|
+
inputRef?: Ref<HTMLTextAreaElement>;
|
17
|
+
inputProps?: Omit<TextAreaProps, 'className'>;
|
18
|
+
description?: string;
|
19
|
+
errorMessage?: FieldErrorProps['children'];
|
20
|
+
};
|
21
|
+
type TextAreaFieldProviderProps = PropsWithChildren<Omit<TextAreaFieldProps, 'ref'>>;
|
22
|
+
|
23
|
+
export type { TextAreaFieldProps, TextAreaFieldProviderProps, TextAreaStyleVariants };
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"types.js"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import'client-only';import {TextField,Text,useContextProps,InputContext,Input,Button}from'react-aria-components';import {cn}from'./../../lib/utils.js';import {CancelFill}from'@accelint/icons';import {cva}from'cva';import {useEffect}from'react';import {Icon}from'../icon/index.js';import {Label}from'../label/index.js';import {jsxs,jsx}from'react/jsx-runtime';var f=cva(["block w-full 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 hover:outline-interactive-hover focus:outline-highlight"},isInvalid:{true:"outline-serious focus:outline-serious"},isReadOnly:{true:"rounded-none p-0 outline-none"},size:{medium:"text-body-s",small:"text-body-xs"},isClearable:{true:"",false:""}},compoundVariants:[{isDisabled:true,isInvalid:true,className:"outline-interactive-disabled"},{isClearable:true,isDisabled:false,size:"medium",className:"pr-xl"}],defaultVariants:{isClearable:false,size:"medium"}}),y={target:{value:""}},k=({className:r,isClearable:i=true,ref:t=null,selectOnFocus:o=false,size:a="medium",...e})=>{[e,t]=useContextProps(e,t,InputContext),useEffect(()=>{function l(n){i&&n.key==="Escape"&&e.onChange?.(y);}return t.current?.addEventListener("keydown",l),()=>t.current?.removeEventListener("keydown",l)},[i,e.onChange,t]);let d=!e.readOnly&&e.value&&a!=="small"&&i&&!e.disabled;return e.readOnly?jsx("span",{className:cn(f({isClearable:false,isDisabled:false,isReadOnly:e.readOnly,size:a,className:r})),children:e.value||"\xA0"}):jsxs("div",{className:"relative flex items-center",children:[jsx(Input,{onFocus:l=>{o&&t.current?.select(),e.onFocus?.(l);},ref:t,className:({isDisabled:l,isInvalid:n})=>cn(f({isClearable:i,isDisabled:l,isInvalid:n,isReadOnly:e.readOnly,size:a,className:r}))}),d&&jsx(Button,{className:"fg-default-dark hover:fg-interactive-hover absolute right-[5px] cursor-pointer",excludeFromTabOrder:true,onPress:()=>{e.onChange?.(y),t.current?.focus();},children:jsx(Icon,{size:"small",children:jsx(CancelFill,{})})})]})};function M({className:r,isClearable:i=true,description:t,errorMessage:o,isDisabled:a,isInvalid:e,isReadOnly:d,label:l,placeholder:n,size:m="medium",...u}){let
|
1
|
+
import'client-only';import {TextField,Text,useContextProps,InputContext,Input,Button}from'react-aria-components';import {cn}from'./../../lib/utils.js';import {CancelFill}from'@accelint/icons';import {cva}from'cva';import {useEffect}from'react';import {Icon}from'../icon/index.js';import {Label}from'../label/index.js';import {jsxs,jsx}from'react/jsx-runtime';var f=cva(["block w-full 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 hover:outline-interactive-hover focus:outline-highlight"},isInvalid:{true:"outline-serious focus:outline-serious"},isReadOnly:{true:"rounded-none p-0 outline-none"},size:{medium:"text-body-s",small:"text-body-xs"},isClearable:{true:"",false:""}},compoundVariants:[{isDisabled:true,isInvalid:true,className:"outline-interactive-disabled"},{isClearable:true,isDisabled:false,size:"medium",className:"pr-xl"}],defaultVariants:{isClearable:false,size:"medium"}}),y={target:{value:""}},k=({className:r,isClearable:i=true,ref:t=null,selectOnFocus:o=false,size:a="medium",...e})=>{[e,t]=useContextProps(e,t,InputContext),useEffect(()=>{function l(n){i&&n.key==="Escape"&&e.onChange?.(y);}return t.current?.addEventListener("keydown",l),()=>t.current?.removeEventListener("keydown",l)},[i,e.onChange,t]);let d=!e.readOnly&&e.value&&a!=="small"&&i&&!e.disabled;return e.readOnly?jsx("span",{className:cn(f({isClearable:false,isDisabled:false,isReadOnly:e.readOnly,size:a,className:r})),children:e.value||"\xA0"}):jsxs("div",{className:"relative flex items-center",children:[jsx(Input,{onFocus:l=>{o&&t.current?.select(),e.onFocus?.(l);},ref:t,className:({isDisabled:l,isInvalid:n})=>cn(f({isClearable:i,isDisabled:l,isInvalid:n,isReadOnly:e.readOnly,size:a,className:r}))}),d&&jsx(Button,{className:"fg-default-dark hover:fg-interactive-hover absolute right-[5px] cursor-pointer",excludeFromTabOrder:true,onPress:()=>{e.onChange?.(y),t.current?.focus();},children:jsx(Icon,{size:"small",children:jsx(CancelFill,{})})})]})};function M({className:r,isClearable:i=true,description:t,errorMessage:o,isDisabled:a,isInvalid:e,isReadOnly:d,label:l,placeholder:n,size:m="medium",...u}){let x=m==="small",b=t&&(!(x||e)||a),v=o&&e&&!a&&!d;return jsxs(TextField,{...u,isDisabled:a,isInvalid:e,isReadOnly:d,className:"flex flex-col gap-xs",children:[!x&&jsx(Label,{className:"empty:hidden",isDisabled:a,isRequired:u.isRequired,children:l}),jsx(k,{className:r,isClearable:i,placeholder:n,size:m,...u}),b&&jsx(Text,{className:cn(["fg-default-dark text-body-xs empty:hidden",a&&"fg-disabled"]),slot:"description",children:t}),v&&jsx(Text,{className:"fg-serious text-body-xs empty:hidden",slot:"errorMessage",children:o})]})}export{M as TextField};//# sourceMappingURL=index.js.map
|
2
2
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/text-field/index.tsx"],"names":["C","ref","size","props","InputContext","useEffect","I","handleKeyPressed","e","shouldShowClearButton","isClearable","jsx","s","c","jsxs","h","g","textFieldStyles","Button","P","N","O","TextField","label","shouldShowDescription","isSmall","isInvalid","isDisabled","shouldShowError","errorMessage","isReadOnly","AriaTextField","F","Label","AriaText","x","description"],"mappings":"uWAiCI,IAAA,CAAA,CAAAA,GAAA,CAAA,CAAA,iFAGA,CAAA,CAAA,CAAU,iGAIJ,CAAA,KAAA,CAAA,0GAEJ,CAAA,CAAA,SACQ,CAAA,CAAA,IAAA,CAAA,uCAER,CAAA,CAAA,UACQ,CAAA,CAAA,IAAA,CAAA,+BAGN,CAAA,CAAA,IAAQ,sBACD,CAAA,KAAA,CAAA,cAET,CAAA,CAAA,YAEE,CAAA,IAAA,CAAO,EACT,CACF,KACA,CAAA,EAAA,CAAA,CAAA,CAAA,gBAEI,CAAA,CAAA,CAAA,UACA,CAAA,IAAA,CAAA,SACA,CAAA,IAAA,CAAA,SAAW,CAAA,8BAGX,CAAA,CAAA,CAAA,WACA,CAAA,IAAA,CAAA,UACM,YACN,QAAA,CAAA,SAEJ,CAAA,OACA,CAAA,CAAA,CAAA,4BAEQ,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AACiB,WAEC,CAAAC,SAAA,CAAA,CAAA,GAAA,CAAA,CAAA,UACA,CAAA,CAAA,CAAA,SACA,CAAA,CAAA,CAAA,sBACW,CAAA,sBAEV,CAAA,QACEC,CAAA,CACC,wBAAU,CAAA,cACV,CAAA,UACA,CAAA,CAAA,CAAA,UAAmB,CAAA,CAAA,CAAA,CAAA,UAElB,CAAAV,QAGJ,CACC,CAAA,CAAA,CAAA,CAAAX,GAAA,CAAA,CAAA,CAAA,CAAA,SACA,CAAA,CAAA,CAAA,WACA,CAAA,CAAA,CAAA,WACMV,CACL,CAAA,CAAA,IACH,CACCsB,CAAAA,CAAAA,GACEU,EAAA,CACC,CAAA,CAAA,EAAAtB,GAAA,CAAAuB,IAAA,CAAA,CAAA,SACE,CAAAtB,EAAA,CAAA,CAAA,4DAGG,CAAA,CAAA,CAAA,IAAA,CAAA,aAEJ,CAAAuB,QAIHzB,CAACuB,CAAAA,CAAA,CACC,CAAA,CAAA,EAAAtB,GAAA,CAAAuB,IAAA,CAAA,CAAA,SAAU,CAAA,sCACL,CAAA,IAAA,CAAA,cAEJ,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 {\n Input as AriaInput,\n type InputProps as AriaInputProps,\n Text as AriaText,\n TextField as AriaTextField,\n type TextFieldProps as AriaTextFieldProps,\n Button,\n InputContext,\n useContextProps,\n} from 'react-aria-components';\n\nimport { cn } from '@/lib/utils';\nimport { CancelFill } from '@accelint/icons';\nimport { type VariantProps, cva } from 'cva';\nimport { type ChangeEvent, type ForwardedRef, useEffect } from 'react';\nimport { Icon } from '../icon';\nimport { Label } from '../label';\n\nconst textFieldStyles = cva(\n [\n 'block w-full 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 hover:outline-interactive-hover focus:outline-highlight',\n },\n isInvalid: {\n true: 'outline-serious focus:outline-serious',\n },\n isReadOnly: {\n true: 'rounded-none p-0 outline-none',\n },\n size: {\n medium: 'text-body-s',\n small: 'text-body-xs',\n },\n isClearable: {\n true: '',\n false: '',\n },\n },\n compoundVariants: [\n {\n isDisabled: true,\n isInvalid: true,\n className: 'outline-interactive-disabled',\n },\n {\n isClearable: true,\n isDisabled: false,\n size: 'medium',\n className: 'pr-xl',\n },\n ],\n defaultVariants: {\n isClearable: false,\n size: 'medium',\n },\n },\n);\n\ninterface InputProps\n extends VariantProps<typeof textFieldStyles>,\n Omit<AriaInputProps, 'size'> {\n isClearable?: boolean;\n selectOnFocus?: boolean;\n ref?: ForwardedRef<HTMLInputElement>;\n}\n\nconst clearInputEvent = {\n target: { value: '' },\n} as ChangeEvent<HTMLInputElement>;\n\nconst Input = ({\n className,\n isClearable = true,\n ref = null,\n selectOnFocus = false,\n size = 'medium',\n ...props\n}: InputProps) => {\n [props, ref] = useContextProps(props, ref, InputContext);\n\n useEffect(() => {\n function handleKeyPressed(e: KeyboardEvent) {\n if (isClearable && e.key === 'Escape') {\n props.onChange?.(clearInputEvent);\n }\n }\n\n ref.current?.addEventListener('keydown', handleKeyPressed);\n\n return () => ref.current?.removeEventListener('keydown', handleKeyPressed);\n }, [isClearable, props.onChange, ref]);\n\n const shouldShowClearButton =\n !props.readOnly &&\n props.value &&\n size !== 'small' &&\n isClearable &&\n !props.disabled;\n\n if (props.readOnly) {\n return (\n <span\n className={cn(\n textFieldStyles({\n isClearable: false,\n isDisabled: false,\n isReadOnly: props.readOnly,\n size,\n className,\n }),\n )}\n >\n {props.value || '\\u00A0'}\n </span>\n );\n }\n\n return (\n <div className='relative flex items-center'>\n <AriaInput\n onFocus={(e) => {\n if (selectOnFocus) {\n ref.current?.select();\n }\n\n props.onFocus?.(e);\n }}\n ref={ref}\n className={({ isDisabled, isInvalid }) =>\n cn(\n textFieldStyles({\n isClearable,\n isDisabled,\n isInvalid,\n isReadOnly: props.readOnly,\n size,\n className,\n }),\n )\n }\n />\n {shouldShowClearButton && (\n <Button\n className='fg-default-dark hover:fg-interactive-hover absolute right-[5px] cursor-pointer'\n excludeFromTabOrder\n onPress={() => {\n props.onChange?.(clearInputEvent);\n ref.current?.focus();\n }}\n >\n <Icon size='small'>\n <CancelFill />\n </Icon>\n </Button>\n )}\n </div>\n );\n};\n\nexport interface TextFieldProps\n extends Omit<\n VariantProps<typeof textFieldStyles>,\n 'isDisabled' | 'isInvalid' | 'isReadOnly'\n >,\n Omit<AriaTextFieldProps, 'className'>,\n Omit<InputProps, keyof AriaTextFieldProps> {\n className?: string;\n isClearable?: boolean;\n description?: string;\n errorMessage?: string;\n label?: string;\n placeholder?: string;\n}\n\nexport function TextField({\n className,\n isClearable = true,\n description,\n errorMessage,\n isDisabled,\n isInvalid,\n isReadOnly,\n label,\n placeholder,\n size = 'medium',\n ...props\n}: TextFieldProps) {\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 <AriaTextField\n {...(props as TextFieldProps)}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n isReadOnly={isReadOnly}\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 <Input\n className={className}\n isClearable={isClearable}\n placeholder={placeholder}\n size={size}\n {...(props as InputProps)}\n />\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 </AriaTextField>\n );\n}\n"]}
|
1
|
+
{"version":3,"sources":["../../../src/components/text-field/index.tsx"],"names":["C","ref","size","props","InputContext","useEffect","I","A","handleKeyPressed","e","shouldShowClearButton","isClearable","jsx","s","c","jsxs","h","g","textFieldStyles","Button","P","N","O","TextField","label","isSmall","shouldShowDescription","isInvalid","isDisabled","shouldShowError","errorMessage","isReadOnly","AriaTextField","F","Label","E","AriaText","p","description"],"mappings":"uWAkCI,IAAA,CAAA,CAAAA,GAAA,CAAA,CAAA,iFAGA,CAAA,CAAA,CAAU,QACR,CAAA,CAAA,UACQ,CAAA,CAAA,IAAA,CAAA,uLAIR,CAAA,CAAA,SACQ,CAAA,CAAA,IAAA,CAAA,mDAGA,CAAA,CAAA,IAAA,CAAA,qCAGE,CAAA,CAAA,MAAA,CAAA,aACD,CAAA,KAAA,CAAA,cAET,CAAA,CAAA,WACQ,CACN,CAAA,IAAA,CAAO,EACT,CACF,KACA,CAAA,EAAA,CAAA,CAAA,CAAA,gBAEI,CAAA,CAAA,CAAA,UACA,CAAA,IAAA,CAAA,SACA,CAAA,IAAA,CAAA,wCAGA,CAAA,CAAA,CAAA,WACA,CAAA,IAAA,CAAA,UACM,CAAA,KAAA,CAAA,IAAA,CACN,QAAA,CAAA,SAEJ,CAAA,OACA,CAAA,CAAA,CAAA,eACE,CAAA,CAAA,WACM,CAAA,KAAA,CAAA,IACR,CACF,QAYA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAE,CAAA,OAAU,CACtB,KAEe,CACb,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,SACA,CAAA,CAAA,CAAA,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EAAArB,GAAA,CAAAsB,KAAA,CAAA,CAAA,SAAU,CAAA,yBAEV,CAAA,CAAA,CAAA,UAAkB,CAAA,CAAA,CAAA,UAEjB,CAAAX,QAGJ,CACC,CAAA,CAAA,CAAA,CAAAX,GAAA,CAAA,CAAA,CAAA,CAAA,SACA,CAAA,CAAA,CAAA,WACA,CAAA,CAAA,CAAA,WACMX,CACL,CAAA,CAAA,IACH,CACCwB,CAAAA,CAAAA,GACEU,EAAA,CACC,CAAA,CAAA,EAAAvB,GAAA,CAAAwB,IAAA,CAAA,CAAA,SACE,CAAAvB,EAAA,CAAA,CAAA,4DAGG,CAAA,CAAA,CAAA,IAAA,CAAA,aAEJ,CAAAwB,QAIH1B,CAACwB,CAAAA,CAAA,CACC,CAAA,CAAA,EAAAvB,GAAA,CAAAwB,IAAA,CAAA,CAAA,SAAU,CAAA,sCACL,CAAA,IAAA,CAAA,cAEJ,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 'client-only';\nimport {\n Input as AriaInput,\n type InputProps as AriaInputProps,\n Text as AriaText,\n TextField as AriaTextField,\n type TextFieldProps as AriaTextFieldProps,\n Button,\n InputContext,\n useContextProps,\n} from 'react-aria-components';\n\nimport { cn } from '@/lib/utils';\nimport { CancelFill } from '@accelint/icons';\nimport { type VariantProps, cva } from 'cva';\nimport { type ChangeEvent, type ForwardedRef, useEffect } from 'react';\nimport { Icon } from '../icon';\nimport { Label } from '../label';\n\nconst textFieldStyles = cva(\n [\n 'block w-full 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 hover:outline-interactive-hover focus:outline-highlight',\n },\n isInvalid: {\n true: 'outline-serious focus:outline-serious',\n },\n isReadOnly: {\n true: 'rounded-none p-0 outline-none',\n },\n size: {\n medium: 'text-body-s',\n small: 'text-body-xs',\n },\n isClearable: {\n true: '',\n false: '',\n },\n },\n compoundVariants: [\n {\n isDisabled: true,\n isInvalid: true,\n className: 'outline-interactive-disabled',\n },\n {\n isClearable: true,\n isDisabled: false,\n size: 'medium',\n className: 'pr-xl',\n },\n ],\n defaultVariants: {\n isClearable: false,\n size: 'medium',\n },\n },\n);\n\ninterface InputProps\n extends VariantProps<typeof textFieldStyles>,\n Omit<AriaInputProps, 'size'> {\n isClearable?: boolean;\n selectOnFocus?: boolean;\n ref?: ForwardedRef<HTMLInputElement>;\n}\n\nconst clearInputEvent = {\n target: { value: '' },\n} as ChangeEvent<HTMLInputElement>;\n\nconst Input = ({\n className,\n isClearable = true,\n ref = null,\n selectOnFocus = false,\n size = 'medium',\n ...props\n}: InputProps) => {\n [props, ref] = useContextProps(props, ref, InputContext);\n\n useEffect(() => {\n function handleKeyPressed(e: KeyboardEvent) {\n if (isClearable && e.key === 'Escape') {\n props.onChange?.(clearInputEvent);\n }\n }\n\n ref.current?.addEventListener('keydown', handleKeyPressed);\n\n return () => ref.current?.removeEventListener('keydown', handleKeyPressed);\n }, [isClearable, props.onChange, ref]);\n\n const shouldShowClearButton =\n !props.readOnly &&\n props.value &&\n size !== 'small' &&\n isClearable &&\n !props.disabled;\n\n if (props.readOnly) {\n return (\n <span\n className={cn(\n textFieldStyles({\n isClearable: false,\n isDisabled: false,\n isReadOnly: props.readOnly,\n size,\n className,\n }),\n )}\n >\n {props.value || '\\u00A0'}\n </span>\n );\n }\n\n return (\n <div className='relative flex items-center'>\n <AriaInput\n onFocus={(e) => {\n if (selectOnFocus) {\n ref.current?.select();\n }\n\n props.onFocus?.(e);\n }}\n ref={ref}\n className={({ isDisabled, isInvalid }) =>\n cn(\n textFieldStyles({\n isClearable,\n isDisabled,\n isInvalid,\n isReadOnly: props.readOnly,\n size,\n className,\n }),\n )\n }\n />\n {shouldShowClearButton && (\n <Button\n className='fg-default-dark hover:fg-interactive-hover absolute right-[5px] cursor-pointer'\n excludeFromTabOrder\n onPress={() => {\n props.onChange?.(clearInputEvent);\n ref.current?.focus();\n }}\n >\n <Icon size='small'>\n <CancelFill />\n </Icon>\n </Button>\n )}\n </div>\n );\n};\n\nexport interface TextFieldProps\n extends Omit<\n VariantProps<typeof textFieldStyles>,\n 'isDisabled' | 'isInvalid' | 'isReadOnly'\n >,\n Omit<AriaTextFieldProps, 'className'>,\n Omit<InputProps, keyof AriaTextFieldProps> {\n className?: string;\n isClearable?: boolean;\n description?: string;\n errorMessage?: string;\n label?: string;\n placeholder?: string;\n}\n\nexport function TextField({\n className,\n isClearable = true,\n description,\n errorMessage,\n isDisabled,\n isInvalid,\n isReadOnly,\n label,\n placeholder,\n size = 'medium',\n ...props\n}: TextFieldProps) {\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 <AriaTextField\n {...(props as TextFieldProps)}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n isReadOnly={isReadOnly}\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 <Input\n className={className}\n isClearable={isClearable}\n placeholder={placeholder}\n size={size}\n {...(props as InputProps)}\n />\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 </AriaTextField>\n );\n}\n"]}
|