@channel.io/bezier-react 1.7.1 → 1.7.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 (186) hide show
  1. package/dist/cjs/components/Forms/FormControl/FormControl.js +1 -1
  2. package/dist/cjs/components/Forms/FormControl/FormControl.js.map +1 -1
  3. package/dist/cjs/components/Forms/FormControl/FormControlContext.js +4 -3
  4. package/dist/cjs/components/Forms/FormControl/FormControlContext.js.map +1 -1
  5. package/dist/cjs/components/Forms/FormGroup/FormGroup.js +2 -2
  6. package/dist/cjs/components/Forms/FormGroup/FormGroup.js.map +1 -1
  7. package/dist/cjs/components/Forms/FormHelperText/FormHelperText.js +2 -2
  8. package/dist/cjs/components/Forms/FormHelperText/FormHelperText.js.map +1 -1
  9. package/dist/cjs/components/Forms/FormLabel/FormLabel.js +2 -2
  10. package/dist/cjs/components/Forms/FormLabel/FormLabel.js.map +1 -1
  11. package/dist/cjs/components/Forms/SegmentedControl/SegmentedControlContext.js +3 -15
  12. package/dist/cjs/components/Forms/SegmentedControl/SegmentedControlContext.js.map +1 -1
  13. package/dist/cjs/components/Forms/useFormFieldProps.js +2 -2
  14. package/dist/cjs/components/Forms/useFormFieldProps.js.map +1 -1
  15. package/dist/cjs/components/ListItem/ListItem.styled.js +1 -1
  16. package/dist/cjs/components/Modals/Modal/Modal.js.map +1 -1
  17. package/dist/cjs/components/Modals/Modal/Modal.types.js.map +1 -1
  18. package/dist/cjs/components/Modals/Modal/ModalContent.js +1 -1
  19. package/dist/cjs/components/Modals/Modal/ModalContent.js.map +1 -1
  20. package/dist/cjs/components/Modals/Modal/ModalContentContext.js +4 -6
  21. package/dist/cjs/components/Modals/Modal/ModalContentContext.js.map +1 -1
  22. package/dist/cjs/components/Modals/Modal/ModalHeader.js +1 -1
  23. package/dist/cjs/components/Modals/Modal/ModalHeader.js.map +1 -1
  24. package/dist/cjs/components/OutlineItem/OutlineItem.js +2 -3
  25. package/dist/cjs/components/OutlineItem/OutlineItem.js.map +1 -1
  26. package/dist/cjs/components/OutlineItem/OutlineItemContext.js +9 -5
  27. package/dist/cjs/components/OutlineItem/OutlineItemContext.js.map +1 -1
  28. package/dist/cjs/components/Spinner/Spinner.styled.js +1 -1
  29. package/dist/cjs/components/Tabs/TabAction.js +1 -1
  30. package/dist/cjs/components/Tabs/TabAction.js.map +1 -1
  31. package/dist/cjs/components/Tabs/TabItem.js +1 -1
  32. package/dist/cjs/components/Tabs/TabItem.js.map +1 -1
  33. package/dist/cjs/components/Tabs/TabList.js +1 -1
  34. package/dist/cjs/components/Tabs/TabList.js.map +1 -1
  35. package/dist/cjs/components/Tabs/TabListContext.js +4 -6
  36. package/dist/cjs/components/Tabs/TabListContext.js.map +1 -1
  37. package/dist/cjs/components/Toast/ToastContext.js +4 -6
  38. package/dist/cjs/components/Toast/ToastContext.js.map +1 -1
  39. package/dist/cjs/components/Toast/ToastProvider.js +1 -4
  40. package/dist/cjs/components/Toast/ToastProvider.js.map +1 -1
  41. package/dist/cjs/components/Toast/useToast.js +2 -3
  42. package/dist/cjs/components/Toast/useToast.js.map +1 -1
  43. package/dist/cjs/components/Tooltip/Tooltip.js +4 -16
  44. package/dist/cjs/components/Tooltip/Tooltip.js.map +1 -1
  45. package/dist/cjs/components/Tooltip/Tooltip.styled.js +3 -56
  46. package/dist/cjs/components/Tooltip/Tooltip.styled.js.map +1 -1
  47. package/dist/cjs/components/Tooltip/Tooltip.types.js.map +1 -1
  48. package/dist/cjs/features/FeatureProvider.js +4 -3
  49. package/dist/cjs/features/FeatureProvider.js.map +1 -1
  50. package/dist/cjs/index.js +1 -3
  51. package/dist/cjs/index.js.map +1 -1
  52. package/dist/cjs/utils/reactUtils.js +21 -0
  53. package/dist/cjs/utils/reactUtils.js.map +1 -1
  54. package/dist/esm/components/Forms/FormControl/FormControl.mjs +2 -2
  55. package/dist/esm/components/Forms/FormControl/FormControl.mjs.map +1 -1
  56. package/dist/esm/components/Forms/FormControl/FormControlContext.mjs +3 -3
  57. package/dist/esm/components/Forms/FormControl/FormControlContext.mjs.map +1 -1
  58. package/dist/esm/components/Forms/FormGroup/FormGroup.mjs +1 -1
  59. package/dist/esm/components/Forms/FormGroup/FormGroup.mjs.map +1 -1
  60. package/dist/esm/components/Forms/FormHelperText/FormHelperText.mjs +1 -1
  61. package/dist/esm/components/Forms/FormHelperText/FormHelperText.mjs.map +1 -1
  62. package/dist/esm/components/Forms/FormLabel/FormLabel.mjs +1 -1
  63. package/dist/esm/components/Forms/FormLabel/FormLabel.mjs.map +1 -1
  64. package/dist/esm/components/Forms/SegmentedControl/SegmentedControlContext.mjs +3 -15
  65. package/dist/esm/components/Forms/SegmentedControl/SegmentedControlContext.mjs.map +1 -1
  66. package/dist/esm/components/Forms/useFormFieldProps.mjs +1 -1
  67. package/dist/esm/components/Forms/useFormFieldProps.mjs.map +1 -1
  68. package/dist/esm/components/ListItem/ListItem.styled.mjs +1 -1
  69. package/dist/esm/components/Modals/Modal/Modal.mjs.map +1 -1
  70. package/dist/esm/components/Modals/Modal/Modal.types.mjs.map +1 -1
  71. package/dist/esm/components/Modals/Modal/ModalContent.mjs +2 -2
  72. package/dist/esm/components/Modals/Modal/ModalContent.mjs.map +1 -1
  73. package/dist/esm/components/Modals/Modal/ModalContentContext.mjs +3 -4
  74. package/dist/esm/components/Modals/Modal/ModalContentContext.mjs.map +1 -1
  75. package/dist/esm/components/Modals/Modal/ModalHeader.mjs +3 -3
  76. package/dist/esm/components/Modals/Modal/ModalHeader.mjs.map +1 -1
  77. package/dist/esm/components/OutlineItem/OutlineItem.mjs +2 -3
  78. package/dist/esm/components/OutlineItem/OutlineItem.mjs.map +1 -1
  79. package/dist/esm/components/OutlineItem/OutlineItemContext.mjs +8 -3
  80. package/dist/esm/components/OutlineItem/OutlineItemContext.mjs.map +1 -1
  81. package/dist/esm/components/Spinner/Spinner.styled.mjs +1 -1
  82. package/dist/esm/components/Tabs/TabAction.mjs +3 -3
  83. package/dist/esm/components/Tabs/TabAction.mjs.map +1 -1
  84. package/dist/esm/components/Tabs/TabItem.mjs +3 -3
  85. package/dist/esm/components/Tabs/TabItem.mjs.map +1 -1
  86. package/dist/esm/components/Tabs/TabList.mjs +2 -2
  87. package/dist/esm/components/Tabs/TabList.mjs.map +1 -1
  88. package/dist/esm/components/Tabs/TabListContext.mjs +3 -4
  89. package/dist/esm/components/Tabs/TabListContext.mjs.map +1 -1
  90. package/dist/esm/components/Toast/ToastContext.mjs +3 -4
  91. package/dist/esm/components/Toast/ToastContext.mjs.map +1 -1
  92. package/dist/esm/components/Toast/ToastProvider.mjs +2 -5
  93. package/dist/esm/components/Toast/ToastProvider.mjs.map +1 -1
  94. package/dist/esm/components/Toast/useToast.mjs +3 -4
  95. package/dist/esm/components/Toast/useToast.mjs.map +1 -1
  96. package/dist/esm/components/Tooltip/Tooltip.mjs +4 -16
  97. package/dist/esm/components/Tooltip/Tooltip.mjs.map +1 -1
  98. package/dist/esm/components/Tooltip/Tooltip.styled.mjs +3 -56
  99. package/dist/esm/components/Tooltip/Tooltip.styled.mjs.map +1 -1
  100. package/dist/esm/components/Tooltip/Tooltip.types.mjs.map +1 -1
  101. package/dist/esm/features/FeatureProvider.mjs +5 -4
  102. package/dist/esm/features/FeatureProvider.mjs.map +1 -1
  103. package/dist/esm/index.mjs +1 -2
  104. package/dist/esm/index.mjs.map +1 -1
  105. package/dist/esm/utils/reactUtils.mjs +21 -1
  106. package/dist/esm/utils/reactUtils.mjs.map +1 -1
  107. package/dist/types/components/Forms/FormControl/FormControlContext.d.ts +1 -1
  108. package/dist/types/components/Forms/FormControl/FormControlContext.d.ts.map +1 -1
  109. package/dist/types/components/Forms/FormControl/index.d.ts +1 -1
  110. package/dist/types/components/Forms/FormControl/index.d.ts.map +1 -1
  111. package/dist/types/components/Forms/SegmentedControl/SegmentedControlContext.d.ts +3 -3
  112. package/dist/types/components/Forms/SegmentedControl/SegmentedControlContext.d.ts.map +1 -1
  113. package/dist/types/components/Forms/index.d.ts +1 -2
  114. package/dist/types/components/Forms/index.d.ts.map +1 -1
  115. package/dist/types/components/Forms/useFormFieldProps.d.ts.map +1 -1
  116. package/dist/types/components/Modals/Modal/Modal.types.d.ts +1 -1
  117. package/dist/types/components/Modals/Modal/Modal.types.d.ts.map +1 -1
  118. package/dist/types/components/Modals/Modal/ModalContentContext.d.ts +2 -3
  119. package/dist/types/components/Modals/Modal/ModalContentContext.d.ts.map +1 -1
  120. package/dist/types/components/Modals/Modal/ModalHeader.d.ts.map +1 -1
  121. package/dist/types/components/OutlineItem/OutlineItem.d.ts.map +1 -1
  122. package/dist/types/components/OutlineItem/OutlineItemContext.d.ts +4 -10
  123. package/dist/types/components/OutlineItem/OutlineItemContext.d.ts.map +1 -1
  124. package/dist/types/components/Tabs/TabAction.d.ts.map +1 -1
  125. package/dist/types/components/Tabs/TabItem.d.ts.map +1 -1
  126. package/dist/types/components/Tabs/TabListContext.d.ts +1 -2
  127. package/dist/types/components/Tabs/TabListContext.d.ts.map +1 -1
  128. package/dist/types/components/Toast/ToastContext.d.ts +1 -2
  129. package/dist/types/components/Toast/ToastContext.d.ts.map +1 -1
  130. package/dist/types/components/Toast/ToastProvider.d.ts.map +1 -1
  131. package/dist/types/components/Toast/useToast.d.ts.map +1 -1
  132. package/dist/types/components/Tooltip/Tooltip.d.ts.map +1 -1
  133. package/dist/types/components/Tooltip/Tooltip.styled.d.ts.map +1 -1
  134. package/dist/types/components/Tooltip/Tooltip.types.d.ts +3 -3
  135. package/dist/types/features/FeatureProvider.d.ts.map +1 -1
  136. package/dist/types/utils/reactUtils.d.ts +14 -0
  137. package/dist/types/utils/reactUtils.d.ts.map +1 -1
  138. package/package.json +1 -1
  139. package/src/components/Forms/FormControl/FormControl.tsx +3 -3
  140. package/src/components/Forms/FormControl/FormControlContext.ts +5 -2
  141. package/src/components/Forms/FormControl/index.ts +1 -1
  142. package/src/components/Forms/FormGroup/FormGroup.tsx +1 -1
  143. package/src/components/Forms/FormHelperText/FormHelperText.tsx +1 -1
  144. package/src/components/Forms/FormLabel/FormLabel.tsx +1 -1
  145. package/src/components/Forms/SegmentedControl/SegmentedControlContext.ts +3 -26
  146. package/src/components/Forms/Slider/Slider.test.tsx +11 -4
  147. package/src/components/Forms/index.ts +0 -2
  148. package/src/components/Forms/useFormFieldProps.ts +1 -2
  149. package/src/components/KeyValueListItem/KeyValueListItem.test.tsx +4 -1
  150. package/src/components/Modals/Modal/Modal.stories.tsx +1 -1
  151. package/src/components/Modals/Modal/Modal.tsx +0 -1
  152. package/src/components/Modals/Modal/Modal.types.ts +1 -1
  153. package/src/components/Modals/Modal/ModalContent.tsx +3 -3
  154. package/src/components/Modals/Modal/ModalContentContext.ts +5 -4
  155. package/src/components/Modals/Modal/ModalHeader.tsx +3 -6
  156. package/src/components/OutlineItem/OutlineItem.tsx +6 -4
  157. package/src/components/OutlineItem/OutlineItemContext.ts +16 -5
  158. package/src/components/Tabs/TabAction.tsx +3 -6
  159. package/src/components/Tabs/TabItem.tsx +3 -6
  160. package/src/components/Tabs/TabList.tsx +3 -3
  161. package/src/components/Tabs/TabListContext.ts +5 -4
  162. package/src/components/Toast/ToastContext.ts +5 -5
  163. package/src/components/Toast/ToastProvider.tsx +3 -5
  164. package/src/components/Toast/useToast.ts +3 -5
  165. package/src/components/Tooltip/Tooltip.stories.tsx +2 -2
  166. package/src/components/Tooltip/Tooltip.styled.ts +0 -77
  167. package/src/components/Tooltip/Tooltip.test.tsx +8 -2
  168. package/src/components/Tooltip/Tooltip.tsx +4 -27
  169. package/src/components/Tooltip/Tooltip.types.ts +3 -3
  170. package/src/components/Tooltip/index.ts +0 -1
  171. package/src/features/FeatureProvider.tsx +9 -6
  172. package/src/utils/reactUtils.ts +41 -0
  173. package/dist/cjs/components/Forms/useFormControlContext.js +0 -13
  174. package/dist/cjs/components/Forms/useFormControlContext.js.map +0 -1
  175. package/dist/cjs/components/OutlineItem/useOutlineItemContext.js +0 -16
  176. package/dist/cjs/components/OutlineItem/useOutlineItemContext.js.map +0 -1
  177. package/dist/esm/components/Forms/useFormControlContext.mjs +0 -9
  178. package/dist/esm/components/Forms/useFormControlContext.mjs.map +0 -1
  179. package/dist/esm/components/OutlineItem/useOutlineItemContext.mjs +0 -12
  180. package/dist/esm/components/OutlineItem/useOutlineItemContext.mjs.map +0 -1
  181. package/dist/types/components/Forms/useFormControlContext.d.ts +0 -3
  182. package/dist/types/components/Forms/useFormControlContext.d.ts.map +0 -1
  183. package/dist/types/components/OutlineItem/useOutlineItemContext.d.ts +0 -4
  184. package/dist/types/components/OutlineItem/useOutlineItemContext.d.ts.map +0 -1
  185. package/src/components/Forms/useFormControlContext.ts +0 -9
  186. package/src/components/OutlineItem/useOutlineItemContext.ts +0 -16
@@ -114,7 +114,7 @@ const FormControl = /*#__PURE__*/React.forwardRef(function FormControl({
114
114
  if (!children) {
115
115
  return null;
116
116
  }
117
- return /*#__PURE__*/React.createElement(FormControlContext.FormControlContext.Provider, {
117
+ return /*#__PURE__*/React.createElement(FormControlContext.FormControlContextProvider, {
118
118
  value: contextValue
119
119
  }, /*#__PURE__*/React.createElement(Container, Object.assign({}, bezierProps, {
120
120
  ref: forwardedRef,
@@ -1 +1 @@
1
- {"version":3,"file":"FormControl.js","sources":["../../../../../src/components/Forms/FormControl/FormControl.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useCallback,\n useMemo,\n useState,\n} from 'react'\n\nimport { Typography } from '~/src/foundation'\n\nimport useId from '~/src/hooks/useId'\nimport {\n omitBezierComponentProps,\n pickBezierComponentProps,\n} from '~/src/utils/propsUtils'\nimport { isNil } from '~/src/utils/typeUtils'\n\nimport { AlphaStack } from '~/src/components/AlphaStack'\n\n// eslint-disable-next-line no-restricted-imports\nimport FormFieldSize from '../FormFieldSize'\n\nimport {\n type ContainerProps,\n type ErrorMessagePropsGetter,\n type FieldPropsGetter,\n type FormControlProps,\n type GroupPropsGetter,\n type HelperTextPropsGetter,\n type LabelPropsGetter,\n} from './FormControl.types'\nimport { FormControlContext } from './FormControlContext'\n\nimport * as Styled from './FormControl.styled'\n\nexport const FORM_CONTROL_TEST_ID = 'bezier-react-form-control'\n\nconst Container = forwardRef<HTMLElement, ContainerProps>(function Container({\n labelPosition,\n children,\n testId,\n ...rest\n}, forwardedRef) {\n switch (labelPosition) {\n case 'top':\n return (\n <AlphaStack\n ref={forwardedRef}\n direction=\"vertical\"\n testId={testId}\n {...rest}\n >\n { children }\n </AlphaStack>\n )\n\n case 'left':\n default:\n return (\n <Styled.Grid\n ref={forwardedRef}\n data-testid={testId}\n {...rest}\n >\n { children }\n </Styled.Grid>\n )\n }\n})\n\nexport const FormControl = forwardRef<HTMLElement, FormControlProps>(function FormControl({\n id: idProp,\n testId = FORM_CONTROL_TEST_ID,\n labelPosition = 'top',\n leftLabelWrapperHeight = FormFieldSize.M,\n style,\n children,\n ...rest\n}, forwardedRef) {\n const [groupNode, setGroupNode] = useState<HTMLElement | null>(null)\n const [helperTextNode, setHelperTextNode] = useState<HTMLElement | null>(null)\n const [errorMessageNode, setErrorMessageNode] = useState<HTMLElement | null>(null)\n\n const id = useId(idProp, 'field')\n const groupId = `${id}-group`\n const labelId = `${id}-label`\n const helperTextId = `${id}-help-text`\n const errorMessageId = `${id}-error-message`\n\n const fieldId = groupNode ? undefined : id\n\n const describerId = useMemo(() => {\n if (errorMessageNode) { return errorMessageId }\n if (helperTextNode) { return helperTextId }\n return undefined\n }, [\n errorMessageNode,\n helperTextNode,\n errorMessageId,\n helperTextId,\n ])\n\n const bezierProps = useMemo(() => pickBezierComponentProps(rest), [rest])\n const formCommonProps = useMemo(() => omitBezierComponentProps(rest), [rest])\n\n const getGroupProps = useCallback<GroupPropsGetter>(ownProps => ({\n id: groupId,\n 'aria-labelledby': labelId,\n 'aria-describedby': describerId,\n ref: setGroupNode,\n ...ownProps,\n }), [\n groupId,\n labelId,\n describerId,\n ])\n\n const getLabelProps = useCallback<LabelPropsGetter>(ownProps => ({\n id: labelId,\n htmlFor: fieldId,\n typo: labelPosition === 'top' ? Typography.Size13 : Typography.Size14,\n Wrapper: labelPosition === 'top'\n ? Styled.TopLabelWrapper\n : Styled.LeftLabelWrapper,\n ...ownProps,\n }), [\n fieldId,\n labelId,\n labelPosition,\n ])\n\n const getFieldProps = useCallback<FieldPropsGetter>(ownProps => ({\n id: fieldId,\n 'aria-describedby': groupNode ? undefined : describerId,\n ...formCommonProps,\n ...ownProps,\n }), [\n fieldId,\n describerId,\n formCommonProps,\n groupNode,\n ])\n\n const getHelperTextProps = useCallback<HelperTextPropsGetter>(ownProps => ({\n id: helperTextId,\n visible: isNil(formCommonProps?.hasError) || !formCommonProps?.hasError,\n ref: setHelperTextNode,\n Wrapper: labelPosition === 'top'\n ? Styled.TopHelperTextWrapper\n : Styled.LeftHelperTextWrapper,\n ...ownProps,\n }), [\n helperTextId,\n labelPosition,\n formCommonProps,\n ])\n\n const getErrorMessageProps = useCallback<ErrorMessagePropsGetter>(ownProps => ({\n id: errorMessageId,\n visible: isNil(formCommonProps?.hasError) || formCommonProps?.hasError,\n ref: setErrorMessageNode,\n Wrapper: labelPosition === 'top'\n ? Styled.TopHelperTextWrapper\n : Styled.LeftHelperTextWrapper,\n ...ownProps,\n }), [\n errorMessageId,\n labelPosition,\n formCommonProps,\n ])\n\n const contextValue = useMemo(() => ({\n id,\n labelId,\n helperTextId,\n errorMessageId,\n getGroupProps,\n getLabelProps,\n getFieldProps,\n getHelperTextProps,\n getErrorMessageProps,\n ...formCommonProps,\n }), [\n id,\n labelId,\n helperTextId,\n errorMessageId,\n getGroupProps,\n getLabelProps,\n getFieldProps,\n getHelperTextProps,\n getErrorMessageProps,\n formCommonProps,\n ])\n\n const containerStyle = useMemo(() => ({\n ...style,\n '--bezier-form-control-left-label-wrapper-height': `${leftLabelWrapperHeight}px`,\n } as React.CSSProperties), [\n style,\n leftLabelWrapperHeight,\n ])\n\n if (!children) { return null }\n\n return (\n <FormControlContext.Provider value={contextValue}>\n <Container\n {...bezierProps}\n ref={forwardedRef}\n style={containerStyle}\n testId={testId}\n labelPosition={labelPosition}\n >\n { children }\n </Container>\n </FormControlContext.Provider>\n )\n})\n"],"names":["FORM_CONTROL_TEST_ID","Container","forwardRef","labelPosition","children","testId","rest","forwardedRef","React","createElement","AlphaStack","Object","assign","ref","direction","Styled","FormControl","id","idProp","leftLabelWrapperHeight","FormFieldSize","M","style","groupNode","setGroupNode","useState","helperTextNode","setHelperTextNode","errorMessageNode","setErrorMessageNode","useId","groupId","labelId","helperTextId","errorMessageId","fieldId","undefined","describerId","useMemo","bezierProps","pickBezierComponentProps","formCommonProps","omitBezierComponentProps","getGroupProps","useCallback","ownProps","getLabelProps","htmlFor","typo","Typography","Size13","Size14","Wrapper","getFieldProps","getHelperTextProps","visible","isNil","hasError","getErrorMessageProps","contextValue","containerStyle","FormControlContext","Provider","value"],"mappings":";;;;;;;;;;;;AAkCO,MAAMA,oBAAoB,GAAG,4BAA2B;AAE/D,MAAMC,SAAS,gBAAGC,gBAAU,CAA8B,SAASD,SAASA,CAAC;EAC3EE,aAAa;EACbC,QAAQ;EACRC,MAAM;EACN,GAAGC,IAAAA;AACL,CAAC,EAAEC,YAAY,EAAE;AACf,EAAA,QAAQJ,aAAa;AACnB,IAAA,KAAK,KAAK;MACR,oBACEK,KAAA,CAAAC,aAAA,CAACC,qBAAU,EAAAC,MAAA,CAAAC,MAAA,CAAA;AACTC,QAAAA,GAAG,EAAEN,YAAa;AAClBO,QAAAA,SAAS,EAAC,UAAU;AACpBT,QAAAA,MAAM,EAAEA,MAAAA;OACJC,EAAAA,IAAI,CAENF,EAAAA,QACQ,CAAC,CAAA;AAGjB,IAAA,KAAK,MAAM,CAAA;AACX,IAAA;MACE,oBACEI,KAAA,CAAAC,aAAA,CAACM,uBAAW,EAAAJ,MAAA,CAAAC,MAAA,CAAA;AACVC,QAAAA,GAAG,EAAEN,YAAa;QAClB,aAAaF,EAAAA,MAAAA;OACTC,EAAAA,IAAI,CAENF,EAAAA,QACS,CAAC,CAAA;AAEpB,GAAA;AACF,CAAC,CAAC,CAAA;MAE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,EAAA,MAAMmB,cAAc,GAAGtB,aAAO,CAAC,OAAO;AACpC,IAAA,GAAGhB,KAAK;IACR,iDAAiD,EAAG,GAAEH,sBAAuB,CAAA,EAAA,CAAA;AAC/E,GAAC,CAAwB,EAAE,CACzBG,KAAK,EACLH,sBAAsB,CACvB,CAAC,CAAA;EAEF,IAAI,CAACf,QAAQ,EAAE;AAAE,IAAA,OAAO,IAAI,CAAA;AAAC,GAAA;AAE7B,EAAA,oBACEI,KAAA,CAAAC,aAAA,CAACoD,qCAAkB,CAACC,QAAQ,EAAA;AAACC,IAAAA,KAAK,EAAEJ,YAAAA;GAClCnD,eAAAA,KAAA,CAAAC,aAAA,CAACR,SAAS,EAAAU,MAAA,CAAAC,MAAA,CAAA,EAAA,EACJ2B,WAAW,EAAA;AACf1B,IAAAA,GAAG,EAAEN,YAAa;AAClBe,IAAAA,KAAK,EAAEsC,cAAe;AACtBvD,IAAAA,MAAM,EAAEA,MAAO;AACfF,IAAAA,aAAa,EAAEA,aAAAA;GAEbC,CAAAA,EAAAA,QACO,CACgB,CAAC,CAAA;AAElC,CAAC;;;;;"}
1
+ {"version":3,"file":"FormControl.js","sources":["../../../../../src/components/Forms/FormControl/FormControl.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useCallback,\n useMemo,\n useState,\n} from 'react'\n\nimport { Typography } from '~/src/foundation'\n\nimport useId from '~/src/hooks/useId'\nimport {\n omitBezierComponentProps,\n pickBezierComponentProps,\n} from '~/src/utils/propsUtils'\nimport { isNil } from '~/src/utils/typeUtils'\n\nimport { AlphaStack } from '~/src/components/AlphaStack'\n\n// eslint-disable-next-line no-restricted-imports\nimport FormFieldSize from '../FormFieldSize'\n\nimport {\n type ContainerProps,\n type ErrorMessagePropsGetter,\n type FieldPropsGetter,\n type FormControlProps,\n type GroupPropsGetter,\n type HelperTextPropsGetter,\n type LabelPropsGetter,\n} from './FormControl.types'\nimport { FormControlContextProvider } from './FormControlContext'\n\nimport * as Styled from './FormControl.styled'\n\nexport const FORM_CONTROL_TEST_ID = 'bezier-react-form-control'\n\nconst Container = forwardRef<HTMLElement, ContainerProps>(function Container({\n labelPosition,\n children,\n testId,\n ...rest\n}, forwardedRef) {\n switch (labelPosition) {\n case 'top':\n return (\n <AlphaStack\n ref={forwardedRef}\n direction=\"vertical\"\n testId={testId}\n {...rest}\n >\n { children }\n </AlphaStack>\n )\n\n case 'left':\n default:\n return (\n <Styled.Grid\n ref={forwardedRef}\n data-testid={testId}\n {...rest}\n >\n { children }\n </Styled.Grid>\n )\n }\n})\n\nexport const FormControl = forwardRef<HTMLElement, FormControlProps>(function FormControl({\n id: idProp,\n testId = FORM_CONTROL_TEST_ID,\n labelPosition = 'top',\n leftLabelWrapperHeight = FormFieldSize.M,\n style,\n children,\n ...rest\n}, forwardedRef) {\n const [groupNode, setGroupNode] = useState<HTMLElement | null>(null)\n const [helperTextNode, setHelperTextNode] = useState<HTMLElement | null>(null)\n const [errorMessageNode, setErrorMessageNode] = useState<HTMLElement | null>(null)\n\n const id = useId(idProp, 'field')\n const groupId = `${id}-group`\n const labelId = `${id}-label`\n const helperTextId = `${id}-help-text`\n const errorMessageId = `${id}-error-message`\n\n const fieldId = groupNode ? undefined : id\n\n const describerId = useMemo(() => {\n if (errorMessageNode) { return errorMessageId }\n if (helperTextNode) { return helperTextId }\n return undefined\n }, [\n errorMessageNode,\n helperTextNode,\n errorMessageId,\n helperTextId,\n ])\n\n const bezierProps = useMemo(() => pickBezierComponentProps(rest), [rest])\n const formCommonProps = useMemo(() => omitBezierComponentProps(rest), [rest])\n\n const getGroupProps = useCallback<GroupPropsGetter>(ownProps => ({\n id: groupId,\n 'aria-labelledby': labelId,\n 'aria-describedby': describerId,\n ref: setGroupNode,\n ...ownProps,\n }), [\n groupId,\n labelId,\n describerId,\n ])\n\n const getLabelProps = useCallback<LabelPropsGetter>(ownProps => ({\n id: labelId,\n htmlFor: fieldId,\n typo: labelPosition === 'top' ? Typography.Size13 : Typography.Size14,\n Wrapper: labelPosition === 'top'\n ? Styled.TopLabelWrapper\n : Styled.LeftLabelWrapper,\n ...ownProps,\n }), [\n fieldId,\n labelId,\n labelPosition,\n ])\n\n const getFieldProps = useCallback<FieldPropsGetter>(ownProps => ({\n id: fieldId,\n 'aria-describedby': groupNode ? undefined : describerId,\n ...formCommonProps,\n ...ownProps,\n }), [\n fieldId,\n describerId,\n formCommonProps,\n groupNode,\n ])\n\n const getHelperTextProps = useCallback<HelperTextPropsGetter>(ownProps => ({\n id: helperTextId,\n visible: isNil(formCommonProps?.hasError) || !formCommonProps?.hasError,\n ref: setHelperTextNode,\n Wrapper: labelPosition === 'top'\n ? Styled.TopHelperTextWrapper\n : Styled.LeftHelperTextWrapper,\n ...ownProps,\n }), [\n helperTextId,\n labelPosition,\n formCommonProps,\n ])\n\n const getErrorMessageProps = useCallback<ErrorMessagePropsGetter>(ownProps => ({\n id: errorMessageId,\n visible: isNil(formCommonProps?.hasError) || formCommonProps?.hasError,\n ref: setErrorMessageNode,\n Wrapper: labelPosition === 'top'\n ? Styled.TopHelperTextWrapper\n : Styled.LeftHelperTextWrapper,\n ...ownProps,\n }), [\n errorMessageId,\n labelPosition,\n formCommonProps,\n ])\n\n const contextValue = useMemo(() => ({\n id,\n labelId,\n helperTextId,\n errorMessageId,\n getGroupProps,\n getLabelProps,\n getFieldProps,\n getHelperTextProps,\n getErrorMessageProps,\n ...formCommonProps,\n }), [\n id,\n labelId,\n helperTextId,\n errorMessageId,\n getGroupProps,\n getLabelProps,\n getFieldProps,\n getHelperTextProps,\n getErrorMessageProps,\n formCommonProps,\n ])\n\n const containerStyle = useMemo(() => ({\n ...style,\n '--bezier-form-control-left-label-wrapper-height': `${leftLabelWrapperHeight}px`,\n } as React.CSSProperties), [\n style,\n leftLabelWrapperHeight,\n ])\n\n if (!children) { return null }\n\n return (\n <FormControlContextProvider value={contextValue}>\n <Container\n {...bezierProps}\n ref={forwardedRef}\n style={containerStyle}\n testId={testId}\n labelPosition={labelPosition}\n >\n { children }\n </Container>\n </FormControlContextProvider>\n )\n})\n"],"names":["FORM_CONTROL_TEST_ID","Container","forwardRef","labelPosition","children","testId","rest","forwardedRef","React","createElement","AlphaStack","Object","assign","ref","direction","Styled","FormControl","id","idProp","leftLabelWrapperHeight","FormFieldSize","M","style","groupNode","setGroupNode","useState","helperTextNode","setHelperTextNode","errorMessageNode","setErrorMessageNode","useId","groupId","labelId","helperTextId","errorMessageId","fieldId","undefined","describerId","useMemo","bezierProps","pickBezierComponentProps","formCommonProps","omitBezierComponentProps","getGroupProps","useCallback","ownProps","getLabelProps","htmlFor","typo","Typography","Size13","Size14","Wrapper","getFieldProps","getHelperTextProps","visible","isNil","hasError","getErrorMessageProps","contextValue","containerStyle","FormControlContextProvider","value"],"mappings":";;;;;;;;;;;;AAkCO,MAAMA,oBAAoB,GAAG,4BAA2B;AAE/D,MAAMC,SAAS,gBAAGC,gBAAU,CAA8B,SAASD,SAASA,CAAC;EAC3EE,aAAa;EACbC,QAAQ;EACRC,MAAM;EACN,GAAGC,IAAAA;AACL,CAAC,EAAEC,YAAY,EAAE;AACf,EAAA,QAAQJ,aAAa;AACnB,IAAA,KAAK,KAAK;MACR,oBACEK,KAAA,CAAAC,aAAA,CAACC,qBAAU,EAAAC,MAAA,CAAAC,MAAA,CAAA;AACTC,QAAAA,GAAG,EAAEN,YAAa;AAClBO,QAAAA,SAAS,EAAC,UAAU;AACpBT,QAAAA,MAAM,EAAEA,MAAAA;OACJC,EAAAA,IAAI,CAENF,EAAAA,QACQ,CAAC,CAAA;AAGjB,IAAA,KAAK,MAAM,CAAA;AACX,IAAA;MACE,oBACEI,KAAA,CAAAC,aAAA,CAACM,uBAAW,EAAAJ,MAAA,CAAAC,MAAA,CAAA;AACVC,QAAAA,GAAG,EAAEN,YAAa;QAClB,aAAaF,EAAAA,MAAAA;OACTC,EAAAA,IAAI,CAENF,EAAAA,QACS,CAAC,CAAA;AAEpB,GAAA;AACF,CAAC,CAAC,CAAA;MAEWY,WAAW,gBAAGd,gBAAU,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GtB,aAAO,CAAC,OAAO;AACpC,IAAA,GAAGhB,KAAK;IACR,iDAAiD,EAAG,GAAEH,sBAAuB,CAAA,EAAA,CAAA;AAC/E,GAAC,CAAwB,EAAE,CACzBG,KAAK,EACLH,sBAAsB,CACvB,CAAC,CAAA;EAEF,IAAI,CAACf,QAAQ,EAAE;AAAE,IAAA,OAAO,IAAI,CAAA;AAAC,GAAA;AAE7B,EAAA,oBACEI,KAAA,CAAAC,aAAA,CAACoD,6CAA0B,EAAA;AAACC,IAAAA,KAAK,EAAEH,YAAAA;GACjCnD,eAAAA,KAAA,CAAAC,aAAA,CAACR,SAAS,EAAAU,MAAA,CAAAC,MAAA,CAAA,EAAA,EACJ2B,WAAW,EAAA;AACf1B,IAAAA,GAAG,EAAEN,YAAa;AAClBe,IAAAA,KAAK,EAAEsC,cAAe;AACtBvD,IAAAA,MAAM,EAAEA,MAAO;AACfF,IAAAA,aAAa,EAAEA,aAAAA;GAEbC,CAAAA,EAAAA,QACO,CACe,CAAC,CAAA;AAEjC,CAAC;;;;;"}
@@ -1,8 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var React = require('react');
3
+ var reactUtils = require('../../../utils/reactUtils.js');
4
4
 
5
- const FormControlContext = /*#__PURE__*/React.createContext(undefined);
5
+ const [FormControlContextProvider, useFormControlContext] = reactUtils.createContext(undefined);
6
6
 
7
- exports.FormControlContext = FormControlContext;
7
+ exports.FormControlContextProvider = FormControlContextProvider;
8
+ exports.useFormControlContext = useFormControlContext;
8
9
  //# sourceMappingURL=FormControlContext.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormControlContext.js","sources":["../../../../../src/components/Forms/FormControl/FormControlContext.ts"],"sourcesContent":["import { createContext } from 'react'\n\nimport { type FormControlContextValue } from '~/src/components/Forms/FormControl'\n\nexport const FormControlContext = createContext<FormControlContextValue | undefined>(undefined)\n"],"names":["FormControlContext","createContext","undefined"],"mappings":";;;;MAIaA,kBAAkB,gBAAGC,mBAAa,CAAsCC,SAAS;;;;"}
1
+ {"version":3,"file":"FormControlContext.js","sources":["../../../../../src/components/Forms/FormControl/FormControlContext.ts"],"sourcesContent":["import { createContext } from '~/src/utils/reactUtils'\n\nimport { type FormControlContextValue } from '~/src/components/Forms/FormControl'\n\nexport const [\n FormControlContextProvider,\n useFormControlContext,\n] = createContext<FormControlContextValue | undefined>(undefined)\n"],"names":["FormControlContextProvider","useFormControlContext","createContext","undefined"],"mappings":";;;;AAIO,MAAM,CACXA,0BAA0B,EAC1BC,qBAAqB,CACtB,GAAGC,wBAAa,CAAsCC,SAAS;;;;;"}
@@ -5,8 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var React = require('react');
6
6
  var useMergeRefs = require('../../../hooks/useMergeRefs.js');
7
7
  var functionUtils = require('../../../utils/functionUtils.js');
8
- var useFormControlContext = require('../useFormControlContext.js');
9
8
  var FormGroup_styled = require('./FormGroup.styled.js');
9
+ var FormControlContext = require('../FormControl/FormControlContext.js');
10
10
 
11
11
  const FORM_GROUP_TEST_ID = 'bezier-react-form-group';
12
12
  function FormGroup({
@@ -17,7 +17,7 @@ function FormGroup({
17
17
  children,
18
18
  ...rest
19
19
  }, forwardedRef) {
20
- const contextValue = useFormControlContext.default();
20
+ const contextValue = FormControlContext.useFormControlContext();
21
21
  const {
22
22
  ref,
23
23
  ...ownProps
@@ -1 +1 @@
1
- {"version":3,"file":"FormGroup.js","sources":["../../../../../src/components/Forms/FormGroup/FormGroup.tsx"],"sourcesContent":["import React, { forwardRef } from 'react'\n\nimport useMergeRefs from '~/src/hooks/useMergeRefs'\nimport { noop } from '~/src/utils/functionUtils'\n\nimport useFormControlContext from '~/src/components/Forms/useFormControlContext'\n\nimport type FormGroupProps from './FormGroup.types'\n\nimport * as Styled from './FormGroup.styled'\n\nconst FORM_GROUP_TEST_ID = 'bezier-react-form-group'\n\nfunction FormGroup({\n testId = FORM_GROUP_TEST_ID,\n spacing = 6,\n direction = 'vertical',\n role = 'group',\n children,\n ...rest\n}: FormGroupProps,\nforwardedRef: React.Ref<HTMLDivElement>,\n) {\n const contextValue = useFormControlContext()\n\n const {\n ref,\n ...ownProps\n } = contextValue?.getGroupProps(rest) ?? {\n ref: noop,\n ...rest,\n }\n\n const mergedRef = useMergeRefs(ref, forwardedRef)\n\n return (\n <Styled.Stack\n {...ownProps}\n data-testid={testId}\n ref={mergedRef}\n justify=\"start\"\n align=\"stretch\"\n spacing={spacing}\n direction={direction}\n role={role}\n >\n { children }\n </Styled.Stack>\n )\n}\n\nexport default forwardRef(FormGroup)\n"],"names":["FORM_GROUP_TEST_ID","FormGroup","testId","spacing","direction","role","children","rest","forwardedRef","contextValue","useFormControlContext","ref","ownProps","getGroupProps","noop","mergedRef","useMergeRefs","React","createElement","Styled","Object","assign","justify","align","forwardRef"],"mappings":";;;;;;;;;;AAWA,MAAMA,kBAAkB,GAAG,yBAAyB,CAAA;AAEpD,SAASC,SAASA,CAAC;AACjBC,EAAAA,MAAM,GAAGF,kBAAkB;AAC3BG,EAAAA,OAAO,GAAG,CAAC;AACXC,EAAAA,SAAS,GAAG,UAAU;AACtBC,EAAAA,IAAI,GAAG,OAAO;EACdC,QAAQ;EACR,GAAGC,IAAAA;AACW,CAAC,EACjBC,YAAuC,EACrC;AACA,EAAA,MAAMC,YAAY,GAAGC,6BAAqB,EAAE,CAAA;EAE5C,MAAM;IACJC,GAAG;IACH,GAAGC,QAAAA;AACL,GAAC,GAAGH,YAAY,EAAEI,aAAa,CAACN,IAAI,CAAC,IAAI;AACvCI,IAAAA,GAAG,EAAEG,kBAAI;IACT,GAAGP,IAAAA;GACJ,CAAA;AAED,EAAA,MAAMQ,SAAS,GAAGC,oBAAY,CAACL,GAAG,EAAEH,YAAY,CAAC,CAAA;AAEjD,EAAA,oBACES,KAAA,CAAAC,aAAA,CAACC,sBAAY,EAAAC,MAAA,CAAAC,MAAA,CAAA,EAAA,EACPT,QAAQ,EAAA;AACZ,IAAA,aAAA,EAAaV,MAAO;AACpBS,IAAAA,GAAG,EAAEI,SAAU;AACfO,IAAAA,OAAO,EAAC,OAAO;AACfC,IAAAA,KAAK,EAAC,SAAS;AACfpB,IAAAA,OAAO,EAAEA,OAAQ;AACjBC,IAAAA,SAAS,EAAEA,SAAU;AACrBC,IAAAA,IAAI,EAAEA,IAAAA;AAAK,GAAA,CAAA,EAETC,QACU,CAAC,CAAA;AAEnB,CAAA;AAEA,kBAAekB,aAAAA,gBAAU,CAACvB,SAAS,CAAC;;;;"}
1
+ {"version":3,"file":"FormGroup.js","sources":["../../../../../src/components/Forms/FormGroup/FormGroup.tsx"],"sourcesContent":["import React, { forwardRef } from 'react'\n\nimport useMergeRefs from '~/src/hooks/useMergeRefs'\nimport { noop } from '~/src/utils/functionUtils'\n\nimport { useFormControlContext } from '~/src/components/Forms/FormControl'\n\nimport type FormGroupProps from './FormGroup.types'\n\nimport * as Styled from './FormGroup.styled'\n\nconst FORM_GROUP_TEST_ID = 'bezier-react-form-group'\n\nfunction FormGroup({\n testId = FORM_GROUP_TEST_ID,\n spacing = 6,\n direction = 'vertical',\n role = 'group',\n children,\n ...rest\n}: FormGroupProps,\nforwardedRef: React.Ref<HTMLDivElement>,\n) {\n const contextValue = useFormControlContext()\n\n const {\n ref,\n ...ownProps\n } = contextValue?.getGroupProps(rest) ?? {\n ref: noop,\n ...rest,\n }\n\n const mergedRef = useMergeRefs(ref, forwardedRef)\n\n return (\n <Styled.Stack\n {...ownProps}\n data-testid={testId}\n ref={mergedRef}\n justify=\"start\"\n align=\"stretch\"\n spacing={spacing}\n direction={direction}\n role={role}\n >\n { children }\n </Styled.Stack>\n )\n}\n\nexport default forwardRef(FormGroup)\n"],"names":["FORM_GROUP_TEST_ID","FormGroup","testId","spacing","direction","role","children","rest","forwardedRef","contextValue","useFormControlContext","ref","ownProps","getGroupProps","noop","mergedRef","useMergeRefs","React","createElement","Styled","Object","assign","justify","align","forwardRef"],"mappings":";;;;;;;;;;AAWA,MAAMA,kBAAkB,GAAG,yBAAyB,CAAA;AAEpD,SAASC,SAASA,CAAC;AACjBC,EAAAA,MAAM,GAAGF,kBAAkB;AAC3BG,EAAAA,OAAO,GAAG,CAAC;AACXC,EAAAA,SAAS,GAAG,UAAU;AACtBC,EAAAA,IAAI,GAAG,OAAO;EACdC,QAAQ;EACR,GAAGC,IAAAA;AACW,CAAC,EACjBC,YAAuC,EACrC;AACA,EAAA,MAAMC,YAAY,GAAGC,wCAAqB,EAAE,CAAA;EAE5C,MAAM;IACJC,GAAG;IACH,GAAGC,QAAAA;AACL,GAAC,GAAGH,YAAY,EAAEI,aAAa,CAACN,IAAI,CAAC,IAAI;AACvCI,IAAAA,GAAG,EAAEG,kBAAI;IACT,GAAGP,IAAAA;GACJ,CAAA;AAED,EAAA,MAAMQ,SAAS,GAAGC,oBAAY,CAACL,GAAG,EAAEH,YAAY,CAAC,CAAA;AAEjD,EAAA,oBACES,KAAA,CAAAC,aAAA,CAACC,sBAAY,EAAAC,MAAA,CAAAC,MAAA,CAAA,EAAA,EACPT,QAAQ,EAAA;AACZ,IAAA,aAAA,EAAaV,MAAO;AACpBS,IAAAA,GAAG,EAAEI,SAAU;AACfO,IAAAA,OAAO,EAAC,OAAO;AACfC,IAAAA,KAAK,EAAC,SAAS;AACfpB,IAAAA,OAAO,EAAEA,OAAQ;AACjBC,IAAAA,SAAS,EAAEA,SAAU;AACrBC,IAAAA,IAAI,EAAEA,IAAAA;AAAK,GAAA,CAAA,EAETC,QACU,CAAC,CAAA;AAEnB,CAAA;AAEA,kBAAekB,aAAAA,gBAAU,CAACvB,SAAS,CAAC;;;;"}
@@ -4,8 +4,8 @@ var React = require('react');
4
4
  var useMergeRefs = require('../../../hooks/useMergeRefs.js');
5
5
  var functionUtils = require('../../../utils/functionUtils.js');
6
6
  var typeUtils = require('../../../utils/typeUtils.js');
7
- var useFormControlContext = require('../useFormControlContext.js');
8
7
  var FormHelperText_styled = require('./FormHelperText.styled.js');
8
+ var FormControlContext = require('../FormControl/FormControlContext.js');
9
9
  var Typography = require('../../../foundation/Typography.js');
10
10
 
11
11
  const FORM_HELPER_TEXT_TEST_ID = 'bezier-react-form-helper-text';
@@ -17,7 +17,7 @@ const BaseHelperText = /*#__PURE__*/React.forwardRef(({
17
17
  children,
18
18
  ...rest
19
19
  }, forwardedRef) => {
20
- const contextValue = useFormControlContext.default();
20
+ const contextValue = FormControlContext.useFormControlContext();
21
21
  const getProps = type === 'info' ? contextValue?.getHelperTextProps : contextValue?.getErrorMessageProps;
22
22
  const {
23
23
  visible,
@@ -1 +1 @@
1
- {"version":3,"file":"FormHelperText.js","sources":["../../../../../src/components/Forms/FormHelperText/FormHelperText.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useMemo,\n} from 'react'\n\nimport { Typography } from '~/src/foundation'\n\nimport useMergeRefs from '~/src/hooks/useMergeRefs'\nimport { noop } from '~/src/utils/functionUtils'\nimport { isEmpty } from '~/src/utils/typeUtils'\n\nimport useFormControlContext from '~/src/components/Forms/useFormControlContext'\n\nimport type {\n BaseHelperTextProps,\n FormErrorMessageProps,\n FormHelperTextProps,\n} from './FormHelperText.types'\n\nimport * as Styled from './FormHelperText.styled'\n\ntype ForwardedRef = React.Ref<HTMLParamElement>\n\nexport const FORM_HELPER_TEXT_TEST_ID = 'bezier-react-form-helper-text'\nexport const FORM_ERROR_MESSAGE_TEST_ID = 'bezier-react-form-error-message'\n\nconst BaseHelperText = forwardRef(({\n as = 'p',\n type,\n typo = Typography.Size13,\n children,\n ...rest\n}: BaseHelperTextProps,\nforwardedRef: ForwardedRef,\n) => {\n const contextValue = useFormControlContext()\n const getProps = type === 'info'\n ? contextValue?.getHelperTextProps\n : contextValue?.getErrorMessageProps\n\n const {\n visible,\n ref,\n Wrapper,\n ...ownProps\n } = getProps?.(rest) ?? {\n visible: true,\n ref: noop,\n Wrapper: React.Fragment,\n ...rest,\n }\n\n const mergedRef = useMergeRefs(ref, forwardedRef)\n\n const shouldRendered = useMemo(() => (\n !isEmpty(children) && visible\n ), [\n visible,\n children,\n ])\n\n if (!shouldRendered) { return null }\n\n return (\n <Wrapper>\n <Styled.HelperText\n {...ownProps}\n ref={mergedRef}\n forwardedAs={as}\n typo={typo}\n >\n { children }\n </Styled.HelperText>\n </Wrapper>\n )\n})\n\nexport const FormHelperText = forwardRef(({\n testId = FORM_HELPER_TEXT_TEST_ID,\n color = 'txt-black-dark',\n children,\n ...rest\n}: FormHelperTextProps,\nforwardedRef: ForwardedRef,\n) => (\n <BaseHelperText\n {...rest}\n type=\"info\"\n ref={forwardedRef}\n testId={testId}\n color={color}\n >\n { children }\n </BaseHelperText>\n))\n\nexport const FormErrorMessage = forwardRef(({\n testId = FORM_ERROR_MESSAGE_TEST_ID,\n color = 'bgtxt-orange-normal',\n children,\n ...rest\n}: FormErrorMessageProps,\nforwardedRef: ForwardedRef,\n) => (\n <BaseHelperText\n {...rest}\n aria-live=\"polite\"\n type=\"error\"\n ref={forwardedRef}\n testId={testId}\n color={color}\n >\n { children }\n </BaseHelperText>\n))\n"],"names":["FORM_HELPER_TEXT_TEST_ID","FORM_ERROR_MESSAGE_TEST_ID","BaseHelperText","forwardRef","as","type","typo","Typography","Size13","children","rest","forwardedRef","contextValue","useFormControlContext","getProps","getHelperTextProps","getErrorMessageProps","visible","ref","Wrapper","ownProps","noop","React","Fragment","mergedRef","useMergeRefs","shouldRendered","useMemo","isEmpty","createElement","Styled","Object","assign","forwardedAs","FormHelperText","testId","color","FormErrorMessage"],"mappings":";;;;;;;;;;AAuBO,MAAMA,wBAAwB,GAAG,gCAA+B;AAChE,MAAMC,0BAA0B,GAAG,kCAAiC;AAE3E,MAAMC,cAAc,gBAAGC,gBAAU,CAAC,CAAC;AACjCC,EAAAA,EAAE,GAAG,GAAG;EACRC,IAAI;EACJC,IAAI,GAAGC,qBAAU,CAACC,MAAM;EACxBC,QAAQ;EACR,GAAGC,IAAAA;AACgB,CAAC,EACtBC,YAA0B,KACrB;AACH,EAAA,MAAMC,YAAY,GAAGC,6BAAqB,EAAE,CAAA;AAC5C,EAAA,MAAMC,QA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tB,IAAI,EAAA;AACRL,EAAAA,IAAI,EAAC,MAAM;AACXa,EAAAA,GAAG,EAAEP,YAAa;AAClBwB,EAAAA,MAAM,EAAEA,MAAO;AACfC,EAAAA,KAAK,EAAEA,KAAAA;AAAM,CAEX3B,CAAAA,EAAAA,QACY,CACjB,EAAC;AAEW4B,MAAAA,gBAAgB,gBAAGlC,gBAAU,CAAC,CAAC;AAC1CgC,EAAAA,MAAM,GAAGlC,0BAA0B;AACnCmC,EAAAA,KAAK,GAAG,qBAAqB;EAC7B3B,QAAQ;EACR,GAAGC,IAAAA;AACkB,CAAC,EACxBC,YAA0B,kBAExBW,KAAA,CAAAO,aAAA,CAAC3B,cAAc,EAAA6B,MAAA,CAAAC,MAAA,KACTtB,IAAI,EAAA;AACR,EAAA,WAAA,EAAU,QAAQ;AAClBL,EAAAA,IAAI,EAAC,OAAO;AACZa,EAAAA,GAAG,EAAEP,YAAa;AAClBwB,EAAAA,MAAM,EAAEA,MAAO;AACfC,EAAAA,KAAK,EAAEA,KAAAA;AAAM,CAEX3B,CAAAA,EAAAA,QACY,CACjB;;;;;;;"}
1
+ {"version":3,"file":"FormHelperText.js","sources":["../../../../../src/components/Forms/FormHelperText/FormHelperText.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useMemo,\n} from 'react'\n\nimport { Typography } from '~/src/foundation'\n\nimport useMergeRefs from '~/src/hooks/useMergeRefs'\nimport { noop } from '~/src/utils/functionUtils'\nimport { isEmpty } from '~/src/utils/typeUtils'\n\nimport { useFormControlContext } from '~/src/components/Forms/FormControl'\n\nimport type {\n BaseHelperTextProps,\n FormErrorMessageProps,\n FormHelperTextProps,\n} from './FormHelperText.types'\n\nimport * as Styled from './FormHelperText.styled'\n\ntype ForwardedRef = React.Ref<HTMLParamElement>\n\nexport const FORM_HELPER_TEXT_TEST_ID = 'bezier-react-form-helper-text'\nexport const FORM_ERROR_MESSAGE_TEST_ID = 'bezier-react-form-error-message'\n\nconst BaseHelperText = forwardRef(({\n as = 'p',\n type,\n typo = Typography.Size13,\n children,\n ...rest\n}: BaseHelperTextProps,\nforwardedRef: ForwardedRef,\n) => {\n const contextValue = useFormControlContext()\n const getProps = type === 'info'\n ? contextValue?.getHelperTextProps\n : contextValue?.getErrorMessageProps\n\n const {\n visible,\n ref,\n Wrapper,\n ...ownProps\n } = getProps?.(rest) ?? {\n visible: true,\n ref: noop,\n Wrapper: React.Fragment,\n ...rest,\n }\n\n const mergedRef = useMergeRefs(ref, forwardedRef)\n\n const shouldRendered = useMemo(() => (\n !isEmpty(children) && visible\n ), [\n visible,\n children,\n ])\n\n if (!shouldRendered) { return null }\n\n return (\n <Wrapper>\n <Styled.HelperText\n {...ownProps}\n ref={mergedRef}\n forwardedAs={as}\n typo={typo}\n >\n { children }\n </Styled.HelperText>\n </Wrapper>\n )\n})\n\nexport const FormHelperText = forwardRef(({\n testId = FORM_HELPER_TEXT_TEST_ID,\n color = 'txt-black-dark',\n children,\n ...rest\n}: FormHelperTextProps,\nforwardedRef: ForwardedRef,\n) => (\n <BaseHelperText\n {...rest}\n type=\"info\"\n ref={forwardedRef}\n testId={testId}\n color={color}\n >\n { children }\n </BaseHelperText>\n))\n\nexport const FormErrorMessage = forwardRef(({\n testId = FORM_ERROR_MESSAGE_TEST_ID,\n color = 'bgtxt-orange-normal',\n children,\n ...rest\n}: FormErrorMessageProps,\nforwardedRef: ForwardedRef,\n) => (\n <BaseHelperText\n {...rest}\n aria-live=\"polite\"\n type=\"error\"\n ref={forwardedRef}\n testId={testId}\n color={color}\n >\n { children }\n </BaseHelperText>\n))\n"],"names":["FORM_HELPER_TEXT_TEST_ID","FORM_ERROR_MESSAGE_TEST_ID","BaseHelperText","forwardRef","as","type","typo","Typography","Size13","children","rest","forwardedRef","contextValue","useFormControlContext","getProps","getHelperTextProps","getErrorMessageProps","visible","ref","Wrapper","ownProps","noop","React","Fragment","mergedRef","useMergeRefs","shouldRendered","useMemo","isEmpty","createElement","Styled","Object","assign","forwardedAs","FormHelperText","testId","color","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AE7B,EAAG;AAChBE,IAAAA,IAAI,EAAEA,IAAAA;GAEJG,CAAAA,EAAAA,QACe,CACZ,CAAC,CAAA;AAEd,CAAC,CAAC,CAAA;AAEWyB,MAAAA,cAAc,gBAAG/B,gBAAU,CAAC,CAAC;AACxCgC,EAAAA,MAAM,GAAGnC,wBAAwB;AACjCoC,EAAAA,KAAK,GAAG,gBAAgB;EACxB3B,QAAQ;EACR,GAAGC,IAAAA;AACgB,CAAC,EACtBC,YAA0B,kBAExBW,KAAA,CAAAO,aAAA,CAAC3B,cAAc,EAAA6B,MAAA,CAAAC,MAAA,KACTtB,IAAI,EAAA;AACRL,EAAAA,IAAI,EAAC,MAAM;AACXa,EAAAA,GAAG,EAAEP,YAAa;AAClBwB,EAAAA,MAAM,EAAEA,MAAO;AACfC,EAAAA,KAAK,EAAEA,KAAAA;AAAM,CAEX3B,CAAAA,EAAAA,QACY,CACjB,EAAC;AAEW4B,MAAAA,gBAAgB,gBAAGlC,gBAAU,CAAC,CAAC;AAC1CgC,EAAAA,MAAM,GAAGlC,0BAA0B;AACnCmC,EAAAA,KAAK,GAAG,qBAAqB;EAC7B3B,QAAQ;EACR,GAAGC,IAAAA;AACkB,CAAC,EACxBC,YAA0B,kBAExBW,KAAA,CAAAO,aAAA,CAAC3B,cAAc,EAAA6B,MAAA,CAAAC,MAAA,KACTtB,IAAI,EAAA;AACR,EAAA,WAAA,EAAU,QAAQ;AAClBL,EAAAA,IAAI,EAAC,OAAO;AACZa,EAAAA,GAAG,EAAEP,YAAa;AAClBwB,EAAAA,MAAM,EAAEA,MAAO;AACfC,EAAAA,KAAK,EAAEA,KAAAA;AAAM,CAEX3B,CAAAA,EAAAA,QACY,CACjB;;;;;;;"}
@@ -4,9 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
6
  var typeUtils = require('../../../utils/typeUtils.js');
7
- var useFormControlContext = require('../useFormControlContext.js');
8
7
  var Help = require('../../Help/Help.js');
9
8
  var FormLabel_styled = require('./FormLabel.styled.js');
9
+ var FormControlContext = require('../FormControl/FormControlContext.js');
10
10
  var Typography = require('../../../foundation/Typography.js');
11
11
  var HStack = require('../../Stack/HStack/HStack.js');
12
12
  var StackItem = require('../../Stack/StackItem/StackItem.js');
@@ -21,7 +21,7 @@ function FormLabel({
21
21
  children,
22
22
  ...rest
23
23
  }, forwardedRef) {
24
- const contextValue = useFormControlContext.default();
24
+ const contextValue = FormControlContext.useFormControlContext();
25
25
  const {
26
26
  Wrapper,
27
27
  typo,
@@ -1 +1 @@
1
- {"version":3,"file":"FormLabel.js","sources":["../../../../../src/components/Forms/FormLabel/FormLabel.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useMemo,\n} from 'react'\n\nimport { Typography } from '~/src/foundation'\n\nimport { isEmpty } from '~/src/utils/typeUtils'\n\nimport useFormControlContext from '~/src/components/Forms/useFormControlContext'\nimport { Help } from '~/src/components/Help'\nimport { HELP_DISPLAY_NAME } from '~/src/components/Help/Help'\nimport {\n HStack,\n StackItem,\n} from '~/src/components/Stack'\n\nimport type FormLabelProps from './FormLabel.types'\n\nimport * as Styled from './FormLabel.styled'\n\nexport const FORM_LABEL_TEST_ID = 'bezier-react-form-label'\n\nfunction FormLabel({\n testId = FORM_LABEL_TEST_ID,\n help,\n as = 'label',\n bold = true,\n color = 'txt-black-darkest',\n children,\n ...rest\n}: FormLabelProps,\nforwardedRef: React.Ref<HTMLLabelElement>,\n) {\n const contextValue = useFormControlContext()\n\n const { Wrapper, typo, ...ownProps } = contextValue?.getLabelProps(rest) ?? {\n Wrapper: React.Fragment,\n typo: Typography.Size13,\n ...rest,\n }\n\n const LabelComponent = useMemo(() => (\n <Styled.Label\n {...ownProps}\n ref={forwardedRef}\n testId={testId}\n forwardedAs={as}\n bold={bold}\n typo={typo}\n color={color}\n >\n { children }\n </Styled.Label>\n ), [\n as,\n typo,\n bold,\n color,\n testId,\n children,\n forwardedRef,\n ownProps,\n ])\n\n const HelpComponent = useMemo(() => {\n if (isEmpty(help)) { return null }\n\n if (React.isValidElement(help)) {\n // FIXME(@bora): string, JSXElementCostructor 타입에 displayName 속성이 존재하지 않음, 임시로 any 타입으로 설정\n const { displayName } = help?.type as any\n if (displayName === HELP_DISPLAY_NAME) {\n return help\n }\n }\n\n return (\n <Help>\n { help }\n </Help>\n )\n }, [help])\n\n if (isEmpty(children)) { return null }\n\n return (\n <Wrapper>\n { !HelpComponent\n ? LabelComponent\n : (\n <HStack align=\"center\" spacing={6}>\n <StackItem shrink weight={1}>\n { LabelComponent }\n </StackItem>\n <StackItem>\n { HelpComponent }\n </StackItem>\n </HStack>\n ) }\n </Wrapper>\n )\n}\n\nexport default forwardRef(FormLabel)\n"],"names":["FORM_LABEL_TEST_ID","FormLabel","testId","help","as","bold","color","children","rest","forwardedRef","contextValue","useFormControlContext","Wrapper","typo","ownProps","getLabelProps","React","Fragment","Typography","Size13","LabelComponent","useMemo","createElement","Styled","Object","assign","ref","forwardedAs","HelpComponent","isEmpty","isValidElement","displayName","type","HELP_DISPLAY_NAME","Help","HStack","align","spacing","StackItem","shrink","weight","forwardRef"],"mappings":";;;;;;;;;;;;;AAqBO,MAAMA,kBAAkB,GAAG,0BAAyB;AAE3D,SAASC,SAASA,CAAC;AACjBC,EAAAA,MAAM,GAAGF,kBAAkB;EAC3BG,IAAI;AACJC,EAAAA,EAAE,GAAG,OAAO;AACZC,EAAAA,IAAI,GAAG,IAAI;AACXC,EAAAA,KAAK,GAAG,mBAAmB;EAC3BC,QAAQ;EACR,GAAGC,IAAAA;AACW,CAAC,EACjBC,YAAyC,EACvC;AACA,EAAA,MAAMC,YAAY,GAAGC,6BAAqB,EAAE,CAAA;EAE5C,MAAM;IAAEC,OAAO;IAAEC,IAAI;IAAE,GAAGC,QAAAA;AAAS,GAAC,GAAGJ,YAAY,EAAEK,aAAa,CAACP,IAAI,CAAC,IAAI;IAC1EI,OAAO,EAAEI,KAAK,CAACC,QAAQ;IACvBJ,IAAI,EAAEK,qBAAU,C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ACZR,cAAc,gBAEdJ,KAAA,CAAAM,aAAA,CAACa,aAAM,EAAA;AAACC,IAAAA,KAAK,EAAC,QAAQ;AAACC,IAAAA,OAAO,EAAE,CAAA;AAAE,GAAA,eAChCrB,KAAA,CAAAM,aAAA,CAACgB,mBAAS,EAAA;IAACC,MAAM,EAAA,IAAA;AAACC,IAAAA,MAAM,EAAE,CAAA;AAAE,GAAA,EACxBpB,cACO,CAAC,eACZJ,KAAA,CAAAM,aAAA,CAACgB,mBAAS,EACNV,IAAAA,EAAAA,aACO,CACL,CAEL,CAAC,CAAA;AAEd,CAAA;AAEA,kBAAea,aAAAA,gBAAU,CAACxC,SAAS,CAAC;;;;;"}
1
+ {"version":3,"file":"FormLabel.js","sources":["../../../../../src/components/Forms/FormLabel/FormLabel.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useMemo,\n} from 'react'\n\nimport { Typography } from '~/src/foundation'\n\nimport { isEmpty } from '~/src/utils/typeUtils'\n\nimport { useFormControlContext } from '~/src/components/Forms/FormControl'\nimport { Help } from '~/src/components/Help'\nimport { HELP_DISPLAY_NAME } from '~/src/components/Help/Help'\nimport {\n HStack,\n StackItem,\n} from '~/src/components/Stack'\n\nimport type FormLabelProps from './FormLabel.types'\n\nimport * as Styled from './FormLabel.styled'\n\nexport const FORM_LABEL_TEST_ID = 'bezier-react-form-label'\n\nfunction FormLabel({\n testId = FORM_LABEL_TEST_ID,\n help,\n as = 'label',\n bold = true,\n color = 'txt-black-darkest',\n children,\n ...rest\n}: FormLabelProps,\nforwardedRef: React.Ref<HTMLLabelElement>,\n) {\n const contextValue = useFormControlContext()\n\n const { Wrapper, typo, ...ownProps } = contextValue?.getLabelProps(rest) ?? {\n Wrapper: React.Fragment,\n typo: Typography.Size13,\n ...rest,\n }\n\n const LabelComponent = useMemo(() => (\n <Styled.Label\n {...ownProps}\n ref={forwardedRef}\n testId={testId}\n forwardedAs={as}\n bold={bold}\n typo={typo}\n color={color}\n >\n { children }\n </Styled.Label>\n ), [\n as,\n typo,\n bold,\n color,\n testId,\n children,\n forwardedRef,\n ownProps,\n ])\n\n const HelpComponent = useMemo(() => {\n if (isEmpty(help)) { return null }\n\n if (React.isValidElement(help)) {\n // FIXME(@bora): string, JSXElementCostructor 타입에 displayName 속성이 존재하지 않음, 임시로 any 타입으로 설정\n const { displayName } = help?.type as any\n if (displayName === HELP_DISPLAY_NAME) {\n return help\n }\n }\n\n return (\n <Help>\n { help }\n </Help>\n )\n }, [help])\n\n if (isEmpty(children)) { return null }\n\n return (\n <Wrapper>\n { !HelpComponent\n ? LabelComponent\n : (\n <HStack align=\"center\" spacing={6}>\n <StackItem shrink weight={1}>\n { LabelComponent }\n </StackItem>\n <StackItem>\n { HelpComponent }\n </StackItem>\n </HStack>\n ) }\n </Wrapper>\n )\n}\n\nexport default forwardRef(FormLabel)\n"],"names":["FORM_LABEL_TEST_ID","FormLabel","testId","help","as","bold","color","children","rest","forwardedRef","contextValue","useFormControlContext","Wrapper","typo","ownProps","getLabelProps","React","Fragment","Typography","Size13","LabelComponent","useMemo","createElement","Styled","Object","assign","ref","forwardedAs","HelpComponent","isEmpty","isValidElement","displayName","type","HELP_DISPLAY_NAME","Help","HStack","align","spacing","StackItem","shrink","weight","forwardRef"],"mappings":";;;;;;;;;;;;;AAqBO,MAAMA,kBAAkB,GAAG,0BAAyB;AAE3D,SAASC,SAASA,CAAC;AACjBC,EAAAA,MAAM,GAAGF,kBAAkB;EAC3BG,IAAI;AACJC,EAAAA,EAAE,GAAG,OAAO;AACZC,EAAAA,IAAI,GAAG,IAAI;AACXC,EAAAA,KAAK,GAAG,mBAAmB;EAC3BC,QAAQ;EACR,GAAGC,IAAAA;AACW,CAAC,EACjBC,YAAyC,EACvC;AACA,EAAA,MAAMC,YAAY,GAAGC,wCAAqB,EAAE,CAAA;EAE5C,MAAM;IAAEC,OAAO;IAAEC,IAAI;IAAE,GAAGC,QAAAA;AAAS,GAAC,GAAGJ,YAAY,EAAEK,aAAa,CAACP,IAAI,CAAC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C,EAAA,oBACES,KAAA,CAAAM,aAAA,CAACV,OAAO,EACJ,IAAA,EAAA,CAACgB,aAAa,GACZR,cAAc,gBAEdJ,KAAA,CAAAM,aAAA,CAACa,aAAM,EAAA;AAACC,IAAAA,KAAK,EAAC,QAAQ;AAACC,IAAAA,OAAO,EAAE,CAAA;AAAE,GAAA,eAChCrB,KAAA,CAAAM,aAAA,CAACgB,mBAAS,EAAA;IAACC,MAAM,EAAA,IAAA;AAACC,IAAAA,MAAM,EAAE,CAAA;AAAE,GAAA,EACxBpB,cACO,CAAC,eACZJ,KAAA,CAAAM,aAAA,CAACgB,mBAAS,EACNV,IAAAA,EAAAA,aACO,CACL,CAEL,CAAC,CAAA;AAEd,CAAA;AAEA,kBAAea,aAAAA,gBAAU,CAACxC,SAAS,CAAC;;;;;"}
@@ -1,21 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var React = require('react');
3
+ var reactUtils = require('../../../utils/reactUtils.js');
4
4
 
5
- // TODO: (@ed) Evolve it into a commonly reusable function
6
- function createContext(providerName, defaultValue) {
7
- const Context = /*#__PURE__*/React.createContext(defaultValue);
8
- function useContext(consumerName) {
9
- const contextValue = React.useContext(Context);
10
- if (!contextValue) {
11
- throw new Error(`'${consumerName}' must be used within '${providerName}'`);
12
- }
13
- return contextValue;
14
- }
15
- return [Context.Provider, useContext];
16
- }
17
- const [SegmentedControlContextProvider, useSegmentedControlContext] = createContext('SegmentedControl', null);
18
- const [SegmentedControlItemListContextProvider, useSegmentedControlItemListContext] = createContext('SegmentedControlItemList', null);
5
+ const [SegmentedControlContextProvider, useSegmentedControlContext] = reactUtils.createContext(null, 'SegmentedControl');
6
+ const [SegmentedControlItemListContextProvider, useSegmentedControlItemListContext] = reactUtils.createContext(null, 'SegmentedControlItemList');
19
7
 
20
8
  exports.SegmentedControlContextProvider = SegmentedControlContextProvider;
21
9
  exports.SegmentedControlItemListContextProvider = SegmentedControlItemListContextProvider;
@@ -1 +1 @@
1
- {"version":3,"file":"SegmentedControlContext.js","sources":["../../../../../src/components/Forms/SegmentedControl/SegmentedControlContext.ts"],"sourcesContent":["import React from 'react'\n\nimport {\n type SegmentedControlProps,\n type SegmentedControlType,\n} from './SegmentedControl.types'\n\n// TODO: (@ed) Evolve it into a commonly reusable function\nfunction createContext<ContextValue>(\n providerName: string,\n defaultValue: ContextValue,\n) {\n const Context = React.createContext<ContextValue>(defaultValue)\n\n function useContext(consumerName: string) {\n const contextValue = React.useContext(Context)\n\n if (!contextValue) {\n throw new Error(`'${consumerName}' must be used within '${providerName}'`)\n }\n\n return contextValue\n }\n\n return [\n Context.Provider,\n useContext,\n ] as const\n}\n\ntype SegmentedControlContextValue = Required<Pick<SegmentedControlProps<SegmentedControlType, string>, 'type' | 'size' | 'width'>>\n\nexport const [\n SegmentedControlContextProvider,\n useSegmentedControlContext,\n] = createContext<SegmentedControlContextValue | null>('SegmentedControl', null)\n\ninterface SegmentedControlItemListContextValue {\n setSelectedElement: (node: HTMLButtonElement | null) => void\n}\n\nexport const [\n SegmentedControlItemListContextProvider,\n useSegmentedControlItemListContext,\n] = createContext<SegmentedControlItemListContextValue | null>('SegmentedControlItemList', null)\n"],"names":["createContext","providerName","defaultValue","Context","React","useContext","consumerName","contextValue","Error","Provider","SegmentedControlContextProvider","useSegmentedControlContext","SegmentedControlItemListContextProvider","useSegmentedControlItemListContext"],"mappings":";;;;AAOA;AACA,SAASA,aAAaA,CACpBC,YAAoB,EACpBC,YAA0B,EAC1B;AACA,EAAA,MAAMC,OAAO,gBAAGC,KAAK,CAACJ,aAAa,CAAeE,YAAY,CAAC,CAAA;EAE/D,SAASG,UAAUA,CAACC,YAAoB,EAAE;AACxC,IAAA,MAAMC,YAAY,GAAGH,KAAK,CAACC,UAAU,CAACF,OAAO,CAAC,CAAA;IAE9C,IAAI,CAACI,YAAY,EAAE;MACjB,MAAM,IAAIC,KAAK,CAAE,CAAA,CAAA,EAAGF,YAAa,CAAyBL,uBAAAA,EAAAA,YAAa,GAAE,CAAC,CAAA;AAC5E,KAAA;AAEA,IAAA,OAAOM,YAAY,CAAA;AACrB,GAAA;AAEA,EAAA,OAAO,CACLJ,OAAO,CAACM,QAAQ,EAChBJ,UAAU,CACX,CAAA;AACH,CAAA;AAIa,MAAA,CACXK,+BAA+B,EAC/BC,0BAA0B,CAC3B,GAAGX,aAAa,CAAsC,kBAAkB,EAAE,IAAI,EAAC;AAMnE,MAAA,CACXY,uCAAuC,EACvCC,kCAAkC,CACnC,GAAGb,aAAa,CAA8C,0BAA0B,EAAE,IAAI;;;;;;;"}
1
+ {"version":3,"file":"SegmentedControlContext.js","sources":["../../../../../src/components/Forms/SegmentedControl/SegmentedControlContext.ts"],"sourcesContent":["import { createContext } from '~/src/utils/reactUtils'\n\nimport {\n type SegmentedControlProps,\n type SegmentedControlType,\n} from './SegmentedControl.types'\n\ntype SegmentedControlContextValue = Required<Pick<SegmentedControlProps<SegmentedControlType, string>, 'type' | 'size' | 'width'>>\n\nexport const [\n SegmentedControlContextProvider,\n useSegmentedControlContext,\n] = createContext<SegmentedControlContextValue | null>(null, 'SegmentedControl')\n\ninterface SegmentedControlItemListContextValue {\n setSelectedElement: (node: HTMLButtonElement | null) => void\n}\n\nexport const [\n SegmentedControlItemListContextProvider,\n useSegmentedControlItemListContext,\n] = createContext<SegmentedControlItemListContextValue | null>(null, 'SegmentedControlItemList')\n"],"names":["SegmentedControlContextProvider","useSegmentedControlContext","createContext","SegmentedControlItemListContextProvider","useSegmentedControlItemListContext"],"mappings":";;;;AASa,MAAA,CACXA,+BAA+B,EAC/BC,0BAA0B,CAC3B,GAAGC,wBAAa,CAAsC,IAAI,EAAE,kBAAkB,EAAC;AAMnE,MAAA,CACXC,uCAAuC,EACvCC,kCAAkC,CACnC,GAAGF,wBAAa,CAA8C,IAAI,EAAE,0BAA0B;;;;;;;"}
@@ -4,11 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
6
  var domUtils = require('../../utils/domUtils.js');
7
- var useFormControlContext = require('./useFormControlContext.js');
7
+ var FormControlContext = require('./FormControl/FormControlContext.js');
8
8
 
9
9
  // TODO: 테스트 추가
10
10
  function useFormFieldProps(props) {
11
- const contextValue = useFormControlContext.default();
11
+ const contextValue = FormControlContext.useFormControlContext();
12
12
  const formFieldProps = React.useMemo(() => {
13
13
  const mergedProps = contextValue?.getFieldProps(props) ?? {
14
14
  ...props
@@ -1 +1 @@
1
- {"version":3,"file":"useFormFieldProps.js","sources":["../../../../src/components/Forms/useFormFieldProps.ts"],"sourcesContent":["import { useMemo } from 'react'\n\nimport { ariaAttr } from '~/src/utils/domUtils'\n\nimport type { FormComponentProps } from '~/src/components/Forms/Form.types'\n\nimport useFormControlContext from './useFormControlContext'\n\n// TODO: 테스트 추가\nfunction useFormFieldProps<Props extends FormComponentProps>(props?: Props) {\n const contextValue = useFormControlContext()\n\n const formFieldProps = useMemo(() => {\n const mergedProps = contextValue?.getFieldProps(props) ?? { ...props }\n\n const {\n disabled = false,\n readOnly = false,\n required = false,\n hasError = false,\n ...rest\n } = mergedProps\n\n return {\n ...rest,\n 'aria-disabled': ariaAttr(disabled),\n 'aria-invalid': ariaAttr(hasError),\n 'aria-required': ariaAttr(required),\n 'aria-readonly': ariaAttr(readOnly),\n disabled,\n hasError,\n required,\n readOnly,\n }\n }, [\n props,\n contextValue,\n ])\n\n return formFieldProps as typeof formFieldProps & Props\n}\n\nexport default useFormFieldProps\n"],"names":["useFormFieldProps","props","contextValue","useFormControlContext","formFieldProps","useMemo","mergedProps","getFieldProps","disabled","readOnly","required","hasError","rest","ariaAttr"],"mappings":";;;;;;;;AAQA;AACA,SAASA,iBAAiBA,CAAmCC,KAAa,EAAE;AAC1E,EAAA,MAAMC,YAAY,GAAGC,6BAAqB,EAAE,CAAA;AAE5C,EAAA,MAAMC,cAAc,GAAGC,aAAO,CAAC,MAAM;IACnC,MAAMC,WAAW,GAAGJ,YAAY,EAAEK,aAAa,CAACN,KAAK,CAAC,IAAI;MAAE,GAAGA,KAAAA;KAAO,CAAA;IAEtE,MAAM;AACJO,MAAAA,QAAQ,GAAG,KAAK;AAChBC,MAAAA,QAAQ,GAAG,KAAK;AAChBC,MAAAA,QAAQ,GAAG,KAAK;AAChBC,MAAAA,QAAQ,GAAG,KAAK;MAChB,GAAGC,IAAAA;AACL,KAAC,GAAGN,WAAW,CAAA;IAEf,OAAO;AACL,MAAA,GAAGM,IAAI;AACP,MAAA,eAAe,EAAEC,iBAAQ,CAACL,QAAQ,CAAC;AACnC,MAAA,cAAc,EAAEK,iBAAQ,CAACF,QAAQ,CAAC;AAClC,MAAA,eAAe,EAAEE,iBAAQ,CAACH,QAAQ,CAAC;AACnC,MAAA,eAAe,EAAEG,iBAAQ,CAACJ,QAAQ,CAAC;MACnCD,QAAQ;MACRG,QAAQ;MACRD,QAAQ;AACRD,MAAAA,QAAAA;KACD,CAAA;AACH,GAAC,EAAE,CACDR,KAAK,EACLC,YAAY,CACb,CAAC,CAAA;AAEF,EAAA,OAAOE,cAAc,CAAA;AACvB;;;;"}
1
+ {"version":3,"file":"useFormFieldProps.js","sources":["../../../../src/components/Forms/useFormFieldProps.ts"],"sourcesContent":["import { useMemo } from 'react'\n\nimport { ariaAttr } from '~/src/utils/domUtils'\n\nimport type { FormComponentProps } from '~/src/components/Forms/Form.types'\nimport { useFormControlContext } from '~/src/components/Forms/FormControl'\n\n// TODO: 테스트 추가\nfunction useFormFieldProps<Props extends FormComponentProps>(props?: Props) {\n const contextValue = useFormControlContext()\n\n const formFieldProps = useMemo(() => {\n const mergedProps = contextValue?.getFieldProps(props) ?? { ...props }\n\n const {\n disabled = false,\n readOnly = false,\n required = false,\n hasError = false,\n ...rest\n } = mergedProps\n\n return {\n ...rest,\n 'aria-disabled': ariaAttr(disabled),\n 'aria-invalid': ariaAttr(hasError),\n 'aria-required': ariaAttr(required),\n 'aria-readonly': ariaAttr(readOnly),\n disabled,\n hasError,\n required,\n readOnly,\n }\n }, [\n props,\n contextValue,\n ])\n\n return formFieldProps as typeof formFieldProps & Props\n}\n\nexport default useFormFieldProps\n"],"names":["useFormFieldProps","props","contextValue","useFormControlContext","formFieldProps","useMemo","mergedProps","getFieldProps","disabled","readOnly","required","hasError","rest","ariaAttr"],"mappings":";;;;;;;;AAOA;AACA,SAASA,iBAAiBA,CAAmCC,KAAa,EAAE;AAC1E,EAAA,MAAMC,YAAY,GAAGC,wCAAqB,EAAE,CAAA;AAE5C,EAAA,MAAMC,cAAc,GAAGC,aAAO,CAAC,MAAM;IACnC,MAAMC,WAAW,GAAGJ,YAAY,EAAEK,aAAa,CAACN,KAAK,CAAC,IAAI;MAAE,GAAGA,KAAAA;KAAO,CAAA;IAEtE,MAAM;AACJO,MAAAA,QAAQ,GAAG,KAAK;AAChBC,MAAAA,QAAQ,GAAG,KAAK;AAChBC,MAAAA,QAAQ,GAAG,KAAK;AAChBC,MAAAA,QAAQ,GAAG,KAAK;MAChB,GAAGC,IAAAA;AACL,KAAC,GAAGN,WAAW,CAAA;IAEf,OAAO;AACL,MAAA,GAAGM,IAAI;AACP,MAAA,eAAe,EAAEC,iBAAQ,CAACL,QAAQ,CAAC;AACnC,MAAA,cAAc,EAAEK,iBAAQ,CAACF,QAAQ,CAAC;AAClC,MAAA,eAAe,EAAEE,iBAAQ,CAACH,QAAQ,CAAC;AACnC,MAAA,eAAe,EAAEG,iBAAQ,CAACJ,QAAQ,CAAC;MACnCD,QAAQ;MACRG,QAAQ;MACRD,QAAQ;AACRD,MAAAA,QAAAA;KACD,CAAA;AACH,GAAC,EAAE,CACDR,KAAK,EACLC,YAAY,CACb,CAAC,CAAA;AAEF,EAAA,OAAOE,cAAc,CAAA;AACvB;;;;"}
@@ -4,10 +4,10 @@ var DisabledOpacity = require('../../constants/DisabledOpacity.js');
4
4
  var ListItem_types = require('./ListItem.types.js');
5
5
  var utils = require('./utils.js');
6
6
  var Icon = require('../Icon/Icon.js');
7
+ var index = require('../../foundation/Transition/index.js');
7
8
  var FoundationStyledComponent = require('../../foundation/FoundationStyledComponent.js');
8
9
  var Mixins = require('../../foundation/Mixins.js');
9
10
  var Typography = require('../../foundation/Typography.js');
10
- var index = require('../../foundation/Transition/index.js');
11
11
 
12
12
  const getColorFromColorVariantWithDefaultValue = (variant, defaultValue) => {
13
13
  switch (variant) {
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.js","sources":["../../../../../src/components/Modals/Modal/Modal.tsx"],"sourcesContent":["import React, { useCallback } from 'react'\n\nimport * as DialogPrimitive from '@radix-ui/react-dialog'\n\nimport { noop } from '~/src/utils/functionUtils'\n\nimport { type ModalProps } from './Modal.types'\n\n/**\n * `Modal` is a dialog that appears on top of the page.\n *\n * `Modal` is a context of the Modal-related components. It doesn't render any DOM node.\n * It controls the visibility of the entire component and provides\n * handlers and accessibility properties to Modal-related components.\n *\n * @example\n *\n * ```tsx\n * // Anatomy of the Modal\n * <Modal>\n * <ModalTrigger />\n * <ModalContent>\n * <ModalHeader />\n * <ModalBody />\n * <ModalFooter />\n * </ModalContent>\n * </Modal>\n * ```\n */\nexport function Modal({\n children,\n show,\n defaultShow,\n onShow = noop,\n onHide = noop,\n}: ModalProps) {\n const onOpenChange = useCallback<NonNullable<DialogPrimitive.DialogProps['onOpenChange']>>((open) => {\n const callback = open ? onShow : onHide\n callback()\n }, [\n onShow,\n onHide,\n ])\n\n return (\n <DialogPrimitive.Root\n open={show}\n defaultOpen={defaultShow}\n onOpenChange={onOpenChange}\n >\n { children }\n </DialogPrimitive.Root>\n )\n}\n\n"],"names":["Modal","children","show","defaultShow","onShow","noop","onHide","onOpenChange","useCallback","open","callback","React","createElement","DialogPrimitive","defaultOpen"],"mappings":";;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,KAAKA,CAAC;EACpBC,QAAQ;EACRC,IAAI;EACJC,WAAW;AACXC,EAAAA,MAAM,GAAGC,kBAAI;AACbC,EAAAA,MAAM,GAAGD,kBAAAA;AACC,CAAC,EAAE;AACb,EAAA,MAAME,YAAY,GAAGC,iBAAW,CAA4DC,IAAI,IAAK;AACnG,IAAA,MAAMC,QAAQ,GAAGD,IAAI,GAAGL,MAAM,GAAGE,MAAM,CAAA;AACvCI,IAAAA,QAAQ,EAAE,CAAA;AACZ,GAAC,EAAE,CACDN,MAAM,EACNE,MAAM,CACP,CAAC,CAAA;AAEF,EAAA,oBACEK,KAAA,CAAAC,aAAA,CAACC,UAAoB,EAAA;AACnBJ,IAAAA,IAAI,EAAEP,IAAK;AACXY,IAAAA,WAAW,EAAEX,WAAY;AACzBI,IAAAA,YAAY,EAAEA,YAAAA;AAAa,GAAA,EAEzBN,QACkB,CAAC,CAAA;AAE3B;;;;"}
1
+ {"version":3,"file":"Modal.js","sources":["../../../../../src/components/Modals/Modal/Modal.tsx"],"sourcesContent":["import React, { useCallback } from 'react'\n\nimport * as DialogPrimitive from '@radix-ui/react-dialog'\n\nimport { noop } from '~/src/utils/functionUtils'\n\nimport { type ModalProps } from './Modal.types'\n\n/**\n * `Modal` is a dialog that appears on top of the page.\n *\n * `Modal` is a context of the Modal-related components. It doesn't render any DOM node.\n * It controls the visibility of the entire component and provides\n * handlers and accessibility properties to Modal-related components.\n *\n * @example\n *\n * ```tsx\n * // Anatomy of the Modal\n * <Modal>\n * <ModalTrigger />\n * <ModalContent>\n * <ModalHeader />\n * <ModalBody />\n * <ModalFooter />\n * </ModalContent>\n * </Modal>\n * ```\n */\nexport function Modal({\n children,\n show,\n defaultShow,\n onShow = noop,\n onHide = noop,\n}: ModalProps) {\n const onOpenChange = useCallback<NonNullable<DialogPrimitive.DialogProps['onOpenChange']>>((open) => {\n const callback = open ? onShow : onHide\n callback()\n }, [\n onShow,\n onHide,\n ])\n\n return (\n <DialogPrimitive.Root\n open={show}\n defaultOpen={defaultShow}\n onOpenChange={onOpenChange}\n >\n { children }\n </DialogPrimitive.Root>\n )\n}\n"],"names":["Modal","children","show","defaultShow","onShow","noop","onHide","onOpenChange","useCallback","open","callback","React","createElement","DialogPrimitive","defaultOpen"],"mappings":";;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,KAAKA,CAAC;EACpBC,QAAQ;EACRC,IAAI;EACJC,WAAW;AACXC,EAAAA,MAAM,GAAGC,kBAAI;AACbC,EAAAA,MAAM,GAAGD,kBAAAA;AACC,CAAC,EAAE;AACb,EAAA,MAAME,YAAY,GAAGC,iBAAW,CAA4DC,IAAI,IAAK;AACnG,IAAA,MAAMC,QAAQ,GAAGD,IAAI,GAAGL,MAAM,GAAGE,MAAM,CAAA;AACvCI,IAAAA,QAAQ,EAAE,CAAA;AACZ,GAAC,EAAE,CACDN,MAAM,EACNE,MAAM,CACP,CAAC,CAAA;AAEF,EAAA,oBACEK,KAAA,CAAAC,aAAA,CAACC,UAAoB,EAAA;AACnBJ,IAAAA,IAAI,EAAEP,IAAK;AACXY,IAAAA,WAAW,EAAEX,WAAY;AACzBI,IAAAA,YAAY,EAAEA,YAAAA;AAAa,GAAA,EAEzBN,QACkB,CAAC,CAAA;AAE3B;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.types.js","sources":["../../../../../src/components/Modals/Modal/Modal.types.ts"],"sourcesContent":["import {\n type BezierComponentProps,\n type ChildrenProps,\n type SideContentProps,\n} from '~/src/types/ComponentProps'\n\nexport enum ModalTitleSize {\n L = 'L',\n M = 'M',\n}\n\ninterface ModalOptions {\n /**\n * The controlled open state of the modal.\n * Must be used in conjunction with `onShow` and `onHide`.\n */\n show?: boolean\n\n /**\n * The open state of the modal when it is initially rendered.\n * Use when you **do not need to control** its open state.\n */\n defaultShow?: boolean\n\n /**\n * Callback function to be called when the modal is opened.\n * @default noop\n */\n onShow?: () => void\n\n /**\n * Callback function to be called when the modal is closed.\n * @default noop\n */\n onHide?: () => void\n}\n\ninterface ModalContentOptions {\n /**\n * Specify a container element to portal the content into.\n * @default document.body\n */\n container?: HTMLElement | null\n\n /**\n * Show close icon button that closes the modal when clicked.\n * @default false\n */\n showCloseIcon?: boolean\n\n /**\n * Width of the modal.\n * @default 'max-content'\n */\n width?: React.CSSProperties['width']\n\n /**\n * Height of the modal.\n * @default 'fit-content'\n */\n height?: React.CSSProperties['height']\n\n /**\n * z-index of the modal content.\n * Rather than using this option, Please check modal is positioned in the proper stacking context.\n * @default ZIndex.Modal\n */\n zIndex?: React.CSSProperties['zIndex']\n}\n\ninterface ModalHeaderOptions {\n /**\n * An accessible title to be announced when the modal is opened.\n */\n title: React.ReactNode\n\n /**\n * An accessible subtitle to be announced when the modal is opened.\n */\n subtitle?: React.ReactNode\n\n /**\n * An accessible description to be announced when the modal is opened.\n */\n description?: React.ReactNode\n\n /**\n * Size of the title\n * @default ModalTitleSize.L\n */\n titleSize?: ModalTitleSize\n\n /**\n * Hides content from the screen in an accessible way.\n * @default false\n */\n hidden?: boolean\n}\n\ntype ModalFooterSideContent = React.ReactNode\n\ninterface ModalFooterOptions extends\n SideContentProps<ModalFooterSideContent, ModalFooterSideContent> {}\n\nexport interface ModalProps extends\n ChildrenProps,\n ModalOptions {}\n\nexport interface ModalContentProps extends\n BezierComponentProps,\n ChildrenProps,\n React.HTMLAttributes<HTMLDivElement>,\n ModalContentOptions {}\n\nexport interface ModalHeaderProps extends\n BezierComponentProps,\n Omit<React.HTMLAttributes<HTMLElement>, keyof ModalHeaderOptions>,\n ModalHeaderOptions {}\n\nexport interface ModalBodyProps extends\n BezierComponentProps,\n ChildrenProps,\n React.HTMLAttributes<HTMLDivElement> {}\n\nexport interface ModalFooterProps extends\n BezierComponentProps,\n React.HTMLAttributes<HTMLElement>,\n ModalFooterOptions {}\n\nexport interface ModalTriggerProps extends\n ChildrenProps<React.ReactElement> {}\n\nexport interface ModalCloseProps extends\n ChildrenProps<React.ReactElement> {}\n\nexport interface ModalContentContextValue extends\n NonNullable<Pick<ModalContentOptions, 'showCloseIcon'>> {}\n"],"names":["ModalTitleSize"],"mappings":";;AAMYA,IAAAA,cAAc,0BAAdA,cAAc,EAAA;EAAdA,cAAc,CAAA,GAAA,CAAA,GAAA,GAAA,CAAA;EAAdA,cAAc,CAAA,GAAA,CAAA,GAAA,GAAA,CAAA;AAAA,EAAA,OAAdA,cAAc,CAAA;AAAA,CAAA,CAAA,EAAA;;;;"}
1
+ {"version":3,"file":"Modal.types.js","sources":["../../../../../src/components/Modals/Modal/Modal.types.ts"],"sourcesContent":["import {\n type BezierComponentProps,\n type ChildrenProps,\n type SideContentProps,\n} from '~/src/types/ComponentProps'\n\nexport enum ModalTitleSize {\n L = 'L',\n M = 'M',\n}\n\ninterface ModalOptions {\n /**\n * The controlled open state of the modal.\n * Must be used in conjunction with `onShow` and `onHide`.\n */\n show?: boolean\n\n /**\n * The open state of the modal when it is initially rendered.\n * Use when you **do not need to control** its open state.\n */\n defaultShow?: boolean\n\n /**\n * Callback function to be called when the modal is opened.\n * @default noop\n */\n onShow?: () => void\n\n /**\n * Callback function to be called when the modal is closed.\n * @default noop\n */\n onHide?: () => void\n}\n\ninterface ModalContentOptions {\n /**\n * Specify a container element to portal the content into.\n * @default document.body\n */\n container?: HTMLElement | null\n\n /**\n * Show close icon button that closes the modal when clicked.\n * @default false\n */\n showCloseIcon?: boolean\n\n /**\n * Width of the modal.\n * @default 'max-content'\n */\n width?: React.CSSProperties['width']\n\n /**\n * Height of the modal.\n * @default 'fit-content'\n */\n height?: React.CSSProperties['height']\n\n /**\n * z-index of the modal content.\n * Rather than using this option, Please check modal is positioned in the proper stacking context.\n * @default ZIndex.Modal\n */\n zIndex?: React.CSSProperties['zIndex']\n}\n\ninterface ModalHeaderOptions {\n /**\n * An accessible title to be announced when the modal is opened.\n */\n title: React.ReactNode\n\n /**\n * An accessible subtitle to be announced when the modal is opened.\n */\n subtitle?: React.ReactNode\n\n /**\n * An accessible description to be announced when the modal is opened.\n */\n description?: React.ReactNode\n\n /**\n * Size of the title\n * @default ModalTitleSize.L\n */\n titleSize?: ModalTitleSize\n\n /**\n * Hides content from the screen in an accessible way.\n * @default false\n */\n hidden?: boolean\n}\n\ntype ModalFooterSideContent = React.ReactNode\n\ninterface ModalFooterOptions extends\n SideContentProps<ModalFooterSideContent, ModalFooterSideContent> {}\n\nexport interface ModalProps extends\n ChildrenProps,\n ModalOptions {}\n\nexport interface ModalContentProps extends\n BezierComponentProps,\n ChildrenProps,\n React.HTMLAttributes<HTMLDivElement>,\n ModalContentOptions {}\n\nexport interface ModalHeaderProps extends\n BezierComponentProps,\n Omit<React.HTMLAttributes<HTMLElement>, keyof ModalHeaderOptions>,\n ModalHeaderOptions {}\n\nexport interface ModalBodyProps extends\n BezierComponentProps,\n ChildrenProps,\n React.HTMLAttributes<HTMLDivElement> {}\n\nexport interface ModalFooterProps extends\n BezierComponentProps,\n React.HTMLAttributes<HTMLElement>,\n ModalFooterOptions {}\n\nexport interface ModalTriggerProps extends\n ChildrenProps<React.ReactElement> {}\n\nexport interface ModalCloseProps extends\n ChildrenProps<React.ReactElement> {}\n\nexport interface ModalContentContextValue extends\n Required<Pick<ModalContentOptions, 'showCloseIcon'>> {}\n"],"names":["ModalTitleSize"],"mappings":";;AAMYA,IAAAA,cAAc,0BAAdA,cAAc,EAAA;EAAdA,cAAc,CAAA,GAAA,CAAA,GAAA,GAAA,CAAA;EAAdA,cAAc,CAAA,GAAA,CAAA,GAAA,GAAA,CAAA;AAAA,EAAA,OAAdA,cAAc,CAAA;AAAA,CAAA,CAAA,EAAA;;;;"}
@@ -45,7 +45,7 @@ const ModalContent = /*#__PURE__*/React.forwardRef(function ModalContent({
45
45
  "aria-modal": true,
46
46
  ref: forwardedRef,
47
47
  style: contentStyle
48
- }, rest), /*#__PURE__*/React.createElement(Modal_styled.Section, null, /*#__PURE__*/React.createElement(ModalContentContext.default.Provider, {
48
+ }, rest), /*#__PURE__*/React.createElement(Modal_styled.Section, null, /*#__PURE__*/React.createElement(ModalContentContext.ModalContentContextProvider, {
49
49
  value: contextValue
50
50
  }, children), showCloseIcon && /*#__PURE__*/React.createElement(ModalHelpers.ModalClose, null, /*#__PURE__*/React.createElement(Modal_styled.CloseIconButton, null)))))));
51
51
  });
@@ -1 +1 @@
1
- {"version":3,"file":"ModalContent.js","sources":["../../../../../src/components/Modals/Modal/ModalContent.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useMemo,\n} from 'react'\n\nimport * as DialogPrimitive from '@radix-ui/react-dialog'\n\nimport { ZIndex } from '~/src/constants/ZIndex'\nimport { document } from '~/src/utils/domUtils'\nimport { isNumber } from '~/src/utils/typeUtils'\n\nimport {\n type ModalContentContextValue,\n type ModalContentProps,\n} from './Modal.types'\nimport ModalContentContext from './ModalContentContext'\nimport { ModalClose } from './ModalHelpers'\n\nimport * as Styled from './Modal.styled'\n\n/**\n * `ModalContent` is a container of the modal content.\n * It creates a portal to render the modal content outside of the DOM tree\n * and renders overlay behind the modal content too.\n */\nexport const ModalContent = forwardRef(function ModalContent({\n children,\n style,\n container = document.body,\n showCloseIcon = false,\n width = 'max-content',\n height = 'fit-content',\n zIndex = ZIndex.Modal,\n ...rest\n}: ModalContentProps, forwardedRef: React.Ref<HTMLDivElement>) {\n const overlayStyle = useMemo((): React.CSSProperties & {\n '--bezier-modal-z-index': ModalContentProps['zIndex']\n } => ({\n '--bezier-modal-z-index': zIndex,\n }), [zIndex])\n\n const contentStyle = useMemo((): React.CSSProperties & {\n '--bezier-modal-width': ModalContentProps['width']\n '--bezier-modal-height': ModalContentProps['height']\n } => ({\n ...style,\n '--bezier-modal-width': isNumber(width) ? `${width}px` : width,\n '--bezier-modal-height': isNumber(height) ? `${height}px` : height,\n }), [\n style,\n width,\n height,\n ])\n\n const contextValue = useMemo((): ModalContentContextValue => ({\n showCloseIcon,\n }), [showCloseIcon])\n\n return (\n <DialogPrimitive.Portal container={container}>\n <Styled.DialogPrimitiveOverlay style={overlayStyle}>\n <DialogPrimitive.Content asChild>\n <Styled.Content\n aria-modal\n ref={forwardedRef}\n style={contentStyle}\n {...rest}\n >\n <Styled.Section>\n <ModalContentContext.Provider value={contextValue}>\n { children }\n </ModalContentContext.Provider>\n\n { /* NOTE: To prevent focusing first on the close button when opening the modal, place the close button behind. */ }\n { showCloseIcon && (\n <ModalClose>\n <Styled.CloseIconButton />\n </ModalClose>\n ) }\n </Styled.Section>\n </Styled.Content>\n </DialogPrimitive.Content>\n </Styled.DialogPrimitiveOverlay>\n </DialogPrimitive.Portal>\n )\n})\n"],"names":["ModalContent","forwardRef","children","style","container","document","body","showCloseIcon","width","height","zIndex","ZIndex","Modal","rest","forwardedRef","overlayStyle","useMemo","contentStyle","isNumber","contextValue","React","createElement","DialogPrimitive","Styled","asChild","Object","assign","ref","ModalContentContext","Provider","value","ModalClose"],"mappings":";;;;;;;;;;;AAoBA;AACA;AACA;AACA;AACA;MACaA,YAAY,gBAAGC,gBAAU,CAAC,SAASD,YAAYA,CAAC;EAC3DE,QAAQ;EACRC,KAAK;EACLC,SAAS,GAAGC,iBAAQ,CAACC,IAAI;AACzBC,EAAAA,aAAa,GAAG,KAAK;AACrBC,EAAAA,KAAK,GAAG,aAAa;AACrBC,EAAAA,MAAM,GAAG,aAAa;EACtBC,MAAM,GAAGC,aAAM,CAACC,KAAK;EACrB,GAAGC,IAAAA;AACc,CAAC,EAAEC,YAAuC,EAAE;AAC7D,EAAA,MAAMC,YAAY,GAAGC,aAAO,CAAC,OAEvB;AACJ,IAAA,wBAAwB,EAAEN,MAAAA;AAC5B,GAAC,CAAC,EAAE,CAACA,MAAM,CAAC,CAAC,CAAA;AAEb,EAAA,MAAMO,YAAY,GAAGD,aAAO,CAAC,OAGvB;AACJ,IAAA,GAAGb,KAAK;IACR,sBAAsB,EAAEe,kBAAQ,CAACV,KAAK,CAAC,GAAI,CAAEA,EAAAA,KAAM,CAAG,EAAA,CAAA,GAAGA,KAAK;IAC9D,uBAAuB,EAAEU,kBAAQ,CAACT,MAAM,CAAC,GAAI,CAAA,EAAEA,MAAO,CAAA,EAAA,CAAG,GAAGA,MAAAA;GAC7D,CAAC,EAAE,CACFN,KAAK,EACLK,KAAK,EACLC,MAAM,CACP,CAAC,CAAA;AAEF,EAAA,MAAMU,YAAY,GAAGH,aAAO,CAAC,OAAiC;AAC5DT,IAAAA,aAAAA;AACF,GAAC,CAAC,EAAE,CAACA,aAAa,CAAC,CAAC,CAAA;AAEpB,EAAA,oBACEa,KAAA,CAAAC,aAAA,CAACC,YAAsB,EAAA;AAAClB,IAAAA,SAAS,EAAEA,SAAAA;AAAU,GAAA,eAC3CgB,KAAA,CAAAC,aAAA,CAACE,mCAA6B,EAAA;AAACpB,IAAAA,KAAK,EAAEY,YAAAA;AAAa,GAAA,eACjDK,KAAA,CAAAC,aAAA,CAACC,aAAuB,EAAA;IAACE,OAAO,EAAA,IAAA;GAC9BJ,eAAAA,KAAA,CAAAC,aAAA,CAACE,oBAAc,EAAAE,MAAA,CAAAC,MAAA,CAAA;IACb,YAAU,EAAA,IAAA;AACVC,IAAAA,GAAG,EAAEb,YAAa;AAClBX,IAAAA,KAAK,EAAEc,YAAAA;AAAa,GAAA,EAChBJ,IAAI,CAERO,eAAAA,KAAA,CAAAC,aAAA,CAACE,oBAAc,EAAA,IAAA,eACbH,KAAA,CAAAC,aAAA,CAACO,2BAAmB,CAACC,QAAQ,EAAA;AAACC,IAAAA,KAAK,EAAEX,YAAAA;GACjCjB,EAAAA,QAC0B,CAAC,EAG7BK,aAAa,iBACba,KAAA,CAAAC,aAAA,CAACU,uBAAU,EACTX,IAAAA,eAAAA,KAAA,CAAAC,aAAA,CAACE,4BAAsB,EAAA,IAAE,CACf,CAEA,CACF,CACO,CACI,CACT,CAAC,CAAA;AAE7B,CAAC;;;;"}
1
+ {"version":3,"file":"ModalContent.js","sources":["../../../../../src/components/Modals/Modal/ModalContent.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useMemo,\n} from 'react'\n\nimport * as DialogPrimitive from '@radix-ui/react-dialog'\n\nimport { ZIndex } from '~/src/constants/ZIndex'\nimport { document } from '~/src/utils/domUtils'\nimport { isNumber } from '~/src/utils/typeUtils'\n\nimport {\n type ModalContentContextValue,\n type ModalContentProps,\n} from './Modal.types'\nimport { ModalContentContextProvider } from './ModalContentContext'\nimport { ModalClose } from './ModalHelpers'\n\nimport * as Styled from './Modal.styled'\n\n/**\n * `ModalContent` is a container of the modal content.\n * It creates a portal to render the modal content outside of the DOM tree\n * and renders overlay behind the modal content too.\n */\nexport const ModalContent = forwardRef(function ModalContent({\n children,\n style,\n container = document.body,\n showCloseIcon = false,\n width = 'max-content',\n height = 'fit-content',\n zIndex = ZIndex.Modal,\n ...rest\n}: ModalContentProps, forwardedRef: React.Ref<HTMLDivElement>) {\n const overlayStyle = useMemo((): React.CSSProperties & {\n '--bezier-modal-z-index': ModalContentProps['zIndex']\n } => ({\n '--bezier-modal-z-index': zIndex,\n }), [zIndex])\n\n const contentStyle = useMemo((): React.CSSProperties & {\n '--bezier-modal-width': ModalContentProps['width']\n '--bezier-modal-height': ModalContentProps['height']\n } => ({\n ...style,\n '--bezier-modal-width': isNumber(width) ? `${width}px` : width,\n '--bezier-modal-height': isNumber(height) ? `${height}px` : height,\n }), [\n style,\n width,\n height,\n ])\n\n const contextValue = useMemo((): ModalContentContextValue => ({\n showCloseIcon,\n }), [showCloseIcon])\n\n return (\n <DialogPrimitive.Portal container={container}>\n <Styled.DialogPrimitiveOverlay style={overlayStyle}>\n <DialogPrimitive.Content asChild>\n <Styled.Content\n aria-modal\n ref={forwardedRef}\n style={contentStyle}\n {...rest}\n >\n <Styled.Section>\n <ModalContentContextProvider value={contextValue}>\n { children }\n </ModalContentContextProvider>\n\n { /* NOTE: To prevent focusing first on the close button when opening the modal, place the close button behind. */ }\n { showCloseIcon && (\n <ModalClose>\n <Styled.CloseIconButton />\n </ModalClose>\n ) }\n </Styled.Section>\n </Styled.Content>\n </DialogPrimitive.Content>\n </Styled.DialogPrimitiveOverlay>\n </DialogPrimitive.Portal>\n )\n})\n"],"names":["ModalContent","forwardRef","children","style","container","document","body","showCloseIcon","width","height","zIndex","ZIndex","Modal","rest","forwardedRef","overlayStyle","useMemo","contentStyle","isNumber","contextValue","React","createElement","DialogPrimitive","Styled","asChild","Object","assign","ref","ModalContentContextProvider","value","ModalClose"],"mappings":";;;;;;;;;;;AAoBA;AACA;AACA;AACA;AACA;MACaA,YAAY,gBAAGC,gBAAU,CAAC,SAASD,YAAYA,CAAC;EAC3DE,QAAQ;EACRC,KAAK;EACLC,SAAS,GAAGC,iBAAQ,CAACC,IAAI;AACzBC,EAAAA,aAAa,GAAG,KAAK;AACrBC,EAAAA,KAAK,GAAG,aAAa;AACrBC,EAAAA,MAAM,GAAG,aAAa;EACtBC,MAAM,GAAGC,aAAM,CAACC,KAAK;EACrB,GAAGC,IAAAA;AACc,CAAC,EAAEC,YAAuC,EAAE;AAC7D,EAAA,MAAMC,YAAY,GAAGC,aAAO,CAAC,OAEvB;AACJ,IAAA,wBAAwB,EAAEN,MAAAA;AAC5B,GAAC,CAAC,EAAE,CAACA,MAAM,CAAC,CAAC,CAAA;AAEb,EAAA,MAAMO,YAAY,GAAGD,aAAO,CAAC,OAGvB;AACJ,IAAA,GAAGb,KAAK;IACR,sBAAsB,EAAEe,kBAAQ,CAACV,KAAK,CAAC,GAAI,CAAEA,EAAAA,KAAM,CAAG,EAAA,CAAA,GAAGA,KAAK;IAC9D,uBAAuB,EAAEU,kBAAQ,CAACT,MAAM,CAAC,GAAI,CAAA,EAAEA,MAAO,CAAA,EAAA,CAAG,GAAGA,MAAAA;GAC7D,CAAC,EAAE,CACFN,KAAK,EACLK,KAAK,EACLC,MAAM,CACP,CAAC,CAAA;AAEF,EAAA,MAAMU,YAAY,GAAGH,aAAO,CAAC,OAAiC;AAC5DT,IAAAA,aAAAA;AACF,GAAC,CAAC,EAAE,CAACA,aAAa,CAAC,CAAC,CAAA;AAEpB,EAAA,oBACEa,KAAA,CAAAC,aAAA,CAACC,YAAsB,EAAA;AAAClB,IAAAA,SAAS,EAAEA,SAAAA;AAAU,GAAA,eAC3CgB,KAAA,CAAAC,aAAA,CAACE,mCAA6B,EAAA;AAACpB,IAAAA,KAAK,EAAEY,YAAAA;AAAa,GAAA,eACjDK,KAAA,CAAAC,aAAA,CAACC,aAAuB,EAAA;IAACE,OAAO,EAAA,IAAA;GAC9BJ,eAAAA,KAAA,CAAAC,aAAA,CAACE,oBAAc,EAAAE,MAAA,CAAAC,MAAA,CAAA;IACb,YAAU,EAAA,IAAA;AACVC,IAAAA,GAAG,EAAEb,YAAa;AAClBX,IAAAA,KAAK,EAAEc,YAAAA;AAAa,GAAA,EAChBJ,IAAI,CAAA,eAERO,KAAA,CAAAC,aAAA,CAACE,oBAAc,EACbH,IAAAA,eAAAA,KAAA,CAAAC,aAAA,CAACO,+CAA2B,EAAA;AAACC,IAAAA,KAAK,EAAEV,YAAAA;GAChCjB,EAAAA,QACyB,CAAC,EAG5BK,aAAa,iBACba,KAAA,CAAAC,aAAA,CAACS,uBAAU,EACTV,IAAAA,eAAAA,KAAA,CAAAC,aAAA,CAACE,4BAAsB,EAAA,IAAE,CACf,CAEA,CACF,CACO,CACI,CACT,CAAC,CAAA;AAE7B,CAAC;;;;"}
@@ -1,13 +1,11 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
3
+ var reactUtils = require('../../../utils/reactUtils.js');
4
4
 
5
- var React = require('react');
6
-
7
- const ModalContentContext = /*#__PURE__*/React.createContext({
5
+ const [ModalContentContextProvider, useModalContentContext] = reactUtils.createContext({
8
6
  showCloseIcon: false
9
7
  });
10
- var ModalContentContext$1 = ModalContentContext;
11
8
 
12
- exports.default = ModalContentContext$1;
9
+ exports.ModalContentContextProvider = ModalContentContextProvider;
10
+ exports.useModalContentContext = useModalContentContext;
13
11
  //# sourceMappingURL=ModalContentContext.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ModalContentContext.js","sources":["../../../../../src/components/Modals/Modal/ModalContentContext.ts"],"sourcesContent":["import React from 'react'\n\nimport { type ModalContentContextValue } from './Modal.types'\n\nconst ModalContentContext = React.createContext<ModalContentContextValue>({\n showCloseIcon: false,\n})\n\nexport default ModalContentContext\n"],"names":["ModalContentContext","React","createContext","showCloseIcon"],"mappings":";;;;;;AAIA,MAAMA,mBAAmB,gBAAGC,KAAK,CAACC,aAAa,CAA2B;AACxEC,EAAAA,aAAa,EAAE,KAAA;AACjB,CAAC,CAAC,CAAA;AAEF,4BAAeH,mBAAmB;;;;"}
1
+ {"version":3,"file":"ModalContentContext.js","sources":["../../../../../src/components/Modals/Modal/ModalContentContext.ts"],"sourcesContent":["import { createContext } from '~/src/utils/reactUtils'\n\nimport { type ModalContentContextValue } from './Modal.types'\n\nexport const [\n ModalContentContextProvider,\n useModalContentContext,\n] = createContext<ModalContentContextValue>({\n showCloseIcon: false,\n})\n"],"names":["ModalContentContextProvider","useModalContentContext","createContext","showCloseIcon"],"mappings":";;;;AAIO,MAAM,CACXA,2BAA2B,EAC3BC,sBAAsB,CACvB,GAAGC,wBAAa,CAA2B;AAC1CC,EAAAA,aAAa,EAAE,KAAA;AACjB,CAAC;;;;;"}
@@ -59,7 +59,7 @@ const ModalHeader = /*#__PURE__*/React.forwardRef(function ModalHeader({
59
59
  }, forwardedRef) {
60
60
  const {
61
61
  showCloseIcon
62
- } = React.useContext(ModalContentContext.default);
62
+ } = ModalContentContext.useModalContentContext();
63
63
  const hasTitleArea = title || showCloseIcon;
64
64
  const Hidden = hidden ? VisuallyHidden.VisuallyHidden : React.Fragment;
65
65
  return /*#__PURE__*/React.createElement(Hidden, null, /*#__PURE__*/React.createElement(Modal_styled.Header, Object.assign({
@@ -1 +1 @@
1
- {"version":3,"file":"ModalHeader.js","sources":["../../../../../src/components/Modals/Modal/ModalHeader.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useContext,\n} from 'react'\n\nimport * as DialogPrimitive from '@radix-ui/react-dialog'\n\nimport { Typography } from '~/src/foundation'\n\nimport { Text } from '~/src/components/Text'\nimport { VisuallyHidden } from '~/src/components/VisuallyHidden'\n\nimport {\n type ModalHeaderProps,\n ModalTitleSize,\n} from './Modal.types'\nimport ModalContentContext from './ModalContentContext'\n\nimport * as Styled from './Modal.styled'\n\nfunction getTitleTypo(size: ModalTitleSize) {\n switch (size) {\n case ModalTitleSize.L:\n return Typography.Size24\n case ModalTitleSize.M:\n return Typography.Size16\n default:\n return Typography.Size16\n }\n}\n\nfunction ModalHeaderTitle({\n children,\n size,\n subtitle,\n}: React.PropsWithChildren<Pick<ModalHeaderProps, 'subtitle'> & { size: NonNullable<ModalHeaderProps['titleSize']> }>) {\n const hasSubtitle = !!subtitle\n const titleTypo = getTitleTypo(size)\n\n return (\n <DialogPrimitive.Title asChild>\n { hasSubtitle\n ? (\n <Styled.HeadingGroup\n role=\"group\"\n aria-roledescription=\"Heading group\"\n >\n <Styled.Title typo={titleTypo}>\n { children }\n </Styled.Title>\n\n <Text\n aria-roledescription=\"subtitle\"\n as=\"p\"\n bold\n color=\"txt-black-dark\"\n typo={Typography.Size13}\n >\n { subtitle }\n </Text>\n </Styled.HeadingGroup>\n )\n : (\n <Styled.Title typo={titleTypo}>\n { children }\n </Styled.Title>\n ) }\n </DialogPrimitive.Title>\n )\n}\n\n/**\n * `ModalHeader` is a header of the modal content.\n * It renders the accessible title and description of the modal.\n * If you want to hide the title and description, use `hidden` prop.\n */\nexport const ModalHeader = forwardRef(function ModalHeader({\n title,\n subtitle,\n description,\n titleSize = ModalTitleSize.L,\n hidden = false,\n ...rest\n}: ModalHeaderProps, forwardedRef: React.Ref<HTMLElement>) {\n const { showCloseIcon } = useContext(ModalContentContext)\n const hasTitleArea = title || showCloseIcon\n const Hidden = hidden ? VisuallyHidden : React.Fragment\n\n return (\n <Hidden>\n <Styled.Header\n ref={forwardedRef}\n hidden={hidden}\n {...rest}\n >\n { hasTitleArea && (\n <Styled.TitleContainer>\n { title && (\n <ModalHeaderTitle\n size={titleSize}\n subtitle={subtitle}\n >\n { title }\n </ModalHeaderTitle>\n ) }\n\n { showCloseIcon && (\n <Styled.CloseIconButtonSpacer />\n ) }\n </Styled.TitleContainer>\n ) }\n\n { description && (\n <DialogPrimitive.Description asChild>\n <Text\n as=\"p\"\n color=\"txt-black-darkest\"\n typo={Typography.Size15}\n >\n { description }\n </Text>\n </DialogPrimitive.Description>\n ) }\n </Styled.Header>\n </Hidden>\n )\n})\n"],"names":["getTitleTypo","size","ModalTitleSize","L","Typography","Size24","M","Size16","ModalHeaderTitle","children","subtitle","hasSubtitle","titleTypo","React","createElement","DialogPrimitive","asChild","Styled","role","typo","Text","as","bold","color","Size13","ModalHeader","forwardRef","title","description","titleSize","hidden","rest","forwardedRef","showCloseIcon","useContext","ModalContentContext","hasTitleArea","Hidden","VisuallyHidden","Fragment","Object","assign","ref","Size15"],"mappings":";;;;;;;;;;;AAoBA,SAASA,YAAYA,CAACC,IAAoB,EAAE;AAC1C,EAAA,QAAQA,IAAI;IACV,KAAKC,0BAAc,CAACC,CAAC;MACnB,OAAOC,qBAAU,CAACC,MAAM,CAAA;IAC1B,KAAKH,0BAAc,CAACI,CAAC;MACnB,OAAOF,qBAAU,CAACG,MAAM,CAAA;AAC1B,IAAA;MACE,OAAOH,qBAAU,CAACG,MAAM,CAAA;AAC5B,GAAA;AACF,CAAA;AAEA,SAASC,gBAAgBA,CAAC;EACxBC,QAAQ;EACRR,IAAI;AACJS,EAAAA,QAAAA;AACkH,CAAC,EAAE;AACrH,EAAA,MAAMC,WAAW,GAAG,CAAC,CAACD,QAAQ,CAAA;AAC9B,EAAA,MAAME,SAAS,GAAGZ,YAAY,CAACC,IAAI,CAAC,CAAA;AAEpC,EAAA,oBACEY,KAAA,CAAAC,aAAA,CAACC,WAAqB,EAAA;IAACC,OAAO,EAAA,IAAA;GAC1BL,EAAAA,WAAW,gBAETE,KAAA,CAAAC,aAAA,CAACG,yBAAmB,EAAA;AAClBC,IAAAA,IAAI,EAAC,OAAO;IACZ,sBAAqB,EAAA,eAAA;AAAe,GAAA,eAEpCL,KAAA,CAAAC,aAA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ACLd,KAAA,CAAAC,aAAA,CAACN,gBAAgB,EAAA;AACfP,IAAAA,IAAI,EAAE4B,SAAU;AAChBnB,IAAAA,QAAQ,EAAEA,QAAAA;GAERiB,EAAAA,KACc,CACnB,EAECM,aAAa,iBACbpB,KAAA,CAAAC,aAAA,CAACG,kCAA4B,MAAE,CAEZ,CACxB,EAECW,WAAW,iBACXf,KAAA,CAAAC,aAAA,CAACC,iBAA2B,EAAA;IAACC,OAAO,EAAA,IAAA;AAAA,GAAA,eAClCH,KAAA,CAAAC,aAAA,CAACM,YAAI,EAAA;AACHC,IAAAA,EAAE,EAAC,GAAG;AACNE,IAAAA,KAAK,EAAC,mBAAmB;IACzBJ,IAAI,EAAEf,qBAAU,CAACuC,MAAAA;AAAO,GAAA,EAEtBf,WACE,CACqB,CAElB,CACT,CAAC,CAAA;AAEb,CAAC;;;;"}
1
+ {"version":3,"file":"ModalHeader.js","sources":["../../../../../src/components/Modals/Modal/ModalHeader.tsx"],"sourcesContent":["import React, { forwardRef } from 'react'\n\nimport * as DialogPrimitive from '@radix-ui/react-dialog'\n\nimport { Typography } from '~/src/foundation'\n\nimport { Text } from '~/src/components/Text'\nimport { VisuallyHidden } from '~/src/components/VisuallyHidden'\n\nimport {\n type ModalHeaderProps,\n ModalTitleSize,\n} from './Modal.types'\nimport { useModalContentContext } from './ModalContentContext'\n\nimport * as Styled from './Modal.styled'\n\nfunction getTitleTypo(size: ModalTitleSize) {\n switch (size) {\n case ModalTitleSize.L:\n return Typography.Size24\n case ModalTitleSize.M:\n return Typography.Size16\n default:\n return Typography.Size16\n }\n}\n\nfunction ModalHeaderTitle({\n children,\n size,\n subtitle,\n}: React.PropsWithChildren<Pick<ModalHeaderProps, 'subtitle'> & { size: NonNullable<ModalHeaderProps['titleSize']> }>) {\n const hasSubtitle = !!subtitle\n const titleTypo = getTitleTypo(size)\n\n return (\n <DialogPrimitive.Title asChild>\n { hasSubtitle\n ? (\n <Styled.HeadingGroup\n role=\"group\"\n aria-roledescription=\"Heading group\"\n >\n <Styled.Title typo={titleTypo}>\n { children }\n </Styled.Title>\n\n <Text\n aria-roledescription=\"subtitle\"\n as=\"p\"\n bold\n color=\"txt-black-dark\"\n typo={Typography.Size13}\n >\n { subtitle }\n </Text>\n </Styled.HeadingGroup>\n )\n : (\n <Styled.Title typo={titleTypo}>\n { children }\n </Styled.Title>\n ) }\n </DialogPrimitive.Title>\n )\n}\n\n/**\n * `ModalHeader` is a header of the modal content.\n * It renders the accessible title and description of the modal.\n * If you want to hide the title and description, use `hidden` prop.\n */\nexport const ModalHeader = forwardRef(function ModalHeader({\n title,\n subtitle,\n description,\n titleSize = ModalTitleSize.L,\n hidden = false,\n ...rest\n}: ModalHeaderProps, forwardedRef: React.Ref<HTMLElement>) {\n const { showCloseIcon } = useModalContentContext()\n const hasTitleArea = title || showCloseIcon\n const Hidden = hidden ? VisuallyHidden : React.Fragment\n\n return (\n <Hidden>\n <Styled.Header\n ref={forwardedRef}\n hidden={hidden}\n {...rest}\n >\n { hasTitleArea && (\n <Styled.TitleContainer>\n { title && (\n <ModalHeaderTitle\n size={titleSize}\n subtitle={subtitle}\n >\n { title }\n </ModalHeaderTitle>\n ) }\n\n { showCloseIcon && (\n <Styled.CloseIconButtonSpacer />\n ) }\n </Styled.TitleContainer>\n ) }\n\n { description && (\n <DialogPrimitive.Description asChild>\n <Text\n as=\"p\"\n color=\"txt-black-darkest\"\n typo={Typography.Size15}\n >\n { description }\n </Text>\n </DialogPrimitive.Description>\n ) }\n </Styled.Header>\n </Hidden>\n )\n})\n"],"names":["getTitleTypo","size","ModalTitleSize","L","Typography","Size24","M","Size16","ModalHeaderTitle","children","subtitle","hasSubtitle","titleTypo","React","createElement","DialogPrimitive","asChild","Styled","role","typo","Text","as","bold","color","Size13","ModalHeader","forwardRef","title","description","titleSize","hidden","rest","forwardedRef","showCloseIcon","useModalContentContext","hasTitleArea","Hidden","VisuallyHidden","Fragment","Object","assign","ref","Size15"],"mappings":";;;;;;;;;;;AAiBA,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Eb,CAAC;;;;"}
@@ -8,7 +8,6 @@ var index = require('../../node_modules/classnames/index.js');
8
8
  var functionUtils = require('../../utils/functionUtils.js');
9
9
  var typeUtils = require('../../utils/typeUtils.js');
10
10
  var OutlineItemContext = require('./OutlineItemContext.js');
11
- var useOutlineItemContext = require('./useOutlineItemContext.js');
12
11
  var OutlineItem_styled = require('./OutlineItem.styled.js');
13
12
  var Icon_types = require('../Icon/Icon.types.js');
14
13
 
@@ -80,7 +79,7 @@ function OutlineItem({
80
79
  onClickArrow(name);
81
80
  }
82
81
  }, [name, onClickArrow]);
83
- const context = useOutlineItemContext.default({
82
+ const context = OutlineItemContext.useOutlineItemContext({
84
83
  paddingLeft: givenPaddingLeft,
85
84
  active: givenActive,
86
85
  onClick: givenOnClick
@@ -146,7 +145,7 @@ function OutlineItem({
146
145
  active: currentOutlineItemIndex === index,
147
146
  onClick: () => handleClickItem(index, element.props.optionKey)
148
147
  };
149
- return /*#__PURE__*/React.createElement(OutlineItemContext.OutlineItemContext.Provider, {
148
+ return /*#__PURE__*/React.createElement(OutlineItemContext.OutlineItemContextProvider, {
150
149
  value: passedContext
151
150
  }, element);
152
151
  }), [children, context, currentOutlineItemIndex, handleClickItem]);
@@ -1 +1 @@
1
- {"version":3,"file":"OutlineItem.js","sources":["../../../../src/components/OutlineItem/OutlineItem.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from 'react'\n\nimport {\n ChevronSmallDownIcon,\n ChevronSmallRightIcon,\n isBezierIcon,\n} from '@channel.io/bezier-icons'\nimport classNames from 'classnames'\n\nimport { noop } from '~/src/utils/functionUtils'\nimport { isNil } from '~/src/utils/typeUtils'\n\nimport { IconSize } from '~/src/components/Icon'\n\nimport type OutlineItemProps from './OutlineItem.types'\nimport { OutlineItemContext } from './OutlineItemContext'\nimport useOutlineItemContext from './useOutlineItemContext'\n\nimport {\n ChevronWrapper,\n ContentWrapper,\n GroupItemWrapper,\n LeftContentWrapper,\n StyledIcon,\n} from './OutlineItem.styled'\n\nconst LIST_GROUP_PADDING_LEFT = 16\n\nexport const OUTLINE_ITEM_TEST_ID = 'bezier-react-outline-item'\nexport const OUTLINE_ITEM_LEFT_ICON_TEST_ID = 'bezier-react-outline-item-left-icon'\n\nfunction OutlineItem(\n {\n as,\n testId = OUTLINE_ITEM_TEST_ID,\n leftIconTestId = OUTLINE_ITEM_LEFT_ICON_TEST_ID,\n style,\n className,\n interpolation,\n contentClassName,\n contentInterpolation,\n iconClassName,\n iconInterpolation,\n paddingLeft: givenPaddingLeft,\n open = false,\n active: givenActive,\n focused = false,\n leftContent,\n leftIcon,\n leftIconColor = 'txt-black-dark',\n disableChevron = false,\n disableIconActive = false,\n name,\n href,\n content = null,\n rightContent = null,\n hide = false,\n onOpen = noop,\n onClickArrow = noop,\n /* OptionMenuHost Props */\n selectedOutlineItemIndex = null,\n onChangeOption = noop,\n /* HTMLAttribute props */\n onClick: givenOnClick = noop,\n children,\n }: OutlineItemProps,\n forwardedRef: React.Ref<HTMLElement>,\n) {\n const [currentOutlineItemIndex, setCurrentOutlineItemIndex] = useState<number | null>(selectedOutlineItemIndex)\n\n useEffect(() => {\n const childs = React.Children.toArray(children)\n if (isNil(selectedOutlineItemIndex)\n || (selectedOutlineItemIndex < childs.length && selectedOutlineItemIndex < 0)) {\n setCurrentOutlineItemIndex(null)\n return\n }\n\n const element = childs[selectedOutlineItemIndex]\n\n if (React.isValidElement(element) && isNil(element.props.children)) {\n if (element.props.href) { return }\n\n setCurrentOutlineItemIndex(selectedOutlineItemIndex)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selectedOutlineItemIndex])\n\n useEffect(() => {\n if (open) {\n onOpen(name)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open])\n\n const handleClickItem = useCallback((\n itemIndex: number,\n optionKey: string,\n ) => {\n onChangeOption(name, optionKey, itemIndex)\n }, [\n name,\n onChangeOption,\n ])\n\n const handleClickIcon = useCallback((event?: React.MouseEvent<SVGSVGElement>) => {\n if (onClickArrow) {\n event?.stopPropagation()\n onClickArrow(name)\n }\n }, [\n name,\n onClickArrow,\n ])\n\n const context = useOutlineItemContext({\n paddingLeft: givenPaddingLeft,\n active: givenActive,\n onClick: givenOnClick,\n }, LIST_GROUP_PADDING_LEFT)\n const { paddingLeft, active, onClick } = context\n\n const handleClickGroup = useCallback((event?: React.MouseEvent) => {\n onClick(event, name)\n }, [\n name,\n onClick,\n ])\n\n const chevronComponent = useMemo(() => {\n if (disableChevron) {\n return null\n }\n\n const chevronSource = open ? ChevronSmallDownIcon : ChevronSmallRightIcon\n const showChevron = !isNil(children)\n\n return (\n <ChevronWrapper>\n { showChevron && (\n <StyledIcon\n source={chevronSource}\n size={IconSize.XS}\n onClick={handleClickIcon}\n color=\"txt-black-darker\"\n />\n ) }\n </ChevronWrapper>\n )\n }, [\n children,\n disableChevron,\n handleClickIcon,\n open,\n ])\n\n const leftComponent = useMemo(() => {\n if (!isNil(leftContent)) {\n return (\n <LeftContentWrapper>\n { leftContent }\n </LeftContentWrapper>\n )\n }\n\n const isIcon = isBezierIcon(leftIcon)\n\n if (isIcon) {\n const iconProps = {\n testId: leftIconTestId,\n className: classNames(\n iconClassName,\n (!disableIconActive && active) && 'active',\n ),\n interpolation: iconInterpolation,\n size: IconSize.S,\n color: leftIconColor,\n }\n\n const Icon = (() => {\n if (isIcon) {\n return (\n <StyledIcon\n {...iconProps}\n source={leftIcon}\n />\n )\n }\n return <></>\n })()\n\n return (\n <LeftContentWrapper>\n { Icon }\n </LeftContentWrapper>\n )\n }\n\n return null\n }, [\n active,\n disableIconActive,\n iconClassName,\n iconInterpolation,\n leftContent,\n leftIcon,\n leftIconColor,\n leftIconTestId,\n ])\n\n const ContentComponent = useMemo(() => (\n <>\n { chevronComponent }\n { leftComponent }\n <ContentWrapper\n className={contentClassName}\n interpolation={contentInterpolation}\n >\n { content }\n </ContentWrapper>\n { rightContent }\n </>\n ),\n [\n chevronComponent,\n leftComponent,\n contentClassName,\n contentInterpolation,\n content,\n rightContent,\n ])\n\n const Items = useMemo(() => (\n React.Children.map(children, (element, index) => {\n if (!React.isValidElement(element)) {\n return element\n }\n\n // eslint-disable-next-line react/jsx-no-constructed-context-values\n const passedContext = {\n ...context,\n active: currentOutlineItemIndex === index,\n onClick: () => handleClickItem(index, element.props.optionKey),\n }\n\n return (\n <OutlineItemContext.Provider value={passedContext}>\n { element }\n </OutlineItemContext.Provider>\n )\n })\n ), [\n children,\n context,\n currentOutlineItemIndex,\n handleClickItem,\n ])\n\n if (hide) { return null }\n\n if (!isNil(href)) {\n return (\n <>\n <GroupItemWrapper\n ref={forwardedRef as React.Ref<HTMLAnchorElement>}\n as=\"a\"\n href={href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n style={style}\n className={className}\n interpolation={interpolation}\n active={false}\n focused={focused}\n currentOutlineItemIndex={currentOutlineItemIndex}\n paddingLeft={paddingLeft}\n onClick={handleClickGroup}\n data-testid={testId}\n data-active-index={currentOutlineItemIndex}\n >\n { ContentComponent }\n </GroupItemWrapper>\n { open && (\n Items\n ) }\n </>\n )\n }\n\n return (\n <>\n <GroupItemWrapper\n as={as}\n ref={forwardedRef}\n style={style}\n className={className}\n interpolation={interpolation}\n active={active}\n focused={focused}\n currentOutlineItemIndex={currentOutlineItemIndex}\n paddingLeft={paddingLeft}\n onClick={handleClickGroup}\n data-testid={testId}\n data-active-index={currentOutlineItemIndex}\n >\n { ContentComponent }\n </GroupItemWrapper>\n { open && (\n Items\n ) }\n </>\n )\n}\n\nexport default forwardRef(OutlineItem)\n"],"names":["LIST_GROUP_PADDING_LEFT","OUTLINE_ITEM_TEST_ID","OUTLINE_ITEM_LEFT_ICON_TEST_ID","OutlineItem","as","testId","leftIconTestId","style","className","interpolation","contentClassName","contentInterpolation","iconClassName","iconInterpolation","paddingLeft","givenPaddingLeft","open","active","givenActive","focused","leftContent","leftIcon","leftIconColor","disableChevron","disableIconActive","name","href","content","rightContent","hide","onOpen","noop","onClickArrow","selectedOutlineItemIndex","onChangeOption","onClick","givenOnClick","children","forwardedRef","currentOutlineItemIndex","setCurrentOutlineItemIndex","useState","useEffect","childs","React","Children","toArray","isNil","length","element","isValidElement","props","handleClickItem","useCallback","itemIndex","optionKey","handleClickIcon","event","stopPropagation","context","useOutlineItemContext","handleClickGroup","chevronComponent","useMemo","chevronSource","ChevronSmallDownIcon","ChevronSmallRightIcon","showChevron","createElement","ChevronWrapper","StyledIcon","source","size","IconSize","XS","color","leftComponent","LeftContentWrapper","isIcon","isBezierIcon","iconProps","classNames","S","Icon","Object","assign","Fragment","ContentComponent","ContentWrapper","Items","map","index","passedContext","OutlineItemContext","Provider","value","GroupItemWrapper","ref","target","rel","forwardRef"],"mappings":";;;;;;;;;;;;;;AAgCA,MAAMA,uBAAuB,GAAG,EAAE,CAAA;AAE3B,MAAMC,oBAAoB,GAAG,4BAA2B;AACxD,MAAMC,8BAA8B,GAAG,sCAAqC;AAEnF,SAASC,WAAWA,CAClB;EACEC,EAAE;AACFC,EAAAA,MAAM,GAAGJ,oBAAoB;AAC7BK,EAAAA,cAAc,GAAGJ,8BAA8B;EAC/CK,KAAK;EACLC,SAAS;EACTC,aAAa;EACbC,gBAAgB;EAChBC,oBAAoB;EACpBC,aAAa;EACbC,iBAAiB;AACjBC,EAAAA,WAAW,EAAEC,gBAAgB;AAC7BC,EAAAA,IAAI,GAAG,KAAK;AACZC,EAAAA,MAAM,EAAEC,WAAW;AACnBC,EAAAA,OAAO,GAAG,KAAK;EACfC,WAAW;EACXC,QAAQ;AACRC,EAAAA,aAAa,GAAG,gBAAgB;AAChCC,EAAAA,cAAc,GAAG,KAAK;AACtBC,EAAAA,iBAAiB,GAAG,KAAK;EACzBC,IAAI;EACJC,IAAI;AACJC,EAAAA,OAAO,GAAG,IAAI;AACdC,EAAAA,YAAY,GAAG,IAAI;AACnBC,EAAAA,IAAI,GAAG,KAAK;AACZC,EAAAA,MAAM,GAAGC,kBAAI;AACbC,EAAAA,YA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AK,EAAEA,KAAM;AACbC,IAAAA,SAAS,EAAEA,SAAU;AACrBC,IAAAA,aAAa,EAAEA,aAAc;AAC7BQ,IAAAA,MAAM,EAAEA,MAAO;AACfE,IAAAA,OAAO,EAAEA,OAAQ;AACjBoB,IAAAA,uBAAuB,EAAEA,uBAAwB;AACjDzB,IAAAA,WAAW,EAAEA,WAAY;AACzBqB,IAAAA,OAAO,EAAE0B,gBAAiB;AAC1B,IAAA,aAAA,EAAaxD,MAAO;IACpB,mBAAmBkC,EAAAA,uBAAAA;AAAwB,GAAA,EAEzCgD,gBACc,CAAC,EACjBvE,IAAI,IACJyE,KAEF,CAAC,CAAA;AAEP,CAAA;AAEA,oBAAeW,aAAAA,gBAAU,CAACjG,WAAW,CAAC;;;;;;"}
1
+ {"version":3,"file":"OutlineItem.js","sources":["../../../../src/components/OutlineItem/OutlineItem.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from 'react'\n\nimport {\n ChevronSmallDownIcon,\n ChevronSmallRightIcon,\n isBezierIcon,\n} from '@channel.io/bezier-icons'\nimport classNames from 'classnames'\n\nimport { noop } from '~/src/utils/functionUtils'\nimport { isNil } from '~/src/utils/typeUtils'\n\nimport { IconSize } from '~/src/components/Icon'\n\nimport type OutlineItemProps from './OutlineItem.types'\nimport {\n OutlineItemContextProvider,\n useOutlineItemContext,\n} from './OutlineItemContext'\n\nimport {\n ChevronWrapper,\n ContentWrapper,\n GroupItemWrapper,\n LeftContentWrapper,\n StyledIcon,\n} from './OutlineItem.styled'\n\nconst LIST_GROUP_PADDING_LEFT = 16\n\nexport const OUTLINE_ITEM_TEST_ID = 'bezier-react-outline-item'\nexport const OUTLINE_ITEM_LEFT_ICON_TEST_ID = 'bezier-react-outline-item-left-icon'\n\nfunction OutlineItem(\n {\n as,\n testId = OUTLINE_ITEM_TEST_ID,\n leftIconTestId = OUTLINE_ITEM_LEFT_ICON_TEST_ID,\n style,\n className,\n interpolation,\n contentClassName,\n contentInterpolation,\n iconClassName,\n iconInterpolation,\n paddingLeft: givenPaddingLeft,\n open = false,\n active: givenActive,\n focused = false,\n leftContent,\n leftIcon,\n leftIconColor = 'txt-black-dark',\n disableChevron = false,\n disableIconActive = false,\n name,\n href,\n content = null,\n rightContent = null,\n hide = false,\n onOpen = noop,\n onClickArrow = noop,\n /* OptionMenuHost Props */\n selectedOutlineItemIndex = null,\n onChangeOption = noop,\n /* HTMLAttribute props */\n onClick: givenOnClick = noop,\n children,\n }: OutlineItemProps,\n forwardedRef: React.Ref<HTMLElement>,\n) {\n const [currentOutlineItemIndex, setCurrentOutlineItemIndex] = useState<number | null>(selectedOutlineItemIndex)\n\n useEffect(() => {\n const childs = React.Children.toArray(children)\n if (isNil(selectedOutlineItemIndex)\n || (selectedOutlineItemIndex < childs.length && selectedOutlineItemIndex < 0)) {\n setCurrentOutlineItemIndex(null)\n return\n }\n\n const element = childs[selectedOutlineItemIndex]\n\n if (React.isValidElement(element) && isNil(element.props.children)) {\n if (element.props.href) { return }\n\n setCurrentOutlineItemIndex(selectedOutlineItemIndex)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selectedOutlineItemIndex])\n\n useEffect(() => {\n if (open) {\n onOpen(name)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open])\n\n const handleClickItem = useCallback((\n itemIndex: number,\n optionKey: string,\n ) => {\n onChangeOption(name, optionKey, itemIndex)\n }, [\n name,\n onChangeOption,\n ])\n\n const handleClickIcon = useCallback((event?: React.MouseEvent<SVGSVGElement>) => {\n if (onClickArrow) {\n event?.stopPropagation()\n onClickArrow(name)\n }\n }, [\n name,\n onClickArrow,\n ])\n\n const context = useOutlineItemContext({\n paddingLeft: givenPaddingLeft,\n active: givenActive,\n onClick: givenOnClick,\n }, LIST_GROUP_PADDING_LEFT)\n const { paddingLeft, active, onClick } = context\n\n const handleClickGroup = useCallback((event?: React.MouseEvent) => {\n onClick(event, name)\n }, [\n name,\n onClick,\n ])\n\n const chevronComponent = useMemo(() => {\n if (disableChevron) {\n return null\n }\n\n const chevronSource = open ? ChevronSmallDownIcon : ChevronSmallRightIcon\n const showChevron = !isNil(children)\n\n return (\n <ChevronWrapper>\n { showChevron && (\n <StyledIcon\n source={chevronSource}\n size={IconSize.XS}\n onClick={handleClickIcon}\n color=\"txt-black-darker\"\n />\n ) }\n </ChevronWrapper>\n )\n }, [\n children,\n disableChevron,\n handleClickIcon,\n open,\n ])\n\n const leftComponent = useMemo(() => {\n if (!isNil(leftContent)) {\n return (\n <LeftContentWrapper>\n { leftContent }\n </LeftContentWrapper>\n )\n }\n\n const isIcon = isBezierIcon(leftIcon)\n\n if (isIcon) {\n const iconProps = {\n testId: leftIconTestId,\n className: classNames(\n iconClassName,\n (!disableIconActive && active) && 'active',\n ),\n interpolation: iconInterpolation,\n size: IconSize.S,\n color: leftIconColor,\n }\n\n const Icon = (() => {\n if (isIcon) {\n return (\n <StyledIcon\n {...iconProps}\n source={leftIcon}\n />\n )\n }\n return <></>\n })()\n\n return (\n <LeftContentWrapper>\n { Icon }\n </LeftContentWrapper>\n )\n }\n\n return null\n }, [\n active,\n disableIconActive,\n iconClassName,\n iconInterpolation,\n leftContent,\n leftIcon,\n leftIconColor,\n leftIconTestId,\n ])\n\n const ContentComponent = useMemo(() => (\n <>\n { chevronComponent }\n { leftComponent }\n <ContentWrapper\n className={contentClassName}\n interpolation={contentInterpolation}\n >\n { content }\n </ContentWrapper>\n { rightContent }\n </>\n ),\n [\n chevronComponent,\n leftComponent,\n contentClassName,\n contentInterpolation,\n content,\n rightContent,\n ])\n\n const Items = useMemo(() => (\n React.Children.map(children, (element, index) => {\n if (!React.isValidElement(element)) {\n return element\n }\n\n // eslint-disable-next-line react/jsx-no-constructed-context-values\n const passedContext = {\n ...context,\n active: currentOutlineItemIndex === index,\n onClick: () => handleClickItem(index, element.props.optionKey),\n }\n\n return (\n <OutlineItemContextProvider value={passedContext}>\n { element }\n </OutlineItemContextProvider>\n )\n })\n ), [\n children,\n context,\n currentOutlineItemIndex,\n handleClickItem,\n ])\n\n if (hide) { return null }\n\n if (!isNil(href)) {\n return (\n <>\n <GroupItemWrapper\n ref={forwardedRef as React.Ref<HTMLAnchorElement>}\n as=\"a\"\n href={href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n style={style}\n className={className}\n interpolation={interpolation}\n active={false}\n focused={focused}\n currentOutlineItemIndex={currentOutlineItemIndex}\n paddingLeft={paddingLeft}\n onClick={handleClickGroup}\n data-testid={testId}\n data-active-index={currentOutlineItemIndex}\n >\n { ContentComponent }\n </GroupItemWrapper>\n { open && (\n Items\n ) }\n </>\n )\n }\n\n return (\n <>\n <GroupItemWrapper\n as={as}\n ref={forwardedRef}\n style={style}\n className={className}\n interpolation={interpolation}\n active={active}\n focused={focused}\n currentOutlineItemIndex={currentOutlineItemIndex}\n paddingLeft={paddingLeft}\n onClick={handleClickGroup}\n data-testid={testId}\n data-active-index={currentOutlineItemIndex}\n >\n { ContentComponent }\n </GroupItemWrapper>\n { open && (\n Items\n ) }\n </>\n )\n}\n\nexport default forwardRef(OutlineItem)\n"],"names":["LIST_GROUP_PADDING_LEFT","OUTLINE_ITEM_TEST_ID","OUTLINE_ITEM_LEFT_ICON_TEST_ID","OutlineItem","as","testId","leftIconTestId","style","className","interpolation","contentClassName","contentInterpolation","iconClassName","iconInterpolation","paddingLeft","givenPaddingLeft","open","active","givenActive","focused","leftContent","leftIcon","leftIconColor","disableChevron","disableIconActive","name","href","content","rightContent","hide","onOpen","noop","onClickArrow","selectedOutlineItemIndex","onChangeOption","onClick","givenOnClick","children","forwardedRef","currentOutlineItemIndex","setCurrentOutlineItemIndex","useState","useEffect","childs","React","Children","toArray","isNil","length","element","isValidElement","props","handleClickItem","useCallback","itemIndex","optionKey","handleClickIcon","event","stopPropagation","context","useOutlineItemContext","handleClickGroup","chevronComponent","useMemo","chevronSource","ChevronSmallDownIcon","ChevronSmallRightIcon","showChevron","createElement","ChevronWrapper","StyledIcon","source","size","IconSize","XS","color","leftComponent","LeftContentWrapper","isIcon","isBezierIcon","iconProps","classNames","S","Icon","Object","assign","Fragment","ContentComponent","ContentWrapper","Items","map","index","passedContext","OutlineItemContextProvider","value","GroupItemWrapper","ref","target","rel","forwardRef"],"mappings":";;;;;;;;;;;;;AAkCA,MAAMA,uBAAuB,GAAG,EAAE,CAAA;AAE3B,MAAMC,oBAAoB,GAAG,4BAA2B;AACxD,MAAMC,8BAA8B,GAAG,sCAAqC;AAEnF,SAASC,WAAWA,CAClB;EACEC,EAAE;AACFC,EAAAA,MAAM,GAAGJ,oBAAoB;AAC7BK,EAAAA,cAAc,GAAGJ,8BAA8B;EAC/CK,KAAK;EACLC,SAAS;EACTC,aAAa;EACbC,gBAAgB;EAChBC,oBAAoB;EACpBC,aAAa;EACbC,iBAAiB;AACjBC,EAAAA,WAAW,EAAEC,gBAAgB;AAC7BC,EAAAA,IAAI,GAAG,KAAK;AACZC,EAAAA,MAAM,EAAEC,WAAW;AACnBC,EAAAA,OAAO,GAAG,KAAK;EACfC,WAAW;EACXC,QAAQ;AACRC,EAAAA,aAAa,GAAG,gBAAgB;AAChCC,EAAAA,cAAc,GAAG,KAAK;AACtBC,EAAAA,iBAAiB,GAAG,KAAK;EACzBC,IAAI;EACJC,IAAI;AACJC,EAAAA,OAAO,GAAG,IAAI;AACdC,EAAAA,YAAY,GAAG,IAAI;AACnBC,EAAAA,IAAI,GAAG,KAAK;AACZC,EAAAA,MAAM,GAAGC,kBAAI;AACbC,EAAAA,YAAY,GAAGD,kBAAI;AACnB;AACAE,EAAAA,wBAAwB,GAAG,IAAI;AAC/BC,EAAAA,cAAc,GAAGH,kBAAI;AACrB;EACAI,OAAO,EAAEC,YAAY,GAAGL,kBAAI;AAC5BM,EAAAA,QAAAA;AACgB,CAAC,EACnBC,YAAoC,EACpC;EACA,MAAM,CAACC,uBAAuB,EAAEC,0BAA0B,CAAC,GAAGC,cAAQ,CAAgBR,wBAAwB,CAAC,CAAA;AAE/GS,EAAA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