@transferwise/components 46.111.0 → 46.112.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/avatarLayout/AvatarLayout.js.map +1 -1
- package/build/avatarLayout/AvatarLayout.mjs.map +1 -1
- package/build/avatarView/AvatarView.js +27 -29
- package/build/avatarView/AvatarView.js.map +1 -1
- package/build/avatarView/AvatarView.mjs +27 -29
- package/build/avatarView/AvatarView.mjs.map +1 -1
- package/build/avatarView/{NotificationDot.js → Dot.js} +14 -12
- package/build/avatarView/Dot.js.map +1 -0
- package/build/avatarView/{NotificationDot.mjs → Dot.mjs} +14 -12
- package/build/avatarView/Dot.mjs.map +1 -0
- package/build/badge/BadgeAssets.js.map +1 -1
- package/build/badge/BadgeAssets.mjs.map +1 -1
- package/build/common/panel/Panel.js +1 -0
- package/build/common/panel/Panel.js.map +1 -1
- package/build/common/panel/Panel.mjs +1 -0
- package/build/common/panel/Panel.mjs.map +1 -1
- package/build/common/responsivePanel/ResponsivePanel.js +6 -1
- package/build/common/responsivePanel/ResponsivePanel.js.map +1 -1
- package/build/common/responsivePanel/ResponsivePanel.mjs +6 -1
- package/build/common/responsivePanel/ResponsivePanel.mjs.map +1 -1
- package/build/dateInput/DateInput.js +46 -24
- package/build/dateInput/DateInput.js.map +1 -1
- package/build/dateInput/DateInput.mjs +48 -26
- package/build/dateInput/DateInput.mjs.map +1 -1
- package/build/dateLookup/DateLookup.js +5 -2
- package/build/dateLookup/DateLookup.js.map +1 -1
- package/build/dateLookup/DateLookup.mjs +5 -2
- package/build/dateLookup/DateLookup.mjs.map +1 -1
- package/build/dateLookup/dateTrigger/DateTrigger.js +2 -0
- package/build/dateLookup/dateTrigger/DateTrigger.js.map +1 -1
- package/build/dateLookup/dateTrigger/DateTrigger.mjs +2 -0
- package/build/dateLookup/dateTrigger/DateTrigger.mjs.map +1 -1
- package/build/field/Field.js +7 -2
- package/build/field/Field.js.map +1 -1
- package/build/field/Field.mjs +13 -8
- package/build/field/Field.mjs.map +1 -1
- package/build/inputs/InputGroup.js +1 -1
- package/build/inputs/InputGroup.js.map +1 -1
- package/build/inputs/InputGroup.mjs +2 -2
- package/build/inputs/InputGroup.mjs.map +1 -1
- package/build/inputs/SelectInput.js +54 -5
- package/build/inputs/SelectInput.js.map +1 -1
- package/build/inputs/SelectInput.mjs +54 -5
- package/build/inputs/SelectInput.mjs.map +1 -1
- package/build/inputs/contexts.js +8 -4
- package/build/inputs/contexts.js.map +1 -1
- package/build/inputs/contexts.mjs +7 -4
- package/build/inputs/contexts.mjs.map +1 -1
- package/build/label/Label.js +14 -8
- package/build/label/Label.js.map +1 -1
- package/build/label/Label.mjs +14 -8
- package/build/label/Label.mjs.map +1 -1
- package/build/listItem/Prompt/ListItemPrompt.js +1 -1
- package/build/listItem/Prompt/ListItemPrompt.js.map +1 -1
- package/build/listItem/Prompt/ListItemPrompt.mjs +1 -1
- package/build/listItem/Prompt/ListItemPrompt.mjs.map +1 -1
- package/build/main.css +180 -164
- package/build/moneyInput/MoneyInput.js +6 -5
- package/build/moneyInput/MoneyInput.js.map +1 -1
- package/build/moneyInput/MoneyInput.mjs +6 -5
- package/build/moneyInput/MoneyInput.mjs.map +1 -1
- package/build/phoneNumberInput/PhoneNumberInput.js +25 -3
- package/build/phoneNumberInput/PhoneNumberInput.js.map +1 -1
- package/build/phoneNumberInput/PhoneNumberInput.mjs +27 -5
- package/build/phoneNumberInput/PhoneNumberInput.mjs.map +1 -1
- package/build/{listItem/Prompt → prompt}/InlinePrompt/InlinePrompt.js +23 -23
- package/build/prompt/InlinePrompt/InlinePrompt.js.map +1 -0
- package/build/{listItem/Prompt → prompt}/InlinePrompt/InlinePrompt.mjs +23 -23
- package/build/prompt/InlinePrompt/InlinePrompt.mjs.map +1 -0
- package/build/styles/avatarView/AvatarView.css +17 -11
- package/build/styles/avatarView/Dot.css +26 -0
- package/build/styles/inputs/Input.css +5 -0
- package/build/styles/inputs/TextArea.css +5 -0
- package/build/styles/listItem/ListItem.css +5 -153
- package/build/styles/listItem/Prompt/ListItemPrompt.css +0 -153
- package/build/styles/main.css +180 -164
- package/build/types/avatarLayout/AvatarLayout.d.ts +1 -1
- package/build/types/avatarLayout/AvatarLayout.d.ts.map +1 -1
- package/build/types/avatarView/AvatarView.d.ts +1 -2
- package/build/types/avatarView/AvatarView.d.ts.map +1 -1
- package/build/types/avatarView/Dot.d.ts +8 -0
- package/build/types/avatarView/Dot.d.ts.map +1 -0
- package/build/types/badge/BadgeAssets.d.ts +1 -1
- package/build/types/badge/BadgeAssets.d.ts.map +1 -1
- package/build/types/common/panel/Panel.d.ts +2 -0
- package/build/types/common/panel/Panel.d.ts.map +1 -1
- package/build/types/common/responsivePanel/ResponsivePanel.d.ts +1 -0
- package/build/types/common/responsivePanel/ResponsivePanel.d.ts.map +1 -1
- package/build/types/dateInput/DateInput.d.ts +2 -2
- package/build/types/dateInput/DateInput.d.ts.map +1 -1
- package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
- package/build/types/dateLookup/dateTrigger/DateTrigger.d.ts +1 -0
- package/build/types/dateLookup/dateTrigger/DateTrigger.d.ts.map +1 -1
- package/build/types/field/Field.d.ts.map +1 -1
- package/build/types/inputs/InputGroup.d.ts.map +1 -1
- package/build/types/inputs/SelectInput.d.ts +27 -1
- package/build/types/inputs/SelectInput.d.ts.map +1 -1
- package/build/types/inputs/contexts.d.ts +6 -1
- package/build/types/inputs/contexts.d.ts.map +1 -1
- package/build/types/label/Label.d.ts +5 -15
- package/build/types/label/Label.d.ts.map +1 -1
- package/build/types/listItem/Prompt/ListItemPrompt.d.ts +1 -1
- package/build/types/listItem/Prompt/ListItemPrompt.d.ts.map +1 -1
- package/build/types/moneyInput/MoneyInput.d.ts.map +1 -1
- package/build/types/phoneNumberInput/PhoneNumberInput.d.ts.map +1 -1
- package/build/types/{listItem/Prompt → prompt}/InlinePrompt/InlinePrompt.d.ts +1 -1
- package/build/types/prompt/InlinePrompt/InlinePrompt.d.ts.map +1 -0
- package/build/types/prompt/InlinePrompt/index.d.ts.map +1 -0
- package/build/types/prompt/index.d.ts +3 -0
- package/build/types/prompt/index.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/DisabledComponents.story.tsx +156 -0
- package/src/avatarLayout/AvatarLayout.tsx +1 -1
- package/src/avatarView/AvatarView.css +17 -11
- package/src/avatarView/AvatarView.less +1 -1
- package/src/avatarView/AvatarView.story.tsx +92 -36
- package/src/avatarView/AvatarView.tsx +35 -30
- package/src/avatarView/Dot.css +26 -0
- package/src/avatarView/Dot.less +31 -0
- package/src/avatarView/Dot.tsx +42 -0
- package/src/badge/BadgeAssets.tsx +1 -1
- package/src/common/panel/Panel.tsx +2 -0
- package/src/common/responsivePanel/ResponsivePanel.tsx +7 -1
- package/src/dateInput/DateInput.spec.tsx +45 -7
- package/src/dateInput/DateInput.story.tsx +2 -0
- package/src/dateInput/DateInput.tsx +65 -30
- package/src/dateLookup/DateLookup.spec.tsx +16 -0
- package/src/dateLookup/DateLookup.tsx +6 -3
- package/src/dateLookup/dateTrigger/DateTrigger.tsx +3 -0
- package/src/field/Field.tsx +6 -5
- package/src/inputs/Input.css +5 -0
- package/src/inputs/InputGroup.tsx +3 -4
- package/src/inputs/SelectInput.story.tsx +101 -0
- package/src/inputs/SelectInput.tsx +113 -5
- package/src/inputs/TextArea.css +5 -0
- package/src/inputs/_common.less +5 -0
- package/src/inputs/contexts.tsx +12 -3
- package/src/label/Label.tsx +26 -20
- package/src/listItem/AvatarView/ListItemAvatarView.story.tsx +89 -25
- package/src/listItem/ListItem.css +5 -153
- package/src/listItem/ListItem.less +5 -0
- package/src/listItem/Prompt/ListItemPrompt.css +0 -153
- package/src/listItem/Prompt/ListItemPrompt.less +0 -2
- package/src/listItem/Prompt/ListItemPrompt.tsx +1 -1
- package/src/main.css +180 -164
- package/src/main.less +1 -0
- package/src/moneyInput/MoneyInput.spec.tsx +16 -1
- package/src/moneyInput/MoneyInput.tsx +7 -6
- package/src/phoneNumberInput/PhoneNumberInput.spec.tsx +32 -0
- package/src/phoneNumberInput/PhoneNumberInput.tsx +32 -11
- package/src/{listItem/Prompt → prompt}/InlinePrompt/InlinePrompt.spec.tsx +2 -2
- package/src/{listItem/Prompt → prompt}/InlinePrompt/InlinePrompt.tsx +4 -4
- package/src/prompt/index.ts +6 -0
- package/build/avatarView/NotificationDot.js.map +0 -1
- package/build/avatarView/NotificationDot.mjs.map +0 -1
- package/build/listItem/Prompt/InlinePrompt/InlinePrompt.js.map +0 -1
- package/build/listItem/Prompt/InlinePrompt/InlinePrompt.mjs.map +0 -1
- package/build/styles/avatarView/NotificationDot.css +0 -20
- package/build/types/avatarView/NotificationDot.d.ts +0 -8
- package/build/types/avatarView/NotificationDot.d.ts.map +0 -1
- package/build/types/listItem/Prompt/InlinePrompt/InlinePrompt.d.ts.map +0 -1
- package/build/types/listItem/Prompt/InlinePrompt/index.d.ts.map +0 -1
- package/src/avatarView/NotificationDot.css +0 -20
- package/src/avatarView/NotificationDot.less +0 -24
- package/src/avatarView/NotificationDot.tsx +0 -35
- /package/build/styles/{listItem/Prompt → prompt}/InlinePrompt/InlinePrompt.css +0 -0
- /package/build/types/{listItem/Prompt → prompt}/InlinePrompt/index.d.ts +0 -0
- /package/src/{listItem/Prompt → prompt}/InlinePrompt/InlinePrompt.css +0 -0
- /package/src/{listItem/Prompt → prompt}/InlinePrompt/InlinePrompt.less +0 -0
- /package/src/{listItem/Prompt → prompt}/InlinePrompt/index.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contexts.d.ts","sourceRoot":"","sources":["../../../src/inputs/contexts.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contexts.d.ts","sourceRoot":"","sources":["../../../src/inputs/contexts.tsx"],"names":[],"mappings":"AAEA,KAAK,qBAAqB,GAAG;IAC3B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;CACzC,CAAC;AAGF,eAAO,MAAM,yBAAyB,6DAA6B,CAAC;AAGpE,eAAO,MAAM,sBAAsB,8CAA0B,CAAC;AAG9D,eAAO,MAAM,wBAAwB,8CAAmC,CAAC;AAGzE,eAAO,MAAM,oBAAoB,+CAA+B,CAAC;AAEjE,UAAU,sBAAsB;IAC9B,gLAAgL;IAChL,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,wBAAgB,kBAAkB,CAAC,EAAE,YAAY,EAAE,GAAE,sBAA2B;;;;;EAQ/E;AAED,wBAAgB,gBAAgB,4DAE/B;AAED,MAAM,WAAW,wBAAwB;IACvC,eAAe,EAAE,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC;CACxD;AAED,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,OAAO,CAAC,wBAAwB,CAAC,EAC7E,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,EACjC,IAAI,CAAC,EAAE,sBAAsB;YAEgB,IAAI,CAAC,CAAC,EAAE,MAAM,wBAAwB,CAAC;;EAOrF"}
|
|
@@ -6,23 +6,13 @@ export type LabelProps = {
|
|
|
6
6
|
className?: string;
|
|
7
7
|
children?: React.ReactNode;
|
|
8
8
|
};
|
|
9
|
-
/**
|
|
10
|
-
* Avoid using `<Label>` component directly
|
|
11
|
-
* it's for edge cases when `<Field />` isn't suitable for some reasons.
|
|
12
|
-
*
|
|
13
|
-
* Example:
|
|
14
|
-
* ```
|
|
15
|
-
* <Field label={..} description={..} required={..}>..</Field>
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
declare const Label: {
|
|
19
|
-
({ className, children, htmlFor, id }: LabelProps): import("react").JSX.Element;
|
|
20
|
-
Optional({ children, className }: LabelOptionalProps): import("react").JSX.Element;
|
|
21
|
-
Description({ id, children, className }: LabelDescriptionProps): import("react").JSX.Element | null;
|
|
22
|
-
};
|
|
23
9
|
export type LabelOptionalProps = PropsWithChildren<CommonProps>;
|
|
24
10
|
export type LabelDescriptionProps = PropsWithChildren<CommonProps> & {
|
|
25
11
|
id?: string;
|
|
26
12
|
};
|
|
27
|
-
|
|
13
|
+
declare const LabelNamespace: import("react").ForwardRefExoticComponent<LabelProps & import("react").RefAttributes<HTMLLabelElement>> & {
|
|
14
|
+
Optional: ({ children, className }: LabelOptionalProps) => import("react").JSX.Element;
|
|
15
|
+
Description: ({ id, children, className }: LabelDescriptionProps) => import("react").JSX.Element | null;
|
|
16
|
+
};
|
|
17
|
+
export { LabelNamespace as Label };
|
|
28
18
|
//# sourceMappingURL=Label.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../../../src/label/Label.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,
|
|
1
|
+
{"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../../../src/label/Label.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAc,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEtD,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AA+BF,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAC;AAchE,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,CAAC,WAAW,CAAC,GAAG;IAAE,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAWrF,QAAA,MAAM,cAAc;wCAvBwC,kBAAkB;+CAcR,qBAAqB;CASrB,CAAC;AAEvE,OAAO,EAAE,cAAc,IAAI,KAAK,EAAE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type InlinePromptProps } from '
|
|
1
|
+
import { type InlinePromptProps } from '../../prompt';
|
|
2
2
|
export type ListItemPromptProps = Pick<InlinePromptProps, 'children' | 'sentiment' | 'muted'>;
|
|
3
3
|
/**
|
|
4
4
|
* This component allows for rendering an Inline Prompt. <br />
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItemPrompt.d.ts","sourceRoot":"","sources":["../../../../src/listItem/Prompt/ListItemPrompt.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAgB,KAAK,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"ListItemPrompt.d.ts","sourceRoot":"","sources":["../../../../src/listItem/Prompt/ListItemPrompt.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAgB,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEpE,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,iBAAiB,EAAE,UAAU,GAAG,WAAW,GAAG,OAAO,CAAC,CAAC;AAE9F;;;;;GAKG;AACH,eAAO,MAAM,MAAM;8BAAiD,mBAAmB;;CActF,CAAC;AAGF,eAAe,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MoneyInput.d.ts","sourceRoot":"","sources":["../../../src/moneyInput/MoneyInput.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAc,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAE/D,OAAO,EAAoB,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC/E,OAAO,EAAuB,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAEnF,OAAO,EAKL,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;AAO/B,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC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BAAgB,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;IACvD,8DAA8D;IAC9D,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC;AAKD,QAAA,MAAM,gBAAgB,GAAI,gMAevB,qBAAqB,gCAiNvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InlinePrompt.d.ts","sourceRoot":"","sources":["../../../../src/prompt/InlinePrompt/InlinePrompt.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAOzC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,CAAC,EAAE,GAAG,SAAS,CAAC,QAAQ,GAAG,SAAS,CAAC,QAAQ,GAAG,SAAS,CAAC,OAAO,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC;IACjG,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,6DAO1B,iBAAiB,gCA4BnB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/prompt/InlinePrompt/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/prompt/index.ts"],"names":[],"mappings":"AAIA,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { Cross } from '@transferwise/icons';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
|
|
5
|
+
import Button from './button';
|
|
6
|
+
import { Input } from './inputs/Input';
|
|
7
|
+
import { SelectInput, SelectInputOptionContent } from './inputs/SelectInput';
|
|
8
|
+
import DateInput from './dateInput';
|
|
9
|
+
import PhoneNumberInput from './phoneNumberInput';
|
|
10
|
+
import { Field } from './field/Field';
|
|
11
|
+
import Checkbox from './checkbox';
|
|
12
|
+
import Body from './body';
|
|
13
|
+
import Header from './header';
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
title: 'Forms/Disabled Forms',
|
|
17
|
+
parameters: {
|
|
18
|
+
layout: 'centered',
|
|
19
|
+
},
|
|
20
|
+
} satisfies Meta;
|
|
21
|
+
|
|
22
|
+
type Story = StoryObj;
|
|
23
|
+
|
|
24
|
+
export const Disabled: Story = {
|
|
25
|
+
render: () => <DisabledFormShowcaseComponent />,
|
|
26
|
+
tags: ['!autodocs'],
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
function DisabledFormShowcaseComponent() {
|
|
30
|
+
const [selectValue, setSelectValue] = useState<string | undefined>('United Kingdom');
|
|
31
|
+
const [dateValue, setDateValue] = useState<string | null>('11/09/1990');
|
|
32
|
+
const [checkboxValue, setCheckboxValue] = useState(false);
|
|
33
|
+
|
|
34
|
+
const countryOptions = [{ value: 'United Kingdom', label: 'United Kingdom' }];
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<div>
|
|
38
|
+
{/* Country of residence */}
|
|
39
|
+
<div style={{ marginBottom: '32px' }}>
|
|
40
|
+
<Field label="Country of residence">
|
|
41
|
+
<SelectInput
|
|
42
|
+
disabled
|
|
43
|
+
value={selectValue}
|
|
44
|
+
placeholder="Select country"
|
|
45
|
+
items={countryOptions.map((option) => ({
|
|
46
|
+
type: 'option' as const,
|
|
47
|
+
value: option.value,
|
|
48
|
+
}))}
|
|
49
|
+
renderValue={(value) => <SelectInputOptionContent title={value} />}
|
|
50
|
+
onChange={setSelectValue}
|
|
51
|
+
/>
|
|
52
|
+
</Field>
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
{/* Personal details section */}
|
|
56
|
+
<Body style={{ marginBottom: '16px', fontWeight: '600', fontSize: '18px' }}>
|
|
57
|
+
Personal details
|
|
58
|
+
</Body>
|
|
59
|
+
|
|
60
|
+
{/* Full legal first and middle name(s) */}
|
|
61
|
+
<div style={{ marginBottom: '24px' }}>
|
|
62
|
+
<Field label="Full legal first and middle name(s)">
|
|
63
|
+
<Input disabled defaultValue="Mickey" placeholder="Enter your first and middle names" />
|
|
64
|
+
</Field>
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
{/* Full legal last name(s) */}
|
|
68
|
+
<div style={{ marginBottom: '24px' }}>
|
|
69
|
+
<Field label="Full legal last name(s)">
|
|
70
|
+
<Input disabled defaultValue="Mantle" placeholder="Enter your last name" />
|
|
71
|
+
</Field>
|
|
72
|
+
</div>
|
|
73
|
+
|
|
74
|
+
{/* Preferred name (optional) */}
|
|
75
|
+
<div style={{ marginBottom: '24px' }}>
|
|
76
|
+
<Field
|
|
77
|
+
label="Preferred name (optional)"
|
|
78
|
+
description="This is how we'll address you in emails and notifications"
|
|
79
|
+
>
|
|
80
|
+
<Input disabled placeholder="Enter your preferred name" />
|
|
81
|
+
</Field>
|
|
82
|
+
</div>
|
|
83
|
+
|
|
84
|
+
{/* Date of birth */}
|
|
85
|
+
<div style={{ marginBottom: '24px' }}>
|
|
86
|
+
<Field label="Date of birth">
|
|
87
|
+
<DateInput
|
|
88
|
+
disabled
|
|
89
|
+
value={dateValue || undefined}
|
|
90
|
+
placeholders={{
|
|
91
|
+
day: '11',
|
|
92
|
+
// month: 'September',
|
|
93
|
+
// year: '1990',
|
|
94
|
+
}}
|
|
95
|
+
onChange={setDateValue}
|
|
96
|
+
/>
|
|
97
|
+
</Field>
|
|
98
|
+
</div>
|
|
99
|
+
|
|
100
|
+
{/* Dynamic flow input */}
|
|
101
|
+
<div className="np-field-control" style={{ marginBottom: '32px' }}>
|
|
102
|
+
<fieldset className="np-input-group">
|
|
103
|
+
<Input disabled value="Fercus" />
|
|
104
|
+
</fieldset>
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
{/* Phone number */}
|
|
108
|
+
<div style={{ marginBottom: '32px' }}>
|
|
109
|
+
<Field label="Phone number">
|
|
110
|
+
<PhoneNumberInput
|
|
111
|
+
disabled
|
|
112
|
+
initialValue="+4407891300098"
|
|
113
|
+
countryCode="GB"
|
|
114
|
+
onChange={() => {}}
|
|
115
|
+
/>
|
|
116
|
+
</Field>
|
|
117
|
+
</div>
|
|
118
|
+
|
|
119
|
+
{/* Additional components */}
|
|
120
|
+
<div
|
|
121
|
+
style={{
|
|
122
|
+
borderTop: '1px solid #e5e7eb',
|
|
123
|
+
paddingTop: '32px',
|
|
124
|
+
marginTop: '32px',
|
|
125
|
+
}}
|
|
126
|
+
>
|
|
127
|
+
<Body style={{ marginBottom: '16px', fontWeight: '600', fontSize: '18px' }}>
|
|
128
|
+
Additional Components
|
|
129
|
+
</Body>
|
|
130
|
+
|
|
131
|
+
{/* Naked Inputs (without Field wrapper) */}
|
|
132
|
+
<div style={{ marginBottom: '24px' }}>
|
|
133
|
+
<Body style={{ marginBottom: '12px', fontWeight: '500', fontSize: '16px' }}>
|
|
134
|
+
Naked Inputs (without Field wrapper)
|
|
135
|
+
</Body>
|
|
136
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
|
|
137
|
+
<Input disabled placeholder="Disabled input with placeholder" />
|
|
138
|
+
<Input disabled defaultValue="Disabled input with default value" />
|
|
139
|
+
<Input disabled type="email" placeholder="email@example.com" />
|
|
140
|
+
<Input disabled type="password" placeholder="Password input" />
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
|
|
144
|
+
{/* Checkbox */}
|
|
145
|
+
<div style={{ marginBottom: '24px' }}>
|
|
146
|
+
<Checkbox
|
|
147
|
+
disabled
|
|
148
|
+
checked={checkboxValue}
|
|
149
|
+
label="I agree to the terms and conditions"
|
|
150
|
+
onChange={(checked) => setCheckboxValue(checked)}
|
|
151
|
+
/>
|
|
152
|
+
</div>
|
|
153
|
+
</div>
|
|
154
|
+
</div>
|
|
155
|
+
);
|
|
156
|
+
}
|
|
@@ -4,7 +4,7 @@ import { useDirection } from '../common/hooks';
|
|
|
4
4
|
|
|
5
5
|
type SingleAvatarType = { asset?: AvatarViewProps['children'] } & Omit<
|
|
6
6
|
AvatarViewProps,
|
|
7
|
-
'
|
|
7
|
+
'selected' | 'size' | 'badge' | 'children' | 'interactive'
|
|
8
8
|
>;
|
|
9
9
|
|
|
10
10
|
export type Props = {
|
|
@@ -1,23 +1,29 @@
|
|
|
1
|
-
.np-
|
|
2
|
-
--np-
|
|
1
|
+
.np-dot {
|
|
2
|
+
--np-dot-size: 14px;
|
|
3
3
|
position: relative;
|
|
4
4
|
display: inline-block;
|
|
5
5
|
}
|
|
6
|
-
.np-
|
|
7
|
-
-webkit-mask-image: radial-gradient(circle at bottom calc(100% - (var(--np-
|
|
8
|
-
mask-image: radial-gradient(circle at bottom calc(100% - (var(--np-
|
|
9
|
-
-webkit-mask-image: radial-gradient(circle at bottom calc(100% - calc(var(--np-
|
|
10
|
-
mask-image: radial-gradient(circle at bottom calc(100% - calc(var(--np-
|
|
6
|
+
.np-dot-mask {
|
|
7
|
+
-webkit-mask-image: radial-gradient(circle at bottom calc(100% - (var(--np-dot-size) / 2)) left calc(100% - (var(--np-dot-size) / 2)), transparent 0, transparent calc(var(--np-dot-size) / 2 + var(--np-dot-offset)), black 0);
|
|
8
|
+
mask-image: radial-gradient(circle at bottom calc(100% - (var(--np-dot-size) / 2)) left calc(100% - (var(--np-dot-size) / 2)), transparent 0, transparent calc(var(--np-dot-size) / 2 + var(--np-dot-offset)), black 0);
|
|
9
|
+
-webkit-mask-image: radial-gradient(circle at bottom calc(100% - calc(var(--np-dot-size) / 2)) left calc(100% - calc(var(--np-dot-size) / 2)), transparent 0, transparent calc(var(--np-dot-size) / 2 + var(--np-dot-offset)), black 0);
|
|
10
|
+
mask-image: radial-gradient(circle at bottom calc(100% - calc(var(--np-dot-size) / 2)) left calc(100% - calc(var(--np-dot-size) / 2)), transparent 0, transparent calc(var(--np-dot-size) / 2 + var(--np-dot-offset)), black 0);
|
|
11
11
|
}
|
|
12
|
-
.np-
|
|
12
|
+
.np-dot-badge {
|
|
13
13
|
position: absolute;
|
|
14
|
-
width: var(--np-
|
|
15
|
-
height: var(--np-
|
|
16
|
-
background-color: var(--color-sentiment-negative);
|
|
14
|
+
width: var(--np-dot-size);
|
|
15
|
+
height: var(--np-dot-size);
|
|
17
16
|
border-radius: 9999px;
|
|
18
17
|
border-radius: var(--radius-full);
|
|
19
18
|
right: 0;
|
|
20
19
|
}
|
|
20
|
+
.np-dot-badge-notification {
|
|
21
|
+
background-color: var(--color-sentiment-negative);
|
|
22
|
+
}
|
|
23
|
+
.np-dot-badge-online {
|
|
24
|
+
background-color: #00a2dd;
|
|
25
|
+
background-color: var(--color-interactive-accent);
|
|
26
|
+
}
|
|
21
27
|
.np-avatar-view .np-avatar-view-content {
|
|
22
28
|
color: #37517e;
|
|
23
29
|
color: var(--color-content-primary);
|
|
@@ -67,42 +67,6 @@ export const Selected: Story = {
|
|
|
67
67
|
},
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
-
export const Notification: Story = {
|
|
71
|
-
render: () => (
|
|
72
|
-
<div
|
|
73
|
-
style={{
|
|
74
|
-
gap: '1em',
|
|
75
|
-
display: 'grid',
|
|
76
|
-
justifyContent: 'space-between',
|
|
77
|
-
gridTemplate: `auto auto / repeat(${sizes.length}, min-content)`,
|
|
78
|
-
}}
|
|
79
|
-
>
|
|
80
|
-
{sizes.map((size) => (
|
|
81
|
-
<Body type="body-large-bold">{size}</Body>
|
|
82
|
-
))}
|
|
83
|
-
{sizes.map((size) => (
|
|
84
|
-
<AvatarView key={size} size={size} notification>
|
|
85
|
-
<Freeze />
|
|
86
|
-
</AvatarView>
|
|
87
|
-
))}
|
|
88
|
-
{sizes.map((size) => (
|
|
89
|
-
<AvatarView key={size} size={size} notification interactive>
|
|
90
|
-
<Freeze />
|
|
91
|
-
</AvatarView>
|
|
92
|
-
))}
|
|
93
|
-
{sizes.map((size) => (
|
|
94
|
-
<AvatarView
|
|
95
|
-
key={size}
|
|
96
|
-
size={size}
|
|
97
|
-
imgSrc="../avatar-rectangle-fox.webp"
|
|
98
|
-
notification
|
|
99
|
-
interactive
|
|
100
|
-
/>
|
|
101
|
-
))}
|
|
102
|
-
</div>
|
|
103
|
-
),
|
|
104
|
-
};
|
|
105
|
-
|
|
106
70
|
export const Badge: Story = {
|
|
107
71
|
render: () => {
|
|
108
72
|
const currencies = ['USD', 'EUR', 'GBP', 'AUD', 'CAD', 'JPY', 'CNY'];
|
|
@@ -219,6 +183,7 @@ export const Badge: Story = {
|
|
|
219
183
|
badge={{ icon: <Convert /> }}
|
|
220
184
|
/>
|
|
221
185
|
))}
|
|
186
|
+
|
|
222
187
|
{sizes.map((size) => (
|
|
223
188
|
<AvatarView
|
|
224
189
|
key={size}
|
|
@@ -241,11 +206,102 @@ export const Badge: Story = {
|
|
|
241
206
|
}}
|
|
242
207
|
/>
|
|
243
208
|
))}
|
|
209
|
+
|
|
210
|
+
{sizes.map((size) => (
|
|
211
|
+
<AvatarView
|
|
212
|
+
key={size}
|
|
213
|
+
size={size}
|
|
214
|
+
imgSrc="../avatar-square-dude.webp"
|
|
215
|
+
badge={{ type: 'notification' }}
|
|
216
|
+
/>
|
|
217
|
+
))}
|
|
218
|
+
|
|
219
|
+
{sizes.map((size) => (
|
|
220
|
+
<AvatarView
|
|
221
|
+
key={size}
|
|
222
|
+
size={size}
|
|
223
|
+
imgSrc="../avatar-square-dude.webp"
|
|
224
|
+
badge={{ type: 'online' }}
|
|
225
|
+
/>
|
|
226
|
+
))}
|
|
244
227
|
</div>
|
|
245
228
|
);
|
|
246
229
|
},
|
|
247
230
|
};
|
|
248
231
|
|
|
232
|
+
export const Notification: Story = {
|
|
233
|
+
render: () => (
|
|
234
|
+
<div
|
|
235
|
+
style={{
|
|
236
|
+
gap: '1em',
|
|
237
|
+
display: 'grid',
|
|
238
|
+
justifyContent: 'space-between',
|
|
239
|
+
gridTemplate: `auto auto / repeat(${sizes.length}, min-content)`,
|
|
240
|
+
}}
|
|
241
|
+
>
|
|
242
|
+
{sizes.map((size) => (
|
|
243
|
+
<Body type="body-large-bold">{size}</Body>
|
|
244
|
+
))}
|
|
245
|
+
{sizes.map((size) => (
|
|
246
|
+
<AvatarView key={size} size={size} badge={{ type: 'notification' }}>
|
|
247
|
+
<Freeze />
|
|
248
|
+
</AvatarView>
|
|
249
|
+
))}
|
|
250
|
+
{sizes.map((size) => (
|
|
251
|
+
<AvatarView key={size} size={size} badge={{ type: 'notification' }} interactive>
|
|
252
|
+
<Freeze />
|
|
253
|
+
</AvatarView>
|
|
254
|
+
))}
|
|
255
|
+
{sizes.map((size) => (
|
|
256
|
+
<AvatarView
|
|
257
|
+
key={size}
|
|
258
|
+
size={size}
|
|
259
|
+
imgSrc="../avatar-rectangle-fox.webp"
|
|
260
|
+
badge={{ type: 'notification' }}
|
|
261
|
+
interactive
|
|
262
|
+
/>
|
|
263
|
+
))}
|
|
264
|
+
</div>
|
|
265
|
+
),
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
export const Online: Story = {
|
|
269
|
+
tags: ['new'],
|
|
270
|
+
render: () => (
|
|
271
|
+
<div
|
|
272
|
+
style={{
|
|
273
|
+
gap: '1em',
|
|
274
|
+
display: 'grid',
|
|
275
|
+
justifyContent: 'space-between',
|
|
276
|
+
gridTemplate: `auto auto / repeat(${sizes.length}, min-content)`,
|
|
277
|
+
}}
|
|
278
|
+
>
|
|
279
|
+
{sizes.map((size) => (
|
|
280
|
+
<Body type="body-large-bold">{size}</Body>
|
|
281
|
+
))}
|
|
282
|
+
{sizes.map((size) => (
|
|
283
|
+
<AvatarView key={size} size={size} badge={{ type: 'online' }}>
|
|
284
|
+
<Freeze />
|
|
285
|
+
</AvatarView>
|
|
286
|
+
))}
|
|
287
|
+
{sizes.map((size) => (
|
|
288
|
+
<AvatarView key={size} size={size} badge={{ type: 'online' }} interactive>
|
|
289
|
+
<Freeze />
|
|
290
|
+
</AvatarView>
|
|
291
|
+
))}
|
|
292
|
+
{sizes.map((size) => (
|
|
293
|
+
<AvatarView
|
|
294
|
+
key={size}
|
|
295
|
+
size={size}
|
|
296
|
+
imgSrc="../avatar-rectangle-fox.webp"
|
|
297
|
+
badge={{ type: 'online' }}
|
|
298
|
+
interactive
|
|
299
|
+
/>
|
|
300
|
+
))}
|
|
301
|
+
</div>
|
|
302
|
+
),
|
|
303
|
+
};
|
|
304
|
+
|
|
249
305
|
export const Images: Story = {
|
|
250
306
|
render: () => {
|
|
251
307
|
return (
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Badge, { BadgeAssets, BadgeProps, BadgeAssetsProps } from '../badge';
|
|
2
|
-
import
|
|
2
|
+
import Dot, { DotProps } from './Dot';
|
|
3
3
|
import Circle from '../common/circle';
|
|
4
4
|
import Image from '../image';
|
|
5
5
|
import { HTMLAttributes, PropsWithChildren, useState } from 'react';
|
|
@@ -26,7 +26,6 @@ export type Props = {
|
|
|
26
26
|
profileName?: string | null;
|
|
27
27
|
profileType?: ProfileTypeBusiness | ProfileTypePersonal;
|
|
28
28
|
size?: 16 | 24 | 32 | 40 | 48 | 56 | 72;
|
|
29
|
-
notification?: boolean;
|
|
30
29
|
badge?: AvatarViewBadgeProps;
|
|
31
30
|
interactive?: boolean;
|
|
32
31
|
selected?: boolean;
|
|
@@ -40,7 +39,6 @@ function AvatarView({
|
|
|
40
39
|
children = undefined,
|
|
41
40
|
size = 48,
|
|
42
41
|
selected,
|
|
43
|
-
notification,
|
|
44
42
|
badge,
|
|
45
43
|
interactive = false,
|
|
46
44
|
className,
|
|
@@ -62,7 +60,7 @@ function AvatarView({
|
|
|
62
60
|
)}
|
|
63
61
|
{...restProps}
|
|
64
62
|
>
|
|
65
|
-
<Badges avatar={{ size,
|
|
63
|
+
<Badges avatar={{ size, selected }} {...badge}>
|
|
66
64
|
<Circle
|
|
67
65
|
size={size}
|
|
68
66
|
fixedSize
|
|
@@ -115,7 +113,7 @@ const MAP_BADGE_POSITION = {
|
|
|
115
113
|
|
|
116
114
|
type BadgesProps = AvatarViewBadgeProps &
|
|
117
115
|
PropsWithChildren<{
|
|
118
|
-
avatar: Pick<Props, 'selected' | 'size'
|
|
116
|
+
avatar: Pick<Props, 'selected' | 'size'>;
|
|
119
117
|
}>;
|
|
120
118
|
|
|
121
119
|
/**
|
|
@@ -128,36 +126,43 @@ function Badges({
|
|
|
128
126
|
asset: customBadge,
|
|
129
127
|
...badgeAssets
|
|
130
128
|
}: BadgesProps) {
|
|
131
|
-
const { size = 48, selected
|
|
129
|
+
const { size = 48, selected } = avatar;
|
|
132
130
|
const anyBadge = Object.values({ customBadge, ...badgeAssets }).filter(Boolean).length > 0;
|
|
133
|
-
|
|
134
|
-
|
|
131
|
+
|
|
132
|
+
if ((!anyBadge && !selected) || size <= 16) {
|
|
133
|
+
return children;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (badgeAssets.type === 'notification' || badgeAssets.type === 'online') {
|
|
135
137
|
return (
|
|
136
|
-
<
|
|
137
|
-
aria-label={ariaLabel}
|
|
138
|
-
size={badgeSize}
|
|
139
|
-
badge={
|
|
140
|
-
customBadge ? (
|
|
141
|
-
<Circle fixedSize size={badgeSize}>
|
|
142
|
-
{customBadge}
|
|
143
|
-
</Circle>
|
|
144
|
-
) : (
|
|
145
|
-
<BadgeAssets {...(selected ? { status: 'positive' } : badgeAssets)} size={badgeSize} />
|
|
146
|
-
)
|
|
147
|
-
}
|
|
148
|
-
style={{
|
|
149
|
-
// @ts-expect-error CSS custom props allowed
|
|
150
|
-
'--badge-content-position': `${MAP_BADGE_POSITION[size] ?? 0}px`,
|
|
151
|
-
}}
|
|
152
|
-
>
|
|
138
|
+
<Dot avatarSize={size} variant={badgeAssets.type === 'online' ? 'online' : 'notification'}>
|
|
153
139
|
{children}
|
|
154
|
-
</
|
|
140
|
+
</Dot>
|
|
155
141
|
);
|
|
156
142
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
143
|
+
|
|
144
|
+
const badgeSize: BadgeAssetsProps['size'] = MAP_BADGE_ASSET_SIZE[size];
|
|
145
|
+
return (
|
|
146
|
+
<Badge
|
|
147
|
+
aria-label={ariaLabel}
|
|
148
|
+
size={badgeSize}
|
|
149
|
+
badge={
|
|
150
|
+
customBadge ? (
|
|
151
|
+
<Circle fixedSize size={badgeSize}>
|
|
152
|
+
{customBadge}
|
|
153
|
+
</Circle>
|
|
154
|
+
) : (
|
|
155
|
+
<BadgeAssets {...(selected ? { status: 'positive' } : badgeAssets)} size={badgeSize} />
|
|
156
|
+
)
|
|
157
|
+
}
|
|
158
|
+
style={{
|
|
159
|
+
// @ts-expect-error CSS custom props allowed
|
|
160
|
+
'--badge-content-position': `${MAP_BADGE_POSITION[size] ?? 0}px`,
|
|
161
|
+
}}
|
|
162
|
+
>
|
|
163
|
+
{children}
|
|
164
|
+
</Badge>
|
|
165
|
+
);
|
|
161
166
|
}
|
|
162
167
|
|
|
163
168
|
function AvatarViewContent({
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
.np-dot {
|
|
2
|
+
--np-dot-size: 14px;
|
|
3
|
+
position: relative;
|
|
4
|
+
display: inline-block;
|
|
5
|
+
}
|
|
6
|
+
.np-dot-mask {
|
|
7
|
+
-webkit-mask-image: radial-gradient(circle at bottom calc(100% - (var(--np-dot-size) / 2)) left calc(100% - (var(--np-dot-size) / 2)), transparent 0, transparent calc(var(--np-dot-size) / 2 + var(--np-dot-offset)), black 0);
|
|
8
|
+
mask-image: radial-gradient(circle at bottom calc(100% - (var(--np-dot-size) / 2)) left calc(100% - (var(--np-dot-size) / 2)), transparent 0, transparent calc(var(--np-dot-size) / 2 + var(--np-dot-offset)), black 0);
|
|
9
|
+
-webkit-mask-image: radial-gradient(circle at bottom calc(100% - calc(var(--np-dot-size) / 2)) left calc(100% - calc(var(--np-dot-size) / 2)), transparent 0, transparent calc(var(--np-dot-size) / 2 + var(--np-dot-offset)), black 0);
|
|
10
|
+
mask-image: radial-gradient(circle at bottom calc(100% - calc(var(--np-dot-size) / 2)) left calc(100% - calc(var(--np-dot-size) / 2)), transparent 0, transparent calc(var(--np-dot-size) / 2 + var(--np-dot-offset)), black 0);
|
|
11
|
+
}
|
|
12
|
+
.np-dot-badge {
|
|
13
|
+
position: absolute;
|
|
14
|
+
width: var(--np-dot-size);
|
|
15
|
+
height: var(--np-dot-size);
|
|
16
|
+
border-radius: 9999px;
|
|
17
|
+
border-radius: var(--radius-full);
|
|
18
|
+
right: 0;
|
|
19
|
+
}
|
|
20
|
+
.np-dot-badge-notification {
|
|
21
|
+
background-color: var(--color-sentiment-negative);
|
|
22
|
+
}
|
|
23
|
+
.np-dot-badge-online {
|
|
24
|
+
background-color: #00a2dd;
|
|
25
|
+
background-color: var(--color-interactive-accent);
|
|
26
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
.np-dot {
|
|
2
|
+
--np-dot-size: 14px;
|
|
3
|
+
position: relative;
|
|
4
|
+
display: inline-block;
|
|
5
|
+
|
|
6
|
+
&-mask {
|
|
7
|
+
mask-image: radial-gradient(
|
|
8
|
+
circle at bottom calc(100% - calc(var(--np-dot-size) / 2))
|
|
9
|
+
left calc(100% - calc(var(--np-dot-size) / 2)),
|
|
10
|
+
transparent 0,
|
|
11
|
+
transparent calc(var(--np-dot-size) / 2 + var(--np-dot-offset)),
|
|
12
|
+
black 0
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&-badge {
|
|
17
|
+
position: absolute;
|
|
18
|
+
width: var(--np-dot-size);
|
|
19
|
+
height: var(--np-dot-size);
|
|
20
|
+
border-radius: var(--radius-full);
|
|
21
|
+
right: 0;
|
|
22
|
+
|
|
23
|
+
&-notification {
|
|
24
|
+
background-color: var(--color-sentiment-negative);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&-online {
|
|
28
|
+
background-color: var(--color-interactive-accent);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|