@bikdotai/bik-component-library 0.0.838-beta.0 → 0.0.838-beta.2
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/bik-layout/CommonStyles.js +6 -4
- package/dist/cjs/components/bik-layout/CommonStyles.js.map +1 -1
- package/dist/cjs/components/button/themes.js +1 -1
- package/dist/cjs/components/button/themes.js.map +1 -1
- package/dist/cjs/components/datePicker/DatePicker.js +1 -1
- package/dist/cjs/components/datePicker/DatePicker.js.map +1 -1
- package/dist/cjs/components/datePicker/DatePicker.styled.js +14 -20
- package/dist/cjs/components/datePicker/DatePicker.styled.js.map +1 -1
- package/dist/cjs/components/dropdown/ChipInput.js +1 -1
- package/dist/cjs/components/dropdown/ChipInput.js.map +1 -1
- package/dist/cjs/components/dropdown/Common.styled.js +5 -6
- package/dist/cjs/components/dropdown/Common.styled.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/ChipInput.js +1 -1
- package/dist/cjs/components/input/ChipInput.js.map +1 -1
- package/dist/cjs/components/input/Input-helper.js +1 -1
- package/dist/cjs/components/input/Input-helper.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 +12 -25
- package/dist/cjs/components/input/Input.styled.js.map +1 -1
- package/dist/cjs/components/plans/SubscriptionPlanSelector.js +5 -5
- package/dist/cjs/components/plans/SubscriptionPlanSelector.js.map +1 -1
- package/dist/cjs/components/tabs/Tabs.js +1 -1
- package/dist/cjs/components/tabs/Tabs.js.map +1 -1
- package/dist/cjs/components/tabs/Tabs.styles.js +8 -22
- package/dist/cjs/components/tabs/Tabs.styles.js.map +1 -1
- package/dist/cjs/components/tag/Tag.js +1 -1
- package/dist/cjs/components/tag/Tag.js.map +1 -1
- package/dist/cjs/components/tag/Tag.styled.js +0 -4
- package/dist/cjs/components/tag/Tag.styled.js.map +1 -1
- package/dist/cjs/components/tag/model.js.map +1 -1
- package/dist/cjs/editor/BikEditor.utils.js +3 -3
- package/dist/cjs/editor/BikEditor.utils.js.map +1 -1
- package/dist/cjs/editor/extensions/buildExtensions.js +2 -2
- package/dist/cjs/editor/extensions/buildExtensions.js.map +1 -1
- package/dist/cjs/helpers/sanitize.js +2 -0
- package/dist/cjs/helpers/sanitize.js.map +1 -0
- package/dist/cjs/index.js +1 -1
- package/dist/esm/components/bik-layout/CommonStyles.js +3 -1
- package/dist/esm/components/bik-layout/CommonStyles.js.map +1 -1
- package/dist/esm/components/button/themes.js +1 -1
- package/dist/esm/components/button/themes.js.map +1 -1
- package/dist/esm/components/datePicker/DatePicker.js +21 -22
- package/dist/esm/components/datePicker/DatePicker.js.map +1 -1
- package/dist/esm/components/datePicker/DatePicker.styled.d.ts +0 -10
- package/dist/esm/components/datePicker/DatePicker.styled.js +16 -23
- package/dist/esm/components/datePicker/DatePicker.styled.js.map +1 -1
- package/dist/esm/components/dropdown/ChipInput.d.ts +0 -1
- package/dist/esm/components/dropdown/ChipInput.js +40 -40
- package/dist/esm/components/dropdown/ChipInput.js.map +1 -1
- package/dist/esm/components/dropdown/Common.styled.js +6 -7
- package/dist/esm/components/dropdown/Common.styled.js.map +1 -1
- package/dist/esm/components/dropdown/Dropdown.d.ts +0 -2
- package/dist/esm/components/dropdown/Dropdown.js +88 -95
- package/dist/esm/components/dropdown/Dropdown.js.map +1 -1
- package/dist/esm/components/input/ChipInput.js +41 -40
- package/dist/esm/components/input/ChipInput.js.map +1 -1
- package/dist/esm/components/input/Input-helper.d.ts +7 -0
- package/dist/esm/components/input/Input-helper.js +16 -25
- package/dist/esm/components/input/Input-helper.js.map +1 -1
- package/dist/esm/components/input/Input.js +108 -109
- package/dist/esm/components/input/Input.js.map +1 -1
- package/dist/esm/components/input/Input.model.d.ts +1 -2
- package/dist/esm/components/input/Input.styled.d.ts +0 -2
- package/dist/esm/components/input/Input.styled.js +25 -38
- package/dist/esm/components/input/Input.styled.js.map +1 -1
- package/dist/esm/components/plans/SubscriptionPlanSelector.js +42 -40
- package/dist/esm/components/plans/SubscriptionPlanSelector.js.map +1 -1
- package/dist/esm/components/tabs/Tabs.js +81 -103
- package/dist/esm/components/tabs/Tabs.js.map +1 -1
- package/dist/esm/components/tabs/Tabs.model.d.ts +0 -7
- package/dist/esm/components/tabs/Tabs.styles.d.ts +0 -2
- package/dist/esm/components/tabs/Tabs.styles.js +9 -23
- package/dist/esm/components/tabs/Tabs.styles.js.map +1 -1
- package/dist/esm/components/tag/Tag.d.ts +1 -1
- package/dist/esm/components/tag/Tag.js +15 -17
- package/dist/esm/components/tag/Tag.js.map +1 -1
- package/dist/esm/components/tag/Tag.styled.d.ts +0 -1
- package/dist/esm/components/tag/Tag.styled.js +6 -10
- package/dist/esm/components/tag/Tag.styled.js.map +1 -1
- package/dist/esm/components/tag/model.d.ts +0 -5
- package/dist/esm/components/tag/model.js.map +1 -1
- package/dist/esm/editor/BikEditor.utils.js +45 -44
- package/dist/esm/editor/BikEditor.utils.js.map +1 -1
- package/dist/esm/editor/extensions/buildExtensions.js +34 -30
- package/dist/esm/editor/extensions/buildExtensions.js.map +1 -1
- package/dist/esm/helpers/index.d.ts +1 -0
- package/dist/esm/helpers/sanitize.d.ts +26 -0
- package/dist/esm/helpers/sanitize.js +123 -0
- package/dist/esm/helpers/sanitize.js.map +1 -0
- package/dist/esm/index.js +123 -114
- package/dist/esm/index.js.map +1 -1
- package/package.json +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChipInput.js","sources":["../../../../src/components/input/ChipInput.tsx"],"sourcesContent":["import React, { KeyboardEvent, useRef, useState } from 'react';\nimport { COLORS } from '@src/constants/Theme';\nimport { BodyCaption, BodySecondary } from '../TypographyStyle';\nimport {\n\tgetChipRemoveStyle,\n\tgetChipStyle,\n\tgetContainerHoverStyle,\n\tgetContainerStyle,\n\tgetInputStyle,\n} from './ChipInput.styled';\n\nexport const extractSingleValueIfAny = (nativeID: string) =>\n\t(document?.querySelector(`#${nativeID} input`) as HTMLInputElement)?.value;\n\nexport const getInputNode = (nativeID: string) =>\n\tdocument?.querySelector(`#${nativeID} input`) as HTMLInputElement;\n\nexport interface ChipInputProps {\n\tonChipsChange: (chips: (string | number)[]) => void;\n\tplaceholder: string;\n\tlabel?: string;\n\tlabelColor?: string;\n\thintText?: string;\n\thintTextColor?: string;\n\tchipTheme?: () => void;\n\tchips: string[];\n\terror?: string;\n\tinputHeight?: number;\n\tcreateChipKeys?: (string | number)[];\n\tchipsContainerCustomStyle?: React.CSSProperties;\n\tnativeID?: string;\n}\n\nconst ChipInput: React.FC<ChipInputProps> = ({\n\tonChipsChange,\n\tplaceholder,\n\tchips,\n\tlabel,\n\tlabelColor,\n\thintText,\n\thintTextColor,\n\terror,\n\tinputHeight,\n\tcreateChipKeys,\n\tchipsContainerCustomStyle,\n\tnativeID,\n}) => {\n\tconst [inputValue, setInputValue] = useState('');\n\tconst [focused, setFocused] = useState(false);\n\tconst inputRef = useRef<HTMLInputElement>(null);\n\n\t// Default chip creation keys: comma (188), enter (13)\n\tconst defaultKeys = [',', 188, 'Enter', 13];\n\tconst chipKeys = createChipKeys || defaultKeys;\n\n\tconst handleKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {\n\t\tconst shouldCreateChip =\n\t\t\tchipKeys.includes(e.key) ||\n\t\t\tchipKeys.includes(e.keyCode) ||\n\t\t\tchipKeys.includes(e.which);\n\n\t\tif (shouldCreateChip) {\n\t\t\te.preventDefault();\n\t\t\tconst trimmedValue = inputValue.trim();\n\t\t\tif (trimmedValue && !chips.includes(trimmedValue)) {\n\t\t\t\tonChipsChange([...chips, trimmedValue]);\n\t\t\t\tsetInputValue('');\n\t\t\t}\n\t\t} else if (e.key === 'Backspace' && inputValue === '' && chips.length > 0) {\n\t\t\t// Remove last chip on backspace when input is empty\n\t\t\tonChipsChange(chips.slice(0, -1));\n\t\t}\n\t};\n\n\tconst handleRemoveChip = (indexToRemove: number) => {\n\t\tonChipsChange(chips.filter((_, index) => index !== indexToRemove));\n\t};\n\n\tconst handleFocus = () => {\n\t\tsetFocused(true);\n\t};\n\n\tconst handleBlur = () => {\n\t\tsetFocused(false);\n\t\t// Optionally create chip on blur if there's a value\n\t\tconst trimmedValue = inputValue.trim();\n\t\tif (trimmedValue && !chips.includes(trimmedValue)) {\n\t\t\tonChipsChange([...chips, trimmedValue]);\n\t\t\tsetInputValue('');\n\t\t}\n\t};\n\n\tconst handleContainerClick = () => {\n\t\tinputRef.current?.focus();\n\t};\n\n\tconst containerStyle = getContainerStyle(\n\t\t!!error,\n\t\tinputHeight,\n\t\tchipsContainerCustomStyle,\n\t\tfocused,\n\t);\n\tconst containerHoverStyle = focused ? {} : getContainerHoverStyle();\n\tconst chipStyle = getChipStyle();\n\tconst chipRemoveStyle = getChipRemoveStyle();\n\tconst inputStyle = getInputStyle(inputHeight);\n\n\treturn (\n\t\t<div\n\t\t\tstyle={{ display: 'flex', flexDirection: 'column', gap: 8 }}\n\t\t\tid={nativeID}\n\t\t>\n\t\t\t{label && (\n\t\t\t\t<BodySecondary\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tcolor: focused\n\t\t\t\t\t\t\t? COLORS.content.brand\n\t\t\t\t\t\t\t: error\n\t\t\t\t\t\t\t? COLORS.content.negative\n\t\t\t\t\t\t\t: labelColor || COLORS.content.primary,\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{label}\n\t\t\t\t</BodySecondary>\n\t\t\t)}\n\t\t\t<div\n\t\t\t\tstyle={containerStyle}\n\t\t\t\tonClick={handleContainerClick}\n\t\t\t\tonMouseEnter={(e) => {\n\t\t\t\t\tif (!focused) {\n\t\t\t\t\t\tObject.assign(e.currentTarget.style, containerHoverStyle);\n\t\t\t\t\t}\n\t\t\t\t}}\n\t\t\t\tonMouseLeave={(e) => {\n\t\t\t\t\tif (!focused) {\n\t\t\t\t\t\te.currentTarget.style.border = `1px solid ${\n\t\t\t\t\t\t\terror ? COLORS.stroke.negative.vibrant : COLORS.stroke.primary\n\t\t\t\t\t\t}`;\n\t\t\t\t\t}\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{chips.map((chip, index) => (\n\t\t\t\t\t<div key={index} style={chipStyle}>\n\t\t\t\t\t\t<span>{chip}</span>\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\tstyle={chipRemoveStyle}\n\t\t\t\t\t\t\tonClick={(e) => {\n\t\t\t\t\t\t\t\te.stopPropagation();\n\t\t\t\t\t\t\t\thandleRemoveChip(index);\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tonMouseEnter={(e) => {\n\t\t\t\t\t\t\t\te.currentTarget.style.color = COLORS.content.secondary;\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tonMouseLeave={(e) => {\n\t\t\t\t\t\t\t\te.currentTarget.style.color = COLORS.content.secondary;\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\taria-label={`Remove ${chip}`}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t×\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\t\t\t\t))}\n\t\t\t\t<input\n\t\t\t\t\tref={inputRef}\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\tvalue={inputValue}\n\t\t\t\t\tonChange={(e) => setInputValue(e.target.value)}\n\t\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t\t\tonFocus={handleFocus}\n\t\t\t\t\tonBlur={handleBlur}\n\t\t\t\t\tplaceholder={\n\t\t\t\t\t\tchips.length === 0 && !!placeholder && !focused\n\t\t\t\t\t\t\t? placeholder\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t\tstyle={inputStyle}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t{(!!hintText || !!error) && (\n\t\t\t\t<BodyCaption\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tcolor: error\n\t\t\t\t\t\t\t? COLORS.content.negative\n\t\t\t\t\t\t\t: hintTextColor || COLORS.content.secondary,\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{error ? error : hintText}\n\t\t\t\t</BodyCaption>\n\t\t\t)}\n\t\t</div>\n\t);\n};\n\nexport default ChipInput;\n"],"names":["ChipInput","onChipsChange","placeholder","chips","label","labelColor","hintText","hintTextColor","error","inputHeight","createChipKeys","chipsContainerCustomStyle","nativeID","inputValue","setInputValue","useState","focused","setFocused","inputRef","useRef","chipKeys","handleKeyDown","trimmedValue","handleRemoveChip","indexToRemove","_","index","handleFocus","handleBlur","handleContainerClick","containerStyle","getContainerStyle","containerHoverStyle","getContainerHoverStyle","chipStyle","getChipStyle","chipRemoveStyle","getChipRemoveStyle","inputStyle","getInputStyle","jsxs","jsx","BodySecondary","COLORS","chip","e","BodyCaption"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ChipInput.js","sources":["../../../../src/components/input/ChipInput.tsx"],"sourcesContent":["import React, { KeyboardEvent, useRef, useState } from 'react';\nimport { COLORS } from '@src/constants/Theme';\nimport { stripHtmlTags } from '../../helpers/sanitize';\nimport { BodyCaption, BodySecondary } from '../TypographyStyle';\nimport {\n\tgetChipRemoveStyle,\n\tgetChipStyle,\n\tgetContainerHoverStyle,\n\tgetContainerStyle,\n\tgetInputStyle,\n} from './ChipInput.styled';\n\nexport const extractSingleValueIfAny = (nativeID: string) =>\n\t(document?.querySelector(`#${nativeID} input`) as HTMLInputElement)?.value;\n\nexport const getInputNode = (nativeID: string) =>\n\tdocument?.querySelector(`#${nativeID} input`) as HTMLInputElement;\n\nexport interface ChipInputProps {\n\tonChipsChange: (chips: (string | number)[]) => void;\n\tplaceholder: string;\n\tlabel?: string;\n\tlabelColor?: string;\n\thintText?: string;\n\thintTextColor?: string;\n\tchipTheme?: () => void;\n\tchips: string[];\n\terror?: string;\n\tinputHeight?: number;\n\tcreateChipKeys?: (string | number)[];\n\tchipsContainerCustomStyle?: React.CSSProperties;\n\tnativeID?: string;\n}\n\nconst ChipInput: React.FC<ChipInputProps> = ({\n\tonChipsChange,\n\tplaceholder,\n\tchips,\n\tlabel,\n\tlabelColor,\n\thintText,\n\thintTextColor,\n\terror,\n\tinputHeight,\n\tcreateChipKeys,\n\tchipsContainerCustomStyle,\n\tnativeID,\n}) => {\n\tconst [inputValue, setInputValue] = useState('');\n\tconst [focused, setFocused] = useState(false);\n\tconst inputRef = useRef<HTMLInputElement>(null);\n\n\t// Default chip creation keys: comma (188), enter (13)\n\tconst defaultKeys = [',', 188, 'Enter', 13];\n\tconst chipKeys = createChipKeys || defaultKeys;\n\n\tconst handleKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {\n\t\tconst shouldCreateChip =\n\t\t\tchipKeys.includes(e.key) ||\n\t\t\tchipKeys.includes(e.keyCode) ||\n\t\t\tchipKeys.includes(e.which);\n\n\t\tif (shouldCreateChip) {\n\t\t\te.preventDefault();\n\t\t\tconst trimmedValue = inputValue.trim();\n\t\t\tif (trimmedValue && !chips.includes(trimmedValue)) {\n\t\t\t\tonChipsChange([...chips, trimmedValue]);\n\t\t\t\tsetInputValue('');\n\t\t\t}\n\t\t} else if (e.key === 'Backspace' && inputValue === '' && chips.length > 0) {\n\t\t\t// Remove last chip on backspace when input is empty\n\t\t\tonChipsChange(chips.slice(0, -1));\n\t\t}\n\t};\n\n\tconst handleRemoveChip = (indexToRemove: number) => {\n\t\tonChipsChange(chips.filter((_, index) => index !== indexToRemove));\n\t};\n\n\tconst handleFocus = () => {\n\t\tsetFocused(true);\n\t};\n\n\tconst handleBlur = () => {\n\t\tsetFocused(false);\n\t\t// Optionally create chip on blur if there's a value\n\t\tconst trimmedValue = inputValue.trim();\n\t\tif (trimmedValue && !chips.includes(trimmedValue)) {\n\t\t\tonChipsChange([...chips, trimmedValue]);\n\t\t\tsetInputValue('');\n\t\t}\n\t};\n\n\tconst handleContainerClick = () => {\n\t\tinputRef.current?.focus();\n\t};\n\n\tconst containerStyle = getContainerStyle(\n\t\t!!error,\n\t\tinputHeight,\n\t\tchipsContainerCustomStyle,\n\t\tfocused,\n\t);\n\tconst containerHoverStyle = focused ? {} : getContainerHoverStyle();\n\tconst chipStyle = getChipStyle();\n\tconst chipRemoveStyle = getChipRemoveStyle();\n\tconst inputStyle = getInputStyle(inputHeight);\n\n\treturn (\n\t\t<div\n\t\t\tstyle={{ display: 'flex', flexDirection: 'column', gap: 8 }}\n\t\t\tid={nativeID}\n\t\t>\n\t\t\t{label && (\n\t\t\t\t<BodySecondary\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tcolor: focused\n\t\t\t\t\t\t\t? COLORS.content.brand\n\t\t\t\t\t\t\t: error\n\t\t\t\t\t\t\t? COLORS.content.negative\n\t\t\t\t\t\t\t: labelColor || COLORS.content.primary,\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{label}\n\t\t\t\t</BodySecondary>\n\t\t\t)}\n\t\t\t<div\n\t\t\t\tstyle={containerStyle}\n\t\t\t\tonClick={handleContainerClick}\n\t\t\t\tonMouseEnter={(e) => {\n\t\t\t\t\tif (!focused) {\n\t\t\t\t\t\tObject.assign(e.currentTarget.style, containerHoverStyle);\n\t\t\t\t\t}\n\t\t\t\t}}\n\t\t\t\tonMouseLeave={(e) => {\n\t\t\t\t\tif (!focused) {\n\t\t\t\t\t\te.currentTarget.style.border = `1px solid ${\n\t\t\t\t\t\t\terror ? COLORS.stroke.negative.vibrant : COLORS.stroke.primary\n\t\t\t\t\t\t}`;\n\t\t\t\t\t}\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{chips.map((chip, index) => (\n\t\t\t\t\t<div key={index} style={chipStyle}>\n\t\t\t\t\t\t<span>{chip}</span>\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\tstyle={chipRemoveStyle}\n\t\t\t\t\t\t\tonClick={(e) => {\n\t\t\t\t\t\t\t\te.stopPropagation();\n\t\t\t\t\t\t\t\thandleRemoveChip(index);\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tonMouseEnter={(e) => {\n\t\t\t\t\t\t\t\te.currentTarget.style.color = COLORS.content.secondary;\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tonMouseLeave={(e) => {\n\t\t\t\t\t\t\t\te.currentTarget.style.color = COLORS.content.secondary;\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\taria-label={`Remove ${chip}`}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t×\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\t\t\t\t))}\n\t\t\t\t<input\n\t\t\t\t\tref={inputRef}\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\tvalue={inputValue}\n\t\t\t\t\tonChange={(e) => setInputValue(stripHtmlTags(e.target.value))}\n\t\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t\t\tonFocus={handleFocus}\n\t\t\t\t\tonBlur={handleBlur}\n\t\t\t\t\tplaceholder={\n\t\t\t\t\t\tchips.length === 0 && !!placeholder && !focused\n\t\t\t\t\t\t\t? placeholder\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t\tstyle={inputStyle}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t{(!!hintText || !!error) && (\n\t\t\t\t<BodyCaption\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tcolor: error\n\t\t\t\t\t\t\t? COLORS.content.negative\n\t\t\t\t\t\t\t: hintTextColor || COLORS.content.secondary,\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{error ? error : hintText}\n\t\t\t\t</BodyCaption>\n\t\t\t)}\n\t\t</div>\n\t);\n};\n\nexport default ChipInput;\n"],"names":["ChipInput","onChipsChange","placeholder","chips","label","labelColor","hintText","hintTextColor","error","inputHeight","createChipKeys","chipsContainerCustomStyle","nativeID","inputValue","setInputValue","useState","focused","setFocused","inputRef","useRef","chipKeys","handleKeyDown","trimmedValue","handleRemoveChip","indexToRemove","_","index","handleFocus","handleBlur","handleContainerClick","containerStyle","getContainerStyle","containerHoverStyle","getContainerHoverStyle","chipStyle","getChipStyle","chipRemoveStyle","getChipRemoveStyle","inputStyle","getInputStyle","jsxs","jsx","BodySecondary","COLORS","chip","e","stripHtmlTags","BodyCaption"],"mappings":"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"}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { InputTypeI } from './Input.model';
|
|
2
2
|
export declare const isFunction: (fn: any) => boolean;
|
|
3
|
+
/**
|
|
4
|
+
* Strip any HTML markup from a plain-text input value. Backed by DOMPurify
|
|
5
|
+
* (parser-based, immune to the malformed-tag bypasses a regex misses); on the
|
|
6
|
+
* server DOMPurify is unavailable so a regex tag-strip is used as a fallback.
|
|
7
|
+
* Text characters like `<` / `>` in ordinary content are preserved because
|
|
8
|
+
* DOMPurify keeps text content and only removes recognised tags.
|
|
9
|
+
*/
|
|
3
10
|
export declare const sanitizeUnsafeInput: (input: string) => string;
|
|
4
11
|
export declare const shouldSanitizeForType: (type: InputTypeI) => boolean;
|
|
5
12
|
export declare const validateInput: (inputText: string | number, type: InputTypeI, rangeValidation?: {
|
|
@@ -1,48 +1,39 @@
|
|
|
1
|
-
import { phone as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
return t;
|
|
5
|
-
let e = t.replace(u, "");
|
|
6
|
-
e = e.replace(m, "");
|
|
7
|
-
let n;
|
|
8
|
-
do
|
|
9
|
-
n = e, e = e.replace(c, "$1");
|
|
10
|
-
while (e !== n);
|
|
11
|
-
return e;
|
|
12
|
-
}, o = [
|
|
1
|
+
import { phone as s } from "phone";
|
|
2
|
+
import { stripHtmlTags as a } from "../../helpers/sanitize.js";
|
|
3
|
+
const c = (e) => e && typeof e == "function", d = (e) => e && a(e), m = [
|
|
13
4
|
"text",
|
|
14
5
|
"multiline",
|
|
15
6
|
"email",
|
|
16
7
|
"url",
|
|
17
8
|
"password"
|
|
18
|
-
],
|
|
9
|
+
], h = (e) => m.includes(e), E = (e, t, n = {}) => {
|
|
19
10
|
let l;
|
|
20
|
-
const
|
|
11
|
+
const u = ["phonenumber", "zip", "number"].includes(t), r = u ? e ? Number(e) : null : e;
|
|
21
12
|
if (r == null || r === "")
|
|
22
13
|
return [!0, ""];
|
|
23
|
-
if (
|
|
14
|
+
if (u && String(r).length && (n.min && r < n.min || n.max && r > n.max))
|
|
24
15
|
return [
|
|
25
16
|
!1,
|
|
26
17
|
`Enter valid number between ${n.min} and ${n.max}`
|
|
27
18
|
];
|
|
28
|
-
if (
|
|
19
|
+
if (t === "email")
|
|
29
20
|
return l = /(.+)@(.+){2,}\.(.+){2,}/, r.match(l) ? [!0, ""] : [!1, "Enter a valid email id"];
|
|
30
|
-
if (
|
|
21
|
+
if (t === "url")
|
|
31
22
|
return l = /^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$/, r.match(l) ? [!0, ""] : [!1, "Enter a valid url"];
|
|
32
|
-
if (
|
|
23
|
+
if (t === "number")
|
|
33
24
|
return r >= 0 ? [!0, ""] : [!1, "Enter a valid number"];
|
|
34
|
-
if (
|
|
25
|
+
if (t === "zip")
|
|
35
26
|
return String(r).trim().length === 6 ? [!0, ""] : [!1, "Enter a valid zip code"];
|
|
36
|
-
if (
|
|
37
|
-
const { isValid: i } =
|
|
27
|
+
if (t === "phonenumber") {
|
|
28
|
+
const { isValid: i } = s("+" + String(r));
|
|
38
29
|
return i ? [!0, ""] : [!1, "Enter a valid phonenumber"];
|
|
39
30
|
} else
|
|
40
31
|
return r?.trim().length > 0 ? [!0, ""] : [!1, "Enter a valid data"];
|
|
41
32
|
};
|
|
42
33
|
export {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
34
|
+
c as isFunction,
|
|
35
|
+
d as sanitizeUnsafeInput,
|
|
36
|
+
h as shouldSanitizeForType,
|
|
37
|
+
E as validateInput
|
|
47
38
|
};
|
|
48
39
|
//# sourceMappingURL=Input-helper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input-helper.js","sources":["../../../../src/components/input/Input-helper.ts"],"sourcesContent":["import { phone } from 'phone';\nimport { InputTypeI } from './Input.model';\n\nexport const isFunction = (fn): boolean => {\n\treturn fn && typeof fn === 'function';\n};\n\
|
|
1
|
+
{"version":3,"file":"Input-helper.js","sources":["../../../../src/components/input/Input-helper.ts"],"sourcesContent":["import { phone } from 'phone';\nimport { stripHtmlTags } from '../../helpers/sanitize';\nimport { InputTypeI } from './Input.model';\n\nexport const isFunction = (fn): boolean => {\n\treturn fn && typeof fn === 'function';\n};\n\n/**\n * Strip any HTML markup from a plain-text input value. Backed by DOMPurify\n * (parser-based, immune to the malformed-tag bypasses a regex misses); on the\n * server DOMPurify is unavailable so a regex tag-strip is used as a fallback.\n * Text characters like `<` / `>` in ordinary content are preserved because\n * DOMPurify keeps text content and only removes recognised tags.\n */\nexport const sanitizeUnsafeInput = (input: string): string => {\n\tif (!input) {\n\t\treturn input;\n\t}\n\treturn stripHtmlTags(input);\n};\n\nconst SANITIZED_INPUT_TYPES: InputTypeI[] = [\n\t'text',\n\t'multiline',\n\t'email',\n\t'url',\n\t'password',\n];\n\nexport const shouldSanitizeForType = (type: InputTypeI): boolean =>\n\tSANITIZED_INPUT_TYPES.includes(type);\n\nexport const validateInput = (\n\tinputText: string | number,\n\ttype: InputTypeI,\n\trangeValidation: { min?: number; max?: number } = {},\n): [boolean, string] => {\n\tlet regex;\n\n\tconst NUMBER_TYPE = ['phonenumber', 'zip', 'number'].includes(type);\n\n\tconst input = NUMBER_TYPE\n\t\t? inputText\n\t\t\t? Number(inputText)\n\t\t\t: null\n\t\t: inputText;\n\n\tif (input === null || input === undefined || input === '') {\n\t\treturn [true, ''];\n\t}\n\n\tif (\n\t\tNUMBER_TYPE &&\n\t\t!!String(input).length &&\n\t\t((!!rangeValidation.min &&\n\t\t\t(input as unknown as number) < rangeValidation.min) ||\n\t\t\t(!!rangeValidation.max &&\n\t\t\t\t(input as unknown as number) > rangeValidation.max))\n\t) {\n\t\treturn [\n\t\t\tfalse,\n\t\t\t`Enter valid number between ${rangeValidation.min} and ${rangeValidation.max}`,\n\t\t];\n\t}\n\n\tif (type === 'email') {\n\t\tregex = /(.+)@(.+){2,}\\.(.+){2,}/;\n\t\treturn (input as string).match(regex)\n\t\t\t? [true, '']\n\t\t\t: [false, 'Enter a valid email id'];\n\t} else if (type === 'url') {\n\t\tregex =\n\t\t\t/^https?:\\/\\/(?:www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b(?:[-a-zA-Z0-9()@:%_\\+.~#?&\\/=]*)$/;\n\t\treturn (input as string).match(regex)\n\t\t\t? [true, '']\n\t\t\t: [false, 'Enter a valid url'];\n\t} else if (type === 'number') {\n\t\treturn input >= 0 ? [true, ''] : [false, 'Enter a valid number'];\n\t} else if (type === 'zip') {\n\t\treturn String(input).trim().length === 6\n\t\t\t? [true, '']\n\t\t\t: [false, 'Enter a valid zip code'];\n\t} else if (type === 'phonenumber') {\n\t\tconst { isValid } = phone('+' + String(input));\n\t\treturn isValid ? [true, ''] : [false, 'Enter a valid phonenumber'];\n\t} else {\n\t\treturn (input as string)?.trim().length > 0\n\t\t\t? [true, '']\n\t\t\t: [false, 'Enter a valid data'];\n\t}\n\treturn [false, 'Enter a valid data'];\n};\n"],"names":["isFunction","fn","sanitizeUnsafeInput","input","stripHtmlTags","SANITIZED_INPUT_TYPES","shouldSanitizeForType","type","validateInput","inputText","rangeValidation","regex","NUMBER_TYPE","isValid","phone"],"mappings":";;AAIO,MAAMA,IAAa,CAACC,MACnBA,KAAM,OAAOA,KAAO,YAUfC,IAAsB,CAACC,MAC9BA,KAGEC,EAAcD,CAAK,GAGrBE,IAAsC;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAEaC,IAAwB,CAACC,MACrCF,EAAsB,SAASE,CAAI,GAEvBC,IAAgB,CAC5BC,GACAF,GACAG,IAAkD,CAAA,MAC3B;AACvB,MAAIC;AAEJ,QAAMC,IAAc,CAAC,eAAe,OAAO,QAAQ,EAAE,SAASL,CAAI,GAE5DJ,IAAQS,IACXH,IACC,OAAOA,CAAS,IAChB,OACDA;AAEH,MAAIN,KAAU,QAA+BA,MAAU;AACtD,WAAO,CAAC,IAAM,EAAE;AAGjB,MACCS,KACE,OAAOT,CAAK,EAAE,WACZO,EAAgB,OAClBP,IAA8BO,EAAgB,OAC5CA,EAAgB,OACjBP,IAA8BO,EAAgB;AAEjD,WAAO;AAAA,MACN;AAAA,MACA,8BAA8BA,EAAgB,GAAG,QAAQA,EAAgB,GAAG;AAAA,IAAA;AAI9E,MAAIH,MAAS;AACZ,WAAAI,IAAQ,2BACAR,EAAiB,MAAMQ,CAAK,IACjC,CAAC,IAAM,EAAE,IACT,CAAC,IAAO,wBAAwB;AACpC,MAAWJ,MAAS;AACnB,WAAAI,IACC,+GACOR,EAAiB,MAAMQ,CAAK,IACjC,CAAC,IAAM,EAAE,IACT,CAAC,IAAO,mBAAmB;AAC/B,MAAWJ,MAAS;AACnB,WAAOJ,KAAS,IAAI,CAAC,IAAM,EAAE,IAAI,CAAC,IAAO,sBAAsB;AAChE,MAAWI,MAAS;AACnB,WAAO,OAAOJ,CAAK,EAAE,KAAA,EAAO,WAAW,IACpC,CAAC,IAAM,EAAE,IACT,CAAC,IAAO,wBAAwB;AACpC,MAAWI,MAAS,eAAe;AAClC,UAAM,EAAE,SAAAM,EAAA,IAAYC,EAAM,MAAM,OAAOX,CAAK,CAAC;AAC7C,WAAOU,IAAU,CAAC,IAAM,EAAE,IAAI,CAAC,IAAO,2BAA2B;AAAA,EAClE;AACC,WAAQV,GAAkB,OAAO,SAAS,IACvC,CAAC,IAAM,EAAE,IACT,CAAC,IAAO,oBAAoB;AAGjC;"}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { jsxs as a, jsx as n, Fragment as Le } from "react/jsx-runtime";
|
|
2
2
|
import Ee from "../../assets/icons/info.svg.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
import { escapeFormulaInjection as He } from "../../helpers/sanitize.js";
|
|
4
|
+
import { forwardRef as _e, useState as v, useContext as ke, useRef as Ae, useEffect as d } from "react";
|
|
5
|
+
import { isFunction as te, shouldSanitizeForType as Fe, sanitizeUnsafeInput as Re, validateInput as Be } from "./Input-helper.js";
|
|
6
|
+
import { TitleSmall as De, BodySecondary as Oe } from "../TypographyStyle.js";
|
|
7
|
+
import { COLORS as ne } from "../../constants/Theme.js";
|
|
8
|
+
import Pe from "../../assets/icons/errorInfo.svg.js";
|
|
9
|
+
import { InputStyleContext as ze } from "./context/InputStyleProvider.js";
|
|
10
|
+
import { RootContainer as Ke, InputFooter as Ne, MaxCharStyle as ie, InputWrapper as je, IconHolder as re, PrefixHolder as Ve, InputContainer as We, InputContainerSmall as Xe, InputContainerXSmall as Ue, SuffixHolder as qe, InputHeader as Ge } from "./Input.styled.js";
|
|
11
|
+
import { Button as le } from "../button/Button.js";
|
|
12
|
+
import { Tooltip as Ye } from "../tooltips/Tooltip.js";
|
|
13
|
+
const $e = _e(
|
|
14
|
+
(e, ae) => {
|
|
14
15
|
const {
|
|
15
16
|
placeholder: E,
|
|
16
17
|
leftIcon: H,
|
|
@@ -21,37 +22,37 @@ const Ye = He(
|
|
|
21
22
|
hintText: A,
|
|
22
23
|
type: c,
|
|
23
24
|
state: T,
|
|
24
|
-
validate:
|
|
25
|
+
validate: oe,
|
|
25
26
|
variant: o,
|
|
26
27
|
button: h,
|
|
27
|
-
suffixText:
|
|
28
|
-
prefixText:
|
|
29
|
-
onChangeText:
|
|
28
|
+
suffixText: F,
|
|
29
|
+
prefixText: R,
|
|
30
|
+
onChangeText: B,
|
|
30
31
|
value: m,
|
|
31
|
-
noErrorHint:
|
|
32
|
-
reset:
|
|
33
|
-
rangeValidation:
|
|
34
|
-
noKeyDownChange:
|
|
35
|
-
version:
|
|
32
|
+
noErrorHint: ce,
|
|
33
|
+
reset: D,
|
|
34
|
+
rangeValidation: se,
|
|
35
|
+
noKeyDownChange: he,
|
|
36
|
+
version: ue,
|
|
36
37
|
noMaxCharCheck: O,
|
|
37
38
|
labelElement: P,
|
|
38
39
|
autoGrow: b,
|
|
39
|
-
minHeight:
|
|
40
|
-
maxHeight:
|
|
41
|
-
labelTextBold:
|
|
42
|
-
truncateText:
|
|
40
|
+
minHeight: p,
|
|
41
|
+
maxHeight: de,
|
|
42
|
+
labelTextBold: fe,
|
|
43
|
+
truncateText: me,
|
|
43
44
|
maxCharLimitPosition: z,
|
|
44
45
|
maxCharStyle: K,
|
|
45
|
-
hightlightInputColor:
|
|
46
|
+
hightlightInputColor: ge,
|
|
46
47
|
onKeyDownEvent: N,
|
|
47
|
-
hideInputHeader:
|
|
48
|
-
hideBorder:
|
|
49
|
-
inputWrapperStyles:
|
|
50
|
-
minCharsToTrigger:
|
|
51
|
-
maxCharAlignment:
|
|
52
|
-
isDisabled:
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
hideInputHeader: xe,
|
|
49
|
+
hideBorder: Ie,
|
|
50
|
+
inputWrapperStyles: Ce,
|
|
51
|
+
minCharsToTrigger: j,
|
|
52
|
+
maxCharAlignment: ve,
|
|
53
|
+
isDisabled: V = !1,
|
|
54
|
+
allowUnsafeInput: ye,
|
|
55
|
+
preventFormulaInjection: Te,
|
|
55
56
|
leftIconStyle: be
|
|
56
57
|
} = {
|
|
57
58
|
maxCharLimit: 0,
|
|
@@ -61,204 +62,202 @@ const Ye = He(
|
|
|
61
62
|
minCharsToTrigger: 0,
|
|
62
63
|
maxCharAlignment: !1,
|
|
63
64
|
...e
|
|
64
|
-
},
|
|
65
|
+
}, W = H?.icon, X = _?.icon, [M, I] = v(!1), [pe, S] = v(!1), [u, U] = v(), q = o === "x-small" ? "12px" : o === "small" ? "18px" : "22px", C = ke(ze), [G, w] = v(""), Me = Ae(null), r = ae ?? Me;
|
|
65
66
|
d(() => {
|
|
66
|
-
w(m || ""), !m && b && (r.current.style.height =
|
|
67
|
+
w(m || ""), !m && b && (r.current.style.height = p || "48px");
|
|
67
68
|
}, [m]), d(() => {
|
|
68
69
|
r.current && e.onReferenceInit?.(r.current);
|
|
69
70
|
}, [r]), d(() => {
|
|
70
71
|
const t = r.current;
|
|
71
72
|
if (t && ["phonenumber", "zip", "number"].includes(c))
|
|
72
|
-
return t.addEventListener("wheel",
|
|
73
|
-
t.removeEventListener("wheel",
|
|
73
|
+
return t.addEventListener("wheel", J, { passive: !1 }), () => {
|
|
74
|
+
t.removeEventListener("wheel", J);
|
|
74
75
|
};
|
|
75
76
|
}, []), d(() => {
|
|
76
|
-
|
|
77
|
-
}, [
|
|
78
|
-
|
|
77
|
+
D && w("");
|
|
78
|
+
}, [D]), d(() => {
|
|
79
|
+
S(!!e.isActive), e.isActive && r.current?.focus();
|
|
79
80
|
}, [e.isActive]), d(() => {
|
|
80
|
-
|
|
81
|
+
U(e.errorMessage);
|
|
81
82
|
}, [e.errorMessage]), d(() => {
|
|
82
83
|
I(!1), (e.state === "invalid" || u || e.state === "disabled-invalid") && I(!0), e.state === "active" && r.current?.focus();
|
|
83
84
|
}, [e.state, u]), d(() => {
|
|
84
85
|
I(!!u || e.state === "invalid");
|
|
85
86
|
}, [u, e.state]);
|
|
86
87
|
const f = (t, ...i) => {
|
|
87
|
-
|
|
88
|
-
},
|
|
89
|
-
const i = l !== 0 ? l :
|
|
90
|
-
N && (!s.length || s.length >= x) && N(t), !
|
|
91
|
-
},
|
|
88
|
+
te(t) && t(...i);
|
|
89
|
+
}, Y = () => c === "zip" ? 6 : 2e3, $ = (t) => {
|
|
90
|
+
const i = l !== 0 ? l : Y(), g = [8], x = j, s = t.target.value;
|
|
91
|
+
N && (!s.length || s.length >= x) && N(t), !he && (!s.length || s.length >= x) && B(m || "", t), !O && !g.includes(t.which) && i > 0 && s.length >= i && t.preventDefault();
|
|
92
|
+
}, J = (t) => {
|
|
92
93
|
t.preventDefault();
|
|
93
|
-
},
|
|
94
|
+
}, Q = (t) => {
|
|
94
95
|
let i = t.target.value;
|
|
95
|
-
const g = l !== 0 ? l + 1 :
|
|
96
|
-
if (!
|
|
96
|
+
const g = l !== 0 ? l + 1 : Y(), x = j;
|
|
97
|
+
if (!ye && Fe(c) && (i = Re(i)), Te && (i = He(i)), !O && g > 0 && i.length >= g && (i = i.substring(0, g - 1)), e.textControl || w(i || ""), x && i && i.length < x)
|
|
97
98
|
return;
|
|
98
|
-
|
|
99
|
-
const s =
|
|
100
|
-
if (!s || !
|
|
99
|
+
B(i, t), b && (r.current.style.height = `${r.current.scrollHeight}px`, i || (r.current.style.height = p || "48px"));
|
|
100
|
+
const s = oe || Be;
|
|
101
|
+
if (!s || !te(s))
|
|
101
102
|
return;
|
|
102
|
-
const [
|
|
103
|
+
const [Se, we] = s(
|
|
103
104
|
i,
|
|
104
105
|
c,
|
|
105
|
-
|
|
106
|
+
se
|
|
106
107
|
);
|
|
107
|
-
I(!
|
|
108
|
+
I(!Se), U(e.errorMessage ? e.errorMessage : we);
|
|
109
|
+
}, Z = (t) => {
|
|
110
|
+
e.skipFocus || S(!0), f(e.onFocus?.(t));
|
|
108
111
|
}, ee = (t) => {
|
|
109
|
-
e.skipFocus ||
|
|
110
|
-
}, te = (t) => {
|
|
111
|
-
e.skipFocus || p(!1), f(e.onBlur?.(t));
|
|
112
|
+
e.skipFocus || S(!1), f(e.onBlur?.(t));
|
|
112
113
|
}, L = () => /* @__PURE__ */ a(Le, { children: [
|
|
113
114
|
c !== "multiline" && /* @__PURE__ */ n(
|
|
114
115
|
"input",
|
|
115
116
|
{
|
|
116
|
-
className:
|
|
117
|
+
className: me ? "truncate-class" : "",
|
|
117
118
|
"data-test": e["data-test"],
|
|
118
119
|
id: e.id,
|
|
119
120
|
style: C?.input ?? {},
|
|
120
121
|
ref: r,
|
|
121
|
-
disabled:
|
|
122
|
+
disabled: V,
|
|
122
123
|
type: ["phonenumber", "zip", "number"].includes(c) ? "number" : c,
|
|
123
|
-
value:
|
|
124
|
-
onFocus: (t) =>
|
|
125
|
-
onBlur: (t) =>
|
|
124
|
+
value: G,
|
|
125
|
+
onFocus: (t) => Z(t),
|
|
126
|
+
onBlur: (t) => ee(t),
|
|
126
127
|
placeholder: E || "Enter here",
|
|
127
|
-
onChange:
|
|
128
|
+
onChange: Q,
|
|
128
129
|
onClick: (t) => f(e.onClick),
|
|
129
|
-
onKeyDown: (t) =>
|
|
130
|
+
onKeyDown: (t) => $(t)
|
|
130
131
|
}
|
|
131
132
|
),
|
|
132
133
|
c === "multiline" && /* @__PURE__ */ n(
|
|
133
134
|
"textarea",
|
|
134
135
|
{
|
|
135
136
|
"data-test": e["data-test"],
|
|
136
|
-
value:
|
|
137
|
+
value: G,
|
|
137
138
|
ref: r,
|
|
138
|
-
onFocus: (t) =>
|
|
139
|
-
onBlur: (t) =>
|
|
139
|
+
onFocus: (t) => Z(t),
|
|
140
|
+
onBlur: (t) => ee(t),
|
|
140
141
|
onClick: (t) => f(e.onClick),
|
|
141
|
-
disabled:
|
|
142
|
+
disabled: V,
|
|
142
143
|
placeholder: E || "Enter here",
|
|
143
|
-
onChange:
|
|
144
|
-
onKeyDown: (t) =>
|
|
144
|
+
onChange: Q,
|
|
145
|
+
onKeyDown: (t) => $(t),
|
|
145
146
|
maxLength: l > 0 ? l : void 0
|
|
146
147
|
}
|
|
147
148
|
)
|
|
148
149
|
] });
|
|
149
150
|
return /* @__PURE__ */ a(
|
|
150
|
-
|
|
151
|
+
Ke,
|
|
151
152
|
{
|
|
152
153
|
width: e.width,
|
|
153
154
|
height: e.height,
|
|
154
155
|
state: T,
|
|
155
|
-
solidDisabled: X,
|
|
156
156
|
type: c,
|
|
157
157
|
style: C?.RootContainer ?? {},
|
|
158
158
|
children: [
|
|
159
159
|
/* @__PURE__ */ a("div", { className: "flex-align-center", children: [
|
|
160
|
-
!
|
|
161
|
-
!!u && /* @__PURE__ */ n(
|
|
160
|
+
!ce && (!!A || !!u) && /* @__PURE__ */ a(Ne, { invalid: !!u, children: [
|
|
161
|
+
!!u && /* @__PURE__ */ n(Pe, { width: 16, height: 16 }),
|
|
162
162
|
u || A
|
|
163
163
|
] }),
|
|
164
|
-
l > 0 && z === "BOTTOM" && /* @__PURE__ */ a(
|
|
164
|
+
l > 0 && z === "BOTTOM" && /* @__PURE__ */ a(ie, { position: "BOTTOM", style: K, children: [
|
|
165
165
|
(m ?? "").toString()?.length ?? 0,
|
|
166
166
|
"/",
|
|
167
167
|
l
|
|
168
168
|
] })
|
|
169
169
|
] }),
|
|
170
170
|
/* @__PURE__ */ a(
|
|
171
|
-
|
|
171
|
+
je,
|
|
172
172
|
{
|
|
173
173
|
variant: o,
|
|
174
174
|
state: T,
|
|
175
|
-
solidDisabled: X,
|
|
176
175
|
width: e.width,
|
|
177
|
-
isActive: T === "active" ||
|
|
178
|
-
isInvalid:
|
|
179
|
-
style: C?.InputWrapper ??
|
|
180
|
-
version:
|
|
176
|
+
isActive: T === "active" || pe,
|
|
177
|
+
isInvalid: M,
|
|
178
|
+
style: C?.InputWrapper ?? Ce ?? {},
|
|
179
|
+
version: ue,
|
|
181
180
|
height: e.height,
|
|
182
|
-
hightlightInputColor:
|
|
183
|
-
hideBorder:
|
|
181
|
+
hightlightInputColor: ge,
|
|
182
|
+
hideBorder: Ie,
|
|
184
183
|
children: [
|
|
185
|
-
!!
|
|
186
|
-
|
|
184
|
+
!!W && /* @__PURE__ */ n(
|
|
185
|
+
re,
|
|
187
186
|
{
|
|
188
187
|
variant: o,
|
|
189
|
-
iconSize:
|
|
188
|
+
iconSize: q,
|
|
190
189
|
onClick: () => f(H?.callback),
|
|
191
190
|
isLeft: !0,
|
|
192
191
|
style: {
|
|
193
192
|
...C?.IconHolder ?? {},
|
|
194
193
|
...be
|
|
195
194
|
},
|
|
196
|
-
children: /* @__PURE__ */ n(
|
|
195
|
+
children: /* @__PURE__ */ n(W, {})
|
|
197
196
|
}
|
|
198
197
|
),
|
|
199
|
-
!!
|
|
198
|
+
!!R && /* @__PURE__ */ n(Ve, { variant: o, children: R }),
|
|
200
199
|
o === "default" && /* @__PURE__ */ n(
|
|
201
200
|
We,
|
|
202
201
|
{
|
|
203
202
|
height: e.height,
|
|
204
203
|
type: e.type,
|
|
205
|
-
minHeight:
|
|
206
|
-
maxHeight:
|
|
204
|
+
minHeight: p,
|
|
205
|
+
maxHeight: de,
|
|
207
206
|
autoGrow: b,
|
|
208
207
|
children: L()
|
|
209
208
|
}
|
|
210
209
|
),
|
|
211
210
|
o === "small" && /* @__PURE__ */ n(Xe, { height: e.height, type: e.type, children: L() }),
|
|
212
211
|
o === "x-small" && /* @__PURE__ */ n(Ue, { height: e.height, type: e.type, children: L() }),
|
|
213
|
-
!!
|
|
214
|
-
|
|
212
|
+
!!X && /* @__PURE__ */ n(
|
|
213
|
+
re,
|
|
215
214
|
{
|
|
216
215
|
variant: o,
|
|
217
|
-
iconSize:
|
|
216
|
+
iconSize: q,
|
|
218
217
|
onClick: () => f(_?.callback),
|
|
219
218
|
isLeft: !1,
|
|
220
|
-
children: /* @__PURE__ */ n(
|
|
219
|
+
children: /* @__PURE__ */ n(X, {})
|
|
221
220
|
}
|
|
222
221
|
),
|
|
223
|
-
!!
|
|
222
|
+
!!F && /* @__PURE__ */ n(qe, { variant: o, children: F }),
|
|
224
223
|
h && h.text && /* @__PURE__ */ n(
|
|
225
|
-
|
|
224
|
+
le,
|
|
226
225
|
{
|
|
227
226
|
buttonText: h.text,
|
|
228
227
|
buttonType: h.buttonType,
|
|
229
228
|
onClick: () => f(h?.onClick)
|
|
230
229
|
}
|
|
231
230
|
),
|
|
232
|
-
h && h.buttonProps && /* @__PURE__ */ n(
|
|
231
|
+
h && h.buttonProps && /* @__PURE__ */ n(le, { ...h.buttonProps })
|
|
233
232
|
]
|
|
234
233
|
}
|
|
235
234
|
),
|
|
236
|
-
!
|
|
237
|
-
|
|
235
|
+
!xe && (!!y || !!l) && /* @__PURE__ */ a(
|
|
236
|
+
Ge,
|
|
238
237
|
{
|
|
239
|
-
invalid:
|
|
240
|
-
maxCharAlignment:
|
|
238
|
+
invalid: M,
|
|
239
|
+
maxCharAlignment: ve,
|
|
241
240
|
children: [
|
|
242
241
|
P && P,
|
|
243
242
|
/* @__PURE__ */ a("div", { className: "label__container", children: [
|
|
244
|
-
|
|
243
|
+
fe ? /* @__PURE__ */ a(De, { children: [
|
|
245
244
|
y,
|
|
246
245
|
k ? /* @__PURE__ */ n("span", { children: "*" }) : ""
|
|
247
|
-
] }) : /* @__PURE__ */ a(
|
|
246
|
+
] }) : /* @__PURE__ */ a(Oe, { children: [
|
|
248
247
|
y,
|
|
249
248
|
k ? /* @__PURE__ */ n("span", { children: "*" }) : ""
|
|
250
249
|
] }),
|
|
251
|
-
e.tooltipText && /* @__PURE__ */ n(
|
|
250
|
+
e.tooltipText && /* @__PURE__ */ n(Ye, { body: e.tooltipText, placement: "top", children: /* @__PURE__ */ n("span", { children: /* @__PURE__ */ n(
|
|
252
251
|
Ee,
|
|
253
252
|
{
|
|
254
253
|
style: { marginTop: -3 },
|
|
255
254
|
width: 18,
|
|
256
255
|
height: 18,
|
|
257
|
-
color:
|
|
256
|
+
color: M ? ne.content.negative : ne.content.primary
|
|
258
257
|
}
|
|
259
258
|
) }) })
|
|
260
259
|
] }),
|
|
261
|
-
l > 0 && z === "TOP" && /* @__PURE__ */ a(
|
|
260
|
+
l > 0 && z === "TOP" && /* @__PURE__ */ a(ie, { style: K, children: [
|
|
262
261
|
(m ?? "").toString()?.length ?? 0,
|
|
263
262
|
"/",
|
|
264
263
|
l
|
|
@@ -271,8 +270,8 @@ const Ye = He(
|
|
|
271
270
|
);
|
|
272
271
|
}
|
|
273
272
|
);
|
|
274
|
-
|
|
273
|
+
$e.displayName = "Input";
|
|
275
274
|
export {
|
|
276
|
-
|
|
275
|
+
$e as Input
|
|
277
276
|
};
|
|
278
277
|
//# sourceMappingURL=Input.js.map
|