@transferwise/components 46.52.2 → 46.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/card/Card.js +20 -13
- package/build/card/Card.js.map +1 -1
- package/build/card/Card.mjs +21 -14
- package/build/card/Card.mjs.map +1 -1
- package/build/common/Option/Option.js.map +1 -1
- package/build/common/Option/Option.mjs.map +1 -1
- package/build/dateLookup/dateTrigger/DateTrigger.js +8 -4
- package/build/dateLookup/dateTrigger/DateTrigger.js.map +1 -1
- package/build/dateLookup/dateTrigger/DateTrigger.mjs +8 -4
- package/build/dateLookup/dateTrigger/DateTrigger.mjs.map +1 -1
- package/build/field/Field.js +36 -8
- package/build/field/Field.js.map +1 -1
- package/build/field/Field.mjs +37 -9
- package/build/field/Field.mjs.map +1 -1
- package/build/i18n/en.json +1 -0
- package/build/i18n/en.json.js +1 -0
- package/build/i18n/en.json.js.map +1 -1
- package/build/i18n/en.json.mjs +1 -0
- package/build/i18n/en.json.mjs.map +1 -1
- package/build/index.js +2 -2
- package/build/index.mjs +1 -1
- package/build/inlineAlert/InlineAlert.js +13 -6
- package/build/inlineAlert/InlineAlert.js.map +1 -1
- package/build/inlineAlert/InlineAlert.mjs +13 -6
- package/build/inlineAlert/InlineAlert.mjs.map +1 -1
- package/build/label/Label.js +35 -4
- package/build/label/Label.js.map +1 -1
- package/build/label/Label.messages.js +12 -0
- package/build/label/Label.messages.js.map +1 -0
- package/build/label/Label.messages.mjs +10 -0
- package/build/label/Label.messages.mjs.map +1 -0
- package/build/label/Label.mjs +36 -5
- package/build/label/Label.mjs.map +1 -1
- package/build/main.css +4 -8
- package/build/styles/dateLookup/dateTrigger/DateTrigger.css +0 -8
- package/build/styles/field/Field.css +4 -0
- package/build/styles/main.css +4 -8
- package/build/tabs/Tab.js +13 -38
- package/build/tabs/Tab.js.map +1 -1
- package/build/tabs/Tab.mjs +13 -34
- package/build/tabs/Tab.mjs.map +1 -1
- package/build/tabs/TabList.js +3 -11
- package/build/tabs/TabList.js.map +1 -1
- package/build/tabs/TabList.mjs +3 -7
- package/build/tabs/TabList.mjs.map +1 -1
- package/build/tabs/TabPanel.js +3 -16
- package/build/tabs/TabPanel.js.map +1 -1
- package/build/tabs/TabPanel.mjs +3 -12
- package/build/tabs/TabPanel.mjs.map +1 -1
- package/build/tabs/Tabs.js +24 -48
- package/build/tabs/Tabs.js.map +1 -1
- package/build/tabs/Tabs.mjs +24 -47
- package/build/tabs/Tabs.mjs.map +1 -1
- package/build/tabs/utils.js +0 -1
- package/build/tabs/utils.js.map +1 -1
- package/build/tabs/utils.mjs +0 -1
- package/build/tabs/utils.mjs.map +1 -1
- package/build/types/card/Card.d.ts.map +1 -1
- package/build/types/common/Option/Option.d.ts +2 -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/field/Field.d.ts +4 -2
- package/build/types/field/Field.d.ts.map +1 -1
- package/build/types/index.d.ts +2 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/inlineAlert/InlineAlert.d.ts +9 -0
- package/build/types/inlineAlert/InlineAlert.d.ts.map +1 -1
- package/build/types/label/Label.d.ts +21 -1
- package/build/types/label/Label.d.ts.map +1 -1
- package/build/types/label/Label.messages.d.ts +8 -0
- package/build/types/label/Label.messages.d.ts.map +1 -0
- package/build/types/label/index.d.ts +3 -0
- package/build/types/label/index.d.ts.map +1 -0
- package/build/types/tabs/Tab.d.ts +12 -1
- package/build/types/tabs/Tab.d.ts.map +1 -1
- package/build/types/tabs/TabList.d.ts +3 -8
- package/build/types/tabs/TabList.d.ts.map +1 -1
- package/build/types/tabs/TabPanel.d.ts +6 -14
- package/build/types/tabs/TabPanel.d.ts.map +1 -1
- package/build/types/tabs/Tabs.d.ts +83 -30
- package/build/types/tabs/Tabs.d.ts.map +1 -1
- package/build/types/tabs/index.d.ts +2 -1
- package/build/types/tabs/index.d.ts.map +1 -1
- package/build/types/tabs/utils.d.ts +12 -7
- package/build/types/tabs/utils.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/card/Card.spec.tsx +35 -3
- package/src/card/Card.story.tsx +56 -40
- package/src/card/Card.tsx +32 -14
- package/src/common/Option/Option.tsx +2 -0
- package/src/dateInput/DateInput.tests.story.tsx +6 -42
- package/src/dateLookup/DateLookup.rtl.spec.tsx +1 -1
- package/src/dateLookup/dateTrigger/DateTrigger.css +0 -8
- package/src/dateLookup/dateTrigger/DateTrigger.less +0 -8
- package/src/dateLookup/dateTrigger/DateTrigger.spec.js +1 -1
- package/src/dateLookup/dateTrigger/DateTrigger.tsx +9 -4
- package/src/field/Field.css +4 -0
- package/src/field/Field.less +5 -0
- package/src/field/Field.spec.tsx +41 -5
- package/src/field/Field.story.tsx +105 -7
- package/src/field/Field.tsx +34 -10
- package/src/i18n/en.json +1 -0
- package/src/index.ts +2 -1
- package/src/inlineAlert/InlineAlert.story.tsx +7 -72
- package/src/inlineAlert/InlineAlert.tsx +14 -3
- package/src/inputWithDisplayFormat/InputWithDisplayFormat.story.js +5 -10
- package/src/inputs/InputGroup.spec.tsx +1 -1
- package/src/inputs/SearchInput.spec.tsx +1 -1
- package/src/inputs/SelectInput.spec.tsx +1 -1
- package/src/label/Label.messages.tsx +8 -0
- package/src/label/Label.spec.tsx +53 -4
- package/src/label/Label.story.tsx +32 -26
- package/src/label/Label.tsx +47 -2
- package/src/label/index.ts +2 -0
- package/src/main.css +4 -8
- package/src/main.less +1 -0
- package/src/moneyInput/MoneyInput.story.tsx +11 -11
- package/src/radioGroup/RadioGroup.rtl.spec.tsx +1 -1
- package/src/select/Select.rtl.spec.tsx +1 -1
- package/src/switch/Switch.spec.tsx +1 -1
- package/src/switch/Switch.story.tsx +19 -21
- package/src/tabs/Tab.tsx +72 -0
- package/src/tabs/TabList.tsx +11 -0
- package/src/tabs/TabPanel.tsx +14 -0
- package/src/tabs/{Tabs.story.js → Tabs.story.tsx} +1 -1
- package/src/tabs/{Tabs.js → Tabs.tsx} +111 -74
- package/src/tabs/index.ts +2 -0
- package/src/tabs/{utils.spec.js → utils.spec.ts} +24 -21
- package/src/tabs/{utils.js → utils.ts} +15 -9
- package/src/field/Field.tests.story.tsx +0 -33
- package/src/tabs/Tab.js +0 -71
- package/src/tabs/TabList.js +0 -15
- package/src/tabs/TabPanel.js +0 -20
- package/src/tabs/index.js +0 -1
package/build/i18n/en.json.js
CHANGED
|
@@ -20,6 +20,7 @@ var en = {
|
|
|
20
20
|
"neptune.DateLookup.year": "year",
|
|
21
21
|
"neptune.FlowNavigation.back": "back to previous step",
|
|
22
22
|
"neptune.Info.ariaLabel": "More information",
|
|
23
|
+
"neptune.Label.optional": "(Optional)",
|
|
23
24
|
"neptune.Link.opensInNewTab": "(opens in new tab)",
|
|
24
25
|
"neptune.MoneyInput.Select.placeholder": "Select an option...",
|
|
25
26
|
"neptune.PhoneNumberInput.SelectInput.placeholder": "Select an option...",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"en.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/build/i18n/en.json.mjs
CHANGED
|
@@ -18,6 +18,7 @@ var en = {
|
|
|
18
18
|
"neptune.DateLookup.year": "year",
|
|
19
19
|
"neptune.FlowNavigation.back": "back to previous step",
|
|
20
20
|
"neptune.Info.ariaLabel": "More information",
|
|
21
|
+
"neptune.Label.optional": "(Optional)",
|
|
21
22
|
"neptune.Link.opensInNewTab": "(opens in new tab)",
|
|
22
23
|
"neptune.MoneyInput.Select.placeholder": "Select an option...",
|
|
23
24
|
"neptune.PhoneNumberInput.SelectInput.placeholder": "Select an option...",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"en.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/build/index.js
CHANGED
|
@@ -84,6 +84,7 @@ var Sticky = require('./sticky/Sticky.js');
|
|
|
84
84
|
var Summary = require('./summary/Summary.js');
|
|
85
85
|
var Switch = require('./switch/Switch.js');
|
|
86
86
|
var SwitchOption = require('./switchOption/SwitchOption.js');
|
|
87
|
+
var Tabs = require('./tabs/Tabs.js');
|
|
87
88
|
var TextareaWithDisplayFormat = require('./textareaWithDisplayFormat/TextareaWithDisplayFormat.js');
|
|
88
89
|
var Title = require('./title/Title.js');
|
|
89
90
|
var Tooltip = require('./tooltip/Tooltip.js');
|
|
@@ -95,7 +96,6 @@ var useSnackbar = require('./snackbar/useSnackbar.js');
|
|
|
95
96
|
var index$1 = require('./i18n/index.js');
|
|
96
97
|
var CheckboxButton = require('./checkboxButton/CheckboxButton.js');
|
|
97
98
|
var ListItem = require('./listItem/ListItem.js');
|
|
98
|
-
var Tabs = require('./tabs/Tabs.js');
|
|
99
99
|
var useDirection = require('./common/hooks/useDirection/useDirection.js');
|
|
100
100
|
var useLayout = require('./common/hooks/useLayout/useLayout.js');
|
|
101
101
|
var breakpoint = require('./common/propsValues/breakpoint.js');
|
|
@@ -231,6 +231,7 @@ exports.Sticky = Sticky;
|
|
|
231
231
|
exports.Summary = Summary;
|
|
232
232
|
exports.Switch = Switch;
|
|
233
233
|
exports.SwitchOption = SwitchOption;
|
|
234
|
+
exports.Tabs = Tabs;
|
|
234
235
|
exports.TextareaWithDisplayFormat = TextareaWithDisplayFormat;
|
|
235
236
|
exports.Title = Title;
|
|
236
237
|
exports.Tooltip = Tooltip;
|
|
@@ -246,7 +247,6 @@ exports.useSnackbar = useSnackbar;
|
|
|
246
247
|
exports.translations = index$1;
|
|
247
248
|
exports.CheckboxButton = CheckboxButton;
|
|
248
249
|
exports.ListItem = ListItem;
|
|
249
|
-
exports.Tabs = Tabs;
|
|
250
250
|
exports.useDirection = useDirection.useDirection;
|
|
251
251
|
exports.useLayout = useLayout.useLayout;
|
|
252
252
|
Object.defineProperty(exports, "Breakpoint", {
|
package/build/index.mjs
CHANGED
|
@@ -82,6 +82,7 @@ export { default as Sticky } from './sticky/Sticky.mjs';
|
|
|
82
82
|
export { default as Summary } from './summary/Summary.mjs';
|
|
83
83
|
export { default as Switch } from './switch/Switch.mjs';
|
|
84
84
|
export { default as SwitchOption } from './switchOption/SwitchOption.mjs';
|
|
85
|
+
export { default as Tabs } from './tabs/Tabs.mjs';
|
|
85
86
|
export { default as TextareaWithDisplayFormat } from './textareaWithDisplayFormat/TextareaWithDisplayFormat.mjs';
|
|
86
87
|
export { default as Title } from './title/Title.mjs';
|
|
87
88
|
export { default as Tooltip } from './tooltip/Tooltip.mjs';
|
|
@@ -93,7 +94,6 @@ export { default as useSnackbar } from './snackbar/useSnackbar.mjs';
|
|
|
93
94
|
export { default as translations } from './i18n/index.mjs';
|
|
94
95
|
export { default as CheckboxButton } from './checkboxButton/CheckboxButton.mjs';
|
|
95
96
|
export { default as ListItem } from './listItem/ListItem.mjs';
|
|
96
|
-
export { default as Tabs } from './tabs/Tabs.mjs';
|
|
97
97
|
export { useDirection } from './common/hooks/useDirection/useDirection.mjs';
|
|
98
98
|
export { useLayout } from './common/hooks/useLayout/useLayout.mjs';
|
|
99
99
|
export { Breakpoint } from './common/propsValues/breakpoint.mjs';
|
|
@@ -2,28 +2,35 @@
|
|
|
2
2
|
|
|
3
3
|
var clsx = require('clsx');
|
|
4
4
|
var StatusIcon = require('../statusIcon/StatusIcon.js');
|
|
5
|
+
var Body = require('../body/Body.js');
|
|
5
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
7
|
var sentiment = require('../common/propsValues/sentiment.js');
|
|
7
8
|
var size = require('../common/propsValues/size.js');
|
|
8
9
|
|
|
9
10
|
const iconTypes = new Set([sentiment.Sentiment.NEGATIVE, sentiment.Sentiment.ERROR, sentiment.Sentiment.POSITIVE, sentiment.Sentiment.SUCCESS, sentiment.Sentiment.WARNING]);
|
|
11
|
+
/**
|
|
12
|
+
* Avoid using `<InlineAlert>` component directly
|
|
13
|
+
* it's for edge cases when `<Field />` isn't suitable for some reasons.
|
|
14
|
+
*
|
|
15
|
+
* Example:
|
|
16
|
+
* ```
|
|
17
|
+
* <Field sentiment={..} message={..}>..</Field>
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
10
20
|
function InlineAlert({
|
|
11
21
|
id,
|
|
12
22
|
type = 'neutral',
|
|
13
23
|
className,
|
|
14
24
|
children
|
|
15
25
|
}) {
|
|
16
|
-
return /*#__PURE__*/jsxRuntime.jsxs(
|
|
26
|
+
return /*#__PURE__*/jsxRuntime.jsxs(Body, {
|
|
17
27
|
role: "alert",
|
|
18
28
|
id: id,
|
|
19
|
-
className: clsx.clsx('alert alert-detach', `alert-${type === sentiment.Sentiment.NEGATIVE || type === sentiment.Sentiment.ERROR ? 'danger' : type}`, className),
|
|
29
|
+
className: clsx.clsx('alert alert-detach', `alert-${type === sentiment.Sentiment.NEGATIVE || type === sentiment.Sentiment.ERROR ? 'danger' : type}`, 'd-flex', className),
|
|
20
30
|
children: [iconTypes.has(type) && /*#__PURE__*/jsxRuntime.jsx(StatusIcon, {
|
|
21
31
|
sentiment: type,
|
|
22
32
|
size: size.Size.SMALL
|
|
23
|
-
}),
|
|
24
|
-
className: "np-text-body-default",
|
|
25
|
-
children: children
|
|
26
|
-
})]
|
|
33
|
+
}), children]
|
|
27
34
|
});
|
|
28
35
|
}
|
|
29
36
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InlineAlert.js","sources":["../../src/inlineAlert/InlineAlert.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ReactNode } from 'react';\n\nimport { Sentiment, Size } from '../common';\nimport StatusIcon from '../statusIcon';\n\nexport interface InlineAlertProps {\n id?: string;\n type?: `${Sentiment}`;\n className?: string;\n children: ReactNode;\n}\n\nconst iconTypes = new Set<NonNullable<InlineAlertProps['type']>>([\n Sentiment.NEGATIVE,\n Sentiment.ERROR,\n Sentiment.POSITIVE,\n Sentiment.SUCCESS,\n Sentiment.WARNING,\n]);\n\nexport default function InlineAlert({\n id,\n type = 'neutral',\n className,\n children,\n}: InlineAlertProps) {\n return (\n <
|
|
1
|
+
{"version":3,"file":"InlineAlert.js","sources":["../../src/inlineAlert/InlineAlert.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ReactNode } from 'react';\n\nimport { Sentiment, Size } from '../common';\nimport StatusIcon from '../statusIcon';\nimport Body from '../body';\n\nexport interface InlineAlertProps {\n id?: string;\n type?: `${Sentiment}`;\n className?: string;\n children: ReactNode;\n}\n\nconst iconTypes = new Set<NonNullable<InlineAlertProps['type']>>([\n Sentiment.NEGATIVE,\n Sentiment.ERROR,\n Sentiment.POSITIVE,\n Sentiment.SUCCESS,\n Sentiment.WARNING,\n]);\n\n/**\n * Avoid using `<InlineAlert>` component directly\n * it's for edge cases when `<Field />` isn't suitable for some reasons.\n *\n * Example:\n * ```\n * <Field sentiment={..} message={..}>..</Field>\n * ```\n */\nexport default function InlineAlert({\n id,\n type = 'neutral',\n className,\n children,\n}: InlineAlertProps) {\n return (\n <Body\n role=\"alert\"\n id={id}\n className={clsx(\n 'alert alert-detach',\n `alert-${type === Sentiment.NEGATIVE || type === Sentiment.ERROR ? 'danger' : type}`,\n 'd-flex',\n className,\n )}\n >\n {iconTypes.has(type) && <StatusIcon sentiment={type} size={Size.SMALL} />}\n {children}\n </Body>\n );\n}\n"],"names":["iconTypes","Set","Sentiment","NEGATIVE","ERROR","POSITIVE","SUCCESS","WARNING","InlineAlert","id","type","className","children","_jsxs","Body","role","clsx","has","_jsx","StatusIcon","sentiment","size","Size","SMALL"],"mappings":";;;;;;;;;AAcA,MAAMA,SAAS,GAAG,IAAIC,GAAG,CAAwC,CAC/DC,mBAAS,CAACC,QAAQ,EAClBD,mBAAS,CAACE,KAAK,EACfF,mBAAS,CAACG,QAAQ,EAClBH,mBAAS,CAACI,OAAO,EACjBJ,mBAAS,CAACK,OAAO,CAClB,CAAC,CAAA;AAEF;;;;;;;;AAQG;AACqB,SAAAC,WAAWA,CAAC;EAClCC,EAAE;AACFC,EAAAA,IAAI,GAAG,SAAS;EAChBC,SAAS;AACTC,EAAAA,QAAAA;AACiB,CAAA,EAAA;EACjB,oBACEC,eAAA,CAACC,IAAI,EAAA;AACHC,IAAAA,IAAI,EAAC,OAAO;AACZN,IAAAA,EAAE,EAAEA,EAAG;IACPE,SAAS,EAAEK,SAAI,CACb,oBAAoB,EACpB,CAASN,MAAAA,EAAAA,IAAI,KAAKR,mBAAS,CAACC,QAAQ,IAAIO,IAAI,KAAKR,mBAAS,CAACE,KAAK,GAAG,QAAQ,GAAGM,IAAI,CAAA,CAAE,EACpF,QAAQ,EACRC,SAAS,CACT;IAAAC,QAAA,EAAA,CAEDZ,SAAS,CAACiB,GAAG,CAACP,IAAI,CAAC,iBAAIQ,cAAA,CAACC,UAAU,EAAA;AAACC,MAAAA,SAAS,EAAEV,IAAK;MAACW,IAAI,EAAEC,SAAI,CAACC,KAAAA;KAAM,CAAG,EACxEX,QAAQ,CAAA;AAAA,GACL,CAAC,CAAA;AAEX;;;;"}
|
|
@@ -1,27 +1,34 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
2
|
import StatusIcon from '../statusIcon/StatusIcon.mjs';
|
|
3
|
+
import Body from '../body/Body.mjs';
|
|
3
4
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
5
|
import { Sentiment } from '../common/propsValues/sentiment.mjs';
|
|
5
6
|
import { Size } from '../common/propsValues/size.mjs';
|
|
6
7
|
|
|
7
8
|
const iconTypes = new Set([Sentiment.NEGATIVE, Sentiment.ERROR, Sentiment.POSITIVE, Sentiment.SUCCESS, Sentiment.WARNING]);
|
|
9
|
+
/**
|
|
10
|
+
* Avoid using `<InlineAlert>` component directly
|
|
11
|
+
* it's for edge cases when `<Field />` isn't suitable for some reasons.
|
|
12
|
+
*
|
|
13
|
+
* Example:
|
|
14
|
+
* ```
|
|
15
|
+
* <Field sentiment={..} message={..}>..</Field>
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
8
18
|
function InlineAlert({
|
|
9
19
|
id,
|
|
10
20
|
type = 'neutral',
|
|
11
21
|
className,
|
|
12
22
|
children
|
|
13
23
|
}) {
|
|
14
|
-
return /*#__PURE__*/jsxs(
|
|
24
|
+
return /*#__PURE__*/jsxs(Body, {
|
|
15
25
|
role: "alert",
|
|
16
26
|
id: id,
|
|
17
|
-
className: clsx('alert alert-detach', `alert-${type === Sentiment.NEGATIVE || type === Sentiment.ERROR ? 'danger' : type}`, className),
|
|
27
|
+
className: clsx('alert alert-detach', `alert-${type === Sentiment.NEGATIVE || type === Sentiment.ERROR ? 'danger' : type}`, 'd-flex', className),
|
|
18
28
|
children: [iconTypes.has(type) && /*#__PURE__*/jsx(StatusIcon, {
|
|
19
29
|
sentiment: type,
|
|
20
30
|
size: Size.SMALL
|
|
21
|
-
}),
|
|
22
|
-
className: "np-text-body-default",
|
|
23
|
-
children: children
|
|
24
|
-
})]
|
|
31
|
+
}), children]
|
|
25
32
|
});
|
|
26
33
|
}
|
|
27
34
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InlineAlert.mjs","sources":["../../src/inlineAlert/InlineAlert.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ReactNode } from 'react';\n\nimport { Sentiment, Size } from '../common';\nimport StatusIcon from '../statusIcon';\n\nexport interface InlineAlertProps {\n id?: string;\n type?: `${Sentiment}`;\n className?: string;\n children: ReactNode;\n}\n\nconst iconTypes = new Set<NonNullable<InlineAlertProps['type']>>([\n Sentiment.NEGATIVE,\n Sentiment.ERROR,\n Sentiment.POSITIVE,\n Sentiment.SUCCESS,\n Sentiment.WARNING,\n]);\n\nexport default function InlineAlert({\n id,\n type = 'neutral',\n className,\n children,\n}: InlineAlertProps) {\n return (\n <
|
|
1
|
+
{"version":3,"file":"InlineAlert.mjs","sources":["../../src/inlineAlert/InlineAlert.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ReactNode } from 'react';\n\nimport { Sentiment, Size } from '../common';\nimport StatusIcon from '../statusIcon';\nimport Body from '../body';\n\nexport interface InlineAlertProps {\n id?: string;\n type?: `${Sentiment}`;\n className?: string;\n children: ReactNode;\n}\n\nconst iconTypes = new Set<NonNullable<InlineAlertProps['type']>>([\n Sentiment.NEGATIVE,\n Sentiment.ERROR,\n Sentiment.POSITIVE,\n Sentiment.SUCCESS,\n Sentiment.WARNING,\n]);\n\n/**\n * Avoid using `<InlineAlert>` component directly\n * it's for edge cases when `<Field />` isn't suitable for some reasons.\n *\n * Example:\n * ```\n * <Field sentiment={..} message={..}>..</Field>\n * ```\n */\nexport default function InlineAlert({\n id,\n type = 'neutral',\n className,\n children,\n}: InlineAlertProps) {\n return (\n <Body\n role=\"alert\"\n id={id}\n className={clsx(\n 'alert alert-detach',\n `alert-${type === Sentiment.NEGATIVE || type === Sentiment.ERROR ? 'danger' : type}`,\n 'd-flex',\n className,\n )}\n >\n {iconTypes.has(type) && <StatusIcon sentiment={type} size={Size.SMALL} />}\n {children}\n </Body>\n );\n}\n"],"names":["iconTypes","Set","Sentiment","NEGATIVE","ERROR","POSITIVE","SUCCESS","WARNING","InlineAlert","id","type","className","children","_jsxs","Body","role","clsx","has","_jsx","StatusIcon","sentiment","size","Size","SMALL"],"mappings":";;;;;;;AAcA,MAAMA,SAAS,GAAG,IAAIC,GAAG,CAAwC,CAC/DC,SAAS,CAACC,QAAQ,EAClBD,SAAS,CAACE,KAAK,EACfF,SAAS,CAACG,QAAQ,EAClBH,SAAS,CAACI,OAAO,EACjBJ,SAAS,CAACK,OAAO,CAClB,CAAC,CAAA;AAEF;;;;;;;;AAQG;AACqB,SAAAC,WAAWA,CAAC;EAClCC,EAAE;AACFC,EAAAA,IAAI,GAAG,SAAS;EAChBC,SAAS;AACTC,EAAAA,QAAAA;AACiB,CAAA,EAAA;EACjB,oBACEC,IAAA,CAACC,IAAI,EAAA;AACHC,IAAAA,IAAI,EAAC,OAAO;AACZN,IAAAA,EAAE,EAAEA,EAAG;IACPE,SAAS,EAAEK,IAAI,CACb,oBAAoB,EACpB,CAASN,MAAAA,EAAAA,IAAI,KAAKR,SAAS,CAACC,QAAQ,IAAIO,IAAI,KAAKR,SAAS,CAACE,KAAK,GAAG,QAAQ,GAAGM,IAAI,CAAA,CAAE,EACpF,QAAQ,EACRC,SAAS,CACT;IAAAC,QAAA,EAAA,CAEDZ,SAAS,CAACiB,GAAG,CAACP,IAAI,CAAC,iBAAIQ,GAAA,CAACC,UAAU,EAAA;AAACC,MAAAA,SAAS,EAAEV,IAAK;MAACW,IAAI,EAAEC,IAAI,CAACC,KAAAA;KAAM,CAAG,EACxEX,QAAQ,CAAA;AAAA,GACL,CAAC,CAAA;AAEX;;;;"}
|
package/build/label/Label.js
CHANGED
|
@@ -1,21 +1,52 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var clsx = require('clsx');
|
|
4
|
+
var Label_messages = require('./Label.messages.js');
|
|
5
|
+
var reactIntl = require('react-intl');
|
|
6
|
+
var Body = require('../body/Body.js');
|
|
4
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
8
|
|
|
6
9
|
const Label = ({
|
|
7
|
-
id,
|
|
8
|
-
htmlFor,
|
|
9
10
|
className,
|
|
10
|
-
children
|
|
11
|
+
children,
|
|
12
|
+
htmlFor,
|
|
13
|
+
id
|
|
11
14
|
}) => {
|
|
12
15
|
return /*#__PURE__*/jsxRuntime.jsx("label", {
|
|
13
16
|
id: id,
|
|
14
17
|
htmlFor: htmlFor,
|
|
15
|
-
className: clsx.clsx('
|
|
18
|
+
className: clsx.clsx('np-label d-flex flex-column np-text-body-default-bold text-primary m-b-0', className),
|
|
16
19
|
children: children
|
|
17
20
|
});
|
|
18
21
|
};
|
|
22
|
+
// eslint-disable-next-line functional/immutable-data
|
|
23
|
+
Label.Optional = function Optional({
|
|
24
|
+
children,
|
|
25
|
+
className
|
|
26
|
+
}) {
|
|
27
|
+
const {
|
|
28
|
+
formatMessage
|
|
29
|
+
} = reactIntl.useIntl();
|
|
30
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
31
|
+
children: [children, /*#__PURE__*/jsxRuntime.jsx(Body, {
|
|
32
|
+
as: "span",
|
|
33
|
+
className: clsx.clsx('text-secondary', 'm-l-1', className),
|
|
34
|
+
children: formatMessage(Label_messages.optionalLabel)
|
|
35
|
+
})]
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
// eslint-disable-next-line functional/immutable-data
|
|
39
|
+
Label.Description = function Description({
|
|
40
|
+
id,
|
|
41
|
+
children,
|
|
42
|
+
className
|
|
43
|
+
}) {
|
|
44
|
+
return children ? /*#__PURE__*/jsxRuntime.jsx(Body, {
|
|
45
|
+
id: id,
|
|
46
|
+
className: clsx.clsx('text-secondary', className),
|
|
47
|
+
children: children
|
|
48
|
+
}) : null;
|
|
49
|
+
};
|
|
19
50
|
|
|
20
51
|
exports.Label = Label;
|
|
21
52
|
//# sourceMappingURL=Label.js.map
|
package/build/label/Label.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Label.js","sources":["../../src/label/Label.tsx"],"sourcesContent":["import { clsx } from 'clsx';\n\nexport type LabelProps = {\n id?: string;\n htmlFor?: string;\n className?: string;\n children?: React.ReactNode;\n};\n\
|
|
1
|
+
{"version":3,"file":"Label.js","sources":["../../src/label/Label.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport messages from './Label.messages';\nimport { useIntl } from 'react-intl';\nimport Body from '../body';\nimport { CommonProps } from '../common';\nimport { PropsWithChildren } from 'react';\n\nexport type LabelProps = {\n id?: string;\n htmlFor?: string;\n className?: string;\n children?: React.ReactNode;\n};\n\n/**\n * Avoid using `<Label>` component directly\n * it's for edge cases when `<Field />` isn't suitable for some reasons.\n *\n * Example:\n * ```\n * <Field label={..} description={..} required={..}>..</Field>\n * ```\n */\nconst Label = ({ className, children, htmlFor, id }: LabelProps) => {\n return (\n <label\n id={id}\n htmlFor={htmlFor}\n className={clsx(\n 'np-label d-flex flex-column np-text-body-default-bold text-primary m-b-0',\n className,\n )}\n >\n {children}\n </label>\n );\n};\n\nexport type LabelOptionalProps = PropsWithChildren<CommonProps>;\n\n// eslint-disable-next-line functional/immutable-data\nLabel.Optional = function Optional({ children, className }: LabelOptionalProps) {\n const { formatMessage } = useIntl();\n return (\n <div>\n {children}\n <Body as=\"span\" className={clsx('text-secondary', 'm-l-1', className)}>\n {formatMessage(messages.optionalLabel)}\n </Body>\n </div>\n );\n};\n\nexport type LabelDescriptionProps = PropsWithChildren<CommonProps> & { id?: string };\n\n// eslint-disable-next-line functional/immutable-data\nLabel.Description = function Description({ id, children, className }: LabelDescriptionProps) {\n return children ? (\n <Body id={id} className={clsx('text-secondary', className)}>\n {children}\n </Body>\n ) : null;\n};\n\nexport { Label };\n"],"names":["Label","className","children","htmlFor","id","_jsx","clsx","Optional","formatMessage","useIntl","_jsxs","Body","as","messages","optionalLabel","Description"],"mappings":";;;;;;;;AAuBMA,MAAAA,KAAK,GAAGA,CAAC;EAAEC,SAAS;EAAEC,QAAQ;EAAEC,OAAO;AAAEC,EAAAA,EAAAA;AAAE,CAAc,KAAI;AACjE,EAAA,oBACEC,cAAA,CAAA,OAAA,EAAA;AACED,IAAAA,EAAE,EAAEA,EAAG;AACPD,IAAAA,OAAO,EAAEA,OAAQ;AACjBF,IAAAA,SAAS,EAAEK,SAAI,CACb,0EAA0E,EAC1EL,SAAS,CACT;AAAAC,IAAAA,QAAA,EAEDA,QAAAA;AAAQ,GACJ,CAAC,CAAA;AAEZ,EAAC;AAID;AACAF,KAAK,CAACO,QAAQ,GAAG,SAASA,QAAQA,CAAC;EAAEL,QAAQ;AAAED,EAAAA,SAAAA;AAA+B,CAAA,EAAA;EAC5E,MAAM;AAAEO,IAAAA,aAAAA;GAAe,GAAGC,iBAAO,EAAE,CAAA;AACnC,EAAA,oBACEC,eAAA,CAAA,KAAA,EAAA;AAAAR,IAAAA,QAAA,EACGA,CAAAA,QAAQ,eACTG,cAAA,CAACM,IAAI,EAAA;AAACC,MAAAA,EAAE,EAAC,MAAM;MAACX,SAAS,EAAEK,SAAI,CAAC,gBAAgB,EAAE,OAAO,EAAEL,SAAS,CAAE;AAAAC,MAAAA,QAAA,EACnEM,aAAa,CAACK,cAAQ,CAACC,aAAa,CAAA;AAAC,KAClC,CACR,CAAA;AAAA,GAAK,CAAC,CAAA;AAEV,CAAC,CAAA;AAID;AACAd,KAAK,CAACe,WAAW,GAAG,SAASA,WAAWA,CAAC;EAAEX,EAAE;EAAEF,QAAQ;AAAED,EAAAA,SAAAA;AAAkC,CAAA,EAAA;AACzF,EAAA,OAAOC,QAAQ,gBACbG,cAAA,CAACM,IAAI,EAAA;AAACP,IAAAA,EAAE,EAAEA,EAAG;AAACH,IAAAA,SAAS,EAAEK,SAAI,CAAC,gBAAgB,EAAEL,SAAS,CAAE;AAAAC,IAAAA,QAAA,EACxDA,QAAAA;GACG,CAAC,GACL,IAAI,CAAA;AACV,CAAC;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Label.messages.js","sources":["../../src/label/Label.messages.tsx"],"sourcesContent":["import { defineMessages } from 'react-intl';\n\nexport default defineMessages({\n optionalLabel: {\n id: 'neptune.Label.optional',\n defaultMessage: '(Optional)',\n },\n});\n"],"names":["defineMessages","optionalLabel","id"],"mappings":";;;;AAEA,eAAeA,wBAAc,CAAC;AAC5BC,EAAAA,aAAa,EAAE;IACbC,EAAE,EAAA,wBAAA;AAEH,GAAA;AACF,CAAA,CAAC;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Label.messages.mjs","sources":["../../src/label/Label.messages.tsx"],"sourcesContent":["import { defineMessages } from 'react-intl';\n\nexport default defineMessages({\n optionalLabel: {\n id: 'neptune.Label.optional',\n defaultMessage: '(Optional)',\n },\n});\n"],"names":["defineMessages","optionalLabel","id"],"mappings":";;AAEA,eAAeA,cAAc,CAAC;AAC5BC,EAAAA,aAAa,EAAE;IACbC,EAAE,EAAA,wBAAA;AAEH,GAAA;AACF,CAAA,CAAC;;;;"}
|
package/build/label/Label.mjs
CHANGED
|
@@ -1,19 +1,50 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
|
-
import
|
|
2
|
+
import messages from './Label.messages.mjs';
|
|
3
|
+
import { useIntl } from 'react-intl';
|
|
4
|
+
import Body from '../body/Body.mjs';
|
|
5
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
6
|
|
|
4
7
|
const Label = ({
|
|
5
|
-
id,
|
|
6
|
-
htmlFor,
|
|
7
8
|
className,
|
|
8
|
-
children
|
|
9
|
+
children,
|
|
10
|
+
htmlFor,
|
|
11
|
+
id
|
|
9
12
|
}) => {
|
|
10
13
|
return /*#__PURE__*/jsx("label", {
|
|
11
14
|
id: id,
|
|
12
15
|
htmlFor: htmlFor,
|
|
13
|
-
className: clsx('
|
|
16
|
+
className: clsx('np-label d-flex flex-column np-text-body-default-bold text-primary m-b-0', className),
|
|
14
17
|
children: children
|
|
15
18
|
});
|
|
16
19
|
};
|
|
20
|
+
// eslint-disable-next-line functional/immutable-data
|
|
21
|
+
Label.Optional = function Optional({
|
|
22
|
+
children,
|
|
23
|
+
className
|
|
24
|
+
}) {
|
|
25
|
+
const {
|
|
26
|
+
formatMessage
|
|
27
|
+
} = useIntl();
|
|
28
|
+
return /*#__PURE__*/jsxs("div", {
|
|
29
|
+
children: [children, /*#__PURE__*/jsx(Body, {
|
|
30
|
+
as: "span",
|
|
31
|
+
className: clsx('text-secondary', 'm-l-1', className),
|
|
32
|
+
children: formatMessage(messages.optionalLabel)
|
|
33
|
+
})]
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
// eslint-disable-next-line functional/immutable-data
|
|
37
|
+
Label.Description = function Description({
|
|
38
|
+
id,
|
|
39
|
+
children,
|
|
40
|
+
className
|
|
41
|
+
}) {
|
|
42
|
+
return children ? /*#__PURE__*/jsx(Body, {
|
|
43
|
+
id: id,
|
|
44
|
+
className: clsx('text-secondary', className),
|
|
45
|
+
children: children
|
|
46
|
+
}) : null;
|
|
47
|
+
};
|
|
17
48
|
|
|
18
49
|
export { Label };
|
|
19
50
|
//# sourceMappingURL=Label.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Label.mjs","sources":["../../src/label/Label.tsx"],"sourcesContent":["import { clsx } from 'clsx';\n\nexport type LabelProps = {\n id?: string;\n htmlFor?: string;\n className?: string;\n children?: React.ReactNode;\n};\n\
|
|
1
|
+
{"version":3,"file":"Label.mjs","sources":["../../src/label/Label.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport messages from './Label.messages';\nimport { useIntl } from 'react-intl';\nimport Body from '../body';\nimport { CommonProps } from '../common';\nimport { PropsWithChildren } from 'react';\n\nexport type LabelProps = {\n id?: string;\n htmlFor?: string;\n className?: string;\n children?: React.ReactNode;\n};\n\n/**\n * Avoid using `<Label>` component directly\n * it's for edge cases when `<Field />` isn't suitable for some reasons.\n *\n * Example:\n * ```\n * <Field label={..} description={..} required={..}>..</Field>\n * ```\n */\nconst Label = ({ className, children, htmlFor, id }: LabelProps) => {\n return (\n <label\n id={id}\n htmlFor={htmlFor}\n className={clsx(\n 'np-label d-flex flex-column np-text-body-default-bold text-primary m-b-0',\n className,\n )}\n >\n {children}\n </label>\n );\n};\n\nexport type LabelOptionalProps = PropsWithChildren<CommonProps>;\n\n// eslint-disable-next-line functional/immutable-data\nLabel.Optional = function Optional({ children, className }: LabelOptionalProps) {\n const { formatMessage } = useIntl();\n return (\n <div>\n {children}\n <Body as=\"span\" className={clsx('text-secondary', 'm-l-1', className)}>\n {formatMessage(messages.optionalLabel)}\n </Body>\n </div>\n );\n};\n\nexport type LabelDescriptionProps = PropsWithChildren<CommonProps> & { id?: string };\n\n// eslint-disable-next-line functional/immutable-data\nLabel.Description = function Description({ id, children, className }: LabelDescriptionProps) {\n return children ? (\n <Body id={id} className={clsx('text-secondary', className)}>\n {children}\n </Body>\n ) : null;\n};\n\nexport { Label };\n"],"names":["Label","className","children","htmlFor","id","_jsx","clsx","Optional","formatMessage","useIntl","_jsxs","Body","as","messages","optionalLabel","Description"],"mappings":";;;;;;AAuBMA,MAAAA,KAAK,GAAGA,CAAC;EAAEC,SAAS;EAAEC,QAAQ;EAAEC,OAAO;AAAEC,EAAAA,EAAAA;AAAE,CAAc,KAAI;AACjE,EAAA,oBACEC,GAAA,CAAA,OAAA,EAAA;AACED,IAAAA,EAAE,EAAEA,EAAG;AACPD,IAAAA,OAAO,EAAEA,OAAQ;AACjBF,IAAAA,SAAS,EAAEK,IAAI,CACb,0EAA0E,EAC1EL,SAAS,CACT;AAAAC,IAAAA,QAAA,EAEDA,QAAAA;AAAQ,GACJ,CAAC,CAAA;AAEZ,EAAC;AAID;AACAF,KAAK,CAACO,QAAQ,GAAG,SAASA,QAAQA,CAAC;EAAEL,QAAQ;AAAED,EAAAA,SAAAA;AAA+B,CAAA,EAAA;EAC5E,MAAM;AAAEO,IAAAA,aAAAA;GAAe,GAAGC,OAAO,EAAE,CAAA;AACnC,EAAA,oBACEC,IAAA,CAAA,KAAA,EAAA;AAAAR,IAAAA,QAAA,EACGA,CAAAA,QAAQ,eACTG,GAAA,CAACM,IAAI,EAAA;AAACC,MAAAA,EAAE,EAAC,MAAM;MAACX,SAAS,EAAEK,IAAI,CAAC,gBAAgB,EAAE,OAAO,EAAEL,SAAS,CAAE;AAAAC,MAAAA,QAAA,EACnEM,aAAa,CAACK,QAAQ,CAACC,aAAa,CAAA;AAAC,KAClC,CACR,CAAA;AAAA,GAAK,CAAC,CAAA;AAEV,CAAC,CAAA;AAID;AACAd,KAAK,CAACe,WAAW,GAAG,SAASA,WAAWA,CAAC;EAAEX,EAAE;EAAEF,QAAQ;AAAED,EAAAA,SAAAA;AAAkC,CAAA,EAAA;AACzF,EAAA,OAAOC,QAAQ,gBACbG,GAAA,CAACM,IAAI,EAAA;AAACP,IAAAA,EAAE,EAAEA,EAAG;AAACH,IAAAA,SAAS,EAAEK,IAAI,CAAC,gBAAgB,EAAEL,SAAS,CAAE;AAAAC,IAAAA,QAAA,EACxDA,QAAAA;GACG,CAAC,GACL,IAAI,CAAA;AACV,CAAC;;;;"}
|
package/build/main.css
CHANGED
|
@@ -1719,18 +1719,10 @@ button.np-option {
|
|
|
1719
1719
|
white-space: nowrap;
|
|
1720
1720
|
width: 100%;
|
|
1721
1721
|
}
|
|
1722
|
-
.np-date-trigger .control-label {
|
|
1723
|
-
font-weight: 400;
|
|
1724
|
-
font-weight: var(--font-weight-regular);
|
|
1725
|
-
}
|
|
1726
1722
|
.np-theme-personal .np-date-trigger {
|
|
1727
1723
|
padding-left: 16px;
|
|
1728
1724
|
padding-left: var(--size-16);
|
|
1729
1725
|
}
|
|
1730
|
-
.np-theme-personal .np-date-trigger .control-label + span {
|
|
1731
|
-
font-weight: 400;
|
|
1732
|
-
font-weight: var(--font-weight-regular);
|
|
1733
|
-
}
|
|
1734
1726
|
.clear-btn {
|
|
1735
1727
|
transition: color 0.15s ease-in-out;
|
|
1736
1728
|
color: #c9cbce;
|
|
@@ -2385,6 +2377,10 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2385
2377
|
border-radius: 9999px !important;
|
|
2386
2378
|
border-radius: var(--radius-full) !important;
|
|
2387
2379
|
}
|
|
2380
|
+
.np-field-control {
|
|
2381
|
+
margin-top: 4px;
|
|
2382
|
+
margin-top: var(--size-4);
|
|
2383
|
+
}
|
|
2388
2384
|
.np-input-group {
|
|
2389
2385
|
display: inline-grid;
|
|
2390
2386
|
width: 100%;
|
|
@@ -4,18 +4,10 @@
|
|
|
4
4
|
white-space: nowrap;
|
|
5
5
|
width: 100%;
|
|
6
6
|
}
|
|
7
|
-
.np-date-trigger .control-label {
|
|
8
|
-
font-weight: 400;
|
|
9
|
-
font-weight: var(--font-weight-regular);
|
|
10
|
-
}
|
|
11
7
|
.np-theme-personal .np-date-trigger {
|
|
12
8
|
padding-left: 16px;
|
|
13
9
|
padding-left: var(--size-16);
|
|
14
10
|
}
|
|
15
|
-
.np-theme-personal .np-date-trigger .control-label + span {
|
|
16
|
-
font-weight: 400;
|
|
17
|
-
font-weight: var(--font-weight-regular);
|
|
18
|
-
}
|
|
19
11
|
.clear-btn {
|
|
20
12
|
transition: color 0.15s ease-in-out;
|
|
21
13
|
color: #c9cbce;
|
package/build/styles/main.css
CHANGED
|
@@ -1719,18 +1719,10 @@ button.np-option {
|
|
|
1719
1719
|
white-space: nowrap;
|
|
1720
1720
|
width: 100%;
|
|
1721
1721
|
}
|
|
1722
|
-
.np-date-trigger .control-label {
|
|
1723
|
-
font-weight: 400;
|
|
1724
|
-
font-weight: var(--font-weight-regular);
|
|
1725
|
-
}
|
|
1726
1722
|
.np-theme-personal .np-date-trigger {
|
|
1727
1723
|
padding-left: 16px;
|
|
1728
1724
|
padding-left: var(--size-16);
|
|
1729
1725
|
}
|
|
1730
|
-
.np-theme-personal .np-date-trigger .control-label + span {
|
|
1731
|
-
font-weight: 400;
|
|
1732
|
-
font-weight: var(--font-weight-regular);
|
|
1733
|
-
}
|
|
1734
1726
|
.clear-btn {
|
|
1735
1727
|
transition: color 0.15s ease-in-out;
|
|
1736
1728
|
color: #c9cbce;
|
|
@@ -2385,6 +2377,10 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2385
2377
|
border-radius: 9999px !important;
|
|
2386
2378
|
border-radius: var(--radius-full) !important;
|
|
2387
2379
|
}
|
|
2380
|
+
.np-field-control {
|
|
2381
|
+
margin-top: 4px;
|
|
2382
|
+
margin-top: var(--size-4);
|
|
2383
|
+
}
|
|
2388
2384
|
.np-input-group {
|
|
2389
2385
|
display: inline-grid;
|
|
2390
2386
|
width: 100%;
|
package/build/tabs/Tab.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var clsx = require('clsx');
|
|
4
|
-
var PropTypes = require('prop-types');
|
|
5
4
|
var React = require('react');
|
|
5
|
+
var useEffectEvent = require('../common/hooks/useEffectEvent.js');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
|
|
11
|
-
|
|
12
|
-
const Tab = /*#__PURE__*/React.forwardRef(({
|
|
8
|
+
const noop = () => {};
|
|
9
|
+
const Tab = /*#__PURE__*/React.forwardRef(function Tab({
|
|
13
10
|
children,
|
|
14
11
|
id,
|
|
15
12
|
disabled,
|
|
@@ -18,21 +15,19 @@ const Tab = /*#__PURE__*/React.forwardRef(({
|
|
|
18
15
|
onKeyDown,
|
|
19
16
|
onClick,
|
|
20
17
|
style,
|
|
21
|
-
focusTab
|
|
22
|
-
}, reference)
|
|
18
|
+
focusTab = noop
|
|
19
|
+
}, reference) {
|
|
20
|
+
const handleFocusTab = useEffectEvent.useEffectEvent(focusTab);
|
|
23
21
|
const firstUpdate = React.useRef(true);
|
|
24
|
-
|
|
22
|
+
React.useEffect(function checkFocus() {
|
|
25
23
|
if (firstUpdate.current) {
|
|
26
24
|
firstUpdate.current = false;
|
|
27
25
|
return;
|
|
28
26
|
}
|
|
29
|
-
if (selected
|
|
30
|
-
|
|
27
|
+
if (selected) {
|
|
28
|
+
handleFocusTab();
|
|
31
29
|
}
|
|
32
|
-
};
|
|
33
|
-
React.useEffect(() => {
|
|
34
|
-
checkFocus();
|
|
35
|
-
}, [selected]);
|
|
30
|
+
}, [handleFocusTab, selected]);
|
|
36
31
|
return /*#__PURE__*/jsxRuntime.jsx("li", {
|
|
37
32
|
ref: reference,
|
|
38
33
|
className: clsx.clsx('tabs__tab', selected ? 'np-text-body-large-bold' : 'np-text-body-large', {
|
|
@@ -44,10 +39,10 @@ const Tab = /*#__PURE__*/React.forwardRef(({
|
|
|
44
39
|
id: id,
|
|
45
40
|
"aria-selected": selected ? 'true' : 'false',
|
|
46
41
|
"aria-disabled": disabled ? 'true' : 'false',
|
|
47
|
-
"aria-controls": disabled ?
|
|
48
|
-
tabIndex:
|
|
42
|
+
"aria-controls": disabled ? undefined : panelId,
|
|
43
|
+
tabIndex: 0,
|
|
49
44
|
style: style,
|
|
50
|
-
onKeyDown: disabled ?
|
|
45
|
+
onKeyDown: disabled ? undefined : onKeyDown,
|
|
51
46
|
onClick: onClick,
|
|
52
47
|
children: /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
53
48
|
className: "tabs__tab__content",
|
|
@@ -55,26 +50,6 @@ const Tab = /*#__PURE__*/React.forwardRef(({
|
|
|
55
50
|
})
|
|
56
51
|
});
|
|
57
52
|
});
|
|
58
|
-
Tab.defaultProps = {
|
|
59
|
-
disabled: false,
|
|
60
|
-
selected: false,
|
|
61
|
-
onClick: null,
|
|
62
|
-
style: null,
|
|
63
|
-
focusTab: null
|
|
64
|
-
};
|
|
65
|
-
Tab.propTypes = {
|
|
66
|
-
children: PropTypes__default.default.node.isRequired,
|
|
67
|
-
disabled: PropTypes__default.default.bool,
|
|
68
|
-
selected: PropTypes__default.default.bool,
|
|
69
|
-
id: PropTypes__default.default.string.isRequired,
|
|
70
|
-
panelId: PropTypes__default.default.string.isRequired,
|
|
71
|
-
style: PropTypes__default.default.shape({
|
|
72
|
-
width: PropTypes__default.default.string
|
|
73
|
-
}),
|
|
74
|
-
focusTab: PropTypes__default.default.func,
|
|
75
|
-
onKeyDown: PropTypes__default.default.func.isRequired,
|
|
76
|
-
onClick: PropTypes__default.default.func
|
|
77
|
-
};
|
|
78
53
|
|
|
79
54
|
module.exports = Tab;
|
|
80
55
|
//# sourceMappingURL=Tab.js.map
|
package/build/tabs/Tab.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tab.js","sources":["../../src/tabs/Tab.
|
|
1
|
+
{"version":3,"file":"Tab.js","sources":["../../src/tabs/Tab.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { forwardRef, useEffect, useRef } from 'react';\nimport { useEffectEvent } from '../common/hooks/useEffectEvent';\n\nexport interface TabProps {\n children?: React.ReactNode;\n disabled?: boolean;\n selected?: boolean;\n id: string;\n panelId: string;\n style?: React.CSSProperties;\n focusTab?: () => void;\n onKeyDown: React.KeyboardEventHandler<HTMLLIElement>;\n onClick?: React.MouseEventHandler<HTMLLIElement>;\n}\n\nconst noop = () => {};\n\nconst Tab = forwardRef(function Tab(\n {\n children,\n id,\n disabled,\n panelId,\n selected,\n onKeyDown,\n onClick,\n style,\n focusTab = noop,\n }: TabProps,\n reference: React.ForwardedRef<HTMLLIElement>,\n) {\n const handleFocusTab = useEffectEvent(focusTab);\n const firstUpdate = useRef(true);\n useEffect(\n function checkFocus() {\n if (firstUpdate.current) {\n firstUpdate.current = false;\n return;\n }\n\n if (selected) {\n handleFocusTab();\n }\n },\n [handleFocusTab, selected],\n );\n\n return (\n <li\n ref={reference}\n className={clsx('tabs__tab', selected ? 'np-text-body-large-bold' : 'np-text-body-large', {\n 'tabs__tab--selected': selected,\n clickable: !disabled,\n disabled,\n })}\n role=\"tab\"\n id={id}\n aria-selected={selected ? 'true' : 'false'}\n aria-disabled={disabled ? 'true' : 'false'}\n aria-controls={disabled ? undefined : panelId}\n tabIndex={0}\n style={style}\n onKeyDown={disabled ? undefined : onKeyDown}\n onClick={onClick}\n >\n <span className=\"tabs__tab__content\">{children}</span>\n </li>\n );\n});\n\nexport default Tab;\n"],"names":["noop","Tab","forwardRef","children","id","disabled","panelId","selected","onKeyDown","onClick","style","focusTab","reference","handleFocusTab","useEffectEvent","firstUpdate","useRef","useEffect","checkFocus","current","_jsx","ref","className","clsx","clickable","role","undefined","tabIndex"],"mappings":";;;;;;;AAgBA,MAAMA,IAAI,GAAGA,MAAK,EAAG,CAAA;AAErB,MAAMC,GAAG,gBAAGC,gBAAU,CAAC,SAASD,GAAGA,CACjC;EACEE,QAAQ;EACRC,EAAE;EACFC,QAAQ;EACRC,OAAO;EACPC,QAAQ;EACRC,SAAS;EACTC,OAAO;EACPC,KAAK;AACLC,EAAAA,QAAQ,GAAGX,IAAAA;AAAI,CACN,EACXY,SAA4C,EAAA;AAE5C,EAAA,MAAMC,cAAc,GAAGC,6BAAc,CAACH,QAAQ,CAAC,CAAA;AAC/C,EAAA,MAAMI,WAAW,GAAGC,YAAM,CAAC,IAAI,CAAC,CAAA;AAChCC,EAAAA,eAAS,CACP,SAASC,UAAUA,GAAA;IACjB,IAAIH,WAAW,CAACI,OAAO,EAAE;MACvBJ,WAAW,CAACI,OAAO,GAAG,KAAK,CAAA;AAC3B,MAAA,OAAA;AACF,KAAA;AAEA,IAAA,IAAIZ,QAAQ,EAAE;AACZM,MAAAA,cAAc,EAAE,CAAA;AAClB,KAAA;AACF,GAAC,EACD,CAACA,cAAc,EAAEN,QAAQ,CAAC,CAC3B,CAAA;AAED,EAAA,oBACEa,cAAA,CAAA,IAAA,EAAA;AACEC,IAAAA,GAAG,EAAET,SAAU;IACfU,SAAS,EAAEC,SAAI,CAAC,WAAW,EAAEhB,QAAQ,GAAG,yBAAyB,GAAG,oBAAoB,EAAE;AACxF,MAAA,qBAAqB,EAAEA,QAAQ;MAC/BiB,SAAS,EAAE,CAACnB,QAAQ;AACpBA,MAAAA,QAAAA;AACD,KAAA,CAAE;AACHoB,IAAAA,IAAI,EAAC,KAAK;AACVrB,IAAAA,EAAE,EAAEA,EAAG;AACP,IAAA,eAAA,EAAeG,QAAQ,GAAG,MAAM,GAAG,OAAQ;AAC3C,IAAA,eAAA,EAAeF,QAAQ,GAAG,MAAM,GAAG,OAAQ;AAC3C,IAAA,eAAA,EAAeA,QAAQ,GAAGqB,SAAS,GAAGpB,OAAQ;AAC9CqB,IAAAA,QAAQ,EAAE,CAAE;AACZjB,IAAAA,KAAK,EAAEA,KAAM;AACbF,IAAAA,SAAS,EAAEH,QAAQ,GAAGqB,SAAS,GAAGlB,SAAU;AAC5CC,IAAAA,OAAO,EAAEA,OAAQ;AAAAN,IAAAA,QAAA,eAEjBiB,cAAA,CAAA,MAAA,EAAA;AAAME,MAAAA,SAAS,EAAC,oBAAoB;AAAAnB,MAAAA,QAAA,EAAEA,QAAAA;KAAe,CAAA;AACvD,GAAI,CAAC,CAAA;AAET,CAAC;;;;"}
|