no-frills-ui 0.0.14-alpha.4 → 0.0.14-alpha.5

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 (132) hide show
  1. package/dist/index.js +1335 -493
  2. package/dist/index.js.map +1 -1
  3. package/lib-esm/components/Accordion/AccordionStep.d.ts.map +1 -1
  4. package/lib-esm/components/Accordion/AccordionStep.js +11 -29
  5. package/lib-esm/components/Accordion/AccordionStep.js.map +1 -1
  6. package/lib-esm/components/Badge/Badge.js +7 -7
  7. package/lib-esm/components/Badge/Badge.js.map +1 -1
  8. package/lib-esm/components/Button/ActionButton.d.ts.map +1 -1
  9. package/lib-esm/components/Button/ActionButton.js +12 -11
  10. package/lib-esm/components/Button/ActionButton.js.map +1 -1
  11. package/lib-esm/components/Button/Button.d.ts.map +1 -1
  12. package/lib-esm/components/Button/Button.js +14 -13
  13. package/lib-esm/components/Button/Button.js.map +1 -1
  14. package/lib-esm/components/Button/IconButton.d.ts.map +1 -1
  15. package/lib-esm/components/Button/IconButton.js +15 -14
  16. package/lib-esm/components/Button/IconButton.js.map +1 -1
  17. package/lib-esm/components/Button/LinkButton.d.ts.map +1 -1
  18. package/lib-esm/components/Button/LinkButton.js +7 -6
  19. package/lib-esm/components/Button/LinkButton.js.map +1 -1
  20. package/lib-esm/components/Button/RaisedButton.d.ts.map +1 -1
  21. package/lib-esm/components/Button/RaisedButton.js +15 -14
  22. package/lib-esm/components/Button/RaisedButton.js.map +1 -1
  23. package/lib-esm/components/Card/Card.d.ts.map +1 -1
  24. package/lib-esm/components/Card/Card.js +4 -4
  25. package/lib-esm/components/Card/Card.js.map +1 -1
  26. package/lib-esm/components/Chip/Chip.js +8 -8
  27. package/lib-esm/components/Chip/Chip.js.map +1 -1
  28. package/lib-esm/components/ChipInput/ChipInput.js +20 -20
  29. package/lib-esm/components/ChipInput/ChipInput.js.map +1 -1
  30. package/lib-esm/components/Dialog/AlertDialog.d.ts.map +1 -1
  31. package/lib-esm/components/Dialog/AlertDialog.js +4 -1
  32. package/lib-esm/components/Dialog/AlertDialog.js.map +1 -1
  33. package/lib-esm/components/Dialog/Dialog.d.ts +26 -1
  34. package/lib-esm/components/Dialog/Dialog.d.ts.map +1 -1
  35. package/lib-esm/components/Dialog/Dialog.js +84 -1
  36. package/lib-esm/components/Dialog/Dialog.js.map +1 -1
  37. package/lib-esm/components/DragAndDrop/DragItem.js +8 -8
  38. package/lib-esm/components/DragAndDrop/DragItem.js.map +1 -1
  39. package/lib-esm/components/Drawer/Drawer.d.ts +76 -1
  40. package/lib-esm/components/Drawer/Drawer.d.ts.map +1 -1
  41. package/lib-esm/components/Drawer/Drawer.js +158 -24
  42. package/lib-esm/components/Drawer/Drawer.js.map +1 -1
  43. package/lib-esm/components/Groups/Group.d.ts.map +1 -1
  44. package/lib-esm/components/Groups/Group.js +10 -8
  45. package/lib-esm/components/Groups/Group.js.map +1 -1
  46. package/lib-esm/components/Groups/GroupLabel.d.ts.map +1 -1
  47. package/lib-esm/components/Groups/GroupLabel.js +3 -3
  48. package/lib-esm/components/Groups/GroupLabel.js.map +1 -1
  49. package/lib-esm/components/Input/Checkbox.d.ts.map +1 -1
  50. package/lib-esm/components/Input/Checkbox.js +63 -58
  51. package/lib-esm/components/Input/Checkbox.js.map +1 -1
  52. package/lib-esm/components/Input/Dropdown.d.ts +8 -0
  53. package/lib-esm/components/Input/Dropdown.d.ts.map +1 -1
  54. package/lib-esm/components/Input/Dropdown.js +54 -31
  55. package/lib-esm/components/Input/Dropdown.js.map +1 -1
  56. package/lib-esm/components/Input/Input.d.ts.map +1 -1
  57. package/lib-esm/components/Input/Input.js +27 -21
  58. package/lib-esm/components/Input/Input.js.map +1 -1
  59. package/lib-esm/components/Input/Radio.d.ts.map +1 -1
  60. package/lib-esm/components/Input/Radio.js +58 -42
  61. package/lib-esm/components/Input/Radio.js.map +1 -1
  62. package/lib-esm/components/Input/RadioButton.d.ts.map +1 -1
  63. package/lib-esm/components/Input/RadioButton.js +12 -12
  64. package/lib-esm/components/Input/RadioButton.js.map +1 -1
  65. package/lib-esm/components/Input/Select.d.ts.map +1 -1
  66. package/lib-esm/components/Input/Select.js +27 -21
  67. package/lib-esm/components/Input/Select.js.map +1 -1
  68. package/lib-esm/components/Input/TextArea.d.ts.map +1 -1
  69. package/lib-esm/components/Input/TextArea.js +27 -21
  70. package/lib-esm/components/Input/TextArea.js.map +1 -1
  71. package/lib-esm/components/Input/Toggle.d.ts.map +1 -1
  72. package/lib-esm/components/Input/Toggle.js +17 -14
  73. package/lib-esm/components/Input/Toggle.js.map +1 -1
  74. package/lib-esm/components/Menu/Menu.d.ts +13 -1
  75. package/lib-esm/components/Menu/Menu.d.ts.map +1 -1
  76. package/lib-esm/components/Menu/Menu.js +98 -3
  77. package/lib-esm/components/Menu/Menu.js.map +1 -1
  78. package/lib-esm/components/Menu/MenuItem.d.ts +6 -3
  79. package/lib-esm/components/Menu/MenuItem.d.ts.map +1 -1
  80. package/lib-esm/components/Menu/MenuItem.js +10 -10
  81. package/lib-esm/components/Menu/MenuItem.js.map +1 -1
  82. package/lib-esm/components/Modal/Modal.d.ts +70 -1
  83. package/lib-esm/components/Modal/Modal.d.ts.map +1 -1
  84. package/lib-esm/components/Modal/Modal.js +145 -11
  85. package/lib-esm/components/Modal/Modal.js.map +1 -1
  86. package/lib-esm/components/Notification/Notification.d.ts +3 -1
  87. package/lib-esm/components/Notification/Notification.d.ts.map +1 -1
  88. package/lib-esm/components/Notification/Notification.js +4 -2
  89. package/lib-esm/components/Notification/Notification.js.map +1 -1
  90. package/lib-esm/components/Notification/NotificationManager.d.ts +11 -1
  91. package/lib-esm/components/Notification/NotificationManager.d.ts.map +1 -1
  92. package/lib-esm/components/Notification/NotificationManager.js +43 -8
  93. package/lib-esm/components/Notification/NotificationManager.js.map +1 -1
  94. package/lib-esm/components/Notification/style.d.ts +4 -0
  95. package/lib-esm/components/Notification/style.d.ts.map +1 -1
  96. package/lib-esm/components/Notification/style.js +30 -15
  97. package/lib-esm/components/Notification/style.js.map +1 -1
  98. package/lib-esm/components/Notification/types.d.ts +2 -0
  99. package/lib-esm/components/Notification/types.d.ts.map +1 -1
  100. package/lib-esm/components/Notification/types.js.map +1 -1
  101. package/lib-esm/components/Popover/Popover.d.ts.map +1 -1
  102. package/lib-esm/components/Popover/Popover.js +17 -2
  103. package/lib-esm/components/Popover/Popover.js.map +1 -1
  104. package/lib-esm/components/Spinner/Spinner.d.ts +3 -0
  105. package/lib-esm/components/Spinner/Spinner.d.ts.map +1 -1
  106. package/lib-esm/components/Spinner/Spinner.js +19 -4
  107. package/lib-esm/components/Spinner/Spinner.js.map +1 -1
  108. package/lib-esm/components/Stepper/Stepper.d.ts.map +1 -1
  109. package/lib-esm/components/Stepper/Stepper.js +29 -10
  110. package/lib-esm/components/Stepper/Stepper.js.map +1 -1
  111. package/lib-esm/components/Tabs/Tabs.d.ts.map +1 -1
  112. package/lib-esm/components/Tabs/Tabs.js +45 -12
  113. package/lib-esm/components/Tabs/Tabs.js.map +1 -1
  114. package/lib-esm/components/Toast/Toast.d.ts +25 -4
  115. package/lib-esm/components/Toast/Toast.d.ts.map +1 -1
  116. package/lib-esm/components/Toast/Toast.js +114 -18
  117. package/lib-esm/components/Toast/Toast.js.map +1 -1
  118. package/lib-esm/components/Tooltip/Tooltip.d.ts.map +1 -1
  119. package/lib-esm/components/Tooltip/Tooltip.js +16 -5
  120. package/lib-esm/components/Tooltip/Tooltip.js.map +1 -1
  121. package/lib-esm/shared/LayerManager.d.ts.map +1 -1
  122. package/lib-esm/shared/LayerManager.js +63 -1
  123. package/lib-esm/shared/LayerManager.js.map +1 -1
  124. package/lib-esm/shared/constants.d.ts +58 -27
  125. package/lib-esm/shared/constants.d.ts.map +1 -1
  126. package/lib-esm/shared/constants.js +88 -25
  127. package/lib-esm/shared/constants.js.map +1 -1
  128. package/lib-esm/shared/styles.d.ts +1 -1
  129. package/lib-esm/shared/styles.d.ts.map +1 -1
  130. package/lib-esm/shared/styles.js +5 -3
  131. package/lib-esm/shared/styles.js.map +1 -1
  132. package/package.json +1 -1
@@ -1,78 +1,94 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
2
  import PropTypes from 'prop-types';
3
3
  import styled from '@emotion/styled';
4
- import constants from '../../shared/constants';
4
+ import { getThemeValue, THEME_NAME } from '../../shared/constants';
5
5
  const Label = styled.label `
6
6
  display: inline-flex;
7
7
  align-items: center;
8
8
  margin: 5px 0;
9
+ cursor: pointer;
10
+ position: relative;
9
11
  `;
10
- const Input = styled.input `
11
- appearance: none;
12
- margin: 0;
12
+ const StyledRadio = styled.span `
13
+ width: 16px;
14
+ height: 16px;
15
+ margin-right: 5px;
16
+ border: 1px solid ${getThemeValue(THEME_NAME.BORDER_COLOR)};
17
+ border-radius: 50%;
18
+ display: block;
19
+ transition: background-color 0.3s ease;
20
+ position: relative;
21
+ flex-shrink: 0;
13
22
 
14
- &::before {
15
- content: ' ';
16
- width: 16px;
17
- height: 16px;
18
- margin: 0 5px;
19
- border: 1px solid var(--border-color, ${constants.BORDER_COLOR});
23
+ &::after {
24
+ content: '';
25
+ width: 100%;
26
+ height: 100%;
20
27
  border-radius: 50%;
21
- display: block;
22
- transition: background-color 0.3s ease;
28
+ position: absolute;
29
+ top: 0;
30
+ left: 0;
31
+ box-shadow: inset 0 0 0 3px ${getThemeValue(THEME_NAME.BACKGROUND)};
32
+ opacity: 0;
33
+ transition: opacity 0.2s ease;
23
34
  }
35
+ `;
36
+ const HiddenInput = styled.input `
37
+ opacity: 0;
38
+ width: 0;
39
+ height: 0;
40
+ position: absolute;
41
+ margin: 0;
24
42
 
25
43
  /* checked */
26
- &:checked::before {
27
- border: 1px solid var(--primary, ${constants.PRIMARY});
28
- background-color: var(--primary, ${constants.PRIMARY});
29
- box-shadow: inset 0 0 0 3px var(--background, ${constants.BACKGROUND});
44
+ &:checked + ${StyledRadio} {
45
+ border-color: ${getThemeValue(THEME_NAME.PRIMARY)};
46
+ background-color: ${getThemeValue(THEME_NAME.PRIMARY)};
47
+ }
48
+
49
+ &:checked + ${StyledRadio}::after {
50
+ opacity: 1;
30
51
  }
31
52
 
32
53
  /* focus */
33
- &:enabled:focus::before {
34
- border: 1px solid var(--primary, ${constants.PRIMARY});
35
- box-shadow: 0 0 0 3px var(--primary, ${constants.PRIMARY_LIGHT});
36
- cursor: pointer;
54
+ &:enabled:focus + ${StyledRadio} {
55
+ border-color: ${getThemeValue(THEME_NAME.PRIMARY)};
56
+ box-shadow: 0 0 0 3px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};
37
57
  }
38
58
 
39
- &:enabled:checked:focus::before {
40
- border: 1px solid var(--primary, ${constants.PRIMARY});
41
- box-shadow:
42
- 0 0 0 3px var(--primary, ${constants.PRIMARY_LIGHT}),
43
- inset 0 0 0 3px var(--background, ${constants.BACKGROUND});
44
- cursor: pointer;
59
+ &:enabled:checked:focus + ${StyledRadio} {
60
+ border-color: ${getThemeValue(THEME_NAME.PRIMARY)};
61
+ box-shadow: 0 0 0 3px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};
45
62
  }
46
63
 
47
64
  /* hover */
48
- &:enabled:hover::before {
49
- border: 1px solid var(--primary, ${constants.PRIMARY});
50
- cursor: pointer;
65
+ &:enabled:hover + ${StyledRadio} {
66
+ border-color: ${getThemeValue(THEME_NAME.PRIMARY)};
51
67
  }
52
68
 
53
- &:enabled:hover + span {
54
- color: var(--primary, ${constants.PRIMARY});
55
- cursor: pointer;
69
+ &:enabled:hover ~ span {
70
+ color: ${getThemeValue(THEME_NAME.PRIMARY)};
56
71
  }
57
72
 
58
73
  /* disabled */
59
- &:disabled::before {
60
- border: 1px solid var(--disabled-border, ${constants.DISABLED_BORDER});
61
- background-color: var(--light-grey, ${constants.LIGHT_GREY});
74
+ &:disabled + ${StyledRadio} {
75
+ border-color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};
76
+ background-color: ${getThemeValue(THEME_NAME.LIGHT_GREY)};
77
+ cursor: not-allowed;
62
78
  }
63
79
 
64
- &:disabled:checked::before {
65
- border: 1px solid var(--disabled-border, ${constants.DISABLED_BORDER});
66
- background-color: var(--disabled-border, ${constants.DISABLED_BORDER});
67
- box-shadow: inset 0 0 0 3px var(--background, ${constants.BACKGROUND});
80
+ &:disabled:checked + ${StyledRadio} {
81
+ border-color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};
82
+ background-color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};
68
83
  }
69
84
 
70
- &:disabled + span {
71
- color: var(--disabled-border, ${constants.DISABLED_BORDER});
85
+ &:disabled ~ span {
86
+ color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};
87
+ cursor: not-allowed;
72
88
  }
73
89
  `;
74
90
  function Radio(props) {
75
- return (_jsxs(Label, { children: [_jsx(Input, Object.assign({}, props, { type: "radio" })), _jsx("span", { children: props.label })] }));
91
+ return (_jsxs(Label, { children: [_jsx(HiddenInput, Object.assign({}, props, { type: "radio" })), _jsx(StyledRadio, {}), _jsx("span", { children: props.label })] }));
76
92
  }
77
93
  Radio.propTypes = {
78
94
  /** Label for the field */
@@ -1 +1 @@
1
- {"version":3,"file":"Radio.js","sourceRoot":"","sources":["../../../src/components/Input/Radio.tsx"],"names":[],"mappings":";AACA,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAE/C,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA;;;;CAIzB,CAAC;AAEF,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA;;;;;;;;;gDASsB,SAAS,CAAC,YAAY;;;;;;;;2CAQ3B,SAAS,CAAC,OAAO;2CACjB,SAAS,CAAC,OAAO;wDACJ,SAAS,CAAC,UAAU;;;;;2CAKjC,SAAS,CAAC,OAAO;+CACb,SAAS,CAAC,aAAa;;;;;2CAK3B,SAAS,CAAC,OAAO;;uCAErB,SAAS,CAAC,aAAa;gDACd,SAAS,CAAC,UAAU;;;;;;2CAMzB,SAAS,CAAC,OAAO;;;;;gCAK5B,SAAS,CAAC,OAAO;;;;;;mDAME,SAAS,CAAC,eAAe;8CAC9B,SAAS,CAAC,UAAU;;;;mDAIf,SAAS,CAAC,eAAe;mDACzB,SAAS,CAAC,eAAe;wDACpB,SAAS,CAAC,UAAU;;;;wCAIpC,SAAS,CAAC,eAAe;;CAEhE,CAAC;AAEF,SAAS,KAAK,CACV,KAA+F;IAE/F,OAAO,CACH,MAAC,KAAK,eACF,KAAC,KAAK,oBAAK,KAAK,IAAE,IAAI,EAAC,OAAO,IAAG,EACjC,yBAAO,KAAK,CAAC,KAAK,GAAQ,IACtB,CACX,CAAC;AACN,CAAC;AAED,KAAK,CAAC,SAAS,GAAG;IACd,0BAA0B;IAC1B,KAAK,EAAE,SAAS,CAAC,MAAM;CAC1B,CAAC;AAEF,eAAe,KAAK,CAAC","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport styled from '@emotion/styled';\nimport constants from '../../shared/constants';\n\nconst Label = styled.label`\n display: inline-flex;\n align-items: center;\n margin: 5px 0;\n`;\n\nconst Input = styled.input`\n appearance: none;\n margin: 0;\n\n &::before {\n content: ' ';\n width: 16px;\n height: 16px;\n margin: 0 5px;\n border: 1px solid var(--border-color, ${constants.BORDER_COLOR});\n border-radius: 50%;\n display: block;\n transition: background-color 0.3s ease;\n }\n\n /* checked */\n &:checked::before {\n border: 1px solid var(--primary, ${constants.PRIMARY});\n background-color: var(--primary, ${constants.PRIMARY});\n box-shadow: inset 0 0 0 3px var(--background, ${constants.BACKGROUND});\n }\n\n /* focus */\n &:enabled:focus::before {\n border: 1px solid var(--primary, ${constants.PRIMARY});\n box-shadow: 0 0 0 3px var(--primary, ${constants.PRIMARY_LIGHT});\n cursor: pointer;\n }\n\n &:enabled:checked:focus::before {\n border: 1px solid var(--primary, ${constants.PRIMARY});\n box-shadow:\n 0 0 0 3px var(--primary, ${constants.PRIMARY_LIGHT}),\n inset 0 0 0 3px var(--background, ${constants.BACKGROUND});\n cursor: pointer;\n }\n\n /* hover */\n &:enabled:hover::before {\n border: 1px solid var(--primary, ${constants.PRIMARY});\n cursor: pointer;\n }\n\n &:enabled:hover + span {\n color: var(--primary, ${constants.PRIMARY});\n cursor: pointer;\n }\n\n /* disabled */\n &:disabled::before {\n border: 1px solid var(--disabled-border, ${constants.DISABLED_BORDER});\n background-color: var(--light-grey, ${constants.LIGHT_GREY});\n }\n\n &:disabled:checked::before {\n border: 1px solid var(--disabled-border, ${constants.DISABLED_BORDER});\n background-color: var(--disabled-border, ${constants.DISABLED_BORDER});\n box-shadow: inset 0 0 0 3px var(--background, ${constants.BACKGROUND});\n }\n\n &:disabled + span {\n color: var(--disabled-border, ${constants.DISABLED_BORDER});\n }\n`;\n\nfunction Radio(\n props: PropTypes.InferProps<React.AllHTMLAttributes<HTMLInputElement> & typeof Radio.propTypes>,\n) {\n return (\n <Label>\n <Input {...props} type=\"radio\" />\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"]}
1
+ {"version":3,"file":"Radio.js","sourceRoot":"","sources":["../../../src/components/Input/Radio.tsx"],"names":[],"mappings":";AACA,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEnE,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA;;;;;;CAMzB,CAAC;AAEF,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAA;;;;wBAIP,aAAa,CAAC,UAAU,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;sCAexB,aAAa,CAAC,UAAU,CAAC,UAAU,CAAC;;;;CAIzE,CAAC;AAEF,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAA;;;;;;;;kBAQd,WAAW;wBACL,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC;4BAC7B,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC;;;kBAG3C,WAAW;;;;;wBAKL,WAAW;wBACX,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC;gCACzB,aAAa,CAAC,UAAU,CAAC,aAAa,CAAC;;;gCAGvC,WAAW;wBACnB,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC;gCACzB,aAAa,CAAC,UAAU,CAAC,aAAa,CAAC;;;;wBAI/C,WAAW;wBACX,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC;;;;iBAIxC,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC;;;;mBAI/B,WAAW;wBACN,aAAa,CAAC,UAAU,CAAC,eAAe,CAAC;4BACrC,aAAa,CAAC,UAAU,CAAC,UAAU,CAAC;;;;2BAIrC,WAAW;wBACd,aAAa,CAAC,UAAU,CAAC,eAAe,CAAC;4BACrC,aAAa,CAAC,UAAU,CAAC,eAAe,CAAC;;;;iBAIpD,aAAa,CAAC,UAAU,CAAC,eAAe,CAAC;;;CAGzD,CAAC;AAEF,SAAS,KAAK,CACV,KAA+F;IAE/F,OAAO,CACH,MAAC,KAAK,eACF,KAAC,WAAW,oBAAK,KAAK,IAAE,IAAI,EAAC,OAAO,IAAG,EACvC,KAAC,WAAW,KAAG,EACf,yBAAO,KAAK,CAAC,KAAK,GAAQ,IACtB,CACX,CAAC;AACN,CAAC;AAED,KAAK,CAAC,SAAS,GAAG;IACd,0BAA0B;IAC1B,KAAK,EAAE,SAAS,CAAC,MAAM;CAC1B,CAAC;AAEF,eAAe,KAAK,CAAC","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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"RadioButton.d.ts","sourceRoot":"","sources":["../../../src/components/Input/RadioButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AAoDnC,eAAO,MAAM,UAAU;;SA7Bf,MAAO,WAAW;qFA0CzB,CAAC;AAEF,iBAAS,WAAW,CAChB,KAAK,EAAE,SAAS,CAAC,UAAU,CACvB,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,GAAG,OAAO,WAAW,CAAC,SAAS,CAC3E,oDAQJ;kBAXQ,WAAW;;QAchB,0BAA0B;;;;AAI9B,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"RadioButton.d.ts","sourceRoot":"","sources":["../../../src/components/Input/RadioButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AAoDnC,eAAO,MAAM,UAAU;;SAhC8C,MACjE,WAEE;qFA0CL,CAAC;AAEF,iBAAS,WAAW,CAChB,KAAK,EAAE,SAAS,CAAC,UAAU,CACvB,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,GAAG,OAAO,WAAW,CAAC,SAAS,CAC3E,oDAQJ;kBAXQ,WAAW;;QAchB,0BAA0B;;;;AAI9B,eAAe,WAAW,CAAC"}
@@ -1,44 +1,44 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
2
  import PropTypes from 'prop-types';
3
3
  import styled from '@emotion/styled';
4
- import constants from '../../shared/constants';
4
+ import { getThemeValue, THEME_NAME } from '../../shared/constants';
5
5
  const Input = styled.input `
6
6
  appearance: none;
7
7
  margin: 0;
8
8
  width: 0;
9
9
 
10
10
  & + span {
11
- color: var(--primary, ${constants.PRIMARY});
11
+ color: ${getThemeValue(THEME_NAME.PRIMARY)};
12
12
  padding: 6px 12px;
13
13
  border: none;
14
- border: 1px solid var(--primary, ${constants.PRIMARY});
14
+ border: 1px solid ${getThemeValue(THEME_NAME.PRIMARY)};
15
15
  cursor: pointer;
16
16
  margin-right: -1px;
17
17
  line-height: 18px;
18
18
  }
19
19
 
20
20
  &:enabled:focus + span {
21
- box-shadow: 0 0 0 4px var(--primary, ${constants.PRIMARY_LIGHT});
21
+ box-shadow: 0 0 0 4px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};
22
22
  }
23
23
 
24
24
  &:enabled:hover + span {
25
- background-color: var(--primary, ${constants.PRIMARY_LIGHT});
26
- color: #fff;
25
+ background-color: ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};
26
+ color: ${getThemeValue(THEME_NAME.TEXT_COLOR_LIGHT)};
27
27
  }
28
28
 
29
29
  &:enabled:checked + span {
30
- background-color: var(--primary, ${constants.PRIMARY});
31
- color: #fff;
30
+ background-color: ${getThemeValue(THEME_NAME.PRIMARY)};
31
+ color: ${getThemeValue(THEME_NAME.TEXT_COLOR_LIGHT)};
32
32
  }
33
33
 
34
34
  &:disabled + span {
35
- background-color: var(--border-light-color, ${constants.BORDER_LIGHT_COLOR});
36
- color: var(--disabled-border, ${constants.DISABLED_BORDER});
35
+ background-color: ${getThemeValue(THEME_NAME.BORDER_LIGHT_COLOR)};
36
+ color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};
37
37
  }
38
38
 
39
39
  &:disabled:checked + span {
40
- background-color: var(--disabled-border, ${constants.DISABLED_BORDER});
41
- color: #fff;
40
+ background-color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};
41
+ color: ${getThemeValue(THEME_NAME.TEXT_COLOR_LIGHT)};
42
42
  }
43
43
  `;
44
44
  const Label = styled.label `
@@ -1 +1 @@
1
- {"version":3,"file":"RadioButton.js","sourceRoot":"","sources":["../../../src/components/Input/RadioButton.tsx"],"names":[],"mappings":";AACA,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAE/C,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA;;;;;;gCAMM,SAAS,CAAC,OAAO;;;2CAGN,SAAS,CAAC,OAAO;;;;;;;+CAOb,SAAS,CAAC,aAAa;;;;2CAI3B,SAAS,CAAC,aAAa;;;;;2CAKvB,SAAS,CAAC,OAAO;;;;;sDAKN,SAAS,CAAC,kBAAkB;wCAC1C,SAAS,CAAC,eAAe;;;;mDAId,SAAS,CAAC,eAAe;;;CAG3E,CAAC;AAEF,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA;;;;;;CAMzB,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;QAM5B,KAAK;;;;QAIL,KAAK;;;CAGZ,CAAC;AAEF,SAAS,WAAW,CAChB,KAEC;IAED,OAAO,CACH,MAAC,KAAK,eACF,KAAC,KAAK,oBAAK,KAAK,IAAE,IAAI,EAAC,OAAO,IAAG,EACjC,yBAAO,KAAK,CAAC,KAAK,GAAQ,IACtB,CACX,CAAC;AACN,CAAC;AAED,WAAW,CAAC,SAAS,GAAG;IACpB,0BAA0B;IAC1B,KAAK,EAAE,SAAS,CAAC,MAAM;CAC1B,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport styled from '@emotion/styled';\nimport constants from '../../shared/constants';\n\nconst Input = styled.input`\n appearance: none;\n margin: 0;\n width: 0;\n\n & + span {\n color: var(--primary, ${constants.PRIMARY});\n padding: 6px 12px;\n border: none;\n border: 1px solid var(--primary, ${constants.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 var(--primary, ${constants.PRIMARY_LIGHT});\n }\n\n &:enabled:hover + span {\n background-color: var(--primary, ${constants.PRIMARY_LIGHT});\n color: #fff;\n }\n\n &:enabled:checked + span {\n background-color: var(--primary, ${constants.PRIMARY});\n color: #fff;\n }\n\n &:disabled + span {\n background-color: var(--border-light-color, ${constants.BORDER_LIGHT_COLOR});\n color: var(--disabled-border, ${constants.DISABLED_BORDER});\n }\n\n &:disabled:checked + span {\n background-color: var(--disabled-border, ${constants.DISABLED_BORDER});\n color: #fff;\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"]}
1
+ {"version":3,"file":"RadioButton.js","sourceRoot":"","sources":["../../../src/components/Input/RadioButton.tsx"],"names":[],"mappings":";AACA,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEnE,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA;;;;;;iBAMT,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC;;;4BAGtB,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC;;;;;;;gCAO7B,aAAa,CAAC,UAAU,CAAC,aAAa,CAAC;;;;4BAI3C,aAAa,CAAC,UAAU,CAAC,aAAa,CAAC;iBAClD,aAAa,CAAC,UAAU,CAAC,gBAAgB,CAAC;;;;4BAI/B,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC;iBAC5C,aAAa,CAAC,UAAU,CAAC,gBAAgB,CAAC;;;;4BAI/B,aAAa,CAAC,UAAU,CAAC,kBAAkB,CAAC;iBACvD,aAAa,CAAC,UAAU,CAAC,eAAe,CAAC;;;;4BAI9B,aAAa,CAAC,UAAU,CAAC,eAAe,CAAC;iBACpD,aAAa,CAAC,UAAU,CAAC,gBAAgB,CAAC;;CAE1D,CAAC;AAEF,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA;;;;;;CAMzB,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;QAM5B,KAAK;;;;QAIL,KAAK;;;CAGZ,CAAC;AAEF,SAAS,WAAW,CAChB,KAEC;IAED,OAAO,CACH,MAAC,KAAK,eACF,KAAC,KAAK,oBAAK,KAAK,IAAE,IAAI,EAAC,OAAO,IAAG,EACjC,yBAAO,KAAK,CAAC,KAAK,GAAQ,IACtB,CACX,CAAC;AACN,CAAC;AAED,WAAW,CAAC,SAAS,GAAG;IACpB,0BAA0B;IAC1B,KAAK,EAAE,SAAS,CAAC,MAAM;CAC1B,CAAC;AAEF,eAAe,WAAW,CAAC","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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../src/components/Input/Select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,SAAS,MAAM,YAAY,CAAC;AAKnC,UAAU,WACN,SACI,SAAS,CAAC,SAAS,CAAC,OAAO,MAAM,CAAC,SAAS,CAAC,EAC5C,KAAK,CAAC,mBAAmB,CAAC,iBAAiB,CAAC;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AA0ID,iBAAwB,MAAM,CAAC,KAAK,EAAE,WAAW,oDAwChD;kBAxCuB,MAAM;;QA2C1B,0BAA0B;;QAE1B,6CAA6C;;;;eA7CzB,MAAM"}
1
+ {"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../src/components/Input/Select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqC,MAAM,OAAO,CAAC;AAC1D,OAAO,SAAS,MAAM,YAAY,CAAC;AAKnC,UAAU,WACN,SACI,SAAS,CAAC,SAAS,CAAC,OAAO,MAAM,CAAC,SAAS,CAAC,EAC5C,KAAK,CAAC,mBAAmB,CAAC,iBAAiB,CAAC;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AA0ID,iBAAwB,MAAM,CAAC,KAAK,EAAE,WAAW,oDAkDhD;kBAlDuB,MAAM;;QAqD1B,0BAA0B;;QAE1B,6CAA6C;;;;eAvDzB,MAAM"}
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
- import { useState } from 'react';
2
+ import { useState, useEffect, useId } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import styled from '@emotion/styled';
5
5
  import ExpandMore from '../../icons/ExpandMore';
6
- import constants from '../../shared/constants';
6
+ import { getThemeValue, THEME_NAME } from '../../shared/constants';
7
7
  const Label = styled.label `
8
8
  display: inline-flex;
9
9
  flex-direction: column;
@@ -24,48 +24,48 @@ const SelectField = styled.select `
24
24
  min-height: 32px;
25
25
  width: 268px;
26
26
  border-radius: 3px;
27
- border: 1px solid var(--border-color, ${constants.BORDER_COLOR});
27
+ border: 1px solid ${getThemeValue(THEME_NAME.BORDER_COLOR)};
28
28
  display: inline-block;
29
- background-color: var(--background, ${constants.BACKGROUND});
29
+ background-color: ${getThemeValue(THEME_NAME.BACKGROUND)};
30
30
  pointer-events: auto;
31
31
  appearance: none;
32
32
 
33
33
  /** Focused */
34
34
  &:focus,
35
35
  &:active {
36
- border-color: var(--primary, ${constants.PRIMARY});
37
- box-shadow: 0 0 0 4px var(--primary, ${constants.PRIMARY_LIGHT});
36
+ border-color: ${getThemeValue(THEME_NAME.PRIMARY)};
37
+ box-shadow: 0 0 0 4px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};
38
38
  }
39
39
 
40
40
  &:focus ~ span,
41
41
  &:active ~ span {
42
- color: var(--primary, ${constants.PRIMARY});
42
+ color: ${getThemeValue(THEME_NAME.PRIMARY)};
43
43
  }
44
44
 
45
45
  /** Disabled */
46
46
  &:disabled {
47
- border-color: var(--disabled-border, ${constants.DISABLED_BORDER});
48
- background-color: var(--disabled-background, ${constants.DISABLED_BACKGROUND});
47
+ border-color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};
48
+ background-color: ${getThemeValue(THEME_NAME.DISABLED_BACKGROUND)};
49
49
  }
50
50
 
51
51
  &:disabled ~ span {
52
- color: var(--disabled, ${constants.DISABLED});
52
+ color: ${getThemeValue(THEME_NAME.DISABLED)};
53
53
  }
54
54
 
55
55
  /** Invalid */
56
56
  &:focus:invalid {
57
- border-color: var(--error, ${constants.ERROR});
58
- box-shadow: 0 0 0 4px var(--error-light, ${constants.ERROR_LIGHT});
57
+ border-color: ${getThemeValue(THEME_NAME.ERROR)};
58
+ box-shadow: 0 0 0 4px ${getThemeValue(THEME_NAME.ERROR_LIGHT)};
59
59
  }
60
60
 
61
61
  ${(props) => props.touched
62
62
  ? `
63
63
  &:invalid {
64
- border-color: var(--error, ${constants.ERROR});
64
+ border-color: ${getThemeValue(THEME_NAME.ERROR)};
65
65
  }
66
66
 
67
67
  &:invalid ~ span {
68
- color: var(--error, ${constants.ERROR});
68
+ color: ${getThemeValue(THEME_NAME.ERROR)};
69
69
  }
70
70
  `
71
71
  : ''}
@@ -73,10 +73,10 @@ const SelectField = styled.select `
73
73
  /** Error */
74
74
  ${(props) => props.errorText
75
75
  ? `
76
- border-color: var(--error, ${constants.ERROR});
76
+ border-color: ${getThemeValue(THEME_NAME.ERROR)};
77
77
 
78
78
  & ~ span {
79
- color: var(--error, ${constants.ERROR});
79
+ color: ${getThemeValue(THEME_NAME.ERROR)};
80
80
  }
81
81
  `
82
82
  : ''}
@@ -85,7 +85,7 @@ const SelectField = styled.select `
85
85
  &:required + span:after {
86
86
  content: '*';
87
87
  margin-left: 2px;
88
- color: var(--error, ${constants.ERROR});
88
+ color: ${getThemeValue(THEME_NAME.ERROR)};
89
89
  }
90
90
 
91
91
  /** Label Animation */
@@ -103,7 +103,7 @@ const SelectField = styled.select `
103
103
  ? `
104
104
  & + span {
105
105
  top: -8px;
106
- background: var(--background, ${constants.BACKGROUND});
106
+ background: ${getThemeValue(THEME_NAME.BACKGROUND)};
107
107
  font-size: 12px;
108
108
  line-height: 14px;
109
109
  }
@@ -112,13 +112,13 @@ const SelectField = styled.select `
112
112
 
113
113
  &:focus + span, &:placeholder-shown + span {
114
114
  top: -8px;
115
- background: var(--background, ${constants.BACKGROUND});
115
+ background: ${getThemeValue(THEME_NAME.BACKGROUND)};
116
116
  font-size: 12px;
117
117
  line-height: 14px;
118
118
  }
119
119
  `;
120
120
  const ErrorContainer = styled.div `
121
- color: var(--error, ${constants.ERROR});
121
+ color: ${getThemeValue(THEME_NAME.ERROR)};
122
122
  padding-top: 3px;
123
123
  font-size: 12px;
124
124
  line-height: 14px;
@@ -132,6 +132,12 @@ const ArrowContainer = styled.span `
132
132
  export default function Select(props) {
133
133
  const [touched, setTouched] = useState(false);
134
134
  const [value, setValue] = useState(props.value || '');
135
+ const errorId = useId();
136
+ useEffect(() => {
137
+ if (props.value !== undefined) {
138
+ setValue(props.value);
139
+ }
140
+ }, [props.value]);
135
141
  const handleFocus = (e) => {
136
142
  setTouched(true);
137
143
  if (props.onFocus) {
@@ -147,7 +153,7 @@ export default function Select(props) {
147
153
  setValue(e.target.value);
148
154
  }
149
155
  };
150
- return (_jsxs(Label, { children: [_jsxs(SelectField, Object.assign({}, props, { multiple: false, value: value, onChange: onChangeHandler, onFocus: handleFocus, touched: touched, children: [_jsx("option", {}), props.children] })), _jsx("span", { children: props.label }), _jsx(ArrowContainer, { children: _jsx(ExpandMore, {}) }), props.errorText && _jsx(ErrorContainer, { children: props.errorText })] }));
156
+ return (_jsxs(Label, { children: [_jsxs(SelectField, Object.assign({}, props, { multiple: false, value: value, onChange: onChangeHandler, onFocus: handleFocus, touched: touched, "aria-invalid": !!props.errorText, "aria-required": props.required, "aria-describedby": props.errorText ? errorId : undefined, children: [_jsx("option", {}), props.children] })), _jsx("span", { children: props.label }), _jsx(ArrowContainer, { "aria-hidden": "true", children: _jsx(ExpandMore, {}) }), props.errorText && _jsx(ErrorContainer, { id: errorId, children: props.errorText })] }));
151
157
  }
152
158
  Select.propTypes = {
153
159
  /** Label for the field */
@@ -1 +1 @@
1
- {"version":3,"file":"Select.js","sourceRoot":"","sources":["../../../src/components/Input/Select.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAa/C,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA;;;;;;;;;;;CAWzB,CAAC;AAEF,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAqB;;;;;;;;4CAQV,SAAS,CAAC,YAAY;;0CAExB,SAAS,CAAC,UAAU;;;;;;;uCAOvB,SAAS,CAAC,OAAO;+CACT,SAAS,CAAC,aAAa;;;;;gCAKtC,SAAS,CAAC,OAAO;;;;;+CAKF,SAAS,CAAC,eAAe;uDACjB,SAAS,CAAC,mBAAmB;;;;iCAInD,SAAS,CAAC,QAAQ;;;;;qCAKd,SAAS,CAAC,KAAK;mDACD,SAAS,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,CAAC,QAAQ,EAAE,CAAC;YACjB,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACzB,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QACtB,CAAC;aAAM,CAAC;YACJ,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC7B,CAAC;IACL,CAAC,CAAC;IAEF,OAAO,CACH,MAAC,KAAK,eACF,MAAC,WAAW,oBACJ,KAAK,IACT,QAAQ,EAAE,KAAK,EACf,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,OAAO,aAEhB,kBAAU,EACT,KAAK,CAAC,QAAQ,KACL,EACd,yBAAO,KAAK,CAAC,KAAK,GAAQ,EAC1B,KAAC,cAAc,cACX,KAAC,UAAU,KAAG,GACD,EAChB,KAAK,CAAC,SAAS,IAAI,KAAC,cAAc,cAAE,KAAK,CAAC,SAAS,GAAkB,IAClE,CACX,CAAC;AACN,CAAC;AAED,MAAM,CAAC,SAAS,GAAG;IACf,0BAA0B;IAC1B,KAAK,EAAE,SAAS,CAAC,MAAM;IACvB,6CAA6C;IAC7C,SAAS,EAAE,SAAS,CAAC,MAAM;CAC9B,CAAC","sourcesContent":["import React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport styled from '@emotion/styled';\nimport ExpandMore from '../../icons/ExpandMore';\nimport constants from '../../shared/constants';\n\ninterface SelectProps\n extends\n PropTypes.InferType<typeof Select.propTypes>,\n React.InputHTMLAttributes<HTMLSelectElement> {\n value?: string;\n}\n\ntype SelectInternalProps = SelectProps & {\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 pointer-events: none;\n max-width: 268px;\n\n & svg {\n fill: currentColor;\n }\n`;\n\nconst SelectField = styled.select<SelectInternalProps>`\n border: none;\n color: inherit;\n padding: 0 8px;\n line-height: 30px;\n min-height: 32px;\n width: 268px;\n border-radius: 3px;\n border: 1px solid var(--border-color, ${constants.BORDER_COLOR});\n display: inline-block;\n background-color: var(--background, ${constants.BACKGROUND});\n pointer-events: auto;\n appearance: none;\n\n /** Focused */\n &:focus,\n &:active {\n border-color: var(--primary, ${constants.PRIMARY});\n box-shadow: 0 0 0 4px var(--primary, ${constants.PRIMARY_LIGHT});\n }\n\n &:focus ~ span,\n &:active ~ span {\n color: var(--primary, ${constants.PRIMARY});\n }\n\n /** Disabled */\n &:disabled {\n border-color: var(--disabled-border, ${constants.DISABLED_BORDER});\n background-color: var(--disabled-background, ${constants.DISABLED_BACKGROUND});\n }\n\n &:disabled ~ span {\n color: var(--disabled, ${constants.DISABLED});\n }\n\n /** Invalid */\n &:focus:invalid {\n border-color: var(--error, ${constants.ERROR});\n box-shadow: 0 0 0 4px var(--error-light, ${constants.ERROR_LIGHT});\n }\n\n ${(props) =>\n props.touched\n ? `\n &:invalid {\n border-color: var(--error, ${constants.ERROR});\n }\n\n &:invalid ~ span {\n color: var(--error, ${constants.ERROR});\n }\n `\n : ''}\n\n /** Error */\n ${(props) =>\n props.errorText\n ? `\n border-color: var(--error, ${constants.ERROR});\n\n & ~ span {\n color: var(--error, ${constants.ERROR});\n }\n `\n : ''}\n\n /** Required */\n &:required + span:after {\n content: '*';\n margin-left: 2px;\n color: var(--error, ${constants.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: var(--background, ${constants.BACKGROUND});\n font-size: 12px;\n line-height: 14px;\n }\n `\n : ''}\n\n &:focus + span, &:placeholder-shown + span {\n top: -8px;\n background: var(--background, ${constants.BACKGROUND});\n font-size: 12px;\n line-height: 14px;\n }\n`;\n\nconst ErrorContainer = styled.div`\n color: var(--error, ${constants.ERROR});\n padding-top: 3px;\n font-size: 12px;\n line-height: 14px;\n margin-left: 3px;\n`;\n\nconst ArrowContainer = styled.span`\n position: absolute;\n right: 8px;\n top: 8px;\n`;\n\nexport default function Select(props: SelectProps) {\n const [touched, setTouched] = useState(false);\n const [value, setValue] = useState(props.value || '');\n\n const handleFocus = (e: React.FocusEvent<HTMLSelectElement>) => {\n setTouched(true);\n if (props.onFocus) {\n props.onFocus(e);\n }\n };\n\n const onChangeHandler = (e: React.ChangeEvent<HTMLSelectElement>) => {\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 <SelectField\n {...props}\n multiple={false}\n value={value}\n onChange={onChangeHandler}\n onFocus={handleFocus}\n touched={touched}\n >\n <option />\n {props.children}\n </SelectField>\n <span>{props.label}</span>\n <ArrowContainer>\n <ExpandMore />\n </ArrowContainer>\n {props.errorText && <ErrorContainer>{props.errorText}</ErrorContainer>}\n </Label>\n );\n}\n\nSelect.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"]}
1
+ {"version":3,"file":"Select.js","sourceRoot":"","sources":["../../../src/components/Input/Select.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAanE,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA;;;;;;;;;;;CAWzB,CAAC;AAEF,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAqB;;;;;;;;wBAQ9B,aAAa,CAAC,UAAU,CAAC,YAAY,CAAC;;wBAEtC,aAAa,CAAC,UAAU,CAAC,U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SAAS,mBAChB,KAAK,CAAC,QAAQ,sBACX,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,aAEvD,kBAAU,EACT,KAAK,CAAC,QAAQ,KACL,EACd,yBAAO,KAAK,CAAC,KAAK,GAAQ,EAC1B,KAAC,cAAc,mBAAa,MAAM,YAC9B,KAAC,UAAU,KAAG,GACD,EAChB,KAAK,CAAC,SAAS,IAAI,KAAC,cAAc,IAAC,EAAE,EAAE,OAAO,YAAG,KAAK,CAAC,SAAS,GAAkB,IAC/E,CACX,CAAC;AACN,CAAC;AAED,MAAM,CAAC,SAAS,GAAG;IACf,0BAA0B;IAC1B,KAAK,EAAE,SAAS,CAAC,MAAM;IACvB,6CAA6C;IAC7C,SAAS,EAAE,SAAS,CAAC,MAAM;CAC9B,CAAC","sourcesContent":["import React, { useState, useEffect, useId } from 'react';\nimport PropTypes from 'prop-types';\nimport styled from '@emotion/styled';\nimport ExpandMore from '../../icons/ExpandMore';\nimport { getThemeValue, THEME_NAME } from '../../shared/constants';\n\ninterface SelectProps\n extends\n PropTypes.InferType<typeof Select.propTypes>,\n React.InputHTMLAttributes<HTMLSelectElement> {\n value?: string;\n}\n\ntype SelectInternalProps = SelectProps & {\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 pointer-events: none;\n max-width: 268px;\n\n & svg {\n fill: currentColor;\n }\n`;\n\nconst SelectField = styled.select<SelectInternalProps>`\n border: none;\n color: inherit;\n padding: 0 8px;\n line-height: 30px;\n min-height: 32px;\n width: 268px;\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 pointer-events: auto;\n appearance: none;\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 }\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 ArrowContainer = styled.span`\n position: absolute;\n right: 8px;\n top: 8px;\n`;\n\nexport default function Select(props: SelectProps) {\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<HTMLSelectElement>) => {\n setTouched(true);\n if (props.onFocus) {\n props.onFocus(e);\n }\n };\n\n const onChangeHandler = (e: React.ChangeEvent<HTMLSelectElement>) => {\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 <SelectField\n {...props}\n multiple={false}\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 <option />\n {props.children}\n </SelectField>\n <span>{props.label}</span>\n <ArrowContainer aria-hidden=\"true\">\n <ExpandMore />\n </ArrowContainer>\n {props.errorText && <ErrorContainer id={errorId}>{props.errorText}</ErrorContainer>}\n </Label>\n );\n}\n\nSelect.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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../../src/components/Input/TextArea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,SAAS,MAAM,YAAY,CAAC;AAInC,UAAU,aACN,SACI,SAAS,CAAC,SAAS,CAAC,OAAO,QAAQ,CAAC,SAAS,CAAC,EAC9C,KAAK,CAAC,mBAAmB,CAAC,mBAAmB,CAAC;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AA2HD,iBAAwB,QAAQ,CAAC,KAAK,EAAE,aAAa,oDAiCpD;kBAjCuB,QAAQ;;QAoC5B,0BAA0B;;QAE1B,6CAA6C;;;;eAtCzB,QAAQ"}
1
+ {"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../../src/components/Input/TextArea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqC,MAAM,OAAO,CAAC;AAC1D,OAAO,SAAS,MAAM,YAAY,CAAC;AAInC,UAAU,aACN,SACI,SAAS,CAAC,SAAS,CAAC,OAAO,QAAQ,CAAC,SAAS,CAAC,EAC9C,KAAK,CAAC,mBAAmB,CAAC,mBAAmB,CAAC;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AA2HD,iBAAwB,QAAQ,CAAC,KAAK,EAAE,aAAa,oDA2CpD;kBA3CuB,QAAQ;;QA8C5B,0BAA0B;;QAE1B,6CAA6C;;;;eAhDzB,QAAQ"}
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
- import { useState } from 'react';
2
+ import { useState, useEffect, useId } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import styled from '@emotion/styled';
5
- import constants from '../../shared/constants';
5
+ import { getThemeValue, THEME_NAME } from '../../shared/constants';
6
6
  const Label = styled.label `
7
7
  display: inline-flex;
8
8
  flex-direction: column;
@@ -16,46 +16,46 @@ const TextField = styled.textarea `
16
16
  min-height: 150px;
17
17
  min-width: 250px;
18
18
  border-radius: 3px;
19
- border: 1px solid var(--border-color, ${constants.BORDER_COLOR});
19
+ border: 1px solid ${getThemeValue(THEME_NAME.BORDER_COLOR)};
20
20
  display: inline-block;
21
- background-color: var(--background, ${constants.BACKGROUND});
21
+ background-color: ${getThemeValue(THEME_NAME.BACKGROUND)};
22
22
 
23
23
  /** Focused */
24
24
  &:focus,
25
25
  &:active {
26
- border-color: var(--primary, ${constants.PRIMARY});
27
- box-shadow: 0 0 0 4px var(--primary, ${constants.PRIMARY_LIGHT});
26
+ border-color: ${getThemeValue(THEME_NAME.PRIMARY)};
27
+ box-shadow: 0 0 0 4px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};
28
28
  }
29
29
 
30
30
  &:focus + span,
31
31
  &:active + span {
32
- color: var(--primary, ${constants.PRIMARY});
32
+ color: ${getThemeValue(THEME_NAME.PRIMARY)};
33
33
  }
34
34
 
35
35
  /** Disabled */
36
36
  &:disabled {
37
- border-color: var(--disabled-border, ${constants.DISABLED_BORDER});
38
- background-color: var(--disabled-background, ${constants.DISABLED_BACKGROUND});
37
+ border-color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};
38
+ background-color: ${getThemeValue(THEME_NAME.DISABLED_BACKGROUND)};
39
39
  }
40
40
 
41
41
  &:disabled + span {
42
- color: var(--disabled, ${constants.DISABLED});
42
+ color: ${getThemeValue(THEME_NAME.DISABLED)};
43
43
  }
44
44
 
45
45
  /** Invalid */
46
46
  &:focus:invalid {
47
- border-color: var(--error, ${constants.ERROR});
48
- box-shadow: 0 0 0 4px var(--error-light, ${constants.ERROR_LIGHT});
47
+ border-color: ${getThemeValue(THEME_NAME.ERROR)};
48
+ box-shadow: 0 0 0 4px ${getThemeValue(THEME_NAME.ERROR_LIGHT)};
49
49
  }
50
50
 
51
51
  ${(props) => props.touched
52
52
  ? `
53
53
  &:invalid {
54
- border-color: var(--error, ${constants.ERROR});
54
+ border-color: ${getThemeValue(THEME_NAME.ERROR)};
55
55
  }
56
56
 
57
57
  &:invalid + span {
58
- color: var(--error, ${constants.ERROR});
58
+ color: ${getThemeValue(THEME_NAME.ERROR)};
59
59
  }
60
60
  `
61
61
  : ''}
@@ -63,10 +63,10 @@ const TextField = styled.textarea `
63
63
  /** Error */
64
64
  ${(props) => props.errorText
65
65
  ? `
66
- border-color: var(--error, ${constants.ERROR});
66
+ border-color: ${getThemeValue(THEME_NAME.ERROR)};
67
67
 
68
68
  & + span {
69
- color: var(--error, ${constants.ERROR});
69
+ color: ${getThemeValue(THEME_NAME.ERROR)};
70
70
  }
71
71
  `
72
72
  : ''}
@@ -75,7 +75,7 @@ const TextField = styled.textarea `
75
75
  &:required + span:after {
76
76
  content: '*';
77
77
  margin-left: 2px;
78
- color: var(--error, ${constants.ERROR});
78
+ color: ${getThemeValue(THEME_NAME.ERROR)};
79
79
  }
80
80
 
81
81
  /** Label Animation */
@@ -93,7 +93,7 @@ const TextField = styled.textarea `
93
93
  ? `
94
94
  & + span {
95
95
  top: -8px;
96
- background: var(--background, ${constants.BACKGROUND});
96
+ background: ${getThemeValue(THEME_NAME.BACKGROUND)};
97
97
  font-size: 12px;
98
98
  line-height: 14px;
99
99
  }
@@ -102,13 +102,13 @@ const TextField = styled.textarea `
102
102
 
103
103
  &:focus + span, &:placeholder-shown + span {
104
104
  top: -8px;
105
- background: var(--background, ${constants.BACKGROUND});
105
+ background: ${getThemeValue(THEME_NAME.BACKGROUND)};
106
106
  font-size: 12px;
107
107
  line-height: 14px;
108
108
  }
109
109
  `;
110
110
  const ErrorContainer = styled.div `
111
- color: var(--error, ${constants.ERROR});
111
+ color: ${getThemeValue(THEME_NAME.ERROR)};
112
112
  padding-top: 3px;
113
113
  font-size: 12px;
114
114
  line-height: 14px;
@@ -117,6 +117,12 @@ const ErrorContainer = styled.div `
117
117
  export default function TextArea(props) {
118
118
  const [touched, setTouched] = useState(false);
119
119
  const [value, setValue] = useState(props.value || '');
120
+ const errorId = useId();
121
+ useEffect(() => {
122
+ if (props.value !== undefined) {
123
+ setValue(props.value);
124
+ }
125
+ }, [props.value]);
120
126
  const handleFocus = (e) => {
121
127
  setTouched(true);
122
128
  if (props.onFocus) {
@@ -132,7 +138,7 @@ export default function TextArea(props) {
132
138
  setValue(e.target.value);
133
139
  }
134
140
  };
135
- return (_jsxs(Label, { children: [_jsx(TextField, Object.assign({}, props, { value: value, onChange: onChangeHandler, onFocus: handleFocus, touched: touched })), _jsx("span", { children: props.label }), props.errorText && _jsx(ErrorContainer, { children: props.errorText })] }));
141
+ return (_jsxs(Label, { children: [_jsx(TextField, Object.assign({}, props, { value: value, onChange: onChangeHandler, onFocus: handleFocus, touched: touched, "aria-invalid": !!props.errorText, "aria-required": props.required, "aria-describedby": props.errorText ? errorId : undefined })), _jsx("span", { children: props.label }), props.errorText && _jsx(ErrorContainer, { id: errorId, children: props.errorText })] }));
136
142
  }
137
143
  TextArea.propTypes = {
138
144
  /** Label for the field */
@@ -1 +1 @@
1
- {"version":3,"file":"TextArea.js","sourceRoot":"","sources":["../../../src/components/Input/TextArea.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAa/C,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA;;;;;CAKzB,CAAC;AAEF,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAuB;;;;;;;4CAOZ,SAAS,CAAC,YAAY;;0CAExB,SAAS,CAAC,UAAU;;;;;uCAKvB,SAAS,CAAC,OAAO;+CACT,SAAS,CAAC,aAAa;;;;;gCAKtC,SAAS,CAAC,OAAO;;;;;+CAKF,SAAS,CAAC,eAAe;uDACjB,SAAS,CAAC,mBAAmB;;;;iCAInD,SAAS,CAAC,QAAQ;;;;;qCAKd,SAAS,CAAC,KAAK;mDACD,SAAS,CAAC,WAAW;;;MAGlE,CAAC,KAAK,EAAE,EAAE,CACR,KAAK,CAAC,OAAO;IACT,CAAC,CAAC;;qCAEuB,SAAS,CAAC,KAAK;;;;8BAItB,SAAS,CAAC,KAAK;;KAExC;IACO,CAAC,CAAC,EAAE;;;MAGV,CAAC,KAAK,EAAE,EAAE,CACR,KAAK,CAAC,SAAS;IACX,CAAC,CAAC;iCACmB,SAAS,CAAC,KAAK;;;8BAGlB,SAAS,CAAC,KAAK;;KAExC;IACO,CAAC,CAAC,EAAE;;;;;;8BAMc,SAAS,CAAC,KAAK;;;;;;;;;;;;;;MAcvC,CAAC,KAAK,EAAE,EAAE,CACR,KAAK,CAAC,KAAK,KAAK,EAAE;IACd,CAAC,CAAC;;;wCAG0B,SAAS,CAAC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CAAC;AAED,QAAQ,CAAC,SAAS,GAAG;IACjB,0BAA0B;IAC1B,KAAK,EAAE,SAAS,CAAC,MAAM;IACvB,6CAA6C;IAC7C,SAAS,EAAE,SAAS,CAAC,MAAM;CAC9B,CAAC","sourcesContent":["import React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport styled from '@emotion/styled';\nimport constants from '../../shared/constants';\n\ninterface TextAreaProps\n extends\n PropTypes.InferType<typeof TextArea.propTypes>,\n React.InputHTMLAttributes<HTMLTextAreaElement> {\n value?: string;\n}\n\ntype TextAreaInternalProps = TextAreaProps & {\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.textarea<TextAreaInternalProps>`\n border: none;\n color: inherit;\n padding: 8px;\n min-height: 150px;\n min-width: 250px;\n border-radius: 3px;\n border: 1px solid var(--border-color, ${constants.BORDER_COLOR});\n display: inline-block;\n background-color: var(--background, ${constants.BACKGROUND});\n\n /** Focused */\n &:focus,\n &:active {\n border-color: var(--primary, ${constants.PRIMARY});\n box-shadow: 0 0 0 4px var(--primary, ${constants.PRIMARY_LIGHT});\n }\n\n &:focus + span,\n &:active + span {\n color: var(--primary, ${constants.PRIMARY});\n }\n\n /** Disabled */\n &:disabled {\n border-color: var(--disabled-border, ${constants.DISABLED_BORDER});\n background-color: var(--disabled-background, ${constants.DISABLED_BACKGROUND});\n }\n\n &:disabled + span {\n color: var(--disabled, ${constants.DISABLED});\n }\n\n /** Invalid */\n &:focus:invalid {\n border-color: var(--error, ${constants.ERROR});\n box-shadow: 0 0 0 4px var(--error-light, ${constants.ERROR_LIGHT});\n }\n\n ${(props) =>\n props.touched\n ? `\n &:invalid {\n border-color: var(--error, ${constants.ERROR});\n }\n\n &:invalid + span {\n color: var(--error, ${constants.ERROR});\n }\n `\n : ''}\n\n /** Error */\n ${(props) =>\n props.errorText\n ? `\n border-color: var(--error, ${constants.ERROR});\n\n & + span {\n color: var(--error, ${constants.ERROR});\n }\n `\n : ''}\n\n /** Required */\n &:required + span:after {\n content: '*';\n margin-left: 2px;\n color: var(--error, ${constants.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: var(--background, ${constants.BACKGROUND});\n font-size: 12px;\n line-height: 14px;\n }\n `\n : ''}\n\n &:focus + span, &:placeholder-shown + span {\n top: -8px;\n background: var(--background, ${constants.BACKGROUND});\n font-size: 12px;\n line-height: 14px;\n }\n`;\n\nconst ErrorContainer = styled.div`\n color: var(--error, ${constants.ERROR});\n padding-top: 3px;\n font-size: 12px;\n line-height: 14px;\n margin-left: 3px;\n`;\n\nexport default function TextArea(props: TextAreaProps) {\n const [touched, setTouched] = useState(false);\n const [value, setValue] = useState(props.value || '');\n\n const handleFocus = (e: React.FocusEvent<HTMLTextAreaElement>) => {\n setTouched(true);\n if (props.onFocus) {\n props.onFocus(e);\n }\n };\n\n const onChangeHandler = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\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 value={value}\n onChange={onChangeHandler}\n onFocus={handleFocus}\n touched={touched}\n />\n <span>{props.label}</span>\n {props.errorText && <ErrorContainer>{props.errorText}</ErrorContainer>}\n </Label>\n );\n}\n\nTextArea.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"]}
1
+ {"version":3,"file":"TextArea.js","sourceRoot":"","sources":["../../../src/components/Input/TextArea.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,SAAS,MAAM,YAAY,C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C;QAC7B,CAAC;IACL,CAAC,CAAC;IAEF,OAAO,CACH,MAAC,KAAK,eACF,KAAC,SAAS,oBACF,KAAK,IACT,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,OAAO,kBACF,CAAC,CAAC,KAAK,CAAC,SAAS,mBAChB,KAAK,CAAC,QAAQ,sBACX,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,IACzD,EACF,yBAAO,KAAK,CAAC,KAAK,GAAQ,EACzB,KAAK,CAAC,SAAS,IAAI,KAAC,cAAc,IAAC,EAAE,EAAE,OAAO,YAAG,KAAK,CAAC,SAAS,GAAkB,IAC/E,CACX,CAAC;AACN,CAAC;AAED,QAAQ,CAAC,SAAS,GAAG;IACjB,0BAA0B;IAC1B,KAAK,EAAE,SAAS,CAAC,MAAM;IACvB,6CAA6C;IAC7C,SAAS,EAAE,SAAS,CAAC,MAAM;CAC9B,CAAC","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\ninterface TextAreaProps\n extends\n PropTypes.InferType<typeof TextArea.propTypes>,\n React.InputHTMLAttributes<HTMLTextAreaElement> {\n value?: string;\n}\n\ntype TextAreaInternalProps = TextAreaProps & {\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.textarea<TextAreaInternalProps>`\n border: none;\n color: inherit;\n padding: 8px;\n min-height: 150px;\n min-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 }\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\nexport default function TextArea(props: TextAreaProps) {\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<HTMLTextAreaElement>) => {\n setTouched(true);\n if (props.onFocus) {\n props.onFocus(e);\n }\n };\n\n const onChangeHandler = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\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 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\nTextArea.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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Toggle.d.ts","sourceRoot":"","sources":["../../../src/components/Input/Toggle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AA4EnC,KAAK,WAAW,GAAG,SAAS,CAAC,UAAU,CACnC,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,GAAG,OAAO,MAAM,CAAC,SAAS,CACtE,CAAC;AAEF,iBAAS,MAAM,CAAC,KAAK,EAAE,WAAW,oDAQjC;kBARQ,MAAM;;QAWX,0BAA0B;;;;AAI9B,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Toggle.d.ts","sourceRoot":"","sources":["../../../src/components/Input/Toggle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AA+EnC,KAAK,WAAW,GAAG,SAAS,CAAC,UAAU,CACnC,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,GAAG,OAAO,MAAM,CAAC,SAAS,CACtE,CAAC;AAEF,iBAAS,MAAM,CAAC,KAAK,EAAE,WAAW,oDAQjC;kBARQ,MAAM;;QAWX,0BAA0B;;;;AAI9B,eAAe,MAAM,CAAC"}