@accelint/design-toolkit 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -7
- package/dist/components/accordion/index.d.ts +21 -30
- package/dist/components/accordion/index.js +1 -1
- package/dist/components/accordion/index.js.map +1 -1
- package/dist/components/accordion/styles.d.ts +96 -0
- package/dist/components/accordion/styles.js +2 -0
- package/dist/components/accordion/styles.js.map +1 -0
- package/dist/components/accordion/types.d.ts +20 -0
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/badge/index.js.map +1 -1
- package/dist/components/box/index.js.map +1 -1
- package/dist/components/button/index.js +1 -1
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/checkbox/index.js +1 -1
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/chip/index.js +1 -1
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/classification-badge/index.js.map +1 -1
- package/dist/components/classification-banner/index.js.map +1 -1
- package/dist/components/color-picker/index.js.map +1 -1
- package/dist/components/combobox/index.d.ts +7 -16
- package/dist/components/combobox/index.js +1 -1
- package/dist/components/combobox/index.js.map +1 -1
- package/dist/components/date-field/index.js.map +1 -1
- package/dist/components/dialog/index.js +1 -1
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/floating-button/index.js.map +1 -1
- package/dist/components/icon/index.d.ts +15 -15
- package/dist/components/icon/index.js +1 -1
- package/dist/components/icon/index.js.map +1 -1
- package/dist/components/icon/styles.d.ts +34 -0
- package/dist/components/icon/styles.js +2 -0
- package/dist/components/icon/styles.js.map +1 -0
- package/dist/components/icon/types.d.ts +10 -0
- package/dist/components/icon/types.js +2 -0
- package/dist/components/icon/types.js.map +1 -0
- package/dist/components/icon-button/index.js +1 -1
- package/dist/components/icon-button/index.js.map +1 -1
- package/dist/components/label/index.js.map +1 -1
- package/dist/components/options/index.d.ts +32 -0
- package/dist/components/options/index.js +2 -0
- package/dist/components/options/index.js.map +1 -0
- package/dist/components/options-item/index.d.ts +30 -0
- package/dist/components/options-item/index.js +2 -0
- package/dist/components/options-item/index.js.map +1 -0
- package/dist/components/query-builder/action-element.js.map +1 -1
- package/dist/components/query-builder/constants.js.map +1 -1
- package/dist/components/query-builder/example-configuration.js.map +1 -1
- package/dist/components/query-builder/group.js.map +1 -1
- package/dist/components/query-builder/index.js.map +1 -1
- package/dist/components/query-builder/rule.js.map +1 -1
- package/dist/components/query-builder/utils.js.map +1 -1
- package/dist/components/query-builder/value-editor.js.map +1 -1
- package/dist/components/query-builder/value-selector.js.map +1 -1
- package/dist/components/radio/index.js +1 -1
- package/dist/components/radio/index.js.map +1 -1
- package/dist/components/search-field/index.js +1 -1
- package/dist/components/search-field/index.js.map +1 -1
- package/dist/components/slider/index.d.ts +23 -0
- package/dist/components/slider/index.js +2 -0
- package/dist/components/slider/index.js.map +1 -0
- package/dist/components/switch/index.js +1 -1
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/tabs/index.js +1 -1
- package/dist/components/tabs/index.js.map +1 -1
- package/dist/components/text-area/index.js.map +1 -1
- package/dist/components/text-field/index.js +1 -1
- package/dist/components/text-field/index.js.map +1 -1
- package/dist/components/toggle-icon-button/index.js +1 -1
- package/dist/components/toggle-icon-button/index.js.map +1 -1
- package/dist/components/tooltip/index.js.map +1 -1
- package/dist/icons/catalog.js.map +1 -1
- package/dist/index.css +6 -6
- package/dist/index.d.ts +14 -6
- package/dist/index.js +1 -1
- package/dist/lib/react.js.map +1 -1
- package/dist/lib/types.d.ts +29 -0
- package/dist/lib/types.js +2 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/utils.d.ts +15 -1
- package/dist/lib/utils.js +1 -1
- package/dist/lib/utils.js.map +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/styles.css +311 -158
- package/package.json +14 -11
- package/dist/types/types.d.ts +0 -11
- /package/dist/{types → components/accordion}/types.js +0 -0
- /package/dist/{types → components/accordion}/types.js.map +0 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/query-builder/value-editor.tsx"],"names":["rule","value","valid","getValidationResult","validator","c","jsx","Checkbox","d","h","values","m","disabled","handleOnChange","name","option","Radio","defaultOptions","type","rest","ValueSelector","k","TextValueEditor","placeholder","reasons","inputType","TextareaValueEditor","valueEditors","RadioGroupValueEditor","SelectValueEditor","SwitchValueEditor","valueEditorType","ruleProp","props","V","useCallback","index","valueAsArray","handleRangeStartChange","multiValueHandler","handleRangeEndChange","b","Editor","operator","multiValueOperators","term"],"mappings":"ieA6BA,oBAEE,CAAA,CAAA,CAAA,SAAmB,CAAA,CAAA,IAAA,CAAA,CAAA,CAAA,2BAEnBA,CACA,CAAA,CAAA,IAAA,CAAAC,CACF,CAAA,KACQ,CAAE,CAAAC,CAAAA,CAAAA,CAAAA,GAAM,CAAIC,KAA0BC,CAAS,CAErD,CAAA,CAAAC,mBAAA,CAAA,CAAA,CAAA,CAAA,CACEC,CAACC,OACCC,GAAA,CAAAC,QAAA,CAAA,CAAA,UACA,CAAA,CAAA,CAAA,UACA,CAAA,CAAA,CAAA,QACc,CAAA,CAAA,CAAA,cACd,CAAA,CAAA,CAAA,CAAA,YAKN,CAAA,CAAA,CAAA,CAAA,CAAA,SACE,CAAA,CAAA,CAAA,QACA,CAAA,CAAA,CAAA,SAAmB,CAAA,CAAA,IAAA,CAAA,CAAA,CAAA,SACnB,CAAA,CAAA,CAAA,CAAA,cACAT,CACA,CAAA,CAAA,IAAA,CAAAC,CACA,CAAA,KAAA,CAAA,CAAAS,CACF,MACQ,CAAE,CAAAR,CAAAA,CAAAA,CAAAA,GAAM,CAAIC,KAA0BC,CAAS,CAAA,CAErD,CACEE,mBAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,OAAOE,GAAA,CAANG,KACC,CAAA,KAAOV,EACP,KAAYW,CAAAA,CAAAA,CAAAA,UACFC,CAAAA,CAAAA,CAAAA,QACI,CAAA,CAAA,CAAA,cACd,CAAA,CAAA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EMrB,CAAAA,CAAAA,CAAAA,CACH,OAAOa,CAAoB,OAAA,CAAA,EAAA,UAExBA,CAAAA,CAAoB,CAEpBW,CAAAA,CAAAA,CAAAA,CAAAA,GAAAA,MAA4B,CAAA,CAElC,CAAIC,CAAAA,GAAAA,CAAAA,CAAAA,CAAAA,OAAuBA,CAAAA,GAAAA,MAA0B,EAAA,CAAA,GAAA,SAIjDC,EAAAA,CAAAA,CAAoB,CAASD,IAAAA,CAAAA,mBAAAA,CAAAA,QAE7B,CACG,yBAAU,CAAA,CAAA,OAAO,CAAA,KAAKE,CAAMT,CAC3B9B,GAAAA,CAAAA,CAAC,SACC,CAAAA,KAAAA,CAAAA,CAAAA,QACM2B,CAAAA,GAAAA,CACJ,CAAMjC,CAAAA,CAAAA,GAAAA,CAAKoC,CAAK,IAChB,CAAA,CAAA,CAAA,CAAOC,CAAaD,CAAAA,KACpB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,cALM,CAAA,CAAA,CAAA,CAAA,CAAGtB,CAAI,CAAA,CAAA,CAAA,CAAI+B,CAAI,EASzB,CACD,CAAA,CACH,EAKFvC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAAE,GACC,CAAAF,KAAAA,CAAAA,CAAAA,QAAY2B,CAAAA,GAAAA,CAAO,EACrB,CAEJ,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA","file":"value-editor.js","sourcesContent":["// __private-exports\n/*\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 { useCallback } from 'react';\nimport {\n type InputType,\n type ValueEditorProps,\n useValueEditor,\n} from 'react-querybuilder';\nimport { Checkbox } from '../checkbox';\nimport { Radio } from '../radio';\nimport { Switch } from '../switch';\nimport { TextArea } from '../text-area';\nimport { TextField } from '../text-field';\nimport type { QueryBuilderValueEditors } from './';\nimport { multiValueOperators } from './constants';\nimport { getValidationResult } from './utils';\nimport { ValueSelector } from './value-selector';\n\nfunction CheckboxValueEditor({\n disabled,\n fieldData: { name, validator },\n handleOnChange,\n rule,\n value,\n}: ValueEditorProps) {\n const { valid } = getValidationResult(rule, validator);\n\n return (\n <Checkbox\n isDisabled={disabled}\n isSelected={value}\n onChange={handleOnChange}\n aria-invalid={!valid}\n aria-label={name}\n />\n );\n}\n\nfunction RadioGroupValueEditor({\n disabled,\n fieldData: { name, validator },\n handleOnChange,\n rule,\n value,\n values,\n}: ValueEditorProps) {\n const { valid } = getValidationResult(rule, validator);\n\n return (\n <Radio.Group\n value={value}\n isDisabled={disabled}\n onChange={handleOnChange}\n aria-invalid={!valid}\n aria-label={name}\n aria-labelledby={name}\n >\n {values?.map((option) => (\n <Radio key={option.name} value={option.value}>\n {option.label}\n </Radio>\n ))}\n </Radio.Group>\n );\n}\n\nconst defaultOptions: unknown[] = [];\n\nfunction SelectValueEditor({\n disabled,\n fieldData: { name, validator },\n handleOnChange,\n rule,\n type,\n value,\n values = defaultOptions,\n ...rest\n}: ValueEditorProps) {\n const { valid } = getValidationResult(rule, validator);\n\n return (\n <ValueSelector\n {...rest}\n disabled={disabled}\n multiple={type === 'multiselect'}\n options={values}\n title={name}\n validation={!valid}\n value={value}\n handleOnChange={handleOnChange}\n aria-labelledby={name}\n />\n );\n}\n\nfunction SwitchValueEditor({\n disabled,\n fieldData: { name, validator },\n handleOnChange,\n rule,\n value,\n}: ValueEditorProps) {\n const { valid } = getValidationResult(rule, validator);\n\n return (\n <Switch\n isDisabled={disabled}\n isSelected={Boolean(value)}\n onChange={handleOnChange}\n aria-invalid={!valid}\n aria-label={name}\n aria-labelledby={name}\n />\n );\n}\n\nfunction TextValueEditor({\n disabled,\n fieldData: { name, placeholder, validator },\n handleOnChange,\n inputType,\n rule,\n value,\n}: ValueEditorProps) {\n const { valid, reasons } = getValidationResult(rule, validator);\n\n return (\n <TextField\n isDisabled={disabled}\n isInvalid={!valid}\n placeholder={placeholder}\n type={(inputType as InputType) ?? 'text'}\n size='small'\n value={value}\n onChange={handleOnChange}\n aria-invalid={!valid}\n aria-label={name}\n aria-labelledby={name}\n errorMessage={reasons?.join('/n')}\n />\n );\n}\n\nfunction TextareaValueEditor({\n disabled,\n fieldData: { name, placeholder, validator },\n handleOnChange,\n rule,\n value,\n}: ValueEditorProps) {\n const { valid, reasons } = getValidationResult(rule, validator);\n\n return (\n <TextArea\n isDisabled={disabled}\n isInvalid={!valid}\n placeholder={placeholder}\n value={value}\n onChange={handleOnChange}\n aria-label={name}\n aria-invalid={!valid}\n aria-labelledby={name}\n errorMessage={reasons?.join('/n')}\n />\n );\n}\n\nconst valueEditors: QueryBuilderValueEditors = {\n checkbox: CheckboxValueEditor,\n radio: RadioGroupValueEditor,\n select: SelectValueEditor,\n switch: SwitchValueEditor,\n text: TextValueEditor,\n textarea: TextareaValueEditor,\n};\n\nexport function ValueEditor(props: ValueEditorProps) {\n const {\n fieldData: { name, valueEditorType },\n operator,\n rule: ruleProp,\n } = props;\n\n const { valueAsArray, multiValueHandler } = useValueEditor({\n ...props,\n skipHook: true,\n });\n\n const rule = useCallback(\n (index: number) => ({\n ...ruleProp,\n value: valueAsArray[index],\n }),\n [ruleProp, valueAsArray],\n );\n\n const handleRangeStartChange = useCallback(\n (value: string) => multiValueHandler(value, 0),\n [multiValueHandler],\n );\n\n const handleRangeEndChange = useCallback(\n (value: string) => multiValueHandler(value, 1),\n [multiValueHandler],\n );\n\n const type =\n (typeof valueEditorType === 'function'\n ? valueEditorType(operator)\n : valueEditorType) ?? 'text';\n\n const Editor = valueEditors?.[type];\n\n if (operator === 'null' || operator === 'notNull' || !Editor) {\n return null;\n }\n\n if (multiValueOperators.includes(operator)) {\n return (\n <>\n {['start', 'end'].map((term, index) => (\n <div key={`${name}-${term}`}>\n <Editor\n {...props}\n rule={rule(index)}\n value={valueAsArray[index]}\n handleOnChange={\n index ? handleRangeEndChange : handleRangeStartChange\n }\n />\n </div>\n ))}\n </>\n );\n }\n\n return (\n <div>\n <Editor {...props} />\n </div>\n );\n}\n"]}
|
1
|
+
{"version":3,"sources":["../../../src/components/query-builder/value-editor.tsx"],"names":["name","rule","value","validator","c","jsx","d","h","values","m","option","defaultOptions","type","rest","k","y","valid","reasons","C","inputType","g","valueEditors","RadioGroupValueEditor","SelectValueEditor","SwitchValueEditor","TextValueEditor","ruleProp","props","V","useCallback","index","b","valueAsArray","handleRangeStartChange","multiValueHandler","handleRangeEndChange","valueEditorType","Editor","operator","multiValueOperators","D","term"],"mappings":"ieA6BA,oBAEE,CAAA,CAAA,CAAA,SAAaA,CAAM,CAAA,IAAA,CAAA,CAAA,CAAA,2BAEnBC,CAAAA,CACA,CAAA,IAAA,CAAAC,CACF,CAAA,KACQ,CAAE,CAAA,CAAA,CAAA,CAAA,GAAM,CAAA,KAA8BC,CAAS,CAAA,CAErD,CAAAC,mBAAA,CAAA,CAAA,CAAA,CAAA,CACEC,CAAAA,OACEC,GAAA,CAAAC,QAAA,CAAA,CAAA,UACA,CAAA,CAAA,CAAA,UACA,CAAA,CAAA,CAAA,QACA,CAAA,CAAA,CAAA,cACA,CAAA,CAAA,CAAA,CAAA,YAKN,CAAA,CAAA,CAAA,CAAA,CAAA,SACE,CAAA,CAAA,CAAA,QACA,CAAA,CAAA,CAAA,SAAaP,CAAM,CAAA,IAAA,CAAA,CAAA,CAAA,SACnB,CAAA,CAAA,CAAA,CAAA,cACAC,CAAAA,CACA,CAAA,IAAA,CAAAC,CAAAA,CACA,KAAA,CAAA,CAAAM,CACF,MACQ,CAAE,CAAA,CAAA,CAAA,CAAA,GAAM,CAAA,KAA8BL,CAAS,CAAA,CAErD,CAAAC,mBAAA,CAAA,CAAA,CAAA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CAAAA,CACH,OAAOwB,CAAAA,OAAoB,CAAA,EAAA,UAExBA,CAAAA,CAAoB,CAAA,CAAA,CAAA,CAAA,CAAA,GAEpBC,MAA4B,CAAA,CAElC,CAAA,CAAA,GAAA,CAAA,CAAIC,CAAAA,OAAa,CAAA,GAAUA,MAAa,EAAA,CAAA,GAAA,SAC/B,EAGLC,CAAAA,CAAoB,CAAA,IAAA,CAAAC,mBAAA,CAAA,QAEpB,CACG,yBAAC,CAAA,CAAS,OAAO,CAAA,KAAKC,CAAMX,CAAAA,GAC3BzB,CAAAA,CAAC,SACC,CAAA,KAAA,CAAA,CAAA,QACG,CAAGsB,GAAAA,CACJ,CAAA,CAAA,CAAA,GAAM1B,CAAK6B,CAAK,IAChB,CAAA,CAAA,CAAA,CAAOE,CAAAA,CAAaF,KACpB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,cAGF,CAAA,CARQ,CAAA,CAAA,CAAG9B,CAAI,CAAA,CAAA,CAAA,CAAIyC,CAAI,EASzB,CACD,CAAA,CACH,EAKFpC,CAAAA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAAC,GACC,CAAA,KAAA,CAAA,CAAA,QAAS,CAAGqB,GAAAA,CAAO,EACrB,CAEJ,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA","file":"value-editor.js","sourcesContent":["// __private-exports\n/*\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 { useCallback } from 'react';\nimport {\n type InputType,\n type ValueEditorProps,\n useValueEditor,\n} from 'react-querybuilder';\nimport { Checkbox } from '../checkbox';\nimport { Radio } from '../radio';\nimport { Switch } from '../switch';\nimport { TextArea } from '../text-area';\nimport { TextField } from '../text-field';\nimport type { QueryBuilderValueEditors } from './';\nimport { multiValueOperators } from './constants';\nimport { getValidationResult } from './utils';\nimport { ValueSelector } from './value-selector';\n\nfunction CheckboxValueEditor({\n disabled,\n fieldData: { name, validator },\n handleOnChange,\n rule,\n value,\n}: ValueEditorProps) {\n const { valid } = getValidationResult(rule, validator);\n\n return (\n <Checkbox\n isDisabled={disabled}\n isSelected={value}\n onChange={handleOnChange}\n aria-invalid={!valid}\n aria-label={name}\n />\n );\n}\n\nfunction RadioGroupValueEditor({\n disabled,\n fieldData: { name, validator },\n handleOnChange,\n rule,\n value,\n values,\n}: ValueEditorProps) {\n const { valid } = getValidationResult(rule, validator);\n\n return (\n <Radio.Group\n value={value}\n isDisabled={disabled}\n onChange={handleOnChange}\n aria-invalid={!valid}\n aria-label={name}\n aria-labelledby={name}\n >\n {values?.map((option) => (\n <Radio key={option.name} value={option.value}>\n {option.label}\n </Radio>\n ))}\n </Radio.Group>\n );\n}\n\nconst defaultOptions: unknown[] = [];\n\nfunction SelectValueEditor({\n disabled,\n fieldData: { name, validator },\n handleOnChange,\n rule,\n type,\n value,\n values = defaultOptions,\n ...rest\n}: ValueEditorProps) {\n const { valid } = getValidationResult(rule, validator);\n\n return (\n <ValueSelector\n {...rest}\n disabled={disabled}\n multiple={type === 'multiselect'}\n options={values}\n title={name}\n validation={!valid}\n value={value}\n handleOnChange={handleOnChange}\n aria-labelledby={name}\n />\n );\n}\n\nfunction SwitchValueEditor({\n disabled,\n fieldData: { name, validator },\n handleOnChange,\n rule,\n value,\n}: ValueEditorProps) {\n const { valid } = getValidationResult(rule, validator);\n\n return (\n <Switch\n isDisabled={disabled}\n isSelected={Boolean(value)}\n onChange={handleOnChange}\n aria-invalid={!valid}\n aria-label={name}\n aria-labelledby={name}\n />\n );\n}\n\nfunction TextValueEditor({\n disabled,\n fieldData: { name, placeholder, validator },\n handleOnChange,\n inputType,\n rule,\n value,\n}: ValueEditorProps) {\n const { valid, reasons } = getValidationResult(rule, validator);\n\n return (\n <TextField\n isDisabled={disabled}\n isInvalid={!valid}\n placeholder={placeholder}\n type={(inputType as InputType) ?? 'text'}\n size='small'\n value={value}\n onChange={handleOnChange}\n aria-invalid={!valid}\n aria-label={name}\n aria-labelledby={name}\n errorMessage={reasons?.join('/n')}\n />\n );\n}\n\nfunction TextareaValueEditor({\n disabled,\n fieldData: { name, placeholder, validator },\n handleOnChange,\n rule,\n value,\n}: ValueEditorProps) {\n const { valid, reasons } = getValidationResult(rule, validator);\n\n return (\n <TextArea\n isDisabled={disabled}\n isInvalid={!valid}\n placeholder={placeholder}\n value={value}\n onChange={handleOnChange}\n aria-label={name}\n aria-invalid={!valid}\n aria-labelledby={name}\n errorMessage={reasons?.join('/n')}\n />\n );\n}\n\nconst valueEditors: QueryBuilderValueEditors = {\n checkbox: CheckboxValueEditor,\n radio: RadioGroupValueEditor,\n select: SelectValueEditor,\n switch: SwitchValueEditor,\n text: TextValueEditor,\n textarea: TextareaValueEditor,\n};\n\nexport function ValueEditor(props: ValueEditorProps) {\n const {\n fieldData: { name, valueEditorType },\n operator,\n rule: ruleProp,\n } = props;\n\n const { valueAsArray, multiValueHandler } = useValueEditor({\n ...props,\n skipHook: true,\n });\n\n const rule = useCallback(\n (index: number) => ({\n ...ruleProp,\n value: valueAsArray[index],\n }),\n [ruleProp, valueAsArray],\n );\n\n const handleRangeStartChange = useCallback(\n (value: string) => multiValueHandler(value, 0),\n [multiValueHandler],\n );\n\n const handleRangeEndChange = useCallback(\n (value: string) => multiValueHandler(value, 1),\n [multiValueHandler],\n );\n\n const type =\n (typeof valueEditorType === 'function'\n ? valueEditorType(operator)\n : valueEditorType) ?? 'text';\n\n const Editor = valueEditors?.[type];\n\n if (operator === 'null' || operator === 'notNull' || !Editor) {\n return null;\n }\n\n if (multiValueOperators.includes(operator)) {\n return (\n <>\n {['start', 'end'].map((term, index) => (\n <div key={`${name}-${term}`}>\n <Editor\n {...props}\n rule={rule(index)}\n value={valueAsArray[index]}\n handleOnChange={\n index ? handleRangeEndChange : handleRangeStartChange\n }\n />\n </div>\n ))}\n </>\n );\n }\n\n return (\n <div>\n <Editor {...props} />\n </div>\n );\n}\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/query-builder/value-selector.tsx"],"names":["ValueSelector","props","handleOnChange","disabled","listsAsArrays","optionsProp","multiple","title","validation","value","onChange","val","useValueSelector","
|
1
|
+
{"version":3,"sources":["../../../src/components/query-builder/value-selector.tsx"],"names":["ValueSelector","props","handleOnChange","disabled","listsAsArrays","optionsProp","multiple","title","validation","value","onChange","val","useValueSelector","handleSelectionChange","useCallback","selection","options","useMemo","isOptionGroupArray","section","jsxs","ListBoxSection","jsx","Header","option","ComboBox"],"mappings":"4PAuBO,SAASA,CAAcC,EAA2B,CACvD,CAAA,GACE,CAAA,cAAAC,CAAAA,CACA,SAAAC,CAAAA,CACA,CAAA,aAAAC,EACA,CAAA,OAASC,CAAAA,CACT,SAAAC,CAAAA,CACA,CAAA,KAAAC,CAAAA,CACA,CAAA,UAAAC,EACA,CAAA,KAAAC,CAAAA,CACA,IACF,CAAA,CAAIR,EAEE,CAAE,CAAA,QAAAS,EAAU,CAAA,GAAAC,CAAI,EAAIC,CAAAA,gBAAiB,CACzC,eAAAV,CAAAA,CACA,CAAA,aAAAE,EACA,CAAA,QAAAE,CAAAA,CACA,MAAAG,CACF,CAAC,EAEKI,CAAAA,CAAwBC,CAAAA,WAC3BC,IACKA,CAAAA,CAAAA,GACO,CAAA,CAAA,EAAY,EAAE,CAE3B,EAAA,CACA,CAACL,CAAQ,CACX,EAEMM,CAAAA,CAAUC,CAAAA,OACd,KACEC,kBAAmBb,CAAW,CAAA,CAC1BA,CAAAA,CAAY,IAAKc,CAAAA,CAAAA,EACfC,IAACC,eAAA,CACC,CAAA,QAAA,CAAAC,IAACC,CAAAA,MAAA,CAAQ,SAAAJ,CAAAA,CAAQ,CAAA,KAAM,EACtBA,CAAAA,CAAQ,CAAA,OAAQ,IAAKK,CAAAA,CAAAA,EACpBF,GAACG,SAAS,CAAA,IAAT,CACC,KAAMD,CAAAA,CAAO,CAAA,IACb,GAAIA,CAAAA,CAAO,CAAA,IAGV,SAAAA,CAAAA,CAAO,CAAA,KAAA,CAFHA,EAAO,CAAA,IAIf,IAVkBL,CAAAA,CAAQ,CAAA,KAY9B,CAAA,CACDd,CAAAA,CAAY,IAAKmB,CAAAA,CAAAA,EACfF,GAACG,SAAS,CAAA,IAAT,CACC,CAAA,IAAMD,CAAAA,CAAO,KACb,CAAA,SAAWA,CAAAA,CAAO,MAClB,CAAA,EAAIA,CAAAA,CAAO,KAGV,CAAA,QAAAA,CAAAA,CAAO,OAFHA,CAAAA,CAAO,CAAA,IAIf,CAAA,CACP,CAACnB,CAAW,CACd,CAAA,CAEA,QACEiB,GAACG,CAAAA,QAAA,CACC,CAAA,IAAK,CAAA,OACL,WAAYtB,CAAAA,CACX,CAAA,IACD,CAAA,WAAa,CAAA,KAAM,QAAQQ,CAAG,CAAA,CAAIA,EAAI,CAAC,CAAA,CAAIA,EAC3C,CAAA,iBAAiBJ,CAAAA,CACjB,kBAAmBM,CAAAA,CAElB,CAAA,QAAAG,EACH,CAEJ,CAAA","file":"value-selector.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport type { Key } from '@react-types/shared';\nimport { useCallback, useMemo } from 'react';\nimport { Header, ListBoxSection } from 'react-aria-components';\nimport {\n type ValueSelectorProps,\n isOptionGroupArray,\n useValueSelector,\n} from 'react-querybuilder';\nimport { ComboBox } from '../combobox';\n\nexport function ValueSelector(props: ValueSelectorProps) {\n const {\n handleOnChange,\n disabled,\n listsAsArrays,\n options: optionsProp,\n multiple,\n title,\n validation,\n value,\n ...rest\n } = props;\n\n const { onChange, val } = useValueSelector({\n handleOnChange,\n listsAsArrays,\n multiple,\n value,\n });\n\n const handleSelectionChange = useCallback(\n (selection: Key | null) => {\n if (selection) {\n onChange(`${selection}`);\n }\n },\n [onChange],\n );\n\n const options = useMemo(\n () =>\n isOptionGroupArray(optionsProp)\n ? optionsProp.map((section) => (\n <ListBoxSection key={section.label}>\n <Header>{section.label}</Header>\n {section.options.map((option) => (\n <ComboBox.Item\n name={option.name}\n id={option.name}\n key={option.name}\n >\n {option.label}\n </ComboBox.Item>\n ))}\n </ListBoxSection>\n ))\n : optionsProp.map((option) => (\n <ComboBox.Item\n name={option.name}\n textValue={option.label}\n id={option.name}\n key={option.name}\n >\n {option.label}\n </ComboBox.Item>\n )),\n [optionsProp],\n );\n\n return (\n <ComboBox\n size='small'\n isDisabled={disabled}\n {...rest}\n selectedKey={Array.isArray(val) ? val[0] : val}\n aria-labelledby={title}\n onSelectionChange={handleSelectionChange}\n >\n {options}\n </ComboBox>\n );\n}\n"]}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import {cn}from'./../../lib/utils.js';import {cva}from'cva';import {Radio,RadioGroup,composeRenderProps}from'react-aria-components';import {Label}from'../label/index.js';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var v=cva("fg-default-light flex size-l items-center justify-center rounded-round outline outline-interactive before:block before:size-s before:rounded-round before:bg-transparent",{variants:{isSelected:{true:"outline-highlight before:bg-highlight"},isFocused:{true:"outline-interactive-hover hover:outline-interactive-hover"},isHovered:{true:"outline-interactive-hover hover:outline-interactive-hover"},isDisabled:{true:"outline-interactive-disabled"}},compoundVariants:[{isDisabled:true,isSelected:true,className:"hover:interactive-disabled outline-interactive-disabled before:bg-interactive-disabled"},{isDisabled:true,className:"hover:interactive-disabled outline-interactive-disabled"}],defaultVariants:{isDisabled:false,isFocused:false,isHovered:false,isSelected:false}});function m({className:i,children:o,...t}){return jsx(Radio,{...t,className:cn("fg-default-light flex items-center gap-m
|
1
|
+
import {cn}from'./../../lib/utils.js';import {cva}from'cva';import {Radio,RadioGroup,composeRenderProps}from'react-aria-components';import {Label}from'../label/index.js';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var v=cva("fg-default-light flex size-l items-center justify-center rounded-round outline outline-interactive before:block before:size-s before:rounded-round before:bg-transparent",{variants:{isSelected:{true:"outline-highlight before:bg-highlight"},isFocused:{true:"outline-interactive-hover hover:outline-interactive-hover"},isHovered:{true:"outline-interactive-hover hover:outline-interactive-hover"},isDisabled:{true:"outline-interactive-disabled"}},compoundVariants:[{isDisabled:true,isSelected:true,className:"hover:interactive-disabled outline-interactive-disabled before:bg-interactive-disabled"},{isDisabled:true,className:"hover:interactive-disabled outline-interactive-disabled"}],defaultVariants:{isDisabled:false,isFocused:false,isHovered:false,isSelected:false}});function m({className:i,children:o,...t}){return jsx(Radio,{...t,className:cn("fg-default-light flex items-center gap-m dtk-disabled:text-interactive-disabled",i),children:e=>jsxs(Fragment,{children:[jsx("div",{className:cn(v({isDisabled:e.isDisabled,isFocused:e.isFocused,isHovered:e.isHovered,isSelected:e.isSelected})),"aria-hidden":true}),typeof o=="function"?o(e):o]})})}function R({children:i,className:o,label:t,...e}){return jsx(RadioGroup,{...e,className:composeRenderProps(o,(r,n)=>cn("fg-default-light flex flex-col gap-m text-body-s",n.orientation==="horizontal"&&"flex-row items-center",r)),children:r=>jsxs(Fragment,{children:[t?jsx(Label,{children:t}):void 0,typeof i=="function"?i(r):i]})})}m.Group=R;export{m as Radio};//# sourceMappingURL=index.js.map
|
2
2
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/radio/index.tsx"],"names":["u","
|
1
|
+
{"version":3,"sources":["../../../src/components/radio/index.tsx"],"names":["u","jsx","args","c","s","l","d","a","children","label","props","f","renderProps","cn","b","Radio","RadioGroup"],"mappings":"4NAyBE,IAAA,CAAA,CAAAA,GAAA,CAAA,0KAEE,CAAA,CAAA,QACE,CAAA,CAAA,UACQ,CAAA,CAAA,IAAA,CAAA,uCAER,CAAA,CAAA,SACQ,CAAA,CAAA,IAAA,CAAA,sEAGA,CAAA,CAAA,IAAA,CAAA,2DAER,CAAA,CAAA,UACQ,CAAA,CAAA,IAAA,CAAA,8BAGV,CAAA,CAAA,CAAA,gBAEI,CAAA,CAAA,CAAA,UACA,CAAA,IAAA,CAAA,UACA,CAAA,IAAA,CAAA,SACE,CAAA,wFAGF,CAAA,CAAA,CAAA,UACA,CAAA,IAAA,CAAA,SAAW,CAAA,yDAGf,CAAA,CAAA,CAAA,eACE,CAAA,CAAA,UACA,CAAA,KAAA,CAAA,SACA,CAAA,KAAA,CAAA,0BAQC,CAAA,KAAA,CAAA,CAAA,CAAA,CAAA,SAAiB,CAAA,CAAA,CAAA,oBAA6B,CAAe,CAClE,OACEC,CAAAA,OACMC,GAAAA,CACJC,KAAA,CAAA,CAAA,GAAA,CAAA,CAAA,SACE,CAAAC,EAAA,CAAA,iFAID,CAAA,CAAA,CAAA,CAAA,QACC,CACE,CAAA,EAAAC,IAAA,CAAAC,QAAA,CAAA,CAAA,QAAC,CAAA,CAAAC,GACC,CAAA,KAAA,CAAA,CAAA,0BAEsB,CAAA,CAAA,CAAA,oBACD,CAAA,CAAA,CAAA,SACjB,CAAA,SAAiB,CAAA,CAAA,CAAA,SACjB,CAAA,UAAkB,CAAA,CAAA,CAAA,UAGtB,CAAA,CAAA,CAAA,CAAA,aAED,CAAA,IAAA,CAAA,CAAOC,CAAAA,OAAa,CAAA,EAAA,UAA+BA,CACtD,CAAA,CAEJ,CAEJ,CAOA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,SAAsB,CAAA,CAAA,CAAA,QAAU,CAAA,CAAA,CAAA,SAAW,CAAAC,EAAO,MAA6B,CAC7E,CAAA,GAAA,CAAA,CAAA,CACER,QACMS,GAAAA,CACJC,UAAA,CAAA,CAAA,GAAA,CAAA,CAAA,SAAqDC,qBACnDC,CAAAA,CACE,CAAA,CAAA,CAAA,GAAAT,EAAA,CAAA,kDACY,CAAA,CAAA,CAAA,WAAgB,GAAA,YAAgB,EAAA,oCAO9C,CACG,CAAA,EAAAC,IAAA,CAAAC,QAAA,CAAA,CAAA,QAAS,CAAO,CAAA,CAAA,CAAAC,GAAA,CAAAO,KAAA,CAAA,CAAA,YAChB,CAAA,MAAON,CAAAA,OAAa,CAAA,EAAA,WACvB,CAAA,CAEJ,CAEJ,CAEAO,CAAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQC,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\nimport { cn } from '@/lib/utils';\nimport { cva } from 'cva';\nimport type React from 'react';\nimport {\n Radio as AriaRadio,\n RadioGroup as AriaRadioGroup,\n type RadioGroupProps as AriaRadioGroupProps,\n type RadioProps as AriaRadioProps,\n composeRenderProps,\n} from 'react-aria-components';\nimport { Label } from '../label';\n\nconst radioStyles = cva(\n 'fg-default-light flex size-l items-center justify-center rounded-round outline outline-interactive before:block before:size-s before:rounded-round before:bg-transparent',\n {\n variants: {\n isSelected: {\n true: 'outline-highlight before:bg-highlight',\n },\n isFocused: {\n true: 'outline-interactive-hover hover:outline-interactive-hover',\n },\n isHovered: {\n true: 'outline-interactive-hover hover:outline-interactive-hover',\n },\n isDisabled: {\n true: 'outline-interactive-disabled',\n },\n },\n compoundVariants: [\n {\n isDisabled: true,\n isSelected: true,\n className:\n 'hover:interactive-disabled outline-interactive-disabled before:bg-interactive-disabled',\n },\n {\n isDisabled: true,\n className: 'hover:interactive-disabled outline-interactive-disabled',\n },\n ],\n defaultVariants: {\n isDisabled: false,\n isFocused: false,\n isHovered: false,\n isSelected: false,\n },\n },\n);\n\nexport interface RadioProps extends AriaRadioProps {}\n\nexport function Radio({ className, children, ...args }: RadioProps) {\n return (\n <AriaRadio\n {...args}\n className={cn(\n 'fg-default-light flex items-center gap-m dtk-disabled:text-interactive-disabled',\n className,\n )}\n >\n {(props) => (\n <>\n <div\n className={cn(\n radioStyles({\n isDisabled: props.isDisabled,\n isFocused: props.isFocused,\n isHovered: props.isHovered,\n isSelected: props.isSelected,\n }),\n )}\n aria-hidden\n />\n {typeof children === 'function' ? children(props) : children}\n </>\n )}\n </AriaRadio>\n );\n}\n\nexport interface RadioGroupProps extends AriaRadioGroupProps {\n // children: React.JSX.Element;\n label?: string | React.JSX.Element;\n}\n\nfunction RadioGroup({ children, className, label, ...props }: RadioGroupProps) {\n return (\n <AriaRadioGroup\n {...props}\n className={composeRenderProps(className, (className, renderProps) =>\n cn(\n 'fg-default-light flex flex-col gap-m text-body-s',\n renderProps.orientation === 'horizontal' && 'flex-row items-center',\n\n className,\n ),\n )}\n >\n {(props) => (\n <>\n {label ? <Label>{label}</Label> : undefined}\n {typeof children === 'function' ? children(props) : children}\n </>\n )}\n </AriaRadioGroup>\n );\n}\n\nRadio.Group = RadioGroup;\n"]}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import {cn}from'./../../lib/utils.js';import {Search,Loop,CancelFill}from'@accelint/icons';import {cva}from'cva';import {SearchField,Input,Button}from'react-aria-components';import {Icon}from'../icon/index.js';import {jsxs,jsx}from'react/jsx-runtime';var v=cva(["hide-cancel block w-full rounded-round p-s pr-[30px] pl-[35px] font-display text-body-s outline"],{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"},variant:{filled:"bg-surface-raised outline-static-dark",outlined:"outline-interactive"}}}),g=({className:i,placeholder:
|
1
|
+
import {cn}from'./../../lib/utils.js';import {Search,Loop,CancelFill}from'@accelint/icons';import {cva}from'cva';import {SearchField,Input,Button}from'react-aria-components';import {Icon}from'../icon/index.js';import {jsxs,jsx}from'react/jsx-runtime';var v=cva(["hide-cancel block w-full rounded-round p-s pr-[30px] pl-[35px] font-display text-body-s outline"],{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"},variant:{filled:"bg-surface-raised outline-static-dark",outlined:"outline-interactive"}}}),g=({className:i,placeholder:l="Search",variant:o="outlined",isLoading:r=false,...s})=>jsxs(SearchField,{className:cn("group relative",i),...s,children:[jsx(Icon,{className:"fg-interactive-hover absolute top-[6px] left-[7px]",children:jsx(Search,{})}),jsx(Input,{placeholder:l,className:({isDisabled:d})=>cn(v({isDisabled:d,variant:o}))}),r?jsx(Icon,{className:"fg-interactive-hover absolute top-[6px] right-[8px] animate-spin",children:jsx(Loop,{className:"scale-x-[-1]"})}):jsx(Button,{className:"fg-default-dark hover:fg-interactive-hover absolute top-[8px] right-[8px] cursor-pointer group-dtk-disabled:hidden group-dtk-empty:hidden",children:jsx(Icon,{size:"small",children:jsx(CancelFill,{})})})]});g.displayName="SearchField";export{g as SearchField};//# sourceMappingURL=index.js.map
|
2
2
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/search-field/index.tsx"],"names":["h","
|
1
|
+
{"version":3,"sources":["../../../src/components/search-field/index.tsx"],"names":["h","variant","rest","jsxs","AriaSearchField","x","u","t","e","a","jsx","Input","m","textFieldStyles","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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 {\n CancelFill,\n Loop as LoopIcon,\n Search as SearchIcon,\n} from '@accelint/icons';\nimport { cva } from 'cva';\nimport {\n SearchField as AriaSearchField,\n Button,\n Input,\n} from 'react-aria-components';\nimport { Icon } from '../icon';\n\nexport interface SearchFieldProps {\n className?: string;\n /** Disables the input field. */\n isDisabled?: boolean;\n /** Displays a loading spinner. */\n isLoading?: boolean;\n /** Displays placeholder text. */\n placeholder?: string;\n /** Whether the input has a filled background or outlined. */\n variant?: 'filled' | 'outlined';\n}\n\nconst textFieldStyles = cva(\n [\n 'hide-cancel block w-full rounded-round p-s pr-[30px] pl-[35px] font-display text-body-s outline',\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 variant: {\n filled: 'bg-surface-raised outline-static-dark',\n outlined: 'outline-interactive',\n },\n },\n },\n);\n\nexport const SearchField = ({\n className,\n placeholder = 'Search',\n variant = 'outlined',\n isLoading = false,\n ...rest\n}: SearchFieldProps) => {\n return (\n <AriaSearchField className={cn('group relative', className)} {...rest}>\n <Icon className='fg-interactive-hover absolute top-[6px] left-[7px]'>\n <SearchIcon />\n </Icon>\n <Input\n placeholder={placeholder}\n className={({ isDisabled }) =>\n cn(textFieldStyles({ isDisabled, variant }))\n }\n />\n {isLoading ? (\n <Icon className='fg-interactive-hover absolute top-[6px] right-[8px] animate-spin'>\n <LoopIcon className='scale-x-[-1]' />\n </Icon>\n ) : (\n <Button className='fg-default-dark hover:fg-interactive-hover absolute top-[8px] right-[8px] cursor-pointer group-dtk-disabled:hidden group-dtk-empty:hidden'>\n <Icon size='small'>\n <CancelFill />\n </Icon>\n </Button>\n )}\n </AriaSearchField>\n );\n};\n\nSearchField.displayName = 'SearchField';\n"]}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
+
import { SliderProps as SliderProps$1 } from 'react-aria-components';
|
3
|
+
|
4
|
+
interface SliderProps extends Omit<SliderProps$1, 'value' | 'defaultValue' | 'showOutput' | 'slot' | 'style' | 'formatOptions'> {
|
5
|
+
className?: string;
|
6
|
+
showInput?: boolean;
|
7
|
+
showLabel?: boolean;
|
8
|
+
layout: 'stacked' | 'inline';
|
9
|
+
value?: number;
|
10
|
+
defaultValue?: number;
|
11
|
+
rangeValue?: [number, number];
|
12
|
+
defaultRangeValue?: [number, number];
|
13
|
+
isRange?: boolean;
|
14
|
+
label: string;
|
15
|
+
}
|
16
|
+
declare const Slider: ({ children, className, showInput, showLabel, layout, value, defaultValue, label, defaultRangeValue, rangeValue, minValue, maxValue, isRange, orientation, ...props }: SliderProps) => react_jsx_runtime.JSX.Element;
|
17
|
+
type RangeSliderProps = Omit<SliderProps, 'isRange' | 'defaultRangeValue' | 'rangeValue' | 'defaultValue' | 'value'> & {
|
18
|
+
defaultValue: SliderProps['defaultRangeValue'];
|
19
|
+
value: SliderProps['rangeValue'];
|
20
|
+
};
|
21
|
+
declare const RangeSlider: ({ defaultValue, value, ...props }: RangeSliderProps) => react_jsx_runtime.JSX.Element;
|
22
|
+
|
23
|
+
export { RangeSlider, type RangeSliderProps, Slider, type SliderProps };
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import {cn}from'./../../lib/utils.js';import {cva}from'cva';import {useContext}from'react';import {Slider,Label,SliderTrack,SliderThumb,Text,SliderStateContext,useSlottedContext,LabelContext,NumberField,Input}from'react-aria-components';import {Tooltip}from'../tooltip/index.js';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var D=cva("grid gap-s",{variants:{layout:{stacked:"",inline:""},orientation:{vertical:"h-full w-fit",horizontal:"h-xl w-full"}},compoundVariants:[{layout:"stacked",orientation:"horizontal",className:"grid-cols-[auto_1fr_auto] grid-rows-[auto_auto_auto]"},{layout:"inline",orientation:"horizontal",className:"grid-cols-[auto_auto_1fr_auto_auto] grid-rows-1 items-center"},{layout:"stacked",orientation:"vertical",className:"grid-cols-[auto_auto_auto] grid-rows-[auto_auto_1fr_auto]"},{layout:"inline",orientation:"vertical",className:"grid-cols-[auto_1fr_auto] grid-rows-[auto_auto_1fr_auto]"}]}),M=cva("font-display text-body-m text-default-dark",{variants:{orientation:{horizontal:"",vertical:"col-start-1 row-start-4"},layout:{inline:"",stacked:""}},compoundVariants:[{layout:"stacked",orientation:"horizontal",className:"col-start-1 row-start-3"},{layout:"inline",orientation:"horizontal",className:"order-2"},{layout:"stacked",orientation:"vertical",className:"self-end justify-self-end"},{layout:"inline",orientation:"vertical",className:"justify-self-center"}]}),q=cva("font-display text-body-m text-default-dark",{variants:{orientation:{horizontal:"",vertical:"col-start-1 row-start-2"},layout:{inline:"",stacked:""}},compoundVariants:[{layout:"stacked",orientation:"horizontal",className:"col-start-3 row-start-3 justify-self-end"},{layout:"inline",orientation:"horizontal",className:"order-4"},{layout:"stacked",orientation:"vertical",className:"justify-self-end"}]}),E=cva("relative",{variants:{orientation:{horizontal:"h-s w-full",vertical:"h-full w-s"},layout:{inline:"",stacked:""}},compoundVariants:[{orientation:"horizontal",layout:"stacked",className:"col-span-3 row-start-2"},{orientation:"horizontal",layout:"inline",className:"order-3"},{orientation:"vertical",layout:"stacked",className:"col-start-2 row-span-3 row-start-2"},{orientation:"vertical",layout:"inline",className:"col-start-1 row-start-3 justify-self-center"}]}),G=cva("flex gap-s",{variants:{orientation:{horizontal:"flex-row",vertical:"flex-col-reverse"},layout:{inline:"order-5",stacked:"col-start-3 row-start-1"}},compoundVariants:[{layout:"inline",orientation:"horizontal",className:"order-5"},{layout:"inline",orientation:"vertical",className:"col-span-3 col-start-1"},{layout:"stacked",orientation:"vertical",className:"row-start-4"}]}),H=cva("text-default-light",{variants:{orientation:{horizontal:"",vertical:""},layout:{inline:"order-1",stacked:"col-start-1"}},compoundVariants:[{layout:"stacked",orientation:"vertical",className:"col-span-2"},{layout:"inline",orientation:"vertical",className:"col-span-3"}]}),J=cva("h-m w-m rounded-full bg-highlight-bold outline-highlight-bold/40 hover:outline-4 focus:outline-4",{variants:{orientation:{horizontal:"translate-y-[50%]",vertical:"translate-x-[40%]"}}}),K=cva("absolute rounded-full bg-default-light/40",{variants:{orientation:{horizontal:"top-[50%] h-xxs w-full translate-y-[50%]",vertical:"left-[50%] h-full w-xxs "}}}),Q=cva("absolute rounded-full bg-highlight",{variants:{orientation:{horizontal:"top-1/2 h-xxs translate-y-1/2",vertical:"left-1/2 w-xxs"}}}),U=({children:s,className:i,showInput:o=false,showLabel:d=true,layout:l="stacked",value:m,defaultValue:N,label:k,defaultRangeValue:w,rangeValue:S,minValue:p=0,maxValue:g=100,isRange:v=false,orientation:t="horizontal",...z})=>{let T=v?S:m,_=v?w:N;return jsxs(Slider,{className:cn(D({orientation:t,layout:l})),minValue:p,maxValue:g,orientation:t,value:T,defaultValue:_,...z,children:[d&&jsx(Label,{className:H({orientation:t,layout:l}),children:k}),o&&jsx("div",{className:G({orientation:t,layout:l}),children:jsx(W,{})}),jsx(SliderTrack,{className:E({layout:l,orientation:t}),children:({state:r})=>{let n=r.getThumbPercent(0),P=r.getThumbPercent(1)||n,y=`${(r.values.length===2?P-n:n)*100}%`,b=r.values.length===2?`${Math.floor(n*100)}%`:"0";return jsxs(Fragment,{children:[jsx("div",{className:K({orientation:t})}),r.values.map((X,u)=>jsxs(Fragment,{children:[jsx("div",{className:Q({orientation:t}),style:t==="horizontal"?{left:b,width:y}:{bottom:b,height:y}},`slider-${u===0?"min":"max"}`),jsx(SliderThumb,{index:u,className:J({orientation:t}),children:!o&&jsxs(Tooltip,{children:[jsx(Tooltip.Trigger,{children:jsx("div",{className:"size-full"})}),jsx(Tooltip.Body,{placement:"top",children:r.getThumbValue(u)})]})},`slider-thumb-${u===0?"min":"max"}`)]}))]})}}),jsx(Text,{slot:"min",className:M({layout:l,orientation:t}),children:p}),jsx(Text,{slot:"max",className:q({layout:l,orientation:t}),children:g})]})},la=({defaultValue:s,value:i,...o})=>jsx(U,{...o,isRange:true,defaultRangeValue:s,rangeValue:i});function W({className:s}){let i=useContext(SliderStateContext),o=useSlottedContext(LabelContext);return jsx(Fragment,{children:i?.values.map((d,l)=>jsx(NumberField,{"aria-labelledby":o?.id,value:d,onChange:m=>i.setThumbValue(0,m),children:jsx(Input,{className:cn("w-[50px] rounded-medium border border-interactive px-s py-xs font-display text-body-m text-default-light",s)})},`number-field-${l===0?"min":"max"}`))})}export{la as RangeSlider,U as Slider};//# sourceMappingURL=index.js.map
|
2
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +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,CAA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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,2 +1,2 @@
|
|
1
|
-
import {cn}from'./../../lib/utils.js';import {cva}from'cva';import {Switch}from'react-aria-components';import {Label}from'../label/index.js';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var
|
1
|
+
import {cn}from'./../../lib/utils.js';import {cva}from'cva';import {Switch}from'react-aria-components';import {Label}from'../label/index.js';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var n=Label.as(),r=cva(["relative flex h-l w-[32px] items-center rounded-round bg-transparent outline outline-interactive","before:absolute before:block before:size-m before:rounded-full before:bg-default-dark","group-hover:bg-interactive-hover-dark group-hover:outline-interactive-hover group-hover:before:bg-interactive-hover","group-focus-within:bg-interactive-hover-dark group-focus-within:outline-interactive-hover group-focus-within:before:bg-interactive-hover"],{variants:{isSelected:{true:["outline-highlight before:right-[3px] before:bg-highlight","group-hover:bg-highlight-subtle group-hover:outline-highlight group-hover:before:bg-highlight","group-focus-within:bg-highlight-subtle group-focus-within:outline-interactive-hover group-focus-within:before:bg-highlight","group-dtk-disabled:bg-interactive-disabled group-dtk-disabled:outline-interactive-disabled group-dtk-disabled:before:bg-disabled"],false:"before:left-[3px]"},isDisabled:{true:"group-dtk-disabled:bg-interactive-disabled group-dtk-disabled:outline-interactive-disabled group-dtk-disabled:before:bg-disabled",false:""}},defaultVariants:{isSelected:false}});function o({children:e,className:a,...s}){return jsx(Switch,{...s,className:"group flex dtk-disabled:cursor-not-allowed items-center gap-s",children:({isDisabled:l,isSelected:h})=>jsxs(Fragment,{children:[jsx("div",{className:cn(r({className:a,isDisabled:l,isSelected:h}))}),e&&jsx("span",{className:n,children:e})]})})}o.displayName="Switch";o.as=e=>cn(r({className:e}));export{o as Switch};//# sourceMappingURL=index.js.map
|
2
2
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/switch/index.tsx"],"names":["switchStyles","cva","
|
1
|
+
{"version":3,"sources":["../../../src/components/switch/index.tsx"],"names":["switchStyles","cva","d","jsx","props","g","Fragment","u","c","i","t","children","Switch","className","cn"],"mappings":"+LAqB0B,IAAG,CAEvBA,CAAAA,KAAeC,CAAAA,EAEjB,EAAA,CAAA,CAAA,CAAAC,GAAA,CAAA,CAAA,kGACA,CAAA,uFACA,CAAA,qHACA,CAAA,0IAGA,CAAA,CAAA,CAAA,QACE,CAAA,CAAA,UAEI,CAAA,CAAA,IAAA,CAAA,CAAA,0DACA,CAAA,+FACA,CAAA,4HACA,CAAA,kIAEK,CAAA,CAAA,KAAA,CAAA,mBAET,CAAA,CAAA,UACQ,CAAA,CAAA,IAAA,CAAA,mIAER,KAEF,CAAA,EAAA,CAAA,CAAA,CAAA,eACE,CAAA,CAAA,UASC,CAAA,KAAA,CAAA,CAAA,CAAA,CAAA,SAAkB,CAAA,CAAA,CAAA,QAAU,CAAA,CAAA,CAAA,SAAoB,CAAgB,CACrE,CAAA,GAAA,CAAA,CAAA,CACEC,CAAAA,OACMC,IACJC,MAAA,CAAA,CAAA,GAAA,CAAA,CAAA,SAAU,CAAA,+DAET,CAAA,QAAG,CAAA,CAAA,CAAA,UAAY,CAAA,CAAA,CAAA,UACdC,CAAAA,CAAA,CACE,GAAAC,IAAA,CAAAC,QAAA,CAAA,CAAA,QAAC,CAAA,CAAAC,GACC,CAAA,KAAA,CAAA,CAAA,SAA6B,CAAAC,EAAA,CAAA,CAAA,CAAA,CAAA,SAAW,CAAA,CAAA,CAAA,UAAY,CAAA,CAAA,CAAA,UAErDC,CAAAA,CAAAA,CAAYR,CAAAA,CAAC,CAAA,CAAA,CAAA,CAAA,EAAAM,GAAA,CAAK,MAAA,CAAA,CAAA,SAAyB,CAAA,CAAA,CAAA,QAGlD,CAEJ,CACAG,CAAAA,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,oBACMC,CAAkCC,CAAAA,CAAGd,EAAa,CAAE,CAAA,EAAAU,EAAA,CAAA,CAAA,CAAA,CAAA,SAAY,CAAA,CAAA,CAAA,CAAA,CAAA","file":"index.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { cn } from '@/lib/utils';\nimport { cva } from 'cva';\nimport type { ReactNode } from 'react';\nimport {\n Switch as AriaSwitch,\n type SwitchProps as AriaSwitchProps,\n} from 'react-aria-components';\nimport { Label } from '../label';\n\nconst labelStyles = Label.as();\n\nconst switchStyles = cva(\n [\n 'relative flex h-l w-[32px] items-center rounded-round bg-transparent outline outline-interactive',\n 'before:absolute before:block before:size-m before:rounded-full before:bg-default-dark',\n 'group-hover:bg-interactive-hover-dark group-hover:outline-interactive-hover group-hover:before:bg-interactive-hover',\n 'group-focus-within:bg-interactive-hover-dark group-focus-within:outline-interactive-hover group-focus-within:before:bg-interactive-hover',\n ],\n {\n variants: {\n isSelected: {\n true: [\n 'outline-highlight before:right-[3px] before:bg-highlight',\n 'group-hover:bg-highlight-subtle group-hover:outline-highlight group-hover:before:bg-highlight',\n 'group-focus-within:bg-highlight-subtle group-focus-within:outline-interactive-hover group-focus-within:before:bg-highlight',\n 'group-dtk-disabled:bg-interactive-disabled group-dtk-disabled:outline-interactive-disabled group-dtk-disabled:before:bg-disabled',\n ],\n false: 'before:left-[3px]',\n },\n isDisabled: {\n true: 'group-dtk-disabled:bg-interactive-disabled group-dtk-disabled:outline-interactive-disabled group-dtk-disabled:before:bg-disabled',\n false: '',\n },\n },\n defaultVariants: {\n isSelected: false,\n },\n },\n);\n\nexport interface SwitchProps extends Omit<AriaSwitchProps, 'children'> {\n children?: ReactNode;\n}\n\nexport function Switch({ children, className, ...props }: SwitchProps) {\n return (\n <AriaSwitch\n {...props}\n className='group flex dtk-disabled:cursor-not-allowed items-center gap-s'\n >\n {({ isDisabled, isSelected }) => (\n <>\n <div\n className={cn(switchStyles({ className, isDisabled, isSelected }))}\n />\n {children && <span className={labelStyles}>{children}</span>}\n </>\n )}\n </AriaSwitch>\n );\n}\nSwitch.displayName = 'Switch';\nSwitch.as = (className?: string | string[]) => cn(switchStyles({ className }));\n"]}
|
@@ -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 {cva}from'cva';import {Tabs,TabList,Tab,TabPanel}from'react-aria-components';import {jsx}from'react/jsx-runtime';var s=({children:t,className:a,orientation:e="horizontal",isDisabled:r=false,...o})=>(containsExactChildren({children:t,componentName:s.displayName,restrictions:{[n.displayName]:{min:1,max:1}}}),jsx(Tabs,{orientation:e,isDisabled:r,className:cn("group flex w-content flex-row dtk-orientation-horizontal:flex-col",a),...o,children:t}));s.displayName="Tabs";var k=cva("flex dtk-orientation-horizontal:flex-row flex-col",{variants:{variant:{icons:"[&>*]:p-xs dtk-orientation-horizontal:[&>*]:pr-s dtk-orientation-horizontal:[&>*]:pl-s [&>*]:leading-[0]",default:"[&>*]:p-s [&>*]:text-header-m"},drawer:{left:"dtk-orientation-vertical:gap-xs rounded-r-large bg-surface-default p-s",right:"dtk-orientation-vertical:gap-xs rounded-l-large bg-surface-default p-s",top:"dtk-orientation-vertical:gap-xs rounded-b-large bg-surface-default p-s",bottom:"dtk-orientation-vertical:gap-xs rounded-t-large bg-surface-default p-s"}}}),n=({children:t,className:a,variant:e="default",drawer:r=void 0,...o})=>(containsExactChildren({children:t,componentName:n.displayName,restrictions:{[d.displayName]:{min:1}}}),jsx(TabList,{className:cn(k({variant:e,drawer:r}),a),...o,children:t}));n.displayName="Tabs.List";s.List=n;var x=cn("fg-default-dark cursor-pointer p-s outline-none","rounded-medium group-dtk-orientation-horizontal:rounded-small group-dtk-orientation-horizontal:rounded-b-none","group-dtk-orientation-horizontal:border-static-light group-dtk-orientation-horizontal:border-b","group-dtk-orientation-vertical:border group-dtk-orientation-vertical:border-transparent"),z=cva(x,{variants:{isSelected:{true:"fg-highlight bg-highlight-subtle group-dtk-orientation-horizontal:border-highlight"},isHovered:{true:"fg-default-light group-dtk-orientation-horizontal:border-interactive-hover"},isFocused:{true:"fg-default-light group-dtk-orientation-horizontal:border-interactive-hover"},isDisabled:{true:"fg-disabled cursor-not-allowed group-dtk-orientation-horizontal:border-interactive-disabled"}},compoundVariants:[{isSelected:true,isHovered:true,className:"fg-highlight group-dtk-orientation-horizontal:border-highlight"},{isSelected:true,isFocused:true,className:"fg-highlight group-dtk-orientation-horizontal:border-interactive-hover group-dtk-orientation-vertical:border-interactive-hover"},{isDisabled:true,isSelected:true,className:"fg-disabled bg-interactive-disabled group-dtk-orientation-horizontal:border-interactive-disabled"}]}),d=({id:t,children:a,className:e,isDisabled:r=false,...o})=>jsx(Tab,{id:t,className:({isSelected:g,isHovered:c,isFocused:h,isDisabled:f})=>cn(z({isSelected:g,isHovered:c,isFocused:h,isDisabled:f}),e),isDisabled:r,...o,children:a});d.displayName="Tabs.Tab";s.Tab=d;var u=({id:t,children:a,className:e,...r})=>jsx(TabPanel,{id:t,className:cn("fg-default-light p-s group-dtk-orientation-vertical:pt-0 group-dtk-orientation-horizontal:pl-0",e),...r,children:a});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","orientation","containsExactChildren","p","Tabs","AriaTabs","l","v","isDisabled","cn","cva","b","TabList","
|
1
|
+
{"version":3,"sources":["../../../src/components/tabs/index.tsx"],"names":["children","className","orientation","containsExactChildren","p","Tabs","jsx","AriaTabs","l","v","isDisabled","cn","cva","b","TabList","AriaTabList","tabListStyles","variant","tabBaseStyles","AriaTab","id","T","isSelected","isHovered","i","isFocused","Tab","TabPanel","AriaTabPanel","P"],"mappings":"uNA6BEA,IAAAA,CACA,WAAAC,CACA,CAAA,CAAA,SAAA,CAAAC,EAAc,WAAA,CAAA,CACd,CAAA,YAAa,CAAA,UAEf,CACEC,EAAsB,KACpB,CAAA,GAAA,CAAA,CAAA,IACAC,qBAAA,CAAA,CAAA,QAAA,CAAA,CAAA,CAAeC,aAAK,CACpB,CAAA,CAAA,WAAc,CACZ,YAAS,CAAA,CAAW,CAAA,CAAG,CAAE,WAAe,EAE5C,CAAC,GAGCC,CAACC,CAAAA,CAAA,GACC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAAC,GAAA,CAAAC,IAAaP,EACb,WAAYQ,CAAAA,CACZ,CAAA,UAAWC,CACT,kFAKD,CAAA,CAAA,CAAA,CAAAX,GACH,CAAA,CAIJK,QAAK,CAAA,CAAA,CAAA,CAAA,EAAc,CAAA,CAAA,WASGO,CAAAA,MAAI,CAAA,IAAA,CAAA,CAAAC,GAAA,CAAA,mDAEtB,CAAA,CAAA,QACE,CAAA,CAAA,yHAES,CAAA,OAAA,CAAA,+BAGT,CAAM,CAAA,MAAA,CAAA,CAAA,IAAA,CAAA,wEAEJ,CAAA,KAAA,CAAA,wEACG,CAAA,GAAA,CAAA,wEAEH,CAAA,MAAA,CAAA,wEAMN,CAAA,CAAA,CAAA,CAAAb,CAAAA,CACA,WAAAC,CACA,CA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SAAAC,CAAAA,CAAY,WAAAC,CAAW,CAAA,CAAA,UAAW,CAAA,CAAA,SAAAb,CAAW,CAAA,CAAA,UAE3C,CAAA,CAAA,CAAA,GAAAc,EAAA,CAAAF,CAAAA,CAAY,CAAA,WAAW,CAAA,CAAA,SAAAG,CAAW,CAAA,CAAA,SAAAf,CAAW,CAAC,CAAA,UAI9D,CAAA,CAAA,CAAA,CAAA,CAAYA,CAAAA,CACX,WAEA,CAAA,CAAA,CAAAV,GACH,CAIJ0B,SAAI,CAAA,CAAA,CAAA,CAAA,CAAc,CAAA,CAAA,WACb,CAAA,UAICC,CAAW,CAAC,CAAE,GAAAP,CAAAA,CAAI,CAAA,IAAA,CAAA,CAAA,CAAA,CAAApB,EAAU,CAAA,CAAA,CAAA,QAAAC,CAAW,WAExC2B,CAAA,CACC,CAAA,GAAIR,CACJ,CAAA,GAAAZ,GAAA,CAAAqB,QAAA,CAAA,CAAA,EAAWlB,CACT,mHAKDX,GACH,CAIJ2B,SAAS,CAAA,CAAA,CAAA,CAAA,CAAc,CAAA,CAAA,WACvBtB,aAAasB,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\nimport { containsExactChildren } from '@/lib/react';\nimport { cn } from '@/lib/utils';\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 dtk-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 dtk-orientation-horizontal:flex-row flex-col', {\n variants: {\n variant: {\n icons:\n '[&>*]:p-xs dtk-orientation-horizontal:[&>*]:pr-s dtk-orientation-horizontal:[&>*]:pl-s [&>*]:leading-[0]',\n default: '[&>*]:p-s [&>*]:text-header-m',\n },\n drawer: {\n left: 'dtk-orientation-vertical:gap-xs rounded-r-large bg-surface-default p-s',\n right:\n 'dtk-orientation-vertical:gap-xs rounded-l-large bg-surface-default p-s',\n top: 'dtk-orientation-vertical:gap-xs rounded-b-large bg-surface-default p-s',\n bottom:\n 'dtk-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-dtk-orientation-horizontal:rounded-small group-dtk-orientation-horizontal:rounded-b-none',\n 'group-dtk-orientation-horizontal:border-static-light group-dtk-orientation-horizontal:border-b',\n 'group-dtk-orientation-vertical:border group-dtk-orientation-vertical:border-transparent',\n);\n\nconst tabStyles = cva(tabBaseStyles, {\n variants: {\n isSelected: {\n true: 'fg-highlight bg-highlight-subtle group-dtk-orientation-horizontal:border-highlight',\n },\n isHovered: {\n true: 'fg-default-light group-dtk-orientation-horizontal:border-interactive-hover',\n },\n isFocused: {\n true: 'fg-default-light group-dtk-orientation-horizontal:border-interactive-hover',\n },\n isDisabled: {\n true: 'fg-disabled cursor-not-allowed group-dtk-orientation-horizontal:border-interactive-disabled',\n },\n },\n compoundVariants: [\n {\n isSelected: true,\n isHovered: true,\n className:\n 'fg-highlight group-dtk-orientation-horizontal:border-highlight',\n },\n {\n isSelected: true,\n isFocused: true,\n className:\n 'fg-highlight group-dtk-orientation-horizontal:border-interactive-hover group-dtk-orientation-vertical:border-interactive-hover',\n },\n {\n isDisabled: true,\n isSelected: true,\n className:\n 'fg-disabled bg-interactive-disabled group-dtk-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-dtk-orientation-vertical:pt-0 group-dtk-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"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/text-area/index.tsx"],"names":["g","ref","size","props","TextAreaContext","
|
1
|
+
{"version":3,"sources":["../../../src/components/text-area/index.tsx"],"names":["g","ref","size","props","TextAreaContext","P","h","T","e","textAreaStyles","n","Input","label","isSmall","shouldShowDescription","isInvalid","isDisabled","shouldShowError","isReadOnly","jsxs","b","Label","a","jsx","AriaText","x","TextArea"],"mappings":"2PA6BE,IAAC,CAAA,CAAAA,GAAA,CAAA,CAAA,0EAEC,CAAA,CAAA,CAAA,QACE,CAAA,CAAA,UACQ,CAAA,CAAA,IAAA,CAAA,sEAEJ,CAAA,KAAA,CAAA,0GAEJ,CAAA,CAAA,SACQ,CAAA,CAAA,IAAA,CAAA,iBAER,CAAA,CAAA,UACQ,CAAA,CAAA,IAAA,CAAA,+BAGN,CAAA,CAAA,IAAA,CAAQ,CAAA,MAAA,CAAA,aACD,CAAA,KAAA,CAAA,cAET,CAAA,CAAA,WACQ,CAAA,CACN,IAAA,CAAA,EAAO,CACT,KAEF,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,UACA,CAAM,KAAA,CAAA,IAAA,CAAA,QACN,CAAA,SACF,CACF,OACA,CAAA,CAAA,CAAA,eACE,CAAA,CAAA,WACA,CAAM,KAAA,CAAA,IAAA,CACR,QAYF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,SACAC,CAAM,CAAA,CAAA,GACN,CAAA,CAAA,CAAA,IAAA,CAAA,aACA,CAAA,CAAA,CAAAC,KAAO,CAAA,IAAA,CA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AcC,CAAAA,CAAAA,CAAc,CAACE,GAErD,CAAA,CAAA,EAAA,CAAA,CACEC,CAAAA,OACOhB,IAAAA,CACLiB,SAAA,CAAA,CAAA,GAAA,CAAA,CAAA,UACA,CAAA,CAAA,CAAA,SACA,CAAA,CAAA,CAAA,UACA,CAAA,CAAA,CAAA,SAAW,CAAA,+BAGRC,CAAAA,CAAA,CACC,uBAAU,CAAA,cACV,CAAA,UACA,CAAA,CAAA,CAAA,UAAmB,CAAA,CAAA,CAAA,CAAA,UAElB,CAAA,QAGJV,CAAA,CAAM,CAAA,CAAA,CAAAW,GAAA,CAAA,CAAA,CAAA,CAAA,SAAsB,CAAA,CAAA,CAAA,WAAgCpB,CAAAA,CAAM,KAEjEqB,CAAAA,CAACC,CAAAA,CAAA,CACC,sBACE,CAAAd,EAAA,CAAA,CAAA,4DAGG,CAAA,CAAA,CAAA,IAAA,CAAA,sBAMPa,CAAAA,CAACC,EAAA,CACC,CAAA,EAAAF,GAAA,CAAAG,IAAA,CAAA,CAAA,SAAU,CAAA,0DAGT,CAAA,QAMXC,EAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,WAAc,CAAA,UAAA","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 Text as AriaText,\n TextArea as AriaTextArea,\n type TextAreaProps as AriaTextAreaProps,\n TextField as AriaTextField,\n type TextFieldProps as AriaTextFieldProps,\n TextAreaContext,\n useContextProps,\n} from 'react-aria-components';\n\nimport { cn } from '@/lib/utils';\nimport { type VariantProps, cva } from 'cva';\nimport type { ForwardedRef } from 'react';\nimport { Label } from '../label';\n\nconst textAreaStyles = cva(\n ['block w-full rounded-medium p-s font-display outline outline-interactive'],\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 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 textAreaStyles>,\n Omit<AriaTextAreaProps, 'size'> {\n selectOnFocus?: boolean;\n ref?: ForwardedRef<HTMLTextAreaElement>;\n}\n\nconst Input = ({\n className,\n ref = null,\n selectOnFocus = false,\n size = 'medium',\n ...props\n}: InputProps) => {\n [props, ref] = useContextProps(props, ref, TextAreaContext);\n\n if (props.readOnly) {\n return (\n <span\n className={cn(\n textAreaStyles({\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 <AriaTextArea\n {...props}\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 textAreaStyles({\n isDisabled,\n isInvalid,\n isReadOnly: props.readOnly,\n size,\n className,\n }),\n )\n }\n />\n </div>\n );\n};\nInput.displayName = 'TextArea.Input';\n\nexport interface TextAreaProps\n extends Omit<\n VariantProps<typeof textAreaStyles>,\n 'isDisabled' | 'isInvalid' | 'isReadOnly'\n >,\n Omit<AriaTextFieldProps, 'className'>,\n Omit<InputProps, keyof AriaTextFieldProps> {\n className?: string;\n description?: string;\n errorMessage?: string;\n label?: string;\n placeholder?: string;\n}\n\nexport function TextArea({\n className,\n description,\n errorMessage,\n isDisabled,\n isInvalid,\n isReadOnly,\n label,\n placeholder,\n size = 'medium',\n ...props\n}: TextAreaProps) {\n const isSmall = size === 'small';\n const shouldShowDescription = !(isSmall || isInvalid) || isDisabled;\n const shouldShowError = isInvalid && !isDisabled && !isReadOnly;\n\n return (\n <AriaTextField\n {...(props as AriaTextFieldProps)}\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 className={className} placeholder={placeholder} size={size} />\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}\nTextArea.displayName = 'TextArea';\n"]}
|
@@ -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:
|
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 p=m==="small",b=t&&(!(p||e)||a),v=o&&e&&!a&&!d;return jsxs(TextField,{...u,isDisabled:a,isInvalid:e,isReadOnly:d,className:"flex flex-col gap-xs",children:[!p&&jsx(Label,{className:"empty:hidden",isDisabled:a,isOptional:!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","isClearable","ref","size","props","InputContext","useEffect","I","handleKeyPressed","e","shouldShowClearButton","jsx","s","c","jsxs","h","isDisabled","isInvalid","Button","P","N","O","TextField","description","label","isSmall","shouldShowError","errorMessage","AriaTextField","isReadOnly","className","placeholder","shouldShowDescription","AriaText","x"],"mappings":"uWAiCI,IACF,CAAA,CAAAA,GAAA,CAAA,CAAA,iFAEE,CAAA,CAAA,CAAU,QACI,CAAA,CAAA,UAEV,CAAA,CAAA,IAAA,CAAA,uLAGF,CAAA,CAAA,SAEA,CAAA,CAAA,IAAA,CAAA,mDAGA,CAAA,CAAA,IAAA,CAAA,qCAEU,CACR,CAAA,MAAA,CAAA,aACF,CAAA,KAAA,CAAA,cACa,CAAA,CAAA,WAEX,CA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A,CAAA,CAAA,YACO,CACP,CAAA,IAAA,CAAA,CAAA,CAAA,QAEA,CAAA,IAAgBrB,CAAS,CAAA,CAAA,IAAA,CAAA,CAAA,CAAA,GAEvBoB,OAAkBE,CAAAA,CAAAA,CAAWR,IAAcD,EACvCU,CAAAA,EACJC,CAAgBV,CAAAA,EAAAA,CAAAA,CAAa,CAACD,CAAAA,CAAAA,CAAc,EAE9C,CAAA,EAAA,CAAA,CAAA,EAAA,CACEF,CAACc,CAAAA,WAEC,CAAYZ,SAAAA,CAAAA,CAAAA,GAAAA,CAAAA,CAAAA,UACDC,CAAAA,CAAAA,CAAAA,SACCY,CAAAA,CAAAA,CAAAA,sBAGX,CAAA,sBAAA,CAAA,QACE,CAAA,CACC,wBACA,CAAA,cAAA,CAAA,UACY,CAAA,CAAA,CAAA,UAEX,CAAA,CAAA,CAAA,CAAA,UAAA,CAAAL,QAGJ,CACC,CAAWM,CAAAA,CAAAA,CAAAA,GAAAA,CAAAA,CAAAA,CAAAA,CAAAA,SACE7B,CAAAA,CAAAA,CAAAA,WACA8B,CAAAA,CAAAA,CAAAA,WAEZ,CAAA,CAAA,CAAA,IACH,CACCC,CACCrB,CAAAA,GAACsB,EAAA,CACC,CAAA,CAAA,EAAArB,GAAA,CAAAsB,IAAA,CAAA,CAAA,SAEElB,CAAAA,EAAAA,CAAAA,CAAAA,4DAEG,CAAA,CAAA,CAAA,IAAA,CAAA,aAEJO,CAAAA,QAIHZ,CAACsB,CAAA,CAAA,CACC,CAAU,CAAA,EAAArB,GAAA,CAAAsB,IAAA,CAAA,CAAA,SAAA,CAAA,sCAGT,CAAA,IAAA,CAAA,cAAA,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\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 icon-size-m 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>\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","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,CA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,CACvCC,EACJC,CAAAA,CAAAA,EAAgBH,CAAAA,CAAa,CAACC,CAAAA,CAAAA,CAAc,EAACG,CAE/C,EAAA,CAAA,CAAA,EAAA,CACEhB,CAAAA,CAACiB,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,2 +1,2 @@
|
|
1
|
-
import {expectsIconWrapper}from'./../../lib/react.js';import {cn}from'./../../lib/utils.js';import {cva}from'cva';import {ToggleButton,composeRenderProps}from'react-aria-components';import {jsx}from'react/jsx-runtime';var
|
1
|
+
import {expectsIconWrapper}from'./../../lib/react.js';import {cn}from'./../../lib/utils.js';import {cva}from'cva';import {ToggleButton,composeRenderProps}from'react-aria-components';import {jsx}from'react/jsx-runtime';var r=cva("inline-flex cursor-pointer items-center justify-center bg-transparent outline-none hover:bg-interactive-hover-dark focus:bg-interactive-hover-dark",{variants:{variant:{primary:"icon-default-light dtk-selected:icon-highlight dtk-selected:hover:bg-highlight-subtle dtk-selected:focus:bg-highlight-subtle",secondary:"icon-default-dark hover:icon-default-light focus:icon-default-light dtk-selected:icon-highlight dtk-selected:hover:bg-highlight-subtle dtk-selected:focus:bg-highlight-subtle"},size:{medium:"size-[28px] rounded-medium [--icon-size:var(--spacing-xl)]",small:"size-[20px] rounded-small [--icon-size:var(--spacing-l)]"},isDisabled:{true:"not-dtk-selected:icon-disabled dtk-selected:cursor-default not-dtk-selected:cursor-not-allowed not-dtk-selected:bg-interactive-disabled dtk-selected:hover:bg-transparent not-dtk-selected:hover:bg-interactive-disabled dtk-selected:focus:bg-transparent not-dtk-selected:focus:bg-interactive-disabled",false:""}},defaultVariants:{isDisabled:false,size:"medium",variant:"primary"}}),o=({className:e,size:t="medium",variant:l="secondary",isDisabled:i,...s})=>(expectsIconWrapper({children:s.children,componentName:o.displayName}),jsx(ToggleButton,{className:composeRenderProps(e,a=>cn(r({isDisabled:i,size:t,variant:l,className:a}))),isDisabled:i,...s}));o.displayName="ToggleIconButton";o.as=(e,t)=>cn(r({...e,className:t}));export{o as ToggleIconButton};//# sourceMappingURL=index.js.map
|
2
2
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/toggle-icon-button/index.tsx"],"names":["
|
1
|
+
{"version":3,"sources":["../../../src/components/toggle-icon-button/index.tsx"],"names":["c","ToggleIconButton","className","d","jsx","p","composeRenderProps","u","n","isDisabled","cn","toggleIconButtonStyles","props"],"mappings":"0NAsBE,IAAA,CAAA,CAAAA,GAAA,CAAA,oJAGI,CAAA,CAAA,QACE,CAAA,CAAA,OACE,CAAA,CAAA,OAAA,CAAA,8HAEA,CAAA,SAAA,CAAA,+KAGF,CAAQ,CAAA,IAAA,CAAA,CAAA,MAAA,CAAA,4DACD,CAAA,KAAA,CAAA,0DAGP,CAAA,CAAA,UAAM,CAAA,CAAA,IAAA,CAAA,2SAIV,CAAA,KAAA,CAAA,EAAA,CAAA,CAAA,CAAA,eACc,CAAA,CACZ,UAAM,CAAA,KAAA,CACN,IAAA,CAAA,QAAS,CAAA,OAWFC,CAAAA,SACX,CAAA,CAAA,CAAA,CAAAC,CAAAA,CACA,CAAA,CAAA,SAAO,CAAA,CAAA,CAAA,IACP,CAAA,CAAA,CAAA,QAAU,CAAA,OAAA,CACV,CAAA,CAAA,WACA,CAAA,UAEmB,CACjB,CAAA,CAAA,GAAA,CAAA,CAAA,IAAgBC,kBAAA,CAAA,CAAA,QAChB,CAAA,CAAA,CAAA,QAAA,CAAeF,aACjB,CAAC,CAAA,CAGCG,WACE,CAAA,CAAA,CAAAC,GAAWC,CAAAA,YAAmBJ,CAAAA,CAAYA,SAGpC,CAAAK,kBAAA,CAAA,CAAA,CAAA,CAAA,EAAAC,EAAA,CAAAC,CAAAA,CACA,CAAA,UACA,CAAA,CAAA,CAAA,IACA,CAAA,CAAA,CAAA,OACF,CAAC,CACH,CACF,SACA,CAAA,CAAA,CAAA,CAAYA,CAAAA,CACX,CAAA,UAIU,CAAA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA,EAAc,CAAA,CAAA,WAAA,CAAA,kBAI1BC,CAAGC,CAAAA,CAAuB,EAAE,CAAA,CAAGC,CAAAA,CAAO,CAAA,GAAAJ,EAAA,CAAA,CAAA,CAAA,CAAA,GAAW,CAAC,CAAA,SAAA,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 { expectsIconWrapper } from '@/lib/react';\nimport { cn } from '@/lib/utils';\nimport { type VariantProps, cva } from 'cva';\nimport {\n ToggleButton as AriaToggleButton,\n type ToggleButtonProps as AriaToggleButtonProps,\n composeRenderProps,\n} from 'react-aria-components';\n\nconst toggleIconButtonStyles = cva(\n 'inline-flex cursor-pointer items-center justify-center bg-transparent outline-none hover:bg-interactive-hover-dark focus:bg-interactive-hover-dark',\n {\n variants: {\n variant: {\n primary:\n 'icon-default-light dtk-selected:icon-highlight dtk-selected:hover:bg-highlight-subtle dtk-selected:focus:bg-highlight-subtle',\n secondary:\n 'icon-default-dark hover:icon-default-light focus:icon-default-light dtk-selected:icon-highlight dtk-selected:hover:bg-highlight-subtle dtk-selected:focus:bg-highlight-subtle',\n },\n size: {\n medium: 'size-[28px] rounded-medium [--icon-size:var(--spacing-xl)]',\n small: 'size-[20px] rounded-small [--icon-size:var(--spacing-l)]',\n },\n isDisabled: {\n true: 'not-dtk-selected:icon-disabled dtk-selected:cursor-default not-dtk-selected:cursor-not-allowed not-dtk-selected:bg-interactive-disabled dtk-selected:hover:bg-transparent not-dtk-selected:hover:bg-interactive-disabled dtk-selected:focus:bg-transparent not-dtk-selected:focus:bg-interactive-disabled',\n false: '',\n },\n },\n defaultVariants: {\n isDisabled: false,\n size: 'medium',\n variant: 'primary',\n },\n },\n);\n\nexport interface ToggleIconButtonProps\n extends Omit<AriaToggleButtonProps, 'isDisabled'>,\n VariantProps<typeof toggleIconButtonStyles> {\n isDisabled?: boolean;\n}\n\nexport const ToggleIconButton = ({\n className,\n size = 'medium',\n variant = 'secondary',\n isDisabled,\n ...props\n}: ToggleIconButtonProps) => {\n expectsIconWrapper({\n children: props.children,\n componentName: ToggleIconButton.displayName,\n });\n\n return (\n <AriaToggleButton\n className={composeRenderProps(className, (className) =>\n cn(\n toggleIconButtonStyles({\n isDisabled,\n size,\n variant,\n className,\n }),\n ),\n )}\n isDisabled={isDisabled}\n {...props}\n />\n );\n};\nToggleIconButton.displayName = 'ToggleIconButton';\nToggleIconButton.as = (\n props: VariantProps<typeof toggleIconButtonStyles>,\n className?: string | string[],\n) => cn(toggleIconButtonStyles({ ...props, className }));\n"]}
|