@razorpay/blade 11.18.0 → 11.18.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.
Files changed (29) hide show
  1. package/build/lib/native/components/Checkbox/Checkbox.js +1 -1
  2. package/build/lib/native/components/Checkbox/Checkbox.js.map +1 -1
  3. package/build/lib/native/components/Dropdown/DropdownHeaderFooter.js +1 -1
  4. package/build/lib/native/components/Dropdown/DropdownHeaderFooter.js.map +1 -1
  5. package/build/lib/native/components/ProgressBar/ProgressBar.js +1 -1
  6. package/build/lib/native/components/ProgressBar/ProgressBar.js.map +1 -1
  7. package/build/lib/native/components/Radio/Radio.js +1 -1
  8. package/build/lib/native/components/Radio/Radio.js.map +1 -1
  9. package/build/lib/web/development/components/Checkbox/Checkbox.js +1 -4
  10. package/build/lib/web/development/components/Checkbox/Checkbox.js.map +1 -1
  11. package/build/lib/web/development/components/Dropdown/DropdownHeaderFooter.js +2 -16
  12. package/build/lib/web/development/components/Dropdown/DropdownHeaderFooter.js.map +1 -1
  13. package/build/lib/web/development/components/ProgressBar/CircularProgressBar.web.js +5 -3
  14. package/build/lib/web/development/components/ProgressBar/CircularProgressBar.web.js.map +1 -1
  15. package/build/lib/web/development/components/ProgressBar/ProgressBar.js +1 -1
  16. package/build/lib/web/development/components/ProgressBar/ProgressBar.js.map +1 -1
  17. package/build/lib/web/development/components/Radio/Radio.js +1 -2
  18. package/build/lib/web/development/components/Radio/Radio.js.map +1 -1
  19. package/build/lib/web/production/components/Checkbox/Checkbox.js +1 -4
  20. package/build/lib/web/production/components/Checkbox/Checkbox.js.map +1 -1
  21. package/build/lib/web/production/components/Dropdown/DropdownHeaderFooter.js +2 -16
  22. package/build/lib/web/production/components/Dropdown/DropdownHeaderFooter.js.map +1 -1
  23. package/build/lib/web/production/components/ProgressBar/CircularProgressBar.web.js +5 -3
  24. package/build/lib/web/production/components/ProgressBar/CircularProgressBar.web.js.map +1 -1
  25. package/build/lib/web/production/components/ProgressBar/ProgressBar.js +1 -1
  26. package/build/lib/web/production/components/ProgressBar/ProgressBar.js.map +1 -1
  27. package/build/lib/web/production/components/Radio/Radio.js +1 -2
  28. package/build/lib/web/production/components/Radio/Radio.js.map +1 -1
  29. package/package.json +1 -1
@@ -38,7 +38,7 @@ var _excluded=["defaultChecked","validationState","isChecked","isDisabled","isIn
38
38
  <Checkbox value="apple">Apple</Checkbox>
39
39
  <Checkbox value="mango">Mango</Checkbox>
40
40
  </CheckboxGroup>
41
- `);}}var _validationState=validationState!=null?validationState:groupProps==null?void 0:groupProps.validationState;var _hasError=_validationState==='error';var _isDisabled=isDisabled!=null?isDisabled:groupProps==null?void 0:groupProps.isDisabled;var _isRequired=Boolean(isRequired||(groupProps==null?void 0:groupProps.isRequired)||(groupProps==null?void 0:groupProps.necessityIndicator)==='required');var _name=name!=null?name:groupProps==null?void 0:groupProps.name;var _isChecked=isChecked!=null?isChecked:groupProps==null?void 0:(_groupProps$state=groupProps.state)==null?void 0:_groupProps$state.isChecked(value);var _size=(_groupProps$size=groupProps.size)!=null?_groupProps$size:size;var _useTheme=useTheme(),theme=_useTheme.theme;var formHintSize={small:'medium',medium:'medium',large:'large'};var showSupportingText=validationState!=='error'&&helpText;var handleChange=function handleChange(_ref2){var isChecked=_ref2.isChecked,event=_ref2.event,value=_ref2.value;if(isChecked){var _groupProps$state2;groupProps==null?void 0:(_groupProps$state2=groupProps.state)==null?void 0:_groupProps$state2.addValue(value);}else {var _groupProps$state3;groupProps==null?void 0:(_groupProps$state3=groupProps.state)==null?void 0:_groupProps$state3.removeValue(value);}onChange==null?void 0:onChange({isChecked:isChecked,event:event,value:value});};var _useCheckbox=useCheckbox({defaultChecked:defaultChecked,isChecked:_isChecked,isIndeterminate:isIndeterminate,hasError:_hasError,hasHelperText:Boolean(showSupportingText),isDisabled:_isDisabled,isRequired:_isRequired,name:_name,value:value,onChange:handleChange}),state=_useCheckbox.state,ids=_useCheckbox.ids,inputProps=_useCheckbox.inputProps;var helpTextLeftSpacing=makeSize(checkboxSizes.icon[size].width+theme.spacing[3]);return jsxs(BaseBox,Object.assign({},metaAttribute({name:MetaConstants.Checkbox,testID:testID}),getStyledProps(styledProps),{children:[jsx(SelectorLabel,{componentName:MetaConstants.CheckboxLabel,inputProps:state.isReactNative?inputProps:{},children:jsxs(BaseBox,{display:"flex",flexDirection:"column",children:[jsxs(BaseBox,{display:"flex",flexDirection:"row",children:[jsx(SelectorInput,{hoverTokens:checkboxHoverTokens,isChecked:state.isChecked||Boolean(isIndeterminate),isDisabled:_isDisabled,hasError:_hasError,inputProps:inputProps,tabIndex:tabIndex,ref:ref}),jsx(CheckboxIcon,{size:_size,isChecked:state.isChecked,isIndeterminate:isIndeterminate,isDisabled:_isDisabled,isNegative:_hasError}),children?jsx(SelectorTitle,{size:_size,isDisabled:_isDisabled,children:children}):null]}),showSupportingText?jsx(BaseBox,{marginLeft:helpTextLeftSpacing,children:jsx(SelectorSupportText,{size:_size,id:ids==null?void 0:ids.helpTextId,children:helpText})}):null]})}),jsx(FormHint,{size:formHintSize[_size],errorText:errorText,errorTextId:ids==null?void 0:ids.errorTextId,type:validationState==='error'?'error':'help'})]}));};var Checkbox=assignWithoutSideEffects(React__default.forwardRef(_Checkbox),{displayName:'Checkbox'});
41
+ `);}}var _validationState=validationState!=null?validationState:groupProps==null?void 0:groupProps.validationState;var _hasError=_validationState==='error';var _isDisabled=isDisabled!=null?isDisabled:groupProps==null?void 0:groupProps.isDisabled;var _isRequired=Boolean(isRequired||(groupProps==null?void 0:groupProps.isRequired)||(groupProps==null?void 0:groupProps.necessityIndicator)==='required');var _name=name!=null?name:groupProps==null?void 0:groupProps.name;var _isChecked=isChecked!=null?isChecked:groupProps==null?void 0:(_groupProps$state=groupProps.state)==null?void 0:_groupProps$state.isChecked(value);var _size=(_groupProps$size=groupProps.size)!=null?_groupProps$size:size;var _useTheme=useTheme(),theme=_useTheme.theme;var formHintSize={small:'medium',medium:'medium',large:'large'};var showSupportingText=helpText;var handleChange=function handleChange(_ref2){var isChecked=_ref2.isChecked,event=_ref2.event,value=_ref2.value;if(isChecked){var _groupProps$state2;groupProps==null?void 0:(_groupProps$state2=groupProps.state)==null?void 0:_groupProps$state2.addValue(value);}else {var _groupProps$state3;groupProps==null?void 0:(_groupProps$state3=groupProps.state)==null?void 0:_groupProps$state3.removeValue(value);}onChange==null?void 0:onChange({isChecked:isChecked,event:event,value:value});};var _useCheckbox=useCheckbox({defaultChecked:defaultChecked,isChecked:_isChecked,isIndeterminate:isIndeterminate,hasError:_hasError,hasHelperText:Boolean(showSupportingText),isDisabled:_isDisabled,isRequired:_isRequired,name:_name,value:value,onChange:handleChange}),state=_useCheckbox.state,ids=_useCheckbox.ids,inputProps=_useCheckbox.inputProps;var helpTextLeftSpacing=makeSize(checkboxSizes.icon[size].width+theme.spacing[3]);return jsxs(BaseBox,Object.assign({},metaAttribute({name:MetaConstants.Checkbox,testID:testID}),getStyledProps(styledProps),{children:[jsx(SelectorLabel,{componentName:MetaConstants.CheckboxLabel,inputProps:state.isReactNative?inputProps:{},children:jsxs(BaseBox,{display:"flex",flexDirection:"column",children:[jsxs(BaseBox,{display:"flex",flexDirection:"row",children:[jsx(SelectorInput,{hoverTokens:checkboxHoverTokens,isChecked:state.isChecked||Boolean(isIndeterminate),isDisabled:_isDisabled,hasError:_hasError,inputProps:inputProps,tabIndex:tabIndex,ref:ref}),jsx(CheckboxIcon,{size:_size,isChecked:state.isChecked,isIndeterminate:isIndeterminate,isDisabled:_isDisabled,isNegative:_hasError}),children?jsx(SelectorTitle,{size:_size,isDisabled:_isDisabled,children:children}):null]}),showSupportingText?jsx(BaseBox,{marginLeft:helpTextLeftSpacing,children:jsx(SelectorSupportText,{size:_size,id:ids==null?void 0:ids.helpTextId,children:helpText})}):null]})}),jsx(FormHint,{size:formHintSize[_size],errorText:errorText,errorTextId:ids==null?void 0:ids.errorTextId,type:validationState==='error'?'error':'help'})]}));};var Checkbox=assignWithoutSideEffects(React__default.forwardRef(_Checkbox),{displayName:'Checkbox'});
42
42
 
43
43
  export { Checkbox };
44
44
  //# sourceMappingURL=Checkbox.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.js","sources":["../../../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/restrict-plus-operands */\n/* eslint-disable @typescript-eslint/no-shadow */\nimport React from 'react';\nimport { useCheckboxGroupContext } from './CheckboxGroup/CheckboxGroupContext';\nimport { CheckboxIcon } from './CheckboxIcon';\nimport { useCheckbox } from './useCheckbox';\nimport { checkboxHoverTokens, checkboxSizes } from './checkboxTokens';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport isUndefined from '~utils/lodashButBetter/isUndefined';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport BaseBox from '~components/Box/BaseBox';\nimport { FormHint } from '~components/Form';\nimport { SelectorLabel } from '~components/Form/Selector/SelectorLabel';\nimport { SelectorTitle } from '~components/Form/Selector/SelectorTitle';\nimport { SelectorSupportText } from '~components/Form/Selector/SelectorSupportText';\nimport { SelectorInput } from '~components/Form/Selector/SelectorInput';\nimport type { BladeElementRef, TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { throwBladeError } from '~utils/logger';\nimport { makeSize, useTheme } from '~utils';\n\ntype OnChange = ({\n isChecked,\n event,\n value,\n}: {\n isChecked: boolean;\n event?: React.ChangeEvent;\n value?: string;\n}) => void;\n\ntype CheckboxProps = {\n /**\n * If `true`, The checkbox will be checked. This also makes the checkbox controlled\n * Use `onChange` to update its value\n *\n * @default false\n */\n isChecked?: boolean;\n /**\n * If `true`, the checkbox will be initially checked. This also makes the checkbox uncontrolled\n *\n * @default false\n */\n defaultChecked?: boolean;\n /**\n * The callback invoked when the checked state of the `Checkbox` changes.\n */\n onChange?: OnChange;\n /**\n * Sets the label of the checkbox\n */\n children?: React.ReactNode;\n /**\n * Help text for the checkbox\n */\n helpText?: string;\n /**\n * Error text for the checkbox\n *\n * Renders when `validationState` is set to 'error'\n */\n errorText?: string;\n /**\n * If `true`, the checkbox will be indeterminate.\n * This does not modify the isChecked property.\n *\n * @default false\n */\n isIndeterminate?: boolean;\n /**\n * The name of the input field in a checkbox\n * (Useful for form submission).\n */\n name?: string;\n /**\n * The value to be used in the checkbox input.\n * This is the value that will be returned on form submission.\n */\n value?: string;\n /**\n * If `true`, the checkbox will be disabled\n *\n * @default false\n */\n isDisabled?: boolean;\n /**\n * If `true`, the checkbox input is marked as required,\n * and `required` attribute will be added\n *\n * @default false\n */\n isRequired?: boolean;\n /**\n * If `error`, the checkbox input is marked as invalid,\n * and `invalid` attribute will be added\n */\n validationState?: 'error' | 'none';\n /**\n * Size of the checkbox\n *\n * @default \"medium\"\n */\n size?: 'small' | 'medium' | 'large';\n /**\n * Sets the tab-index property on checkbox element\n *\n */\n tabIndex?: number;\n} & TestID &\n StyledPropsBlade;\n\nconst _Checkbox: React.ForwardRefRenderFunction<BladeElementRef, CheckboxProps> = (\n {\n defaultChecked,\n validationState,\n isChecked,\n isDisabled,\n isIndeterminate,\n isRequired,\n name,\n onChange,\n value,\n children,\n helpText,\n errorText,\n size = 'medium',\n tabIndex,\n testID,\n ...styledProps\n },\n ref,\n) => {\n const groupProps = useCheckboxGroupContext();\n\n // ban certain props in checkbox while inside group\n const hasValidationState = !isUndefined(validationState);\n const hasName = !isUndefined(name);\n const hasDefaultChecked = !isUndefined(defaultChecked);\n const hasIsChecked = !isUndefined(isChecked);\n const hasOnChange = !isUndefined(onChange);\n\n if (__DEV__) {\n if (\n (hasValidationState || hasName || hasDefaultChecked || hasIsChecked || hasOnChange) &&\n !isEmpty(groupProps)\n ) {\n const props = [\n hasValidationState ? 'validationState' : undefined,\n hasName ? 'name' : undefined,\n hasDefaultChecked ? 'defaultChecked' : undefined,\n hasIsChecked ? 'isChecked' : undefined,\n hasOnChange ? 'onChange' : undefined,\n ]\n .filter(Boolean)\n .join(',');\n\n throwBladeError({\n message: `Cannot set \\`${props}\\` on <Checkbox /> when it's inside <CheckboxGroup />, Please set it on the <CheckboxGroup /> itself`,\n moduleName: 'Checkbox',\n });\n }\n\n // mandate value prop when using inside group\n if (!value && !isEmpty(groupProps)) {\n throw new Error(\n `[Blade Checkbox]: <CheckboxGroup /> requires that you pass unique \"value\" prop to each <Checkbox />\n <CheckboxGroup>\n <Checkbox value=\"apple\">Apple</Checkbox>\n <Checkbox value=\"mango\">Mango</Checkbox>\n </CheckboxGroup>\n `,\n );\n }\n }\n\n const _validationState = validationState ?? groupProps?.validationState;\n const _hasError = _validationState === 'error';\n const _isDisabled = isDisabled ?? groupProps?.isDisabled;\n const _isRequired = Boolean(\n isRequired || groupProps?.isRequired || groupProps?.necessityIndicator === 'required',\n );\n const _name = name ?? groupProps?.name;\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n const _isChecked = isChecked ?? groupProps?.state?.isChecked(value!);\n const _size = groupProps.size ?? size;\n const { theme } = useTheme();\n const formHintSize = {\n small: 'medium',\n medium: 'medium',\n large: 'large',\n } as const;\n\n // only show error when the self validation is set to error\n // Since we don't want to show errorText inside the group\n const showSupportingText = validationState !== 'error' && helpText;\n\n const handleChange: OnChange = ({ isChecked, event, value }) => {\n if (isChecked) {\n groupProps?.state?.addValue(value!);\n } else {\n groupProps?.state?.removeValue(value!);\n }\n\n onChange?.({ isChecked, event, value });\n };\n\n const { state, ids, inputProps } = useCheckbox({\n defaultChecked,\n isChecked: _isChecked,\n isIndeterminate,\n hasError: _hasError,\n hasHelperText: Boolean(showSupportingText),\n isDisabled: _isDisabled,\n isRequired: _isRequired,\n name: _name,\n value,\n onChange: handleChange,\n });\n\n // Checkbox icon's size & margin + margin-left of SelectorTitle which is 2\n const helpTextLeftSpacing = makeSize(checkboxSizes.icon[size].width + theme.spacing[3]);\n\n return (\n <BaseBox\n {...metaAttribute({ name: MetaConstants.Checkbox, testID })}\n {...getStyledProps(styledProps)}\n >\n <SelectorLabel\n componentName={MetaConstants.CheckboxLabel}\n inputProps={state.isReactNative ? inputProps : {}}\n >\n <BaseBox display=\"flex\" flexDirection=\"column\">\n <BaseBox display=\"flex\" flexDirection=\"row\">\n <SelectorInput\n hoverTokens={checkboxHoverTokens}\n isChecked={state.isChecked || Boolean(isIndeterminate)}\n isDisabled={_isDisabled}\n hasError={_hasError}\n inputProps={inputProps}\n tabIndex={tabIndex}\n ref={ref}\n />\n <CheckboxIcon\n size={_size}\n isChecked={state.isChecked}\n isIndeterminate={isIndeterminate}\n isDisabled={_isDisabled}\n isNegative={_hasError}\n />\n {children ? (\n <SelectorTitle size={_size} isDisabled={_isDisabled}>\n {children}\n </SelectorTitle>\n ) : null}\n </BaseBox>\n {showSupportingText ? (\n <BaseBox marginLeft={helpTextLeftSpacing}>\n <SelectorSupportText size={_size} id={ids?.helpTextId}>\n {helpText}\n </SelectorSupportText>\n </BaseBox>\n ) : null}\n </BaseBox>\n </SelectorLabel>\n <FormHint\n size={formHintSize[_size]}\n errorText={errorText}\n errorTextId={ids?.errorTextId}\n type={validationState === 'error' ? 'error' : 'help'}\n />\n </BaseBox>\n );\n};\n\nconst Checkbox = assignWithoutSideEffects(React.forwardRef(_Checkbox), {\n displayName: 'Checkbox',\n});\n\nexport type { CheckboxProps };\nexport { Checkbox };\n"],"names":["_Checkbox","_ref","ref","_groupProps$state","_groupProps$size","defaultChecked","validationState","isChecked","isDisabled","isIndeterminate","isRequired","name","onChange","value","children","helpText","errorText","_ref$size","size","tabIndex","testID","styledProps","_objectWithoutProperties","_excluded","groupProps","useCheckboxGroupContext","hasValidationState","isUndefined","hasName","hasDefaultChecked","hasIsChecked","hasOnChange","__DEV__","isEmpty","props","undefined","filter","Boolean","join","throwBladeError","message","moduleName","Error","_validationState","_hasError","_isDisabled","_isRequired","necessityIndicator","_name","_isChecked","state","_size","_useTheme","useTheme","theme","formHintSize","small","medium","large","showSupportingText","handleChange","_ref2","event","_groupProps$state2","addValue","_groupProps$state3","removeValue","_useCheckbox","useCheckbox","hasError","hasHelperText","ids","inputProps","helpTextLeftSpacing","makeSize","checkboxSizes","icon","width","spacing","_jsxs","BaseBox","Object","assign","metaAttribute","MetaConstants","Checkbox","getStyledProps","_jsx","SelectorLabel","componentName","CheckboxLabel","isReactNative","display","flexDirection","SelectorInput","hoverTokens","checkboxHoverTokens","CheckboxIcon","isNegative","SelectorTitle","marginLeft","SelectorSupportText","id","helpTextId","FormHint","errorTextId","type","assignWithoutSideEffects","React","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAA,SAAA,CAAA,CAAA,gBAAA,CAAA,iBAAA,CAAA,WAAA,CAAA,YAAA,CAAA,iBAAA,CAAA,YAAA,CAAA,MAAA,CAAA,UAAA,CAAA,OAAA,CAAA,UAAA,CAAA,UAAA,CAAA,WAAA,CAAA,MAAA,CAAA,UAAA,CAAA,QAAA,CAAA,CAgHA,IAAMA,SAAyE,CAAG,SAA5EA,SAAyEA,CAAAC,IAAA,CAmB7EC,GAAG,CACA,CAAAC,IAAAA,iBAAA,CAAAC,gBAAA,KAlBDC,cAAc,CAAAJ,IAAA,CAAdI,cAAc,CACdC,eAAe,CAAAL,IAAA,CAAfK,eAAe,CACfC,SAAS,CAAAN,IAAA,CAATM,SAAS,CACTC,UAAU,CAAAP,IAAA,CAAVO,UAAU,CACVC,eAAe,CAAAR,IAAA,CAAfQ,eAAe,CACfC,UAAU,CAAAT,IAAA,CAAVS,UAAU,CACVC,IAAI,CAAAV,IAAA,CAAJU,IAAI,CACJC,QAAQ,CAAAX,IAAA,CAARW,QAAQ,CACRC,KAAK,CAAAZ,IAAA,CAALY,KAAK,CACLC,QAAQ,CAAAb,IAAA,CAARa,QAAQ,CACRC,QAAQ,CAAAd,IAAA,CAARc,QAAQ,CACRC,SAAS,CAAAf,IAAA,CAATe,SAAS,CAAAC,SAAA,CAAAhB,IAAA,CACTiB,IAAI,C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ACjCD,UAAU,CAAEqC,WAAY,CACxBqD,UAAU,CAAEtD,SAAU,CACvB,CAAC,CACD9B,QAAQ,CACPyE,GAAA,CAACY,aAAa,CAAA,CAACjF,IAAI,CAAEiC,KAAM,CAAC3C,UAAU,CAAEqC,WAAY,CAAA/B,QAAA,CACjDA,QAAQ,CACI,CAAC,CACd,IAAI,CAAA,CACD,CAAC,CACT6C,kBAAkB,CACjB4B,GAAA,CAACP,OAAO,CAAA,CAACoB,UAAU,CAAE3B,mBAAoB,CAAA3D,QAAA,CACvCyE,GAAA,CAACc,mBAAmB,CAAA,CAACnF,IAAI,CAAEiC,KAAM,CAACmD,EAAE,CAAE/B,GAAG,cAAHA,GAAG,CAAEgC,UAAW,CAAAzF,QAAA,CACnDC,QAAQ,CACU,CAAC,CACf,CAAC,CACR,IAAI,EACD,CAAC,CACG,CAAC,CAChBwE,GAAA,CAACiB,QAAQ,CACPtF,CAAAA,IAAI,CAAEqC,YAAY,CAACJ,KAAK,CAAE,CAC1BnC,SAAS,CAAEA,SAAU,CACrByF,WAAW,CAAElC,GAAG,EAAHA,IAAAA,CAAAA,KAAAA,CAAAA,CAAAA,GAAG,CAAEkC,WAAY,CAC9BC,IAAI,CAAEpG,eAAe,GAAK,OAAO,CAAG,OAAO,CAAG,MAAO,CACtD,CAAC,GACK,CAAC,CAEd,CAAC,CAEK,IAAA+E,QAAQ,CAAGsB,wBAAwB,CAACC,cAAK,CAACC,UAAU,CAAC7G,SAAS,CAAC,CAAE,CACrE8G,WAAW,CAAE,UACf,CAAC;;;;"}
1
+ {"version":3,"file":"Checkbox.js","sources":["../../../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/restrict-plus-operands */\n/* eslint-disable @typescript-eslint/no-shadow */\nimport React from 'react';\nimport { useCheckboxGroupContext } from './CheckboxGroup/CheckboxGroupContext';\nimport { CheckboxIcon } from './CheckboxIcon';\nimport { useCheckbox } from './useCheckbox';\nimport { checkboxHoverTokens, checkboxSizes } from './checkboxTokens';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport isUndefined from '~utils/lodashButBetter/isUndefined';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport BaseBox from '~components/Box/BaseBox';\nimport { FormHint } from '~components/Form';\nimport { SelectorLabel } from '~components/Form/Selector/SelectorLabel';\nimport { SelectorTitle } from '~components/Form/Selector/SelectorTitle';\nimport { SelectorSupportText } from '~components/Form/Selector/SelectorSupportText';\nimport { SelectorInput } from '~components/Form/Selector/SelectorInput';\nimport type { BladeElementRef, TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { throwBladeError } from '~utils/logger';\nimport { makeSize, useTheme } from '~utils';\n\ntype OnChange = ({\n isChecked,\n event,\n value,\n}: {\n isChecked: boolean;\n event?: React.ChangeEvent;\n value?: string;\n}) => void;\n\ntype CheckboxProps = {\n /**\n * If `true`, The checkbox will be checked. This also makes the checkbox controlled\n * Use `onChange` to update its value\n *\n * @default false\n */\n isChecked?: boolean;\n /**\n * If `true`, the checkbox will be initially checked. This also makes the checkbox uncontrolled\n *\n * @default false\n */\n defaultChecked?: boolean;\n /**\n * The callback invoked when the checked state of the `Checkbox` changes.\n */\n onChange?: OnChange;\n /**\n * Sets the label of the checkbox\n */\n children?: React.ReactNode;\n /**\n * Help text for the checkbox\n */\n helpText?: string;\n /**\n * Error text for the checkbox\n *\n * Renders when `validationState` is set to 'error'\n */\n errorText?: string;\n /**\n * If `true`, the checkbox will be indeterminate.\n * This does not modify the isChecked property.\n *\n * @default false\n */\n isIndeterminate?: boolean;\n /**\n * The name of the input field in a checkbox\n * (Useful for form submission).\n */\n name?: string;\n /**\n * The value to be used in the checkbox input.\n * This is the value that will be returned on form submission.\n */\n value?: string;\n /**\n * If `true`, the checkbox will be disabled\n *\n * @default false\n */\n isDisabled?: boolean;\n /**\n * If `true`, the checkbox input is marked as required,\n * and `required` attribute will be added\n *\n * @default false\n */\n isRequired?: boolean;\n /**\n * If `error`, the checkbox input is marked as invalid,\n * and `invalid` attribute will be added\n */\n validationState?: 'error' | 'none';\n /**\n * Size of the checkbox\n *\n * @default \"medium\"\n */\n size?: 'small' | 'medium' | 'large';\n /**\n * Sets the tab-index property on checkbox element\n *\n */\n tabIndex?: number;\n} & TestID &\n StyledPropsBlade;\n\nconst _Checkbox: React.ForwardRefRenderFunction<BladeElementRef, CheckboxProps> = (\n {\n defaultChecked,\n validationState,\n isChecked,\n isDisabled,\n isIndeterminate,\n isRequired,\n name,\n onChange,\n value,\n children,\n helpText,\n errorText,\n size = 'medium',\n tabIndex,\n testID,\n ...styledProps\n },\n ref,\n) => {\n const groupProps = useCheckboxGroupContext();\n\n // ban certain props in checkbox while inside group\n const hasValidationState = !isUndefined(validationState);\n const hasName = !isUndefined(name);\n const hasDefaultChecked = !isUndefined(defaultChecked);\n const hasIsChecked = !isUndefined(isChecked);\n const hasOnChange = !isUndefined(onChange);\n\n if (__DEV__) {\n if (\n (hasValidationState || hasName || hasDefaultChecked || hasIsChecked || hasOnChange) &&\n !isEmpty(groupProps)\n ) {\n const props = [\n hasValidationState ? 'validationState' : undefined,\n hasName ? 'name' : undefined,\n hasDefaultChecked ? 'defaultChecked' : undefined,\n hasIsChecked ? 'isChecked' : undefined,\n hasOnChange ? 'onChange' : undefined,\n ]\n .filter(Boolean)\n .join(',');\n\n throwBladeError({\n message: `Cannot set \\`${props}\\` on <Checkbox /> when it's inside <CheckboxGroup />, Please set it on the <CheckboxGroup /> itself`,\n moduleName: 'Checkbox',\n });\n }\n\n // mandate value prop when using inside group\n if (!value && !isEmpty(groupProps)) {\n throw new Error(\n `[Blade Checkbox]: <CheckboxGroup /> requires that you pass unique \"value\" prop to each <Checkbox />\n <CheckboxGroup>\n <Checkbox value=\"apple\">Apple</Checkbox>\n <Checkbox value=\"mango\">Mango</Checkbox>\n </CheckboxGroup>\n `,\n );\n }\n }\n\n const _validationState = validationState ?? groupProps?.validationState;\n const _hasError = _validationState === 'error';\n const _isDisabled = isDisabled ?? groupProps?.isDisabled;\n const _isRequired = Boolean(\n isRequired || groupProps?.isRequired || groupProps?.necessityIndicator === 'required',\n );\n const _name = name ?? groupProps?.name;\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n const _isChecked = isChecked ?? groupProps?.state?.isChecked(value!);\n const _size = groupProps.size ?? size;\n const { theme } = useTheme();\n const formHintSize = {\n small: 'medium',\n medium: 'medium',\n large: 'large',\n } as const;\n\n const showSupportingText = helpText;\n\n const handleChange: OnChange = ({ isChecked, event, value }) => {\n if (isChecked) {\n groupProps?.state?.addValue(value!);\n } else {\n groupProps?.state?.removeValue(value!);\n }\n\n onChange?.({ isChecked, event, value });\n };\n\n const { state, ids, inputProps } = useCheckbox({\n defaultChecked,\n isChecked: _isChecked,\n isIndeterminate,\n hasError: _hasError,\n hasHelperText: Boolean(showSupportingText),\n isDisabled: _isDisabled,\n isRequired: _isRequired,\n name: _name,\n value,\n onChange: handleChange,\n });\n\n // Checkbox icon's size & margin + margin-left of SelectorTitle which is 2\n const helpTextLeftSpacing = makeSize(checkboxSizes.icon[size].width + theme.spacing[3]);\n\n return (\n <BaseBox\n {...metaAttribute({ name: MetaConstants.Checkbox, testID })}\n {...getStyledProps(styledProps)}\n >\n <SelectorLabel\n componentName={MetaConstants.CheckboxLabel}\n inputProps={state.isReactNative ? inputProps : {}}\n >\n <BaseBox display=\"flex\" flexDirection=\"column\">\n <BaseBox display=\"flex\" flexDirection=\"row\">\n <SelectorInput\n hoverTokens={checkboxHoverTokens}\n isChecked={state.isChecked || Boolean(isIndeterminate)}\n isDisabled={_isDisabled}\n hasError={_hasError}\n inputProps={inputProps}\n tabIndex={tabIndex}\n ref={ref}\n />\n <CheckboxIcon\n size={_size}\n isChecked={state.isChecked}\n isIndeterminate={isIndeterminate}\n isDisabled={_isDisabled}\n isNegative={_hasError}\n />\n {children ? (\n <SelectorTitle size={_size} isDisabled={_isDisabled}>\n {children}\n </SelectorTitle>\n ) : null}\n </BaseBox>\n {showSupportingText ? (\n <BaseBox marginLeft={helpTextLeftSpacing}>\n <SelectorSupportText size={_size} id={ids?.helpTextId}>\n {helpText}\n </SelectorSupportText>\n </BaseBox>\n ) : null}\n </BaseBox>\n </SelectorLabel>\n <FormHint\n size={formHintSize[_size]}\n errorText={errorText}\n errorTextId={ids?.errorTextId}\n type={validationState === 'error' ? 'error' : 'help'}\n />\n </BaseBox>\n );\n};\n\nconst Checkbox = assignWithoutSideEffects(React.forwardRef(_Checkbox), {\n displayName: 'Checkbox',\n});\n\nexport type { CheckboxProps };\nexport { Checkbox };\n"],"names":["_Checkbox","_ref","ref","_groupProps$state","_groupProps$size","defaultChecked","validationState","isChecked","isDisabled","isIndeterminate","isRequired","name","onChange","value","children","helpText","errorText","_ref$size","size","tabIndex","testID","styledProps","_objectWithoutProperties","_excluded","groupProps","useCheckboxGroupContext","hasValidationState","isUndefined","hasName","hasDefaultChecked","hasIsChecked","hasOnChange","__DEV__","isEmpty","props","undefined","filter","Boolean","join","throwBladeError","message","moduleName","Error","_validationState","_hasError","_isDisabled","_isRequired","necessityIndicator","_name","_isChecked","state","_size","_useTheme","useTheme","theme","formHintSize","small","medium","large","showSupportingText","handleChange","_ref2","event","_groupProps$state2","addValue","_groupProps$state3","removeValue","_useCheckbox","useCheckbox","hasError","hasHelperText","ids","inputProps","helpTextLeftSpacing","makeSize","checkboxSizes","icon","width","spacing","_jsxs","BaseBox","Object","assign","metaAttribute","MetaConstants","Checkbox","getStyledProps","_jsx","SelectorLabel","componentName","CheckboxLabel","isReactNative","display","flexDirection","SelectorInput","hoverTokens","checkboxHoverTokens","CheckboxIcon","isNegative","SelectorTitle","marginLeft","SelectorSupportText","id","helpTextId","FormHint","errorTextId","type","assignWithoutSideEffects","React","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAA,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AAHA,GAAG,CAAEgC,UAAW,CAAAzF,QAAA,CACnDC,QAAQ,CACU,CAAC,CACf,CAAC,CACR,IAAI,EACD,CAAC,CACG,CAAC,CAChBwE,GAAA,CAACiB,QAAQ,CACPtF,CAAAA,IAAI,CAAEqC,YAAY,CAACJ,KAAK,CAAE,CAC1BnC,SAAS,CAAEA,SAAU,CACrByF,WAAW,CAAElC,GAAG,EAAHA,IAAAA,CAAAA,KAAAA,CAAAA,CAAAA,GAAG,CAAEkC,WAAY,CAC9BC,IAAI,CAAEpG,eAAe,GAAK,OAAO,CAAG,OAAO,CAAG,MAAO,CACtD,CAAC,GACK,CAAC,CAEd,CAAC,CAEK,IAAA+E,QAAQ,CAAGsB,wBAAwB,CAACC,cAAK,CAACC,UAAU,CAAC7G,SAAS,CAAC,CAAE,CACrE8G,WAAW,CAAE,UACf,CAAC;;;;"}
@@ -12,7 +12,7 @@ import { makeAccessible } from '../../utils/makeAccessible/makeAccessible.native
12
12
  import { MetaConstants } from '../../utils/metaAttribute/metaConstants.js';
13
13
  import { jsx } from 'react/jsx-runtime';
14
14
 
15
- var _DropdownHeader=function _DropdownHeader(_ref){var title=_ref.title,subtitle=_ref.subtitle,leading=_ref.leading,titleSuffix=_ref.titleSuffix,trailing=_ref.trailing,testID=_ref.testID;return jsx(BaseBox,Object.assign({flexShrink:0},isReactNative()?{}:{onMouseDown:function onMouseDown(e){e.preventDefault();}},{children:jsx(BaseHeader,{title:title,subtitle:subtitle,leading:leading,trailing:trailing,titleSuffix:titleSuffix,metaComponentName:MetaConstants.DropdownHeader,testID:testID,showBackButton:false,showCloseButton:false})}));};var DropdownHeader=assignWithoutSideEffects(_DropdownHeader,{componentId:'DropdownHeader'});var _DropdownFooter=function _DropdownFooter(_ref2){var children=_ref2.children,testID=_ref2.testID;var _useDropdown=useDropdown(),setHasFooterAction=_useDropdown.setHasFooterAction,activeIndex=_useDropdown.activeIndex,onTriggerKeydown=_useDropdown.onTriggerKeydown,isOpen=_useDropdown.isOpen;var footerRef=React__default.useRef(null);React__default.useEffect(function(){setHasFooterAction(true);},[]);return jsx(BaseBox,Object.assign({ref:footerRef},isReactNative()?{}:{onKeyDown:function onKeyDown(e){var nativeEvent=e.nativeEvent;var shouldIgnoreDropdownKeydown=(nativeEvent.key===' '||nativeEvent.key==='Enter')&&activeIndex<0;if(!shouldIgnoreDropdownKeydown){onTriggerKeydown==null?void 0:onTriggerKeydown({event:e.nativeEvent});}}},makeAccessible({role:isReactNative()?undefined:'group'}),{children:jsx(BaseFooter,{metaComponentName:MetaConstants.DropdownFooter,testID:testID,children:isOpen?children:null})}));};var DropdownFooter=assignWithoutSideEffects(_DropdownFooter,{componentId:'DropdownFooter'});
15
+ var _DropdownHeader=function _DropdownHeader(_ref){var title=_ref.title,subtitle=_ref.subtitle,leading=_ref.leading,titleSuffix=_ref.titleSuffix,trailing=_ref.trailing,testID=_ref.testID;return jsx(BaseBox,Object.assign({flexShrink:0},isReactNative()?{}:{onMouseDown:function onMouseDown(e){e.preventDefault();}},{children:jsx(BaseHeader,{title:title,subtitle:subtitle,leading:leading,trailing:trailing,titleSuffix:titleSuffix,metaComponentName:MetaConstants.DropdownHeader,testID:testID,showBackButton:false,showCloseButton:false})}));};var DropdownHeader=assignWithoutSideEffects(_DropdownHeader,{componentId:'DropdownHeader'});var _DropdownFooter=function _DropdownFooter(_ref2){var children=_ref2.children,testID=_ref2.testID;var _useDropdown=useDropdown(),setHasFooterAction=_useDropdown.setHasFooterAction,isOpen=_useDropdown.isOpen;var footerRef=React__default.useRef(null);React__default.useEffect(function(){setHasFooterAction(true);},[]);return jsx(BaseBox,Object.assign({ref:footerRef},makeAccessible({role:isReactNative()?undefined:'group'}),{children:jsx(BaseFooter,{metaComponentName:MetaConstants.DropdownFooter,testID:testID,children:isOpen?children:null})}));};var DropdownFooter=assignWithoutSideEffects(_DropdownFooter,{componentId:'DropdownFooter'});
16
16
 
17
17
  export { DropdownFooter, DropdownHeader };
18
18
  //# sourceMappingURL=DropdownHeaderFooter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownHeaderFooter.js","sources":["../../../../../src/components/Dropdown/DropdownHeaderFooter.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */\nimport React from 'react';\nimport { useDropdown } from './useDropdown';\nimport { BaseFooter } from '~components/BaseHeaderFooter/BaseFooter';\nimport { BaseHeader } from '~components/BaseHeaderFooter/BaseHeader';\nimport type { BaseHeaderProps } from '~components/BaseHeaderFooter/BaseHeader';\nimport type { BaseFooterProps } from '~components/BaseHeaderFooter/BaseFooter';\nimport BaseBox from '~components/Box/BaseBox';\nimport { isReactNative } from '~utils';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { MetaConstants } from '~utils/metaAttribute/metaConstants';\n\ntype DropdownHeaderProps = Pick<\n BaseHeaderProps,\n 'title' | 'subtitle' | 'leading' | 'trailing' | 'titleSuffix' | 'testID'\n>;\n\nconst _DropdownHeader = ({\n title,\n subtitle,\n leading,\n titleSuffix,\n trailing,\n testID,\n}: DropdownHeaderProps): React.ReactElement => {\n return (\n <BaseBox\n flexShrink={0}\n {...(isReactNative()\n ? {}\n : {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onMouseDown: (e: any) => {\n // we don't want focus to ever move on header because its static element\n e.preventDefault();\n },\n })}\n >\n <BaseHeader\n title={title}\n subtitle={subtitle}\n leading={leading}\n trailing={trailing}\n titleSuffix={titleSuffix}\n metaComponentName={MetaConstants.DropdownHeader}\n testID={testID}\n // back button\n showBackButton={false}\n // close button\n showCloseButton={false}\n />\n </BaseBox>\n );\n};\n\nconst DropdownHeader = assignWithoutSideEffects(_DropdownHeader, {\n componentId: 'DropdownHeader',\n});\n\ntype DropdownFooter = Pick<BaseFooterProps, 'children' | 'testID'>;\n\nconst _DropdownFooter = ({ children, testID }: DropdownFooter): React.ReactElement => {\n const { setHasFooterAction, activeIndex, onTriggerKeydown, isOpen } = useDropdown();\n const footerRef = React.useRef<HTMLDivElement>(null);\n\n React.useEffect(() => {\n setHasFooterAction(true);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return (\n <BaseBox\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref={footerRef as any}\n {...(isReactNative()\n ? {}\n : {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onKeyDown: (e: any) => {\n const nativeEvent = e.nativeEvent;\n const shouldIgnoreDropdownKeydown =\n (nativeEvent.key === ' ' || nativeEvent.key === 'Enter') && activeIndex < 0;\n\n if (!shouldIgnoreDropdownKeydown) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onTriggerKeydown?.({ event: e.nativeEvent } as any);\n }\n },\n })}\n {...makeAccessible({\n role: isReactNative() ? undefined : 'group',\n })}\n >\n <BaseFooter metaComponentName={MetaConstants.DropdownFooter} testID={testID}>\n {/* We don't want any of the interactive children to get focussed on TAB when dropdown is closed so we remove them from DOM itself */}\n {isOpen ? children : null}\n </BaseFooter>\n </BaseBox>\n );\n};\n\nconst DropdownFooter = assignWithoutSideEffects(_DropdownFooter, {\n componentId: 'DropdownFooter',\n});\n\nexport { DropdownHeader, DropdownFooter };\n"],"names":["_DropdownHeader","_ref","title","subtitle","leading","titleSuffix","trailing","testID","_jsx","BaseBox","Object","assign","flexShrink","isReactNative","onMouseDown","e","preventDefault","children","BaseHeader","metaComponentName","MetaConstants","DropdownHeader","showBackButton","showCloseButton","assignWithoutSideEffects","componentId","_DropdownFooter","_ref2","_useDropdown","useDropdown","setHasFooterAction","activeIndex","onTriggerKeydown","isOpen","footerRef","React","useRef","useEffect","ref","onKeyDown","nativeEvent","shouldIgnoreDropdownKeydown","key","event","makeAccessible","role","undefined","BaseFooter","DropdownFooter"],"mappings":";;;;;;;;;;;;;;AAkBA,IAAMA,eAAe,CAAG,SAAlBA,eAAeA,CAAAC,IAAA,CAO0B,CAN7C,IAAAC,KAAK,CAAAD,IAAA,CAALC,KAAK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,cAAK,CAACC,MAAM,CAAiB,IAAI,CAAC,CAEpDD,cAAK,CAACE,SAAS,CAAC,UAAM,CACpBP,kBAAkB,CAAC,IAAI,CAAC,CAE1B,CAAC,CAAE,EAAE,CAAC,CAEN,OACEtB,GAAA,CAACC,OAAO,CAAAC,MAAA,CAAAC,MAAA,CAEN2B,CAAAA,GAAG,CAAEJ,SAAiB,CACjBrB,CAAAA,aAAa,EAAE,CAChB,EAAE,CACF,CAEE0B,SAAS,CAAE,SAAAA,SAAAA,CAACxB,CAAM,CAAK,CACrB,IAAMyB,WAAW,CAAGzB,CAAC,CAACyB,WAAW,CACjC,IAAMC,2BAA2B,CAC/B,CAACD,WAAW,CAACE,GAAG,GAAK,GAAG,EAAIF,WAAW,CAACE,GAAG,GAAK,OAAO,GAAKX,WAAW,CAAG,CAAC,CAE7E,GAAI,CAACU,2BAA2B,CAAE,CAEhCT,gBAAgB,EAAA,IAAA,CAAA,KAAA,CAAA,CAAhBA,gBAAgB,CAAG,CAAEW,KAAK,CAAE5B,CAAC,CAACyB,WAAY,CAAQ,CAAC,CACrD,CACF,CACF,CAAC,CACDI,cAAc,CAAC,CACjBC,IAAI,CAAEhC,aAAa,EAAE,CAAGiC,SAAS,CAAG,OACtC,CAAC,CAAC,CAAA7B,CAAAA,QAAA,CAEFT,GAAA,CAACuC,UAAU,CAAC5B,CAAAA,iBAAiB,CAAEC,aAAa,CAAC4B,cAAe,CAACzC,MAAM,CAAEA,MAAO,CAAAU,QAAA,CAEzEgB,MAAM,CAAGhB,QAAQ,CAAG,IAAI,CACf,CAAC,CACN,CAAA,CAAC,CAEd,CAAC,CAEK,IAAA+B,cAAc,CAAGxB,wBAAwB,CAACE,eAAe,CAAE,CAC/DD,WAAW,CAAE,gBACf,CAAC;;;;"}
1
+ {"version":3,"file":"DropdownHeaderFooter.js","sources":["../../../../../src/components/Dropdown/DropdownHeaderFooter.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */\nimport React from 'react';\nimport { useDropdown } from './useDropdown';\nimport { BaseFooter } from '~components/BaseHeaderFooter/BaseFooter';\nimport { BaseHeader } from '~components/BaseHeaderFooter/BaseHeader';\nimport type { BaseHeaderProps } from '~components/BaseHeaderFooter/BaseHeader';\nimport type { BaseFooterProps } from '~components/BaseHeaderFooter/BaseFooter';\nimport BaseBox from '~components/Box/BaseBox';\nimport { isReactNative } from '~utils';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { MetaConstants } from '~utils/metaAttribute/metaConstants';\n\ntype DropdownHeaderProps = Pick<\n BaseHeaderProps,\n 'title' | 'subtitle' | 'leading' | 'trailing' | 'titleSuffix' | 'testID'\n>;\n\nconst _DropdownHeader = ({\n title,\n subtitle,\n leading,\n titleSuffix,\n trailing,\n testID,\n}: DropdownHeaderProps): React.ReactElement => {\n return (\n <BaseBox\n flexShrink={0}\n {...(isReactNative()\n ? {}\n : {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onMouseDown: (e: any) => {\n // we don't want focus to ever move on header because its static element\n e.preventDefault();\n },\n })}\n >\n <BaseHeader\n title={title}\n subtitle={subtitle}\n leading={leading}\n trailing={trailing}\n titleSuffix={titleSuffix}\n metaComponentName={MetaConstants.DropdownHeader}\n testID={testID}\n // back button\n showBackButton={false}\n // close button\n showCloseButton={false}\n />\n </BaseBox>\n );\n};\n\nconst DropdownHeader = assignWithoutSideEffects(_DropdownHeader, {\n componentId: 'DropdownHeader',\n});\n\ntype DropdownFooter = Pick<BaseFooterProps, 'children' | 'testID'>;\n\nconst _DropdownFooter = ({ children, testID }: DropdownFooter): React.ReactElement => {\n const { setHasFooterAction, isOpen } = useDropdown();\n const footerRef = React.useRef<HTMLDivElement>(null);\n\n React.useEffect(() => {\n setHasFooterAction(true);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return (\n <BaseBox\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref={footerRef as any}\n {...makeAccessible({\n role: isReactNative() ? undefined : 'group',\n })}\n >\n <BaseFooter metaComponentName={MetaConstants.DropdownFooter} testID={testID}>\n {/* We don't want any of the interactive children to get focussed on TAB when dropdown is closed so we remove them from DOM itself */}\n {isOpen ? children : null}\n </BaseFooter>\n </BaseBox>\n );\n};\n\nconst DropdownFooter = assignWithoutSideEffects(_DropdownFooter, {\n componentId: 'DropdownFooter',\n});\n\nexport { DropdownHeader, DropdownFooter };\n"],"names":["_DropdownHeader","_ref","title","subtitle","leading","titleSuffix","trailing","testID","_jsx","BaseBox","Object","assign","flexShrink","isReactNative","onMouseDown","e","preventDefault","children","BaseHeader","metaComponentName","MetaConstants","DropdownHeader","showBackButton","showCloseButton","assignWithoutSideEffects","componentId","_DropdownFooter","_ref2","_useDropdown","useDropdown","setHasFooterAction","isOpen","footerRef","React","useRef","useEffect","ref","makeAccessible","role","undefined","BaseFooter","DropdownFooter"],"mappings":";;;;;;;;;;;;;;AAkBA,IAAMA,eAAe,CAAG,SAAlBA,eAAeA,CAAAC,IAAA,CAO0B,CAN7C,IAAAC,KAAK,CAAAD,IAAA,CAALC,KAAK,CACLC,QAAQ,CAAAF,IAAA,CAARE,QAAQ,CACRC,OAAO,CAAAH,IAAA,CAAPG,OAAO,CACPC,WAAW,CAAAJ,IAAA,CAAXI,WAAW,CACXC,QAAQ,CAAAL,IAAA,CAARK,QAAQ,CACRC,MAAM,CAAAN,IAAA,CAANM,MAAM,CAEN,OACEC,GAAA,CAACC,OAAO,CAAAC,MAAA,CAAAC,MAAA,CACNC,CAAAA,UAAU,CAAE,CAAE,CAAA,CACTC,aAAa,EAAE,CAChB,EAAE,CACF,CAEEC,WAAW,CAAE,SAAAA,WAACC,CAAAA,CAAM,CAAK,CAEvBA,CAAC,CAACC,cAAc,EAAE,CACpB,CACF,CAAC,CAAA,CAAAC,QAAA,CAELT,GAAA,CAACU,UAAU,EACThB,KAAK,CAAEA,KAAM,CACbC,QAAQ,CAAEA,QAAS,CACnBC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,CAAE,gBACf,CAAC;;;;"}
@@ -24,7 +24,7 @@ import { jsx, jsxs } from 'react/jsx-runtime';
24
24
  import { BaseBox } from '../Box/BaseBox/BaseBox.native.js';
25
25
  import { makeAccessible } from '../../utils/makeAccessible/makeAccessible.native.js';
26
26
 
27
- var _excluded=["accessibilityLabel","color","type","isIndeterminate","label","showPercentage","size","value","variant","min","max","testID"];var progressBarHeight={small:size[2],medium:size[4],large:size[0]};var ProgressBar=function ProgressBar(_ref){var _label$trim;var accessibilityLabel=_ref.accessibilityLabel,color=_ref.color,type=_ref.type,_ref$isIndeterminate=_ref.isIndeterminate,isIndeterminate=_ref$isIndeterminate===void 0?false:_ref$isIndeterminate,label=_ref.label,_ref$showPercentage=_ref.showPercentage,showPercentage=_ref$showPercentage===void 0?true:_ref$showPercentage,_ref$size=_ref.size,size=_ref$size===void 0?'small':_ref$size,_ref$value=_ref.value,value=_ref$value===void 0?0:_ref$value,_ref$variant=_ref.variant,variant=_ref$variant===void 0?'progress':_ref$variant,_ref$min=_ref.min,min=_ref$min===void 0?0:_ref$min,_ref$max=_ref.max,max=_ref$max===void 0?100:_ref$max,testID=_ref.testID,styledProps=_objectWithoutProperties(_ref,_excluded);var _useTheme=useTheme(),theme=_useTheme.theme;var progressType=!type&&(variant==='meter'||variant==='progress')?variant:type;var progressVariant=variant==='meter'||variant==='progress'?'linear':variant;var id=useId(`${progressType}-${progressVariant}`);if(__DEV__){if(progressType==='meter'&&isIndeterminate){throwBladeError({moduleName:'ProgressBar',message:`Cannot set 'isIndeterminate' when 'type' or 'variant' is 'meter'.`});}if(progressVariant==='circular'&&isIndeterminate){throwBladeError({moduleName:'ProgressBar',message:`Cannot set 'isIndeterminate' when 'variant' is 'circular'.`});}if(progressVariant==='linear'&&size==='large'){throwBladeError({moduleName:'ProgressBar',message:`Large size isn't available when 'variant' is 'linear'.`});}if(type&&(variant==='progress'||variant==='meter')){throwBladeError({moduleName:'ProgressBar',message:`variant can only be 'linear' or 'circular' when 'type=${type}'.`});}}var unfilledBackgroundColor=theme.colors.feedback.background.neutral.subtle;var filledBackgroundColor=color?theme.colors.feedback.background[color].intense:theme.colors.surface.background.primary.intense;var hasLabel=label&&((_label$trim=label.trim())==null?void 0:_label$trim.length)>0;var isMeter=progressType==='meter';var isCircular=progressVariant==='circular';var progressValue=clamp(value,min,max);var percentageProgressValue=Math.floor((progressValue-min)*100/(max-min));var shouldShowPercentage=showPercentage&&!isMeter&&!isIndeterminate;var accessibilityProps={role:'progressbar',label:accessibilityLabel!=null?accessibilityLabel:label,valueNow:percentageProgressValue,valueText:`${percentageProgressValue}%`,valueMin:min,valueMax:max};if(isMeter){accessibilityProps.role='meter';accessibilityProps.valueNow=progressValue;accessibilityProps.valueText=`${progressValue}`;}if(isIndeterminate){accessibilityProps.valueNow=undefined;accessibilityProps.valueMin=undefined;accessibilityProps.valueMax=undefined;accessibilityProps.valueText=undefined;}return jsx(BaseBox,Object.assign({},getStyledProps(styledProps),metaAttribute({name:MetaConstants.ProgressBar,testID:testID}),{children:jsxs(BaseBox,{display:"flex",flexDirection:"column",width:"100%",children:[!isCircular?jsxs(BaseBox,{display:"flex",flexDirection:"row",justifyContent:hasLabel?'space-between':'flex-end',children:[hasLabel?jsx(Text,{as:"label",variant:"body",size:"small",color:"surface.text.gray.subtle",children:label}):null,shouldShowPercentage?jsx(BaseBox,{marginBottom:"spacing.2",children:jsx(Text,{variant:"body",size:"small",color:"surface.text.gray.subtle",children:`${percentageProgressValue}%`})}):null]}):null,jsx(BaseBox,Object.assign({id:id},makeAccessible({role:accessibilityProps.role,label:accessibilityProps.label,valueNow:accessibilityProps.valueNow,valueText:accessibilityProps.valueText,valueMin:accessibilityProps.valueMin,valueMax:accessibilityProps.valueMax}),{children:isCircular?jsx(CircularProgressBarFilled,{size:size,label:label,progressPercent:percentageProgressValue,isMeter:isMeter,showPercentage:shouldShowPercentage,backgroundColor:unfilledBackgroundColor,fillColor:filledBackgroundColor,pulseMotionDuration:"duration.2xgentle",fillMotionDuration:"duration.2xgentle",pulseMotionDelay:"delay.long",motionEasing:"easing.standard.revealing"}):jsx(BaseBox,{backgroundColor:unfilledBackgroundColor,height:makeSize(progressBarHeight[size]),overflow:"hidden",position:"relative",children:jsx(ProgressBarFilled,{backgroundColor:filledBackgroundColor,progress:percentageProgressValue,fillMotionDuration:"duration.2xgentle",pulseMotionDuration:"duration.2xgentle",indeterminateMotionDuration:"duration.2xgentle",pulseMotionDelay:"delay.long",motionEasing:"easing.standard.revealing",type:progressType,isIndeterminate:isIndeterminate})})}))]})}));};
27
+ var _excluded=["accessibilityLabel","color","type","isIndeterminate","label","showPercentage","size","value","variant","min","max","testID"];var progressBarHeight={small:size[2],medium:size[4],large:size[0]};var ProgressBar=function ProgressBar(_ref){var _label$trim;var accessibilityLabel=_ref.accessibilityLabel,color=_ref.color,type=_ref.type,_ref$isIndeterminate=_ref.isIndeterminate,isIndeterminate=_ref$isIndeterminate===void 0?false:_ref$isIndeterminate,label=_ref.label,_ref$showPercentage=_ref.showPercentage,showPercentage=_ref$showPercentage===void 0?true:_ref$showPercentage,_ref$size=_ref.size,size=_ref$size===void 0?'small':_ref$size,_ref$value=_ref.value,value=_ref$value===void 0?0:_ref$value,_ref$variant=_ref.variant,variant=_ref$variant===void 0?'progress':_ref$variant,_ref$min=_ref.min,min=_ref$min===void 0?0:_ref$min,_ref$max=_ref.max,max=_ref$max===void 0?100:_ref$max,testID=_ref.testID,styledProps=_objectWithoutProperties(_ref,_excluded);var _useTheme=useTheme(),theme=_useTheme.theme;var progressType=!type&&(variant==='meter'||variant==='progress')?variant:type;var progressVariant=variant==='meter'||variant==='progress'?'linear':variant;var id=useId(`${progressType}-${progressVariant}`);if(__DEV__){if(progressType==='meter'&&isIndeterminate){throwBladeError({moduleName:'ProgressBar',message:`Cannot set 'isIndeterminate' when 'type' or 'variant' is 'meter'.`});}if(progressVariant==='circular'&&isIndeterminate){throwBladeError({moduleName:'ProgressBar',message:`Cannot set 'isIndeterminate' when 'variant' is 'circular'.`});}if(progressVariant==='linear'&&size==='large'){throwBladeError({moduleName:'ProgressBar',message:`Large size isn't available when 'variant' is 'linear'.`});}if(type&&(variant==='progress'||variant==='meter')){throwBladeError({moduleName:'ProgressBar',message:`variant can only be 'linear' or 'circular' when 'type=${type}'.`});}}var unfilledBackgroundColor=theme.colors.feedback.background.neutral.subtle;var filledBackgroundColor=color?theme.colors.feedback.background[color].intense:theme.colors.surface.background.primary.intense;var hasLabel=label&&((_label$trim=label.trim())==null?void 0:_label$trim.length)>0;var isMeter=progressType==='meter';var isCircular=progressVariant==='circular';var progressValue=clamp(value,min,max);var percentageProgressValue=Math.floor((progressValue-min)*100/(max-min));var shouldShowPercentage=showPercentage&&!isMeter&&!isIndeterminate;var accessibilityProps={role:'progressbar',label:accessibilityLabel!=null?accessibilityLabel:label,valueNow:percentageProgressValue,valueText:`${percentageProgressValue}%`,valueMin:min,valueMax:max};if(isMeter){accessibilityProps.role='meter';accessibilityProps.valueNow=progressValue;accessibilityProps.valueText=`${progressValue}`;}if(isIndeterminate){accessibilityProps.valueNow=undefined;accessibilityProps.valueMin=undefined;accessibilityProps.valueMax=undefined;accessibilityProps.valueText=undefined;}return jsx(BaseBox,Object.assign({},getStyledProps(styledProps),metaAttribute({name:MetaConstants.ProgressBar,testID:testID}),{children:jsxs(BaseBox,{display:"flex",flexDirection:"column",width:"100%",children:[!isCircular?jsxs(BaseBox,{display:"flex",flexDirection:"row",justifyContent:hasLabel?'space-between':'flex-end',children:[hasLabel?jsx(Text,{as:"label",variant:"body",size:"small",color:"surface.text.gray.subtle",children:label}):null,shouldShowPercentage?jsx(BaseBox,{marginBottom:"spacing.2",children:jsx(Text,{variant:"body",size:"small",color:"surface.text.gray.subtle",children:`${percentageProgressValue}%`})}):null]}):null,jsx(BaseBox,Object.assign({id:id},makeAccessible({role:accessibilityProps.role,label:accessibilityProps.label,valueNow:accessibilityProps.valueNow,valueText:accessibilityProps.valueText,valueMin:accessibilityProps.valueMin,valueMax:accessibilityProps.valueMax}),{children:isCircular?jsx(CircularProgressBarFilled,{size:size,label:label,progressPercent:percentageProgressValue,isMeter:isMeter,showPercentage:showPercentage,backgroundColor:unfilledBackgroundColor,fillColor:filledBackgroundColor,pulseMotionDuration:"duration.2xgentle",fillMotionDuration:"duration.2xgentle",pulseMotionDelay:"delay.long",motionEasing:"easing.standard.revealing"}):jsx(BaseBox,{backgroundColor:unfilledBackgroundColor,height:makeSize(progressBarHeight[size]),overflow:"hidden",position:"relative",children:jsx(ProgressBarFilled,{backgroundColor:filledBackgroundColor,progress:percentageProgressValue,fillMotionDuration:"duration.2xgentle",pulseMotionDuration:"duration.2xgentle",indeterminateMotionDuration:"duration.2xgentle",pulseMotionDelay:"delay.long",motionEasing:"easing.standard.revealing",type:progressType,isIndeterminate:isIndeterminate})})}))]})}));};
28
28
 
29
29
  export { ProgressBar };
30
30
  //# sourceMappingURL=ProgressBar.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ProgressBar.js","sources":["../../../../../src/components/ProgressBar/ProgressBar.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport { ProgressBarFilled } from './ProgressBarFilled';\nimport { CircularProgressBarFilled } from './CircularProgressBar';\nimport clamp from '~utils/lodashButBetter/clamp';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { Text } from '~components/Typography/Text';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { useId } from '~utils/useId';\nimport { useTheme } from '~components/BladeProvider';\nimport type { BaseBoxProps } from '~components/Box/BaseBox';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { FeedbackColors } from '~tokens/theme/theme';\nimport { size } from '~tokens/global';\nimport type { TestID } from '~utils/types';\nimport { makeSize } from '~utils/makeSize';\nimport type { AccessibilityProps } from '~utils/makeAccessible';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { throwBladeError } from '~utils/logger';\n\ntype ProgressBarCommonProps = {\n /**\n * Sets aria-label to help users know what the progress bar is for. Default value is the same as the `label` passed.\n */\n accessibilityLabel?: string;\n /**\n * Sets the color of the progress bar which changes the feedback color.\n */\n color?: FeedbackColors;\n /**\n * Sets the type of the progress bar.\n * @default 'progress'\n */\n type?: 'meter' | 'progress';\n /**\n * Sets the label to be rendered for the progress bar. This value will also be used as default for `accessibilityLabel`.\n */\n label?: string;\n /**\n * Sets the size of the progress bar.\n * Note: 'large' size isn't available when the variant is 'linear'.\n * @default 'small'\n */\n size?: 'small' | 'medium' | 'large';\n /**\n * Sets the progress value of the progress bar.\n * @default 'small'\n */\n value?: number;\n /**\n * Sets the minimum value for the progress bar.\n * @default 0\n */\n min?: number;\n /**\n * Sets the maximum value for the progress bar.\n * @default 100\n */\n max?: number;\n} & TestID &\n StyledPropsBlade;\n\ntype ProgressBarVariant = 'progress' | 'meter' | 'linear' | 'circular';\n\ntype ProgressBarProgressProps = ProgressBarCommonProps & {\n /**\n * Sets the variant to be rendered for the progress bar.\n * @default 'progress'\n */\n variant?: Extract<ProgressBarVariant, 'progress' | 'linear' | 'circular'>;\n /**\n * Sets whether the progress bar is in an indeterminate state.\n * @default false\n */\n isIndeterminate?: boolean;\n /**\n * Sets whether or not to show the progress percentage for the progress bar. Percentage is hidden by default for the `meter` variant.\n * @default true\n */\n showPercentage?: boolean;\n};\n\ntype ProgressBarMeterProps = ProgressBarCommonProps & {\n /**\n * Sets the variant to be rendered for thr progress bar.\n * @default 'progress'\n */\n variant?: Extract<ProgressBarVariant, 'meter' | 'linear' | 'circular'>;\n /**\n * Sets whether the progress bar is in an indeterminate state.\n * @default false\n */\n isIndeterminate?: undefined;\n /**\n * Sets whether or not to show the progress percentage for the progress bar. Percentage is hidden by default for the `meter` variant.\n * @default false\n */\n showPercentage?: undefined;\n};\n\ntype ProgressBarProps = ProgressBarProgressProps | ProgressBarMeterProps;\n\nconst progressBarHeight: Record<NonNullable<ProgressBarProps['size']>, 2 | 4 | 0> = {\n small: size[2],\n medium: size[4],\n // Large size isn't available when variant is 'linear'\n large: size[0],\n};\n\nconst ProgressBar = ({\n accessibilityLabel,\n color,\n type,\n isIndeterminate = false,\n label,\n showPercentage = true,\n size = 'small',\n value = 0,\n variant = 'progress',\n min = 0,\n max = 100,\n testID,\n ...styledProps\n}: ProgressBarProps): ReactElement => {\n const { theme } = useTheme();\n const progressType = !type && (variant === 'meter' || variant === 'progress') ? variant : type;\n const progressVariant = variant === 'meter' || variant === 'progress' ? 'linear' : variant;\n const id = useId(`${progressType}-${progressVariant}`);\n\n if (__DEV__) {\n if (progressType === 'meter' && isIndeterminate) {\n throwBladeError({\n moduleName: 'ProgressBar',\n message: `Cannot set 'isIndeterminate' when 'type' or 'variant' is 'meter'.`,\n });\n }\n\n if (progressVariant === 'circular' && isIndeterminate) {\n throwBladeError({\n moduleName: 'ProgressBar',\n message: `Cannot set 'isIndeterminate' when 'variant' is 'circular'.`,\n });\n }\n\n if (progressVariant === 'linear' && size === 'large') {\n throwBladeError({\n moduleName: 'ProgressBar',\n message: `Large size isn't available when 'variant' is 'linear'.`,\n });\n }\n\n if (type && (variant === 'progress' || variant === 'meter')) {\n throwBladeError({\n moduleName: 'ProgressBar',\n message: `variant can only be 'linear' or 'circular' when 'type=${type}'.`,\n });\n }\n }\n\n const unfilledBackgroundColor = theme.colors.feedback.background.neutral\n .subtle as BaseBoxProps['backgroundColor'];\n const filledBackgroundColor = color\n ? theme.colors.feedback.background[color].intense\n : theme.colors.surface.background.primary.intense;\n const hasLabel = label && label.trim()?.length > 0;\n const isMeter = progressType === 'meter';\n const isCircular = progressVariant === 'circular';\n const progressValue = clamp(value, min, max);\n const percentageProgressValue = Math.floor(((progressValue - min) * 100) / (max - min));\n const shouldShowPercentage = showPercentage && !isMeter && !isIndeterminate;\n const accessibilityProps: Pick<\n AccessibilityProps,\n 'role' | 'label' | 'valueMax' | 'valueNow' | 'valueMin' | 'valueText'\n > = {\n role: 'progressbar',\n label: accessibilityLabel ?? label,\n valueNow: percentageProgressValue,\n valueText: `${percentageProgressValue}%`,\n valueMin: min,\n valueMax: max,\n };\n\n if (isMeter) {\n accessibilityProps.role = 'meter';\n accessibilityProps.valueNow = progressValue;\n accessibilityProps.valueText = `${progressValue}`;\n }\n\n if (isIndeterminate) {\n accessibilityProps.valueNow = undefined;\n accessibilityProps.valueMin = undefined;\n accessibilityProps.valueMax = undefined;\n accessibilityProps.valueText = undefined;\n }\n\n return (\n <BaseBox\n {...getStyledProps(styledProps)}\n {...metaAttribute({ name: MetaConstants.ProgressBar, testID })}\n >\n <BaseBox display=\"flex\" flexDirection=\"column\" width=\"100%\">\n {!isCircular ? (\n <BaseBox\n display=\"flex\"\n flexDirection=\"row\"\n justifyContent={hasLabel ? 'space-between' : 'flex-end'}\n >\n {hasLabel ? (\n <Text as=\"label\" variant=\"body\" size=\"small\" color=\"surface.text.gray.subtle\">\n {label}\n </Text>\n ) : null}\n {shouldShowPercentage ? (\n <BaseBox marginBottom=\"spacing.2\">\n <Text\n variant=\"body\"\n size=\"small\"\n color=\"surface.text.gray.subtle\"\n >{`${percentageProgressValue}%`}</Text>\n </BaseBox>\n ) : null}\n </BaseBox>\n ) : null}\n\n <BaseBox\n id={id}\n {...makeAccessible({\n role: accessibilityProps.role,\n label: accessibilityProps.label,\n valueNow: accessibilityProps.valueNow,\n valueText: accessibilityProps.valueText,\n valueMin: accessibilityProps.valueMin,\n valueMax: accessibilityProps.valueMax,\n })}\n >\n {isCircular ? (\n <CircularProgressBarFilled\n size={size}\n label={label}\n progressPercent={percentageProgressValue}\n isMeter={isMeter}\n showPercentage={shouldShowPercentage}\n backgroundColor={unfilledBackgroundColor as string}\n fillColor={filledBackgroundColor}\n pulseMotionDuration=\"duration.2xgentle\"\n fillMotionDuration=\"duration.2xgentle\"\n pulseMotionDelay=\"delay.long\"\n motionEasing=\"easing.standard.revealing\"\n />\n ) : (\n <BaseBox\n backgroundColor={unfilledBackgroundColor}\n height={makeSize(progressBarHeight[size])}\n overflow=\"hidden\"\n position=\"relative\"\n >\n <ProgressBarFilled\n backgroundColor={filledBackgroundColor}\n progress={percentageProgressValue}\n fillMotionDuration=\"duration.2xgentle\"\n pulseMotionDuration=\"duration.2xgentle\"\n indeterminateMotionDuration=\"duration.2xgentle\"\n pulseMotionDelay=\"delay.long\"\n motionEasing=\"easing.standard.revealing\"\n type={progressType}\n isIndeterminate={isIndeterminate}\n />\n </BaseBox>\n )}\n </BaseBox>\n </BaseBox>\n </BaseBox>\n );\n};\n\nexport type { ProgressBarProps, ProgressBarVariant };\nexport { ProgressBar };\n"],"names":["progressBarHeight","small","size","medium","large","ProgressBar","_ref","_label$trim","accessibilityLabel","color","type","_ref$isIndeterminate","isIndeterminate","label","_ref$showPercentage","showPercentage","_ref$size","_ref$value","value","_ref$variant","variant","_ref$min","min","_ref$max","max","testID","styledProps","_objectWithoutProperties","_excluded","_useTheme","useTheme","theme","progressType","progressVariant","id","useId","__DEV__","throwBladeError","moduleName","message","unfilledBackgroundColor","colors","feedback","background","neutral","subtle","filledBackgroundColor","intense","surface","primary","hasLabel","trim","length","isMeter","isCircular","progressValue","clamp","percentageProgressValue","Math","floor","shouldShowPercentage","accessibilityProps","role","valueNow","valueText","valueMin","valueMax","undefined","_jsx","BaseBox","Object","assign","getStyledProps","metaAttribute","name","MetaConstants","children","_jsxs","display","flexDirection","width","justifyContent","Text","as","marginBottom","makeAccessible","CircularProgressBarFilled","progressPercent","backgroundColor","fillColor","pulseMotionDuration","fillMotionDuration","pulseMotionDelay","motionEasing","height","makeSize","overflow","position","ProgressBarFilled","progress","indeterminateMotionDuration"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;6IAsGA,IAAMA,iBAA2E,CAAG,CAClFC,KAAK,CAAEC,IAAI,CAAC,CAAC,CAAC,CACdC,MAAM,CAAED,IAAI,CAAC,CAAC,CAAC,CAEfE,KAAK,CAAEF,IAAI,CAAC,CAAC,CACf,CAAC,CAEK,IAAAG,WAAW,CAAG,SAAdA,WAAWA,CAAAC,IAAA,CAcqB,CAAAC,IAAAA,WAAA,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AACE,QAAQ,CACrCC,SAAS,CAAEH,kBAAkB,CAACG,SAAS,CACvCC,QAAQ,CAAEJ,kBAAkB,CAACI,QAAQ,CACrCC,QAAQ,CAAEL,kBAAkB,CAACK,QAC/B,CAAC,CAAC,CAAA,CAAAU,QAAA,CAEDtB,UAAU,CACTc,GAAA,CAACkB,yBAAyB,CACxBpF,CAAAA,IAAI,CAAEA,IAAK,CACXW,KAAK,CAAEA,KAAM,CACb0E,eAAe,CAAE9B,uBAAwB,CACzCJ,OAAO,CAAEA,OAAQ,CACjBtC,cAAc,CAAE6C,oBAAqB,CACrC4B,eAAe,CAAEhD,uBAAkC,CACnDiD,SAAS,CAAE3C,qBAAsB,CACjC4C,mBAAmB,CAAC,mBAAmB,CACvCC,kBAAkB,CAAC,mBAAmB,CACtCC,gBAAgB,CAAC,YAAY,CAC7BC,YAAY,CAAC,2BAA2B,CACzC,CAAC,CAEFzB,GAAA,CAACC,OAAO,CAAA,CACNmB,eAAe,CAAEhD,uBAAwB,CACzCsD,MAAM,CAAEC,QAAQ,CAAC/F,iBAAiB,CAACE,IAAI,CAAC,CAAE,CAC1C8F,QAAQ,CAAC,QAAQ,CACjBC,QAAQ,CAAC,UAAU,CAAArB,QAAA,CAEnBR,GAAA,CAAC8B,iBAAiB,CAAA,CAChBV,eAAe,CAAE1C,qBAAsB,CACvCqD,QAAQ,CAAE1C,uBAAwB,CAClCkC,kBAAkB,CAAC,mBAAmB,CACtCD,mBAAmB,CAAC,mBAAmB,CACvCU,2BAA2B,CAAC,mBAAmB,CAC/CR,gBAAgB,CAAC,YAAY,CAC7BC,YAAY,CAAC,2BAA2B,CACxCnF,IAAI,CAAEsB,YAAa,CACnBpB,eAAe,CAAEA,eAAgB,CAClC,CAAC,CACK,CACV,CACM,CAAA,CAAC,CACH,CAAA,CAAC,CACH,CAAA,CAAC,CAEd;;;;"}
1
+ {"version":3,"file":"ProgressBar.js","sources":["../../../../../src/components/ProgressBar/ProgressBar.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport { ProgressBarFilled } from './ProgressBarFilled';\nimport { CircularProgressBarFilled } from './CircularProgressBar';\nimport clamp from '~utils/lodashButBetter/clamp';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { Text } from '~components/Typography/Text';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { useId } from '~utils/useId';\nimport { useTheme } from '~components/BladeProvider';\nimport type { BaseBoxProps } from '~components/Box/BaseBox';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { FeedbackColors } from '~tokens/theme/theme';\nimport { size } from '~tokens/global';\nimport type { TestID } from '~utils/types';\nimport { makeSize } from '~utils/makeSize';\nimport type { AccessibilityProps } from '~utils/makeAccessible';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { throwBladeError } from '~utils/logger';\n\ntype ProgressBarCommonProps = {\n /**\n * Sets aria-label to help users know what the progress bar is for. Default value is the same as the `label` passed.\n */\n accessibilityLabel?: string;\n /**\n * Sets the color of the progress bar which changes the feedback color.\n */\n color?: FeedbackColors;\n /**\n * Sets the type of the progress bar.\n * @default 'progress'\n */\n type?: 'meter' | 'progress';\n /**\n * Sets the label to be rendered for the progress bar. This value will also be used as default for `accessibilityLabel`.\n */\n label?: string;\n /**\n * Sets the size of the progress bar.\n * Note: 'large' size isn't available when the variant is 'linear'.\n * @default 'small'\n */\n size?: 'small' | 'medium' | 'large';\n /**\n * Sets the progress value of the progress bar.\n * @default 'small'\n */\n value?: number;\n /**\n * Sets the minimum value for the progress bar.\n * @default 0\n */\n min?: number;\n /**\n * Sets the maximum value for the progress bar.\n * @default 100\n */\n max?: number;\n} & TestID &\n StyledPropsBlade;\n\ntype ProgressBarVariant = 'progress' | 'meter' | 'linear' | 'circular';\n\ntype ProgressBarProgressProps = ProgressBarCommonProps & {\n /**\n * Sets the variant to be rendered for the progress bar.\n * @default 'progress'\n */\n variant?: Extract<ProgressBarVariant, 'progress' | 'linear' | 'circular'>;\n /**\n * Sets whether the progress bar is in an indeterminate state.\n * @default false\n */\n isIndeterminate?: boolean;\n /**\n * Sets whether or not to show the progress percentage for the progress bar. Percentage is hidden by default for the `meter` variant.\n * @default true\n */\n showPercentage?: boolean;\n};\n\ntype ProgressBarMeterProps = ProgressBarCommonProps & {\n /**\n * Sets the variant to be rendered for thr progress bar.\n * @default 'progress'\n */\n variant?: Extract<ProgressBarVariant, 'meter' | 'linear' | 'circular'>;\n /**\n * Sets whether the progress bar is in an indeterminate state.\n * @default false\n */\n isIndeterminate?: undefined;\n /**\n * Sets whether or not to show the progress percentage for the progress bar. Percentage is hidden by default for the `meter` variant.\n * @default false\n */\n showPercentage?: undefined;\n};\n\ntype ProgressBarProps = ProgressBarProgressProps | ProgressBarMeterProps;\n\nconst progressBarHeight: Record<NonNullable<ProgressBarProps['size']>, 2 | 4 | 0> = {\n small: size[2],\n medium: size[4],\n // Large size isn't available when variant is 'linear'\n large: size[0],\n};\n\nconst ProgressBar = ({\n accessibilityLabel,\n color,\n type,\n isIndeterminate = false,\n label,\n showPercentage = true,\n size = 'small',\n value = 0,\n variant = 'progress',\n min = 0,\n max = 100,\n testID,\n ...styledProps\n}: ProgressBarProps): ReactElement => {\n const { theme } = useTheme();\n const progressType = !type && (variant === 'meter' || variant === 'progress') ? variant : type;\n const progressVariant = variant === 'meter' || variant === 'progress' ? 'linear' : variant;\n const id = useId(`${progressType}-${progressVariant}`);\n\n if (__DEV__) {\n if (progressType === 'meter' && isIndeterminate) {\n throwBladeError({\n moduleName: 'ProgressBar',\n message: `Cannot set 'isIndeterminate' when 'type' or 'variant' is 'meter'.`,\n });\n }\n\n if (progressVariant === 'circular' && isIndeterminate) {\n throwBladeError({\n moduleName: 'ProgressBar',\n message: `Cannot set 'isIndeterminate' when 'variant' is 'circular'.`,\n });\n }\n\n if (progressVariant === 'linear' && size === 'large') {\n throwBladeError({\n moduleName: 'ProgressBar',\n message: `Large size isn't available when 'variant' is 'linear'.`,\n });\n }\n\n if (type && (variant === 'progress' || variant === 'meter')) {\n throwBladeError({\n moduleName: 'ProgressBar',\n message: `variant can only be 'linear' or 'circular' when 'type=${type}'.`,\n });\n }\n }\n\n const unfilledBackgroundColor = theme.colors.feedback.background.neutral\n .subtle as BaseBoxProps['backgroundColor'];\n const filledBackgroundColor = color\n ? theme.colors.feedback.background[color].intense\n : theme.colors.surface.background.primary.intense;\n const hasLabel = label && label.trim()?.length > 0;\n const isMeter = progressType === 'meter';\n const isCircular = progressVariant === 'circular';\n const progressValue = clamp(value, min, max);\n const percentageProgressValue = Math.floor(((progressValue - min) * 100) / (max - min));\n const shouldShowPercentage = showPercentage && !isMeter && !isIndeterminate;\n const accessibilityProps: Pick<\n AccessibilityProps,\n 'role' | 'label' | 'valueMax' | 'valueNow' | 'valueMin' | 'valueText'\n > = {\n role: 'progressbar',\n label: accessibilityLabel ?? label,\n valueNow: percentageProgressValue,\n valueText: `${percentageProgressValue}%`,\n valueMin: min,\n valueMax: max,\n };\n\n if (isMeter) {\n accessibilityProps.role = 'meter';\n accessibilityProps.valueNow = progressValue;\n accessibilityProps.valueText = `${progressValue}`;\n }\n\n if (isIndeterminate) {\n accessibilityProps.valueNow = undefined;\n accessibilityProps.valueMin = undefined;\n accessibilityProps.valueMax = undefined;\n accessibilityProps.valueText = undefined;\n }\n\n return (\n <BaseBox\n {...getStyledProps(styledProps)}\n {...metaAttribute({ name: MetaConstants.ProgressBar, testID })}\n >\n <BaseBox display=\"flex\" flexDirection=\"column\" width=\"100%\">\n {!isCircular ? (\n <BaseBox\n display=\"flex\"\n flexDirection=\"row\"\n justifyContent={hasLabel ? 'space-between' : 'flex-end'}\n >\n {hasLabel ? (\n <Text as=\"label\" variant=\"body\" size=\"small\" color=\"surface.text.gray.subtle\">\n {label}\n </Text>\n ) : null}\n {shouldShowPercentage ? (\n <BaseBox marginBottom=\"spacing.2\">\n <Text\n variant=\"body\"\n size=\"small\"\n color=\"surface.text.gray.subtle\"\n >{`${percentageProgressValue}%`}</Text>\n </BaseBox>\n ) : null}\n </BaseBox>\n ) : null}\n\n <BaseBox\n id={id}\n {...makeAccessible({\n role: accessibilityProps.role,\n label: accessibilityProps.label,\n valueNow: accessibilityProps.valueNow,\n valueText: accessibilityProps.valueText,\n valueMin: accessibilityProps.valueMin,\n valueMax: accessibilityProps.valueMax,\n })}\n >\n {isCircular ? (\n <CircularProgressBarFilled\n size={size}\n label={label}\n progressPercent={percentageProgressValue}\n isMeter={isMeter}\n showPercentage={showPercentage}\n backgroundColor={unfilledBackgroundColor as string}\n fillColor={filledBackgroundColor}\n pulseMotionDuration=\"duration.2xgentle\"\n fillMotionDuration=\"duration.2xgentle\"\n pulseMotionDelay=\"delay.long\"\n motionEasing=\"easing.standard.revealing\"\n />\n ) : (\n <BaseBox\n backgroundColor={unfilledBackgroundColor}\n height={makeSize(progressBarHeight[size])}\n overflow=\"hidden\"\n position=\"relative\"\n >\n <ProgressBarFilled\n backgroundColor={filledBackgroundColor}\n progress={percentageProgressValue}\n fillMotionDuration=\"duration.2xgentle\"\n pulseMotionDuration=\"duration.2xgentle\"\n indeterminateMotionDuration=\"duration.2xgentle\"\n pulseMotionDelay=\"delay.long\"\n motionEasing=\"easing.standard.revealing\"\n type={progressType}\n isIndeterminate={isIndeterminate}\n />\n </BaseBox>\n )}\n </BaseBox>\n </BaseBox>\n </BaseBox>\n );\n};\n\nexport type { ProgressBarProps, ProgressBarVariant };\nexport { ProgressBar };\n"],"names":["progressBarHeight","small","size","medium","large","ProgressBar","_ref","_label$trim","accessibilityLabel","color","type","_ref$isIndeterminate","isIndeterminate","label","_ref$showPercentage","showPercentage","_ref$size","_ref$value","value","_ref$variant","variant","_ref$min","min","_ref$max","max","testID","styledProps","_objectWithoutProperties","_excluded","_useTheme","useTheme","theme","progressType","progressVariant","id","useId","__DEV__","throwBladeError","moduleName","message","unfilledBackgroundColor","colors","feedback","background","neutral","subtle","filledBackgroundColor","intense","surface","primary","hasLabel","trim","length","isMeter","isCircular","progressValue","clamp","percentageProgressValue","Math","floor","shouldShowPercentage","accessibilityProps","role","valueNow","valueText","valueMin","valueMax","undefined","_jsx","BaseBox","Object","assign","getStyledProps","metaAttribute","name","MetaConstants","children","_jsxs","display","flexDirection","width","justifyContent","Text","as","marginBottom","makeAccessible","CircularProgressBarFilled","progressPercent","backgroundColor","fillColor","pulseMotionDuration","fillMotionDuration","pulseMotionDelay","motionEasing","height","makeSize","overflow","position","ProgressBarFilled","progress","indeterminateMotionDuration"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;6IAsGA,IAAMA,iBAA2E,CAAG,CAClFC,KAAK,CAAEC,IAAI,CAAC,CAAC,CAAC,CACdC,MAAM,CAAED,IAAI,CAAC,CAAC,CAAC,CAEfE,KAAK,CAAEF,IAAI,CAAC,CAAC,CACf,CAAC,CAEK,IAAAG,WAAW,CAAG,SAAdA,WAAWA,CAAAC,IAAA,CAcqB,CAAAC,IAAAA,WAAA,CAbpC,IAAAC,kBAAkB,CAAAF,IAAA,CAAlBE,kBAAkB,CAClBC,KAAK,CAAAH,IAAA,CAALG,KAAK,CACLC,IAAI,CAAAJ,IAAA,CAAJI,IAAI,CAAAC,oBAAA,CAAAL,IAAA,CACJM,eAAe,CAAfA,eAAe,CAAAD,oBAAA,GAAA,KAAA,CAAA,CAAG,KAAK,CAAAA,oBAAA,CACvBE,KAAK,CAAAP,IAAA,CAALO,KAAK,CAAAC,mBAAA,CAAAR,IAAA,CACLS,cAAc,CAAdA,cAAc,CAAAD,mBAAA,GAAA,KAAA,CAAA,CAAG,IAAI,CAAAA,mBAAA,CAAAE,SAAA,CAAAV,IAAA,CACrBJ,IAAI,CAAJA,IAAI,CAAAc,SAAA,GAAG,KAAA,CAAA,CAAA,OAAO,CAAAA,SAAA,CAAAC,UAAA,CAAAX,IAAA,CACdY,KAAK,CAALA,KAAK,CAAAD,UAAA,GAAA,KAAA,CAAA,CAAG,CAAC,CAAAA,UAAA,CAAAE,YAAA,CAAAb,IAAA,CACTc,OAAO,CAAPA,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AAiB,CAACE,IAAI,CAAC,CAAE,CAC1C8F,QAAQ,CAAC,QAAQ,CACjBC,QAAQ,CAAC,UAAU,CAAArB,QAAA,CAEnBR,GAAA,CAAC8B,iBAAiB,CAAA,CAChBV,eAAe,CAAE1C,qBAAsB,CACvCqD,QAAQ,CAAE1C,uBAAwB,CAClCkC,kBAAkB,CAAC,mBAAmB,CACtCD,mBAAmB,CAAC,mBAAmB,CACvCU,2BAA2B,CAAC,mBAAmB,CAC/CR,gBAAgB,CAAC,YAAY,CAC7BC,YAAY,CAAC,2BAA2B,CACxCnF,IAAI,CAAEsB,YAAa,CACnBpB,eAAe,CAAEA,eAAgB,CAClC,CAAC,CACK,CACV,CACM,CAAA,CAAC,CACH,CAAA,CAAC,CACH,CAAA,CAAC,CAEd;;;;"}
@@ -24,7 +24,7 @@ import '@babel/runtime/helpers/defineProperty';
24
24
  import { MetaConstants } from '../../utils/metaAttribute/metaConstants.js';
25
25
  import { jsx, jsxs } from 'react/jsx-runtime';
26
26
 
27
- var _excluded=["value","children","helpText","isDisabled","size","testID"];var _Radio=function _Radio(_ref,ref){var _groupProps$state,_groupProps$size;var value=_ref.value,children=_ref.children,helpText=_ref.helpText,isDisabled=_ref.isDisabled,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,testID=_ref.testID,styledProps=_objectWithoutProperties(_ref,_excluded);var _useTheme=useTheme(),theme=_useTheme.theme;var groupProps=useRadioGroupContext();var isInsideGroup=!isEmpty(groupProps);if(__DEV__){if(!isInsideGroup){throwBladeError({moduleName:'Radio',message:'Cannot use <Radio /> outside of <RadioGroup />'});}}var isChecked=groupProps==null?void 0:(_groupProps$state=groupProps.state)==null?void 0:_groupProps$state.isChecked(value);var defaultChecked=(groupProps==null?void 0:groupProps.defaultValue)===undefined?undefined:(groupProps==null?void 0:groupProps.defaultValue)===value;var validationState=groupProps==null?void 0:groupProps.validationState;var hasError=validationState==='error';var _isDisabled=isDisabled!=null?isDisabled:groupProps==null?void 0:groupProps.isDisabled;var _isRequired=(groupProps==null?void 0:groupProps.isRequired)||(groupProps==null?void 0:groupProps.necessityIndicator)==='required';var name=groupProps==null?void 0:groupProps.name;var showHelpText=!hasError&&helpText;var isReactNative=getPlatformType()==='react-native';var _size=(_groupProps$size=groupProps.size)!=null?_groupProps$size:size;var handleChange=function handleChange(_ref2){var isChecked=_ref2.isChecked,value=_ref2.value;if(isChecked){var _groupProps$state2;groupProps==null?void 0:(_groupProps$state2=groupProps.state)==null?void 0:_groupProps$state2.setValue(value);}else {var _groupProps$state3;groupProps==null?void 0:(_groupProps$state3=groupProps.state)==null?void 0:_groupProps$state3.removeValue();}};var _useRadio=useRadio({defaultChecked:defaultChecked,isChecked:isChecked,hasError:hasError,isDisabled:_isDisabled,isRequired:_isRequired,name:name,value:value,onChange:handleChange}),state=_useRadio.state,ids=_useRadio.ids,inputProps=_useRadio.inputProps;var helpTextLeftSpacing=makeSize(radioSizes.icon[size].width+theme.spacing[3]);return jsx(BaseBox,Object.assign({},getStyledProps(styledProps),{children:jsx(SelectorLabel,{componentName:MetaConstants.RadioLabel,inputProps:isReactNative?inputProps:{},testID:testID,children:jsxs(BaseBox,{display:"flex",flexDirection:"column",children:[jsxs(BaseBox,{display:"flex",alignItems:"center",flexDirection:"row",children:[jsx(SelectorInput,{hoverTokens:radioHoverTokens,isChecked:state.isChecked,isDisabled:_isDisabled,hasError:hasError,inputProps:inputProps,ref:ref}),jsx(RadioIcon,{size:_size,isChecked:state.isChecked,isDisabled:_isDisabled,isNegative:hasError}),children?jsx(SelectorTitle,{size:_size,isDisabled:_isDisabled,children:children}):null]}),showHelpText&&jsx(BaseBox,{marginLeft:helpTextLeftSpacing,children:jsx(SelectorSupportText,{size:_size,isNegative:true,id:ids==null?void 0:ids.helpTextId,children:helpText})})]})})}));};var Radio=assignWithoutSideEffects(React__default.forwardRef(_Radio),{displayName:'Radio'});
27
+ var _excluded=["value","children","helpText","isDisabled","size","testID"];var _Radio=function _Radio(_ref,ref){var _groupProps$state,_groupProps$size;var value=_ref.value,children=_ref.children,helpText=_ref.helpText,isDisabled=_ref.isDisabled,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,testID=_ref.testID,styledProps=_objectWithoutProperties(_ref,_excluded);var _useTheme=useTheme(),theme=_useTheme.theme;var groupProps=useRadioGroupContext();var isInsideGroup=!isEmpty(groupProps);if(__DEV__){if(!isInsideGroup){throwBladeError({moduleName:'Radio',message:'Cannot use <Radio /> outside of <RadioGroup />'});}}var isChecked=groupProps==null?void 0:(_groupProps$state=groupProps.state)==null?void 0:_groupProps$state.isChecked(value);var defaultChecked=(groupProps==null?void 0:groupProps.defaultValue)===undefined?undefined:(groupProps==null?void 0:groupProps.defaultValue)===value;var validationState=groupProps==null?void 0:groupProps.validationState;var hasError=validationState==='error';var _isDisabled=isDisabled!=null?isDisabled:groupProps==null?void 0:groupProps.isDisabled;var _isRequired=(groupProps==null?void 0:groupProps.isRequired)||(groupProps==null?void 0:groupProps.necessityIndicator)==='required';var name=groupProps==null?void 0:groupProps.name;var showHelpText=helpText;var isReactNative=getPlatformType()==='react-native';var _size=(_groupProps$size=groupProps.size)!=null?_groupProps$size:size;var handleChange=function handleChange(_ref2){var isChecked=_ref2.isChecked,value=_ref2.value;if(isChecked){var _groupProps$state2;groupProps==null?void 0:(_groupProps$state2=groupProps.state)==null?void 0:_groupProps$state2.setValue(value);}else {var _groupProps$state3;groupProps==null?void 0:(_groupProps$state3=groupProps.state)==null?void 0:_groupProps$state3.removeValue();}};var _useRadio=useRadio({defaultChecked:defaultChecked,isChecked:isChecked,hasError:hasError,isDisabled:_isDisabled,isRequired:_isRequired,name:name,value:value,onChange:handleChange}),state=_useRadio.state,ids=_useRadio.ids,inputProps=_useRadio.inputProps;var helpTextLeftSpacing=makeSize(radioSizes.icon[size].width+theme.spacing[3]);return jsx(BaseBox,Object.assign({},getStyledProps(styledProps),{children:jsx(SelectorLabel,{componentName:MetaConstants.RadioLabel,inputProps:isReactNative?inputProps:{},testID:testID,children:jsxs(BaseBox,{display:"flex",flexDirection:"column",children:[jsxs(BaseBox,{display:"flex",alignItems:"center",flexDirection:"row",children:[jsx(SelectorInput,{hoverTokens:radioHoverTokens,isChecked:state.isChecked,isDisabled:_isDisabled,hasError:hasError,inputProps:inputProps,ref:ref}),jsx(RadioIcon,{size:_size,isChecked:state.isChecked,isDisabled:_isDisabled,isNegative:hasError}),children?jsx(SelectorTitle,{size:_size,isDisabled:_isDisabled,children:children}):null]}),showHelpText&&jsx(BaseBox,{marginLeft:helpTextLeftSpacing,children:jsx(SelectorSupportText,{size:_size,id:ids==null?void 0:ids.helpTextId,children:helpText})})]})})}));};var Radio=assignWithoutSideEffects(React__default.forwardRef(_Radio),{displayName:'Radio'});
28
28
 
29
29
  export { Radio };
30
30
  //# sourceMappingURL=Radio.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Radio.js","sources":["../../../../../src/components/Radio/Radio.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/restrict-plus-operands */\n/* eslint-disable @typescript-eslint/no-shadow */\nimport React from 'react';\nimport type { OnChange } from './useRadio';\nimport { useRadio } from './useRadio';\nimport { RadioIcon } from './RadioIcon/RadioIcon';\nimport { useRadioGroupContext } from './RadioGroup/RadioContext';\nimport { radioHoverTokens, radioSizes } from './radioTokens';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport { SelectorLabel } from '~components/Form/Selector/SelectorLabel';\nimport BaseBox from '~components/Box/BaseBox';\nimport { SelectorTitle } from '~components/Form/Selector/SelectorTitle';\nimport { SelectorSupportText } from '~components/Form/Selector/SelectorSupportText';\nimport { SelectorInput } from '~components/Form/Selector/SelectorInput';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport type { BladeElementRef, StringChildrenType, TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getPlatformType, makeSize, useTheme } from '~utils';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport { throwBladeError } from '~utils/logger';\n\ntype RadioProps = {\n /**\n * Sets the label text of the Radio\n */\n children?: StringChildrenType;\n /**\n * Help text for the Radio\n */\n helpText?: string;\n /**\n * The value to be used in the Radio input.\n * This is the value that will be returned on form submission.\n */\n value: string;\n /**\n * If `true`, the Radio will be disabled\n *\n * @default false\n */\n isDisabled?: boolean;\n /**\n * Size of the radios\n *\n * @default \"medium\"\n */\n size?: 'small' | 'medium' | 'large';\n} & TestID &\n StyledPropsBlade;\n\nconst _Radio: React.ForwardRefRenderFunction<BladeElementRef, RadioProps> = (\n { value, children, helpText, isDisabled, size = 'medium', testID, ...styledProps },\n ref,\n) => {\n const { theme } = useTheme();\n const groupProps = useRadioGroupContext();\n const isInsideGroup = !isEmpty(groupProps);\n\n if (__DEV__) {\n if (!isInsideGroup) {\n throwBladeError({\n moduleName: 'Radio',\n message: 'Cannot use <Radio /> outside of <RadioGroup />',\n });\n }\n }\n\n const isChecked = groupProps?.state?.isChecked(value);\n const defaultChecked =\n groupProps?.defaultValue === undefined ? undefined : groupProps?.defaultValue === value;\n const validationState = groupProps?.validationState;\n const hasError = validationState === 'error';\n const _isDisabled = isDisabled ?? groupProps?.isDisabled;\n const _isRequired = groupProps?.isRequired || groupProps?.necessityIndicator === 'required';\n const name = groupProps?.name;\n const showHelpText = !hasError && helpText;\n const isReactNative = getPlatformType() === 'react-native';\n const _size = groupProps.size ?? size;\n\n const handleChange: OnChange = ({ isChecked, value }) => {\n if (isChecked) {\n groupProps?.state?.setValue(value!);\n } else {\n groupProps?.state?.removeValue();\n }\n };\n\n const { state, ids, inputProps } = useRadio({\n defaultChecked,\n isChecked,\n hasError,\n isDisabled: _isDisabled,\n isRequired: _isRequired,\n name,\n value,\n onChange: handleChange,\n });\n\n // radio icon's size & margin + margin-left of SelectorTitle which is 2\n const helpTextLeftSpacing = makeSize(radioSizes.icon[size].width + theme.spacing[3]);\n\n return (\n <BaseBox {...getStyledProps(styledProps)}>\n <SelectorLabel\n componentName={MetaConstants.RadioLabel}\n inputProps={isReactNative ? inputProps : {}}\n testID={testID}\n >\n <BaseBox display=\"flex\" flexDirection=\"column\">\n <BaseBox display=\"flex\" alignItems=\"center\" flexDirection=\"row\">\n <SelectorInput\n hoverTokens={radioHoverTokens}\n isChecked={state.isChecked}\n isDisabled={_isDisabled}\n hasError={hasError}\n inputProps={inputProps}\n ref={ref}\n />\n <RadioIcon\n size={_size}\n isChecked={state.isChecked}\n isDisabled={_isDisabled}\n isNegative={hasError}\n />\n {children ? (\n <SelectorTitle size={_size} isDisabled={_isDisabled}>\n {children}\n </SelectorTitle>\n ) : null}\n </BaseBox>\n {showHelpText && (\n <BaseBox marginLeft={helpTextLeftSpacing}>\n <SelectorSupportText size={_size} isNegative={true} id={ids?.helpTextId}>\n {helpText}\n </SelectorSupportText>\n </BaseBox>\n )}\n </BaseBox>\n </SelectorLabel>\n </BaseBox>\n );\n};\n\nconst Radio = assignWithoutSideEffects(React.forwardRef(_Radio), { displayName: 'Radio' });\n\nexport type { RadioProps };\nexport { Radio };\n"],"names":["_Radio","_ref","ref","_groupProps$state","_groupProps$size","value","children","helpText","isDisabled","_ref$size","size","testID","styledProps","_objectWithoutProperties","_excluded","_useTheme","useTheme","theme","groupProps","useRadioGroupContext","isInsideGroup","isEmpty","__DEV__","throwBladeError","moduleName","message","isChecked","state","defaultChecked","defaultValue","undefined","validationState","hasError","_isDisabled","_isRequired","isRequired","necessityIndicator","name","showHelpText","isReactNative","getPlatformType","_size","handleChange","_ref2","_groupProps$state2","setValue","_groupProps$state3","removeValue","_useRadio","useRadio","onChange","ids","inputProps","helpTextLeftSpacing","makeSize","radioSizes","icon","width","spacing","_jsx","BaseBox","Object","assign","getStyledProps","SelectorLabel","componentName","MetaConstants","RadioLabel","_jsxs","display","flexDirection","alignItems","SelectorInput","hoverTokens","radioHoverTokens","RadioIcon","isNegative","SelectorTitle","marginLeft","SelectorSupportText","id","helpTextId","Radio","assignWithoutSideEffects","React","forwardRef","displayName"],"m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QAAA,CAC7DqD,CAAAA,GAAA,CAACa,aAAa,CAAA,CACZC,WAAW,CAAEC,gBAAiB,CAC9BhD,SAAS,CAAEC,KAAK,CAACD,SAAU,CAC3BlB,UAAU,CAAEyB,WAAY,CACxBD,QAAQ,CAAEA,QAAS,CACnBoB,UAAU,CAAEA,UAAW,CACvBlD,GAAG,CAAEA,GAAI,CACV,CAAC,CACFyD,GAAA,CAACgB,SAAS,CACRjE,CAAAA,IAAI,CAAE+B,KAAM,CACZf,SAAS,CAAEC,KAAK,CAACD,SAAU,CAC3BlB,UAAU,CAAEyB,WAAY,CACxB2C,UAAU,CAAE5C,QAAS,CACtB,CAAC,CACD1B,QAAQ,CACPqD,GAAA,CAACkB,aAAa,CAAA,CAACnE,IAAI,CAAE+B,KAAM,CAACjC,UAAU,CAAEyB,WAAY,CAAA3B,QAAA,CACjDA,QAAQ,CACI,CAAC,CACd,IAAI,CAAA,CACD,CAAC,CACTgC,YAAY,EACXqB,GAAA,CAACC,OAAO,CAAA,CAACkB,UAAU,CAAEzB,mBAAoB,CAAA/C,QAAA,CACvCqD,GAAA,CAACoB,mBAAmB,CAACrE,CAAAA,IAAI,CAAE+B,KAAM,CAACmC,UAAU,CAAE,IAAK,CAACI,EAAE,CAAE7B,GAAG,EAAA,IAAA,CAAA,KAAA,CAAA,CAAHA,GAAG,CAAE8B,UAAW,CAAA3E,QAAA,CACrEC,QAAQ,CACU,CAAC,CACf,CACV,EACM,CAAC,CACG,CAAC,CACT,CAAA,CAAC,CAEd,CAAC,CAEK,IAAA2E,KAAK,CAAGC,wBAAwB,CAACC,cAAK,CAACC,UAAU,CAACrF,MAAM,CAAC,CAAE,CAAEsF,WAAW,CAAE,OAAQ,CAAC;;;;"}
1
+ {"version":3,"file":"Radio.js","sources":["../../../../../src/components/Radio/Radio.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/restrict-plus-operands */\n/* eslint-disable @typescript-eslint/no-shadow */\nimport React from 'react';\nimport type { OnChange } from './useRadio';\nimport { useRadio } from './useRadio';\nimport { RadioIcon } from './RadioIcon/RadioIcon';\nimport { useRadioGroupContext } from './RadioGroup/RadioContext';\nimport { radioHoverTokens, radioSizes } from './radioTokens';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport { SelectorLabel } from '~components/Form/Selector/SelectorLabel';\nimport BaseBox from '~components/Box/BaseBox';\nimport { SelectorTitle } from '~components/Form/Selector/SelectorTitle';\nimport { SelectorSupportText } from '~components/Form/Selector/SelectorSupportText';\nimport { SelectorInput } from '~components/Form/Selector/SelectorInput';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport type { BladeElementRef, StringChildrenType, TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getPlatformType, makeSize, useTheme } from '~utils';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport { throwBladeError } from '~utils/logger';\n\ntype RadioProps = {\n /**\n * Sets the label text of the Radio\n */\n children?: StringChildrenType;\n /**\n * Help text for the Radio\n */\n helpText?: string;\n /**\n * The value to be used in the Radio input.\n * This is the value that will be returned on form submission.\n */\n value: string;\n /**\n * If `true`, the Radio will be disabled\n *\n * @default false\n */\n isDisabled?: boolean;\n /**\n * Size of the radios\n *\n * @default \"medium\"\n */\n size?: 'small' | 'medium' | 'large';\n} & TestID &\n StyledPropsBlade;\n\nconst _Radio: React.ForwardRefRenderFunction<BladeElementRef, RadioProps> = (\n { value, children, helpText, isDisabled, size = 'medium', testID, ...styledProps },\n ref,\n) => {\n const { theme } = useTheme();\n const groupProps = useRadioGroupContext();\n const isInsideGroup = !isEmpty(groupProps);\n\n if (__DEV__) {\n if (!isInsideGroup) {\n throwBladeError({\n moduleName: 'Radio',\n message: 'Cannot use <Radio /> outside of <RadioGroup />',\n });\n }\n }\n\n const isChecked = groupProps?.state?.isChecked(value);\n const defaultChecked =\n groupProps?.defaultValue === undefined ? undefined : groupProps?.defaultValue === value;\n const validationState = groupProps?.validationState;\n const hasError = validationState === 'error';\n const _isDisabled = isDisabled ?? groupProps?.isDisabled;\n const _isRequired = groupProps?.isRequired || groupProps?.necessityIndicator === 'required';\n const name = groupProps?.name;\n const showHelpText = helpText;\n const isReactNative = getPlatformType() === 'react-native';\n const _size = groupProps.size ?? size;\n\n const handleChange: OnChange = ({ isChecked, value }) => {\n if (isChecked) {\n groupProps?.state?.setValue(value!);\n } else {\n groupProps?.state?.removeValue();\n }\n };\n\n const { state, ids, inputProps } = useRadio({\n defaultChecked,\n isChecked,\n hasError,\n isDisabled: _isDisabled,\n isRequired: _isRequired,\n name,\n value,\n onChange: handleChange,\n });\n\n // radio icon's size & margin + margin-left of SelectorTitle which is 2\n const helpTextLeftSpacing = makeSize(radioSizes.icon[size].width + theme.spacing[3]);\n\n return (\n <BaseBox {...getStyledProps(styledProps)}>\n <SelectorLabel\n componentName={MetaConstants.RadioLabel}\n inputProps={isReactNative ? inputProps : {}}\n testID={testID}\n >\n <BaseBox display=\"flex\" flexDirection=\"column\">\n <BaseBox display=\"flex\" alignItems=\"center\" flexDirection=\"row\">\n <SelectorInput\n hoverTokens={radioHoverTokens}\n isChecked={state.isChecked}\n isDisabled={_isDisabled}\n hasError={hasError}\n inputProps={inputProps}\n ref={ref}\n />\n <RadioIcon\n size={_size}\n isChecked={state.isChecked}\n isDisabled={_isDisabled}\n isNegative={hasError}\n />\n {children ? (\n <SelectorTitle size={_size} isDisabled={_isDisabled}>\n {children}\n </SelectorTitle>\n ) : null}\n </BaseBox>\n {showHelpText && (\n <BaseBox marginLeft={helpTextLeftSpacing}>\n <SelectorSupportText size={_size} id={ids?.helpTextId}>\n {helpText}\n </SelectorSupportText>\n </BaseBox>\n )}\n </BaseBox>\n </SelectorLabel>\n </BaseBox>\n );\n};\n\nconst Radio = assignWithoutSideEffects(React.forwardRef(_Radio), { displayName: 'Radio' });\n\nexport type { RadioProps };\nexport { Radio };\n"],"names":["_Radio","_ref","ref","_groupProps$state","_groupProps$size","value","children","helpText","isDisabled","_ref$size","size","testID","styledProps","_objectWithoutProperties","_excluded","_useTheme","useTheme","theme","groupProps","useRadioGroupContext","isInsideGroup","isEmpty","__DEV__","throwBladeError","moduleName","message","isChecked","state","defaultChecked","defaultValue","undefined","validationState","hasError","_isDisabled","_isRequired","isRequired","necessityIndicator","name","showHelpText","isReactNative","getPlatformType","_size","handleChange","_ref2","_groupProps$state2","setValue","_groupProps$state3","removeValue","_useRadio","useRadio","onChange","ids","inputProps","helpTextLeftSpacing","makeSize","radioSizes","icon","width","spacing","_jsx","BaseBox","Object","assign","getStyledProps","SelectorLabel","componentName","MetaConstants","RadioLabel","_jsxs","display","flexDirection","alignItems","SelectorInput","hoverTokens","radioHoverTokens","RadioIcon","isNegative","SelectorTitle","marginLeft","SelectorSupportText","id","helpTextId","Radio","assignWithoutSideEffects","React","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAA,SAAA,CAAA,CAAA,OAAA,CAAA,UAAA,CAAA,UAAA,CAAA,YAAA,CAAA,MAAA,CAAA,QAAA,CAAA,CAiDA,IAAMA,MAAmE,CAAG,SAAtEA,MAAmEA,CAAAC,IAAA,CAEvEC,GAAG,CACA,KAAAC,iBAAA,CAAAC,gBAAA,CAFD,IAAAC,KAAK,CAAAJ,IAAA,CAALI,KAAK,CAAEC,QAAQ,CAAAL,IAAA,CAARK,QAAQ,CAAEC,QAAQ,CAAAN,IAAA,CAARM,QAAQ,CAAEC,UAAU,CAAAP,IAAA,CAAVO,UAAU,CAAAC,SAAA,CAAAR,IAAA,CAAES,IAAI,CAAJA,IAAI,CAAAD,SAAA,GAAA,KAAA,CAAA,CAAG,QAAQ,CAAAA,SAAA,CAAEE,MAAM,CAAAV,IAAA,CAANU,MAAM,CAAKC,WAAW,CAAAC,wBAAA,CAAAZ,IAAA,CAAAa,SAAA,EAGhF,IAAAC,SAAA,CAAkBC,QAAQ,EAAE,CAApBC,KAAK,CAAAF,SAAA,CAALE,KAAK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,CAAAA,KAAAA,CAAAA,CAAAA,GAAG,CAAE8B,UAAW,CAAA3E,QAAA,CACnDC,QAAQ,CACU,CAAC,CACf,CACV,CAAA,CACM,CAAC,CACG,CAAC,EACT,CAAC,CAEd,CAAC,CAEK,IAAA2E,KAAK,CAAGC,wBAAwB,CAACC,cAAK,CAACC,UAAU,CAACrF,MAAM,CAAC,CAAE,CAAEsF,WAAW,CAAE,OAAQ,CAAC;;;;"}
@@ -89,10 +89,7 @@ var _Checkbox = function _Checkbox(_ref, ref) {
89
89
  medium: 'medium',
90
90
  large: 'large'
91
91
  };
92
-
93
- // only show error when the self validation is set to error
94
- // Since we don't want to show errorText inside the group
95
- var showSupportingText = validationState !== 'error' && helpText;
92
+ var showSupportingText = helpText;
96
93
  var handleChange = function handleChange(_ref2) {
97
94
  var isChecked = _ref2.isChecked,
98
95
  event = _ref2.event,
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.js","sources":["../../../../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/restrict-plus-operands */\n/* eslint-disable @typescript-eslint/no-shadow */\nimport React from 'react';\nimport { useCheckboxGroupContext } from './CheckboxGroup/CheckboxGroupContext';\nimport { CheckboxIcon } from './CheckboxIcon';\nimport { useCheckbox } from './useCheckbox';\nimport { checkboxHoverTokens, checkboxSizes } from './checkboxTokens';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport isUndefined from '~utils/lodashButBetter/isUndefined';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport BaseBox from '~components/Box/BaseBox';\nimport { FormHint } from '~components/Form';\nimport { SelectorLabel } from '~components/Form/Selector/SelectorLabel';\nimport { SelectorTitle } from '~components/Form/Selector/SelectorTitle';\nimport { SelectorSupportText } from '~components/Form/Selector/SelectorSupportText';\nimport { SelectorInput } from '~components/Form/Selector/SelectorInput';\nimport type { BladeElementRef, TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { throwBladeError } from '~utils/logger';\nimport { makeSize, useTheme } from '~utils';\n\ntype OnChange = ({\n isChecked,\n event,\n value,\n}: {\n isChecked: boolean;\n event?: React.ChangeEvent;\n value?: string;\n}) => void;\n\ntype CheckboxProps = {\n /**\n * If `true`, The checkbox will be checked. This also makes the checkbox controlled\n * Use `onChange` to update its value\n *\n * @default false\n */\n isChecked?: boolean;\n /**\n * If `true`, the checkbox will be initially checked. This also makes the checkbox uncontrolled\n *\n * @default false\n */\n defaultChecked?: boolean;\n /**\n * The callback invoked when the checked state of the `Checkbox` changes.\n */\n onChange?: OnChange;\n /**\n * Sets the label of the checkbox\n */\n children?: React.ReactNode;\n /**\n * Help text for the checkbox\n */\n helpText?: string;\n /**\n * Error text for the checkbox\n *\n * Renders when `validationState` is set to 'error'\n */\n errorText?: string;\n /**\n * If `true`, the checkbox will be indeterminate.\n * This does not modify the isChecked property.\n *\n * @default false\n */\n isIndeterminate?: boolean;\n /**\n * The name of the input field in a checkbox\n * (Useful for form submission).\n */\n name?: string;\n /**\n * The value to be used in the checkbox input.\n * This is the value that will be returned on form submission.\n */\n value?: string;\n /**\n * If `true`, the checkbox will be disabled\n *\n * @default false\n */\n isDisabled?: boolean;\n /**\n * If `true`, the checkbox input is marked as required,\n * and `required` attribute will be added\n *\n * @default false\n */\n isRequired?: boolean;\n /**\n * If `error`, the checkbox input is marked as invalid,\n * and `invalid` attribute will be added\n */\n validationState?: 'error' | 'none';\n /**\n * Size of the checkbox\n *\n * @default \"medium\"\n */\n size?: 'small' | 'medium' | 'large';\n /**\n * Sets the tab-index property on checkbox element\n *\n */\n tabIndex?: number;\n} & TestID &\n StyledPropsBlade;\n\nconst _Checkbox: React.ForwardRefRenderFunction<BladeElementRef, CheckboxProps> = (\n {\n defaultChecked,\n validationState,\n isChecked,\n isDisabled,\n isIndeterminate,\n isRequired,\n name,\n onChange,\n value,\n children,\n helpText,\n errorText,\n size = 'medium',\n tabIndex,\n testID,\n ...styledProps\n },\n ref,\n) => {\n const groupProps = useCheckboxGroupContext();\n\n // ban certain props in checkbox while inside group\n const hasValidationState = !isUndefined(validationState);\n const hasName = !isUndefined(name);\n const hasDefaultChecked = !isUndefined(defaultChecked);\n const hasIsChecked = !isUndefined(isChecked);\n const hasOnChange = !isUndefined(onChange);\n\n if (__DEV__) {\n if (\n (hasValidationState || hasName || hasDefaultChecked || hasIsChecked || hasOnChange) &&\n !isEmpty(groupProps)\n ) {\n const props = [\n hasValidationState ? 'validationState' : undefined,\n hasName ? 'name' : undefined,\n hasDefaultChecked ? 'defaultChecked' : undefined,\n hasIsChecked ? 'isChecked' : undefined,\n hasOnChange ? 'onChange' : undefined,\n ]\n .filter(Boolean)\n .join(',');\n\n throwBladeError({\n message: `Cannot set \\`${props}\\` on <Checkbox /> when it's inside <CheckboxGroup />, Please set it on the <CheckboxGroup /> itself`,\n moduleName: 'Checkbox',\n });\n }\n\n // mandate value prop when using inside group\n if (!value && !isEmpty(groupProps)) {\n throw new Error(\n `[Blade Checkbox]: <CheckboxGroup /> requires that you pass unique \"value\" prop to each <Checkbox />\n <CheckboxGroup>\n <Checkbox value=\"apple\">Apple</Checkbox>\n <Checkbox value=\"mango\">Mango</Checkbox>\n </CheckboxGroup>\n `,\n );\n }\n }\n\n const _validationState = validationState ?? groupProps?.validationState;\n const _hasError = _validationState === 'error';\n const _isDisabled = isDisabled ?? groupProps?.isDisabled;\n const _isRequired = Boolean(\n isRequired || groupProps?.isRequired || groupProps?.necessityIndicator === 'required',\n );\n const _name = name ?? groupProps?.name;\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n const _isChecked = isChecked ?? groupProps?.state?.isChecked(value!);\n const _size = groupProps.size ?? size;\n const { theme } = useTheme();\n const formHintSize = {\n small: 'medium',\n medium: 'medium',\n large: 'large',\n } as const;\n\n // only show error when the self validation is set to error\n // Since we don't want to show errorText inside the group\n const showSupportingText = validationState !== 'error' && helpText;\n\n const handleChange: OnChange = ({ isChecked, event, value }) => {\n if (isChecked) {\n groupProps?.state?.addValue(value!);\n } else {\n groupProps?.state?.removeValue(value!);\n }\n\n onChange?.({ isChecked, event, value });\n };\n\n const { state, ids, inputProps } = useCheckbox({\n defaultChecked,\n isChecked: _isChecked,\n isIndeterminate,\n hasError: _hasError,\n hasHelperText: Boolean(showSupportingText),\n isDisabled: _isDisabled,\n isRequired: _isRequired,\n name: _name,\n value,\n onChange: handleChange,\n });\n\n // Checkbox icon's size & margin + margin-left of SelectorTitle which is 2\n const helpTextLeftSpacing = makeSize(checkboxSizes.icon[size].width + theme.spacing[3]);\n\n return (\n <BaseBox\n {...metaAttribute({ name: MetaConstants.Checkbox, testID })}\n {...getStyledProps(styledProps)}\n >\n <SelectorLabel\n componentName={MetaConstants.CheckboxLabel}\n inputProps={state.isReactNative ? inputProps : {}}\n >\n <BaseBox display=\"flex\" flexDirection=\"column\">\n <BaseBox display=\"flex\" flexDirection=\"row\">\n <SelectorInput\n hoverTokens={checkboxHoverTokens}\n isChecked={state.isChecked || Boolean(isIndeterminate)}\n isDisabled={_isDisabled}\n hasError={_hasError}\n inputProps={inputProps}\n tabIndex={tabIndex}\n ref={ref}\n />\n <CheckboxIcon\n size={_size}\n isChecked={state.isChecked}\n isIndeterminate={isIndeterminate}\n isDisabled={_isDisabled}\n isNegative={_hasError}\n />\n {children ? (\n <SelectorTitle size={_size} isDisabled={_isDisabled}>\n {children}\n </SelectorTitle>\n ) : null}\n </BaseBox>\n {showSupportingText ? (\n <BaseBox marginLeft={helpTextLeftSpacing}>\n <SelectorSupportText size={_size} id={ids?.helpTextId}>\n {helpText}\n </SelectorSupportText>\n </BaseBox>\n ) : null}\n </BaseBox>\n </SelectorLabel>\n <FormHint\n size={formHintSize[_size]}\n errorText={errorText}\n errorTextId={ids?.errorTextId}\n type={validationState === 'error' ? 'error' : 'help'}\n />\n </BaseBox>\n );\n};\n\nconst Checkbox = assignWithoutSideEffects(React.forwardRef(_Checkbox), {\n displayName: 'Checkbox',\n});\n\nexport type { CheckboxProps };\nexport { Checkbox };\n"],"names":["_Checkbox","_ref","ref","_groupProps$state","_groupProps$size","defaultChecked","validationState","isChecked","isDisabled","isIndeterminate","isRequired","name","onChange","value","children","helpText","errorText","_ref$size","size","tabIndex","testID","styledProps","_objectWithoutProperties","_excluded","groupProps","useCheckboxGroupContext","hasValidationState","isUndefined","hasName","hasDefaultChecked","hasIsChecked","hasOnChange","isEmpty","props","undefined","filter","Boolean","join","throwBladeError","message","concat","moduleName","Error","_validationState","_hasError","_isDisabled","_isRequired","necessityIndicator","_name","_isChecked","state","_size","_useTheme","useTheme","theme","formHintSize","small","medium","large","showSupportingText","handleChange","_ref2","event","_groupProps$state2","addValue","_groupProps$state3","removeValue","_useCheckbox","useCheckbox","hasError","hasHelperText","ids","inputProps","helpTextLeftSpacing","makeSize","checkboxSizes","icon","width","spacing","_jsxs","BaseBox","_objectSpread","metaAttribute","MetaConstants","Checkbox","getStyledProps","_jsx","SelectorLabel","componentName","CheckboxLabel","isReactNative","display","flexDirection","SelectorInput","hoverTokens","checkboxHoverTokens","CheckboxIcon","isNegative","SelectorTitle","marginLeft","SelectorSupportText","id","helpTextId","FormHint","errorTextId","type","assignWithoutSideEffects","React","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkHA,IAAMA,SAAyE,GAAG,SAA5EA,SAAyEA,CAAAC,IAAA,EAmB7EC,GAAG,EACA;EAAA,IAAAC,iBAAA,EAAAC,gBAAA,CAAA;AAAA,EAAA,IAlBDC,cAAc,GAAAJ,IAAA,CAAdI,cAAc;IACdC,eAAe,GAAAL,IAAA,CAAfK,eAAe;IACfC,SAAS,GAAAN,IAAA,CAATM,SAAS;IACTC,UAAU,GAAAP,IAAA,CAAVO,UAAU;IACVC,eAAe,GAAAR,IAAA,CAAfQ,eAAe;IACfC,UAAU,GAAAT,IAAA,CAAVS,UAAU;IAC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eAAe,KAAK,OAAO,GAAG,OAAO,GAAG,MAAA;AAAO,KACtD,CAAC,CAAA;AAAA,GAAA,CACK,CAAC,CAAA;AAEd,CAAC,CAAA;AAEK8E,IAAAA,QAAQ,gBAAGsB,wBAAwB,eAACC,cAAK,CAACC,UAAU,CAAC5G,SAAS,CAAC,EAAE;AACrE6G,EAAAA,WAAW,EAAE,UAAA;AACf,CAAC;;;;"}
1
+ {"version":3,"file":"Checkbox.js","sources":["../../../../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/restrict-plus-operands */\n/* eslint-disable @typescript-eslint/no-shadow */\nimport React from 'react';\nimport { useCheckboxGroupContext } from './CheckboxGroup/CheckboxGroupContext';\nimport { CheckboxIcon } from './CheckboxIcon';\nimport { useCheckbox } from './useCheckbox';\nimport { checkboxHoverTokens, checkboxSizes } from './checkboxTokens';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport isUndefined from '~utils/lodashButBetter/isUndefined';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport BaseBox from '~components/Box/BaseBox';\nimport { FormHint } from '~components/Form';\nimport { SelectorLabel } from '~components/Form/Selector/SelectorLabel';\nimport { SelectorTitle } from '~components/Form/Selector/SelectorTitle';\nimport { SelectorSupportText } from '~components/Form/Selector/SelectorSupportText';\nimport { SelectorInput } from '~components/Form/Selector/SelectorInput';\nimport type { BladeElementRef, TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { throwBladeError } from '~utils/logger';\nimport { makeSize, useTheme } from '~utils';\n\ntype OnChange = ({\n isChecked,\n event,\n value,\n}: {\n isChecked: boolean;\n event?: React.ChangeEvent;\n value?: string;\n}) => void;\n\ntype CheckboxProps = {\n /**\n * If `true`, The checkbox will be checked. This also makes the checkbox controlled\n * Use `onChange` to update its value\n *\n * @default false\n */\n isChecked?: boolean;\n /**\n * If `true`, the checkbox will be initially checked. This also makes the checkbox uncontrolled\n *\n * @default false\n */\n defaultChecked?: boolean;\n /**\n * The callback invoked when the checked state of the `Checkbox` changes.\n */\n onChange?: OnChange;\n /**\n * Sets the label of the checkbox\n */\n children?: React.ReactNode;\n /**\n * Help text for the checkbox\n */\n helpText?: string;\n /**\n * Error text for the checkbox\n *\n * Renders when `validationState` is set to 'error'\n */\n errorText?: string;\n /**\n * If `true`, the checkbox will be indeterminate.\n * This does not modify the isChecked property.\n *\n * @default false\n */\n isIndeterminate?: boolean;\n /**\n * The name of the input field in a checkbox\n * (Useful for form submission).\n */\n name?: string;\n /**\n * The value to be used in the checkbox input.\n * This is the value that will be returned on form submission.\n */\n value?: string;\n /**\n * If `true`, the checkbox will be disabled\n *\n * @default false\n */\n isDisabled?: boolean;\n /**\n * If `true`, the checkbox input is marked as required,\n * and `required` attribute will be added\n *\n * @default false\n */\n isRequired?: boolean;\n /**\n * If `error`, the checkbox input is marked as invalid,\n * and `invalid` attribute will be added\n */\n validationState?: 'error' | 'none';\n /**\n * Size of the checkbox\n *\n * @default \"medium\"\n */\n size?: 'small' | 'medium' | 'large';\n /**\n * Sets the tab-index property on checkbox element\n *\n */\n tabIndex?: number;\n} & TestID &\n StyledPropsBlade;\n\nconst _Checkbox: React.ForwardRefRenderFunction<BladeElementRef, CheckboxProps> = (\n {\n defaultChecked,\n validationState,\n isChecked,\n isDisabled,\n isIndeterminate,\n isRequired,\n name,\n onChange,\n value,\n children,\n helpText,\n errorText,\n size = 'medium',\n tabIndex,\n testID,\n ...styledProps\n },\n ref,\n) => {\n const groupProps = useCheckboxGroupContext();\n\n // ban certain props in checkbox while inside group\n const hasValidationState = !isUndefined(validationState);\n const hasName = !isUndefined(name);\n const hasDefaultChecked = !isUndefined(defaultChecked);\n const hasIsChecked = !isUndefined(isChecked);\n const hasOnChange = !isUndefined(onChange);\n\n if (__DEV__) {\n if (\n (hasValidationState || hasName || hasDefaultChecked || hasIsChecked || hasOnChange) &&\n !isEmpty(groupProps)\n ) {\n const props = [\n hasValidationState ? 'validationState' : undefined,\n hasName ? 'name' : undefined,\n hasDefaultChecked ? 'defaultChecked' : undefined,\n hasIsChecked ? 'isChecked' : undefined,\n hasOnChange ? 'onChange' : undefined,\n ]\n .filter(Boolean)\n .join(',');\n\n throwBladeError({\n message: `Cannot set \\`${props}\\` on <Checkbox /> when it's inside <CheckboxGroup />, Please set it on the <CheckboxGroup /> itself`,\n moduleName: 'Checkbox',\n });\n }\n\n // mandate value prop when using inside group\n if (!value && !isEmpty(groupProps)) {\n throw new Error(\n `[Blade Checkbox]: <CheckboxGroup /> requires that you pass unique \"value\" prop to each <Checkbox />\n <CheckboxGroup>\n <Checkbox value=\"apple\">Apple</Checkbox>\n <Checkbox value=\"mango\">Mango</Checkbox>\n </CheckboxGroup>\n `,\n );\n }\n }\n\n const _validationState = validationState ?? groupProps?.validationState;\n const _hasError = _validationState === 'error';\n const _isDisabled = isDisabled ?? groupProps?.isDisabled;\n const _isRequired = Boolean(\n isRequired || groupProps?.isRequired || groupProps?.necessityIndicator === 'required',\n );\n const _name = name ?? groupProps?.name;\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n const _isChecked = isChecked ?? groupProps?.state?.isChecked(value!);\n const _size = groupProps.size ?? size;\n const { theme } = useTheme();\n const formHintSize = {\n small: 'medium',\n medium: 'medium',\n large: 'large',\n } as const;\n\n const showSupportingText = helpText;\n\n const handleChange: OnChange = ({ isChecked, event, value }) => {\n if (isChecked) {\n groupProps?.state?.addValue(value!);\n } else {\n groupProps?.state?.removeValue(value!);\n }\n\n onChange?.({ isChecked, event, value });\n };\n\n const { state, ids, inputProps } = useCheckbox({\n defaultChecked,\n isChecked: _isChecked,\n isIndeterminate,\n hasError: _hasError,\n hasHelperText: Boolean(showSupportingText),\n isDisabled: _isDisabled,\n isRequired: _isRequired,\n name: _name,\n value,\n onChange: handleChange,\n });\n\n // Checkbox icon's size & margin + margin-left of SelectorTitle which is 2\n const helpTextLeftSpacing = makeSize(checkboxSizes.icon[size].width + theme.spacing[3]);\n\n return (\n <BaseBox\n {...metaAttribute({ name: MetaConstants.Checkbox, testID })}\n {...getStyledProps(styledProps)}\n >\n <SelectorLabel\n componentName={MetaConstants.CheckboxLabel}\n inputProps={state.isReactNative ? inputProps : {}}\n >\n <BaseBox display=\"flex\" flexDirection=\"column\">\n <BaseBox display=\"flex\" flexDirection=\"row\">\n <SelectorInput\n hoverTokens={checkboxHoverTokens}\n isChecked={state.isChecked || Boolean(isIndeterminate)}\n isDisabled={_isDisabled}\n hasError={_hasError}\n inputProps={inputProps}\n tabIndex={tabIndex}\n ref={ref}\n />\n <CheckboxIcon\n size={_size}\n isChecked={state.isChecked}\n isIndeterminate={isIndeterminate}\n isDisabled={_isDisabled}\n isNegative={_hasError}\n />\n {children ? (\n <SelectorTitle size={_size} isDisabled={_isDisabled}>\n {children}\n </SelectorTitle>\n ) : null}\n </BaseBox>\n {showSupportingText ? (\n <BaseBox marginLeft={helpTextLeftSpacing}>\n <SelectorSupportText size={_size} id={ids?.helpTextId}>\n {helpText}\n </SelectorSupportText>\n </BaseBox>\n ) : null}\n </BaseBox>\n </SelectorLabel>\n <FormHint\n size={formHintSize[_size]}\n errorText={errorText}\n errorTextId={ids?.errorTextId}\n type={validationState === 'error' ? 'error' : 'help'}\n />\n </BaseBox>\n );\n};\n\nconst Checkbox = assignWithoutSideEffects(React.forwardRef(_Checkbox), {\n displayName: 'Checkbox',\n});\n\nexport type { CheckboxProps };\nexport { Checkbox };\n"],"names":["_Checkbox","_ref","ref","_groupProps$state","_groupProps$size","defaultChecked","validationState","isChecked","isDisabled","isIndeterminate","isRequired","name","onChange","value","children","helpText","errorText","_ref$size","size","tabIndex","testID","styledProps","_objectWithoutProperties","_excluded","groupProps","useCheckboxGroupContext","hasValidationState","isUndefined","hasName","hasDefaultChecked","hasIsChecked","hasOnChange","isEmpty","props","undefined","filter","Boolean","join","throwBladeError","message","concat","moduleName","Error","_validationState","_hasError","_isDisabled","_isRequired","necessityIndicator","_name","_isChecked","state","_size","_useTheme","useTheme","theme","formHintSize","small","medium","large","showSupportingText","handleChange","_ref2","event","_groupProps$state2","addValue","_groupProps$state3","removeValue","_useCheckbox","useCheckbox","hasError","hasHelperText","ids","inputProps","helpTextLeftSpacing","makeSize","checkboxSizes","icon","width","spacing","_jsxs","BaseBox","_objectSpread","metaAttribute","MetaConstants","Checkbox","getStyledProps","_jsx","SelectorLabel","componentName","CheckboxLabel","isReactNative","display","flexDirection","SelectorInput","hoverTokens","checkboxHoverTokens","CheckboxIcon","isNegative","SelectorTitle","marginLeft","SelectorSupportText","id","helpTextId","FormHint","errorTextId","type","assignWithoutSideEffects","React","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkHA,IAAMA,SAAyE,GAAG,SAA5EA,SAAyEA,CAAAC,IAAA,EAmB7EC,GAAG,EACA;EAAA,IAAAC,iBAAA,EAAAC,gBAAA,CAAA;AAAA,EAAA,IAlBDC,cAAc,GAAAJ,IAAA,CAAdI,cAAc;IACdC,eAAe,GAAAL,IAAA,CAAfK,eAAe;IACfC,SAAS,GAAAN,IAAA,CAATM,SAAS;IACTC,UAAU,GAAAP,IAAA,CAAVO,UAAU;IACVC,eAAe,GAAAR,IAAA,CAAfQ,eAAe;IACfC,UAAU,GAAAT,IAAA,CAAVS,UAAU;IACVC,IAAI,GAAAV,IAAA,CAAJU,IAAI;IACJC,QAAQ,GAAAX,IAAA,CAARW,QAAQ;IACRC,KAAK,GAAAZ,IAAA,CAALY,KAAK;IACLC,QAAQ,GAAAb,IAAA,CAARa,QAAQ;IACRC,QAAQ,GAAAd,IAAA,CAARc,QAAQ;IACRC,SAAS,GAAAf,IAAA,CAATe,SAAS;IAAAC,SAAA,GAAAhB,IAAA,CACTiB,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,QAAQ,GAAAA,SAAA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AChF,YAAAA,IAAI,EAAEiC,KAAM;AAAC3C,YAAAA,UAAU,EAAEqC,WAAY;AAAA/B,YAAAA,QAAA,EACjDA,QAAAA;WACY,CAAC,GACd,IAAI,CAAA;AAAA,SACD,CAAC,EACT6C,kBAAkB,gBACjB2B,GAAA,CAACN,OAAO,EAAA;AAACmB,UAAAA,UAAU,EAAE1B,mBAAoB;UAAA3D,QAAA,eACvCwE,GAAA,CAACc,mBAAmB,EAAA;AAAClF,YAAAA,IAAI,EAAEiC,KAAM;AAACkD,YAAAA,EAAE,EAAE9B,GAAG,KAAA,IAAA,IAAHA,GAAG,KAAHA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,GAAG,CAAE+B,UAAW;AAAAxF,YAAAA,QAAA,EACnDC,QAAAA;WACkB,CAAA;SACd,CAAC,GACR,IAAI,CAAA;OACD,CAAA;AAAC,KACG,CAAC,eAChBuE,GAAA,CAACiB,QAAQ,EAAA;AACPrF,MAAAA,IAAI,EAAEqC,YAAY,CAACJ,KAAK,CAAE;AAC1BnC,MAAAA,SAAS,EAAEA,SAAU;AACrBwF,MAAAA,WAAW,EAAEjC,GAAG,KAAA,IAAA,IAAHA,GAAG,KAAHA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,GAAG,CAAEiC,WAAY;AAC9BC,MAAAA,IAAI,EAAEnG,eAAe,KAAK,OAAO,GAAG,OAAO,GAAG,MAAA;AAAO,KACtD,CAAC,CAAA;AAAA,GAAA,CACK,CAAC,CAAA;AAEd,CAAC,CAAA;AAEK8E,IAAAA,QAAQ,gBAAGsB,wBAAwB,eAACC,cAAK,CAACC,UAAU,CAAC5G,SAAS,CAAC,EAAE;AACrE6G,EAAAA,WAAW,EAAE,UAAA;AACf,CAAC;;;;"}
@@ -57,8 +57,6 @@ var _DropdownFooter = function _DropdownFooter(_ref2) {
57
57
  testID = _ref2.testID;
58
58
  var _useDropdown = useDropdown(),
59
59
  setHasFooterAction = _useDropdown.setHasFooterAction,
60
- activeIndex = _useDropdown.activeIndex,
61
- onTriggerKeydown = _useDropdown.onTriggerKeydown,
62
60
  isOpen = _useDropdown.isOpen;
63
61
  var footerRef = React__default.useRef(null);
64
62
  React__default.useEffect(function () {
@@ -67,21 +65,9 @@ var _DropdownFooter = function _DropdownFooter(_ref2) {
67
65
  }, []);
68
66
  return /*#__PURE__*/jsx(BaseBox
69
67
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
70
- , _objectSpread(_objectSpread(_objectSpread({
68
+ , _objectSpread(_objectSpread({
71
69
  ref: footerRef
72
- }, isReactNative() ? {} : {
73
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
74
- onKeyDown: function onKeyDown(e) {
75
- var nativeEvent = e.nativeEvent;
76
- var shouldIgnoreDropdownKeydown = (nativeEvent.key === ' ' || nativeEvent.key === 'Enter') && activeIndex < 0;
77
- if (!shouldIgnoreDropdownKeydown) {
78
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
79
- onTriggerKeydown === null || onTriggerKeydown === void 0 ? void 0 : onTriggerKeydown({
80
- event: e.nativeEvent
81
- });
82
- }
83
- }
84
- }), makeAccessible({
70
+ }, makeAccessible({
85
71
  role: isReactNative() ? undefined : 'group'
86
72
  })), {}, {
87
73
  children: /*#__PURE__*/jsx(BaseFooter, {
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownHeaderFooter.js","sources":["../../../../../../src/components/Dropdown/DropdownHeaderFooter.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */\nimport React from 'react';\nimport { useDropdown } from './useDropdown';\nimport { BaseFooter } from '~components/BaseHeaderFooter/BaseFooter';\nimport { BaseHeader } from '~components/BaseHeaderFooter/BaseHeader';\nimport type { BaseHeaderProps } from '~components/BaseHeaderFooter/BaseHeader';\nimport type { BaseFooterProps } from '~components/BaseHeaderFooter/BaseFooter';\nimport BaseBox from '~components/Box/BaseBox';\nimport { isReactNative } from '~utils';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { MetaConstants } from '~utils/metaAttribute/metaConstants';\n\ntype DropdownHeaderProps = Pick<\n BaseHeaderProps,\n 'title' | 'subtitle' | 'leading' | 'trailing' | 'titleSuffix' | 'testID'\n>;\n\nconst _DropdownHeader = ({\n title,\n subtitle,\n leading,\n titleSuffix,\n trailing,\n testID,\n}: DropdownHeaderProps): React.ReactElement => {\n return (\n <BaseBox\n flexShrink={0}\n {...(isReactNative()\n ? {}\n : {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onMouseDown: (e: any) => {\n // we don't want focus to ever move on header because its static element\n e.preventDefault();\n },\n })}\n >\n <BaseHeader\n title={title}\n subtitle={subtitle}\n leading={leading}\n trailing={trailing}\n titleSuffix={titleSuffix}\n metaComponentName={MetaConstants.DropdownHeader}\n testID={testID}\n // back button\n showBackButton={false}\n // close button\n showCloseButton={false}\n />\n </BaseBox>\n );\n};\n\nconst DropdownHeader = assignWithoutSideEffects(_DropdownHeader, {\n componentId: 'DropdownHeader',\n});\n\ntype DropdownFooter = Pick<BaseFooterProps, 'children' | 'testID'>;\n\nconst _DropdownFooter = ({ children, testID }: DropdownFooter): React.ReactElement => {\n const { setHasFooterAction, activeIndex, onTriggerKeydown, isOpen } = useDropdown();\n const footerRef = React.useRef<HTMLDivElement>(null);\n\n React.useEffect(() => {\n setHasFooterAction(true);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return (\n <BaseBox\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref={footerRef as any}\n {...(isReactNative()\n ? {}\n : {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onKeyDown: (e: any) => {\n const nativeEvent = e.nativeEvent;\n const shouldIgnoreDropdownKeydown =\n (nativeEvent.key === ' ' || nativeEvent.key === 'Enter') && activeIndex < 0;\n\n if (!shouldIgnoreDropdownKeydown) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onTriggerKeydown?.({ event: e.nativeEvent } as any);\n }\n },\n })}\n {...makeAccessible({\n role: isReactNative() ? undefined : 'group',\n })}\n >\n <BaseFooter metaComponentName={MetaConstants.DropdownFooter} testID={testID}>\n {/* We don't want any of the interactive children to get focussed on TAB when dropdown is closed so we remove them from DOM itself */}\n {isOpen ? children : null}\n </BaseFooter>\n </BaseBox>\n );\n};\n\nconst DropdownFooter = assignWithoutSideEffects(_DropdownFooter, {\n componentId: 'DropdownFooter',\n});\n\nexport { DropdownHeader, DropdownFooter };\n"],"names":["_DropdownHeader","_ref","title","subtitle","leading","titleSuffix","trailing","testID","_jsx","BaseBox","_objectSpread","flexShrink","isReactNative","onMouseDown","e","preventDefault","children","BaseHeader","metaComponentName","MetaConstants","DropdownHeader","showBackButton","showCloseButton","assignWithoutSideEffects","componentId","_DropdownFooter","_ref2","_useDropdown","useDropdown","setHasFooterAction","activeIndex","onTriggerKeydown","isOpen","footerRef","React","useRef","useEffect","ref","onKeyDown","nativeEvent","shouldIgnoreDropdownKeydown","key","event","makeAccessible","role","undefined","BaseFooter","DropdownFooter"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,IAAMA,eAAe,GAAG,SAAlBA,eAAeA,CAAAC,IAAA,EAO0B;AAAA,EAAA,IAN7CC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,OAAO,GAAAH,IAAA,CAAPG,OAAO;IACPC,WAAW,GAAAJ,IAAA,CAAXI,WAAW;IACXC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;IACRC,MAAM,GAAAN,IAAA,CAANM,MAAM,CAAA;AAEN,EAAA,oBACEC,GAAA,CAACC,OAAO,EAAAC,aAAA,CAAAA,aAAA,CAAA;AACNC,IAAAA,UAAU,EAAE,CAAA;AAAE,GAAA,EACTC,aAAa,EAAE,GAChB,EAAE,GACF;AACE;AACAC,IAAAA,WAAW,EAAE,SAAAA,WAACC,CAAAA,CAAM,EAAK;AACvB;MACAA,C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A,IAAAC,aAAA,CAAAA,aAAA,CAAAA,aAAA,CAAA;AACA2B,IAAAA,GAAG,EAAEJ,SAAAA;AAAiB,GAAA,EACjBrB,aAAa,EAAE,GAChB,EAAE,GACF;AACE;AACA0B,IAAAA,SAAS,EAAE,SAAAA,SAACxB,CAAAA,CAAM,EAAK;AACrB,MAAA,IAAMyB,WAAW,GAAGzB,CAAC,CAACyB,WAAW,CAAA;AACjC,MAAA,IAAMC,2BAA2B,GAC/B,CAACD,WAAW,CAACE,GAAG,KAAK,GAAG,IAAIF,WAAW,CAACE,GAAG,KAAK,OAAO,KAAKX,WAAW,GAAG,CAAC,CAAA;MAE7E,IAAI,CAACU,2BAA2B,EAAE;AAChC;AACAT,QAAAA,gBAAgB,KAAhBA,IAAAA,IAAAA,gBAAgB,KAAhBA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,gBAAgB,CAAG;UAAEW,KAAK,EAAE5B,CAAC,CAACyB,WAAAA;AAAY,SAAQ,CAAC,CAAA;AACrD,OAAA;AACF,KAAA;GACD,CAAA,EACDI,cAAc,CAAC;AACjBC,IAAAA,IAAI,EAAEhC,aAAa,EAAE,GAAGiC,SAAS,GAAG,OAAA;AACtC,GAAC,CAAC,CAAA,EAAA,EAAA,EAAA;IAAA7B,QAAA,eAEFR,GAAA,CAACsC,UAAU,EAAA;MAAC5B,iBAAiB,EAAEC,aAAa,CAAC4B,cAAe;AAACxC,MAAAA,MAAM,EAAEA,MAAO;AAAAS,MAAAA,QAAA,EAEzEgB,MAAM,GAAGhB,QAAQ,GAAG,IAAA;KACX,CAAA;AAAC,GAAA,CACN,CAAC,CAAA;AAEd,CAAC,CAAA;AAED,IAAM+B,cAAc,gBAAGxB,wBAAwB,CAACE,eAAe,EAAE;AAC/DD,EAAAA,WAAW,EAAE,gBAAA;AACf,CAAC;;;;"}
1
+ {"version":3,"file":"DropdownHeaderFooter.js","sources":["../../../../../../src/components/Dropdown/DropdownHeaderFooter.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */\nimport React from 'react';\nimport { useDropdown } from './useDropdown';\nimport { BaseFooter } from '~components/BaseHeaderFooter/BaseFooter';\nimport { BaseHeader } from '~components/BaseHeaderFooter/BaseHeader';\nimport type { BaseHeaderProps } from '~components/BaseHeaderFooter/BaseHeader';\nimport type { BaseFooterProps } from '~components/BaseHeaderFooter/BaseFooter';\nimport BaseBox from '~components/Box/BaseBox';\nimport { isReactNative } from '~utils';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { MetaConstants } from '~utils/metaAttribute/metaConstants';\n\ntype DropdownHeaderProps = Pick<\n BaseHeaderProps,\n 'title' | 'subtitle' | 'leading' | 'trailing' | 'titleSuffix' | 'testID'\n>;\n\nconst _DropdownHeader = ({\n title,\n subtitle,\n leading,\n titleSuffix,\n trailing,\n testID,\n}: DropdownHeaderProps): React.ReactElement => {\n return (\n <BaseBox\n flexShrink={0}\n {...(isReactNative()\n ? {}\n : {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onMouseDown: (e: any) => {\n // we don't want focus to ever move on header because its static element\n e.preventDefault();\n },\n })}\n >\n <BaseHeader\n title={title}\n subtitle={subtitle}\n leading={leading}\n trailing={trailing}\n titleSuffix={titleSuffix}\n metaComponentName={MetaConstants.DropdownHeader}\n testID={testID}\n // back button\n showBackButton={false}\n // close button\n showCloseButton={false}\n />\n </BaseBox>\n );\n};\n\nconst DropdownHeader = assignWithoutSideEffects(_DropdownHeader, {\n componentId: 'DropdownHeader',\n});\n\ntype DropdownFooter = Pick<BaseFooterProps, 'children' | 'testID'>;\n\nconst _DropdownFooter = ({ children, testID }: DropdownFooter): React.ReactElement => {\n const { setHasFooterAction, isOpen } = useDropdown();\n const footerRef = React.useRef<HTMLDivElement>(null);\n\n React.useEffect(() => {\n setHasFooterAction(true);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return (\n <BaseBox\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref={footerRef as any}\n {...makeAccessible({\n role: isReactNative() ? undefined : 'group',\n })}\n >\n <BaseFooter metaComponentName={MetaConstants.DropdownFooter} testID={testID}>\n {/* We don't want any of the interactive children to get focussed on TAB when dropdown is closed so we remove them from DOM itself */}\n {isOpen ? children : null}\n </BaseFooter>\n </BaseBox>\n );\n};\n\nconst DropdownFooter = assignWithoutSideEffects(_DropdownFooter, {\n componentId: 'DropdownFooter',\n});\n\nexport { DropdownHeader, DropdownFooter };\n"],"names":["_DropdownHeader","_ref","title","subtitle","leading","titleSuffix","trailing","testID","_jsx","BaseBox","_objectSpread","flexShrink","isReactNative","onMouseDown","e","preventDefault","children","BaseHeader","metaComponentName","MetaConstants","DropdownHeader","showBackButton","showCloseButton","assignWithoutSideEffects","componentId","_DropdownFooter","_ref2","_useDropdown","useDropdown","setHasFooterAction","isOpen","footerRef","React","useRef","useEffect","ref","makeAccessible","role","undefined","BaseFooter","DropdownFooter"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,IAAMA,eAAe,GAAG,SAAlBA,eAAeA,CAAAC,IAAA,EAO0B;AAAA,EAAA,IAN7CC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,OAAO,GAAAH,IAAA,CAAPG,OAAO;IACPC,WAAW,GAAAJ,IAAA,CAAXI,WAAW;IACXC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;IACRC,MAAM,GAAAN,IAAA,CAANM,MAAM,CAAA;AAEN,EAAA,oBACEC,GAAA,CAACC,OAAO,EAAAC,aAAA,CAAAA,aAAA,CAAA;AACNC,IAAAA,UAAU,EAAE,CAAA;AAAE,GAAA,EACTC,aAAa,EAAE,GAChB,EAAE,GACF;AACE;AACAC,IAAAA,WAAW,EAAE,SAAAA,WAACC,CAAAA,CAAM,EAAK;AACvB;MACAA,CAAC,CAACC,cAAc,EAAE,CAAA;AACpB,KAAA;GACD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,EAAE,GAAG0B,SAAS,GAAG,OAAA;AACtC,GAAC,CAAC,CAAA,EAAA,EAAA,EAAA;IAAAtB,QAAA,eAEFR,GAAA,CAAC+B,UAAU,EAAA;MAACrB,iBAAiB,EAAEC,aAAa,CAACqB,cAAe;AAACjC,MAAAA,MAAM,EAAEA,MAAO;AAAAS,MAAAA,QAAA,EAEzEc,MAAM,GAAGd,QAAQ,GAAG,IAAA;KACX,CAAA;AAAC,GAAA,CACN,CAAC,CAAA;AAEd,CAAC,CAAA;AAED,IAAMwB,cAAc,gBAAGjB,wBAAwB,CAACE,eAAe,EAAE;AAC/DD,EAAAA,WAAW,EAAE,gBAAA;AACf,CAAC;;;;"}
@@ -20,7 +20,7 @@ import Circle from '../Icons/_Svg/Circle/Circle.web.js';
20
20
 
21
21
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
22
22
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
23
- var pulseKeyframes = /*#__PURE__*/keyframes(["0%{opacity:100;}50%{opacity:0.65;}100%{opacity:100;}"]);
23
+ var pulseKeyframes = /*#__PURE__*/keyframes(["0%{opacity:1;}50%{opacity:0.65;}100%{opacity:1;}"]);
24
24
  var getPulseAnimationStyles = function getPulseAnimationStyles(_ref) {
25
25
  var duration = _ref.duration,
26
26
  easing = _ref.easing,
@@ -38,13 +38,15 @@ var StyledSVGText = /*#__PURE__*/styled.text.withConfig({
38
38
  var theme = _ref2.theme,
39
39
  size = _ref2.size,
40
40
  weight = _ref2.weight;
41
- return getBaseTextStyles(_objectSpread({
41
+ return _objectSpread(_objectSpread({}, getBaseTextStyles(_objectSpread({
42
42
  theme: theme
43
43
  }, getTextProps({
44
44
  variant: 'body',
45
45
  size: size,
46
46
  weight: weight
47
- })));
47
+ })))), {}, {
48
+ fill: theme.colors.surface.text.gray.normal
49
+ });
48
50
  });
49
51
  var DeterminatePulseAnimation = /*#__PURE__*/styled.circle.withConfig({
50
52
  displayName: "CircularProgressBarweb__DeterminatePulseAnimation",