@transferwise/components 46.92.0 → 46.93.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/build/actionOption/ActionOption.js +2 -0
- package/build/actionOption/ActionOption.js.map +1 -1
- package/build/actionOption/ActionOption.mjs +2 -0
- package/build/actionOption/ActionOption.mjs.map +1 -1
- package/build/common/Option/Option.js +9 -4
- package/build/common/Option/Option.js.map +1 -1
- package/build/common/Option/Option.mjs +10 -5
- package/build/common/Option/Option.mjs.map +1 -1
- package/build/dateLookup/dateTrigger/DateTrigger.js +11 -6
- package/build/dateLookup/dateTrigger/DateTrigger.js.map +1 -1
- package/build/dateLookup/dateTrigger/DateTrigger.mjs +11 -6
- package/build/dateLookup/dateTrigger/DateTrigger.mjs.map +1 -1
- package/build/definitionList/DefinitionList.js +5 -3
- package/build/definitionList/DefinitionList.js.map +1 -1
- package/build/definitionList/DefinitionList.mjs +5 -3
- package/build/definitionList/DefinitionList.mjs.map +1 -1
- package/build/main.css +23 -32
- package/build/snackbar/Snackbar.js +4 -2
- package/build/snackbar/Snackbar.js.map +1 -1
- package/build/snackbar/Snackbar.mjs +4 -2
- package/build/snackbar/Snackbar.mjs.map +1 -1
- package/build/styles/common/Option/Option.css +22 -0
- package/build/styles/dateLookup/dateTrigger/DateTrigger.css +1 -32
- package/build/styles/main.css +23 -32
- package/build/typeahead/typeaheadInput/TypeaheadInput.js +4 -1
- package/build/typeahead/typeaheadInput/TypeaheadInput.js.map +1 -1
- package/build/typeahead/typeaheadInput/TypeaheadInput.mjs +4 -1
- package/build/typeahead/typeaheadInput/TypeaheadInput.mjs.map +1 -1
- package/build/types/actionOption/ActionOption.d.ts +2 -1
- package/build/types/actionOption/ActionOption.d.ts.map +1 -1
- package/build/types/common/Option/Option.d.ts +1 -0
- package/build/types/common/Option/Option.d.ts.map +1 -1
- package/build/types/dateLookup/dateTrigger/DateTrigger.d.ts.map +1 -1
- package/build/types/definitionList/DefinitionList.d.ts.map +1 -1
- package/build/types/typeahead/typeaheadInput/TypeaheadInput.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/actionOption/ActionOption.story.tsx +2 -0
- package/src/actionOption/ActionOption.tsx +3 -0
- package/src/common/Option/Option.css +22 -0
- package/src/common/Option/Option.less +21 -0
- package/src/common/Option/Option.spec.tsx +21 -0
- package/src/common/Option/Option.tsx +7 -1
- package/src/dateLookup/DateLookup.spec.tsx +445 -0
- package/src/dateLookup/dateTrigger/DateTrigger.css +1 -32
- package/src/dateLookup/dateTrigger/DateTrigger.less +4 -28
- package/src/dateLookup/dateTrigger/DateTrigger.tsx +9 -5
- package/src/definitionList/DefinitionList.tsx +3 -3
- package/src/inputs/InputGroup.story.tsx +5 -3
- package/src/listItem/ListItem.spec.tsx +10 -2
- package/src/listItem/ListItem.story.tsx +11 -3
- package/src/main.css +23 -32
- package/src/snackbar/Snackbar.tsx +3 -3
- package/src/typeahead/Typeahead.story.tsx +46 -0
- package/src/typeahead/typeaheadInput/TypeaheadInput.tsx +4 -1
- package/src/withNextPortal/withNextPortal.spec.tsx +24 -0
- package/src/common/Option/Option.spec.js +0 -129
- package/src/dateLookup/DateLookup.proptypes.spec.js +0 -28
- package/src/dateLookup/DateLookup.rtl.spec.tsx +0 -199
- package/src/dateLookup/DateLookup.state.spec.js +0 -76
- package/src/dateLookup/DateLookup.testingLibrary.spec.js +0 -256
- package/src/dateLookup/DateLookup.view.spec.js +0 -151
- package/src/dateLookup/dateHeader/DateHeader.spec.js +0 -95
- package/src/dateLookup/dateTrigger/DateTrigger.spec.js +0 -123
- package/src/dateLookup/dayCalendar/DayCalendar.spec.js +0 -122
- package/src/dateLookup/dayCalendar/table/DayCalendarTable.spec.js +0 -147
- package/src/dateLookup/monthCalendar/MonthCalendar.spec.js +0 -105
- package/src/dateLookup/monthCalendar/table/MonthCalendarTable.spec.js +0 -120
- package/src/dateLookup/tableLink/TableLink.spec.js +0 -109
- package/src/dateLookup/yearCalendar/YearCalendar.spec.js +0 -88
- package/src/dateLookup/yearCalendar/table/YearCalendarTable.spec.js +0 -121
- package/src/modal/Modal.spec.js +0 -197
- package/src/withNextPortal/withNextPortal.spec.js +0 -22
- /package/src/modal/{Modal.rtl.spec.tsx → Modal.spec.tsx} +0 -0
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var reactTransitionGroup = require('react-transition-group');
|
|
7
|
-
var
|
|
7
|
+
var Button_resolver = require('../button/Button.resolver.js');
|
|
8
8
|
var Body = require('../body/Body.js');
|
|
9
9
|
var DirectionProvider = require('../provider/direction/DirectionProvider.js');
|
|
10
10
|
var withNextPortal = require('../withNextPortal/withNextPortal.js');
|
|
@@ -111,8 +111,10 @@ class Snackbar extends React.Component {
|
|
|
111
111
|
ref: this.bodyRef,
|
|
112
112
|
as: "span",
|
|
113
113
|
className: "snackbar__text",
|
|
114
|
-
children: [text, action ? /*#__PURE__*/jsxRuntime.jsx(
|
|
114
|
+
children: [text, action ? /*#__PURE__*/jsxRuntime.jsx(Button_resolver, {
|
|
115
115
|
className: "snackbar__text__action",
|
|
116
|
+
v2: true,
|
|
117
|
+
size: "sm",
|
|
116
118
|
onClick: action.onClick,
|
|
117
119
|
children: action.label
|
|
118
120
|
}) : null]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Snackbar.js","sources":["../../src/snackbar/Snackbar.tsx"],"sourcesContent":["import { Component, createRef } from 'react';\nimport { CSSTransition } from 'react-transition-group';\n\nimport
|
|
1
|
+
{"version":3,"file":"Snackbar.js","sources":["../../src/snackbar/Snackbar.tsx"],"sourcesContent":["import { Component, createRef } from 'react';\nimport { CSSTransition } from 'react-transition-group';\n\nimport Button from '../button';\nimport Body from '../body';\nimport { Theme, type ThemeDark, type ThemeLight } from '../common';\nimport { DirectionContext } from '../provider/direction';\nimport withNextPortal from '../withNextPortal/withNextPortal';\n\nconst CSS_TRANSITION_DURATION = 400;\n\nexport interface SnackbarProps {\n action?: {\n label: string;\n onClick?: React.MouseEventHandler<HTMLButtonElement>;\n };\n text: React.ReactNode;\n /** @deprecated */\n theme?: ThemeLight | ThemeDark;\n timeout: number;\n timestamp: number;\n}\n\ninterface SnackbarState extends Pick<SnackbarProps, 'action' | 'text' | 'theme'> {\n visible: boolean;\n}\n\nexport class Snackbar extends Component<SnackbarProps, SnackbarState> {\n bodyRef = createRef<HTMLSpanElement>();\n timeout = 0;\n transitionTimeout = 0;\n\n constructor(props: SnackbarProps) {\n super(props);\n this.state = {\n visible: false,\n text: '',\n };\n }\n\n componentWillUnmount() {\n window.clearTimeout(this.timeout);\n window.clearTimeout(this.transitionTimeout);\n }\n\n shouldComponentUpdate(nextProps: SnackbarProps, nextState: SnackbarState) {\n if (!nextProps.text) {\n return false;\n }\n if (\n nextProps.timestamp === this.props.timestamp &&\n nextState.visible === this.state.visible &&\n nextState.text === this.state.text\n ) {\n return false;\n }\n\n return true;\n }\n\n setLeaveTimeout = () => {\n const { timeout } = this.props;\n\n this.timeout = window.setTimeout(() => {\n this.setState({ visible: false });\n }, timeout);\n };\n\n componentDidUpdate(previousProps: SnackbarProps) {\n const { action, text, timestamp } = this.props;\n\n if (!previousProps.text) {\n this.setState({ visible: true, action, text }, () => {\n this.setLeaveTimeout();\n });\n } else if (previousProps.timestamp !== timestamp) {\n window.clearTimeout(this.timeout);\n\n if (this.state.visible) {\n this.setState({ visible: false }, () => {\n this.transitionTimeout = window.setTimeout(() => {\n this.setState({ visible: true, action, text });\n this.setLeaveTimeout();\n }, CSS_TRANSITION_DURATION);\n });\n } else {\n this.setState({ visible: true, action, text });\n this.setLeaveTimeout();\n }\n }\n }\n\n render() {\n const { action, text, visible } = this.state;\n const { timeout } = this.props;\n\n return (\n <div className=\"snackbar\" aria-live=\"assertive\" role=\"alert\">\n <CSSTransition\n nodeRef={this.bodyRef}\n in={visible}\n classNames=\"snackbar__text-container\"\n timeout={{\n appear: 0,\n enter: timeout,\n exit: CSS_TRANSITION_DURATION,\n }}\n unmountOnExit\n >\n <Body ref={this.bodyRef} as=\"span\" className=\"snackbar__text\">\n {text}\n {action ? (\n <Button className=\"snackbar__text__action\" v2 size=\"sm\" onClick={action.onClick}>\n {action.label}\n </Button>\n ) : null}\n </Body>\n </CSSTransition>\n </div>\n );\n }\n}\n\nSnackbar.contextType = DirectionContext;\n\nexport default withNextPortal(Snackbar);\n"],"names":["CSS_TRANSITION_DURATION","Snackbar","Component","bodyRef","createRef","timeout","transitionTimeout","constructor","props","state","visible","text","componentWillUnmount","window","clearTimeout","shouldComponentUpdate","nextProps","nextState","timestamp","setLeaveTimeout","setTimeout","setState","componentDidUpdate","previousProps","action","render","_jsx","className","role","children","CSSTransition","nodeRef","in","classNames","appear","enter","exit","unmountOnExit","_jsxs","Body","ref","as","Button","v2","size","onClick","label","contextType","DirectionContext","withNextPortal"],"mappings":";;;;;;;;;;;;AASA,MAAMA,uBAAuB,GAAG,GAAG,CAAA;AAkB7B,MAAOC,QAAS,SAAQC,eAAuC,CAAA;EACnEC,OAAO,gBAAGC,eAAS,EAAmB,CAAA;AACtCC,EAAAA,OAAO,GAAG,CAAC,CAAA;AACXC,EAAAA,iBAAiB,GAAG,CAAC,CAAA;EAErBC,WAAAA,CAAYC,KAAoB,EAAA;IAC9B,KAAK,CAACA,KAAK,CAAC,CAAA;IACZ,IAAI,CAACC,KAAK,GAAG;AACXC,MAAAA,OAAO,EAAE,KAAK;AACdC,MAAAA,IAAI,EAAE,EAAA;KACP,CAAA;AACH,GAAA;AAEAC,EAAAA,oBAAoBA,GAAA;AAClBC,IAAAA,MAAM,CAACC,YAAY,CAAC,IAAI,CAACT,OAAO,CAAC,CAAA;AACjCQ,IAAAA,MAAM,CAACC,YAAY,CAAC,IAAI,CAACR,iBAAiB,CAAC,CAAA;AAC7C,GAAA;AAEAS,EAAAA,qBAAqBA,CAACC,SAAwB,EAAEC,SAAwB,EAAA;AACtE,IAAA,IAAI,CAACD,SAAS,CAACL,IA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,IAAI,EAAA;UAACC,GAAG,EAAE,IAAI,CAACrC,OAAQ;AAACsC,UAAAA,EAAE,EAAC,MAAM;AAACd,UAAAA,SAAS,EAAC,gBAAgB;AAAAE,UAAAA,QAAA,GAC1DlB,IAAI,EACJa,MAAM,gBACLE,cAAA,CAACgB,eAAM,EAAA;AAACf,YAAAA,SAAS,EAAC,wBAAwB;YAACgB,EAAE,EAAA,IAAA;AAACC,YAAAA,IAAI,EAAC,IAAI;YAACC,OAAO,EAAErB,MAAM,CAACqB,OAAQ;YAAAhB,QAAA,EAC7EL,MAAM,CAACsB,KAAAA;WACF,CAAC,GACP,IAAI,CAAA;SACJ,CAAA;OACO,CAAA;AACjB,KAAK,CAAC,CAAA;AAEV,GAAA;AACD,CAAA;AAED7C,QAAQ,CAAC8C,WAAW,GAAGC,kCAAgB,CAAA;AAEvC,qBAAeC,cAAc,CAAChD,QAAQ,CAAC;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Component, createRef } from 'react';
|
|
2
2
|
import { CSSTransition } from 'react-transition-group';
|
|
3
|
-
import
|
|
3
|
+
import Button from '../button/Button.resolver.mjs';
|
|
4
4
|
import Body from '../body/Body.mjs';
|
|
5
5
|
import { DirectionContext } from '../provider/direction/DirectionProvider.mjs';
|
|
6
6
|
import withNextPortalWrapper from '../withNextPortal/withNextPortal.mjs';
|
|
@@ -107,8 +107,10 @@ class Snackbar extends Component {
|
|
|
107
107
|
ref: this.bodyRef,
|
|
108
108
|
as: "span",
|
|
109
109
|
className: "snackbar__text",
|
|
110
|
-
children: [text, action ? /*#__PURE__*/jsx(
|
|
110
|
+
children: [text, action ? /*#__PURE__*/jsx(Button, {
|
|
111
111
|
className: "snackbar__text__action",
|
|
112
|
+
v2: true,
|
|
113
|
+
size: "sm",
|
|
112
114
|
onClick: action.onClick,
|
|
113
115
|
children: action.label
|
|
114
116
|
}) : null]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Snackbar.mjs","sources":["../../src/snackbar/Snackbar.tsx"],"sourcesContent":["import { Component, createRef } from 'react';\nimport { CSSTransition } from 'react-transition-group';\n\nimport
|
|
1
|
+
{"version":3,"file":"Snackbar.mjs","sources":["../../src/snackbar/Snackbar.tsx"],"sourcesContent":["import { Component, createRef } from 'react';\nimport { CSSTransition } from 'react-transition-group';\n\nimport Button from '../button';\nimport Body from '../body';\nimport { Theme, type ThemeDark, type ThemeLight } from '../common';\nimport { DirectionContext } from '../provider/direction';\nimport withNextPortal from '../withNextPortal/withNextPortal';\n\nconst CSS_TRANSITION_DURATION = 400;\n\nexport interface SnackbarProps {\n action?: {\n label: string;\n onClick?: React.MouseEventHandler<HTMLButtonElement>;\n };\n text: React.ReactNode;\n /** @deprecated */\n theme?: ThemeLight | ThemeDark;\n timeout: number;\n timestamp: number;\n}\n\ninterface SnackbarState extends Pick<SnackbarProps, 'action' | 'text' | 'theme'> {\n visible: boolean;\n}\n\nexport class Snackbar extends Component<SnackbarProps, SnackbarState> {\n bodyRef = createRef<HTMLSpanElement>();\n timeout = 0;\n transitionTimeout = 0;\n\n constructor(props: SnackbarProps) {\n super(props);\n this.state = {\n visible: false,\n text: '',\n };\n }\n\n componentWillUnmount() {\n window.clearTimeout(this.timeout);\n window.clearTimeout(this.transitionTimeout);\n }\n\n shouldComponentUpdate(nextProps: SnackbarProps, nextState: SnackbarState) {\n if (!nextProps.text) {\n return false;\n }\n if (\n nextProps.timestamp === this.props.timestamp &&\n nextState.visible === this.state.visible &&\n nextState.text === this.state.text\n ) {\n return false;\n }\n\n return true;\n }\n\n setLeaveTimeout = () => {\n const { timeout } = this.props;\n\n this.timeout = window.setTimeout(() => {\n this.setState({ visible: false });\n }, timeout);\n };\n\n componentDidUpdate(previousProps: SnackbarProps) {\n const { action, text, timestamp } = this.props;\n\n if (!previousProps.text) {\n this.setState({ visible: true, action, text }, () => {\n this.setLeaveTimeout();\n });\n } else if (previousProps.timestamp !== timestamp) {\n window.clearTimeout(this.timeout);\n\n if (this.state.visible) {\n this.setState({ visible: false }, () => {\n this.transitionTimeout = window.setTimeout(() => {\n this.setState({ visible: true, action, text });\n this.setLeaveTimeout();\n }, CSS_TRANSITION_DURATION);\n });\n } else {\n this.setState({ visible: true, action, text });\n this.setLeaveTimeout();\n }\n }\n }\n\n render() {\n const { action, text, visible } = this.state;\n const { timeout } = this.props;\n\n return (\n <div className=\"snackbar\" aria-live=\"assertive\" role=\"alert\">\n <CSSTransition\n nodeRef={this.bodyRef}\n in={visible}\n classNames=\"snackbar__text-container\"\n timeout={{\n appear: 0,\n enter: timeout,\n exit: CSS_TRANSITION_DURATION,\n }}\n unmountOnExit\n >\n <Body ref={this.bodyRef} as=\"span\" className=\"snackbar__text\">\n {text}\n {action ? (\n <Button className=\"snackbar__text__action\" v2 size=\"sm\" onClick={action.onClick}>\n {action.label}\n </Button>\n ) : null}\n </Body>\n </CSSTransition>\n </div>\n );\n }\n}\n\nSnackbar.contextType = DirectionContext;\n\nexport default withNextPortal(Snackbar);\n"],"names":["CSS_TRANSITION_DURATION","Snackbar","Component","bodyRef","createRef","timeout","transitionTimeout","constructor","props","state","visible","text","componentWillUnmount","window","clearTimeout","shouldComponentUpdate","nextProps","nextState","timestamp","setLeaveTimeout","setTimeout","setState","componentDidUpdate","previousProps","action","render","_jsx","className","role","children","CSSTransition","nodeRef","in","classNames","appear","enter","exit","unmountOnExit","_jsxs","Body","ref","as","Button","v2","size","onClick","label","contextType","DirectionContext","withNextPortal"],"mappings":";;;;;;;;AASA,MAAMA,uBAAuB,GAAG,GAAG,CAAA;AAkB7B,MAAOC,QAAS,SAAQC,SAAuC,CAAA;EACnEC,OAAO,gBAAGC,SAAS,EAAmB,CAAA;AACtCC,EAAAA,OAAO,GAAG,CAAC,CAAA;AACXC,EAAAA,iBAAiB,GAAG,CAAC,CAAA;EAErBC,WAAAA,CAAYC,KAAoB,EAAA;IAC9B,KAAK,CAACA,KAAK,CAAC,CAAA;IACZ,IAAI,CAACC,KAAK,GAAG;AACXC,MA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AAO;MAAAC,QAAA,eAC1DH,GAAA,CAACI,aAAa,EAAA;QACZC,OAAO,EAAE,IAAI,CAAC5B,OAAQ;AACtB6B,QAAAA,EAAE,EAAEtB,OAAQ;AACZuB,QAAAA,UAAU,EAAC,0BAA0B;AACrC5B,QAAAA,OAAO,EAAE;AACP6B,UAAAA,MAAM,EAAE,CAAC;AACTC,UAAAA,KAAK,EAAE9B,OAAO;AACd+B,UAAAA,IAAI,EAAEpC,uBAAAA;SACN;QACFqC,aAAa,EAAA,IAAA;QAAAR,QAAA,eAEbS,IAAA,CAACC,IAAI,EAAA;UAACC,GAAG,EAAE,IAAI,CAACrC,OAAQ;AAACsC,UAAAA,EAAE,EAAC,MAAM;AAACd,UAAAA,SAAS,EAAC,gBAAgB;AAAAE,UAAAA,QAAA,GAC1DlB,IAAI,EACJa,MAAM,gBACLE,GAAA,CAACgB,MAAM,EAAA;AAACf,YAAAA,SAAS,EAAC,wBAAwB;YAACgB,EAAE,EAAA,IAAA;AAACC,YAAAA,IAAI,EAAC,IAAI;YAACC,OAAO,EAAErB,MAAM,CAACqB,OAAQ;YAAAhB,QAAA,EAC7EL,MAAM,CAACsB,KAAAA;WACF,CAAC,GACP,IAAI,CAAA;SACJ,CAAA;OACO,CAAA;AACjB,KAAK,CAAC,CAAA;AAEV,GAAA;AACD,CAAA;AAED7C,QAAQ,CAAC8C,WAAW,GAAGC,gBAAgB,CAAA;AAEvC,qBAAeC,qBAAc,CAAChD,QAAQ,CAAC;;;;"}
|
|
@@ -98,3 +98,25 @@ button.np-option {
|
|
|
98
98
|
border-radius: var(--radius-small);
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
+
.np-theme-personal .np-option-additional-content {
|
|
102
|
+
margin-left: 80px;
|
|
103
|
+
margin-left: var(--size-80);
|
|
104
|
+
margin-right: 16px;
|
|
105
|
+
margin-right: var(--size-16);
|
|
106
|
+
margin-top: -10px;
|
|
107
|
+
padding-bottom: 16px;
|
|
108
|
+
padding-bottom: var(--size-16);
|
|
109
|
+
max-width: -moz-fit-content;
|
|
110
|
+
max-width: fit-content;
|
|
111
|
+
}
|
|
112
|
+
@media (max-width: 480px) {
|
|
113
|
+
.np-theme-personal .np-option-additional-content {
|
|
114
|
+
margin-left: 16px;
|
|
115
|
+
margin-left: var(--size-16);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
@media (max-width: 320px) {
|
|
119
|
+
.np-theme-personal .np-option-additional-content {
|
|
120
|
+
margin-top: -3px;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -9,52 +9,21 @@
|
|
|
9
9
|
padding-left: var(--size-16);
|
|
10
10
|
}
|
|
11
11
|
.clear-btn {
|
|
12
|
-
transition: color 0.15s ease-in-out;
|
|
13
|
-
color: #c9cbce;
|
|
14
|
-
color: var(--color-interactive-secondary);
|
|
15
12
|
position: absolute;
|
|
16
|
-
top: 16px;
|
|
17
|
-
top: var(--size-16);
|
|
18
|
-
right: 16px;
|
|
19
|
-
right: var(--size-16);
|
|
20
|
-
}
|
|
21
|
-
[dir="rtl"] .clear-btn {
|
|
22
|
-
left: 16px;
|
|
23
|
-
left: var(--size-16);
|
|
24
|
-
right: auto;
|
|
25
|
-
right: initial;
|
|
26
|
-
}
|
|
27
|
-
.np-theme-personal .clear-btn {
|
|
28
13
|
top: 8px;
|
|
29
14
|
top: var(--size-8);
|
|
30
15
|
right: 8px;
|
|
31
16
|
right: var(--size-8);
|
|
32
17
|
}
|
|
33
|
-
[dir="rtl"] .
|
|
18
|
+
[dir="rtl"] .clear-btn {
|
|
34
19
|
left: 8px;
|
|
35
20
|
left: var(--size-8);
|
|
36
21
|
right: auto;
|
|
37
22
|
right: initial;
|
|
38
23
|
}
|
|
39
24
|
.clear-btn--sm {
|
|
40
|
-
top: 8px;
|
|
41
|
-
top: var(--size-8);
|
|
42
|
-
}
|
|
43
|
-
.np-theme-personal .clear-btn--sm {
|
|
44
25
|
top: 0;
|
|
45
26
|
}
|
|
46
27
|
.clear-btn--lg {
|
|
47
|
-
top: 28px;
|
|
48
|
-
}
|
|
49
|
-
.np-theme-personal .clear-btn--lg {
|
|
50
28
|
top: 20px;
|
|
51
29
|
}
|
|
52
|
-
.clear-btn:not(.disabled):not(:disabled):hover,
|
|
53
|
-
.clear-btn:not(.disabled):not(:disabled):focus {
|
|
54
|
-
color: #d03238;
|
|
55
|
-
color: var(--color-interactive-negative-hover);
|
|
56
|
-
}
|
|
57
|
-
.clear-btn:not(.disabled):not(:disabled):active {
|
|
58
|
-
color: #bf1e2c;
|
|
59
|
-
color: var(--color-interactive-negative-active);
|
|
60
|
-
}
|
package/build/styles/main.css
CHANGED
|
@@ -1770,6 +1770,28 @@ button.np-option {
|
|
|
1770
1770
|
border-radius: var(--radius-small);
|
|
1771
1771
|
}
|
|
1772
1772
|
}
|
|
1773
|
+
.np-theme-personal .np-option-additional-content {
|
|
1774
|
+
margin-left: 80px;
|
|
1775
|
+
margin-left: var(--size-80);
|
|
1776
|
+
margin-right: 16px;
|
|
1777
|
+
margin-right: var(--size-16);
|
|
1778
|
+
margin-top: -10px;
|
|
1779
|
+
padding-bottom: 16px;
|
|
1780
|
+
padding-bottom: var(--size-16);
|
|
1781
|
+
max-width: -moz-fit-content;
|
|
1782
|
+
max-width: fit-content;
|
|
1783
|
+
}
|
|
1784
|
+
@media (max-width: 480px) {
|
|
1785
|
+
.np-theme-personal .np-option-additional-content {
|
|
1786
|
+
margin-left: 16px;
|
|
1787
|
+
margin-left: var(--size-16);
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
@media (max-width: 320px) {
|
|
1791
|
+
.np-theme-personal .np-option-additional-content {
|
|
1792
|
+
margin-top: -3px;
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1773
1795
|
.np-select-option {
|
|
1774
1796
|
border-radius: 10px;
|
|
1775
1797
|
border-radius: var(--radius-small);
|
|
@@ -2003,55 +2025,24 @@ button.np-option {
|
|
|
2003
2025
|
padding-left: var(--size-16);
|
|
2004
2026
|
}
|
|
2005
2027
|
.clear-btn {
|
|
2006
|
-
transition: color 0.15s ease-in-out;
|
|
2007
|
-
color: #c9cbce;
|
|
2008
|
-
color: var(--color-interactive-secondary);
|
|
2009
2028
|
position: absolute;
|
|
2010
|
-
top: 16px;
|
|
2011
|
-
top: var(--size-16);
|
|
2012
|
-
right: 16px;
|
|
2013
|
-
right: var(--size-16);
|
|
2014
|
-
}
|
|
2015
|
-
[dir="rtl"] .clear-btn {
|
|
2016
|
-
left: 16px;
|
|
2017
|
-
left: var(--size-16);
|
|
2018
|
-
right: auto;
|
|
2019
|
-
right: initial;
|
|
2020
|
-
}
|
|
2021
|
-
.np-theme-personal .clear-btn {
|
|
2022
2029
|
top: 8px;
|
|
2023
2030
|
top: var(--size-8);
|
|
2024
2031
|
right: 8px;
|
|
2025
2032
|
right: var(--size-8);
|
|
2026
2033
|
}
|
|
2027
|
-
[dir="rtl"] .
|
|
2034
|
+
[dir="rtl"] .clear-btn {
|
|
2028
2035
|
left: 8px;
|
|
2029
2036
|
left: var(--size-8);
|
|
2030
2037
|
right: auto;
|
|
2031
2038
|
right: initial;
|
|
2032
2039
|
}
|
|
2033
2040
|
.clear-btn--sm {
|
|
2034
|
-
top: 8px;
|
|
2035
|
-
top: var(--size-8);
|
|
2036
|
-
}
|
|
2037
|
-
.np-theme-personal .clear-btn--sm {
|
|
2038
2041
|
top: 0;
|
|
2039
2042
|
}
|
|
2040
2043
|
.clear-btn--lg {
|
|
2041
|
-
top: 28px;
|
|
2042
|
-
}
|
|
2043
|
-
.np-theme-personal .clear-btn--lg {
|
|
2044
2044
|
top: 20px;
|
|
2045
2045
|
}
|
|
2046
|
-
.clear-btn:not(.disabled):not(:disabled):hover,
|
|
2047
|
-
.clear-btn:not(.disabled):not(:disabled):focus {
|
|
2048
|
-
color: #d03238;
|
|
2049
|
-
color: var(--color-interactive-negative-hover);
|
|
2050
|
-
}
|
|
2051
|
-
.clear-btn:not(.disabled):not(:disabled):active {
|
|
2052
|
-
color: #bf1e2c;
|
|
2053
|
-
color: var(--color-interactive-negative-active);
|
|
2054
|
-
}
|
|
2055
2046
|
.np-decision .decision {
|
|
2056
2047
|
display: flex;
|
|
2057
2048
|
}
|
|
@@ -24,7 +24,10 @@ class TypeaheadInput extends React.Component {
|
|
|
24
24
|
autoFocus
|
|
25
25
|
} = this.props;
|
|
26
26
|
if (autoFocus) {
|
|
27
|
-
|
|
27
|
+
// Autofocus after context code executions (e.g open Modal) is completed
|
|
28
|
+
setTimeout(() => {
|
|
29
|
+
this.inputRef.current?.focus();
|
|
30
|
+
});
|
|
28
31
|
}
|
|
29
32
|
}
|
|
30
33
|
componentDidUpdate(previousProps) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeaheadInput.js","sources":["../../../src/typeahead/typeaheadInput/TypeaheadInput.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/no-autofocus */\n/* eslint-disable jsx-a11y/click-events-have-key-events */\n/* eslint-disable jsx-a11y/no-static-element-interactions */\nimport { clsx } from 'clsx';\nimport { Component, createRef, ReactNode } from 'react';\n\nimport { Input } from '../../inputs/Input';\nimport { TypeaheadOption, TypeaheadProps } from '../Typeahead';\n\nconst DEFAULT_INPUT_MIN_WIDTH = 10;\n\nexport type TypeaheadInputProps<T> = {\n typeaheadId: string;\n value: string;\n selected: readonly TypeaheadOption<T>[];\n dropdownOpen?: boolean;\n autoComplete: string;\n onChange: React.ChangeEventHandler<HTMLInputElement>;\n onKeyDown: React.KeyboardEventHandler<HTMLInputElement>;\n onFocus: () => void;\n onPaste: React.ClipboardEventHandler<HTMLInputElement>;\n renderChip: (chip: TypeaheadOption<T>, index: number) => ReactNode;\n ariaActivedescendant?: string;\n} & Pick<TypeaheadProps<T>, 'id' | 'name' | 'autoFocus' | 'multiple' | 'placeholder' | 'maxHeight'>;\n\ntype TypeaheadInputState = {\n inputWidth: number;\n keyboardFocusedOptionIndex: number | null;\n};\n\nexport default class TypeaheadInput<T> extends Component<\n TypeaheadInputProps<T>,\n TypeaheadInputState\n> {\n inputRef = createRef<HTMLInputElement>();\n sizerRef = createRef<HTMLDivElement>();\n\n constructor(props: TypeaheadInputProps<T>) {\n super(props);\n this.state = {\n inputWidth: DEFAULT_INPUT_MIN_WIDTH,\n keyboardFocusedOptionIndex: null,\n };\n }\n\n componentDidMount() {\n const { autoFocus } = this.props;\n if (autoFocus) {\n this.inputRef.current?.focus();\n }\n }\n\n componentDidUpdate(previousProps: TypeaheadInputProps<T>) {\n if (previousProps.value !== this.props.value && this.props.multiple) {\n this.recalculateWidth();\n }\n }\n\n recalculateWidth = () => {\n requestAnimationFrame(() => {\n this.setState({\n inputWidth: Math.max(DEFAULT_INPUT_MIN_WIDTH, this.sizerRef.current?.scrollWidth ?? 0 + 10),\n });\n });\n };\n\n renderInput = () => {\n const {\n typeaheadId,\n autoFocus,\n multiple,\n name,\n dropdownOpen,\n placeholder,\n selected,\n value,\n onChange,\n onKeyDown,\n onFocus,\n onPaste,\n autoComplete,\n ariaActivedescendant, // Declare the ariaActivedescendant variable\n } = this.props;\n const { inputWidth } = this.state;\n\n const hasPlaceholder = !multiple || selected.length === 0;\n return (\n <Input\n ref={this.inputRef}\n className={clsx(multiple && 'typeahead__input')}\n name={name}\n id={`input-${typeaheadId}`}\n aria-activedescendant={\n ariaActivedescendant\n ? `menu-${typeaheadId} ${ariaActivedescendant}`\n : `menu-${typeaheadId}`\n }\n autoFocus={autoFocus}\n placeholder={hasPlaceholder ? placeholder : ''}\n aria-autocomplete=\"list\"\n aria-expanded={dropdownOpen}\n aria-haspopup=\"listbox\"\n aria-controls={dropdownOpen ? `menu-${typeaheadId}` : undefined}\n autoComplete={autoComplete}\n role=\"combobox\"\n value={value}\n style={multiple && selected.length > 0 ? { width: inputWidth } : {}}\n onChange={onChange}\n onKeyDown={onKeyDown}\n onClick={onFocus}\n onFocus={onFocus}\n onPaste={onPaste}\n />\n );\n };\n\n render() {\n const { multiple, selected, value, maxHeight, renderChip } = this.props;\n\n return multiple ? (\n <div\n className=\"form-control typeahead__input-container\"\n style={{ maxHeight }}\n onClick={() => {\n this.inputRef.current?.focus();\n }}\n >\n <div className=\"typeahead__input-wrapper\">\n {selected && selected.map((chip, idx) => renderChip(chip, idx))}\n\n {this.renderInput()}\n <div className=\"typeahead__input-aligner\" />\n </div>\n <div ref={this.sizerRef} className=\"sizer form-control typeahead__input\">\n {value}\n </div>\n </div>\n ) : (\n this.renderInput()\n );\n }\n}\n"],"names":["DEFAULT_INPUT_MIN_WIDTH","TypeaheadInput","Component","inputRef","createRef","sizerRef","constructor","props","state","inputWidth","keyboardFocusedOptionIndex","componentDidMount","autoFocus","current","focus","componentDidUpdate","previousProps","value","multiple","recalculateWidth","requestAnimationFrame","setState","Math","max","scrollWidth","renderInput","typeaheadId","name","dropdownOpen","placeholder","selected","onChange","onKeyDown","onFocus","onPaste","autoComplete","ariaActivedescendant","hasPlaceholder","length","_jsx","Input","ref","className","clsx","id","undefined","role","style","width","onClick","render","maxHeight","renderChip","_jsxs","children","map","chip","idx"],"mappings":";;;;;;;AAAA;AACA;AACA;AAOA,MAAMA,uBAAuB,GAAG,EAAE,CAAA;AAqBb,MAAAC,cAAkB,SAAQC,eAG9C,CAAA;EACCC,QAAQ,gBAAGC,eAAS,EAAoB,CAAA;EACxCC,QAAQ,gBAAGD,eAAS,EAAkB,CAAA;EAEtCE,WAAAA,CAAYC,KAA6B,EAAA;IACvC,KAAK,CAACA,KAAK,CAAC,CAAA;IACZ,IAAI,CAACC,KAAK,GAAG;AACXC,MAAAA,UAAU,EAAET,uBAAuB;AACnCU,MAAAA,0BAA0B,EAAE,IAAA;KAC7B,CAAA;AACH,GAAA;AAEAC,EAAAA,iBAAiBA,GAAA;IACf,MAAM;AAAEC,MAAAA,SAAAA;KAAW,GAAG,IAAI,CAACL,KAAK,CAAA;AAChC,IAAA,IAAIK,SAAS,EAAE;AACb,
|
|
1
|
+
{"version":3,"file":"TypeaheadInput.js","sources":["../../../src/typeahead/typeaheadInput/TypeaheadInput.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/no-autofocus */\n/* eslint-disable jsx-a11y/click-events-have-key-events */\n/* eslint-disable jsx-a11y/no-static-element-interactions */\nimport { clsx } from 'clsx';\nimport { Component, createRef, ReactNode } from 'react';\n\nimport { Input } from '../../inputs/Input';\nimport { TypeaheadOption, TypeaheadProps } from '../Typeahead';\n\nconst DEFAULT_INPUT_MIN_WIDTH = 10;\n\nexport type TypeaheadInputProps<T> = {\n typeaheadId: string;\n value: string;\n selected: readonly TypeaheadOption<T>[];\n dropdownOpen?: boolean;\n autoComplete: string;\n onChange: React.ChangeEventHandler<HTMLInputElement>;\n onKeyDown: React.KeyboardEventHandler<HTMLInputElement>;\n onFocus: () => void;\n onPaste: React.ClipboardEventHandler<HTMLInputElement>;\n renderChip: (chip: TypeaheadOption<T>, index: number) => ReactNode;\n ariaActivedescendant?: string;\n} & Pick<TypeaheadProps<T>, 'id' | 'name' | 'autoFocus' | 'multiple' | 'placeholder' | 'maxHeight'>;\n\ntype TypeaheadInputState = {\n inputWidth: number;\n keyboardFocusedOptionIndex: number | null;\n};\n\nexport default class TypeaheadInput<T> extends Component<\n TypeaheadInputProps<T>,\n TypeaheadInputState\n> {\n inputRef = createRef<HTMLInputElement>();\n sizerRef = createRef<HTMLDivElement>();\n\n constructor(props: TypeaheadInputProps<T>) {\n super(props);\n this.state = {\n inputWidth: DEFAULT_INPUT_MIN_WIDTH,\n keyboardFocusedOptionIndex: null,\n };\n }\n\n componentDidMount() {\n const { autoFocus } = this.props;\n if (autoFocus) {\n // Autofocus after context code executions (e.g open Modal) is completed\n setTimeout(() => {\n this.inputRef.current?.focus();\n });\n }\n }\n\n componentDidUpdate(previousProps: TypeaheadInputProps<T>) {\n if (previousProps.value !== this.props.value && this.props.multiple) {\n this.recalculateWidth();\n }\n }\n\n recalculateWidth = () => {\n requestAnimationFrame(() => {\n this.setState({\n inputWidth: Math.max(DEFAULT_INPUT_MIN_WIDTH, this.sizerRef.current?.scrollWidth ?? 0 + 10),\n });\n });\n };\n\n renderInput = () => {\n const {\n typeaheadId,\n autoFocus,\n multiple,\n name,\n dropdownOpen,\n placeholder,\n selected,\n value,\n onChange,\n onKeyDown,\n onFocus,\n onPaste,\n autoComplete,\n ariaActivedescendant, // Declare the ariaActivedescendant variable\n } = this.props;\n const { inputWidth } = this.state;\n\n const hasPlaceholder = !multiple || selected.length === 0;\n return (\n <Input\n ref={this.inputRef}\n className={clsx(multiple && 'typeahead__input')}\n name={name}\n id={`input-${typeaheadId}`}\n aria-activedescendant={\n ariaActivedescendant\n ? `menu-${typeaheadId} ${ariaActivedescendant}`\n : `menu-${typeaheadId}`\n }\n autoFocus={autoFocus}\n placeholder={hasPlaceholder ? placeholder : ''}\n aria-autocomplete=\"list\"\n aria-expanded={dropdownOpen}\n aria-haspopup=\"listbox\"\n aria-controls={dropdownOpen ? `menu-${typeaheadId}` : undefined}\n autoComplete={autoComplete}\n role=\"combobox\"\n value={value}\n style={multiple && selected.length > 0 ? { width: inputWidth } : {}}\n onChange={onChange}\n onKeyDown={onKeyDown}\n onClick={onFocus}\n onFocus={onFocus}\n onPaste={onPaste}\n />\n );\n };\n\n render() {\n const { multiple, selected, value, maxHeight, renderChip } = this.props;\n\n return multiple ? (\n <div\n className=\"form-control typeahead__input-container\"\n style={{ maxHeight }}\n onClick={() => {\n this.inputRef.current?.focus();\n }}\n >\n <div className=\"typeahead__input-wrapper\">\n {selected && selected.map((chip, idx) => renderChip(chip, idx))}\n\n {this.renderInput()}\n <div className=\"typeahead__input-aligner\" />\n </div>\n <div ref={this.sizerRef} className=\"sizer form-control typeahead__input\">\n {value}\n </div>\n </div>\n ) : (\n this.renderInput()\n );\n }\n}\n"],"names":["DEFAULT_INPUT_MIN_WIDTH","TypeaheadInput","Component","inputRef","createRef","sizerRef","constructor","props","state","inputWidth","keyboardFocusedOptionIndex","componentDidMount","autoFocus","setTimeout","current","focus","componentDidUpdate","previousProps","value","multiple","recalculateWidth","requestAnimationFrame","setState","Math","max","scrollWidth","renderInput","typeaheadId","name","dropdownOpen","placeholder","selected","onChange","onKeyDown","onFocus","onPaste","autoComplete","ariaActivedescendant","hasPlaceholder","length","_jsx","Input","ref","className","clsx","id","undefined","role","style","width","onClick","render","maxHeight","renderChip","_jsxs","children","map","chip","idx"],"mappings":";;;;;;;AAAA;AACA;AACA;AAOA,MAAMA,uBAAuB,GAAG,EAAE,CAAA;AAqBb,MAAAC,cAAkB,SAAQC,eAG9C,CAAA;EACCC,QAAQ,gBAAGC,eAAS,EAAoB,CAAA;EACxCC,QAAQ,gBAAGD,eAAS,EAAkB,CAAA;EAEtCE,WAAAA,CAAYC,KAA6B,EAAA;IACvC,KAAK,CAACA,KAAK,CAAC,CAAA;IACZ,IAAI,CAACC,KAAK,GAAG;AACXC,MAAAA,UAAU,EAAET,uBAAuB;AACnCU,MAAAA,0BAA0B,EAAE,IAAA;KAC7B,CAAA;AACH,GAAA;AAEAC,EAAAA,iBAAiBA,GAAA;IACf,MAAM;AAAEC,MAAAA,SAAAA;KAAW,GAAG,IAAI,CAACL,KAAK,CAAA;AAChC,IAAA,IAAIK,SAAS,EAAE;AACb;AACAC,MAAAA,UAAU,CAAC,MAAK;AACd,QAAA,IAAI,CAACV,QAAQ,CAACW,OAAO,EAAEC,KAAK,EAAE,CAAA;AAChC,OAAC,CAAC,CAAA;AACJ,KAAA;AACF,GAAA;EAEAC,kBAAkBA,CAACC,aAAqC,EAAA;AACtD,IAAA,IAAIA,aAAa,CAACC,KAAK,KAAK,IAAI,CAACX,KAAK,CAACW,KAAK,IAAI,IAAI,CAACX,KAAK,CAACY,QAAQ,EAAE;MACnE,IAAI,CAACC,gBAAgB,EAAE,CAAA;AACzB,KAAA;AACF,GAAA;EAEAA,gBAAgB,GAAGA,MAAK;AACtBC,IAAAA,qBAAqB,CAAC,MAAK;MACzB,IAAI,CAACC,QAAQ,CAAC;AACZb,QAAAA,UAAU,EAAEc,IAAI,CAACC,GAAG,CAACxB,uBAAuB,EAAE,IAAI,CA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G,EAAE,IAAI,CAACrC,QAAS;AAACsC,QAAAA,SAAS,EAAC,qCAAqC;AAAAY,QAAAA,QAAA,EACrErC,KAAAA;AAAK,OACH,CACP,CAAA;AAAA,KAAK,CAAC,GAEN,IAAI,CAACQ,WAAW,EACjB,CAAA;AACH,GAAA;AACD;;;;"}
|
|
@@ -22,7 +22,10 @@ class TypeaheadInput extends Component {
|
|
|
22
22
|
autoFocus
|
|
23
23
|
} = this.props;
|
|
24
24
|
if (autoFocus) {
|
|
25
|
-
|
|
25
|
+
// Autofocus after context code executions (e.g open Modal) is completed
|
|
26
|
+
setTimeout(() => {
|
|
27
|
+
this.inputRef.current?.focus();
|
|
28
|
+
});
|
|
26
29
|
}
|
|
27
30
|
}
|
|
28
31
|
componentDidUpdate(previousProps) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeaheadInput.mjs","sources":["../../../src/typeahead/typeaheadInput/TypeaheadInput.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/no-autofocus */\n/* eslint-disable jsx-a11y/click-events-have-key-events */\n/* eslint-disable jsx-a11y/no-static-element-interactions */\nimport { clsx } from 'clsx';\nimport { Component, createRef, ReactNode } from 'react';\n\nimport { Input } from '../../inputs/Input';\nimport { TypeaheadOption, TypeaheadProps } from '../Typeahead';\n\nconst DEFAULT_INPUT_MIN_WIDTH = 10;\n\nexport type TypeaheadInputProps<T> = {\n typeaheadId: string;\n value: string;\n selected: readonly TypeaheadOption<T>[];\n dropdownOpen?: boolean;\n autoComplete: string;\n onChange: React.ChangeEventHandler<HTMLInputElement>;\n onKeyDown: React.KeyboardEventHandler<HTMLInputElement>;\n onFocus: () => void;\n onPaste: React.ClipboardEventHandler<HTMLInputElement>;\n renderChip: (chip: TypeaheadOption<T>, index: number) => ReactNode;\n ariaActivedescendant?: string;\n} & Pick<TypeaheadProps<T>, 'id' | 'name' | 'autoFocus' | 'multiple' | 'placeholder' | 'maxHeight'>;\n\ntype TypeaheadInputState = {\n inputWidth: number;\n keyboardFocusedOptionIndex: number | null;\n};\n\nexport default class TypeaheadInput<T> extends Component<\n TypeaheadInputProps<T>,\n TypeaheadInputState\n> {\n inputRef = createRef<HTMLInputElement>();\n sizerRef = createRef<HTMLDivElement>();\n\n constructor(props: TypeaheadInputProps<T>) {\n super(props);\n this.state = {\n inputWidth: DEFAULT_INPUT_MIN_WIDTH,\n keyboardFocusedOptionIndex: null,\n };\n }\n\n componentDidMount() {\n const { autoFocus } = this.props;\n if (autoFocus) {\n this.inputRef.current?.focus();\n }\n }\n\n componentDidUpdate(previousProps: TypeaheadInputProps<T>) {\n if (previousProps.value !== this.props.value && this.props.multiple) {\n this.recalculateWidth();\n }\n }\n\n recalculateWidth = () => {\n requestAnimationFrame(() => {\n this.setState({\n inputWidth: Math.max(DEFAULT_INPUT_MIN_WIDTH, this.sizerRef.current?.scrollWidth ?? 0 + 10),\n });\n });\n };\n\n renderInput = () => {\n const {\n typeaheadId,\n autoFocus,\n multiple,\n name,\n dropdownOpen,\n placeholder,\n selected,\n value,\n onChange,\n onKeyDown,\n onFocus,\n onPaste,\n autoComplete,\n ariaActivedescendant, // Declare the ariaActivedescendant variable\n } = this.props;\n const { inputWidth } = this.state;\n\n const hasPlaceholder = !multiple || selected.length === 0;\n return (\n <Input\n ref={this.inputRef}\n className={clsx(multiple && 'typeahead__input')}\n name={name}\n id={`input-${typeaheadId}`}\n aria-activedescendant={\n ariaActivedescendant\n ? `menu-${typeaheadId} ${ariaActivedescendant}`\n : `menu-${typeaheadId}`\n }\n autoFocus={autoFocus}\n placeholder={hasPlaceholder ? placeholder : ''}\n aria-autocomplete=\"list\"\n aria-expanded={dropdownOpen}\n aria-haspopup=\"listbox\"\n aria-controls={dropdownOpen ? `menu-${typeaheadId}` : undefined}\n autoComplete={autoComplete}\n role=\"combobox\"\n value={value}\n style={multiple && selected.length > 0 ? { width: inputWidth } : {}}\n onChange={onChange}\n onKeyDown={onKeyDown}\n onClick={onFocus}\n onFocus={onFocus}\n onPaste={onPaste}\n />\n );\n };\n\n render() {\n const { multiple, selected, value, maxHeight, renderChip } = this.props;\n\n return multiple ? (\n <div\n className=\"form-control typeahead__input-container\"\n style={{ maxHeight }}\n onClick={() => {\n this.inputRef.current?.focus();\n }}\n >\n <div className=\"typeahead__input-wrapper\">\n {selected && selected.map((chip, idx) => renderChip(chip, idx))}\n\n {this.renderInput()}\n <div className=\"typeahead__input-aligner\" />\n </div>\n <div ref={this.sizerRef} className=\"sizer form-control typeahead__input\">\n {value}\n </div>\n </div>\n ) : (\n this.renderInput()\n );\n }\n}\n"],"names":["DEFAULT_INPUT_MIN_WIDTH","TypeaheadInput","Component","inputRef","createRef","sizerRef","constructor","props","state","inputWidth","keyboardFocusedOptionIndex","componentDidMount","autoFocus","current","focus","componentDidUpdate","previousProps","value","multiple","recalculateWidth","requestAnimationFrame","setState","Math","max","scrollWidth","renderInput","typeaheadId","name","dropdownOpen","placeholder","selected","onChange","onKeyDown","onFocus","onPaste","autoComplete","ariaActivedescendant","hasPlaceholder","length","_jsx","Input","ref","className","clsx","id","undefined","role","style","width","onClick","render","maxHeight","renderChip","_jsxs","children","map","chip","idx"],"mappings":";;;;;AAAA;AACA;AACA;AAOA,MAAMA,uBAAuB,GAAG,EAAE,CAAA;AAqBb,MAAAC,cAAkB,SAAQC,SAG9C,CAAA;EACCC,QAAQ,gBAAGC,SAAS,EAAoB,CAAA;EACxCC,QAAQ,gBAAGD,SAAS,EAAkB,CAAA;EAEtCE,WAAAA,CAAYC,KAA6B,EAAA;IACvC,KAAK,CAACA,KAAK,CAAC,CAAA;IACZ,IAAI,CAACC,KAAK,GAAG;AACXC,MAAAA,UAAU,EAAET,uBAAuB;AACnCU,MAAAA,0BAA0B,EAAE,IAAA;KAC7B,CAAA;AACH,GAAA;AAEAC,EAAAA,iBAAiBA,GAAA;IACf,MAAM;AAAEC,MAAAA,SAAAA;KAAW,GAAG,IAAI,CAACL,KAAK,CAAA;AAChC,IAAA,IAAIK,SAAS,EAAE;AACb,
|
|
1
|
+
{"version":3,"file":"TypeaheadInput.mjs","sources":["../../../src/typeahead/typeaheadInput/TypeaheadInput.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/no-autofocus */\n/* eslint-disable jsx-a11y/click-events-have-key-events */\n/* eslint-disable jsx-a11y/no-static-element-interactions */\nimport { clsx } from 'clsx';\nimport { Component, createRef, ReactNode } from 'react';\n\nimport { Input } from '../../inputs/Input';\nimport { TypeaheadOption, TypeaheadProps } from '../Typeahead';\n\nconst DEFAULT_INPUT_MIN_WIDTH = 10;\n\nexport type TypeaheadInputProps<T> = {\n typeaheadId: string;\n value: string;\n selected: readonly TypeaheadOption<T>[];\n dropdownOpen?: boolean;\n autoComplete: string;\n onChange: React.ChangeEventHandler<HTMLInputElement>;\n onKeyDown: React.KeyboardEventHandler<HTMLInputElement>;\n onFocus: () => void;\n onPaste: React.ClipboardEventHandler<HTMLInputElement>;\n renderChip: (chip: TypeaheadOption<T>, index: number) => ReactNode;\n ariaActivedescendant?: string;\n} & Pick<TypeaheadProps<T>, 'id' | 'name' | 'autoFocus' | 'multiple' | 'placeholder' | 'maxHeight'>;\n\ntype TypeaheadInputState = {\n inputWidth: number;\n keyboardFocusedOptionIndex: number | null;\n};\n\nexport default class TypeaheadInput<T> extends Component<\n TypeaheadInputProps<T>,\n TypeaheadInputState\n> {\n inputRef = createRef<HTMLInputElement>();\n sizerRef = createRef<HTMLDivElement>();\n\n constructor(props: TypeaheadInputProps<T>) {\n super(props);\n this.state = {\n inputWidth: DEFAULT_INPUT_MIN_WIDTH,\n keyboardFocusedOptionIndex: null,\n };\n }\n\n componentDidMount() {\n const { autoFocus } = this.props;\n if (autoFocus) {\n // Autofocus after context code executions (e.g open Modal) is completed\n setTimeout(() => {\n this.inputRef.current?.focus();\n });\n }\n }\n\n componentDidUpdate(previousProps: TypeaheadInputProps<T>) {\n if (previousProps.value !== this.props.value && this.props.multiple) {\n this.recalculateWidth();\n }\n }\n\n recalculateWidth = () => {\n requestAnimationFrame(() => {\n this.setState({\n inputWidth: Math.max(DEFAULT_INPUT_MIN_WIDTH, this.sizerRef.current?.scrollWidth ?? 0 + 10),\n });\n });\n };\n\n renderInput = () => {\n const {\n typeaheadId,\n autoFocus,\n multiple,\n name,\n dropdownOpen,\n placeholder,\n selected,\n value,\n onChange,\n onKeyDown,\n onFocus,\n onPaste,\n autoComplete,\n ariaActivedescendant, // Declare the ariaActivedescendant variable\n } = this.props;\n const { inputWidth } = this.state;\n\n const hasPlaceholder = !multiple || selected.length === 0;\n return (\n <Input\n ref={this.inputRef}\n className={clsx(multiple && 'typeahead__input')}\n name={name}\n id={`input-${typeaheadId}`}\n aria-activedescendant={\n ariaActivedescendant\n ? `menu-${typeaheadId} ${ariaActivedescendant}`\n : `menu-${typeaheadId}`\n }\n autoFocus={autoFocus}\n placeholder={hasPlaceholder ? placeholder : ''}\n aria-autocomplete=\"list\"\n aria-expanded={dropdownOpen}\n aria-haspopup=\"listbox\"\n aria-controls={dropdownOpen ? `menu-${typeaheadId}` : undefined}\n autoComplete={autoComplete}\n role=\"combobox\"\n value={value}\n style={multiple && selected.length > 0 ? { width: inputWidth } : {}}\n onChange={onChange}\n onKeyDown={onKeyDown}\n onClick={onFocus}\n onFocus={onFocus}\n onPaste={onPaste}\n />\n );\n };\n\n render() {\n const { multiple, selected, value, maxHeight, renderChip } = this.props;\n\n return multiple ? (\n <div\n className=\"form-control typeahead__input-container\"\n style={{ maxHeight }}\n onClick={() => {\n this.inputRef.current?.focus();\n }}\n >\n <div className=\"typeahead__input-wrapper\">\n {selected && selected.map((chip, idx) => renderChip(chip, idx))}\n\n {this.renderInput()}\n <div className=\"typeahead__input-aligner\" />\n </div>\n <div ref={this.sizerRef} className=\"sizer form-control typeahead__input\">\n {value}\n </div>\n </div>\n ) : (\n this.renderInput()\n );\n }\n}\n"],"names":["DEFAULT_INPUT_MIN_WIDTH","TypeaheadInput","Component","inputRef","createRef","sizerRef","constructor","props","state","inputWidth","keyboardFocusedOptionIndex","componentDidMount","autoFocus","setTimeout","current","focus","componentDidUpdate","previousProps","value","multiple","recalculateWidth","requestAnimationFrame","setState","Math","max","scrollWidth","renderInput","typeaheadId","name","dropdownOpen","placeholder","selected","onChange","onKeyDown","onFocus","onPaste","autoComplete","ariaActivedescendant","hasPlaceholder","length","_jsx","Input","ref","className","clsx","id","undefined","role","style","width","onClick","render","maxHeight","renderChip","_jsxs","children","map","chip","idx"],"mappings":";;;;;AAAA;AACA;AACA;AAOA,MAAMA,uBAAuB,GAAG,EAAE,CAAA;AAqBb,MAAAC,cAAkB,SAAQC,SAG9C,CAAA;EACCC,QAAQ,gBAAGC,SAAS,EAAoB,CAAA;EACxCC,QAAQ,gBAAGD,SAAS,EAAkB,CAAA;EAEtCE,WAAAA,CAAYC,KAA6B,EAAA;IACvC,KAAK,CAACA,KAAK,CAAC,CAAA;IACZ,IAAI,CAACC,KAAK,GAAG;AACXC,MAAAA,UAAU,EAAET,uBAAuB;AACnCU,MAAAA,0BAA0B,EAAE,IAAA;KAC7B,CAAA;AACH,GAAA;AAEAC,EAAAA,iBAAiBA,GAAA;IACf,MAAM;AAAEC,MAAAA,SAAAA;KAAW,GAAG,IAAI,CAACL,KAAK,CAAA;AAChC,IAAA,IAAIK,SAAS,EAAE;AACb;AACAC,MAAAA,UAAU,CAAC,MAAK;AACd,QAAA,IAAI,CAACV,QAAQ,CAACW,OAAO,EAAEC,KAAK,EAAE,CAAA;AAChC,OAAC,CAAC,CAAA;AACJ,KAAA;AACF,GAAA;EAEAC,kBAAkBA,CAACC,aAAqC,EAAA;AACtD,IAAA,IAAIA,aAAa,CAACC,KAAK,KAAK,IAAI,CAACX,KAAK,CAACW,KAAK,IAAI,IAAI,CAACX,KAAK,CAACY,QAAQ,EAAE;MACnE,IAAI,CAACC,gBAAgB,EAAE,CAAA;AACzB,KAAA;AACF,GAAA;EAEAA,gBAAgB,GAAGA,MAAK;AACtBC,IAAAA,qBAAqB,CAAC,MAAK;MACzB,IAAI,CAACC,QAAQ,CAA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A0B,SAC3C,CAAA,CAAA;OAAK,CACL,eAAAH,GAAA,CAAA,KAAA,EAAA;QAAKE,GAAG,EAAE,IAAI,CAACrC,QAAS;AAACsC,QAAAA,SAAS,EAAC,qCAAqC;AAAAY,QAAAA,QAAA,EACrErC,KAAAA;AAAK,OACH,CACP,CAAA;AAAA,KAAK,CAAC,GAEN,IAAI,CAACQ,WAAW,EACjB,CAAA;AACH,GAAA;AACD;;;;"}
|
|
@@ -8,12 +8,13 @@ export type ActionOptionProps = {
|
|
|
8
8
|
showMediaAtAllSizes?: boolean;
|
|
9
9
|
onClick: () => void;
|
|
10
10
|
title: React.ReactNode;
|
|
11
|
+
additionalContent?: React.ReactNode;
|
|
11
12
|
action: React.ReactNode;
|
|
12
13
|
priority?: ActionOptionPriority;
|
|
13
14
|
showMediaCircle?: boolean;
|
|
14
15
|
isContainerAligned?: boolean;
|
|
15
16
|
as?: React.ElementType;
|
|
16
17
|
} & CommonProps & AriaLabelProperty;
|
|
17
|
-
declare const ActionOption: ({ action, priority, disabled, onClick, media, title, content, complex, className, showMediaAtAllSizes, showMediaCircle, isContainerAligned, as, "aria-label": ariaLabel, }: ActionOptionProps) => import("react").JSX.Element;
|
|
18
|
+
declare const ActionOption: ({ action, priority, disabled, onClick, media, title, content, additionalContent, complex, className, showMediaAtAllSizes, showMediaCircle, isContainerAligned, as, "aria-label": ariaLabel, }: ActionOptionProps) => import("react").JSX.Element;
|
|
18
19
|
export default ActionOption;
|
|
19
20
|
//# sourceMappingURL=ActionOption.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionOption.d.ts","sourceRoot":"","sources":["../../../src/actionOption/ActionOption.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,iBAAiB,EACjB,WAAW,EAEX,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,WAAW,CAAC;AAInB,KAAK,oBAAoB,GACrB,eAAe,GACf,iBAAiB,GACjB,gBAAgB,GAChB,gBAAg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C,SAAS,CAAC;IACpC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAChC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC;CACxB,GAAG,WAAW,GACb,iBAAiB,CAAC;AAEpB,QAAA,MAAM,YAAY,kMAgBf,iBAAiB,gCAiEnB,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -20,6 +20,7 @@ export interface BaseOptionProps extends Omit<HTMLAttributes<HTMLElement>, 'titl
|
|
|
20
20
|
showMediaAtAllSizes?: boolean;
|
|
21
21
|
showMediaCircle?: boolean;
|
|
22
22
|
isContainerAligned?: boolean;
|
|
23
|
+
additionalContent?: ReactNode;
|
|
23
24
|
}
|
|
24
25
|
interface AnchorOptionProps extends BaseOptionProps, LinkProps {
|
|
25
26
|
as: 'a';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Option.d.ts","sourceRoot":"","sources":["../../../../src/common/Option/Option.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Option.d.ts","sourceRoot":"","sources":["../../../../src/common/Option/Option.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAc,cAAc,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAGvF,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7F,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IACnD,EAAE,CAAC,EAAE,WAAW,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,iBAAiB,CAAC,EAAE,SAAS,CAAC;CAC/B;AAED,UAAU,iBAAkB,SAAQ,eAAe,EAAE,SAAS;IAC5D,EAAE,EAAE,GAAG,CAAC;CACT;AAED,MAAM,MAAM,WAAW,GAAG,eAAe,GAAG,iBAAiB,CAAC;AAE9D,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,iBAAiB,CAAC;AAE5D,QAAA,MAAM,MAAM,uGA0EX,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTrigger.d.ts","sourceRoot":"","sources":["../../../../src/dateLookup/dateTrigger/DateTrigger.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAkB,SAAS,EAAE,UAAU,EAAE,SAAS,EAAc,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"DateTrigger.d.ts","sourceRoot":"","sources":["../../../../src/dateLookup/dateTrigger/DateTrigger.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAkB,SAAS,EAAE,UAAU,EAAE,SAAS,EAAc,MAAM,cAAc,CAAC;AAS5F,UAAU,gBAAgB;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,IAAI,GAAG,IAAI,CAAC;IAC1B,IAAI,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,OAAO,GAAG,MAAM,CAAC;IAC9B,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA0E3C,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefinitionList.d.ts","sourceRoot":"","sources":["../../../src/definitionList/DefinitionList.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DefinitionList.d.ts","sourceRoot":"","sources":["../../../src/definitionList/DefinitionList.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGnC,MAAM,WAAW,wBAAwB;IACvC,MAAM,CAAC,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;KACtD,CAAC;IACF,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,MAAM,oBAAoB,GAC9B,GAAG,MAAM,CAAC,mBAAmB,GAAG,MAAM,CAAC,mBAAmB,GAAG,MAAM,CAAC,oBAAoB,GAAG,MAAM,CAAC,uBAAuB,GAAG,MAAM,CAAC,wBAAwB,EAAE,CAAC;AAEhK,MAAM,WAAW,mBAAmB;I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IAAI,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,aAAa,GAAG,WAAW,CAAC,CAAC;AAEpG,KAAK,mBAAmB,GAAG;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,0BAA0B,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3C,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,cAAc,CAAC,CAAC,CAAE,SAAQ,SAAS,CACtD,mBAAmB,CAAC,CAAC,CAAC,EACtB,mBAAmB,CACpB;IACC,QAAQ,8CAAiC;IACzC,QAAQ,4CAA+B;gBAE3B,KAAK,EAAE,mBAAmB,CAAC,CAAC,CAAC;IAQzC,iBAAiB;IAUjB,kBAAkB,CAAC,aAAa,EAAE,mBAAmB,CAAC,CAAC,CAAC;IAMxD,gBAAgB,aAMd;IAEF,WAAW,oCAgDT;IAEF,MAAM;CAyBP"}
|
package/package.json
CHANGED
|
@@ -15,6 +15,8 @@ export default {
|
|
|
15
15
|
action: 'Action',
|
|
16
16
|
media: <FastFlagIcon />,
|
|
17
17
|
showMediaCircle: false,
|
|
18
|
+
additionalContent:
|
|
19
|
+
'Additional content goes here, this content does not align with the logo and button',
|
|
18
20
|
},
|
|
19
21
|
tags: ['autodocs'],
|
|
20
22
|
} satisfies Meta<typeof ActionOption>;
|
|
@@ -26,6 +26,7 @@ export type ActionOptionProps = {
|
|
|
26
26
|
showMediaAtAllSizes?: boolean;
|
|
27
27
|
onClick: () => void;
|
|
28
28
|
title: React.ReactNode;
|
|
29
|
+
additionalContent?: React.ReactNode;
|
|
29
30
|
action: React.ReactNode;
|
|
30
31
|
priority?: ActionOptionPriority;
|
|
31
32
|
showMediaCircle?: boolean;
|
|
@@ -42,6 +43,7 @@ const ActionOption = ({
|
|
|
42
43
|
media,
|
|
43
44
|
title,
|
|
44
45
|
content,
|
|
46
|
+
additionalContent,
|
|
45
47
|
complex,
|
|
46
48
|
className,
|
|
47
49
|
showMediaAtAllSizes,
|
|
@@ -60,6 +62,7 @@ const ActionOption = ({
|
|
|
60
62
|
showMediaCircle,
|
|
61
63
|
className: clsx('tw-action-option', className),
|
|
62
64
|
isContainerAligned,
|
|
65
|
+
additionalContent,
|
|
63
66
|
as,
|
|
64
67
|
};
|
|
65
68
|
|
|
@@ -98,3 +98,25 @@ button.np-option {
|
|
|
98
98
|
border-radius: var(--radius-small);
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
+
.np-theme-personal .np-option-additional-content {
|
|
102
|
+
margin-left: 80px;
|
|
103
|
+
margin-left: var(--size-80);
|
|
104
|
+
margin-right: 16px;
|
|
105
|
+
margin-right: var(--size-16);
|
|
106
|
+
margin-top: -10px;
|
|
107
|
+
padding-bottom: 16px;
|
|
108
|
+
padding-bottom: var(--size-16);
|
|
109
|
+
max-width: -moz-fit-content;
|
|
110
|
+
max-width: fit-content;
|
|
111
|
+
}
|
|
112
|
+
@media (max-width: 480px) {
|
|
113
|
+
.np-theme-personal .np-option-additional-content {
|
|
114
|
+
margin-left: 16px;
|
|
115
|
+
margin-left: var(--size-16);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
@media (max-width: 320px) {
|
|
119
|
+
.np-theme-personal .np-option-additional-content {
|
|
120
|
+
margin-top: -3px;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -95,4 +95,25 @@ button.np-option {
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
+
|
|
99
|
+
.np-option-additional-content {
|
|
100
|
+
margin-left: var(--size-80);
|
|
101
|
+
margin-right: var(--size-16);
|
|
102
|
+
margin-top: -10px;
|
|
103
|
+
padding-bottom: var(--size-16);
|
|
104
|
+
max-width:fit-content
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
@media (max-width: 480px) {
|
|
108
|
+
.np-option-additional-content {
|
|
109
|
+
margin-left: var(--size-16);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
@media (--screen-400-zoom) {
|
|
114
|
+
.np-option-additional-content {
|
|
115
|
+
margin-top: -3px;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
98
119
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createRef } from 'react';
|
|
2
|
+
|
|
3
|
+
import { render, screen } from '../../test-utils';
|
|
4
|
+
|
|
5
|
+
import Option from '.';
|
|
6
|
+
|
|
7
|
+
describe('Option', () => {
|
|
8
|
+
it('renders the title', () => {
|
|
9
|
+
render(<Option title="Option title" content="" media={<span />} button={<span />} />);
|
|
10
|
+
|
|
11
|
+
expect(() => screen.getByText('Option title')).not.toThrow();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('`ref` attribute is passed to Option and reference is created', () => {
|
|
15
|
+
const reference = createRef<HTMLElement | HTMLAnchorElement>();
|
|
16
|
+
|
|
17
|
+
expect(reference.current).toBeFalsy();
|
|
18
|
+
render(<Option ref={reference} title="" content="" media={<span />} button={<span />} />);
|
|
19
|
+
expect(reference.current).toBeTruthy();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable react/display-name */
|
|
1
2
|
import { clsx } from 'clsx';
|
|
2
3
|
import { MouseEvent, forwardRef, HTMLAttributes, ReactNode, ElementType } from 'react';
|
|
3
4
|
|
|
@@ -24,6 +25,7 @@ export interface BaseOptionProps extends Omit<HTMLAttributes<HTMLElement>, 'titl
|
|
|
24
25
|
showMediaAtAllSizes?: boolean;
|
|
25
26
|
showMediaCircle?: boolean;
|
|
26
27
|
isContainerAligned?: boolean;
|
|
28
|
+
additionalContent?: ReactNode;
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
interface AnchorOptionProps extends BaseOptionProps, LinkProps {
|
|
@@ -50,6 +52,7 @@ const Option = forwardRef<ReferenceType, OptionProps>(
|
|
|
50
52
|
showMediaAtAllSizes,
|
|
51
53
|
showMediaCircle = true,
|
|
52
54
|
isContainerAligned = false,
|
|
55
|
+
additionalContent,
|
|
53
56
|
...rest
|
|
54
57
|
},
|
|
55
58
|
reference,
|
|
@@ -69,7 +72,7 @@ const Option = forwardRef<ReferenceType, OptionProps>(
|
|
|
69
72
|
})}
|
|
70
73
|
disabled={disabled && Element === 'button'}
|
|
71
74
|
>
|
|
72
|
-
<div className=
|
|
75
|
+
<div className={clsx('media')}>
|
|
73
76
|
{media && (
|
|
74
77
|
<div className="media-left">
|
|
75
78
|
{showMediaCircle ? (
|
|
@@ -101,6 +104,9 @@ const Option = forwardRef<ReferenceType, OptionProps>(
|
|
|
101
104
|
</div>
|
|
102
105
|
<div className="media-right">{button}</div>
|
|
103
106
|
</div>
|
|
107
|
+
{additionalContent ? (
|
|
108
|
+
<div className="np-option-additional-content"> {additionalContent} </div>
|
|
109
|
+
) : null}
|
|
104
110
|
</Element>
|
|
105
111
|
);
|
|
106
112
|
},
|