no-frills-ui 0.0.14-alpha.8 → 0.0.14-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/README.md +2 -3
  2. package/dist/index.js +841 -710
  3. package/dist/index.js.map +1 -1
  4. package/lib-esm/components/Accordion/Accordion.d.ts +9 -13
  5. package/lib-esm/components/Accordion/Accordion.js +3 -10
  6. package/lib-esm/components/Accordion/Accordion.js.map +1 -1
  7. package/lib-esm/components/Accordion/AccordionStep.d.ts +22 -22
  8. package/lib-esm/components/Accordion/AccordionStep.js +33 -28
  9. package/lib-esm/components/Accordion/AccordionStep.js.map +1 -1
  10. package/lib-esm/components/Badge/Badge.d.ts +13 -16
  11. package/lib-esm/components/Badge/Badge.js +10 -20
  12. package/lib-esm/components/Badge/Badge.js.map +1 -1
  13. package/lib-esm/components/Button/ActionButton.d.ts +9 -5
  14. package/lib-esm/components/Button/ActionButton.js +18 -3
  15. package/lib-esm/components/Button/ActionButton.js.map +1 -1
  16. package/lib-esm/components/Button/Button.d.ts +9 -5
  17. package/lib-esm/components/Button/Button.js +17 -5
  18. package/lib-esm/components/Button/Button.js.map +1 -1
  19. package/lib-esm/components/Button/IconButton.d.ts +9 -5
  20. package/lib-esm/components/Button/IconButton.js +18 -3
  21. package/lib-esm/components/Button/IconButton.js.map +1 -1
  22. package/lib-esm/components/Button/LinkButton.d.ts +9 -5
  23. package/lib-esm/components/Button/LinkButton.js +18 -3
  24. package/lib-esm/components/Button/LinkButton.js.map +1 -1
  25. package/lib-esm/components/Button/RaisedButton.d.ts +9 -5
  26. package/lib-esm/components/Button/RaisedButton.js +18 -3
  27. package/lib-esm/components/Button/RaisedButton.js.map +1 -1
  28. package/lib-esm/components/Card/Card.d.ts +4 -6
  29. package/lib-esm/components/Card/Card.js +16 -3
  30. package/lib-esm/components/Card/Card.js.map +1 -1
  31. package/lib-esm/components/Chip/Chip.d.ts +2 -2
  32. package/lib-esm/components/Chip/Chip.js +14 -8
  33. package/lib-esm/components/Chip/Chip.js.map +1 -1
  34. package/lib-esm/components/ChipInput/ChipInput.d.ts +28 -39
  35. package/lib-esm/components/ChipInput/ChipInput.js +35 -36
  36. package/lib-esm/components/ChipInput/ChipInput.js.map +1 -1
  37. package/lib-esm/components/Dialog/AlertDialog.d.ts +11 -12
  38. package/lib-esm/components/Dialog/AlertDialog.js +4 -11
  39. package/lib-esm/components/Dialog/AlertDialog.js.map +1 -1
  40. package/lib-esm/components/Dialog/ConfirmDialog.d.ts +13 -14
  41. package/lib-esm/components/Dialog/ConfirmDialog.js +4 -12
  42. package/lib-esm/components/Dialog/ConfirmDialog.js.map +1 -1
  43. package/lib-esm/components/Dialog/Dialog.d.ts +8 -14
  44. package/lib-esm/components/Dialog/Dialog.js +11 -9
  45. package/lib-esm/components/Dialog/Dialog.js.map +1 -1
  46. package/lib-esm/components/Dialog/PromptDialog.d.ts +18 -19
  47. package/lib-esm/components/Dialog/PromptDialog.js +10 -18
  48. package/lib-esm/components/Dialog/PromptDialog.js.map +1 -1
  49. package/lib-esm/components/DragAndDrop/DragAndDrop.d.ts +37 -59
  50. package/lib-esm/components/DragAndDrop/DragAndDrop.js +23 -26
  51. package/lib-esm/components/DragAndDrop/DragAndDrop.js.map +1 -1
  52. package/lib-esm/components/DragAndDrop/DragItem.d.ts +2 -2
  53. package/lib-esm/components/DragAndDrop/DragItem.js +40 -38
  54. package/lib-esm/components/DragAndDrop/DragItem.js.map +1 -1
  55. package/lib-esm/components/DragAndDrop/types.d.ts +3 -3
  56. package/lib-esm/components/DragAndDrop/types.js.map +1 -1
  57. package/lib-esm/components/Drawer/Drawer.d.ts +24 -31
  58. package/lib-esm/components/Drawer/Drawer.js +49 -45
  59. package/lib-esm/components/Drawer/Drawer.js.map +1 -1
  60. package/lib-esm/components/Groups/Group.d.ts +6 -8
  61. package/lib-esm/components/Groups/Group.js +12 -10
  62. package/lib-esm/components/Groups/Group.js.map +1 -1
  63. package/lib-esm/components/Input/Checkbox.d.ts +12 -15
  64. package/lib-esm/components/Input/Checkbox.js +30 -26
  65. package/lib-esm/components/Input/Checkbox.js.map +1 -1
  66. package/lib-esm/components/Input/Dropdown.d.ts +8 -18
  67. package/lib-esm/components/Input/Dropdown.js +42 -17
  68. package/lib-esm/components/Input/Dropdown.js.map +1 -1
  69. package/lib-esm/components/Input/Input.d.ts +8 -3
  70. package/lib-esm/components/Input/Input.js +20 -19
  71. package/lib-esm/components/Input/Input.js.map +1 -1
  72. package/lib-esm/components/Input/Radio.d.ts +4 -8
  73. package/lib-esm/components/Input/Radio.js +16 -13
  74. package/lib-esm/components/Input/Radio.js.map +1 -1
  75. package/lib-esm/components/Input/RadioButton.d.ts +4 -8
  76. package/lib-esm/components/Input/RadioButton.js +15 -12
  77. package/lib-esm/components/Input/RadioButton.js.map +1 -1
  78. package/lib-esm/components/Input/Select.d.ts +6 -13
  79. package/lib-esm/components/Input/Select.js +21 -18
  80. package/lib-esm/components/Input/Select.js.map +1 -1
  81. package/lib-esm/components/Input/TextArea.d.ts +6 -13
  82. package/lib-esm/components/Input/TextArea.js +29 -24
  83. package/lib-esm/components/Input/TextArea.js.map +1 -1
  84. package/lib-esm/components/Input/Toggle.d.ts +4 -9
  85. package/lib-esm/components/Input/Toggle.js +12 -10
  86. package/lib-esm/components/Input/Toggle.js.map +1 -1
  87. package/lib-esm/components/Menu/Menu.d.ts +4 -14
  88. package/lib-esm/components/Menu/Menu.js +24 -16
  89. package/lib-esm/components/Menu/Menu.js.map +1 -1
  90. package/lib-esm/components/Menu/MenuContext.d.ts +4 -4
  91. package/lib-esm/components/Menu/MenuContext.js +1 -0
  92. package/lib-esm/components/Menu/MenuContext.js.map +1 -1
  93. package/lib-esm/components/Menu/MenuItem.d.ts +10 -4
  94. package/lib-esm/components/Menu/MenuItem.js +19 -5
  95. package/lib-esm/components/Menu/MenuItem.js.map +1 -1
  96. package/lib-esm/components/Modal/Modal.d.ts +17 -23
  97. package/lib-esm/components/Modal/Modal.js +37 -34
  98. package/lib-esm/components/Modal/Modal.js.map +1 -1
  99. package/lib-esm/components/Notification/Notification.d.ts +39 -34
  100. package/lib-esm/components/Notification/Notification.js +16 -39
  101. package/lib-esm/components/Notification/Notification.js.map +1 -1
  102. package/lib-esm/components/Notification/NotificationManager.d.ts +4 -4
  103. package/lib-esm/components/Notification/NotificationManager.js +18 -14
  104. package/lib-esm/components/Notification/NotificationManager.js.map +1 -1
  105. package/lib-esm/components/Notification/index.d.ts +1 -0
  106. package/lib-esm/components/Notification/style.d.ts +2 -3
  107. package/lib-esm/components/Notification/style.js +11 -11
  108. package/lib-esm/components/Notification/style.js.map +1 -1
  109. package/lib-esm/components/Popover/Popover.d.ts +21 -20
  110. package/lib-esm/components/Popover/Popover.js +42 -44
  111. package/lib-esm/components/Popover/Popover.js.map +1 -1
  112. package/lib-esm/components/Spinner/Spinner.d.ts +14 -15
  113. package/lib-esm/components/Spinner/Spinner.js +12 -13
  114. package/lib-esm/components/Spinner/Spinner.js.map +1 -1
  115. package/lib-esm/components/Stepper/Step.d.ts +15 -12
  116. package/lib-esm/components/Stepper/Step.js +10 -8
  117. package/lib-esm/components/Stepper/Step.js.map +1 -1
  118. package/lib-esm/components/Stepper/Stepper.d.ts +11 -17
  119. package/lib-esm/components/Stepper/Stepper.js +25 -23
  120. package/lib-esm/components/Stepper/Stepper.js.map +1 -1
  121. package/lib-esm/components/Tabs/Tab.d.ts +10 -16
  122. package/lib-esm/components/Tabs/Tab.js +0 -8
  123. package/lib-esm/components/Tabs/Tab.js.map +1 -1
  124. package/lib-esm/components/Tabs/Tabs.d.ts +11 -22
  125. package/lib-esm/components/Tabs/Tabs.js +39 -31
  126. package/lib-esm/components/Tabs/Tabs.js.map +1 -1
  127. package/lib-esm/components/Toast/Toast.d.ts +7 -7
  128. package/lib-esm/components/Toast/Toast.js +13 -12
  129. package/lib-esm/components/Toast/Toast.js.map +1 -1
  130. package/lib-esm/components/Toast/ToastStory.d.ts +21 -24
  131. package/lib-esm/components/Tooltip/Tooltip.d.ts +11 -14
  132. package/lib-esm/components/Tooltip/Tooltip.js +11 -21
  133. package/lib-esm/components/Tooltip/Tooltip.js.map +1 -1
  134. package/lib-esm/icons/CheckCircle.js +2 -2
  135. package/lib-esm/icons/CheckCircle.js.map +1 -1
  136. package/lib-esm/icons/ErrorOutline.js +2 -2
  137. package/lib-esm/icons/ErrorOutline.js.map +1 -1
  138. package/lib-esm/icons/Info.js +2 -2
  139. package/lib-esm/icons/Info.js.map +1 -1
  140. package/lib-esm/icons/ReportProblem.js +2 -2
  141. package/lib-esm/icons/ReportProblem.js.map +1 -1
  142. package/lib-esm/index.js +43 -0
  143. package/lib-esm/shared/LayerManager.d.ts +5 -4
  144. package/lib-esm/shared/LayerManager.js +123 -111
  145. package/lib-esm/shared/LayerManager.js.map +1 -1
  146. package/lib-esm/shared/styles.js +4 -4
  147. package/lib-esm/shared/styles.js.map +1 -1
  148. package/package.json +66 -31
  149. package/lib-esm/components/index.js +0 -43
  150. /package/lib-esm/{components/index.js.map → index.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.js","sources":["../../../src/components/Input/Checkbox.tsx"],"sourcesContent":["import React, { useCallback } from 'react';\nimport PropTypes from 'prop-types';\nimport styled from '@emotion/styled';\nimport { getThemeValue, THEME_NAME } from '../../shared/constants';\n\nconst Label = styled.label`\n margin: 5px 0;\n position: relative;\n display: inline-flex;\n align-items: center;\n cursor: pointer;\n`;\n\nconst StyledCheckmark = styled.span`\n width: 16px;\n height: 16px;\n border: 1px solid ${getThemeValue(THEME_NAME.BORDER_COLOR)};\n display: inline-block;\n border-radius: 3px;\n margin-right: 5px;\n background-color: ${getThemeValue(THEME_NAME.BACKGROUND)};\n transition: all 0.3s ease;\n position: relative;\n flex-shrink: 0;\n\n &::after {\n content: '';\n width: 3px;\n height: 10px;\n border-right: 2px solid ${getThemeValue(THEME_NAME.TEXT_COLOR_LIGHT)};\n border-bottom: 2px solid ${getThemeValue(THEME_NAME.TEXT_COLOR_LIGHT)};\n position: absolute;\n top: 1px;\n left: 6px;\n opacity: 0;\n transform: rotate(45deg) scale(0);\n transition: all 0.2s ease;\n }\n`;\n\nconst HiddenInput = styled.input`\n opacity: 0;\n width: 0;\n height: 0;\n position: absolute;\n margin: 0;\n\n /** checked */\n &:checked + ${StyledCheckmark} {\n background-color: ${getThemeValue(THEME_NAME.PRIMARY)};\n border-color: ${getThemeValue(THEME_NAME.PRIMARY)};\n }\n\n &:checked + ${StyledCheckmark}::after {\n opacity: 1;\n transform: rotate(45deg) scale(1);\n }\n\n /** indeterminate */\n &:indeterminate + ${StyledCheckmark} {\n background-color: ${getThemeValue(THEME_NAME.PRIMARY)};\n border-color: ${getThemeValue(THEME_NAME.PRIMARY)};\n }\n\n &:indeterminate + ${StyledCheckmark}::after {\n opacity: 1;\n height: 0;\n width: 8px;\n border-right: none;\n border-bottom: 2px solid ${getThemeValue(THEME_NAME.TEXT_COLOR_LIGHT)};\n transform: rotate(0deg) scale(1);\n top: 7px;\n left: 4px;\n }\n\n /** active and focus */\n &:enabled:active + ${StyledCheckmark}, &:focus + ${StyledCheckmark} {\n border-color: ${getThemeValue(THEME_NAME.PRIMARY)};\n box-shadow: 0 0 0 3px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};\n }\n\n &:enabled:active ~ span,\n &:focus ~ span {\n color: ${getThemeValue(THEME_NAME.PRIMARY)};\n }\n\n /** hover */\n &:enabled:hover + ${StyledCheckmark} {\n border-color: ${getThemeValue(THEME_NAME.PRIMARY)};\n }\n\n &:enabled:hover ~ span {\n color: ${getThemeValue(THEME_NAME.PRIMARY)};\n }\n\n /** disabled */\n &:disabled + ${StyledCheckmark} {\n border-color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};\n cursor: not-allowed;\n }\n\n &:disabled ~ span {\n color: ${getThemeValue(THEME_NAME.DISABLED)};\n cursor: not-allowed;\n }\n\n &:checked:disabled + ${StyledCheckmark}, &:indeterminate:disabled + ${StyledCheckmark} {\n background-color: ${getThemeValue(THEME_NAME.DISABLED)};\n }\n`;\n\ntype CheckboxProps = Omit<React.HTMLProps<HTMLInputElement>, 'as'> &\n PropTypes.InferProps<typeof Checkbox.propTypes>;\n\nexport default function Checkbox(props: CheckboxProps) {\n const ref = useCallback(\n (node: unknown) => {\n if (node !== null) {\n if (props.indeterminate) {\n (node as HTMLInputElement).indeterminate = true;\n }\n }\n },\n [props.indeterminate],\n );\n\n return (\n <Label>\n <HiddenInput\n {...props}\n ref={ref}\n type=\"checkbox\"\n aria-checked={props.indeterminate ? 'mixed' : props.checked}\n />\n <StyledCheckmark />\n <span>{props.label}</span>\n </Label>\n );\n}\n\nCheckbox.propTypes = {\n /** Label for the field */\n label: PropTypes.string,\n /** If the field is in indeterminate state */\n indeterminate: PropTypes.bool,\n};\n\nCheckbox.defaultProps = {\n indeterminate: false,\n label: '',\n};\n"],"names":["Label","styled","StyledCheckmark","getThemeValue","THEME_NAME","BORDER_COLOR","BACKGROUND","TEXT_COLOR_LIGHT","HiddenInput","PRIMARY","PRIMARY_LIGHT","DISABLED_BORDER","DISABLED","Checkbox","props","ref","useCallback","node","indeterminate","_jsxs","_jsx","type","aria-checked","checked","span","label","propTypes","PropTypes","string","bool","defaultProps"],"mappings":";;;;;;AAKA,MAAMA,KAAAA,iBAAQC,MAAAA,CAAAA,OAAAA,EAAAA;;;;AAQd,MAAMC,eAAAA,iBAAkBD,MAAAA,CAAAA,MAAAA,EAAAA;;;AAGAE,CAAAA,CAAAA,CAAAA,0CAAAA,EAAAA,aAAAA,CAAcC,UAAAA,CAAWC,YAAY,CAAA,EAAA,4EAAA,EAIrCF,aAAAA,CAAcC,UAAAA,CAAWE,UAAU,CAAA,EAAA,6HAAA,EASzBH,aAAAA,CAAcC,UAAAA,CAAWG,gBAAgB,CAAA,EAAA,2BAAA,EACxCJ,aAAAA,CAAcC,WAAWG,gBAAgB,CAAA,EAAA,2GAAA,CAAA;AAU5E,MAAMC,WAAAA,iBAAcP,MAAA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;AACG,QAAA,IAAIA,SAAS,IAAA,EAAM;YACf,IAAIH,KAAAA,CAAMI,aAAa,EAAE;AACpBD,gBAAAA,IAAAA,CAA0BC,aAAa,GAAG,IAAA;AAC/C,YAAA;AACJ,QAAA;IACJ,CAAA,EACA;AAACJ,QAAAA,KAAAA,CAAMI;AAAc,KAAA,CAAA;AAGzB,IAAA,qBACIC,IAAA,CAACnB,KAAAA,EAAAA;;0BACGoB,GAAA,CAACZ,WAAAA,EAAAA;AACI,gBAAA,GAAGM,KAAK;gBACTC,GAAAA,EAAKA,GAAAA;gBACLM,IAAAA,EAAK,UAAA;AACLC,gBAAAA,cAAAA,EAAcR,KAAAA,CAAMI,aAAa,GAAG,OAAA,GAAUJ,MAAMS;;0BAExDH,GAAA,CAAClB,eAAAA,EAAAA,EAAAA,CAAAA;0BACDkB,GAAA,CAACI,MAAAA,EAAAA;AAAMV,gBAAAA,QAAAA,EAAAA,KAAAA,CAAMW;;;;AAGzB;AAEAZ,QAAAA,CAASa,SAAS,GAAG;+BAEjBD,KAAAA,EAAOE,SAAAA,CAAUC,MAAM;kDAEvBV,aAAAA,EAAeS,SAAAA,CAAUE;AAC7B,CAAA;AAEAhB,QAAAA,CAASiB,YAAY,GAAG;IACpBZ,aAAAA,EAAe,KAAA;IACfO,KAAAA,EAAO;AACX,CAAA;;;;"}
1
+ {"version":3,"file":"Checkbox.js","sources":["../../../src/components/Input/Checkbox.tsx"],"sourcesContent":["import React, { useCallback } from 'react';\nimport styled from '@emotion/styled';\nimport { getThemeValue, THEME_NAME } from '../../shared/constants';\n\nconst Label = styled.label`\n margin: 5px 0;\n position: relative;\n display: inline-flex;\n align-items: center;\n cursor: pointer;\n`;\n\nconst StyledCheckmark = styled.span`\n width: 16px;\n height: 16px;\n border: 1px solid ${getThemeValue(THEME_NAME.BORDER_COLOR)};\n display: inline-block;\n border-radius: 3px;\n margin-right: 5px;\n background-color: ${getThemeValue(THEME_NAME.BACKGROUND)};\n transition: all 0.3s ease;\n position: relative;\n flex-shrink: 0;\n\n &::after {\n content: '';\n width: 3px;\n height: 10px;\n border-right: 2px solid ${getThemeValue(THEME_NAME.TEXT_COLOR_LIGHT)};\n border-bottom: 2px solid ${getThemeValue(THEME_NAME.TEXT_COLOR_LIGHT)};\n position: absolute;\n top: 1px;\n left: 6px;\n opacity: 0;\n transform: rotate(45deg) scale(0);\n transition: all 0.2s ease;\n }\n`;\n\nconst HiddenInput = styled.input`\n opacity: 0;\n width: 0;\n height: 0;\n position: absolute;\n margin: 0;\n\n /** checked */\n &:checked + ${StyledCheckmark} {\n background-color: ${getThemeValue(THEME_NAME.PRIMARY)};\n border-color: ${getThemeValue(THEME_NAME.PRIMARY)};\n }\n\n &:checked + ${StyledCheckmark}::after {\n opacity: 1;\n transform: rotate(45deg) scale(1);\n }\n\n /** indeterminate */\n &:indeterminate + ${StyledCheckmark} {\n background-color: ${getThemeValue(THEME_NAME.PRIMARY)};\n border-color: ${getThemeValue(THEME_NAME.PRIMARY)};\n }\n\n &:indeterminate + ${StyledCheckmark}::after {\n opacity: 1;\n height: 0;\n width: 8px;\n border-right: none;\n border-bottom: 2px solid ${getThemeValue(THEME_NAME.TEXT_COLOR_LIGHT)};\n transform: rotate(0deg) scale(1);\n top: 7px;\n left: 4px;\n }\n\n /** active and focus */\n &:enabled:active + ${StyledCheckmark}, &:focus + ${StyledCheckmark} {\n border-color: ${getThemeValue(THEME_NAME.PRIMARY)};\n box-shadow: 0 0 0 3px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};\n }\n\n &:enabled:active ~ span,\n &:focus ~ span {\n color: ${getThemeValue(THEME_NAME.PRIMARY)};\n }\n\n /** hover */\n &:enabled:hover + ${StyledCheckmark} {\n border-color: ${getThemeValue(THEME_NAME.PRIMARY)};\n }\n\n &:enabled:hover ~ span {\n color: ${getThemeValue(THEME_NAME.PRIMARY)};\n }\n\n /** disabled */\n &:disabled + ${StyledCheckmark} {\n border-color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};\n cursor: not-allowed;\n }\n\n &:disabled ~ span {\n color: ${getThemeValue(THEME_NAME.DISABLED)};\n cursor: not-allowed;\n }\n\n &:checked:disabled + ${StyledCheckmark}, &:indeterminate:disabled + ${StyledCheckmark} {\n background-color: ${getThemeValue(THEME_NAME.DISABLED)};\n }\n`;\n\ntype CheckboxProps = {\n /**\n * Label for the field\n * @default ''\n */\n label?: string;\n /**\n * If the field is in indeterminate state\n * @default false\n */\n indeterminate?: boolean;\n} & React.InputHTMLAttributes<HTMLInputElement>;\n\n/**\n * Checkbox Component\n * @param props - Component props\n * @param fwdRef - Ref forwarded to the underlying HTMLInputElement\n */\nfunction CheckboxComponent(props: CheckboxProps, fwdRef: React.Ref<HTMLInputElement>) {\n const { label = '', indeterminate = false, checked, ...rest } = props;\n\n const ref = useCallback(\n (node: HTMLInputElement | null) => {\n // Ensure the DOM `indeterminate` flag always matches the prop\n if (node) {\n node.indeterminate = !!indeterminate;\n }\n\n // Forward the node (or null) to the parent ref (supports function or ref object)\n if (typeof fwdRef === 'function') {\n fwdRef(node);\n } else if (fwdRef) {\n (fwdRef as React.MutableRefObject<HTMLInputElement | null>).current = node;\n }\n },\n [indeterminate, fwdRef],\n );\n\n return (\n <Label>\n <HiddenInput\n {...rest}\n ref={ref}\n type=\"checkbox\"\n checked={checked}\n aria-checked={indeterminate ? 'mixed' : checked}\n />\n <StyledCheckmark />\n <span>{label}</span>\n </Label>\n );\n}\n\nconst Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(CheckboxComponent);\n\nexport default Checkbox;\n"],"names":["Label","styled","StyledCheckmark","getThemeValue","THEME_NAME","BORDER_COLOR","BACKGROUND","TEXT_COLOR_LIGHT","HiddenInput","PRIMARY","PRIMARY_LIGHT","DISABLED_BORDER","DISABLED","CheckboxComponent","props","fwdRef","label","indeterminate","checked","rest","ref","useCallback","node","current","_jsxs","_jsx","type","aria-checked","span","Checkbox","React","forwardRef"],"mappings":";;;;;AAIA,MAAMA,OAAAA,iBAAQC,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0BACDuB,GAAA,CAACG,MAAAA,EAAAA;AAAMZ,gBAAAA,QAAAA,EAAAA;;;;AAGnB;AAEA,MAAMa,QAAAA,iBAAWC,KAAAA,CAAMC,UAAU,CAAkClB,iBAAAA;;;;"}
@@ -1,9 +1,12 @@
1
1
  import React from 'react';
2
- type DropdownProps<T> = {
2
+ type DropdownProps<T> = React.PropsWithChildren<{
3
3
  /** Value of the control */
4
4
  value?: T | T[];
5
- /** If multiple elements can be selected */
6
- multiSelect: boolean;
5
+ /**
6
+ * If multiple elements can be selected
7
+ * @default false
8
+ */
9
+ multiSelect?: boolean;
7
10
  /** Change handler */
8
11
  onChange?: (v: T | T[]) => void;
9
12
  /** Label of the control */
@@ -14,19 +17,6 @@ type DropdownProps<T> = {
14
17
  required?: boolean;
15
18
  /** Disables the field */
16
19
  disabled?: boolean;
17
- } & React.PropsWithChildren<unknown>;
18
- /**
19
- * Dropdown component that allows selection from a list of options.
20
- * Supports single and multi-select modes.
21
- *
22
- * @template T - The type of the value(s) in the dropdown.
23
- * @param {DropdownProps<T>} props - The properties for the Dropdown component.
24
- * @returns {JSX.Element} The rendered Dropdown component.
25
- */
26
- declare function Dropdown<T extends object>(props: DropdownProps<T>): import("@emotion/react/jsx-runtime").JSX.Element;
27
- declare namespace Dropdown {
28
- var defaultProps: {
29
- multiSelect: boolean;
30
- };
31
- }
20
+ }> & Omit<React.InputHTMLAttributes<HTMLInputElement>, 'value'>;
21
+ declare const Dropdown: <T>(props: DropdownProps<T> & React.RefAttributes<HTMLInputElement>) => React.ReactElement | null;
32
22
  export default Dropdown;
@@ -7,7 +7,7 @@ import Menu from '../Menu/Menu.js';
7
7
  import ExpandMore from '../../icons/ExpandMore.js';
8
8
 
9
9
  const ArrowContainer = /*#__PURE__*/ styled("span", {
10
- target: "elhmc4m0",
10
+ target: "e1d5dyoc0",
11
11
  label: "ArrowContainer"
12
12
  })("position:absolute;right:12px;top:16px;pointer-events:none;");
13
13
  /**
@@ -15,12 +15,17 @@ const ArrowContainer = /*#__PURE__*/ styled("span", {
15
15
  * Supports single and multi-select modes.
16
16
  *
17
17
  * @template T - The type of the value(s) in the dropdown.
18
- * @param {DropdownProps<T>} props - The properties for the Dropdown component.
19
- * @returns {JSX.Element} The rendered Dropdown component.
20
- */ function Dropdown(props) {
21
- const { multiSelect, onChange } = props;
18
+ * @param props - The properties for the Dropdown component.
19
+ * @returns The rendered Dropdown component.
20
+ */ /**
21
+ * Dropdown Component
22
+ * @template T - The type of value(s) in the dropdown.
23
+ * @param props - Component props
24
+ * @param outerRef - Ref forwarded to the underlying HTMLInputElement
25
+ */ function DropdownComponent(props, outerRef) {
26
+ const { multiSelect = false, onChange, children, value: propValue, label, errorText, required, disabled, ...rest } = props;
22
27
  const [open, setOpen] = useState(false);
23
- const [value, setValue] = useState(props.value);
28
+ const [value, setValue] = useState(propValue);
24
29
  const id = React.useId();
25
30
  const menuId = `${id}-menu`;
26
31
  const menuRef = React.useRef(null);
@@ -75,19 +80,40 @@ const ArrowContainer = /*#__PURE__*/ styled("span", {
75
80
  /**
76
81
  * Toggles the dropdown open state on click.
77
82
  */ const clickHandler = ()=>setOpen(true);
78
- const TriggerElement = /*#__PURE__*/ React.forwardRef((passedProps, ref)=>/*#__PURE__*/ jsxs(Fragment, {
83
+ const TriggerElement = /*#__PURE__*/ React.forwardRef((passedProps, ref)=>{
84
+ // Helper to assign both internal triggerRef and external forwarded ref
85
+ const assignRefs = (node)=>{
86
+ triggerRef.current = node;
87
+ if (!outerRef) return;
88
+ if (typeof outerRef === 'function') {
89
+ outerRef(node);
90
+ } else {
91
+ outerRef.current = node;
92
+ }
93
+ };
94
+ // Combine the ref passed by parent with our assignRefs so both are updated
95
+ const combinedRef = (node)=>{
96
+ assignRefs(node);
97
+ if (typeof ref === 'function') {
98
+ ref(node);
99
+ } else if (ref) {
100
+ ref.current = node;
101
+ }
102
+ };
103
+ return /*#__PURE__*/ jsxs(Fragment, {
79
104
  children: [
80
105
  /*#__PURE__*/ jsx(Input, {
106
+ ...rest,
81
107
  ...passedProps,
82
- ref: ref,
108
+ ref: combinedRef,
83
109
  type: "text",
84
110
  value: value && String(value),
85
- label: props.label,
86
- errorText: props.errorText,
111
+ label: label,
112
+ errorText: errorText,
87
113
  onClick: clickHandler,
88
114
  onKeyDown: onKeyDown,
89
- required: props.required,
90
- disabled: props.disabled,
115
+ required: required,
116
+ disabled: disabled,
91
117
  readOnly: true,
92
118
  role: "combobox",
93
119
  "aria-haspopup": "listbox",
@@ -99,7 +125,8 @@ const ArrowContainer = /*#__PURE__*/ styled("span", {
99
125
  children: /*#__PURE__*/ jsx(ExpandMore, {})
100
126
  })
101
127
  ]
102
- }));
128
+ });
129
+ });
103
130
  TriggerElement.displayName = 'DropdownTrigger';
104
131
  return /*#__PURE__*/ jsx(Popover, {
105
132
  position: POPOVER_POSITION.BOTTOM_LEFT,
@@ -115,13 +142,11 @@ const ArrowContainer = /*#__PURE__*/ styled("span", {
115
142
  value: value,
116
143
  multiSelect: multiSelect,
117
144
  onChange: changeHandler,
118
- children: props.children
145
+ children: children
119
146
  })
120
147
  });
121
148
  }
122
- Dropdown.defaultProps = {
123
- multiSelect: false
124
- };
149
+ const Dropdown = /*#__PURE__*/ React.forwardRef(DropdownComponent);
125
150
 
126
151
  export { Dropdown as default };
127
152
  //# sourceMappingURL=Dropdown.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Dropdown.js","sources":["../../../src/components/Input/Dropdown.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport styled from '@emotion/styled';\nimport { ExpandMore } from '../../icons';\nimport { Menu } from '../Menu';\nimport { Popover, POPOVER_POSITION } from '../Popover';\nimport Input from './Input';\n\ntype DropdownProps<T> = {\n /** Value of the control */\n value?: T | T[];\n /** If multiple elements can be selected */\n multiSelect: boolean;\n /** Change handler */\n onChange?: (v: T | T[]) => void;\n /** Label of the control */\n label?: string;\n /** Error message */\n errorText?: string;\n /** Makes field required */\n required?: boolean;\n /** Disables the field */\n disabled?: boolean;\n} & React.PropsWithChildren<unknown>;\n\nconst ArrowContainer = styled.span`\n position: absolute;\n right: 12px;\n top: 16px;\n pointer-events: none;\n`;\n\n/**\n * Dropdown component that allows selection from a list of options.\n * Supports single and multi-select modes.\n *\n * @template T - The type of the value(s) in the dropdown.\n * @param {DropdownProps<T>} props - The properties for the Dropdown component.\n * @returns {JSX.Element} The rendered Dropdown component.\n */\nexport default function Dropdown<T extends object>(props: DropdownProps<T>) {\n const { multiSelect, onChange } = props;\n const [open, setOpen] = useState(false);\n const [value, setValue] = useState(props.value);\n const id = React.useId();\n const menuId = `${id}-menu`;\n const menuRef = React.useRef<HTMLDivElement>(null);\n const triggerRef = React.useRef<HTMLInputElement>(null);\n\n // Focus menu when opened\n useEffect(() => {\n if (open) {\n // Wait for Popover to fully open and focus itself first\n // Then move focus to the first menu item\n const timer = setTimeout(() => {\n const firstItem = menuRef.current?.querySelector('[role=\"option\"]') as HTMLElement;\n if (firstItem) {\n firstItem.focus();\n }\n }, 100); // Wait after Popover has set initial focus\n return () => clearTimeout(timer);\n }\n }, [open]);\n\n /**\n * Handles keydown events on the input trigger.\n * Opens the menu on 'Enter', 'Space', 'ArrowDown', or 'ArrowUp'.\n *\n * @param {React.KeyboardEvent<HTMLInputElement>} e - The keyboard event.\n */\n const onKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (['ArrowDown', 'ArrowUp', 'Enter', ' '].includes(e.key)) {\n e.preventDefault();\n setOpen(true);\n }\n };\n\n /**\n * Handles changes to the dropdown value.\n * Updates local state and calls the external onChange handler.\n * Closes the dropdown if not in multi-select mode.\n *\n * @param {T | T[]} val - The new value(s).\n */\n const changeHandler = (val: T | T[]) => {\n setValue(val);\n onChange?.(val);\n\n // Close dropdown after selection if not multiSelect\n if (!multiSelect) {\n setOpen(false);\n triggerRef.current?.focus();\n }\n };\n\n /**\n * Toggles the dropdown open state on click.\n */\n const clickHandler = () => setOpen(true);\n\n const TriggerElement = React.forwardRef<HTMLInputElement>((passedProps, ref) => (\n <>\n <Input\n {...passedProps}\n ref={ref}\n type=\"text\"\n value={value && String(value)}\n label={props.label}\n errorText={props.errorText}\n onClick={clickHandler}\n onKeyDown={onKeyDown}\n required={props.required}\n disabled={props.disabled}\n readOnly\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-expanded={open}\n aria-controls={menuId}\n />\n <ArrowContainer aria-hidden=\"true\">\n <ExpandMore />\n </ArrowContainer>\n </>\n ));\n TriggerElement.displayName = 'DropdownTrigger';\n\n return (\n <Popover\n position={POPOVER_POSITION.BOTTOM_LEFT}\n open={open}\n element={TriggerElement}\n onClose={() => {\n setOpen(false);\n triggerRef.current?.focus();\n }}\n >\n <Menu\n ref={menuRef}\n id={menuId}\n value={value}\n multiSelect={multiSelect}\n onChange={changeHandler}\n >\n {props.children}\n </Menu>\n </Popover>\n );\n}\n\nDropdown.defaultProps = {\n multiSelect: false,\n};\n"],"names":["ArrowContainer","styled","Dropdown","props","multiSelect","onChange","open","setOpen","useState","value","setValue","id","React","useId","menuId","menuRef","useRef","triggerRef","useEffect","timer","setTimeout","firstItem","current","querySelector","focus","clearTimeout","onKeyDown","e","includes","key","preventDefault","changeHandler","val","clickHandler","TriggerElement","forwardRef","passedProps","ref","_jsxs","_Fragment","_jsx","Input","type","String","label","errorText","onClick","required","disabled","readOnly","role","aria-haspopup","aria-expanded","aria-controls","aria-hidden","ExpandMore","displayName","Popover","position","POPOVER_POSITION","BOTTOM_LEFT","element","onClose","Menu","children","defaultProps"],"mappings":";;;;;;;;AAwBA,MAAMA,cAAAA,iBAAiBC,MAAAA,CAAAA,MAAAA,EAAAA;;;;AAOvB;;;;;;;IAQe,SAASC,QAAAA,CAA2BC,KAAuB,EAAA;AACtE,IAAA,MAAM,EAAEC,WAAW,EAAEC,QAAQ,EAAE,GAAGF,KAAAA;AAClC,IAAA,MAAM,CAACG,IAAAA,EAAMC,OAAAA,CAAQ,GAAGC,QAAAA,CAAS,KAAA,CAAA;AACjC,IAAA,MAAM,CA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,KAAA,CAAA;AACRU,YAAAA,UAAAA,CAAWK,OAAO,EAAEE,KAAAA,EAAAA;AACxB,QAAA,CAAA;AAEA,QAAA,QAAA,gBAAAgB,GAAA,CAACuB,IAAAA,EAAAA;YACG1B,GAAAA,EAAKtB,OAAAA;YACLJ,EAAAA,EAAIG,MAAAA;YACJL,KAAAA,EAAOA,KAAAA;YACPL,WAAAA,EAAaA,WAAAA;YACbC,QAAAA,EAAU0B,aAAAA;AAET5B,YAAAA,QAAAA,EAAAA,KAAAA,CAAM6D;;;AAIvB;AAEA9D,QAAAA,CAAS+D,YAAY,GAAG;IACpB7D,WAAAA,EAAa;AACjB,CAAA;;;;"}
1
+ {"version":3,"file":"Dropdown.js","sources":["../../../src/components/Input/Dropdown.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport styled from '@emotion/styled';\nimport { ExpandMore } from '../../icons';\nimport { Menu } from '../Menu';\nimport { Popover, POPOVER_POSITION } from '../Popover';\nimport Input from './Input';\n\ntype DropdownProps<T> = React.PropsWithChildren<{\n /** Value of the control */\n value?: T | T[];\n /**\n * If multiple elements can be selected\n * @default false\n */\n multiSelect?: boolean;\n /** Change handler */\n onChange?: (v: T | T[]) => void;\n /** Label of the control */\n label?: string;\n /** Error message */\n errorText?: string;\n /** Makes field required */\n required?: boolean;\n /** Disables the field */\n disabled?: boolean;\n}> &\n Omit<React.InputHTMLAttributes<HTMLInputElement>, 'value'>;\n\nconst ArrowContainer = styled.span`\n position: absolute;\n right: 12px;\n top: 16px;\n pointer-events: none;\n`;\n\n/**\n * Dropdown component that allows selection from a list of options.\n * Supports single and multi-select modes.\n *\n * @template T - The type of the value(s) in the dropdown.\n * @param props - The properties for the Dropdown component.\n * @returns The rendered Dropdown component.\n */\n/**\n * Dropdown Component\n * @template T - The type of value(s) in the dropdown.\n * @param props - Component props\n * @param outerRef - Ref forwarded to the underlying HTMLInputElement\n */\nfunction DropdownComponent<T extends object>(\n props: DropdownProps<T>,\n outerRef: React.Ref<HTMLInputElement>,\n) {\n const {\n multiSelect = false,\n onChange,\n children,\n value: propValue,\n label,\n errorText,\n required,\n disabled,\n ...rest\n } = props;\n const [open, setOpen] = useState(false);\n const [value, setValue] = useState<T | T[] | undefined>(propValue);\n const id = React.useId();\n const menuId = `${id}-menu`;\n const menuRef = React.useRef<HTMLDivElement | null>(null);\n const triggerRef = React.useRef<HTMLInputElement | null>(null);\n\n // Focus menu when opened\n useEffect(() => {\n if (open) {\n // Wait for Popover to fully open and focus itself first\n // Then move focus to the first menu item\n const timer = setTimeout(() => {\n const firstItem = menuRef.current?.querySelector('[role=\"option\"]') as HTMLElement;\n if (firstItem) {\n firstItem.focus();\n }\n }, 100); // Wait after Popover has set initial focus\n return () => clearTimeout(timer);\n }\n }, [open]);\n\n /**\n * Handles keydown events on the input trigger.\n * Opens the menu on 'Enter', 'Space', 'ArrowDown', or 'ArrowUp'.\n *\n * @param {React.KeyboardEvent<HTMLInputElement>} e - The keyboard event.\n */\n const onKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (['ArrowDown', 'ArrowUp', 'Enter', ' '].includes(e.key)) {\n e.preventDefault();\n setOpen(true);\n }\n };\n\n /**\n * Handles changes to the dropdown value.\n * Updates local state and calls the external onChange handler.\n * Closes the dropdown if not in multi-select mode.\n *\n * @param {T | T[]} val - The new value(s).\n */\n const changeHandler = (val: T | T[]) => {\n setValue(val);\n onChange?.(val);\n\n // Close dropdown after selection if not multiSelect\n if (!multiSelect) {\n setOpen(false);\n triggerRef.current?.focus();\n }\n };\n\n /**\n * Toggles the dropdown open state on click.\n */\n const clickHandler = () => setOpen(true);\n\n const TriggerElement = React.forwardRef<HTMLInputElement>((passedProps, ref) => {\n // Helper to assign both internal triggerRef and external forwarded ref\n const assignRefs = (node: HTMLInputElement | null) => {\n triggerRef.current = node;\n\n if (!outerRef) return;\n if (typeof outerRef === 'function') {\n outerRef(node);\n } else {\n (outerRef as React.MutableRefObject<HTMLInputElement | null>).current = node;\n }\n };\n\n // Combine the ref passed by parent with our assignRefs so both are updated\n const combinedRef: React.Ref<HTMLInputElement> = (node) => {\n assignRefs(node);\n if (typeof ref === 'function') {\n ref(node);\n } else if (ref) {\n (ref as React.MutableRefObject<HTMLInputElement | null>).current = node;\n }\n };\n\n return (\n <>\n <Input\n {...rest}\n {...passedProps}\n ref={combinedRef}\n type=\"text\"\n value={value && String(value)}\n label={label}\n errorText={errorText}\n onClick={clickHandler}\n onKeyDown={onKeyDown}\n required={required}\n disabled={disabled}\n readOnly\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-expanded={open}\n aria-controls={menuId}\n />\n <ArrowContainer aria-hidden=\"true\">\n <ExpandMore />\n </ArrowContainer>\n </>\n );\n });\n TriggerElement.displayName = 'DropdownTrigger';\n\n return (\n <Popover\n position={POPOVER_POSITION.BOTTOM_LEFT}\n open={open}\n element={TriggerElement}\n onClose={() => {\n setOpen(false);\n triggerRef.current?.focus();\n }}\n >\n <Menu\n ref={menuRef}\n id={menuId}\n value={value}\n multiSelect={multiSelect}\n onChange={changeHandler}\n >\n {children}\n </Menu>\n </Popover>\n );\n}\n\nconst Dropdown = React.forwardRef(DropdownComponent) as <T>(\n props: DropdownProps<T> & React.RefAttributes<HTMLInputElement>,\n) => React.ReactElement | null;\nexport default Dropdown;\n"],"names":["ArrowContainer","styled","DropdownComponent","props","outerRef","multiSelect","onChange","children","value","propValue","label","errorText","required","disabled","rest","open","setOpen","useState","setValue","id","React","useId","menuId","menuRef","useRef","triggerRef","useEffect","timer","setTimeout","firstItem","current","querySelector","focus","clearTimeout","onKeyDown","e","includes","key","preventDefault","changeHandler","val","clickHandler","TriggerElement","forwardRef","passedProps","ref","assignRefs","node","combinedRef","_jsxs","_Fragment","_jsx","Input","type","String","onClick","readOnly","role","aria-haspopup","aria-expanded","aria-controls","aria-hidden","ExpandMore","displayName","Popover","position","POPOVER_POSITION","BOTTOM_LEFT","element","onClose","Menu","Dropdown"],"mappings":";;;;;;;;AA4BA,MAAMA,cAA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OA,KAAAA;YACPH,WAAAA,EAAaA,WAAAA;YACbC,QAAAA,EAAUiC,aAAAA;AAEThC,YAAAA,QAAAA,EAAAA;;;AAIjB;AAEA,MAAMgE,QAAAA,iBAAWnD,KAAAA,CAAMuB,UAAU,CAACzC,iBAAAA;;;;"}
@@ -1,9 +1,14 @@
1
1
  import React from 'react';
2
- type InputProps = React.AllHTMLAttributes<HTMLInputElement> & {
2
+ type InputProps = {
3
3
  /** Label for the field */
4
4
  label?: string;
5
- /** Error message for the field */
5
+ /** Error text to be shown below the field */
6
6
  errorText?: string;
7
- };
7
+ } & React.AllHTMLAttributes<HTMLInputElement>;
8
+ /**
9
+ * Input Component
10
+ * @param props - Component props
11
+ * @param ref - Ref forwarded to the underlying HTMLInputElement
12
+ */
8
13
  declare const Input: React.ForwardRefExoticComponent<Omit<InputProps, "as"> & React.RefAttributes<HTMLInputElement>>;
9
14
  export default Input;
@@ -1,15 +1,14 @@
1
1
  import { jsxs, jsx } from '@emotion/react/jsx-runtime';
2
- import React, { useState, useId, useEffect } from 'react';
3
- import PropTypes from 'prop-types';
2
+ import React, { useState, useId, useRef, useEffect } from 'react';
4
3
  import styled from '@emotion/styled';
5
4
  import { getThemeValue, THEME_NAME } from '../../shared/constants.js';
6
5
 
7
- const Label = /*#__PURE__*/ styled("label", {
8
- target: "e1hw2ebx0",
6
+ const Label$5 = /*#__PURE__*/ styled("label", {
7
+ target: "el9i5v60",
9
8
  label: "Label"
10
9
  })("display:inline-flex;flex-direction:column;position:relative;margin:10px 5px;");
11
- const TextField = /*#__PURE__*/ styled("input", {
12
- target: "e1hw2ebx1",
10
+ const TextField$1 = /*#__PURE__*/ styled("input", {
11
+ target: "el9i5v61",
13
12
  label: "TextField"
14
13
  })("outline:none;color:inherit;padding:0 8px;line-height:30px;min-height:30px;width:250px;border-radius:3px;border:1px solid ", getThemeValue(THEME_NAME.BORDER_COLOR), ";display:inline-block;background-color:", getThemeValue(THEME_NAME.BACKGROUND), ";&:focus,&:active{border-color:", getThemeValue(THEME_NAME.PRIMARY), ";box-shadow:0 0 0 4px ", getThemeValue(THEME_NAME.PRIMARY_LIGHT), ";}&:focus + span,&:active + span{color:", getThemeValue(THEME_NAME.PRIMARY), ";}&:disabled{border-color:", getThemeValue(THEME_NAME.DISABLED_BORDER), ";background-color:", getThemeValue(THEME_NAME.DISABLED_BACKGROUND), ";padding:0 8px;}&:disabled + span{color:", getThemeValue(THEME_NAME.DISABLED), ";}&:focus:invalid{border-color:", getThemeValue(THEME_NAME.ERROR), ";box-shadow:0 0 0 4px ", getThemeValue(THEME_NAME.ERROR_LIGHT), ";}", (props)=>props.touched ? `
15
14
  &:invalid {
@@ -33,17 +32,23 @@ const TextField = /*#__PURE__*/ styled("input", {
33
32
  line-height: 14px;
34
33
  }
35
34
  ` : '', " &:focus + span,&:placeholder-shown + span{top:-8px;background:", getThemeValue(THEME_NAME.BACKGROUND), ";font-size:12px;line-height:14px;}");
36
- const ErrorContainer = /*#__PURE__*/ styled("div", {
37
- target: "e1hw2ebx2",
35
+ const ErrorContainer$3 = /*#__PURE__*/ styled("div", {
36
+ target: "el9i5v62",
38
37
  label: "ErrorContainer"
39
38
  })("color:", getThemeValue(THEME_NAME.ERROR), ";padding-top:3px;font-size:12px;line-height:14px;margin-left:3px;");
40
- const Input = /*#__PURE__*/ React.forwardRef((props, ref)=>{
39
+ /**
40
+ * Input Component
41
+ * @param props - Component props
42
+ * @param ref - Ref forwarded to the underlying HTMLInputElement
43
+ */ const Input$2 = /*#__PURE__*/ React.forwardRef((props, ref)=>{
41
44
  const [touched, setTouched] = useState(false);
42
45
  const [value, setValue] = useState(props.value || '');
43
46
  const errorId = useId();
47
+ const prevValueRef = useRef(undefined);
44
48
  useEffect(()=>{
45
- if (props.value !== undefined) {
49
+ if (props.value !== undefined && props.value !== prevValueRef.current) {
46
50
  setValue(props.value);
51
+ prevValueRef.current = props.value;
47
52
  }
48
53
  }, [
49
54
  props.value
@@ -62,9 +67,9 @@ const Input = /*#__PURE__*/ React.forwardRef((props, ref)=>{
62
67
  setValue(e.target.value);
63
68
  }
64
69
  };
65
- return /*#__PURE__*/ jsxs(Label, {
70
+ return /*#__PURE__*/ jsxs(Label$5, {
66
71
  children: [
67
- /*#__PURE__*/ jsx(TextField, {
72
+ /*#__PURE__*/ jsx(TextField$1, {
68
73
  ...props,
69
74
  ref: ref,
70
75
  value: value,
@@ -78,18 +83,14 @@ const Input = /*#__PURE__*/ React.forwardRef((props, ref)=>{
78
83
  /*#__PURE__*/ jsx("span", {
79
84
  children: props.label
80
85
  }),
81
- props.errorText && /*#__PURE__*/ jsx(ErrorContainer, {
86
+ props.errorText && /*#__PURE__*/ jsx(ErrorContainer$3, {
82
87
  id: errorId,
83
88
  children: props.errorText
84
89
  })
85
90
  ]
86
91
  });
87
92
  });
88
- Input.displayName = 'Input';
89
- Input.propTypes = {
90
- /** Label for the field */ label: PropTypes.string,
91
- /** Error text to be shown below the field */ errorText: PropTypes.string
92
- };
93
+ Input$2.displayName = 'Input';
93
94
 
94
- export { Input as default };
95
+ export { Input$2 as default };
95
96
  //# sourceMappingURL=Input.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Input.js","sources":["../../../src/components/Input/Input.tsx"],"sourcesContent":["import React, { useState, useEffect, useId } from 'react';\nimport PropTypes from 'prop-types';\nimport styled from '@emotion/styled';\nimport { getThemeValue, THEME_NAME } from '../../shared/constants';\n\ntype InputProps = React.AllHTMLAttributes<HTMLInputElement> & {\n /** Label for the field */\n label?: string;\n /** Error message for the field */\n errorText?: string;\n};\n\ntype InputInternalProps = InputProps & {\n touched: boolean;\n};\n\nconst Label = styled.label`\n display: inline-flex;\n flex-direction: column;\n position: relative;\n margin: 10px 5px;\n`;\n\nconst TextField = styled.input<InputInternalProps>`\n outline: none;\n color: inherit;\n padding: 0 8px;\n line-height: 30px;\n min-height: 30px;\n width: 250px;\n border-radius: 3px;\n border: 1px solid ${getThemeValue(THEME_NAME.BORDER_COLOR)};\n display: inline-block;\n background-color: ${getThemeValue(THEME_NAME.BACKGROUND)};\n\n /** Focused */\n &:focus,\n &:active {\n border-color: ${getThemeValue(THEME_NAME.PRIMARY)};\n box-shadow: 0 0 0 4px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};\n }\n\n &:focus + span,\n &:active + span {\n color: ${getThemeValue(THEME_NAME.PRIMARY)};\n }\n\n /** Disabled */\n &:disabled {\n border-color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};\n background-color: ${getThemeValue(THEME_NAME.DISABLED_BACKGROUND)};\n padding: 0 8px;\n }\n\n &:disabled + span {\n color: ${getThemeValue(THEME_NAME.DISABLED)};\n }\n\n /** Invalid */\n &:focus:invalid {\n border-color: ${getThemeValue(THEME_NAME.ERROR)};\n box-shadow: 0 0 0 4px ${getThemeValue(THEME_NAME.ERROR_LIGHT)};\n }\n\n ${(props) =>\n props.touched\n ? `\n &:invalid {\n border-color: ${getThemeValue(THEME_NAME.ERROR)};\n }\n\n &:invalid + span {\n color: ${getThemeValue(THEME_NAME.ERROR)};\n }\n `\n : ''}\n\n /** Error */\n ${(props) =>\n props.errorText\n ? `\n border-color: ${getThemeValue(THEME_NAME.ERROR)};\n\n & + span {\n color: ${getThemeValue(THEME_NAME.ERROR)};\n }\n `\n : ''}\n\n /** Required */\n &:required + span:after {\n content: '*';\n margin-left: 2px;\n color: ${getThemeValue(THEME_NAME.ERROR)};\n }\n\n /** Label Animation */\n & + span {\n position: absolute;\n padding: 0 5px;\n top: 0px;\n left: 4px;\n font-size: 14px;\n line-height: 32px;\n transition: all 300ms ease;\n }\n\n ${(props) =>\n props.value !== ''\n ? `\n & + span {\n top: -8px;\n background: ${getThemeValue(THEME_NAME.BACKGROUND)};\n font-size: 12px;\n line-height: 14px;\n }\n `\n : ''}\n\n &:focus + span, &:placeholder-shown + span {\n top: -8px;\n background: ${getThemeValue(THEME_NAME.BACKGROUND)};\n font-size: 12px;\n line-height: 14px;\n }\n`;\n\nconst ErrorContainer = styled.div`\n color: ${getThemeValue(THEME_NAME.ERROR)};\n padding-top: 3px;\n font-size: 12px;\n line-height: 14px;\n margin-left: 3px;\n`;\n\nconst Input = React.forwardRef<HTMLInputElement, Omit<InputProps, 'as'>>((props, ref) => {\n const [touched, setTouched] = useState(false);\n const [value, setValue] = useState(props.value || '');\n const errorId = useId();\n\n useEffect(() => {\n if (props.value !== undefined) {\n setValue(props.value);\n }\n }, [props.value]);\n\n const handleFocus = (e: React.FocusEvent<HTMLInputElement>) => {\n setTouched(true);\n if (props.onFocus) {\n props.onFocus(e);\n }\n };\n\n const onChangeHandler = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (props.onChange) {\n setValue(e.target.value);\n props.onChange(e);\n } else {\n setValue(e.target.value);\n }\n };\n\n return (\n <Label>\n <TextField\n {...props}\n ref={ref}\n value={value}\n onChange={onChangeHandler}\n onFocus={handleFocus}\n touched={touched}\n aria-invalid={!!props.errorText}\n aria-required={props.required}\n aria-describedby={props.errorText ? errorId : undefined}\n />\n <span>{props.label}</span>\n {props.errorText && <ErrorContainer id={errorId}>{props.errorText}</ErrorContainer>}\n </Label>\n );\n});\n\nInput.displayName = 'Input';\n\nexport default Input;\n\nInput.propTypes = {\n /** Label for the field */\n label: PropTypes.string,\n /** Error text to be shown below the field */\n errorText: PropTypes.string,\n};\n"],"names":["Label","styled","TextField","getThemeValue","THEME_NAME","BORDER_COLOR","BACKGROUND","PRIMARY","PRIMARY_LIGHT","DISABLED_BORDER","DISABLED_BACKGROUND","DISABLED","ERROR","ERROR_LIGHT","props","touched","errorText","value","ErrorContainer","Input","React","forwardRef","ref","setTouched","useState","setValue","errorId","useId","useEffect","undefined","handleFocus","e","onFocus","onChangeHandler","onChange","target","_jsxs","_jsx","aria-invalid","aria-required","required","aria-describedby","span","label","id","displayName","propTypes","PropTypes","string"],"mappings":";;;;;;AAgBA,MAAMA,KAAAA,iBAAQC,MAAAA,CAAAA,OAAAA,EAAAA;;;;AAOd,MAAMC,SAAAA,iBAAYD,MAAAA,CAAAA,OAAA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AA;AAC3B,QAAA;AACJ,IAAA,CAAA;AAEA,IAAA,qBACImB,IAAA,CAACpC,KAAAA,EAAAA;;0BACGqC,GAAA,CAACnC,SAAAA,EAAAA;AACI,gBAAA,GAAGY,KAAK;gBACTQ,GAAAA,EAAKA,GAAAA;gBACLL,KAAAA,EAAOA,KAAAA;gBACPiB,QAAAA,EAAUD,eAAAA;gBACVD,OAAAA,EAASF,WAAAA;gBACTf,OAAAA,EAASA,OAAAA;gBACTuB,cAAAA,EAAc,CAAC,CAACxB,KAAAA,CAAME,SAAS;AAC/BuB,gBAAAA,eAAAA,EAAezB,MAAM0B,QAAQ;gBAC7BC,kBAAAA,EAAkB3B,KAAAA,CAAME,SAAS,GAAGU,OAAAA,GAAUG;;0BAElDQ,GAAA,CAACK,MAAAA,EAAAA;AAAM5B,gBAAAA,QAAAA,EAAAA,KAAAA,CAAM6B;;YACZ7B,KAAAA,CAAME,SAAS,kBAAIqB,GAAA,CAACnB,cAAAA,EAAAA;gBAAe0B,EAAAA,EAAIlB,OAAAA;AAAUZ,gBAAAA,QAAAA,EAAAA,KAAAA,CAAME;;;;AAGpE,CAAA;AAEAG,KAAAA,CAAM0B,WAAW,GAAG,OAAA;AAIpB1B,KAAAA,CAAM2B,SAAS,GAAG;+BAEdH,KAAAA,EAAOI,SAAAA,CAAUC,MAAM;kDAEvBhC,SAAAA,EAAW+B,SAAAA,CAAUC;AACzB,CAAA;;;;"}
1
+ {"version":3,"file":"Input.js","sources":["../../../src/components/Input/Input.tsx"],"sourcesContent":["import React, { useState, useEffect, useId, useRef } from 'react';\nimport styled from '@emotion/styled';\nimport { getThemeValue, THEME_NAME } from '../../shared/constants';\n\ntype InputProps = {\n /** Label for the field */\n label?: string;\n /** Error text to be shown below the field */\n errorText?: string;\n} & React.AllHTMLAttributes<HTMLInputElement>;\n\ntype InputInternalProps = InputProps & {\n touched: boolean;\n};\n\nconst Label = styled.label`\n display: inline-flex;\n flex-direction: column;\n position: relative;\n margin: 10px 5px;\n`;\n\nconst TextField = styled.input<InputInternalProps>`\n outline: none;\n color: inherit;\n padding: 0 8px;\n line-height: 30px;\n min-height: 30px;\n width: 250px;\n border-radius: 3px;\n border: 1px solid ${getThemeValue(THEME_NAME.BORDER_COLOR)};\n display: inline-block;\n background-color: ${getThemeValue(THEME_NAME.BACKGROUND)};\n\n /** Focused */\n &:focus,\n &:active {\n border-color: ${getThemeValue(THEME_NAME.PRIMARY)};\n box-shadow: 0 0 0 4px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};\n }\n\n &:focus + span,\n &:active + span {\n color: ${getThemeValue(THEME_NAME.PRIMARY)};\n }\n\n /** Disabled */\n &:disabled {\n border-color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};\n background-color: ${getThemeValue(THEME_NAME.DISABLED_BACKGROUND)};\n padding: 0 8px;\n }\n\n &:disabled + span {\n color: ${getThemeValue(THEME_NAME.DISABLED)};\n }\n\n /** Invalid */\n &:focus:invalid {\n border-color: ${getThemeValue(THEME_NAME.ERROR)};\n box-shadow: 0 0 0 4px ${getThemeValue(THEME_NAME.ERROR_LIGHT)};\n }\n\n ${(props) =>\n props.touched\n ? `\n &:invalid {\n border-color: ${getThemeValue(THEME_NAME.ERROR)};\n }\n\n &:invalid + span {\n color: ${getThemeValue(THEME_NAME.ERROR)};\n }\n `\n : ''}\n\n /** Error */\n ${(props) =>\n props.errorText\n ? `\n border-color: ${getThemeValue(THEME_NAME.ERROR)};\n\n & + span {\n color: ${getThemeValue(THEME_NAME.ERROR)};\n }\n `\n : ''}\n\n /** Required */\n &:required + span:after {\n content: '*';\n margin-left: 2px;\n color: ${getThemeValue(THEME_NAME.ERROR)};\n }\n\n /** Label Animation */\n & + span {\n position: absolute;\n padding: 0 5px;\n top: 0px;\n left: 4px;\n font-size: 14px;\n line-height: 32px;\n transition: all 300ms ease;\n }\n\n ${(props) =>\n props.value !== ''\n ? `\n & + span {\n top: -8px;\n background: ${getThemeValue(THEME_NAME.BACKGROUND)};\n font-size: 12px;\n line-height: 14px;\n }\n `\n : ''}\n\n &:focus + span, &:placeholder-shown + span {\n top: -8px;\n background: ${getThemeValue(THEME_NAME.BACKGROUND)};\n font-size: 12px;\n line-height: 14px;\n }\n`;\n\nconst ErrorContainer = styled.div`\n color: ${getThemeValue(THEME_NAME.ERROR)};\n padding-top: 3px;\n font-size: 12px;\n line-height: 14px;\n margin-left: 3px;\n`;\n\n/**\n * Input Component\n * @param props - Component props\n * @param ref - Ref forwarded to the underlying HTMLInputElement\n */\nconst Input = React.forwardRef<HTMLInputElement, Omit<InputProps, 'as'>>((props, ref) => {\n const [touched, setTouched] = useState(false);\n const [value, setValue] = useState(props.value || '');\n const errorId = useId();\n const prevValueRef = useRef<string>(undefined);\n\n useEffect(() => {\n if (props.value !== undefined && props.value !== prevValueRef.current) {\n setValue(props.value);\n prevValueRef.current = props.value as string;\n }\n }, [props.value]);\n\n const handleFocus = (e: React.FocusEvent<HTMLInputElement>) => {\n setTouched(true);\n if (props.onFocus) {\n props.onFocus(e);\n }\n };\n\n const onChangeHandler = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (props.onChange) {\n setValue(e.target.value);\n props.onChange(e);\n } else {\n setValue(e.target.value);\n }\n };\n\n return (\n <Label>\n <TextField\n {...props}\n ref={ref}\n value={value}\n onChange={onChangeHandler}\n onFocus={handleFocus}\n touched={touched}\n aria-invalid={!!props.errorText}\n aria-required={props.required}\n aria-describedby={props.errorText ? errorId : undefined}\n />\n <span>{props.label}</span>\n {props.errorText && <ErrorContainer id={errorId}>{props.errorText}</ErrorContainer>}\n </Label>\n );\n});\n\nInput.displayName = 'Input';\nexport default Input;\n"],"names":["Label","styled","TextField","getThemeValue","THEME_NAME","BORDER_COLOR","BACKGROUND","PRIMARY","PRIMARY_LIGHT","DISABLED_BORDER","DISABLED_BACKGROUND","DISABLED","ERROR","ERROR_LIGHT","props","touched","errorText","value","ErrorContainer","Input","React","forwardRef","ref","setTouched","useState","setValue","errorId","useId","prevValueRef","useRef","undefined","useEffect","current","handleFocus","e","onFocus","onChangeHandler","onChange","target","_jsxs","_jsx","aria-invalid","aria-required","required","aria-describedby","span","label","id","displayName"],"mappings":";;;;;AAeA,MAAMA,OAAAA,iBAAQC,MAAAA,CAAAA,OAAAA,EAAAA;;;;AAOd,MAAMC,WAAAA,iBAAYD,MAAAA,CAAAA,OAAAA,EAAAA;;;gIAQME,aAAAA,CAAcC,UAAAA,CAAWC,YAAY,CAAA,EAAA,yCAAA,EAErCF,aAAAA,CAAcC,WAAWE,UAAU,CAAA,EAAA,iCAAA,EAKnCH,cAAcC,UAAAA,CAAWG,OAAO,6BACxBJ,aAAAA,CAAcC,UAAAA,CAAWI,aAAa,CAAA,EAAA,yCAAA,EAKrDL,aAAAA,CAAcC,WAAWG,OAAO,CAAA,EAAA,4BAAA,EAKzBJ,cAAcC,UAAAA,CAAWK,eAAe,yBACpCN,aAAAA,CAAcC,UAAAA,CAAWM,mBAAmB,CAAA,EAAA,0CAAA,EAKvDP,aAAAA,CAAcC,WAAWO,QAAQ,CAAA,EAAA,iCAAA,EAK1BR,cAAcC,UAAAA,CAAWQ,KAAK,6BACtBT,aAAAA,CAAcC,UAAAA,CAAWS,WAAW,CAAA,EAAA,IAAA,EAG9D,CAACC,QACCA,KAAAA,CAAMC,OAAO,GACP;;sBAEQ,EAAEZ,aAAAA,CAAcC,UAAAA,CAAWQ,KAAK,CAAA,CAAE;;;;eAIzC,EAAET,aAAAA,CAAcC,UAAAA,CAAWQ,KAAK,CAAA,CAAE;;AAE7C,IAAA,CAAC,GACS,EAAA,EAAA,YAAA,EAGR,CAACE,QACCA,KAAAA,CAAME,SAAS,GACT;kBACI,EAAEb,aAAAA,CAAcC,UAAAA,CAAWQ,KAAK,CAAA,CAAE;;;eAGrC,EAAET,aAAAA,CAAcC,UAAAA,CAAWQ,KAAK,CAAA,CAAE;;AAE7C,IAAA,CAAC,GACS,EAAA,EAAA,sEAAA,EAMGT,aAAAA,CAAcC,UAAAA,CAAWQ,KAAK,CA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AAMqB,OAAO,EAAE;AACfrB,YAAAA,KAAAA,CAAMqB,OAAO,CAACD,CAAAA,CAAAA;AAClB,QAAA;AACJ,IAAA,CAAA;AAEA,IAAA,MAAME,kBAAkB,CAACF,CAAAA,GAAAA;QACrB,IAAIpB,KAAAA,CAAMuB,QAAQ,EAAE;YAChBZ,QAAAA,CAASS,CAAAA,CAAEI,MAAM,CAACrB,KAAK,CAAA;AACvBH,YAAAA,KAAAA,CAAMuB,QAAQ,CAACH,CAAAA,CAAAA;QACnB,CAAA,MAAO;YACHT,QAAAA,CAASS,CAAAA,CAAEI,MAAM,CAACrB,KAAK,CAAA;AAC3B,QAAA;AACJ,IAAA,CAAA;AAEA,IAAA,qBACIsB,IAAA,CAACvC,OAAAA,EAAAA;;0BACGwC,GAAA,CAACtC,WAAAA,EAAAA;AACI,gBAAA,GAAGY,KAAK;gBACTQ,GAAAA,EAAKA,GAAAA;gBACLL,KAAAA,EAAOA,KAAAA;gBACPoB,QAAAA,EAAUD,eAAAA;gBACVD,OAAAA,EAASF,WAAAA;gBACTlB,OAAAA,EAASA,OAAAA;gBACT0B,cAAAA,EAAc,CAAC,CAAC3B,KAAAA,CAAME,SAAS;AAC/B0B,gBAAAA,eAAAA,EAAe5B,MAAM6B,QAAQ;gBAC7BC,kBAAAA,EAAkB9B,KAAAA,CAAME,SAAS,GAAGU,OAAAA,GAAUI;;0BAElDU,GAAA,CAACK,MAAAA,EAAAA;AAAM/B,gBAAAA,QAAAA,EAAAA,KAAAA,CAAMgC;;YACZhC,KAAAA,CAAME,SAAS,kBAAIwB,GAAA,CAACtB,gBAAAA,EAAAA;gBAAe6B,EAAAA,EAAIrB,OAAAA;AAAUZ,gBAAAA,QAAAA,EAAAA,KAAAA,CAAME;;;;AAGpE,CAAA;AAEAG,OAAAA,CAAM6B,WAAW,GAAG,OAAA;;;;"}
@@ -1,10 +1,6 @@
1
1
  import React from 'react';
2
- import PropTypes from 'prop-types';
3
- declare function Radio(props: PropTypes.InferProps<React.AllHTMLAttributes<HTMLInputElement> & typeof Radio.propTypes>): import("@emotion/react/jsx-runtime").JSX.Element;
4
- declare namespace Radio {
5
- var propTypes: {
6
- /** Label for the field */
7
- label: PropTypes.Requireable<string>;
8
- };
9
- }
2
+ declare const Radio: React.ForwardRefExoticComponent<{
3
+ /** Label for the field */
4
+ label?: string;
5
+ } & React.InputHTMLAttributes<HTMLInputElement> & React.RefAttributes<HTMLInputElement>>;
10
6
  export default Radio;
@@ -1,38 +1,41 @@
1
1
  import { jsxs, jsx } from '@emotion/react/jsx-runtime';
2
- import 'react';
3
- import PropTypes from 'prop-types';
2
+ import React from 'react';
4
3
  import styled from '@emotion/styled';
5
4
  import { getThemeValue, THEME_NAME } from '../../shared/constants.js';
6
5
 
7
- const Label = /*#__PURE__*/ styled("label", {
8
- target: "e1ji8xn0",
6
+ const Label$1 = /*#__PURE__*/ styled("label", {
7
+ target: "e12cx2u30",
9
8
  label: "Label"
10
9
  })("display:inline-flex;align-items:center;margin:5px 0;cursor:pointer;position:relative;");
11
10
  const StyledRadio = /*#__PURE__*/ styled("span", {
12
- target: "e1ji8xn1",
11
+ target: "e12cx2u31",
13
12
  label: "StyledRadio"
14
13
  })("width:16px;height:16px;margin-right:5px;border:1px solid ", getThemeValue(THEME_NAME.BORDER_COLOR), ";border-radius:50%;display:block;transition:background-color 0.3s ease;position:relative;flex-shrink:0;&::after{content:'';width:100%;height:100%;border-radius:50%;position:absolute;top:0;left:0;box-shadow:inset 0 0 0 3px ", getThemeValue(THEME_NAME.BACKGROUND), ";opacity:0;transition:opacity 0.2s ease;}");
15
14
  const HiddenInput = /*#__PURE__*/ styled("input", {
16
- target: "e1ji8xn2",
15
+ target: "e12cx2u32",
17
16
  label: "HiddenInput"
18
17
  })("opacity:0;width:0;height:0;position:absolute;margin:0;&:checked + ", StyledRadio, "{border-color:", getThemeValue(THEME_NAME.PRIMARY), ";background-color:", getThemeValue(THEME_NAME.PRIMARY), ";}&:checked + ", StyledRadio, "::after{opacity:1;}&:enabled:focus + ", StyledRadio, "{border-color:", getThemeValue(THEME_NAME.PRIMARY), ";box-shadow:0 0 0 3px ", getThemeValue(THEME_NAME.PRIMARY_LIGHT), ";}&:enabled:checked:focus + ", StyledRadio, "{border-color:", getThemeValue(THEME_NAME.PRIMARY), ";box-shadow:0 0 0 3px ", getThemeValue(THEME_NAME.PRIMARY_LIGHT), ";}&:enabled:hover + ", StyledRadio, "{border-color:", getThemeValue(THEME_NAME.PRIMARY), ";}&:enabled:hover ~ span{color:", getThemeValue(THEME_NAME.PRIMARY), ";}&:disabled + ", StyledRadio, "{border-color:", getThemeValue(THEME_NAME.DISABLED_BORDER), ";background-color:", getThemeValue(THEME_NAME.LIGHT_GREY), ";cursor:not-allowed;}&:disabled:checked + ", StyledRadio, "{border-color:", getThemeValue(THEME_NAME.DISABLED_BORDER), ";background-color:", getThemeValue(THEME_NAME.DISABLED_BORDER), ";}&:disabled ~ span{color:", getThemeValue(THEME_NAME.DISABLED_BORDER), ";cursor:not-allowed;}");
19
- function Radio(props) {
20
- return /*#__PURE__*/ jsxs(Label, {
18
+ /**
19
+ * Radio Component
20
+ * @param props - Component props
21
+ * @param ref - Ref forwarded to the underlying HTMLInputElement
22
+ */ function RadioComponent(props, ref) {
23
+ const { label, ...rest } = props;
24
+ return /*#__PURE__*/ jsxs(Label$1, {
21
25
  children: [
22
26
  /*#__PURE__*/ jsx(HiddenInput, {
23
- ...props,
27
+ ...rest,
28
+ ref: ref,
24
29
  type: "radio"
25
30
  }),
26
31
  /*#__PURE__*/ jsx(StyledRadio, {}),
27
32
  /*#__PURE__*/ jsx("span", {
28
- children: props.label
33
+ children: label
29
34
  })
30
35
  ]
31
36
  });
32
37
  }
33
- Radio.propTypes = {
34
- /** Label for the field */ label: PropTypes.string
35
- };
38
+ const Radio = /*#__PURE__*/ React.forwardRef(RadioComponent);
36
39
 
37
40
  export { Radio as default };
38
41
  //# sourceMappingURL=Radio.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Radio.js","sources":["../../../src/components/Input/Radio.tsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport styled from '@emotion/styled';\nimport { getThemeValue, THEME_NAME } from '../../shared/constants';\n\nconst Label = styled.label`\n display: inline-flex;\n align-items: center;\n margin: 5px 0;\n cursor: pointer;\n position: relative;\n`;\n\nconst StyledRadio = styled.span`\n width: 16px;\n height: 16px;\n margin-right: 5px;\n border: 1px solid ${getThemeValue(THEME_NAME.BORDER_COLOR)};\n border-radius: 50%;\n display: block;\n transition: background-color 0.3s ease;\n position: relative;\n flex-shrink: 0;\n\n &::after {\n content: '';\n width: 100%;\n height: 100%;\n border-radius: 50%;\n position: absolute;\n top: 0;\n left: 0;\n box-shadow: inset 0 0 0 3px ${getThemeValue(THEME_NAME.BACKGROUND)};\n opacity: 0;\n transition: opacity 0.2s ease;\n }\n`;\n\nconst HiddenInput = styled.input`\n opacity: 0;\n width: 0;\n height: 0;\n position: absolute;\n margin: 0;\n\n /* checked */\n &:checked + ${StyledRadio} {\n border-color: ${getThemeValue(THEME_NAME.PRIMARY)};\n background-color: ${getThemeValue(THEME_NAME.PRIMARY)};\n }\n\n &:checked + ${StyledRadio}::after {\n opacity: 1;\n }\n\n /* focus */\n &:enabled:focus + ${StyledRadio} {\n border-color: ${getThemeValue(THEME_NAME.PRIMARY)};\n box-shadow: 0 0 0 3px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};\n }\n\n &:enabled:checked:focus + ${StyledRadio} {\n border-color: ${getThemeValue(THEME_NAME.PRIMARY)};\n box-shadow: 0 0 0 3px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};\n }\n\n /* hover */\n &:enabled:hover + ${StyledRadio} {\n border-color: ${getThemeValue(THEME_NAME.PRIMARY)};\n }\n\n &:enabled:hover ~ span {\n color: ${getThemeValue(THEME_NAME.PRIMARY)};\n }\n\n /* disabled */\n &:disabled + ${StyledRadio} {\n border-color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};\n background-color: ${getThemeValue(THEME_NAME.LIGHT_GREY)};\n cursor: not-allowed;\n }\n\n &:disabled:checked + ${StyledRadio} {\n border-color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};\n background-color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};\n }\n\n &:disabled ~ span {\n color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};\n cursor: not-allowed;\n }\n`;\n\nfunction Radio(\n props: PropTypes.InferProps<React.AllHTMLAttributes<HTMLInputElement> & typeof Radio.propTypes>,\n) {\n return (\n <Label>\n <HiddenInput {...props} type=\"radio\" />\n <StyledRadio />\n <span>{props.label}</span>\n </Label>\n );\n}\n\nRadio.propTypes = {\n /** Label for the field */\n label: PropTypes.string,\n};\n\nexport default Radio;\n"],"names":["Label","styled","StyledRadio","getThemeValue","THEME_NAME","BORDER_COLOR","BACKGROUND","HiddenInput","PRIMARY","PRIMARY_LIGHT","DISABLED_BORDER","LIGHT_GREY","Radio","props","_jsxs","_jsx","type","span","label","propTypes","PropTypes","string"],"mappings":";;;;;;AAKA,MAAMA,KAAAA,iBAAQC,MAAAA,CAAAA,OAAAA,EAAAA;;;;AAQd,MAAMC,WAAAA,iBAAcD,MAAAA,CAAAA,MAAAA,EAAAA;;;AAIIE,CAAAA,CAAAA,CAAAA,2DAAAA,EAAAA,aAAAA,CAAcC,UAAAA,CAAWC,YAAY,CAAA,EAAA,gOAAA,EAevBF,aAAAA,CAAcC,WAAWE,UAAU,CAAA,EAAA,2CAAA,CAAA;AAMzE,MAAMC,WAAAA,iBAAcN,MAAAA,CAAAA,OAAAA,EAAAA;;;yEAQFC,WAAAA,EAAAA,gBAAAA,EACMC,aAAAA,CAAcC,UAAAA,CAAWI,OAAO,CAAA,EAAA,oBAAA,EAC5BL,aAAAA,CAAcC,UAAAA,CAAWI,OAAO,CAAA,EAAA,gBAAA,EAG1CN,WAAAA,EAAAA,uCAAAA,EAKMA,WAAAA,EAAAA,gBAAAA,EACAC,aAAAA,CAAcC,UAAAA,CAAWI,OAAO,6BACxBL,aAAAA,CAAcC,UAAAA,CAAWK,aAAa,CAAA,EAAA,8BAAA,EAGtCP,WAAAA,EAAAA,gBAAAA,EACRC,aAAAA,CAAcC,UAAAA,CAAWI,OAAO,CAAA,EAAA,wBAAA,EACxBL,aAAAA,CAAcC,UAAAA,CAAWK,aAAa,CAAA,EAAA,sBAAA,EAI9CP,WAAAA,EAAAA,gBAAAA,EACAC,cAAcC,UAAAA,CAAWI,OAAO,CAAA,EAAA,iCAAA,EAIvCL,aAAAA,CAAcC,UAAAA,CAAWI,OAAO,CAAA,EAAA,iBAAA,EAI9BN,WAAAA,EAAAA,gBAAAA,EACKC,aAAAA,CAAcC,UAAAA,CAAWM,eAAe,CAAA,EAAA,oBAAA,EACpCP,aAAAA,CAAcC,UAAAA,CAAWO,UAAU,CAAA,EAAA,4CAAA,EAIpCT,WAAAA,EAAAA,gBAAAA,EACHC,aAAAA,CAAcC,UAAAA,CAAWM,eAAe,CAAA,EAAA,oBAAA,EACpCP,aAAAA,CAAcC,UAAAA,CAAWM,eAAe,CAAA,EAAA,4BAAA,EAInDP,aAAAA,CAAcC,UAAAA,CAAWM,eAAe,CAAA,EAAA,uBAAA,CAAA;AAKzD,SAASE,MACLC,KAA+F,EAAA;AAE/F,IAAA,qBACIC,IAAA,CAACd,KAAAA,EAAAA;;0BACGe,GAAA,CAACR,WAAAA,EAAAA;AAAa,gBAAA,GAAGM,KAAK;gBAAEG,IAAAA,EAAK;;0BAC7BD,GAAA,CAACb,WAAAA,EAAAA,EAAAA,CAAAA;0BACDa,GAAA,CAACE,MAAAA,EAAAA;AAAMJ,gBAAAA,QAAAA,EAAAA,KAAAA,CAAMK;;;;AAGzB;AAEAN,KAAAA,CAAMO,SAAS,GAAG;+BAEdD,KAAAA,EAAOE,SAAAA,CAAUC;AACrB,CAAA;;;;"}
1
+ {"version":3,"file":"Radio.js","sources":["../../../src/components/Input/Radio.tsx"],"sourcesContent":["import React from 'react';\nimport styled from '@emotion/styled';\nimport { getThemeValue, THEME_NAME } from '../../shared/constants';\n\nconst Label = styled.label`\n display: inline-flex;\n align-items: center;\n margin: 5px 0;\n cursor: pointer;\n position: relative;\n`;\n\nconst StyledRadio = styled.span`\n width: 16px;\n height: 16px;\n margin-right: 5px;\n border: 1px solid ${getThemeValue(THEME_NAME.BORDER_COLOR)};\n border-radius: 50%;\n display: block;\n transition: background-color 0.3s ease;\n position: relative;\n flex-shrink: 0;\n\n &::after {\n content: '';\n width: 100%;\n height: 100%;\n border-radius: 50%;\n position: absolute;\n top: 0;\n left: 0;\n box-shadow: inset 0 0 0 3px ${getThemeValue(THEME_NAME.BACKGROUND)};\n opacity: 0;\n transition: opacity 0.2s ease;\n }\n`;\n\nconst HiddenInput = styled.input`\n opacity: 0;\n width: 0;\n height: 0;\n position: absolute;\n margin: 0;\n\n /* checked */\n &:checked + ${StyledRadio} {\n border-color: ${getThemeValue(THEME_NAME.PRIMARY)};\n background-color: ${getThemeValue(THEME_NAME.PRIMARY)};\n }\n\n &:checked + ${StyledRadio}::after {\n opacity: 1;\n }\n\n /* focus */\n &:enabled:focus + ${StyledRadio} {\n border-color: ${getThemeValue(THEME_NAME.PRIMARY)};\n box-shadow: 0 0 0 3px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};\n }\n\n &:enabled:checked:focus + ${StyledRadio} {\n border-color: ${getThemeValue(THEME_NAME.PRIMARY)};\n box-shadow: 0 0 0 3px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};\n }\n\n /* hover */\n &:enabled:hover + ${StyledRadio} {\n border-color: ${getThemeValue(THEME_NAME.PRIMARY)};\n }\n\n &:enabled:hover ~ span {\n color: ${getThemeValue(THEME_NAME.PRIMARY)};\n }\n\n /* disabled */\n &:disabled + ${StyledRadio} {\n border-color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};\n background-color: ${getThemeValue(THEME_NAME.LIGHT_GREY)};\n cursor: not-allowed;\n }\n\n &:disabled:checked + ${StyledRadio} {\n border-color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};\n background-color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};\n }\n\n &:disabled ~ span {\n color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};\n cursor: not-allowed;\n }\n`;\n\ntype RadioProps = {\n /** Label for the field */\n label?: string;\n} & React.InputHTMLAttributes<HTMLInputElement>;\n\n/**\n * Radio Component\n * @param props - Component props\n * @param ref - Ref forwarded to the underlying HTMLInputElement\n */\nfunction RadioComponent(props: RadioProps, ref: React.Ref<HTMLInputElement>) {\n const { label, ...rest } = props;\n\n return (\n <Label>\n <HiddenInput {...rest} ref={ref} type=\"radio\" />\n <StyledRadio />\n <span>{label}</span>\n </Label>\n );\n}\n\nconst Radio = React.forwardRef<HTMLInputElement, RadioProps>(RadioComponent);\nexport default Radio;\n"],"names":["Label","styled","StyledRadio","getThemeValue","THEME_NAME","BORDER_COLOR","BACKGROUND","HiddenInput","PRIMARY","PRIMARY_LIGHT","DISABLED_BORDER","LIGHT_GREY","RadioComponent","props","ref","label","rest","_jsxs","_jsx","type","span","Radio","React","forwardRef"],"mappings":";;;;;AAIA,MAAMA,OAAAA,iBAAQC,MAAAA,CAAAA,OAAAA,EAAAA;;;;AAQd,MAAMC,WAAAA,iBAAcD,MAAAA,CAAAA,MAAAA,EAAAA;;;AAIIE,CAAAA,CAAAA,CAAAA,2DAAAA,EAAAA,aAAAA,CAAcC,UAAAA,CAAWC,YAAY,CAAA,EAAA,gOAAA,EAevBF,aAAAA,CAAcC,WAAWE,UAAU,CAAA,EAAA,2CAAA,CAAA;AAMzE,MAAMC,WAAAA,iBAAcN,MAAAA,CAAAA,OAAAA,EAAAA;;;yEAQFC,WAAAA,EAAAA,gBAAAA,EACMC,aAAAA,CAAcC,UAAAA,CAAWI,OAAO,CAAA,EAAA,oBAAA,EAC5BL,aAAAA,CAAcC,UAAAA,CAAWI,OAAO,CAAA,EAAA,gBAAA,EAG1CN,WAAAA,EAAAA,uCAAAA,EAKMA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MM,KAAAA,iBAAQC,KAAAA,CAAMC,UAAU,CAA+BX,cAAAA;;;;"}
@@ -1,14 +1,10 @@
1
1
  import React from 'react';
2
- import PropTypes from 'prop-types';
3
2
  export declare const RadioGroup: import("@emotion/styled").StyledComponent<{
4
3
  theme?: import("@emotion/react").Theme;
5
4
  as?: React.ElementType;
6
5
  }, React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
7
- declare function RadioButton(props: PropTypes.InferProps<React.AllHTMLAttributes<HTMLInputElement> & typeof RadioButton.propTypes>): import("@emotion/react/jsx-runtime").JSX.Element;
8
- declare namespace RadioButton {
9
- var propTypes: {
10
- /** Label for the field */
11
- label: PropTypes.Requireable<string>;
12
- };
13
- }
6
+ declare const RadioButton: React.ForwardRefExoticComponent<{
7
+ /** Label for the field */
8
+ label?: string;
9
+ } & React.InputHTMLAttributes<HTMLInputElement> & React.RefAttributes<HTMLInputElement>>;
14
10
  export default RadioButton;
@@ -1,37 +1,40 @@
1
1
  import { jsxs, jsx } from '@emotion/react/jsx-runtime';
2
- import 'react';
3
- import PropTypes from 'prop-types';
2
+ import React from 'react';
4
3
  import styled from '@emotion/styled';
5
4
  import { getThemeValue, THEME_NAME } from '../../shared/constants.js';
6
5
 
7
6
  const Input = /*#__PURE__*/ styled("input", {
8
- target: "e1ed8pyp0",
7
+ target: "e1yp0s5y0",
9
8
  label: "Input"
10
9
  })("appearance:none;margin:0;width:0;& + span{color:", getThemeValue(THEME_NAME.PRIMARY), ";padding:6px 12px;border:none;border:1px solid ", getThemeValue(THEME_NAME.PRIMARY), ";cursor:pointer;margin-right:-1px;line-height:18px;}&:enabled:focus + span{box-shadow:0 0 0 4px ", getThemeValue(THEME_NAME.PRIMARY_LIGHT), ";}&:enabled:hover + span{background-color:", getThemeValue(THEME_NAME.PRIMARY_LIGHT), ";color:", getThemeValue(THEME_NAME.TEXT_COLOR_LIGHT), ";}&:enabled:checked + span{background-color:", getThemeValue(THEME_NAME.PRIMARY), ";color:", getThemeValue(THEME_NAME.TEXT_COLOR_LIGHT), ";}&:disabled + span{background-color:", getThemeValue(THEME_NAME.BORDER_LIGHT_COLOR), ";color:", getThemeValue(THEME_NAME.DISABLED_BORDER), ";}&:disabled:checked + span{background-color:", getThemeValue(THEME_NAME.DISABLED_BORDER), ";color:", getThemeValue(THEME_NAME.TEXT_COLOR_LIGHT), ";}");
11
10
  const Label = /*#__PURE__*/ styled("label", {
12
- target: "e1ed8pyp1",
11
+ target: "e1yp0s5y1",
13
12
  label: "Label"
14
13
  })("display:inline-flex;&:focus-within{z-index:1;}");
15
14
  const RadioGroup = /*#__PURE__*/ styled("div", {
16
- target: "e1ed8pyp2",
15
+ target: "e1yp0s5y2",
17
16
  label: "RadioGroup"
18
17
  })("display:inline-flex;align-items:center;border-radius:3px;margin:5px 0;& ", Label, ":first-child > span{border-radius:3px 0 0 3px;}& ", Label, ":last-child > span{border-radius:0 3px 3px 0;}");
19
- function RadioButton(props) {
18
+ /**
19
+ * RadioButton Component
20
+ * @param props - Component props
21
+ * @param ref - Ref forwarded to the underlying HTMLInputElement
22
+ */ function RadioButtonComponent(props, ref) {
23
+ const { label, ...rest } = props;
20
24
  return /*#__PURE__*/ jsxs(Label, {
21
25
  children: [
22
26
  /*#__PURE__*/ jsx(Input, {
23
- ...props,
24
- type: "radio"
27
+ ...rest,
28
+ type: "radio",
29
+ ref: ref
25
30
  }),
26
31
  /*#__PURE__*/ jsx("span", {
27
- children: props.label
32
+ children: label
28
33
  })
29
34
  ]
30
35
  });
31
36
  }
32
- RadioButton.propTypes = {
33
- /** Label for the field */ label: PropTypes.string
34
- };
37
+ const RadioButton = /*#__PURE__*/ React.forwardRef(RadioButtonComponent);
35
38
 
36
39
  export { RadioGroup, RadioButton as default };
37
40
  //# sourceMappingURL=RadioButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RadioButton.js","sources":["../../../src/components/Input/RadioButton.tsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport styled from '@emotion/styled';\nimport { getThemeValue, THEME_NAME } from '../../shared/constants';\n\nconst Input = styled.input`\n appearance: none;\n margin: 0;\n width: 0;\n\n & + span {\n color: ${getThemeValue(THEME_NAME.PRIMARY)};\n padding: 6px 12px;\n border: none;\n border: 1px solid ${getThemeValue(THEME_NAME.PRIMARY)};\n cursor: pointer;\n margin-right: -1px;\n line-height: 18px;\n }\n\n &:enabled:focus + span {\n box-shadow: 0 0 0 4px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};\n }\n\n &:enabled:hover + span {\n background-color: ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};\n color: ${getThemeValue(THEME_NAME.TEXT_COLOR_LIGHT)};\n }\n\n &:enabled:checked + span {\n background-color: ${getThemeValue(THEME_NAME.PRIMARY)};\n color: ${getThemeValue(THEME_NAME.TEXT_COLOR_LIGHT)};\n }\n\n &:disabled + span {\n background-color: ${getThemeValue(THEME_NAME.BORDER_LIGHT_COLOR)};\n color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};\n }\n\n &:disabled:checked + span {\n background-color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};\n color: ${getThemeValue(THEME_NAME.TEXT_COLOR_LIGHT)};\n }\n`;\n\nconst Label = styled.label`\n display: inline-flex;\n\n &:focus-within {\n z-index: 1;\n }\n`;\n\nexport const RadioGroup = styled.div`\n display: inline-flex;\n align-items: center;\n border-radius: 3px;\n margin: 5px 0;\n\n & ${Label}:first-child > span {\n border-radius: 3px 0 0 3px;\n }\n\n & ${Label}:last-child > span {\n border-radius: 0 3px 3px 0;\n }\n`;\n\nfunction RadioButton(\n props: PropTypes.InferProps<\n React.AllHTMLAttributes<HTMLInputElement> & typeof RadioButton.propTypes\n >,\n) {\n return (\n <Label>\n <Input {...props} type=\"radio\" />\n <span>{props.label}</span>\n </Label>\n );\n}\n\nRadioButton.propTypes = {\n /** Label for the field */\n label: PropTypes.string,\n};\n\nexport default RadioButton;\n"],"names":["Input","styled","getThemeValue","THEME_NAME","PRIMARY","PRIMARY_LIGHT","TEXT_COLOR_LIGHT","BORDER_LIGHT_COLOR","DISABLED_BORDER","Label","RadioGroup","RadioButton","props","_jsxs","_jsx","type","span","label","propTypes","PropTypes","string"],"mappings":";;;;;;AAKA,MAAMA,KAAAA,iBAAQC,MAAAA,CAAAA,OAAAA,EAAAA;;;AAMGC,CAAAA,CAAAA,CAAAA,kDAAAA,EAAAA,aAAAA,CAAcC,WAAWC,OAAO,CAAA,EAAA,iDAAA,EAGrBF,cAAcC,UAAAA,CAAWC,OAAO,uGAO5BF,aAAAA,CAAcC,UAAAA,CAAWE,aAAa,CAAA,EAAA,4CAAA,EAI1CH,cAAcC,UAAAA,CAAWE,aAAa,cACjDH,aAAAA,CAAcC,UAAAA,CAAWG,gBAAgB,CAAA,EAAA,8CAAA,EAI9BJ,aAAAA,CAAcC,UAAAA,CAAWC,OAAO,cAC3CF,aAAAA,CAAcC,UAAAA,CAAWG,gBAAgB,CAAA,EAAA,uCAAA,EAI9BJ,aAAAA,CAAcC,WAAWI,kBAAkB,CAAA,EAAA,SAAA,EACtDL,cAAcC,UAAAA,CAAWK,eAAe,oDAI7BN,aAAAA,CAAcC,UAAAA,CAAWK,eAAe,CAAA,EAAA,SAAA,EACnDN,aAAAA,CAAcC,WAAWG,gBAAgB,CAAA,EAAA,IAAA,CAAA;AAI1D,MAAMG,KAAAA,iBAAQR,MAAAA,CAAAA,OAAAA,EAAAA;;;;MAQDS,UAAAA,iBAAaT,MAAAA,CAAAA,KAAAA,EAAAA;;;AAMlBQ,CAAAA,CAAAA,CAAAA,0EAAAA,EAAAA,KAAAA,EAAAA,mDAAAA,EAIAA,KAAAA,EAAAA,gDAAAA;AAKR,SAASE,YACLC,KAEC,EAAA;AAED,IAAA,qBACIC,IAAA,CAACJ,KAAAA,EAAAA;;0BACGK,GAAA,CAACd,KAAAA,EAAAA;AAAO,gBAAA,GAAGY,KAAK;gBAAEG,IAAAA,EAAK;;0BACvBD,GAAA,CAACE,MAAAA,EAAAA;AAAMJ,gBAAAA,QAAAA,EAAAA,KAAAA,CAAMK;;;;AAGzB;AAEAN,WAAAA,CAAYO,SAAS,GAAG;+BAEpBD,KAAAA,EAAOE,SAAAA,CAAUC;AACrB,CAAA;;;;"}
1
+ {"version":3,"file":"RadioButton.js","sources":["../../../src/components/Input/RadioButton.tsx"],"sourcesContent":["import React from 'react';\nimport styled from '@emotion/styled';\nimport { getThemeValue, THEME_NAME } from '../../shared/constants';\n\nconst Input = styled.input`\n appearance: none;\n margin: 0;\n width: 0;\n\n & + span {\n color: ${getThemeValue(THEME_NAME.PRIMARY)};\n padding: 6px 12px;\n border: none;\n border: 1px solid ${getThemeValue(THEME_NAME.PRIMARY)};\n cursor: pointer;\n margin-right: -1px;\n line-height: 18px;\n }\n\n &:enabled:focus + span {\n box-shadow: 0 0 0 4px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};\n }\n\n &:enabled:hover + span {\n background-color: ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};\n color: ${getThemeValue(THEME_NAME.TEXT_COLOR_LIGHT)};\n }\n\n &:enabled:checked + span {\n background-color: ${getThemeValue(THEME_NAME.PRIMARY)};\n color: ${getThemeValue(THEME_NAME.TEXT_COLOR_LIGHT)};\n }\n\n &:disabled + span {\n background-color: ${getThemeValue(THEME_NAME.BORDER_LIGHT_COLOR)};\n color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};\n }\n\n &:disabled:checked + span {\n background-color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};\n color: ${getThemeValue(THEME_NAME.TEXT_COLOR_LIGHT)};\n }\n`;\n\nconst Label = styled.label`\n display: inline-flex;\n\n &:focus-within {\n z-index: 1;\n }\n`;\n\nexport const RadioGroup = styled.div`\n display: inline-flex;\n align-items: center;\n border-radius: 3px;\n margin: 5px 0;\n\n & ${Label}:first-child > span {\n border-radius: 3px 0 0 3px;\n }\n\n & ${Label}:last-child > span {\n border-radius: 0 3px 3px 0;\n }\n`;\n\ntype RadioButtonProps = {\n /** Label for the field */\n label?: string;\n} & React.InputHTMLAttributes<HTMLInputElement>;\n\n/**\n * RadioButton Component\n * @param props - Component props\n * @param ref - Ref forwarded to the underlying HTMLInputElement\n */\nfunction RadioButtonComponent(props: RadioButtonProps, ref: React.Ref<HTMLInputElement>) {\n const { label, ...rest } = props;\n return (\n <Label>\n <Input {...rest} type=\"radio\" ref={ref} />\n <span>{label}</span>\n </Label>\n );\n}\n\nconst RadioButton = React.forwardRef(RadioButtonComponent);\nexport default RadioButton;\n"],"names":["Input","styled","getThemeValue","THEME_NAME","PRIMARY","PRIMARY_LIGHT","TEXT_COLOR_LIGHT","BORDER_LIGHT_COLOR","DISABLED_BORDER","Label","RadioGroup","RadioButtonComponent","props","ref","label","rest","_jsxs","_jsx","type","span","RadioButton","React","forwardRef"],"mappings":";;;;;AAIA,MAAMA,KAAAA,iBAAQC,MAAAA,CAAAA,OAAAA,EAAAA;;;AAMGC,CAAAA,CAAAA,CAAAA,kDAAAA,EAAAA,aAAAA,CAAcC,WAAWC,OAAO,CAAA,EAAA,iDAAA,EAGrBF,cAAcC,UAAAA,CAAWC,OAAO,uGAO5BF,aAAAA,CAAcC,UAAAA,CAAWE,aAAa,CAAA,EAAA,4CAAA,EAI1CH,cAAcC,UAAAA,CAAWE,aAAa,cACjDH,aAAAA,CAAcC,UAAAA,CAAWG,gBAAgB,CAAA,EAAA,8CAAA,EAI9BJ,aAAAA,CAAcC,UAAAA,CAAWC,OAAO,cAC3CF,aAAAA,CAAcC,UAAAA,CAAWG,gBAAgB,CAAA,EAAA,uCAAA,EAI9BJ,aAAAA,CAAcC,WAAWI,kBAAkB,CAAA,EAAA,SAAA,EACtDL,cAAcC,UAAAA,CAAWK,eAAe,oDAI7BN,aAAAA,CAAcC,UAAAA,CAAWK,eAAe,CAAA,EAAA,SAAA,EACnDN,aAAAA,CAAcC,WAAWG,gBAAgB,CAAA,EAAA,IAAA,CAAA;AAI1D,MAAMG,KAAAA,iBAAQR,MAAAA,CAAAA,OAAAA,EAAAA;;;;MAQDS,UAAAA,iBAAaT,MAAAA,CAAAA,KAAAA,EAAAA;;;AAMlBQ,CAAAA,CAAAA,CAAAA,0EAAAA,EAAAA,KAAAA,EAAAA,mDAAAA,EAIAA,KAAAA,EAAAA,gDAAAA;AAUR;;;;AAIC,IACD,SAASE,oBAAAA,CAAqBC,KAAuB,EAAEC,GAAgC,EAAA;AACnF,IAAA,MAAM,EAAEC,KAAK,EAAE,GAAGC,MAAM,GAAGH,KAAAA;AAC3B,IAAA,qBACII,IAAA,CAACP,KAAAA,EAAAA;;0BACGQ,GAAA,CAACjB,KAAAA,EAAAA;AAAO,gBAAA,GAAGe,IAAI;gBAAEG,IAAAA,EAAK,OAAA;gBAAQL,GAAAA,EAAKA;;0BACnCI,GAAA,CAACE,MAAAA,EAAAA;AAAML,gBAAAA,QAAAA,EAAAA;;;;AAGnB;AAEA,MAAMM,WAAAA,iBAAcC,KAAAA,CAAMC,UAAU,CAACX,oBAAAA;;;;"}
@@ -1,15 +1,8 @@
1
1
  import React from 'react';
2
- import PropTypes from 'prop-types';
3
- interface SelectProps extends PropTypes.InferType<typeof Select.propTypes>, React.InputHTMLAttributes<HTMLSelectElement> {
4
- value?: string;
5
- }
6
- declare function Select(props: SelectProps): import("@emotion/react/jsx-runtime").JSX.Element;
7
- declare namespace Select {
8
- var propTypes: {
9
- /** Label for the field */
10
- label: PropTypes.Requireable<string>;
11
- /** Error text to be shown below the field */
12
- errorText: PropTypes.Requireable<string>;
13
- };
14
- }
2
+ declare const Select: React.ForwardRefExoticComponent<{
3
+ /** Label for the field */
4
+ label?: string;
5
+ /** Error text to be shown below the field */
6
+ errorText?: string;
7
+ } & React.InputHTMLAttributes<HTMLSelectElement> & React.RefAttributes<HTMLSelectElement>>;
15
8
  export default Select;