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,5 +1,9 @@
1
- declare const _default: import("@emotion/styled").StyledComponent<{
2
- theme?: import("@emotion/react").Theme;
3
- as?: React.ElementType;
4
- }, import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>;
5
- export default _default;
1
+ import React from 'react';
2
+ declare const LinkButton: React.ForwardRefExoticComponent<{
3
+ /**
4
+ * Type of Link Button
5
+ * @default 'button'
6
+ */
7
+ type?: "button" | "submit" | "reset";
8
+ } & React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
9
+ export default LinkButton;
@@ -1,10 +1,25 @@
1
+ import { jsx } from '@emotion/react/jsx-runtime';
2
+ import React from 'react';
1
3
  import styled from '@emotion/styled';
2
4
  import { getThemeValue, THEME_NAME } from '../../shared/constants.js';
3
5
 
4
- var LinkButton = /*#__PURE__*/ styled("button", {
5
- target: "ecu06nw0",
6
- label: ""
6
+ const StyledLinkButton = /*#__PURE__*/ styled("button", {
7
+ target: "e1d039580",
8
+ label: "StyledLinkButton"
7
9
  })("min-width:100px;font-size:14px;text-align:center;height:32px;cursor:pointer;background-color:transparent;border:none;color:", getThemeValue(THEME_NAME.PRIMARY), ";padding:0 12px;margin:5px;position:relative;display:inline-flex;align-items:center;justify-content:center;& svg{vertical-align:middle;height:24px;width:24px;fill:currentColor;margin-left:-6px;}&:enabled:hover,&:focus{text-decoration:underline;}&:disabled{border-color:", getThemeValue(THEME_NAME.BORDER_COLOR), ";color:", getThemeValue(THEME_NAME.DISABLED), ";}");
10
+ /**
11
+ * LinkButton Component
12
+ * @param props - Component props
13
+ * @param ref - Ref forwarded to the underlying HTMLButtonElement
14
+ */ const LinkButtonComponent = (props, ref)=>{
15
+ const { type = 'button', ...rest } = props;
16
+ return /*#__PURE__*/ jsx(StyledLinkButton, {
17
+ ref: ref,
18
+ type: type,
19
+ ...rest
20
+ });
21
+ };
22
+ const LinkButton = /*#__PURE__*/ React.forwardRef(LinkButtonComponent);
8
23
 
9
24
  export { LinkButton as default };
10
25
  //# sourceMappingURL=LinkButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LinkButton.js","sources":["../../../src/components/Button/LinkButton.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport { getThemeValue, THEME_NAME } from '../../shared/constants';\n\nexport default styled.button`\n min-width: 100px;\n font-size: 14px;\n text-align: center;\n height: 32px;\n cursor: pointer;\n background-color: transparent;\n border: none;\n color: ${getThemeValue(THEME_NAME.PRIMARY)};\n padding: 0 12px;\n margin: 5px;\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n\n & svg {\n vertical-align: middle;\n height: 24px;\n width: 24px;\n fill: currentColor;\n margin-left: -6px;\n }\n\n &:enabled:hover,\n &:focus {\n text-decoration: underline;\n }\n\n &:disabled {\n border-color: ${getThemeValue(THEME_NAME.BORDER_COLOR)};\n color: ${getThemeValue(THEME_NAME.DISABLED)};\n }\n`;\n"],"names":["styled","getThemeValue","THEME_NAME","PRIMARY","BORDER_COLOR","DISABLED"],"mappings":";;;AAGA,iBAAA,cAAeA,MAAAA,CAAAA,QAAAA,EAAAA;;;kIAQFC,aAAAA,CAAcC,UAAAA,CAAWC,OAAO,CAAA,EAAA,+QAAA,EAsBrBF,aAAAA,CAAcC,UAAAA,CAAWE,YAAY,CAAA,EAAA,SAAA,EAC5CH,aAAAA,CAAcC,UAAAA,CAAWG,QAAQ,CAAA,EAAA,IAAA,CAAA;;;;"}
1
+ {"version":3,"file":"LinkButton.js","sources":["../../../src/components/Button/LinkButton.tsx"],"sourcesContent":["import React from 'react';\nimport styled from '@emotion/styled';\nimport { getThemeValue, THEME_NAME } from '../../shared/constants';\n\nconst StyledLinkButton = styled.button`\n min-width: 100px;\n font-size: 14px;\n text-align: center;\n height: 32px;\n cursor: pointer;\n background-color: transparent;\n border: none;\n color: ${getThemeValue(THEME_NAME.PRIMARY)};\n padding: 0 12px;\n margin: 5px;\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n\n & svg {\n vertical-align: middle;\n height: 24px;\n width: 24px;\n fill: currentColor;\n margin-left: -6px;\n }\n\n &:enabled:hover,\n &:focus {\n text-decoration: underline;\n }\n\n &:disabled {\n border-color: ${getThemeValue(THEME_NAME.BORDER_COLOR)};\n color: ${getThemeValue(THEME_NAME.DISABLED)};\n }\n`;\n\ntype LinkButtonProps = {\n /**\n * Type of Link Button\n * @default 'button'\n */\n type?: 'button' | 'submit' | 'reset';\n} & React.ButtonHTMLAttributes<HTMLButtonElement>;\n\n/**\n * LinkButton Component\n * @param props - Component props\n * @param ref - Ref forwarded to the underlying HTMLButtonElement\n */\nconst LinkButtonComponent = (props: LinkButtonProps, ref: React.Ref<HTMLButtonElement>) => {\n const { type = 'button', ...rest } = props;\n\n return <StyledLinkButton ref={ref} type={type} {...rest} />;\n};\n\nconst LinkButton = React.forwardRef<HTMLButtonElement, LinkButtonProps>(LinkButtonComponent);\nexport default LinkButton;\n"],"names":["StyledLinkButton","styled","getThemeValue","THEME_NAME","PRIMARY","BORDER_COLOR","DISABLED","LinkButtonComponent","props","ref","type","rest","_jsx","LinkButton","React","forwardRef"],"mappings":";;;;;AAIA,MAAMA,gBAAAA,iBAAmBC,MAAAA,CAAAA,QAAAA,EAAAA;;;kIAQZC,aAAAA,CAAcC,UAAAA,CAAWC,OAAO,CAAA,EAAA,+QAAA,EAsBrBF,aAAAA,CAAcC,WAAWE,YAAY,CAAA,EAAA,SAAA,EAC5CH,aAAAA,CAAcC,UAAAA,CAAWG,QAAQ,CAAA,EAAA,IAAA,CAAA;AAYlD;;;;IAKA,MAAMC,mBAAAA,GAAsB,CAACC,KAAAA,EAAwBC,GAAAA,GAAAA;AACjD,IAAA,MAAM,EAAEC,IAAAA,GAAO,QAAQ,EAAE,GAAGC,MAAM,GAAGH,KAAAA;AAErC,IAAA,qBAAOI,GAAA,CAACZ,gBAAAA,EAAAA;QAAiBS,GAAAA,EAAKA,GAAAA;QAAKC,IAAAA,EAAMA,IAAAA;AAAO,QAAA,GAAGC;;AACvD,CAAA;AAEA,MAAME,UAAAA,iBAAaC,KAAAA,CAAMC,UAAU,CAAqCR,mBAAAA;;;;"}
@@ -1,5 +1,9 @@
1
- declare const _default: import("@emotion/styled").StyledComponent<{
2
- theme?: import("@emotion/react").Theme;
3
- as?: React.ElementType;
4
- }, import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>;
5
- export default _default;
1
+ import React from 'react';
2
+ declare const RaisedButton: React.ForwardRefExoticComponent<{
3
+ /**
4
+ * Type of Raised Button
5
+ * @default 'button'
6
+ */
7
+ type?: "button" | "submit" | "reset";
8
+ } & React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
9
+ export default RaisedButton;
@@ -1,10 +1,25 @@
1
+ import { jsx } from '@emotion/react/jsx-runtime';
2
+ import React from 'react';
1
3
  import styled from '@emotion/styled';
2
4
  import { getThemeValue, THEME_NAME } from '../../shared/constants.js';
3
5
 
4
- var RaisedButton = /*#__PURE__*/ styled("button", {
5
- target: "etv67u90",
6
- label: ""
6
+ const StyledRaisedButton = /*#__PURE__*/ styled("button", {
7
+ target: "e1p6mbrx0",
8
+ label: "StyledRaisedButton"
7
9
  })("border:1px solid ", getThemeValue(THEME_NAME.BORDER_COLOR), ";border-radius:5px;height:32px;min-width:100px;font-size:14px;text-align:center;padding:0 12px;cursor:", getThemeValue(THEME_NAME.TEXT_COLOR_DARK), ";color:inherit;background-color:", getThemeValue(THEME_NAME.BACKGROUND), ";transform:translateY(-2px);box-shadow:", getThemeValue(THEME_NAME.HOVER_SHADOW), ";margin:5px;position:relative;display:inline-flex;align-items:center;justify-content:center;& svg{vertical-align:middle;height:24px;width:24px;margin-left:-6px;fill:currentColor;}&:enabled:hover{border-color:", getThemeValue(THEME_NAME.PRIMARY), ";color:", getThemeValue(THEME_NAME.PRIMARY), ";}&:focus{border-color:", getThemeValue(THEME_NAME.PRIMARY), ";}&:disabled{background-color:", getThemeValue(THEME_NAME.DISABLED_BACKGROUND), ";border-color:", getThemeValue(THEME_NAME.LIGHT_GREY), ";color:", getThemeValue(THEME_NAME.DISABLED), ";}&:active{transform:translateY(0);box-shadow:", getThemeValue(THEME_NAME.SHADOW), ";}");
10
+ /**
11
+ * RaisedButton Component
12
+ * @param props - Component props
13
+ * @param ref - Ref forwarded to the underlying HTMLButtonElement
14
+ */ const RaisedButtonComponent = (props, ref)=>{
15
+ const { type = 'button', ...rest } = props;
16
+ return /*#__PURE__*/ jsx(StyledRaisedButton, {
17
+ ref: ref,
18
+ type: type,
19
+ ...rest
20
+ });
21
+ };
22
+ const RaisedButton = /*#__PURE__*/ React.forwardRef(RaisedButtonComponent);
8
23
 
9
24
  export { RaisedButton as default };
10
25
  //# sourceMappingURL=RaisedButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RaisedButton.js","sources":["../../../src/components/Button/RaisedButton.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport { getThemeValue, THEME_NAME } from '../../shared/constants';\n\nexport default styled.button`\n border: 1px solid ${getThemeValue(THEME_NAME.BORDER_COLOR)};\n border-radius: 5px;\n height: 32px;\n min-width: 100px;\n font-size: 14px;\n text-align: center;\n padding: 0 12px;\n cursor: ${getThemeValue(THEME_NAME.TEXT_COLOR_DARK)};\n color: inherit;\n background-color: ${getThemeValue(THEME_NAME.BACKGROUND)};\n transform: translateY(-2px);\n box-shadow: ${getThemeValue(THEME_NAME.HOVER_SHADOW)};\n margin: 5px;\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n\n & svg {\n vertical-align: middle;\n height: 24px;\n width: 24px;\n margin-left: -6px;\n fill: currentColor;\n }\n\n &:enabled:hover {\n border-color: ${getThemeValue(THEME_NAME.PRIMARY)};\n color: ${getThemeValue(THEME_NAME.PRIMARY)};\n }\n\n &:focus {\n border-color: ${getThemeValue(THEME_NAME.PRIMARY)};\n }\n\n &:disabled {\n background-color: ${getThemeValue(THEME_NAME.DISABLED_BACKGROUND)};\n border-color: ${getThemeValue(THEME_NAME.LIGHT_GREY)};\n color: ${getThemeValue(THEME_NAME.DISABLED)};\n }\n\n &:active {\n transform: translateY(0);\n box-shadow: ${getThemeValue(THEME_NAME.SHADOW)};\n }\n`;\n"],"names":["styled","getThemeValue","THEME_NAME","BORDER_COLOR","TEXT_COLOR_DARK","BACKGROUND","HOVER_SHADOW","PRIMARY","DISABLED_BACKGROUND","LIGHT_GREY","DISABLED","SHADOW"],"mappings":";;;AAGA,mBAAA,cAAeA,MAAAA,CAAAA,QAAAA,EAAAA;;;AACSC,CAAAA,CAAAA,CAAAA,mBAAAA,EAAAA,aAAAA,CAAcC,WAAWC,YAAY,CAAA,EAAA,wGAAA,EAO/CF,cAAcC,UAAAA,CAAWE,eAAe,uCAE9BH,aAAAA,CAAcC,UAAAA,CAAWG,UAAU,CAAA,EAAA,yCAAA,EAEzCJ,aAAAA,CAAcC,WAAWI,YAAY,CAAA,EAAA,kNAAA,EAgB/BL,cAAcC,UAAAA,CAAWK,OAAO,cACvCN,aAAAA,CAAcC,UAAAA,CAAWK,OAAO,CAAA,EAAA,yBAAA,EAIzBN,cAAcC,UAAAA,CAAWK,OAAO,qCAI5BN,aAAAA,CAAcC,UAAAA,CAAWM,mBAAmB,CAAA,EAAA,gBAAA,EAChDP,aAAAA,CAAcC,WAAWO,UAAU,CAAA,EAAA,SAAA,EAC1CR,cAAcC,UAAAA,CAAWQ,QAAQ,qDAK5BT,aAAAA,CAAcC,UAAAA,CAAWS,MAAM,CAAA,EAAA,IAAA,CAAA;;;;"}
1
+ {"version":3,"file":"RaisedButton.js","sources":["../../../src/components/Button/RaisedButton.tsx"],"sourcesContent":["import React from 'react';\nimport styled from '@emotion/styled';\nimport { getThemeValue, THEME_NAME } from '../../shared/constants';\n\nconst StyledRaisedButton = styled.button`\n border: 1px solid ${getThemeValue(THEME_NAME.BORDER_COLOR)};\n border-radius: 5px;\n height: 32px;\n min-width: 100px;\n font-size: 14px;\n text-align: center;\n padding: 0 12px;\n cursor: ${getThemeValue(THEME_NAME.TEXT_COLOR_DARK)};\n color: inherit;\n background-color: ${getThemeValue(THEME_NAME.BACKGROUND)};\n transform: translateY(-2px);\n box-shadow: ${getThemeValue(THEME_NAME.HOVER_SHADOW)};\n margin: 5px;\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n\n & svg {\n vertical-align: middle;\n height: 24px;\n width: 24px;\n margin-left: -6px;\n fill: currentColor;\n }\n\n &:enabled:hover {\n border-color: ${getThemeValue(THEME_NAME.PRIMARY)};\n color: ${getThemeValue(THEME_NAME.PRIMARY)};\n }\n\n &:focus {\n border-color: ${getThemeValue(THEME_NAME.PRIMARY)};\n }\n\n &:disabled {\n background-color: ${getThemeValue(THEME_NAME.DISABLED_BACKGROUND)};\n border-color: ${getThemeValue(THEME_NAME.LIGHT_GREY)};\n color: ${getThemeValue(THEME_NAME.DISABLED)};\n }\n\n &:active {\n transform: translateY(0);\n box-shadow: ${getThemeValue(THEME_NAME.SHADOW)};\n }\n`;\n\ntype RaisedButtonProps = {\n /**\n * Type of Raised Button\n * @default 'button'\n */\n type?: 'button' | 'submit' | 'reset';\n} & React.ButtonHTMLAttributes<HTMLButtonElement>;\n\n/**\n * RaisedButton Component\n * @param props - Component props\n * @param ref - Ref forwarded to the underlying HTMLButtonElement\n */\nconst RaisedButtonComponent = (props: RaisedButtonProps, ref: React.Ref<HTMLButtonElement>) => {\n const { type = 'button', ...rest } = props;\n\n return <StyledRaisedButton ref={ref} type={type} {...rest} />;\n};\n\nconst RaisedButton = React.forwardRef<HTMLButtonElement, RaisedButtonProps>(RaisedButtonComponent);\nexport default RaisedButton;\n"],"names":["StyledRaisedButton","styled","getThemeValue","THEME_NAME","BORDER_COLOR","TEXT_COLOR_DARK","BACKGROUND","HOVER_SHADOW","PRIMARY","DISABLED_BACKGROUND","LIGHT_GREY","DISABLED","SHADOW","RaisedButtonComponent","props","ref","type","rest","_jsx","RaisedButton","React","forwardRef"],"mappings":";;;;;AAIA,MAAMA,kBAAAA,iBAAqBC,MAAAA,CAAAA,QAAAA,EAAAA;;;AACHC,CAAAA,CAAAA,CAAAA,mBAAAA,EAAAA,aAAAA,CAAcC,WAAWC,YAAY,CAAA,EAAA,wGAAA,EAO/CF,cAAcC,UAAAA,CAAWE,eAAe,uCAE9BH,aAAAA,CAAcC,UAAAA,CAAWG,UAAU,CAAA,EAAA,yCAAA,EAEzCJ,cAAcC,UAAAA,CAAWI,YAAY,uNAgB/BL,aAAAA,CAAcC,UAAAA,CAAWK,OAAO,CAAA,EAAA,SAAA,EACvCN,aAAAA,CAAcC,UAAAA,CAAWK,OAAO,8BAIzBN,aAAAA,CAAcC,UAAAA,CAAWK,OAAO,CAAA,EAAA,gCAAA,EAI5BN,aAAAA,CAAcC,WAAWM,mBAAmB,CAAA,EAAA,gBAAA,EAChDP,cAAcC,UAAAA,CAAWO,UAAU,cAC1CR,aAAAA,CAAcC,UAAAA,CAAWQ,QAAQ,CAAA,EAAA,gDAAA,EAK5BT,aAAAA,CAAcC,WAAWS,MAAM,CAAA,EAAA,IAAA,CAAA;AAYrD;;;;IAKA,MAAMC,qBAAAA,GAAwB,CAACC,KAAAA,EAA0BC,GAAAA,GAAAA;AACrD,IAAA,MAAM,EAAEC,IAAAA,GAAO,QAAQ,EAAE,GAAGC,MAAM,GAAGH,KAAAA;AAErC,IAAA,qBAAOI,GAAA,CAAClB,kBAAAA,EAAAA;QAAmBe,GAAAA,EAAKA,GAAAA;QAAKC,IAAAA,EAAMA,IAAAA;AAAO,QAAA,GAAGC;;AACzD,CAAA;AAEA,MAAME,YAAAA,iBAAeC,KAAAA,CAAMC,UAAU,CAAuCR,qBAAAA;;;;"}
@@ -1,8 +1,6 @@
1
- export interface CardExtraProps {
1
+ import React from 'react';
2
+ declare const Card: React.ForwardRefExoticComponent<{
3
+ /** Shows a shadow around the card to show elevation */
2
4
  elevated?: boolean;
3
- }
4
- declare const Card: import("@emotion/styled").StyledComponent<{
5
- theme?: import("@emotion/react").Theme;
6
- as?: React.ElementType;
7
- } & CardExtraProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
5
+ } & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
8
6
  export default Card;
@@ -1,10 +1,23 @@
1
+ import { jsx } from '@emotion/react/jsx-runtime';
2
+ import React from 'react';
1
3
  import styled from '@emotion/styled';
2
4
  import { getThemeValue, THEME_NAME } from '../../shared/constants.js';
3
5
 
4
- const Card = /*#__PURE__*/ styled("div", {
5
- target: "e1jmwjfy0",
6
- label: "Card"
6
+ const StyledCard = /*#__PURE__*/ styled("div", {
7
+ target: "ebufzie0",
8
+ label: "StyledCard"
7
9
  })("border-radius:10px;background-color:", getThemeValue(THEME_NAME.BACKGROUND), ";", (props)=>props.elevated ? `box-shadow: ${getThemeValue(THEME_NAME.MODAL_SHADOW)};` : `box-shadow: ${getThemeValue(THEME_NAME.SHADOW)};`, " margin:5px;overflow:auto;position:relative;");
10
+ /**
11
+ * Card Component
12
+ * @param props - Component props
13
+ * @param ref - Ref forwarded to the underlying HTMLDivElement
14
+ */ function CardComponent(props, ref) {
15
+ return /*#__PURE__*/ jsx(StyledCard, {
16
+ ...props,
17
+ ref: ref
18
+ });
19
+ }
20
+ const Card = /*#__PURE__*/ React.forwardRef(CardComponent);
8
21
 
9
22
  export { Card as default };
10
23
  //# sourceMappingURL=Card.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Card.js","sources":["../../../src/components/Card/Card.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport { THEME_NAME, getThemeValue } from '../../shared/constants';\n\nexport interface CardExtraProps {\n elevated?: boolean;\n}\n\nconst Card = styled.div<CardExtraProps>`\n border-radius: 10px;\n background-color: ${getThemeValue(THEME_NAME.BACKGROUND)};\n ${(props) =>\n props.elevated\n ? `box-shadow: ${getThemeValue(THEME_NAME.MODAL_SHADOW)};`\n : `box-shadow: ${getThemeValue(THEME_NAME.SHADOW)};`}\n margin: 5px;\n overflow: auto;\n position: relative;\n`;\n\nexport default Card;\n"],"names":["Card","styled","getThemeValue","THEME_NAME","BACKGROUND","props","elevated","MODAL_SHADOW","SHADOW"],"mappings":";;;AAOA,MAAMA,IAAAA,iBAAOC,MAAAA,CAAAA,KAAAA,EAAAA;;;2CAEWC,aAAAA,CAAcC,UAAAA,CAAWC,UAAU,CAAA,EAAA,GAAA,EACrD,CAACC,KAAAA,GACCA,KAAAA,CAAMC,QAAQ,GACR,CAAC,YAAY,EAAEJ,aAAAA,CAAcC,UAAAA,CAAWI,YAAY,CAAA,CAAE,CAAC,CAAC,GACxD,CAAC,YAAY,EAAEL,aAAAA,CAAcC,UAAAA,CAAWK,MAAM,CAAA,CAAE,CAAC,CAAC,EAAA,iDAAA;;;;"}
1
+ {"version":3,"file":"Card.js","sources":["../../../src/components/Card/Card.tsx"],"sourcesContent":["import React from 'react';\nimport styled from '@emotion/styled';\nimport { THEME_NAME, getThemeValue } from '../../shared/constants';\n\ntype CardProps = {\n /** Shows a shadow around the card to show elevation */\n elevated?: boolean;\n} & React.HTMLAttributes<HTMLDivElement>;\n\nconst StyledCard = styled.div<CardProps>`\n border-radius: 10px;\n background-color: ${getThemeValue(THEME_NAME.BACKGROUND)};\n ${(props) =>\n props.elevated\n ? `box-shadow: ${getThemeValue(THEME_NAME.MODAL_SHADOW)};`\n : `box-shadow: ${getThemeValue(THEME_NAME.SHADOW)};`}\n margin: 5px;\n overflow: auto;\n position: relative;\n`;\n\n/**\n * Card Component\n * @param props - Component props\n * @param ref - Ref forwarded to the underlying HTMLDivElement\n */\nfunction CardComponent(props: CardProps, ref: React.Ref<HTMLDivElement>) {\n return <StyledCard {...props} ref={ref} />;\n}\n\nconst Card = React.forwardRef<HTMLDivElement, CardProps>(CardComponent);\nexport default Card;\n"],"names":["StyledCard","styled","getThemeValue","THEME_NAME","BACKGROUND","props","elevated","MODAL_SHADOW","SHADOW","CardComponent","ref","_jsx","Card","React","forwardRef"],"mappings":";;;;;AASA,MAAMA,UAAAA,iBAAaC,MAAAA,CAAAA,KAAAA,EAAAA;;;2CAEKC,aAAAA,CAAcC,UAAAA,CAAWC,UAAU,CAAA,EAAA,GAAA,EACrD,CAACC,KAAAA,GACCA,KAAAA,CAAMC,QAAQ,GACR,CAAC,YAAY,EAAEJ,aAAAA,CAAcC,UAAAA,CAAWI,YAAY,CAAA,CAAE,CAAC,CAAC,GACxD,CAAC,YAAY,EAAEL,aAAAA,CAAcC,UAAAA,CAAWK,MAAM,CAAA,CAAE,CAAC,CAAC,EAAA,iDAAA,CAAA;AAMhE;;;;AAIC,IACD,SAASC,aAAAA,CAAcJ,KAAgB,EAAEK,GAA8B,EAAA;AACnE,IAAA,qBAAOC,GAAA,CAACX,UAAAA,EAAAA;AAAY,QAAA,GAAGK,KAAK;QAAEK,GAAAA,EAAKA;;AACvC;AAEA,MAAME,IAAAA,iBAAOC,KAAAA,CAAMC,UAAU,CAA4BL,aAAAA;;;;"}
@@ -7,5 +7,5 @@ interface ChipProps {
7
7
  /** Aria label for the close button. Defaults to "Remove {label}" */
8
8
  closeButtonAriaLabel?: string;
9
9
  }
10
- export default function Chip(props: ChipProps & React.HTMLAttributes<HTMLSpanElement>): import("@emotion/react/jsx-runtime").JSX.Element;
11
- export {};
10
+ declare const Chip: React.ForwardRefExoticComponent<ChipProps & React.HTMLAttributes<HTMLSpanElement> & React.RefAttributes<HTMLSpanElement>>;
11
+ export default Chip;
@@ -1,18 +1,22 @@
1
1
  import { jsxs, jsx } from '@emotion/react/jsx-runtime';
2
- import 'react';
2
+ import React from 'react';
3
3
  import styled from '@emotion/styled';
4
4
  import { getThemeValue, THEME_NAME } from '../../shared/constants.js';
5
5
  import Close from '../../icons/Close.js';
6
6
 
7
- const Container = /*#__PURE__*/ styled("span", {
8
- target: "e1b6ywa20",
7
+ const Container$8 = /*#__PURE__*/ styled("span", {
8
+ target: "eg8hsap0",
9
9
  label: "Container"
10
10
  })("padding:5px;padding-left:15px;border-radius:16px;background-color:", getThemeValue(THEME_NAME.BORDER_LIGHT_COLOR), ";display:inline-flex;margin:5px;line-height:20px;align-items:center;");
11
- const Button = /*#__PURE__*/ styled("button", {
12
- target: "e1b6ywa21",
11
+ const Button$1 = /*#__PURE__*/ styled("button", {
12
+ target: "eg8hsap1",
13
13
  label: "Button"
14
14
  })("color:", getThemeValue(THEME_NAME.BACKGROUND), ";background-color:", getThemeValue(THEME_NAME.DISABLED), ";border-radius:50%;border:none;padding:4px;display:inline-flex;margin-left:5px;&:focus-within{outline:4px solid ", getThemeValue(THEME_NAME.ERROR_LIGHT), ";}");
15
- function Chip(props) {
15
+ /**
16
+ * Chip Component
17
+ * @param props - Component props
18
+ * @param ref - Ref forwarded to the underlying HTMLSpanElement
19
+ */ function ChipComponent(props, ref) {
16
20
  const { label, onCloseClick, closeButtonAriaLabel, ...rest } = props;
17
21
  const keyUpHandler = (e)=>{
18
22
  if (e.key === 'Backspace' || e.key === 'Delete') {
@@ -25,12 +29,13 @@ function Chip(props) {
25
29
  e.stopPropagation();
26
30
  }
27
31
  };
28
- return /*#__PURE__*/ jsxs(Container, {
32
+ return /*#__PURE__*/ jsxs(Container$8, {
29
33
  ...rest,
34
+ ref: ref,
30
35
  onKeyUp: keyUpHandler,
31
36
  children: [
32
37
  label,
33
- /*#__PURE__*/ jsx(Button, {
38
+ /*#__PURE__*/ jsx(Button$1, {
34
39
  onClick: onCloseClick,
35
40
  onKeyDown: buttonKeyDownHandler,
36
41
  "aria-label": closeButtonAriaLabel ?? `Remove ${label}`,
@@ -42,6 +47,7 @@ function Chip(props) {
42
47
  ]
43
48
  });
44
49
  }
50
+ const Chip = /*#__PURE__*/ React.forwardRef(ChipComponent);
45
51
 
46
52
  export { Chip as default };
47
53
  //# sourceMappingURL=Chip.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Chip.js","sources":["../../../src/components/Chip/Chip.tsx"],"sourcesContent":["import React from 'react';\nimport styled from '@emotion/styled';\nimport { Close } from '../../icons';\nimport { getThemeValue, THEME_NAME } from '../../shared/constants';\n\ninterface ChipProps {\n /** Label for the chip */\n label: string;\n /** Callback when the close button is clicked */\n onCloseClick?: (e: React.KeyboardEvent | React.MouseEvent) => void;\n /** Aria label for the close button. Defaults to \"Remove {label}\" */\n closeButtonAriaLabel?: string;\n}\n\nconst Container = styled.span`\n padding: 5px;\n padding-left: 15px;\n border-radius: 16px;\n background-color: ${getThemeValue(THEME_NAME.BORDER_LIGHT_COLOR)};\n display: inline-flex;\n margin: 5px;\n line-height: 20px;\n align-items: center;\n`;\n\nconst Button = styled.button`\n color: ${getThemeValue(THEME_NAME.BACKGROUND)};\n background-color: ${getThemeValue(THEME_NAME.DISABLED)};\n border-radius: 50%;\n border: none;\n padding: 4px;\n display: inline-flex;\n margin-left: 5px;\n\n &:focus-within {\n outline: 4px solid ${getThemeValue(THEME_NAME.ERROR_LIGHT)};\n }\n`;\n\nexport default function Chip(props: ChipProps & React.HTMLAttributes<HTMLSpanElement>) {\n const { label, onCloseClick, closeButtonAriaLabel, ...rest } = props;\n\n const keyUpHandler: React.KeyboardEventHandler<HTMLSpanElement> = (e) => {\n if (e.key === 'Backspace' || e.key === 'Delete') {\n onCloseClick?.(e);\n }\n };\n\n const buttonKeyDownHandler: React.KeyboardEventHandler<HTMLButtonElement> = (e) => {\n // Stop propagation to prevent DragAndDrop from capturing Space/Enter\n if (e.key === ' ' || e.key === 'Spacebar' || e.key === 'Enter') {\n e.stopPropagation();\n }\n };\n\n return (\n <Container {...rest} onKeyUp={keyUpHandler}>\n {label}\n <Button\n onClick={onCloseClick}\n onKeyDown={buttonKeyDownHandler}\n aria-label={closeButtonAriaLabel ?? `Remove ${label}`}\n >\n <Close height={16} width={16} />\n </Button>\n </Container>\n );\n}\n"],"names":["Container","styled","getThemeValue","THEME_NAME","BORDER_LIGHT_COLOR","Button","BACKGROUND","DISABLED","ERROR_LIGHT","Chip","props","label","onCloseClick","closeButtonAriaLabel","rest","keyUpHandler","e","key","buttonKeyDownHandler","stopPropagation","_jsxs","onKeyUp","_jsx","onClick","onKeyDown","aria-label","Close","height","width"],"mappings":";;;;;;AAcA,MAAMA,SAAAA,iBAAYC,MAAAA,CAAAA,MAAAA,EAAAA;;;AAIMC,CAAAA,CAAAA,CAAAA,oEAAAA,EAAAA,aAAAA,CAAcC,WAAWC,kBAAkB,CAAA,EAAA,sEAAA,CAAA;AAOnE,MAAMC,MAAAA,iBAASJ,MAAAA,CAAAA,QAAAA,EAAAA;;;aACFC,aAAAA,CAAcC,UAAAA,CAAWG,UAAU,CAAA,EAAA,oBAAA,EACxBJ,aAAAA,CAAcC,WAAWI,QAAQ,CAAA,EAAA,kHAAA,EAQ5BL,aAAAA,CAAcC,UAAAA,CAAWK,WAAW,CAAA,EAAA,IAAA,CAAA;AAIlD,SAASC,KAAKC,KAAwD,EAAA;IACjF,MAAM,EAAEC,KAAK,EAAEC,YAAY,EAAEC,oBAAoB,EAAE,GAAGC,IAAAA,EAAM,GAAGJ,KAAAA;AAE/D,IAAA,MAAMK,eAA4D,CAACC,CAAAA,GAAAA;AAC/D,QAAA,IAAIA,EAAEC,GAAG,KAAK,eAAeD,CAAAA,CAAEC,GAAG,KAAK,QAAA,EAAU;YAC7CL,YAAAA,GAAeI,CAAAA,CAAAA;AACnB,QAAA;AACJ,IAAA,CAAA;AAEA,IAAA,MAAME,uBAAsE,CAACF,CAAAA,GAAAA;;QAEzE,IAAIA,CAAAA,CAAEC,GAAG,KAAK,GAAA,IAAOD,CAAAA,CAAEC,GAAG,KAAK,UAAA,IAAcD,CAAAA,CAAEC,GAAG,KAAK,OAAA,EAAS;AAC5DD,YAAAA,CAAAA,CAAEG,eAAe,EAAA;AACrB,QAAA;AACJ,IAAA,CAAA;AAEA,IAAA,qBACIC,IAAA,CAACpB,SAAAA,EAAAA;AAAW,QAAA,GAAGc,IAAI;QAAEO,OAAAA,EAASN,YAAAA;;AACzBJ,YAAAA,KAAAA;0BACDW,GAAA,CAACjB,MAAAA,EAAAA;gBACGkB,OAAAA,EAASX,YAAAA;gBACTY,SAAAA,EAAWN,oBAAAA;AACXO,gBAAAA,YAAAA,EAAYZ,oBAAAA,IAAwB,CAAC,OAAO,EAAEF,KAAAA,CAAAA,CAAO;AAErD,gBAAA,QAAA,gBAAAW,GAAA,CAACI,KAAAA,EAAAA;oBAAMC,MAAAA,EAAQ,EAAA;oBAAIC,KAAAA,EAAO;;;;;AAI1C;;;;"}
1
+ {"version":3,"file":"Chip.js","sources":["../../../src/components/Chip/Chip.tsx"],"sourcesContent":["import React from 'react';\nimport styled from '@emotion/styled';\nimport { Close } from '../../icons';\nimport { getThemeValue, THEME_NAME } from '../../shared/constants';\n\ninterface ChipProps {\n /** Label for the chip */\n label: string;\n /** Callback when the close button is clicked */\n onCloseClick?: (e: React.KeyboardEvent | React.MouseEvent) => void;\n /** Aria label for the close button. Defaults to \"Remove {label}\" */\n closeButtonAriaLabel?: string;\n}\n\nconst Container = styled.span`\n padding: 5px;\n padding-left: 15px;\n border-radius: 16px;\n background-color: ${getThemeValue(THEME_NAME.BORDER_LIGHT_COLOR)};\n display: inline-flex;\n margin: 5px;\n line-height: 20px;\n align-items: center;\n`;\n\nconst Button = styled.button`\n color: ${getThemeValue(THEME_NAME.BACKGROUND)};\n background-color: ${getThemeValue(THEME_NAME.DISABLED)};\n border-radius: 50%;\n border: none;\n padding: 4px;\n display: inline-flex;\n margin-left: 5px;\n\n &:focus-within {\n outline: 4px solid ${getThemeValue(THEME_NAME.ERROR_LIGHT)};\n }\n`;\n\n/**\n * Chip Component\n * @param props - Component props\n * @param ref - Ref forwarded to the underlying HTMLSpanElement\n */\nfunction ChipComponent(\n props: ChipProps & React.HTMLAttributes<HTMLSpanElement>,\n ref: React.Ref<HTMLSpanElement>,\n) {\n const { label, onCloseClick, closeButtonAriaLabel, ...rest } = props;\n\n const keyUpHandler: React.KeyboardEventHandler<HTMLSpanElement> = (e) => {\n if (e.key === 'Backspace' || e.key === 'Delete') {\n onCloseClick?.(e);\n }\n };\n\n const buttonKeyDownHandler: React.KeyboardEventHandler<HTMLButtonElement> = (e) => {\n // Stop propagation to prevent DragAndDrop from capturing Space/Enter\n if (e.key === ' ' || e.key === 'Spacebar' || e.key === 'Enter') {\n e.stopPropagation();\n }\n };\n\n return (\n <Container {...rest} ref={ref} onKeyUp={keyUpHandler}>\n {label}\n <Button\n onClick={onCloseClick}\n onKeyDown={buttonKeyDownHandler}\n aria-label={closeButtonAriaLabel ?? `Remove ${label}`}\n >\n <Close height={16} width={16} />\n </Button>\n </Container>\n );\n}\n\nconst Chip = React.forwardRef(ChipComponent);\nexport default Chip;\n"],"names":["Container","styled","getThemeValue","THEME_NAME","BORDER_LIGHT_COLOR","Button","BACKGROUND","DISABLED","ERROR_LIGHT","ChipComponent","props","ref","label","onCloseClick","closeButtonAriaLabel","rest","keyUpHandler","e","key","buttonKeyDownHandler","stopPropagation","_jsxs","onKeyUp","_jsx","onClick","on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ACDW,GAAA,CAAClB,QAAAA,EAAAA;gBACGmB,OAAAA,EAASX,YAAAA;gBACTY,SAAAA,EAAWN,oBAAAA;AACXO,gBAAAA,YAAAA,EAAYZ,oBAAAA,IAAwB,CAAC,OAAO,EAAEF,KAAAA,CAAAA,CAAO;AAErD,gBAAA,QAAA,gBAAAW,GAAA,CAACI,KAAAA,EAAAA;oBAAMC,MAAAA,EAAQ,EAAA;oBAAIC,KAAAA,EAAO;;;;;AAI1C;AAEA,MAAMC,IAAAA,iBAAOC,KAAAA,CAAMC,UAAU,CAACvB,aAAAA;;;;"}
@@ -1,42 +1,31 @@
1
1
  import React from 'react';
2
- import PropTypes from 'prop-types';
3
- type ChipInputProps = PropTypes.InferProps<typeof ChipInput.propTypes>;
4
- /**
5
- * A chip input component that allows users to add and remove chips (tags) by typing and pressing Enter.
6
- * @component
7
- * @example
8
- * ```tsx
9
- * <ChipInput
10
- * value={['tag1', 'tag2']}
11
- * onChange={(newTags) => console.log(newTags)}
12
- * label="Add tags"
13
- * errorText="At least one tag is required"
14
- * />
15
- * ```
16
- */
17
- declare function ChipInput(props: ChipInputProps & React.AllHTMLAttributes<HTMLInputElement>): import("@emotion/react/jsx-runtime").JSX.Element;
18
- declare namespace ChipInput {
19
- var propTypes: {
20
- /** Label for the field */
21
- label: PropTypes.Validator<string>;
22
- /** Error message for the field */
23
- errorText: PropTypes.Requireable<string>;
24
- /** Values to display as chips */
25
- value: PropTypes.Requireable<string[]>;
26
- /** Callback when chips change */
27
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
28
- /** Aria label for the close button on chip. Defaults to "Remove {label}" */
29
- closeButtonAriaLabel: PropTypes.Requireable<string>;
30
- /** Announcement text when a chip is added. Defaults to "{label} was added" */
31
- addedAnnouncementTemplate: PropTypes.Requireable<string>;
32
- /** Announcement text when a chip is removed. Defaults to "{label} was removed" */
33
- removedAnnouncementTemplate: PropTypes.Requireable<string>;
34
- };
35
- var defaultProps: {
36
- value: any[];
37
- closeButtonAriaLabel: string;
38
- addedAnnouncementTemplate: string;
39
- removedAnnouncementTemplate: string;
40
- };
2
+ interface ChipInputProps {
3
+ /** Label for the field */
4
+ label: string;
5
+ /** Error message for the field */
6
+ errorText?: string;
7
+ /**
8
+ * Values to display as chips
9
+ * @default []
10
+ */
11
+ value?: string[];
12
+ /** Callback when chips change */
13
+ onChange?: (newValue: string[]) => void;
14
+ /**
15
+ * Aria label for the close button on chip. Defaults to "Remove {:label}"
16
+ * @default "Remove {:label}"
17
+ */
18
+ closeButtonAriaLabel?: string;
19
+ /**
20
+ * Announcement text when a chip is added. Defaults to "{:label} was added"
21
+ * @default "{:label} was added"
22
+ */
23
+ addedAnnouncementTemplate?: string;
24
+ /**
25
+ * Announcement text when a chip is removed. Defaults to "{:label} was removed"
26
+ * @default "{:label} was removed"
27
+ */
28
+ removedAnnouncementTemplate?: string;
41
29
  }
30
+ declare const ChipInput: React.ForwardRefExoticComponent<ChipInputProps & React.AllHTMLAttributes<HTMLInputElement> & React.RefAttributes<HTMLInputElement>>;
42
31
  export default ChipInput;
@@ -1,6 +1,5 @@
1
1
  import { jsxs, Fragment, 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, useImperativeHandle, useEffect } from 'react';
4
3
  import styled from '@emotion/styled';
5
4
  import { getThemeValue, THEME_NAME } from '../../shared/constants.js';
6
5
  import Chip from '../Chip/Chip.js';
@@ -8,8 +7,8 @@ import DragAndDrop from '../DragAndDrop/DragAndDrop.js';
8
7
  import { ORIENTATION } from '../DragAndDrop/types.js';
9
8
 
10
9
  // Label component for the ChipInput
11
- const Label = /*#__PURE__*/ styled("label", {
12
- target: "ey9yju70",
10
+ const Label$6 = /*#__PURE__*/ styled("label", {
11
+ target: "e12jan4z0",
13
12
  label: "Label"
14
13
  })("display:inline-flex;flex-direction:column;flex:1;position:relative;margin:10px 5px;color:inherit;padding:0 8px;width:250px;border-radius:3px;border:1px solid ", getThemeValue(THEME_NAME.BORDER_COLOR), ";background-color:", getThemeValue(THEME_NAME.BACKGROUND), ";&:has(:focus),&:has(:active){border-color:", getThemeValue(THEME_NAME.PRIMARY), ";box-shadow:0 0 0 4px ", getThemeValue(THEME_NAME.PRIMARY_LIGHT), ";}&:has(:focus) > span,&:has(:active) > span{color:", getThemeValue(THEME_NAME.PRIMARY), ";}&:has(:disabled){border-color:", getThemeValue(THEME_NAME.DISABLED_BORDER), ";background-color:", getThemeValue(THEME_NAME.DISABLED_BACKGROUND), ";}&:has(:disabled) > span{color:", getThemeValue(THEME_NAME.DISABLED), ";}&:has(:focus:invalid){border-color:", getThemeValue(THEME_NAME.ERROR), ";box-shadow:0 0 0 4px ", getThemeValue(THEME_NAME.ERROR_LIGHT), ";}", (props)=>props.touched ? `
15
14
  &:has(:invalid) {
@@ -25,7 +24,11 @@ const Label = /*#__PURE__*/ styled("label", {
25
24
  & > span {
26
25
  color: ${getThemeValue(THEME_NAME.ERROR)};
27
26
  }
28
- ` : '', " \n &:has(:required) > span:after{content:'*';margin-left:2px;color:", getThemeValue(THEME_NAME.ERROR), ";}& > input{border:none;outline:none;line-height:30px;min-height:30px;max-width:95%;}& > span{position:absolute;padding:0 5px;top:0px;left:4px;font-size:14px;line-height:32px;transition:all 300ms ease;}&:has(:focus) > span,&:has(:placeholder-shown) > span{top:-8px;background:", getThemeValue(THEME_NAME.BACKGROUND), ";font-size:12px;line-height:14px;}", (props)=>props.text !== '' ? `
27
+ ` : '', " \n ", (props)=>props.required ? `& > span:after {
28
+ content: '*';
29
+ margin-left: 2px;
30
+ color: ${getThemeValue(THEME_NAME.ERROR)};
31
+ }` : '', " \n\n & > input{border:none;outline:none;line-height:30px;min-height:30px;max-width:95%;}& > span{position:absolute;padding:0 5px;top:0px;left:4px;font-size:14px;line-height:32px;transition:all 300ms ease;}&:has(:focus) > span,&:has(:placeholder-shown) > span{top:-8px;background:", getThemeValue(THEME_NAME.BACKGROUND), ";font-size:12px;line-height:14px;}", (props)=>props.text !== '' ? `
29
32
  & > span {
30
33
  top: -8px;
31
34
  background: ${getThemeValue(THEME_NAME.BACKGROUND)};
@@ -34,13 +37,13 @@ const Label = /*#__PURE__*/ styled("label", {
34
37
  }
35
38
  ` : '');
36
39
  // Error message container
37
- const ErrorContainer = /*#__PURE__*/ styled("div", {
38
- target: "ey9yju71",
40
+ const ErrorContainer$4 = /*#__PURE__*/ styled("div", {
41
+ target: "e12jan4z1",
39
42
  label: "ErrorContainer"
40
43
  })("color:", getThemeValue(THEME_NAME.ERROR), ";padding-top:3px;font-size:12px;line-height:14px;margin-left:3px;");
41
44
  // Visually hidden but accessible to screen readers
42
- const VisuallyHidden = /*#__PURE__*/ styled("ul", {
43
- target: "ey9yju72",
45
+ const VisuallyHidden$1 = /*#__PURE__*/ styled("ul", {
46
+ target: "e12jan4z2",
44
47
  label: "VisuallyHidden"
45
48
  })("position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0;& li{list-style:none;}");
46
49
  /**
@@ -55,26 +58,35 @@ const VisuallyHidden = /*#__PURE__*/ styled("ul", {
55
58
  * errorText="At least one tag is required"
56
59
  * />
57
60
  * ```
58
- */ function ChipInput(props) {
61
+ */ function ChipInputComponent(props, ref) {
62
+ const { value: propValue = [], closeButtonAriaLabel = `Remove {:label}`, addedAnnouncementTemplate = '{:label} was added', removedAnnouncementTemplate = '{:label} was removed' } = props;
59
63
  const [text, setText] = useState('');
60
64
  const [touched, setTouched] = useState(false);
61
- const [value, setValue] = useState(props.value || []);
65
+ const [value, setValue] = useState(propValue || []);
62
66
  const InputRef = React.useRef(null);
63
67
  const [announcement, setAnnouncement] = useState('');
64
68
  const errorId = useId();
69
+ // Forward the underlying input element.
70
+ useImperativeHandle(ref, ()=>InputRef.current);
65
71
  /**
66
72
  * Replace {:label} placeholder in template string
67
73
  */ const replacePlaceholder = (template, label)=>{
68
74
  if (!template) return undefined;
69
75
  return template.replace(/\{:label\}/g, label);
70
76
  };
77
+ const prevPropValueRef = React.useRef(undefined);
71
78
  // Sync internal value with props.value
72
79
  useEffect(()=>{
73
- if (Array.isArray(props.value)) {
74
- setValue(props.value);
80
+ if (Array.isArray(propValue)) {
81
+ const prevValue = prevPropValueRef.current;
82
+ const isEqual = prevValue && propValue.length === prevValue.length && propValue.every((val, index)=>val === prevValue[index]);
83
+ if (!isEqual) {
84
+ setValue(propValue);
85
+ prevPropValueRef.current = propValue;
86
+ }
75
87
  }
76
88
  }, [
77
- props.value
89
+ propValue
78
90
  ]);
79
91
  /**
80
92
  * Update the chip values and notify changes.
@@ -103,14 +115,14 @@ const VisuallyHidden = /*#__PURE__*/ styled("ul", {
103
115
  * Adds a new chip on Enter key press.
104
116
  * @param e React keyboard event
105
117
  */ const handleKeyUp = (e)=>{
106
- if (e.key === 'Enter' && text.trim() !== '' && InputRef.current.validity.valid) {
118
+ if (e.key === 'Enter' && text.trim() !== '' && InputRef.current?.validity.valid) {
107
119
  const newValue = [
108
120
  ...value,
109
121
  text.trim()
110
122
  ];
111
123
  updateValue(newValue);
112
124
  setText('');
113
- setAnnouncement(replacePlaceholder(props.addedAnnouncementTemplate, text.trim()));
125
+ setAnnouncement(replacePlaceholder(addedAnnouncementTemplate, text.trim()));
114
126
  }
115
127
  };
116
128
  /**
@@ -119,7 +131,7 @@ const VisuallyHidden = /*#__PURE__*/ styled("ul", {
119
131
  */ const removeChip = (chipToRemove)=>{
120
132
  const newValue = value.filter((chip)=>chip !== chipToRemove);
121
133
  updateValue(newValue);
122
- setAnnouncement(replacePlaceholder(props.removedAnnouncementTemplate, chipToRemove));
134
+ setAnnouncement(replacePlaceholder(removedAnnouncementTemplate, chipToRemove));
123
135
  };
124
136
  /**
125
137
  * Moves a chip from one position to another.
@@ -140,10 +152,11 @@ const VisuallyHidden = /*#__PURE__*/ styled("ul", {
140
152
  // Render the component
141
153
  return /*#__PURE__*/ jsxs(Fragment, {
142
154
  children: [
143
- /*#__PURE__*/ jsxs(Label, {
155
+ /*#__PURE__*/ jsxs(Label$6, {
144
156
  text: text,
145
157
  touched: touched,
146
158
  errorText: props.errorText,
159
+ required: props.required,
147
160
  children: [
148
161
  /*#__PURE__*/ jsx("input", {
149
162
  ...props,
@@ -164,20 +177,20 @@ const VisuallyHidden = /*#__PURE__*/ styled("ul", {
164
177
  children: value.map((chip)=>/*#__PURE__*/ jsx(Chip, {
165
178
  label: chip,
166
179
  onCloseClick: ()=>removeChip(chip),
167
- closeButtonAriaLabel: replacePlaceholder(props.closeButtonAriaLabel, chip)
180
+ closeButtonAriaLabel: replacePlaceholder(closeButtonAriaLabel, chip)
168
181
  }, chip))
169
182
  })
170
183
  }),
171
184
  /*#__PURE__*/ jsx("span", {
172
185
  children: props.label
173
186
  }),
174
- props.errorText && /*#__PURE__*/ jsx(ErrorContainer, {
187
+ props.errorText && /*#__PURE__*/ jsx(ErrorContainer$4, {
175
188
  id: errorId,
176
189
  children: props.errorText
177
190
  })
178
191
  ]
179
192
  }),
180
- /*#__PURE__*/ jsx(VisuallyHidden, {
193
+ /*#__PURE__*/ jsx(VisuallyHidden$1, {
181
194
  "aria-live": "polite",
182
195
  "aria-atomic": "true",
183
196
  children: announcement
@@ -185,21 +198,7 @@ const VisuallyHidden = /*#__PURE__*/ styled("ul", {
185
198
  ]
186
199
  });
187
200
  }
188
- ChipInput.propTypes = {
189
- /** Label for the field */ label: PropTypes.string.isRequired,
190
- /** Error message for the field */ errorText: PropTypes.string,
191
- /** Values to display as chips */ value: PropTypes.arrayOf(PropTypes.string),
192
- /** Callback when chips change */ onChange: PropTypes.func,
193
- /** Aria label for the close button on chip. Defaults to "Remove {label}" */ closeButtonAriaLabel: PropTypes.string,
194
- /** Announcement text when a chip is added. Defaults to "{label} was added" */ addedAnnouncementTemplate: PropTypes.string,
195
- /** Announcement text when a chip is removed. Defaults to "{label} was removed" */ removedAnnouncementTemplate: PropTypes.string
196
- };
197
- ChipInput.defaultProps = {
198
- value: [],
199
- closeButtonAriaLabel: 'Remove {:label}',
200
- addedAnnouncementTemplate: '{:label} was added',
201
- removedAnnouncementTemplate: '{:label} was removed'
202
- };
201
+ const ChipInput = /*#__PURE__*/ React.forwardRef(ChipInputComponent);
203
202
 
204
203
  export { ChipInput as default };
205
204
  //# sourceMappingURL=ChipInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChipInput.js","sources":["../../../src/components/ChipInput/ChipInput.tsx"],"sourcesContent":["import React, { useEffect, useId, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport styled from '@emotion/styled';\nimport { getThemeValue, THEME_NAME } from '../../shared/constants';\nimport Chip from '../Chip/Chip';\nimport { DragAndDrop, ORIENTATION } from '../DragAndDrop';\n\n// Prop types definition\ntype ChipInputProps = PropTypes.InferProps<typeof ChipInput.propTypes>;\n\n// Label component for the ChipInput\nconst Label = styled.label<{\n text: string;\n touched?: boolean;\n errorText?: string;\n}>`\n display: inline-flex;\n flex-direction: column;\n flex: 1;\n position: relative;\n margin: 10px 5px;\n color: inherit;\n padding: 0 8px;\n width: 250px;\n border-radius: 3px;\n border: 1px solid ${getThemeValue(THEME_NAME.BORDER_COLOR)};\n background-color: ${getThemeValue(THEME_NAME.BACKGROUND)};\n\n /** Focused */\n &:has(:focus),\n &:has(:active) {\n border-color: ${getThemeValue(THEME_NAME.PRIMARY)};\n box-shadow: 0 0 0 4px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};\n }\n\n &:has(:focus) > span,\n &:has(:active) > span {\n color: ${getThemeValue(THEME_NAME.PRIMARY)};\n }\n\n /** Disabled */\n &:has(:disabled) {\n border-color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};\n background-color: ${getThemeValue(THEME_NAME.DISABLED_BACKGROUND)};\n }\n\n &:has(:disabled) > span {\n color: ${getThemeValue(THEME_NAME.DISABLED)};\n }\n\n /** Invalid */\n &:has(: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 &:has(:invalid) {\n border-color: ${getThemeValue(THEME_NAME.ERROR)};\n }\n \n &:has(: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 &:has(:required) > span:after {\n content: '*';\n margin-left: 2px;\n color: ${getThemeValue(THEME_NAME.ERROR)};\n }\n\n & > input {\n border: none;\n outline: none;\n line-height: 30px;\n min-height: 30px;\n max-width: 95%;\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 &:has(:focus) > span,\n &:has(:placeholder-shown) > span {\n top: -8px;\n background: ${getThemeValue(THEME_NAME.BACKGROUND)};\n font-size: 12px;\n line-height: 14px;\n }\n\n ${(props) =>\n props.text !== ''\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\n// Error message container\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// Visually hidden but accessible to screen readers\nconst VisuallyHidden = styled.ul`\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n\n & li {\n list-style: none;\n }\n`;\n\n/**\n * A chip input component that allows users to add and remove chips (tags) by typing and pressing Enter.\n * @component\n * @example\n * ```tsx\n * <ChipInput\n * value={['tag1', 'tag2']}\n * onChange={(newTags) => console.log(newTags)}\n * label=\"Add tags\"\n * errorText=\"At least one tag is required\"\n * />\n * ```\n */\nexport default function ChipInput(\n props: ChipInputProps & React.AllHTMLAttributes<HTMLInputElement>,\n) {\n const [text, setText] = useState('');\n const [touched, setTouched] = useState(false);\n const [value, setValue] = useState<string[]>(props.value || []);\n const InputRef = React.useRef<HTMLInputElement>(null);\n const [announcement, setAnnouncement] = useState('');\n const errorId = useId();\n\n /**\n * Replace {:label} placeholder in template string\n */\n const replacePlaceholder = (\n template: string | undefined,\n label: string,\n ): string | undefined => {\n if (!template) return undefined;\n return template.replace(/\\{:label\\}/g, label);\n };\n\n // Sync internal value with props.value\n useEffect(() => {\n if (Array.isArray(props.value)) {\n setValue(props.value);\n }\n }, [props.value]);\n\n /**\n * Update the chip values and notify changes.\n * @param newValue The new array of chip values\n */\n const updateValue = (newValue: string[]) => {\n const deduped = Array.from(new Set(newValue));\n setValue(deduped);\n props.onChange?.(deduped);\n };\n\n /**\n * Marks the input as touched on focus.\n * @param e React focus event\n */\n const handleFocus = (e: React.FocusEvent<HTMLInputElement>) => {\n setTouched(true);\n if (props.onFocus) {\n props.onFocus(e);\n }\n };\n\n /**\n * Change handler for the input field.\n * @param e React change event\n */\n const handleChange: React.ChangeEventHandler<HTMLInputElement> = (e) => {\n setText(e.target.value);\n };\n\n /**\n * Adds a new chip on Enter key press.\n * @param e React keyboard event\n */\n const handleKeyUp: React.KeyboardEventHandler<HTMLInputElement> = (e) => {\n if (e.key === 'Enter' && text.trim() !== '' && InputRef.current.validity.valid) {\n const newValue = [...value, text.trim()];\n updateValue(newValue);\n setText('');\n setAnnouncement(replacePlaceholder(props.addedAnnouncementTemplate, text.trim())!);\n }\n };\n\n /**\n * Removes a chip from the list.\n * @param chipToRemove The chip value to remove\n */\n const removeChip = (chipToRemove: string) => {\n const newValue = value.filter((chip) => chip !== chipToRemove);\n updateValue(newValue);\n setAnnouncement(replacePlaceholder(props.removedAnnouncementTemplate, chipToRemove)!);\n };\n\n /**\n * Moves a chip from one position to another.\n * @param start The starting index of the item to move\n * @param end The ending index where the item should be placed\n */\n const onDrop = (start: number, end: number) => {\n // Clone existing elements\n const newItems = [...value];\n // Remove the element to be moved\n const item = newItems.splice(start, 1);\n // Add it back at the required position\n newItems.splice(end, 0, item[0]);\n // Update\n updateValue(newItems);\n };\n\n // Render the component\n return (\n <>\n <Label text={text} touched={touched} errorText={props.errorText}>\n <input\n {...props}\n ref={InputRef}\n value={text}\n onChange={handleChange}\n onFocus={handleFocus}\n onKeyUp={handleKeyUp}\n required={props.required && value.length === 0}\n aria-required={props.required}\n aria-invalid={!!props.errorText}\n aria-describedby={props.errorText ? errorId : undefined}\n />\n <div>\n {value?.length > 0 && (\n <DragAndDrop orientation={ORIENTATION.HORIZONTAL} onDrop={onDrop}>\n {value.map((chip) => (\n <Chip\n key={chip}\n label={chip}\n onCloseClick={() => removeChip(chip)}\n closeButtonAriaLabel={replacePlaceholder(\n props.closeButtonAriaLabel,\n chip,\n )}\n />\n ))}\n </DragAndDrop>\n )}\n </div>\n <span>{props.label}</span>\n {props.errorText && <ErrorContainer id={errorId}>{props.errorText}</ErrorContainer>}\n </Label>\n <VisuallyHidden aria-live=\"polite\" aria-atomic=\"true\">\n {announcement}\n </VisuallyHidden>\n </>\n );\n}\n\nChipInput.propTypes = {\n /** Label for the field */\n label: PropTypes.string.isRequired,\n /** Error message for the field */\n errorText: PropTypes.string,\n /** Values to display as chips */\n value: PropTypes.arrayOf(PropTypes.string),\n /** Callback when chips change */\n onChange: PropTypes.func,\n /** Aria label for the close button on chip. Defaults to \"Remove {label}\" */\n closeButtonAriaLabel: PropTypes.string,\n /** Announcement text when a chip is added. Defaults to \"{label} was added\" */\n addedAnnouncementTemplate: PropTypes.string,\n /** Announcement text when a chip is removed. Defaults to \"{label} was removed\" */\n removedAnnouncementTemplate: PropTypes.string,\n};\n\nChipInput.defaultProps = {\n value: [],\n closeButtonAriaLabel: 'Remove {:label}',\n addedAnnouncementTemplate: '{:label} was added',\n removedAnnouncementTemplate: '{:label} was removed',\n};\n"],"names":["Label","styled","getThemeValue","THEME_NAME","BORDER_COLOR","BACKGROUND","PRIMARY","PRIMARY_LIGHT","DISABLED_BORDER","DISABLED_BACKGROUND","DISABLED","ERROR","ERROR_LIGHT","props","touched","errorText","text","ErrorContainer","VisuallyHidden","ChipInput","setText","useState","setTouched","value","setValue","InputRef","React","useRef","announcement","setAnnouncement","errorId","useId","replacePlaceholder","template","label","undefined","replace","useEffect","Array","isArray","updateValue","newValue","deduped","from","Set","onChange","handleFocus","e","onFocus","handleChange","target","handleKeyUp","key","trim","current","validity","valid","addedAnnouncementTemplate","removeChip","chipToRemove","filter","chip","removedAnnouncementTemplate","onDrop","start","end","newItems","item","splice","_jsxs","_Fragment","_jsx","input","ref","onKeyUp","required","length","aria-required","aria-invalid","aria-describedby","div","DragAndDrop","orientation","ORIENTATION","HORIZONTAL","map","Chip","onCloseClick","closeButtonAriaLabel","span","id","aria-live","aria-atomic","propTypes","PropTypes","string","isRequired","arrayOf","func","defaultProps"],"mappings":";;;;;;;;;AAUA;AACA,MAAMA,KAAAA,iBAAQC,MAAAA,CAAAA,OAAAA,EAAAA;;;qKAcUC,aAAAA,CAAcC,UAAAA,CAAWC,YAAY,CAAA,EAAA,oBAAA,EACrCF,aAAAA,CAAcC,WAAWE,UAAU,CAAA,EAAA,6CAAA,EAKnCH,cAAcC,UAAAA,CAAWG,OAAO,6BACxBJ,aAAAA,CAAcC,UAAAA,CAAWI,aAAa,CAAA,EAAA,qDAAA,EAKrDL,aAAAA,CAAcC,WAAWG,OAAO,CAAA,EAAA,kCAAA,EAKzBJ,cAAcC,UAAAA,CAAWK,eAAe,yBACpCN,aAAAA,CAAcC,UAAAA,CAAWM,mBAAmB,CAAA,EAAA,kCAAA,EAIvDP,aAAAA,CAAcC,WAAWO,QAAQ,CAAA,EAAA,uCAAA,EAK1BR,cAAcC,UAAAA,CAAWQ,KAAK,6BACtBT,aAAAA,CAAcC,UAAAA,CAAWS,WAAW,CAAA,EAAA,IAAA,EA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E,wBAAAA,QAAAA,EAAAA,KAAAA,CAAMqB;;oBACZrB,KAAAA,CAAME,SAAS,kBAAIwD,GAAA,CAACtD,cAAAA,EAAAA;wBAAeyE,EAAAA,EAAI5D,OAAAA;AAAUjB,wBAAAA,QAAAA,EAAAA,KAAAA,CAAME;;;;0BAE5DwD,GAAA,CAACrD,cAAAA,EAAAA;gBAAeyE,WAAAA,EAAU,QAAA;gBAASC,aAAAA,EAAY,MAAA;AAC1ChE,gBAAAA,QAAAA,EAAAA;;;;AAIjB;AAEAT,SAAAA,CAAU0E,SAAS,GAAG;AAClB,+BACA3D,KAAAA,EAAO4D,SAAAA,CAAUC,MAAM,CAACC,UAAU;uCAElCjF,SAAAA,EAAW+E,SAAAA,CAAUC,MAAM;AAC3B,sCACAxE,KAAAA,EAAOuE,SAAAA,CAAUG,OAAO,CAACH,UAAUC,MAAM,CAAA;sCAEzClD,QAAAA,EAAUiD,SAAAA,CAAUI,IAAI;iFAExBV,oBAAAA,EAAsBM,SAAAA,CAAUC,MAAM;mFAEtCtC,yBAAAA,EAA2BqC,SAAAA,CAAUC,MAAM;uFAE3CjC,2BAAAA,EAA6BgC,SAAAA,CAAUC;AAC3C,CAAA;AAEA5E,SAAAA,CAAUgF,YAAY,GAAG;AACrB5E,IAAAA,KAAAA,EAAO,EAAE;IACTiE,oBAAAA,EAAsB,iBAAA;IACtB/B,yBAAAA,EAA2B,oBAAA;IAC3BK,2BAAAA,EAA6B;AACjC,CAAA;;;;"}
1
+ {"version":3,"file":"ChipInput.js","sources":["../../../src/components/ChipInput/ChipInput.tsx"],"sourcesContent":["import React, { useImperativeHandle, useEffect, useId, useState } from 'react';\nimport styled from '@emotion/styled';\nimport { getThemeValue, THEME_NAME } from '../../shared/constants';\nimport Chip from '../Chip/Chip';\nimport { DragAndDrop, ORIENTATION } from '../DragAndDrop';\n\n// Prop types definition\ninterface ChipInputProps {\n /** Label for the field */\n label: string;\n /** Error message for the field */\n errorText?: string;\n /**\n * Values to display as chips\n * @default []\n */\n value?: string[];\n /** Callback when chips change */\n onChange?: (newValue: string[]) => void;\n /**\n * Aria label for the close button on chip. Defaults to \"Remove {:label}\"\n * @default \"Remove {:label}\"\n */\n closeButtonAriaLabel?: string;\n /**\n * Announcement text when a chip is added. Defaults to \"{:label} was added\"\n * @default \"{:label} was added\"\n */\n addedAnnouncementTemplate?: string;\n /**\n * Announcement text when a chip is removed. Defaults to \"{:label} was removed\"\n * @default \"{:label} was removed\"\n */\n removedAnnouncementTemplate?: string;\n}\n\n// Label component for the ChipInput\nconst Label = styled.label<{\n text: string;\n touched?: boolean;\n errorText?: string;\n required?: boolean;\n}>`\n display: inline-flex;\n flex-direction: column;\n flex: 1;\n position: relative;\n margin: 10px 5px;\n color: inherit;\n padding: 0 8px;\n width: 250px;\n border-radius: 3px;\n border: 1px solid ${getThemeValue(THEME_NAME.BORDER_COLOR)};\n background-color: ${getThemeValue(THEME_NAME.BACKGROUND)};\n\n /** Focused */\n &:has(:focus),\n &:has(:active) {\n border-color: ${getThemeValue(THEME_NAME.PRIMARY)};\n box-shadow: 0 0 0 4px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};\n }\n\n &:has(:focus) > span,\n &:has(:active) > span {\n color: ${getThemeValue(THEME_NAME.PRIMARY)};\n }\n\n /** Disabled */\n &:has(:disabled) {\n border-color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};\n background-color: ${getThemeValue(THEME_NAME.DISABLED_BACKGROUND)};\n }\n\n &:has(:disabled) > span {\n color: ${getThemeValue(THEME_NAME.DISABLED)};\n }\n\n /** Invalid */\n &:has(: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 &:has(:invalid) {\n border-color: ${getThemeValue(THEME_NAME.ERROR)};\n }\n \n &:has(: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 ${(props) =>\n props.required\n ? `& > span:after {\n content: '*';\n margin-left: 2px;\n color: ${getThemeValue(THEME_NAME.ERROR)};\n }`\n : ''}\n \n\n & > input {\n border: none;\n outline: none;\n line-height: 30px;\n min-height: 30px;\n max-width: 95%;\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 &:has(:focus) > span,\n &:has(:placeholder-shown) > span {\n top: -8px;\n background: ${getThemeValue(THEME_NAME.BACKGROUND)};\n font-size: 12px;\n line-height: 14px;\n }\n\n ${(props) =>\n props.text !== ''\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\n// Error message container\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// Visually hidden but accessible to screen readers\nconst VisuallyHidden = styled.ul`\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n\n & li {\n list-style: none;\n }\n`;\n\n/**\n * A chip input component that allows users to add and remove chips (tags) by typing and pressing Enter.\n * @component\n * @example\n * ```tsx\n * <ChipInput\n * value={['tag1', 'tag2']}\n * onChange={(newTags) => console.log(newTags)}\n * label=\"Add tags\"\n * errorText=\"At least one tag is required\"\n * />\n * ```\n */\nfunction ChipInputComponent(\n props: ChipInputProps & React.AllHTMLAttributes<HTMLInputElement>,\n ref: React.Ref<HTMLInputElement | null>,\n) {\n const {\n value: propValue = [],\n closeButtonAriaLabel = `Remove {:label}`,\n addedAnnouncementTemplate = '{:label} was added',\n removedAnnouncementTemplate = '{:label} was removed',\n } = props;\n\n const [text, setText] = useState('');\n const [touched, setTouched] = useState(false);\n const [value, setValue] = useState<string[]>(propValue || []);\n const InputRef = React.useRef<HTMLInputElement>(null);\n const [announcement, setAnnouncement] = useState('');\n const errorId = useId();\n\n // Forward the underlying input element.\n useImperativeHandle(ref, () => InputRef.current as HTMLInputElement);\n\n /**\n * Replace {:label} placeholder in template string\n */\n const replacePlaceholder = (\n template: string | undefined,\n label: string,\n ): string | undefined => {\n if (!template) return undefined;\n return template.replace(/\\{:label\\}/g, label);\n };\n\n const prevPropValueRef = React.useRef<string[]>(undefined);\n\n // Sync internal value with props.value\n useEffect(() => {\n if (Array.isArray(propValue)) {\n const prevValue = prevPropValueRef.current;\n const isEqual =\n prevValue &&\n propValue.length === prevValue.length &&\n propValue.every((val, index) => val === prevValue[index]);\n if (!isEqual) {\n setValue(propValue);\n prevPropValueRef.current = propValue;\n }\n }\n }, [propValue]);\n\n /**\n * Update the chip values and notify changes.\n * @param newValue The new array of chip values\n */\n const updateValue = (newValue: string[]) => {\n const deduped = Array.from(new Set(newValue));\n setValue(deduped);\n props.onChange?.(deduped);\n };\n\n /**\n * Marks the input as touched on focus.\n * @param e React focus event\n */\n const handleFocus = (e: React.FocusEvent<HTMLInputElement>) => {\n setTouched(true);\n if (props.onFocus) {\n props.onFocus(e);\n }\n };\n\n /**\n * Change handler for the input field.\n * @param e React change event\n */\n const handleChange: React.ChangeEventHandler<HTMLInputElement> = (e) => {\n setText(e.target.value);\n };\n\n /**\n * Adds a new chip on Enter key press.\n * @param e React keyboard event\n */\n const handleKeyUp: React.KeyboardEventHandler<HTMLInputElement> = (e) => {\n if (e.key === 'Enter' && text.trim() !== '' && InputRef.current?.validity.valid) {\n const newValue = [...value, text.trim()];\n updateValue(newValue);\n setText('');\n setAnnouncement(replacePlaceholder(addedAnnouncementTemplate, text.trim())!);\n }\n };\n\n /**\n * Removes a chip from the list.\n * @param chipToRemove The chip value to remove\n */\n const removeChip = (chipToRemove: string) => {\n const newValue = value.filter((chip) => chip !== chipToRemove);\n updateValue(newValue);\n setAnnouncement(replacePlaceholder(removedAnnouncementTemplate, chipToRemove)!);\n };\n\n /**\n * Moves a chip from one position to another.\n * @param start The starting index of the item to move\n * @param end The ending index where the item should be placed\n */\n const onDrop = (start: number, end: number) => {\n // Clone existing elements\n const newItems = [...value];\n // Remove the element to be moved\n const item = newItems.splice(start, 1);\n // Add it back at the required position\n newItems.splice(end, 0, item[0]);\n // Update\n updateValue(newItems);\n };\n\n // Render the component\n return (\n <>\n <Label\n text={text}\n touched={touched}\n errorText={props.errorText}\n required={props.required}\n >\n <input\n {...props}\n ref={InputRef}\n value={text}\n onChange={handleChange}\n onFocus={handleFocus}\n onKeyUp={handleKeyUp}\n required={props.required && value.length === 0}\n aria-required={props.required}\n aria-invalid={!!props.errorText}\n aria-describedby={props.errorText ? errorId : undefined}\n />\n <div>\n {value?.length > 0 && (\n <DragAndDrop orientation={ORIENTATION.HORIZONTAL} onDrop={onDrop}>\n {value.map((chip) => (\n <Chip\n key={chip}\n label={chip}\n onCloseClick={() => removeChip(chip)}\n closeButtonAriaLabel={replacePlaceholder(\n closeButtonAriaLabel,\n chip,\n )}\n />\n ))}\n </DragAndDrop>\n )}\n </div>\n <span>{props.label}</span>\n {props.errorText && <ErrorContainer id={errorId}>{props.errorText}</ErrorContainer>}\n </Label>\n <VisuallyHidden aria-live=\"polite\" aria-atomic=\"true\">\n {announcement}\n </VisuallyHidden>\n </>\n );\n}\n\nconst ChipInput = React.forwardRef<\n HTMLInputElement,\n ChipInputProps & React.AllHTMLAttributes<HTMLInputElement>\n>(ChipInputComponent);\n\nexport default ChipInput;\n"],"names":["Label","styled","getThemeValue","THEME_NAME","BORDER_COLOR","BACKGROUND","PRIMARY","PRIMARY_LIGHT","DISABLED_BORDER","DISABLED_BACKGROUND","DISABLED","ERROR","ERROR_LIGHT","props","touched","errorText","required","text","ErrorContainer","VisuallyHidden","ChipInputComponent","ref","value","propValue","closeButtonAriaLabel","addedAnnouncementTemplate","removedAnnouncementTemplate","setText","useState","setTouched","setValue","InputRef","React","useRef","announcement","setAnnouncement","errorId","useId","useImperativeHandle","current","replacePlaceholder","template","label","undefined","replace","prevPropValueRef","useEffect","Array","isArray","prevValue","isEqual","length","every","val","index","updateValue","newValue","deduped","from","Set","onChange","handleFocus","e","onFocus","handleChange","target","handleKeyUp","key","trim","validity","valid","removeChip","chipToRemove","filter","chip","onDrop","start","end","newItems","item","splice","_jsxs","_Fragment","_jsx","input","onKeyUp","aria-required","aria-invalid","aria-describedby","div","DragAndDrop","orientation","ORIENTATION","HORIZONTAL","map","Chip","onCloseClick","span","id","aria-live","aria-atomic","ChipInput","forwardRef"],"mappings":";;;;;;;;AAoCA;AACA,MAAMA,OAAAA,iBAAQC,MAAAA,CAAAA,OAAAA,EAAAA;;;qKAeUC,aAAAA,CAAcC,UAAAA,CAAWC,YAAY,CAAA,EAAA,oBAAA,EACrCF,aAAAA,CAAcC,WAAWE,UAAU,CAAA,EAAA,6CAAA,EAKnCH,cAAcC,UAAAA,CAAWG,OAAO,6BACxBJ,aAAAA,CAAcC,UAAAA,CAAWI,aAAa,CAAA,EAAA,qDAAA,EAKrDL,aAAAA,CAAcC,WAAWG,OAAO,CAAA,EAAA,kCAAA,EAKzBJ,cAAcC,UAAAA,CAAWK,eAAe,yBACpCN,aAAAA,CAAcC,UAAAA,CAAWM,mBAAmB,CAAA,EAAA,kCAAA,EAIvDP,aAAAA,CAAcC,WAAWO,QAAQ,CAAA,EAAA,uCAAA,EAK1BR,cAAcC,UAAAA,CAAWQ,KAAK,6BACtBT,aAAAA,CAAcC,UAAAA,CAAWS,WAAW,CAAA,EAAA,IAAA,EAG9D,CAACC,QACCA,KAAAA,CAAMC,OAAO,GACP;;0BAEY,EAAEZ,aAAAA,CAAcC,UAAAA,CAAWQ,KAAK,CAAA,CAAE;;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