no-frills-ui 0.0.14-alpha.8 → 0.0.14-rc.1
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.
- package/README.md +3 -3
- package/dist/index.js +847 -718
- package/dist/index.js.map +1 -1
- package/lib-esm/components/Accordion/Accordion.d.ts +9 -13
- package/lib-esm/components/Accordion/Accordion.js +13 -11
- package/lib-esm/components/Accordion/Accordion.js.map +1 -1
- package/lib-esm/components/Accordion/AccordionStep.d.ts +22 -22
- package/lib-esm/components/Accordion/AccordionStep.js +34 -29
- package/lib-esm/components/Accordion/AccordionStep.js.map +1 -1
- package/lib-esm/components/Badge/Badge.d.ts +13 -16
- package/lib-esm/components/Badge/Badge.js +10 -20
- package/lib-esm/components/Badge/Badge.js.map +1 -1
- package/lib-esm/components/Button/ActionButton.d.ts +9 -5
- package/lib-esm/components/Button/ActionButton.js +18 -3
- package/lib-esm/components/Button/ActionButton.js.map +1 -1
- package/lib-esm/components/Button/Button.d.ts +9 -5
- package/lib-esm/components/Button/Button.js +17 -5
- package/lib-esm/components/Button/Button.js.map +1 -1
- package/lib-esm/components/Button/IconButton.d.ts +9 -5
- package/lib-esm/components/Button/IconButton.js +18 -3
- package/lib-esm/components/Button/IconButton.js.map +1 -1
- package/lib-esm/components/Button/LinkButton.d.ts +9 -5
- package/lib-esm/components/Button/LinkButton.js +18 -3
- package/lib-esm/components/Button/LinkButton.js.map +1 -1
- package/lib-esm/components/Button/RaisedButton.d.ts +9 -5
- package/lib-esm/components/Button/RaisedButton.js +18 -3
- package/lib-esm/components/Button/RaisedButton.js.map +1 -1
- package/lib-esm/components/Card/Card.d.ts +4 -6
- package/lib-esm/components/Card/Card.js +16 -3
- package/lib-esm/components/Card/Card.js.map +1 -1
- package/lib-esm/components/Chip/Chip.d.ts +2 -2
- package/lib-esm/components/Chip/Chip.js +14 -8
- package/lib-esm/components/Chip/Chip.js.map +1 -1
- package/lib-esm/components/ChipInput/ChipInput.d.ts +28 -39
- package/lib-esm/components/ChipInput/ChipInput.js +37 -37
- package/lib-esm/components/ChipInput/ChipInput.js.map +1 -1
- package/lib-esm/components/Dialog/AlertDialog.d.ts +11 -12
- package/lib-esm/components/Dialog/AlertDialog.js +4 -11
- package/lib-esm/components/Dialog/AlertDialog.js.map +1 -1
- package/lib-esm/components/Dialog/ConfirmDialog.d.ts +13 -14
- package/lib-esm/components/Dialog/ConfirmDialog.js +4 -12
- package/lib-esm/components/Dialog/ConfirmDialog.js.map +1 -1
- package/lib-esm/components/Dialog/Dialog.d.ts +8 -14
- package/lib-esm/components/Dialog/Dialog.js +11 -9
- package/lib-esm/components/Dialog/Dialog.js.map +1 -1
- package/lib-esm/components/Dialog/PromptDialog.d.ts +18 -19
- package/lib-esm/components/Dialog/PromptDialog.js +10 -18
- package/lib-esm/components/Dialog/PromptDialog.js.map +1 -1
- package/lib-esm/components/DragAndDrop/DragAndDrop.d.ts +37 -59
- package/lib-esm/components/DragAndDrop/DragAndDrop.js +23 -26
- package/lib-esm/components/DragAndDrop/DragAndDrop.js.map +1 -1
- package/lib-esm/components/DragAndDrop/DragItem.d.ts +2 -2
- package/lib-esm/components/DragAndDrop/DragItem.js +40 -38
- package/lib-esm/components/DragAndDrop/DragItem.js.map +1 -1
- package/lib-esm/components/DragAndDrop/types.d.ts +3 -3
- package/lib-esm/components/DragAndDrop/types.js.map +1 -1
- package/lib-esm/components/Drawer/Drawer.d.ts +24 -31
- package/lib-esm/components/Drawer/Drawer.js +49 -45
- package/lib-esm/components/Drawer/Drawer.js.map +1 -1
- package/lib-esm/components/Groups/Group.d.ts +6 -8
- package/lib-esm/components/Groups/Group.js +12 -10
- package/lib-esm/components/Groups/Group.js.map +1 -1
- package/lib-esm/components/Input/Checkbox.d.ts +12 -15
- package/lib-esm/components/Input/Checkbox.js +30 -26
- package/lib-esm/components/Input/Checkbox.js.map +1 -1
- package/lib-esm/components/Input/Dropdown.d.ts +8 -18
- package/lib-esm/components/Input/Dropdown.js +42 -17
- package/lib-esm/components/Input/Dropdown.js.map +1 -1
- package/lib-esm/components/Input/Input.d.ts +8 -3
- package/lib-esm/components/Input/Input.js +20 -19
- package/lib-esm/components/Input/Input.js.map +1 -1
- package/lib-esm/components/Input/Radio.d.ts +4 -8
- package/lib-esm/components/Input/Radio.js +16 -13
- package/lib-esm/components/Input/Radio.js.map +1 -1
- package/lib-esm/components/Input/RadioButton.d.ts +4 -8
- package/lib-esm/components/Input/RadioButton.js +15 -12
- package/lib-esm/components/Input/RadioButton.js.map +1 -1
- package/lib-esm/components/Input/Select.d.ts +6 -13
- package/lib-esm/components/Input/Select.js +21 -18
- package/lib-esm/components/Input/Select.js.map +1 -1
- package/lib-esm/components/Input/TextArea.d.ts +6 -13
- package/lib-esm/components/Input/TextArea.js +29 -24
- package/lib-esm/components/Input/TextArea.js.map +1 -1
- package/lib-esm/components/Input/Toggle.d.ts +4 -9
- package/lib-esm/components/Input/Toggle.js +12 -10
- package/lib-esm/components/Input/Toggle.js.map +1 -1
- package/lib-esm/components/Menu/Menu.d.ts +4 -14
- package/lib-esm/components/Menu/Menu.js +24 -16
- package/lib-esm/components/Menu/Menu.js.map +1 -1
- package/lib-esm/components/Menu/MenuContext.d.ts +4 -4
- package/lib-esm/components/Menu/MenuContext.js +1 -0
- package/lib-esm/components/Menu/MenuContext.js.map +1 -1
- package/lib-esm/components/Menu/MenuItem.d.ts +10 -4
- package/lib-esm/components/Menu/MenuItem.js +19 -5
- package/lib-esm/components/Menu/MenuItem.js.map +1 -1
- package/lib-esm/components/Modal/Modal.d.ts +17 -23
- package/lib-esm/components/Modal/Modal.js +37 -34
- package/lib-esm/components/Modal/Modal.js.map +1 -1
- package/lib-esm/components/Notification/Notification.d.ts +39 -34
- package/lib-esm/components/Notification/Notification.js +16 -39
- package/lib-esm/components/Notification/Notification.js.map +1 -1
- package/lib-esm/components/Notification/NotificationManager.d.ts +4 -4
- package/lib-esm/components/Notification/NotificationManager.js +18 -14
- package/lib-esm/components/Notification/NotificationManager.js.map +1 -1
- package/lib-esm/components/Notification/index.d.ts +1 -0
- package/lib-esm/components/Notification/style.d.ts +2 -3
- package/lib-esm/components/Notification/style.js +11 -11
- package/lib-esm/components/Notification/style.js.map +1 -1
- package/lib-esm/components/Popover/Popover.d.ts +21 -20
- package/lib-esm/components/Popover/Popover.js +42 -44
- package/lib-esm/components/Popover/Popover.js.map +1 -1
- package/lib-esm/components/Spinner/Spinner.d.ts +14 -15
- package/lib-esm/components/Spinner/Spinner.js +12 -13
- package/lib-esm/components/Spinner/Spinner.js.map +1 -1
- package/lib-esm/components/Stepper/Step.d.ts +15 -12
- package/lib-esm/components/Stepper/Step.js +10 -8
- package/lib-esm/components/Stepper/Step.js.map +1 -1
- package/lib-esm/components/Stepper/Stepper.d.ts +11 -17
- package/lib-esm/components/Stepper/Stepper.js +25 -23
- package/lib-esm/components/Stepper/Stepper.js.map +1 -1
- package/lib-esm/components/Tabs/Tab.d.ts +10 -16
- package/lib-esm/components/Tabs/Tab.js +0 -8
- package/lib-esm/components/Tabs/Tab.js.map +1 -1
- package/lib-esm/components/Tabs/Tabs.d.ts +11 -22
- package/lib-esm/components/Tabs/Tabs.js +39 -31
- package/lib-esm/components/Tabs/Tabs.js.map +1 -1
- package/lib-esm/components/Toast/Toast.d.ts +7 -7
- package/lib-esm/components/Toast/Toast.js +13 -12
- package/lib-esm/components/Toast/Toast.js.map +1 -1
- package/lib-esm/components/Toast/ToastStory.d.ts +21 -24
- package/lib-esm/components/Tooltip/Tooltip.d.ts +11 -14
- package/lib-esm/components/Tooltip/Tooltip.js +11 -21
- package/lib-esm/components/Tooltip/Tooltip.js.map +1 -1
- package/lib-esm/icons/CheckCircle.js +2 -2
- package/lib-esm/icons/CheckCircle.js.map +1 -1
- package/lib-esm/icons/ErrorOutline.js +2 -2
- package/lib-esm/icons/ErrorOutline.js.map +1 -1
- package/lib-esm/icons/Info.js +2 -2
- package/lib-esm/icons/Info.js.map +1 -1
- package/lib-esm/icons/ReportProblem.js +2 -2
- package/lib-esm/icons/ReportProblem.js.map +1 -1
- package/lib-esm/index.js +43 -0
- package/lib-esm/shared/LayerManager.d.ts +5 -4
- package/lib-esm/shared/LayerManager.js +111 -111
- package/lib-esm/shared/LayerManager.js.map +1 -1
- package/lib-esm/shared/styles.d.ts +1 -1
- package/lib-esm/shared/styles.js +9 -9
- package/lib-esm/shared/styles.js.map +1 -1
- package/package.json +66 -31
- package/lib-esm/components/index.js +0 -43
- /package/lib-esm/{components/index.js.map → index.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButton.js","sources":["../../../src/components/Button/IconButton.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport { getThemeValue, THEME_NAME } from '../../shared/constants';\n\
|
|
1
|
+
{"version":3,"file":"IconButton.js","sources":["../../../src/components/Button/IconButton.tsx"],"sourcesContent":["import React from 'react';\nimport styled from '@emotion/styled';\nimport { getThemeValue, THEME_NAME } from '../../shared/constants';\n\nconst StyledIconButton = styled.button`\n border: 1px solid ${getThemeValue(THEME_NAME.BORDER_COLOR)};\n border-radius: 5px;\n height: 32px;\n font-size: 14px;\n text-align: center;\n padding: 0 3px;\n cursor: pointer;\n color: ${getThemeValue(THEME_NAME.TEXT_COLOR_DARK)};\n background-color: ${getThemeValue(THEME_NAME.BACKGROUND)};\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 }\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 box-shadow: 0 0 0 4px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};\n }\n\n &:disabled {\n background-color: ${getThemeValue(THEME_NAME.BORDER_LIGHT_COLOR)};\n border-color: ${getThemeValue(THEME_NAME.LIGHT_GREY)};\n color: ${getThemeValue(THEME_NAME.DISABLED)};\n }\n\n &:disabled > svg {\n fill: ${getThemeValue(THEME_NAME.DISABLED)};\n }\n`;\n\ntype IconButtonProps = {\n /**\n * Type of Icon Button\n * @default 'button'\n */\n type?: 'button' | 'submit' | 'reset';\n} & React.ButtonHTMLAttributes<HTMLButtonElement>;\n\n/**\n * IconButton Component\n * @param props - Component props\n * @param ref - Ref forwarded to the underlying HTMLButtonElement\n */\nfunction IconButtonComponent(props: IconButtonProps, ref: React.Ref<HTMLButtonElement>) {\n const { type = 'button', ...rest } = props;\n\n return <StyledIconButton ref={ref} type={type} {...rest} />;\n}\n\nconst IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(IconButtonComponent);\n\nexport default IconButton;\n"],"names":["StyledIconButton","styled","getThemeValue","THEME_NAME","BORDER_COLOR","TEXT_COLOR_DARK","BACKGROUND","PRIMARY","PRIMARY_LIGHT","BORDER_LIGHT_COLOR","LIGHT_GREY","DISABLED","IconButtonComponent","props","ref","type","rest","_jsx","IconButton","React","forwardRef"],"mappings":";;;;;AAIA,MAAMA,gBAAAA,iBAAmBC,MAAAA,CAAAA,QAAAA,EAAAA;;;AACDC,CAAAA,CAAAA,CAAAA,mBAAAA,EAAAA,aAAAA,CAAcC,WAAWC,YAAY,CAAA,EAAA,qGAAA,EAOhDF,cAAcC,UAAAA,CAAWE,eAAe,yBAC7BH,aAAAA,CAAcC,UAAAA,CAAWG,UAAU,CAAA,EAAA,iMAAA,EAenCJ,cAAcC,UAAAA,CAAWI,OAAO,cACvCL,aAAAA,CAAcC,UAAAA,CAAWI,OAAO,CAAA,EAAA,yBAAA,EAIzBL,aAAAA,CAAcC,UAAAA,CAAWI,OAAO,6BACxBL,aAAAA,CAAcC,UAAAA,CAAWK,aAAa,CAAA,EAAA,gCAAA,EAI1CN,aAAAA,CAAcC,WAAWM,kBAAkB,CAAA,EAAA,gBAAA,EAC/CP,cAAcC,UAAAA,CAAWO,UAAU,cAC1CR,aAAAA,CAAcC,UAAAA,CAAWQ,QAAQ,CAAA,EAAA,0BAAA,EAIlCT,aAAAA,CAAcC,WAAWQ,QAAQ,CAAA,EAAA,IAAA,CAAA;AAYjD;;;;AAIC,IACD,SAASC,mBAAAA,CAAoBC,KAAsB,EAAEC,GAAiC,EAAA;AAClF,IAAA,MAAM,EAAEC,IAAAA,GAAO,QAAQ,EAAE,GAAGC,MAAM,GAAGH,KAAAA;AAErC,IAAA,qBAAOI,GAAA,CAACjB,gBAAAA,EAAAA;QAAiBc,GAAAA,EAAKA,GAAAA;QAAKC,IAAAA,EAAMA,IAAAA;AAAO,QAAA,GAAGC;;AACvD;AAEA,MAAME,UAAAA,iBAAaC,KAAAA,CAAMC,UAAU,CAAqCR,mBAAAA;;;;"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
5
|
-
target: "
|
|
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\
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
5
|
-
target: "
|
|
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\
|
|
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
|
-
|
|
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
|
|
5
|
-
target: "
|
|
6
|
-
label: "
|
|
6
|
+
const StyledCard = /*#__PURE__*/ styled("div", {
|
|
7
|
+
target: "e9lfq9w0",
|
|
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 HTMLAr
|
|
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\
|
|
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 HTMLAr\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
|
-
|
|
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: "
|
|
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: "
|
|
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
|
-
|
|
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\
|
|
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","onKeyDown","aria-label","Close","height","width","Chip","React","forwardRef"],"mappings":";;;;;;AAcA,MAAMA,WAAAA,iBAAYC,MAAAA,CAAAA,MAAAA,EAAAA;;;AAIMC,CAAAA,CAAAA,CAAAA,oEAAAA,EAAAA,aAAAA,CAAcC,WAAWC,kBAAkB,CAAA,EAAA,sEAAA,CAAA;AAOnE,MAAMC,QAAAA,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;AAIjE;;;;AAIC,IACD,SAASC,aAAAA,CACLC,KAAwD,EACxDC,GAA+B,EAAA;IAE/B,MAAM,EAAEC,KAAK,EAAEC,YAAY,EAAEC,oBAAoB,EAAE,GAAGC,IAAAA,EAAM,GAAGL,KAAAA;AAE/D,IAAA,MAAMM,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,CAACrB,WAAAA,EAAAA;AAAW,QAAA,GAAGe,IAAI;QAAEJ,GAAAA,EAAKA,GAAAA;QAAKW,OAAAA,EAASN,YAAAA;;AACnCJ,YAAAA,KAAAA;0BACDW,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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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 & Omit<React.AllHTMLAttributes<HTMLInputElement>, "onChange" | "value"> & 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,10 +7,10 @@ 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: "
|
|
10
|
+
const Label$6 = /*#__PURE__*/ styled("label", {
|
|
11
|
+
target: "ew8m37a0",
|
|
13
12
|
label: "Label"
|
|
14
|
-
})("display:inline-flex;flex-direction:column;flex:1;position:relative;margin:10px 5px;color:inherit;padding:0 8px;
|
|
13
|
+
})("display:inline-flex;flex-direction:column;flex:1;position:relative;margin:10px 5px;color:inherit;padding:0 8px;border-radius:3px;border:1px solid ", getThemeValue(THEME_NAME.BORDER_COLOR), ";background-color:", getThemeValue(THEME_NAME.BACKGROUND), ";width:", (props)=>typeof props.width === 'number' ? `${props.width}px` : props.width || '250px', ";max-width:100%;&: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) {
|
|
16
15
|
border-color: ${getThemeValue(THEME_NAME.ERROR)};
|
|
17
16
|
}
|
|
@@ -25,7 +24,11 @@ const Label = /*#__PURE__*/ styled("label", {
|
|
|
25
24
|
& > span {
|
|
26
25
|
color: ${getThemeValue(THEME_NAME.ERROR)};
|
|
27
26
|
}
|
|
28
|
-
` : '', " \n
|
|
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: "
|
|
40
|
+
const ErrorContainer$4 = /*#__PURE__*/ styled("div", {
|
|
41
|
+
target: "ew8m37a1",
|
|
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: "
|
|
45
|
+
const VisuallyHidden$1 = /*#__PURE__*/ styled("ul", {
|
|
46
|
+
target: "ew8m37a2",
|
|
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
|
|
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(
|
|
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(
|
|
74
|
-
|
|
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
|
-
|
|
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
|
|
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(
|
|
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(
|
|
134
|
+
setAnnouncement(replacePlaceholder(removedAnnouncementTemplate, chipToRemove));
|
|
123
135
|
};
|
|
124
136
|
/**
|
|
125
137
|
* Moves a chip from one position to another.
|
|
@@ -140,10 +152,12 @@ 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,
|
|
160
|
+
width: props.width,
|
|
147
161
|
children: [
|
|
148
162
|
/*#__PURE__*/ jsx("input", {
|
|
149
163
|
...props,
|
|
@@ -164,20 +178,20 @@ const VisuallyHidden = /*#__PURE__*/ styled("ul", {
|
|
|
164
178
|
children: value.map((chip)=>/*#__PURE__*/ jsx(Chip, {
|
|
165
179
|
label: chip,
|
|
166
180
|
onCloseClick: ()=>removeChip(chip),
|
|
167
|
-
closeButtonAriaLabel: replacePlaceholder(
|
|
181
|
+
closeButtonAriaLabel: replacePlaceholder(closeButtonAriaLabel, chip)
|
|
168
182
|
}, chip))
|
|
169
183
|
})
|
|
170
184
|
}),
|
|
171
185
|
/*#__PURE__*/ jsx("span", {
|
|
172
186
|
children: props.label
|
|
173
187
|
}),
|
|
174
|
-
props.errorText && /*#__PURE__*/ jsx(ErrorContainer, {
|
|
188
|
+
props.errorText && /*#__PURE__*/ jsx(ErrorContainer$4, {
|
|
175
189
|
id: errorId,
|
|
176
190
|
children: props.errorText
|
|
177
191
|
})
|
|
178
192
|
]
|
|
179
193
|
}),
|
|
180
|
-
/*#__PURE__*/ jsx(VisuallyHidden, {
|
|
194
|
+
/*#__PURE__*/ jsx(VisuallyHidden$1, {
|
|
181
195
|
"aria-live": "polite",
|
|
182
196
|
"aria-atomic": "true",
|
|
183
197
|
children: announcement
|
|
@@ -185,21 +199,7 @@ const VisuallyHidden = /*#__PURE__*/ styled("ul", {
|
|
|
185
199
|
]
|
|
186
200
|
});
|
|
187
201
|
}
|
|
188
|
-
ChipInput
|
|
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
|
-
};
|
|
202
|
+
const ChipInput = /*#__PURE__*/ React.forwardRef(ChipInputComponent);
|
|
203
203
|
|
|
204
204
|
export { ChipInput as default };
|
|
205
205
|
//# sourceMappingURL=ChipInput.js.map
|