@bikdotai/bik-component-library 0.0.830-beta.2 → 0.0.830-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/dropdown/ChipInput.js +1 -1
- package/dist/cjs/components/dropdown/ChipInput.js.map +1 -1
- package/dist/cjs/components/dropdown/Dropdown.js +1 -1
- package/dist/cjs/components/dropdown/Dropdown.js.map +1 -1
- package/dist/cjs/components/input/Input.js +1 -1
- package/dist/cjs/components/input/Input.js.map +1 -1
- package/dist/cjs/components/input/Input.styled.js +25 -12
- package/dist/cjs/components/input/Input.styled.js.map +1 -1
- package/dist/esm/components/dropdown/ChipInput.d.ts +1 -0
- package/dist/esm/components/dropdown/ChipInput.js +60 -49
- package/dist/esm/components/dropdown/ChipInput.js.map +1 -1
- package/dist/esm/components/dropdown/Dropdown.d.ts +2 -0
- package/dist/esm/components/dropdown/Dropdown.js +111 -104
- package/dist/esm/components/dropdown/Dropdown.js.map +1 -1
- package/dist/esm/components/input/Input.js +130 -127
- package/dist/esm/components/input/Input.js.map +1 -1
- package/dist/esm/components/input/Input.model.d.ts +2 -0
- package/dist/esm/components/input/Input.styled.d.ts +2 -0
- package/dist/esm/components/input/Input.styled.js +38 -25
- package/dist/esm/components/input/Input.styled.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropdown.js","sources":["../../../../src/components/dropdown/Dropdown.tsx"],"sourcesContent":["import React, { Ref, useEffect, useRef, useState } from 'react';\nimport { BASE_COLORS, COLORS } from '@src/constants/Theme';\nimport DownIcon from '../../assets/icons/chevronDown.svg';\nimport { Input } from '../input';\nimport { InputStyleContext } from '../input/context/InputStyleProvider';\nimport ChipInput from './ChipInput';\nimport { DropdownPopover } from './DropdownPopover';\nimport { getSelectedOptionsAsText } from './OpenedDropdown/utils/iterationOnOptions';\nimport {\n\tDropdownOption,\n\tGroupedOption,\n\tOpenDropdownProps,\n\tSingleOption,\n} from './type';\n\nexport type DropdownProps = OpenDropdownProps & {\n\tplaceHolder?: string;\n\tsize?: 'default' | 'small' | 'x-small';\n\tdisabled?: boolean;\n\tnoErrorHint?: boolean;\n\tbuttonWidth?: string;\n\tplaceHolderHeight?: string;\n\tshowPlaceholderWhenSelected?: boolean;\n\tinputStyle?: React.CSSProperties;\n\tinputType?: 'chip' | 'default';\n\tonDeleteChip?: (chip: SingleOption) => void;\n\ttruncatedText?: boolean;\n\t'data-test'?: string;\n\tshowLeadingIconInPlaceholder?: boolean;\n\tshowTrailingIconPlaceholder?: boolean;\n\tshowLabelsOnMoreHover?: boolean;\n\tbackgroundColor?: string;\n\tvalue?: string;\n\tshowSelected?: boolean;\n\t/** Fired when the dropdown opens/closes. Runs alongside internal open state. */\n\tonDropdownVisbilityChange?: (isOpen: boolean) => void;\n};\n\nfunction noop() {\n\t/** empty */\n}\n\nexport const Dropdown: React.FC<DropdownProps> = ({\n\tplaceHolder,\n\tsize,\n\tonSelect,\n\tdefaultOptions,\n\tdisabled,\n\tnoErrorHint,\n\tplaceHolderHeight,\n\tshowPlaceholderWhenSelected = false,\n\tinputStyle = {},\n\tinputType = 'default',\n\tonDeleteChip,\n\ttruncatedText,\n\tshowLeadingIconInPlaceholder = false,\n\tshowTrailingIconPlaceholder = false,\n\tshowLabelsOnMoreHover = false,\n\tvalue,\n\tshowSelected = false,\n\tonDropdownVisbilityChange,\n\t...openDropdownProps\n}) => {\n\tconst [isDropdownOpened, setDropdownOpenFlag] = useState(false);\n\tconst [isHovering, setIsHovering] = useState(false);\n\tconst sizeToUse = size ?? 'default';\n\tconst dropdownVisibilityRef = useRef<{\n\t\topenDropdown: boolean;\n\t}>();\n\tconst [selectedOption, setSelectedOption] = useState<DropdownOption[]>(\n\t\tdefaultOptions ?? [],\n\t);\n\tfunction handleSelection(option: DropdownOption | DropdownOption[]) {\n\t\tif (Array.isArray(option)) {\n\t\t\tsetSelectedOption([...option]);\n\t\t} else {\n\t\t\tsetSelectedOption([...[option]]);\n\t\t}\n\t\tonSelect?.(option);\n\t}\n\n\tuseEffect(() => {\n\t\tconst flatSelectedOption: SingleOption[] = [];\n\t\topenDropdownProps?.options?.forEach((option) => {\n\t\t\tif ((option as GroupedOption).options) {\n\t\t\t\t(option as GroupedOption).options.forEach((op) => {\n\t\t\t\t\tif (op.selected) {\n\t\t\t\t\t\tflatSelectedOption.push({\n\t\t\t\t\t\t\t...op,\n\t\t\t\t\t\t\tlabel: op.label,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tif ((option as SingleOption).selected) {\n\t\t\t\t\tflatSelectedOption.push(option as SingleOption);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tsetSelectedOption([...flatSelectedOption]);\n\t}, [openDropdownProps.options]);\n\n\tuseEffect(() => {\n\t\tif (defaultOptions) {\n\t\t\tsetSelectedOption([...defaultOptions]);\n\t\t}\n\t}, [defaultOptions]);\n\n\tconst textVal = getSelectedOptionsAsText(selectedOption);\n\tconst displayText = showPlaceholderWhenSelected\n\t\t? placeHolder\n\t\t: textVal ?? placeHolder ?? 'Select an option';\n\n\tconst configuredMaxWidth = openDropdownProps.buttonWidth;\n\n\t// Shared width for the input wrapper and dropdown popover\n\tconst inputWidth = configuredMaxWidth ?? openDropdownProps.width ?? '100%';\n\n\t// Width passed to dropdown popover — matches input box width\n\tconst dropdownWidth = openDropdownProps.dropdownWidth ?? inputWidth;\n\n\treturn (\n\t\t<>\n\t\t\t<InputStyleContext.Provider\n\t\t\t\tvalue={{\n\t\t\t\t\tInputWrapper: {\n\t\t\t\t\t\theight: placeHolderHeight\n\t\t\t\t\t\t\t? placeHolderHeight\n\t\t\t\t\t\t\t: sizeToUse === 'x-small'\n\t\t\t\t\t\t\t? 24\n\t\t\t\t\t\t\t: sizeToUse === 'small'\n\t\t\t\t\t\t\t? 32\n\t\t\t\t\t\t\t: 48,\n\t\t\t\t\t\twidth: inputWidth,\n\t\t\t\t\t\t...(configuredMaxWidth ? { maxWidth: configuredMaxWidth } : {}),\n\t\t\t\t\t\tzIndex: 1,\n\t\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t\tpadding: sizeToUse === 'x-small' ? '4px 8px' : '6px 8px',\n\t\t\t\t\t\tbackgroundColor:\n\t\t\t\t\t\t\topenDropdownProps.version === '3.0'\n\t\t\t\t\t\t\t\t? isDropdownOpened || isHovering\n\t\t\t\t\t\t\t\t\t? COLORS.surface.hovered\n\t\t\t\t\t\t\t\t\t: COLORS.surface.standard\n\t\t\t\t\t\t\t\t: showSelected && value !== undefined\n\t\t\t\t\t\t\t\t? BASE_COLORS.positive['100']\n\t\t\t\t\t\t\t\t: isHovering\n\t\t\t\t\t\t\t\t? COLORS.background.inactive\n\t\t\t\t\t\t\t\t: COLORS.surface.standard,\n\t\t\t\t\t\ttransition: 'background-color 0.3s ease',\n\t\t\t\t\t\t...inputStyle,\n\t\t\t\t\t},\n\t\t\t\t\tinput: {\n\t\t\t\t\t\tminHeight: '100%',\n\t\t\t\t\t\tmaxWidth: '100%',\n\t\t\t\t\t\tcolor:\n\t\t\t\t\t\t\tshowSelected && value !== undefined\n\t\t\t\t\t\t\t\t? COLORS.content.positive\n\t\t\t\t\t\t\t\t: 'inherit',\n\t\t\t\t\t},\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tonMouseEnter={() => setIsHovering(true)}\n\t\t\t\t\tonMouseLeave={() => setIsHovering(false)}\n\t\t\t\t\tstyle={\n\t\t\t\t\t\topenDropdownProps.width\n\t\t\t\t\t\t\t? { width: openDropdownProps.width }\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<DropdownPopover\n\t\t\t\t\t\tdata-test={openDropdownProps['data-test']}\n\t\t\t\t\t\tref={\n\t\t\t\t\t\t\tdropdownVisibilityRef as Ref<{\n\t\t\t\t\t\t\t\topenDropdown: boolean;\n\t\t\t\t\t\t\t}>\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonSelect={handleSelection}\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\t{...openDropdownProps}\n\t\t\t\t\t\tonDropdownVisbilityChange={(isOpen) => {\n\t\t\t\t\t\t\t// Keep the internal open flag (carat/open styling) AND forward\n\t\t\t\t\t\t\t// to a consumer-provided handler so callers can react to open state.\n\t\t\t\t\t\t\tsetDropdownOpenFlag(isOpen);\n\t\t\t\t\t\t\tonDropdownVisbilityChange?.(isOpen);\n\t\t\t\t\t\t}}\n\t\t\t\t\t\twidth={dropdownWidth}\n\t\t\t\t\t>\n\t\t\t\t\t\t{inputType == 'default' && (\n\t\t\t\t\t\t\t<Input\n\t\t\t\t\t\t\t\tversion={openDropdownProps.version}\n\t\t\t\t\t\t\t\tnoErrorHint={noErrorHint}\n\t\t\t\t\t\t\t\tstate={disabled ? 'disabled' : 'none'}\n\t\t\t\t\t\t\t\tvalue={value === undefined ? displayText : value}\n\t\t\t\t\t\t\t\terrorMessage={openDropdownProps.error}\n\t\t\t\t\t\t\t\tvariant={sizeToUse}\n\t\t\t\t\t\t\t\tplaceholder={placeHolder ?? 'Select an option'}\n\t\t\t\t\t\t\t\tonChangeText={noop}\n\t\t\t\t\t\t\t\tleftIcon={\n\t\t\t\t\t\t\t\t\tshowLeadingIconInPlaceholder && selectedOption[0]?.leadingIcon\n\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\ticon: () => <>{selectedOption[0]?.leadingIcon}</>,\n\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\trightIcon={{\n\t\t\t\t\t\t\t\t\ticon: () => (\n\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{showTrailingIconPlaceholder &&\n\t\t\t\t\t\t\t\t\t\t\t\t(selectedOption[0] as SingleOption)?.trailingIcon}\n\t\t\t\t\t\t\t\t\t\t\t<DownIcon\n\t\t\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\t\t\ttransform: isDropdownOpened\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 'rotate(180deg)'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 'rotate(0deg)',\n\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={noop}\n\t\t\t\t\t\t\t\t\t\t\t\twidth={\n\t\t\t\t\t\t\t\t\t\t\t\t\tsizeToUse === 'x-small'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 16\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: sizeToUse === 'small'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 20\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 24\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\theight={\n\t\t\t\t\t\t\t\t\t\t\t\t\tsizeToUse === 'x-small'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 16\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: sizeToUse === 'small'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 20\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 24\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tcolor={\n\t\t\t\t\t\t\t\t\t\t\t\t\tshowSelected\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? COLORS.content.positive\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: COLORS.content.primary\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\ttruncateText={truncatedText ?? true}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{inputType == 'chip' && (\n\t\t\t\t\t\t\t<ChipInput\n\t\t\t\t\t\t\t\tplaceholder={placeHolder ?? 'Select options'}\n\t\t\t\t\t\t\t\tchips={selectedOption as SingleOption[]}\n\t\t\t\t\t\t\t\tonDeleteChip={(chip) => {\n\t\t\t\t\t\t\t\t\tonDeleteChip?.(chip);\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\terrorMessage={openDropdownProps.error}\n\t\t\t\t\t\t\t\tisDropdownOpened={isDropdownOpened}\n\t\t\t\t\t\t\t\tsizeToUse={sizeToUse}\n\t\t\t\t\t\t\t\tcontainerStyle={{\n\t\t\t\t\t\t\t\t\twidth: openDropdownProps.width ?? '100%',\n\t\t\t\t\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tshowLabelsOnMoreHover={showLabelsOnMoreHover}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</DropdownPopover>\n\t\t\t\t</div>\n\t\t\t</InputStyleContext.Provider>\n\t\t</>\n\t);\n};\n\nDropdown.displayName = 'Dropdown';\n"],"names":["noop","Dropdown","placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder","showTrailingIconPlaceholder","showLabelsOnMoreHover","value","showSelected","onDropdownVisbilityChange","openDropdownProps","isDropdownOpened","setDropdownOpenFlag","useState","isHovering","setIsHovering","sizeToUse","dropdownVisibilityRef","useRef","selectedOption","setSelectedOption","handleSelection","option","useEffect","flatSelectedOption","op","textVal","getSelectedOptionsAsText","displayText","configuredMaxWidth","inputWidth","dropdownWidth","jsxDEV","Fragment","InputStyleContext","COLORS","BASE_COLORS","DropdownPopover","isOpen","Input","this","DownIcon","ChipInput","chip"],"mappings":";;;;;;;;;AAsCA,SAASA,IAAO;AAEhB;AAEO,MAAMC,IAAoC,CAAC;AAAA,EACjD,aAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,6BAAAC,IAA8B;AAAA,EAC9B,YAAAC,IAAa,CAAA;AAAA,EACb,WAAAC,IAAY;AAAA,EACZ,cAAAC;AAAA,EACA,eAAAC;AAAA,EACA,8BAAAC,IAA+B;AAAA,EAC/B,6BAAAC,IAA8B;AAAA,EAC9B,uBAAAC,IAAwB;AAAA,EACxB,OAAAC;AAAA,EACA,cAAAC,IAAe;AAAA,EACf,2BAAAC;AAAA,EACA,GAAGC;AACJ,MAAM;AACL,QAAM,CAACC,GAAkBC,CAAmB,IAAIC,EAAS,EAAK,GACxD,CAACC,GAAYC,CAAa,IAAIF,EAAS,EAAK,GAC5CG,IAAYvB,KAAQ,WACpBwB,IAAwBC,EAAA,GAGxB,CAACC,GAAgBC,CAAiB,IAAIP;AAAA,IAC3ClB,KAAkB,CAAA;AAAA,EAAC;AAEpB,WAAS0B,EAAgBC,GAA2C;AACnE,IAAI,MAAM,QAAQA,CAAM,IACvBF,EAAkB,CAAC,GAAGE,CAAM,CAAC,IAE7BF,EAAkB,CAAKE,CAAO,CAAC,GAEhC5B,IAAW4B,CAAM;AAAA,EAClB;AAEA,EAAAC,EAAU,MAAM;AACf,UAAMC,IAAqC,CAAA;AAC3C,IAAAd,GAAmB,SAAS,QAAQ,CAACY,MAAW;AAC/C,MAAKA,EAAyB,UAC5BA,EAAyB,QAAQ,QAAQ,CAACG,MAAO;AACjD,QAAIA,EAAG,YACND,EAAmB,KAAK;AAAA,UACvB,GAAGC;AAAA,UACH,OAAOA,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AAA,kBAAA;AAAA,kBAAAkC;AAAAA,gBAAA;AAAA,cAcA;AAAA,YAAA;AAAA,YA5FF;AAAA,YAAA;AAAA,YAAA;AAAA,cAAA,UAAA;AAAA,cAAA,YAAA;AAAA,cAAA,cAAA;AAAA,YAAA;AAAA,YAAAA;AAAAA,UAAA;AAAA,QA8FA;AAAA,QAvGD;AAAA,QAAA;AAAA,QAAA;AAAA,UAAA,UAAA;AAAA,UAAA,YAAA;AAAA,UAAA,cAAA;AAAA,QAAA;AAAA,QAAAA;AAAAA,MAAA;AAAA,IAwGA;AAAA,IA9ID;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAA;AAAAA,EAAA,EA+IA,GAhJD,QAAA,IAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAiJA;AAEF;AAEAjD,EAAS,cAAc;"}
|
|
1
|
+
{"version":3,"file":"Dropdown.js","sources":["../../../../src/components/dropdown/Dropdown.tsx"],"sourcesContent":["import React, { Ref, useEffect, useRef, useState } from 'react';\nimport { BASE_COLORS, COLORS } from '@src/constants/Theme';\nimport DownIcon from '../../assets/icons/chevronDown.svg';\nimport { Input } from '../input';\nimport { InputStyleContext } from '../input/context/InputStyleProvider';\nimport ChipInput from './ChipInput';\nimport { DropdownPopover } from './DropdownPopover';\nimport { getSelectedOptionsAsText } from './OpenedDropdown/utils/iterationOnOptions';\nimport {\n\tDropdownOption,\n\tGroupedOption,\n\tOpenDropdownProps,\n\tSingleOption,\n} from './type';\n\nexport type DropdownProps = OpenDropdownProps & {\n\tplaceHolder?: string;\n\tsize?: 'default' | 'small' | 'x-small';\n\tdisabled?: boolean;\n\t/** When disabled, render a solid grey box (background.base) with secondary text and no opacity wash. */\n\tsolidDisabled?: boolean;\n\tnoErrorHint?: boolean;\n\tbuttonWidth?: string;\n\tplaceHolderHeight?: string;\n\tshowPlaceholderWhenSelected?: boolean;\n\tinputStyle?: React.CSSProperties;\n\tinputType?: 'chip' | 'default';\n\tonDeleteChip?: (chip: SingleOption) => void;\n\ttruncatedText?: boolean;\n\t'data-test'?: string;\n\tshowLeadingIconInPlaceholder?: boolean;\n\tshowTrailingIconPlaceholder?: boolean;\n\tshowLabelsOnMoreHover?: boolean;\n\tbackgroundColor?: string;\n\tvalue?: string;\n\tshowSelected?: boolean;\n\t/** Fired when the dropdown opens/closes. Runs alongside internal open state. */\n\tonDropdownVisbilityChange?: (isOpen: boolean) => void;\n};\n\nfunction noop() {\n\t/** empty */\n}\n\nexport const Dropdown: React.FC<DropdownProps> = ({\n\tplaceHolder,\n\tsize,\n\tonSelect,\n\tdefaultOptions,\n\tdisabled,\n\tsolidDisabled,\n\tnoErrorHint,\n\tplaceHolderHeight,\n\tshowPlaceholderWhenSelected = false,\n\tinputStyle = {},\n\tinputType = 'default',\n\tonDeleteChip,\n\ttruncatedText,\n\tshowLeadingIconInPlaceholder = false,\n\tshowTrailingIconPlaceholder = false,\n\tshowLabelsOnMoreHover = false,\n\tvalue,\n\tshowSelected = false,\n\tonDropdownVisbilityChange,\n\t...openDropdownProps\n}) => {\n\tconst [isDropdownOpened, setDropdownOpenFlag] = useState(false);\n\tconst [isHovering, setIsHovering] = useState(false);\n\tconst sizeToUse = size ?? 'default';\n\tconst dropdownVisibilityRef = useRef<{\n\t\topenDropdown: boolean;\n\t}>();\n\tconst [selectedOption, setSelectedOption] = useState<DropdownOption[]>(\n\t\tdefaultOptions ?? [],\n\t);\n\tfunction handleSelection(option: DropdownOption | DropdownOption[]) {\n\t\tif (Array.isArray(option)) {\n\t\t\tsetSelectedOption([...option]);\n\t\t} else {\n\t\t\tsetSelectedOption([...[option]]);\n\t\t}\n\t\tonSelect?.(option);\n\t}\n\n\tuseEffect(() => {\n\t\tconst flatSelectedOption: SingleOption[] = [];\n\t\topenDropdownProps?.options?.forEach((option) => {\n\t\t\tif ((option as GroupedOption).options) {\n\t\t\t\t(option as GroupedOption).options.forEach((op) => {\n\t\t\t\t\tif (op.selected) {\n\t\t\t\t\t\tflatSelectedOption.push({\n\t\t\t\t\t\t\t...op,\n\t\t\t\t\t\t\tlabel: op.label,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tif ((option as SingleOption).selected) {\n\t\t\t\t\tflatSelectedOption.push(option as SingleOption);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tsetSelectedOption([...flatSelectedOption]);\n\t}, [openDropdownProps.options]);\n\n\tuseEffect(() => {\n\t\tif (defaultOptions) {\n\t\t\tsetSelectedOption([...defaultOptions]);\n\t\t}\n\t}, [defaultOptions]);\n\n\tconst textVal = getSelectedOptionsAsText(selectedOption);\n\tconst displayText = showPlaceholderWhenSelected\n\t\t? placeHolder\n\t\t: textVal ?? placeHolder ?? 'Select an option';\n\n\tconst configuredMaxWidth = openDropdownProps.buttonWidth;\n\n\t// Shared width for the input wrapper and dropdown popover\n\tconst inputWidth = configuredMaxWidth ?? openDropdownProps.width ?? '100%';\n\n\t// Width passed to dropdown popover — matches input box width\n\tconst dropdownWidth = openDropdownProps.dropdownWidth ?? inputWidth;\n\n\treturn (\n\t\t<>\n\t\t\t<InputStyleContext.Provider\n\t\t\t\tvalue={{\n\t\t\t\t\tInputWrapper: {\n\t\t\t\t\t\theight: placeHolderHeight\n\t\t\t\t\t\t\t? placeHolderHeight\n\t\t\t\t\t\t\t: sizeToUse === 'x-small'\n\t\t\t\t\t\t\t? 24\n\t\t\t\t\t\t\t: sizeToUse === 'small'\n\t\t\t\t\t\t\t? 32\n\t\t\t\t\t\t\t: 48,\n\t\t\t\t\t\twidth: inputWidth,\n\t\t\t\t\t\t...(configuredMaxWidth ? { maxWidth: configuredMaxWidth } : {}),\n\t\t\t\t\t\tzIndex: 1,\n\t\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t\tpadding: sizeToUse === 'x-small' ? '4px 8px' : '6px 8px',\n\t\t\t\t\t\tbackgroundColor:\n\t\t\t\t\t\t\tdisabled && solidDisabled\n\t\t\t\t\t\t\t\t? COLORS.background.base\n\t\t\t\t\t\t\t\t: openDropdownProps.version === '3.0'\n\t\t\t\t\t\t\t\t? isDropdownOpened || isHovering\n\t\t\t\t\t\t\t\t\t? COLORS.surface.hovered\n\t\t\t\t\t\t\t\t\t: COLORS.surface.standard\n\t\t\t\t\t\t\t\t: showSelected && value !== undefined\n\t\t\t\t\t\t\t\t? BASE_COLORS.positive['100']\n\t\t\t\t\t\t\t\t: isHovering\n\t\t\t\t\t\t\t\t? COLORS.background.inactive\n\t\t\t\t\t\t\t\t: COLORS.surface.standard,\n\t\t\t\t\t\ttransition: 'background-color 0.3s ease',\n\t\t\t\t\t\t...inputStyle,\n\t\t\t\t\t},\n\t\t\t\t\tinput: {\n\t\t\t\t\t\tminHeight: '100%',\n\t\t\t\t\t\tmaxWidth: '100%',\n\t\t\t\t\t\tcolor:\n\t\t\t\t\t\t\tdisabled && solidDisabled\n\t\t\t\t\t\t\t\t? COLORS.content.secondary\n\t\t\t\t\t\t\t\t: showSelected && value !== undefined\n\t\t\t\t\t\t\t\t? COLORS.content.positive\n\t\t\t\t\t\t\t\t: 'inherit',\n\t\t\t\t\t},\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tonMouseEnter={() => setIsHovering(true)}\n\t\t\t\t\tonMouseLeave={() => setIsHovering(false)}\n\t\t\t\t\tstyle={\n\t\t\t\t\t\topenDropdownProps.width\n\t\t\t\t\t\t\t? { width: openDropdownProps.width }\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<DropdownPopover\n\t\t\t\t\t\tdata-test={openDropdownProps['data-test']}\n\t\t\t\t\t\tref={\n\t\t\t\t\t\t\tdropdownVisibilityRef as Ref<{\n\t\t\t\t\t\t\t\topenDropdown: boolean;\n\t\t\t\t\t\t\t}>\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonSelect={handleSelection}\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\t{...openDropdownProps}\n\t\t\t\t\t\tonDropdownVisbilityChange={(isOpen) => {\n\t\t\t\t\t\t\t// Keep the internal open flag (carat/open styling) AND forward\n\t\t\t\t\t\t\t// to a consumer-provided handler so callers can react to open state.\n\t\t\t\t\t\t\tsetDropdownOpenFlag(isOpen);\n\t\t\t\t\t\t\tonDropdownVisbilityChange?.(isOpen);\n\t\t\t\t\t\t}}\n\t\t\t\t\t\twidth={dropdownWidth}\n\t\t\t\t\t>\n\t\t\t\t\t\t{inputType == 'default' && (\n\t\t\t\t\t\t\t<Input\n\t\t\t\t\t\t\t\tversion={openDropdownProps.version}\n\t\t\t\t\t\t\t\tnoErrorHint={noErrorHint}\n\t\t\t\t\t\t\t\tstate={disabled ? 'disabled' : 'none'}\n\t\t\t\t\t\t\t\tsolidDisabled={solidDisabled}\n\t\t\t\t\t\t\t\tvalue={value === undefined ? displayText : value}\n\t\t\t\t\t\t\t\terrorMessage={openDropdownProps.error}\n\t\t\t\t\t\t\t\tvariant={sizeToUse}\n\t\t\t\t\t\t\t\tplaceholder={placeHolder ?? 'Select an option'}\n\t\t\t\t\t\t\t\tonChangeText={noop}\n\t\t\t\t\t\t\t\tleftIcon={\n\t\t\t\t\t\t\t\t\tshowLeadingIconInPlaceholder && selectedOption[0]?.leadingIcon\n\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\ticon: () => <>{selectedOption[0]?.leadingIcon}</>,\n\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\trightIcon={{\n\t\t\t\t\t\t\t\t\ticon: () => (\n\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{showTrailingIconPlaceholder &&\n\t\t\t\t\t\t\t\t\t\t\t\t(selectedOption[0] as SingleOption)?.trailingIcon}\n\t\t\t\t\t\t\t\t\t\t\t<DownIcon\n\t\t\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\t\t\ttransform: isDropdownOpened\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 'rotate(180deg)'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 'rotate(0deg)',\n\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={noop}\n\t\t\t\t\t\t\t\t\t\t\t\twidth={\n\t\t\t\t\t\t\t\t\t\t\t\t\tsizeToUse === 'x-small'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 16\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: sizeToUse === 'small'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 20\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 24\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\theight={\n\t\t\t\t\t\t\t\t\t\t\t\t\tsizeToUse === 'x-small'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 16\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: sizeToUse === 'small'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 20\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 24\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tcolor={\n\t\t\t\t\t\t\t\t\t\t\t\t\tshowSelected\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? COLORS.content.positive\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: COLORS.content.primary\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\ttruncateText={truncatedText ?? true}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{inputType == 'chip' && (\n\t\t\t\t\t\t\t<ChipInput\n\t\t\t\t\t\t\t\tplaceholder={placeHolder ?? 'Select options'}\n\t\t\t\t\t\t\t\tplaceholderColor={\n\t\t\t\t\t\t\t\t\tdisabled && solidDisabled ? COLORS.content.secondary : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tchips={selectedOption as SingleOption[]}\n\t\t\t\t\t\t\t\tonDeleteChip={(chip) => {\n\t\t\t\t\t\t\t\t\tonDeleteChip?.(chip);\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\terrorMessage={openDropdownProps.error}\n\t\t\t\t\t\t\t\tisDropdownOpened={isDropdownOpened}\n\t\t\t\t\t\t\t\tsizeToUse={sizeToUse}\n\t\t\t\t\t\t\t\tcontainerStyle={{\n\t\t\t\t\t\t\t\t\twidth: openDropdownProps.width ?? '100%',\n\t\t\t\t\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t\t\t\t\t...(disabled && solidDisabled\n\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\tbackgroundColor: COLORS.background.base,\n\t\t\t\t\t\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tshowLabelsOnMoreHover={showLabelsOnMoreHover}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</DropdownPopover>\n\t\t\t\t</div>\n\t\t\t</InputStyleContext.Provider>\n\t\t</>\n\t);\n};\n\nDropdown.displayName = 'Dropdown';\n"],"names":["noop","Dropdown","placeHolder","size","onSelect","defaultOptions","disabled","solidDisabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder","showTrailingIconPlaceholder","showLabelsOnMoreHover","value","showSelected","onDropdownVisbilityChange","openDropdownProps","isDropdownOpened","setDropdownOpenFlag","useState","isHovering","setIsHovering","sizeToUse","dropdownVisibilityRef","useRef","selectedOption","setSelectedOption","handleSelection","option","useEffect","flatSelectedOption","op","textVal","getSelectedOptionsAsText","displayText","configuredMaxWidth","inputWidth","dropdownWidth","jsxDEV","Fragment","InputStyleContext","COLORS","BASE_COLORS","DropdownPopover","isOpen","Input","this","DownIcon","ChipInput","chip"],"mappings":";;;;;;;;;AAwCA,SAASA,IAAO;AAEhB;AAEO,MAAMC,IAAoC,CAAC;AAAA,EACjD,aAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,eAAAC;AAAA,EACA,aAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,6BAAAC,IAA8B;AAAA,EAC9B,YAAAC,IAAa,CAAA;AAAA,EACb,WAAAC,IAAY;AAAA,EACZ,cAAAC;AAAA,EACA,eAAAC;AAAA,EACA,8BAAAC,IAA+B;AAAA,EAC/B,6BAAAC,IAA8B;AAAA,EAC9B,uBAAAC,IAAwB;AAAA,EACxB,OAAAC;AAAA,EACA,cAAAC,IAAe;AAAA,EACf,2BAAAC;AAAA,EACA,GAAGC;AACJ,MAAM;AACL,QAAM,CAACC,GAAkBC,CAAmB,IAAIC,EAAS,EAAK,GACxD,CAACC,GAAYC,CAAa,IAAIF,EAAS,EAAK,GAC5CG,IAAYxB,KAAQ,WACpByB,IAAwBC,EAAA,GAGxB,CAACC,GAAgBC,CAAiB,IAAIP;AAAA,IAC3CnB,KAAkB,CAAA;AAAA,EAAC;AAEpB,WAAS2B,EAAgBC,G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;AAEF;AAEAlD,EAAS,cAAc;"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { jsxDEV as t, Fragment as
|
|
2
|
-
import
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { isFunction as
|
|
5
|
-
import { TitleSmall as
|
|
6
|
-
import { COLORS as
|
|
7
|
-
import
|
|
8
|
-
import { InputStyleContext as
|
|
9
|
-
import { RootContainer as
|
|
10
|
-
import { Button as
|
|
11
|
-
import { Tooltip as
|
|
12
|
-
const
|
|
13
|
-
(e,
|
|
1
|
+
import { jsxDEV as t, Fragment as Ce } from "react/jsx-dev-runtime";
|
|
2
|
+
import Te from "../../assets/icons/info.svg.js";
|
|
3
|
+
import { forwardRef as We, useState as b, useContext as Ue, useRef as Me, useEffect as c } from "react";
|
|
4
|
+
import { isFunction as ne, shouldSanitizeForType as Se, sanitizeUnsafeInput as Le, validateInput as Ee } from "./Input-helper.js";
|
|
5
|
+
import { TitleSmall as He, BodySecondary as _e } from "../TypographyStyle.js";
|
|
6
|
+
import { COLORS as te } from "../../constants/Theme.js";
|
|
7
|
+
import Ae from "../../assets/icons/errorInfo.svg.js";
|
|
8
|
+
import { InputStyleContext as Re } from "./context/InputStyleProvider.js";
|
|
9
|
+
import { RootContainer as Fe, InputFooter as Be, MaxCharStyle as ie, InputWrapper as Oe, IconHolder as re, PrefixHolder as Pe, InputContainer as ze, InputContainerSmall as Ke, InputContainerXSmall as Ve, SuffixHolder as Xe, InputHeader as je } from "./Input.styled.js";
|
|
10
|
+
import { Button as se } from "../button/Button.js";
|
|
11
|
+
import { Tooltip as qe } from "../tooltips/Tooltip.js";
|
|
12
|
+
const Ge = We(
|
|
13
|
+
(e, oe) => {
|
|
14
14
|
const {
|
|
15
15
|
placeholder: T,
|
|
16
16
|
leftIcon: W,
|
|
@@ -21,37 +21,38 @@ const qe = Te(
|
|
|
21
21
|
hintText: S,
|
|
22
22
|
type: a,
|
|
23
23
|
state: x,
|
|
24
|
-
validate:
|
|
24
|
+
validate: ae,
|
|
25
25
|
variant: o,
|
|
26
26
|
button: l,
|
|
27
27
|
suffixText: L,
|
|
28
28
|
prefixText: E,
|
|
29
29
|
onChangeText: H,
|
|
30
30
|
value: d,
|
|
31
|
-
noErrorHint:
|
|
31
|
+
noErrorHint: ue,
|
|
32
32
|
reset: _,
|
|
33
|
-
rangeValidation:
|
|
34
|
-
noKeyDownChange:
|
|
35
|
-
version:
|
|
33
|
+
rangeValidation: le,
|
|
34
|
+
noKeyDownChange: me,
|
|
35
|
+
version: ce,
|
|
36
36
|
noMaxCharCheck: A,
|
|
37
37
|
labelElement: R,
|
|
38
38
|
autoGrow: I,
|
|
39
39
|
minHeight: y,
|
|
40
|
-
maxHeight:
|
|
41
|
-
labelTextBold:
|
|
42
|
-
truncateText:
|
|
40
|
+
maxHeight: pe,
|
|
41
|
+
labelTextBold: de,
|
|
42
|
+
truncateText: he,
|
|
43
43
|
maxCharLimitPosition: F,
|
|
44
44
|
maxCharStyle: B,
|
|
45
|
-
hightlightInputColor:
|
|
45
|
+
hightlightInputColor: ke,
|
|
46
46
|
onKeyDownEvent: O,
|
|
47
|
-
hideInputHeader:
|
|
48
|
-
hideBorder:
|
|
49
|
-
inputWrapperStyles:
|
|
47
|
+
hideInputHeader: ve,
|
|
48
|
+
hideBorder: fe,
|
|
49
|
+
inputWrapperStyles: be,
|
|
50
50
|
minCharsToTrigger: P,
|
|
51
|
-
maxCharAlignment:
|
|
51
|
+
maxCharAlignment: Ne,
|
|
52
52
|
isDisabled: z = !1,
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
solidDisabled: K = !1,
|
|
54
|
+
allowUnsafeInput: xe,
|
|
55
|
+
leftIconStyle: Ie
|
|
55
56
|
} = {
|
|
56
57
|
maxCharLimit: 0,
|
|
57
58
|
type: "text",
|
|
@@ -60,7 +61,7 @@ const qe = Te(
|
|
|
60
61
|
minCharsToTrigger: 0,
|
|
61
62
|
maxCharAlignment: !1,
|
|
62
63
|
...e
|
|
63
|
-
},
|
|
64
|
+
}, V = W?.icon, X = U?.icon, [g, v] = b(!1), [ye, w] = b(!1), [m, j] = b(), q = o === "x-small" ? "12px" : o === "small" ? "18px" : "22px", f = Ue(Re), [G, D] = b(""), ge = Me(null), r = oe ?? ge;
|
|
64
65
|
c(() => {
|
|
65
66
|
D(d || ""), !d && I && (r.current.style.height = y || "48px");
|
|
66
67
|
}, [d]), c(() => {
|
|
@@ -68,70 +69,70 @@ const qe = Te(
|
|
|
68
69
|
}, [r]), c(() => {
|
|
69
70
|
const n = r.current;
|
|
70
71
|
if (n && ["phonenumber", "zip", "number"].includes(a))
|
|
71
|
-
return n.addEventListener("wheel",
|
|
72
|
-
n.removeEventListener("wheel",
|
|
72
|
+
return n.addEventListener("wheel", J, { passive: !1 }), () => {
|
|
73
|
+
n.removeEventListener("wheel", J);
|
|
73
74
|
};
|
|
74
75
|
}, []), c(() => {
|
|
75
76
|
_ && D("");
|
|
76
77
|
}, [_]), c(() => {
|
|
77
78
|
w(!!e.isActive), e.isActive && r.current?.focus();
|
|
78
79
|
}, [e.isActive]), c(() => {
|
|
79
|
-
|
|
80
|
+
j(e.errorMessage);
|
|
80
81
|
}, [e.errorMessage]), c(() => {
|
|
81
82
|
v(!1), (e.state === "invalid" || m || e.state === "disabled-invalid") && v(!0), e.state === "active" && r.current?.focus();
|
|
82
83
|
}, [e.state, m]), c(() => {
|
|
83
84
|
v(!!m || e.state === "invalid");
|
|
84
85
|
}, [m, e.state]);
|
|
85
86
|
const p = (n, ...i) => {
|
|
86
|
-
|
|
87
|
-
},
|
|
88
|
-
const i = s !== 0 ? s :
|
|
89
|
-
O && (!u.length || u.length >= k) && O(n), !
|
|
90
|
-
}, $ = (n) => {
|
|
91
|
-
n.preventDefault();
|
|
87
|
+
ne(n) && n(...i);
|
|
88
|
+
}, Y = () => a === "zip" ? 6 : 2e3, $ = (n) => {
|
|
89
|
+
const i = s !== 0 ? s : Y(), h = [8], k = P, u = n.target.value;
|
|
90
|
+
O && (!u.length || u.length >= k) && O(n), !me && (!u.length || u.length >= k) && H(d || "", n), !A && !h.includes(n.which) && i > 0 && u.length >= i && n.preventDefault();
|
|
92
91
|
}, J = (n) => {
|
|
92
|
+
n.preventDefault();
|
|
93
|
+
}, Q = (n) => {
|
|
93
94
|
let i = n.target.value;
|
|
94
|
-
const h = s !== 0 ? s + 1 :
|
|
95
|
-
if (!
|
|
95
|
+
const h = s !== 0 ? s + 1 : Y(), k = P;
|
|
96
|
+
if (!xe && Se(a) && (i = Le(i)), !A && h > 0 && i.length >= h && (i = i.substring(0, h - 1)), e.textControl || D(i || ""), k && i && i.length < k)
|
|
96
97
|
return;
|
|
97
98
|
H(i, n), I && (r.current.style.height = `${r.current.scrollHeight}px`, i || (r.current.style.height = y || "48px"));
|
|
98
|
-
const u =
|
|
99
|
-
if (!u || !
|
|
99
|
+
const u = ae || Ee;
|
|
100
|
+
if (!u || !ne(u))
|
|
100
101
|
return;
|
|
101
|
-
const [
|
|
102
|
+
const [we, De] = u(
|
|
102
103
|
i,
|
|
103
104
|
a,
|
|
104
|
-
|
|
105
|
+
le
|
|
105
106
|
);
|
|
106
|
-
v(!
|
|
107
|
-
}, Q = (n) => {
|
|
108
|
-
e.skipFocus || w(!0), p(e.onFocus?.(n));
|
|
107
|
+
v(!we), j(e.errorMessage ? e.errorMessage : De);
|
|
109
108
|
}, Z = (n) => {
|
|
109
|
+
e.skipFocus || w(!0), p(e.onFocus?.(n));
|
|
110
|
+
}, ee = (n) => {
|
|
110
111
|
e.skipFocus || w(!1), p(e.onBlur?.(n));
|
|
111
|
-
}, C = () => /* @__PURE__ */ t(
|
|
112
|
+
}, C = () => /* @__PURE__ */ t(Ce, { children: [
|
|
112
113
|
a !== "multiline" && /* @__PURE__ */ t(
|
|
113
114
|
"input",
|
|
114
115
|
{
|
|
115
|
-
className:
|
|
116
|
+
className: he ? "truncate-class" : "",
|
|
116
117
|
"data-test": e["data-test"],
|
|
117
118
|
id: e.id,
|
|
118
119
|
style: f?.input ?? {},
|
|
119
120
|
ref: r,
|
|
120
121
|
disabled: z,
|
|
121
122
|
type: ["phonenumber", "zip", "number"].includes(a) ? "number" : a,
|
|
122
|
-
value:
|
|
123
|
-
onFocus: (n) =>
|
|
124
|
-
onBlur: (n) =>
|
|
123
|
+
value: G,
|
|
124
|
+
onFocus: (n) => Z(n),
|
|
125
|
+
onBlur: (n) => ee(n),
|
|
125
126
|
placeholder: T || "Enter here",
|
|
126
|
-
onChange:
|
|
127
|
+
onChange: Q,
|
|
127
128
|
onClick: (n) => p(e.onClick),
|
|
128
|
-
onKeyDown: (n) =>
|
|
129
|
+
onKeyDown: (n) => $(n)
|
|
129
130
|
},
|
|
130
131
|
void 0,
|
|
131
132
|
!1,
|
|
132
133
|
{
|
|
133
134
|
fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/input/Input.tsx",
|
|
134
|
-
lineNumber:
|
|
135
|
+
lineNumber: 272,
|
|
135
136
|
columnNumber: 7
|
|
136
137
|
},
|
|
137
138
|
void 0
|
|
@@ -140,95 +141,97 @@ const qe = Te(
|
|
|
140
141
|
"textarea",
|
|
141
142
|
{
|
|
142
143
|
"data-test": e["data-test"],
|
|
143
|
-
value:
|
|
144
|
+
value: G,
|
|
144
145
|
ref: r,
|
|
145
|
-
onFocus: (n) =>
|
|
146
|
-
onBlur: (n) =>
|
|
146
|
+
onFocus: (n) => Z(n),
|
|
147
|
+
onBlur: (n) => ee(n),
|
|
147
148
|
onClick: (n) => p(e.onClick),
|
|
148
149
|
disabled: z,
|
|
149
150
|
placeholder: T || "Enter here",
|
|
150
|
-
onChange:
|
|
151
|
-
onKeyDown: (n) =>
|
|
151
|
+
onChange: Q,
|
|
152
|
+
onKeyDown: (n) => $(n),
|
|
152
153
|
maxLength: s > 0 ? s : void 0
|
|
153
154
|
},
|
|
154
155
|
void 0,
|
|
155
156
|
!1,
|
|
156
157
|
{
|
|
157
158
|
fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/input/Input.tsx",
|
|
158
|
-
lineNumber:
|
|
159
|
+
lineNumber: 294,
|
|
159
160
|
columnNumber: 7
|
|
160
161
|
},
|
|
161
162
|
void 0
|
|
162
163
|
)
|
|
163
164
|
] }, void 0, !0, {
|
|
164
165
|
fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/input/Input.tsx",
|
|
165
|
-
lineNumber:
|
|
166
|
+
lineNumber: 270,
|
|
166
167
|
columnNumber: 5
|
|
167
168
|
}, void 0);
|
|
168
169
|
return /* @__PURE__ */ t(
|
|
169
|
-
|
|
170
|
+
Fe,
|
|
170
171
|
{
|
|
171
172
|
width: e.width,
|
|
172
173
|
height: e.height,
|
|
173
174
|
state: x,
|
|
175
|
+
solidDisabled: K,
|
|
174
176
|
type: a,
|
|
175
177
|
style: f?.RootContainer ?? {},
|
|
176
178
|
children: [
|
|
177
179
|
/* @__PURE__ */ t("div", { className: "flex-align-center", children: [
|
|
178
|
-
!
|
|
179
|
-
!!m && /* @__PURE__ */ t(
|
|
180
|
+
!ue && (!!S || !!m) && /* @__PURE__ */ t(Be, { invalid: !!m, children: [
|
|
181
|
+
!!m && /* @__PURE__ */ t(Ae, { width: 16, height: 16 }, void 0, !1, {
|
|
180
182
|
fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/input/Input.tsx",
|
|
181
|
-
lineNumber:
|
|
183
|
+
lineNumber: 324,
|
|
182
184
|
columnNumber: 27
|
|
183
185
|
}, void 0),
|
|
184
186
|
m || S
|
|
185
187
|
] }, void 0, !0, {
|
|
186
188
|
fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/input/Input.tsx",
|
|
187
|
-
lineNumber:
|
|
189
|
+
lineNumber: 323,
|
|
188
190
|
columnNumber: 7
|
|
189
191
|
}, void 0),
|
|
190
|
-
s > 0 && F === "BOTTOM" && /* @__PURE__ */ t(
|
|
192
|
+
s > 0 && F === "BOTTOM" && /* @__PURE__ */ t(ie, { position: "BOTTOM", style: B, children: [
|
|
191
193
|
(d ?? "").toString()?.length ?? 0,
|
|
192
194
|
"/",
|
|
193
195
|
s
|
|
194
196
|
] }, void 0, !0, {
|
|
195
197
|
fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/input/Input.tsx",
|
|
196
|
-
lineNumber:
|
|
198
|
+
lineNumber: 329,
|
|
197
199
|
columnNumber: 7
|
|
198
200
|
}, void 0)
|
|
199
201
|
] }, void 0, !0, {
|
|
200
202
|
fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/input/Input.tsx",
|
|
201
|
-
lineNumber:
|
|
203
|
+
lineNumber: 321,
|
|
202
204
|
columnNumber: 5
|
|
203
205
|
}, void 0),
|
|
204
206
|
/* @__PURE__ */ t(
|
|
205
|
-
|
|
207
|
+
Oe,
|
|
206
208
|
{
|
|
207
209
|
variant: o,
|
|
208
210
|
state: x,
|
|
211
|
+
solidDisabled: K,
|
|
209
212
|
width: e.width,
|
|
210
|
-
isActive: x === "active" ||
|
|
213
|
+
isActive: x === "active" || ye,
|
|
211
214
|
isInvalid: g,
|
|
212
|
-
style: f?.InputWrapper ??
|
|
213
|
-
version:
|
|
215
|
+
style: f?.InputWrapper ?? be ?? {},
|
|
216
|
+
version: ce,
|
|
214
217
|
height: e.height,
|
|
215
|
-
hightlightInputColor:
|
|
216
|
-
hideBorder:
|
|
218
|
+
hightlightInputColor: ke,
|
|
219
|
+
hideBorder: fe,
|
|
217
220
|
children: [
|
|
218
|
-
!!
|
|
219
|
-
|
|
221
|
+
!!V && /* @__PURE__ */ t(
|
|
222
|
+
re,
|
|
220
223
|
{
|
|
221
224
|
variant: o,
|
|
222
|
-
iconSize:
|
|
225
|
+
iconSize: q,
|
|
223
226
|
onClick: () => p(W?.callback),
|
|
224
227
|
isLeft: !0,
|
|
225
228
|
style: {
|
|
226
229
|
...f?.IconHolder ?? {},
|
|
227
|
-
...
|
|
230
|
+
...Ie
|
|
228
231
|
},
|
|
229
|
-
children: /* @__PURE__ */ t(
|
|
232
|
+
children: /* @__PURE__ */ t(V, {}, void 0, !1, {
|
|
230
233
|
fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/input/Input.tsx",
|
|
231
|
-
lineNumber:
|
|
234
|
+
lineNumber: 358,
|
|
232
235
|
columnNumber: 8
|
|
233
236
|
}, void 0)
|
|
234
237
|
},
|
|
@@ -236,23 +239,23 @@ const qe = Te(
|
|
|
236
239
|
!1,
|
|
237
240
|
{
|
|
238
241
|
fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/input/Input.tsx",
|
|
239
|
-
lineNumber:
|
|
242
|
+
lineNumber: 348,
|
|
240
243
|
columnNumber: 7
|
|
241
244
|
},
|
|
242
245
|
void 0
|
|
243
246
|
),
|
|
244
|
-
!!E && /* @__PURE__ */ t(
|
|
247
|
+
!!E && /* @__PURE__ */ t(Pe, { variant: o, children: E }, void 0, !1, {
|
|
245
248
|
fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/input/Input.tsx",
|
|
246
|
-
lineNumber:
|
|
249
|
+
lineNumber: 362,
|
|
247
250
|
columnNumber: 7
|
|
248
251
|
}, void 0),
|
|
249
252
|
o === "default" && /* @__PURE__ */ t(
|
|
250
|
-
|
|
253
|
+
ze,
|
|
251
254
|
{
|
|
252
255
|
height: e.height,
|
|
253
256
|
type: e.type,
|
|
254
257
|
minHeight: y,
|
|
255
|
-
maxHeight:
|
|
258
|
+
maxHeight: pe,
|
|
256
259
|
autoGrow: I,
|
|
257
260
|
children: C()
|
|
258
261
|
},
|
|
@@ -260,31 +263,31 @@ const qe = Te(
|
|
|
260
263
|
!1,
|
|
261
264
|
{
|
|
262
265
|
fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/input/Input.tsx",
|
|
263
|
-
lineNumber:
|
|
266
|
+
lineNumber: 365,
|
|
264
267
|
columnNumber: 7
|
|
265
268
|
},
|
|
266
269
|
void 0
|
|
267
270
|
),
|
|
268
|
-
o === "small" && /* @__PURE__ */ t(
|
|
271
|
+
o === "small" && /* @__PURE__ */ t(Ke, { height: e.height, type: e.type, children: C() }, void 0, !1, {
|
|
269
272
|
fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/input/Input.tsx",
|
|
270
|
-
lineNumber:
|
|
273
|
+
lineNumber: 376,
|
|
271
274
|
columnNumber: 7
|
|
272
275
|
}, void 0),
|
|
273
|
-
o === "x-small" && /* @__PURE__ */ t(
|
|
276
|
+
o === "x-small" && /* @__PURE__ */ t(Ve, { height: e.height, type: e.type, children: C() }, void 0, !1, {
|
|
274
277
|
fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/input/Input.tsx",
|
|
275
|
-
lineNumber:
|
|
278
|
+
lineNumber: 381,
|
|
276
279
|
columnNumber: 7
|
|
277
280
|
}, void 0),
|
|
278
|
-
!!
|
|
279
|
-
|
|
281
|
+
!!X && /* @__PURE__ */ t(
|
|
282
|
+
re,
|
|
280
283
|
{
|
|
281
284
|
variant: o,
|
|
282
|
-
iconSize:
|
|
285
|
+
iconSize: q,
|
|
283
286
|
onClick: () => p(U?.callback),
|
|
284
287
|
isLeft: !1,
|
|
285
|
-
children: /* @__PURE__ */ t(
|
|
288
|
+
children: /* @__PURE__ */ t(X, {}, void 0, !1, {
|
|
286
289
|
fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/input/Input.tsx",
|
|
287
|
-
lineNumber:
|
|
290
|
+
lineNumber: 392,
|
|
288
291
|
columnNumber: 8
|
|
289
292
|
}, void 0)
|
|
290
293
|
},
|
|
@@ -292,18 +295,18 @@ const qe = Te(
|
|
|
292
295
|
!1,
|
|
293
296
|
{
|
|
294
297
|
fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/input/Input.tsx",
|
|
295
|
-
lineNumber:
|
|
298
|
+
lineNumber: 386,
|
|
296
299
|
columnNumber: 7
|
|
297
300
|
},
|
|
298
301
|
void 0
|
|
299
302
|
),
|
|
300
|
-
!!L && /* @__PURE__ */ t(
|
|
303
|
+
!!L && /* @__PURE__ */ t(Xe, { variant: o, children: L }, void 0, !1, {
|
|
301
304
|
fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/input/Input.tsx",
|
|
302
|
-
lineNumber:
|
|
305
|
+
lineNumber: 396,
|
|
303
306
|
columnNumber: 7
|
|
304
307
|
}, void 0),
|
|
305
308
|
l && l.text && /* @__PURE__ */ t(
|
|
306
|
-
|
|
309
|
+
se,
|
|
307
310
|
{
|
|
308
311
|
buttonText: l.text,
|
|
309
312
|
buttonType: l.buttonType,
|
|
@@ -313,14 +316,14 @@ const qe = Te(
|
|
|
313
316
|
!1,
|
|
314
317
|
{
|
|
315
318
|
fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/input/Input.tsx",
|
|
316
|
-
lineNumber:
|
|
319
|
+
lineNumber: 399,
|
|
317
320
|
columnNumber: 7
|
|
318
321
|
},
|
|
319
322
|
void 0
|
|
320
323
|
),
|
|
321
|
-
l && l.buttonProps && /* @__PURE__ */ t(
|
|
324
|
+
l && l.buttonProps && /* @__PURE__ */ t(se, { ...l.buttonProps }, void 0, !1, {
|
|
322
325
|
fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/input/Input.tsx",
|
|
323
|
-
lineNumber:
|
|
326
|
+
lineNumber: 405,
|
|
324
327
|
columnNumber: 39
|
|
325
328
|
}, void 0)
|
|
326
329
|
]
|
|
@@ -329,79 +332,79 @@ const qe = Te(
|
|
|
329
332
|
!0,
|
|
330
333
|
{
|
|
331
334
|
fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/input/Input.tsx",
|
|
332
|
-
lineNumber:
|
|
335
|
+
lineNumber: 334,
|
|
333
336
|
columnNumber: 5
|
|
334
337
|
},
|
|
335
338
|
void 0
|
|
336
339
|
),
|
|
337
|
-
!
|
|
338
|
-
|
|
340
|
+
!ve && (!!N || !!s) && /* @__PURE__ */ t(
|
|
341
|
+
je,
|
|
339
342
|
{
|
|
340
343
|
invalid: g,
|
|
341
|
-
maxCharAlignment:
|
|
344
|
+
maxCharAlignment: Ne,
|
|
342
345
|
children: [
|
|
343
346
|
R && R,
|
|
344
347
|
/* @__PURE__ */ t("div", { className: "label__container", children: [
|
|
345
|
-
|
|
348
|
+
de ? /* @__PURE__ */ t(He, { children: [
|
|
346
349
|
N,
|
|
347
350
|
M ? /* @__PURE__ */ t("span", { children: "*" }, void 0, !1, {
|
|
348
351
|
fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/input/Input.tsx",
|
|
349
|
-
lineNumber:
|
|
352
|
+
lineNumber: 417,
|
|
350
353
|
columnNumber: 24
|
|
351
354
|
}, void 0) : ""
|
|
352
355
|
] }, void 0, !0, {
|
|
353
356
|
fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/input/Input.tsx",
|
|
354
|
-
lineNumber:
|
|
357
|
+
lineNumber: 415,
|
|
355
358
|
columnNumber: 9
|
|
356
|
-
}, void 0) : /* @__PURE__ */ t(
|
|
359
|
+
}, void 0) : /* @__PURE__ */ t(_e, { children: [
|
|
357
360
|
N,
|
|
358
361
|
M ? /* @__PURE__ */ t("span", { children: "*" }, void 0, !1, {
|
|
359
362
|
fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/input/Input.tsx",
|
|
360
|
-
lineNumber:
|
|
363
|
+
lineNumber: 422,
|
|
361
364
|
columnNumber: 24
|
|
362
365
|
}, void 0) : ""
|
|
363
366
|
] }, void 0, !0, {
|
|
364
367
|
fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/input/Input.tsx",
|
|
365
|
-
lineNumber:
|
|
368
|
+
lineNumber: 420,
|
|
366
369
|
columnNumber: 9
|
|
367
370
|
}, void 0),
|
|
368
|
-
e.tooltipText && /* @__PURE__ */ t(
|
|
369
|
-
|
|
371
|
+
e.tooltipText && /* @__PURE__ */ t(qe, { body: e.tooltipText, placement: "top", children: /* @__PURE__ */ t("span", { children: /* @__PURE__ */ t(
|
|
372
|
+
Te,
|
|
370
373
|
{
|
|
371
374
|
style: { marginTop: -3 },
|
|
372
375
|
width: 18,
|
|
373
376
|
height: 18,
|
|
374
|
-
color: g ?
|
|
377
|
+
color: g ? te.content.negative : te.content.primary
|
|
375
378
|
},
|
|
376
379
|
void 0,
|
|
377
380
|
!1,
|
|
378
381
|
{
|
|
379
382
|
fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/input/Input.tsx",
|
|
380
|
-
lineNumber:
|
|
383
|
+
lineNumber: 428,
|
|
381
384
|
columnNumber: 11
|
|
382
385
|
},
|
|
383
386
|
void 0
|
|
384
387
|
) }, void 0, !1, {
|
|
385
388
|
fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/input/Input.tsx",
|
|
386
|
-
lineNumber:
|
|
389
|
+
lineNumber: 427,
|
|
387
390
|
columnNumber: 10
|
|
388
391
|
}, void 0) }, void 0, !1, {
|
|
389
392
|
fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/input/Input.tsx",
|
|
390
|
-
lineNumber:
|
|
393
|
+
lineNumber: 426,
|
|
391
394
|
columnNumber: 9
|
|
392
395
|
}, void 0)
|
|
393
396
|
] }, void 0, !0, {
|
|
394
397
|
fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/input/Input.tsx",
|
|
395
|
-
lineNumber:
|
|
398
|
+
lineNumber: 413,
|
|
396
399
|
columnNumber: 7
|
|
397
400
|
}, void 0),
|
|
398
|
-
s > 0 && F === "TOP" && /* @__PURE__ */ t(
|
|
401
|
+
s > 0 && F === "TOP" && /* @__PURE__ */ t(ie, { style: B, children: [
|
|
399
402
|
(d ?? "").toString()?.length ?? 0,
|
|
400
403
|
"/",
|
|
401
404
|
s
|
|
402
405
|
] }, void 0, !0, {
|
|
403
406
|
fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/input/Input.tsx",
|
|
404
|
-
lineNumber:
|
|
407
|
+
lineNumber: 443,
|
|
405
408
|
columnNumber: 8
|
|
406
409
|
}, void 0)
|
|
407
410
|
]
|
|
@@ -410,7 +413,7 @@ const qe = Te(
|
|
|
410
413
|
!0,
|
|
411
414
|
{
|
|
412
415
|
fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/input/Input.tsx",
|
|
413
|
-
lineNumber:
|
|
416
|
+
lineNumber: 408,
|
|
414
417
|
columnNumber: 6
|
|
415
418
|
},
|
|
416
419
|
void 0
|
|
@@ -421,15 +424,15 @@ const qe = Te(
|
|
|
421
424
|
!0,
|
|
422
425
|
{
|
|
423
426
|
fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/input/Input.tsx",
|
|
424
|
-
lineNumber:
|
|
427
|
+
lineNumber: 313,
|
|
425
428
|
columnNumber: 4
|
|
426
429
|
},
|
|
427
430
|
void 0
|
|
428
431
|
);
|
|
429
432
|
}
|
|
430
433
|
);
|
|
431
|
-
|
|
434
|
+
Ge.displayName = "Input";
|
|
432
435
|
export {
|
|
433
|
-
|
|
436
|
+
Ge as Input
|
|
434
437
|
};
|
|
435
438
|
//# sourceMappingURL=Input.js.map
|