@audius/harmony 0.0.25 → 0.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -12
- package/dist/components/hint/Hint.d.ts +2 -0
- package/dist/components/hint/Hint.d.ts.map +1 -1
- package/dist/components/hint/Hint.js +6 -2
- package/dist/components/hint/Hint.js.map +1 -1
- package/dist/components/icon.d.ts +1 -2
- package/dist/components/icon.d.ts.map +1 -1
- package/dist/components/input/PasswordInput/PasswordInput.js +1 -0
- package/dist/components/input/PasswordInput/PasswordInput.js.map +1 -1
- package/dist/components/input/SelectablePill/SelectablePill.d.ts.map +1 -1
- package/dist/components/input/SelectablePill/SelectablePill.js +8 -6
- package/dist/components/input/SelectablePill/SelectablePill.js.map +1 -1
- package/dist/components/input/TextInput/index.d.ts +1 -1
- package/dist/components/input/TextInput/index.d.ts.map +1 -1
- package/dist/components/input/TextInput/types.d.ts +1 -1
- package/dist/components/input/TextInput/types.js.map +1 -1
- package/dist/components/input/TokenAmountInput/TokenAmountInput.js +1 -0
- package/dist/components/input/TokenAmountInput/TokenAmountInput.js.map +1 -1
- package/dist/components/text/Text/Text.d.ts.map +1 -1
- package/dist/components/text/Text/Text.js +11 -7
- package/dist/components/text/Text/Text.js.map +1 -1
- package/dist/components/text/Text/types.d.ts +1 -0
- package/dist/components/text/Text/types.d.ts.map +1 -1
- package/dist/components/text-link/TextLink.d.ts +14 -2
- package/dist/components/text-link/TextLink.d.ts.map +1 -1
- package/dist/components/text-link/TextLink.js +10 -7
- package/dist/components/text-link/TextLink.js.map +1 -1
- package/dist/components/text-link/index.d.ts +1 -0
- package/dist/components/text-link/index.d.ts.map +1 -1
- package/dist/components/text-link/types.d.ts +6 -2
- package/dist/components/text-link/types.d.ts.map +1 -1
- package/dist/foundations/spacing/spacing.d.ts +1 -0
- package/dist/foundations/spacing/spacing.d.ts.map +1 -1
- package/dist/foundations/spacing/spacing.js.map +1 -1
- package/dist/foundations/theme/ThemeProvider.d.ts.map +1 -1
- package/dist/foundations/theme/ThemeProvider.js +2 -7
- package/dist/foundations/theme/ThemeProvider.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img height="288px" src="
|
|
3
|
-
<img height="288px" src="
|
|
2
|
+
<img height="288px" src="https://github.com/AudiusProject/audius-protocol/blob/main/packages/harmony/src/storybook/assets/harmonyLogoDark.png#gh-dark-mode-only">
|
|
3
|
+
<img height="288px" src="https://github.com/AudiusProject/audius-protocol/blob/main/packages/harmony/src/storybook/assets/harmonyLogo.png?raw=true#gh-light-mode-only">
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
6
6
|
Harmony is design system focused on collaboration, reusability, and scalability.
|
|
@@ -48,18 +48,15 @@ Setup the ThemeProvider exported by Harmony
|
|
|
48
48
|
import { ThemeProvider as HarmonyThemeProvider } from '@audius/harmony'
|
|
49
49
|
|
|
50
50
|
const App = () => {
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
<HarmonyThemeProvider theme='day'>
|
|
54
|
-
...
|
|
55
|
-
</HarmonyThemeProvider>
|
|
56
|
-
)
|
|
51
|
+
return <HarmonyThemeProvider theme='day'>...</HarmonyThemeProvider>
|
|
57
52
|
}
|
|
58
53
|
```
|
|
59
54
|
|
|
60
55
|
In order use emotion yourself, follow their documentation for [setting up the css-prop](https://emotion.sh/docs/css-prop)
|
|
61
56
|
|
|
62
|
-
If using typescript
|
|
57
|
+
If using typescript you will need to:
|
|
58
|
+
|
|
59
|
+
1. Add an emotion.d.ts file and include the following for access to harmony's theme type
|
|
63
60
|
|
|
64
61
|
```ts
|
|
65
62
|
import '@emotion/react'
|
|
@@ -68,18 +65,28 @@ import type { HarmonyTheme } from '@audius/harmony'
|
|
|
68
65
|
declare module '@emotion/react' {
|
|
69
66
|
export interface Theme extends HarmonyTheme {}
|
|
70
67
|
}
|
|
68
|
+
```
|
|
71
69
|
|
|
70
|
+
2. Update your tsconfig to specify the jsxImportLocation:
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
{
|
|
74
|
+
"compilerOptions": {
|
|
75
|
+
"jsxImportSource": "@emotion/react",
|
|
76
|
+
...
|
|
77
|
+
}
|
|
78
|
+
}
|
|
72
79
|
```
|
|
73
80
|
|
|
74
81
|
## Usage
|
|
75
82
|
|
|
76
83
|
```tsx
|
|
77
|
-
import { Button,
|
|
84
|
+
import { Button, Flex } from '@audius/harmony'
|
|
78
85
|
|
|
79
86
|
const App = () => {
|
|
80
87
|
return (
|
|
81
88
|
<Flex gap='m'>
|
|
82
|
-
<Button variant=
|
|
89
|
+
<Button variant='secondary'>Click This!</Button>
|
|
83
90
|
<Button>Click That!</Button>
|
|
84
91
|
</Flex>
|
|
85
92
|
)
|
|
@@ -97,4 +104,3 @@ npm run storybook
|
|
|
97
104
|
## Contribution
|
|
98
105
|
|
|
99
106
|
A Contribution Guide is [available here](https://www.notion.so/audiusproject/Submitting-for-Design-Updates-52a8bc3bb68747818a96d2721bace27f).
|
|
100
|
-
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
1
2
|
import type { IconComponent } from "../icon";
|
|
2
3
|
import { PaperProps } from "../layout/Paper";
|
|
3
4
|
type HintProps = {
|
|
4
5
|
icon: IconComponent;
|
|
6
|
+
actions?: ReactNode;
|
|
5
7
|
} & PaperProps;
|
|
6
8
|
export declare const Hint: (props: HintProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
7
9
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Hint.d.ts","sourceRoot":"","sources":["../../../src/components/hint/Hint.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAuB;
|
|
1
|
+
{"version":3,"file":"Hint.d.ts","sourceRoot":"","sources":["../../../src/components/hint/Hint.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAuB;AAEpD,OAAO,EAAS,UAAU,EAAE,wBAA+B;AAG3D,KAAK,SAAS,GAAG;IACf,IAAI,EAAE,aAAa,CAAA;IACnB,OAAO,CAAC,EAAE,SAAS,CAAA;CACpB,GAAG,UAAU,CAAA;AAKd,eAAO,MAAM,IAAI,UAAW,SAAS,qDA2BpC,CAAA"}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { __rest, __assign } from '../../_virtual/_tslib.js';
|
|
2
2
|
import { jsxs, jsx } from '@emotion/react/jsx-runtime';
|
|
3
|
+
import '../layout/Box/Box.js';
|
|
4
|
+
import '@emotion/react';
|
|
5
|
+
import { Flex } from '../layout/Flex/Flex.js';
|
|
3
6
|
import { Paper } from '../layout/Paper/Paper.js';
|
|
7
|
+
import '../layout/Popup/Popup.js';
|
|
4
8
|
import { Text } from '../text/Text/Text.js';
|
|
5
9
|
|
|
6
10
|
/*
|
|
7
11
|
* A way of informing the user of important details in line in a prominent way.
|
|
8
12
|
*/
|
|
9
13
|
var Hint = function (props) {
|
|
10
|
-
var Icon = props.icon, children = props.children, other = __rest(props, ["icon", "children"]);
|
|
11
|
-
return (jsxs(Paper, __assign({ role: 'alert',
|
|
14
|
+
var Icon = props.icon, children = props.children, actions = props.actions, other = __rest(props, ["icon", "children", "actions"]);
|
|
15
|
+
return (jsxs(Paper, __assign({ role: 'alert', backgroundColor: 'surface2', ph: 'l', pv: 'm', direction: 'column', gap: 'm', shadow: 'flat', border: 'strong' }, other, { children: [jsxs(Flex, __assign({ gap: 'l', alignItems: 'center' }, { children: [jsx(Icon, { size: 'l', color: 'default' }), jsx(Text, __assign({ variant: 'body', color: 'default' }, { children: children }))] })), actions ? (jsx(Flex, __assign({ pl: 'unit10', gap: 'l' }, { children: actions }))) : null] })));
|
|
12
16
|
};
|
|
13
17
|
|
|
14
18
|
export { Hint };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Hint.js","sources":["../../../src/components/hint/Hint.tsx"],"sourcesContent":["import type { IconComponent } from 'components/icon'\nimport { Paper, PaperProps } from 'components/layout/Paper'\nimport { Text } from 'components/text'\n\ntype HintProps = {\n icon: IconComponent\n} & PaperProps\n\n/*\n * A way of informing the user of important details in line in a prominent way.\n */\nexport const Hint = (props: HintProps) => {\n const { icon: Icon, children, ...other } = props\n return (\n <Paper\n role='alert'\n
|
|
1
|
+
{"version":3,"file":"Hint.js","sources":["../../../src/components/hint/Hint.tsx"],"sourcesContent":["import { ReactNode } from 'react'\n\nimport type { IconComponent } from 'components/icon'\nimport { Flex } from 'components/layout'\nimport { Paper, PaperProps } from 'components/layout/Paper'\nimport { Text } from 'components/text'\n\ntype HintProps = {\n icon: IconComponent\n actions?: ReactNode\n} & PaperProps\n\n/*\n * A way of informing the user of important details in line in a prominent way.\n */\nexport const Hint = (props: HintProps) => {\n const { icon: Icon, children, actions, ...other } = props\n return (\n <Paper\n role='alert'\n backgroundColor='surface2'\n ph='l'\n pv='m'\n direction='column'\n gap='m'\n shadow='flat'\n border='strong'\n {...other}\n >\n <Flex gap='l' alignItems='center'>\n <Icon size='l' color='default' />\n <Text variant='body' color='default'>\n {children}\n </Text>\n </Flex>\n {actions ? (\n <Flex pl='unit10' gap='l'>\n {actions}\n </Flex>\n ) : null}\n </Paper>\n )\n}\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;AAYA;;AAEG;AACI,IAAM,IAAI,GAAG,UAAC,KAAgB,EAAA;IAC3B,IAAM,IAAI,GAAkC,KAAK,CAAA,IAAvC,EAAE,QAAQ,GAAwB,KAAK,CAA7B,QAAA,EAAE,OAAO,GAAe,KAAK,QAApB,EAAK,KAAK,UAAK,KAAK,EAAnD,CAA2C,MAAA,EAAA,UAAA,EAAA,SAAA,CAAA,CAAF,CAAU;IACzD,QACEA,KAAC,KAAK,EAAA,QAAA,CAAA,EACJ,IAAI,EAAC,OAAO,EACZ,eAAe,EAAC,UAAU,EAC1B,EAAE,EAAC,GAAG,EACN,EAAE,EAAC,GAAG,EACN,SAAS,EAAC,QAAQ,EAClB,GAAG,EAAC,GAAG,EACP,MAAM,EAAC,MAAM,EACb,MAAM,EAAC,QAAQ,EACX,EAAA,KAAK,eAETA,IAAC,CAAA,IAAI,aAAC,GAAG,EAAC,GAAG,EAAC,UAAU,EAAC,QAAQ,EAC/B,EAAA,EAAA,QAAA,EAAA,CAAAC,GAAA,CAAC,IAAI,EAAC,EAAA,IAAI,EAAC,GAAG,EAAC,KAAK,EAAC,SAAS,EAAG,CAAA,EACjCA,GAAC,CAAA,IAAI,aAAC,OAAO,EAAC,MAAM,EAAC,KAAK,EAAC,SAAS,EAAA,EAAA,EAAA,QAAA,EACjC,QAAQ,EAAA,CAAA,CACJ,CACF,EAAA,CAAA,CAAA,EACN,OAAO,IACNA,GAAA,CAAC,IAAI,EAAC,QAAA,CAAA,EAAA,EAAE,EAAC,QAAQ,EAAC,GAAG,EAAC,GAAG,EAAA,EAAA,EAAA,QAAA,EACtB,OAAO,EAAA,CAAA,CACH,IACL,IAAI,CACF,EAAA,CAAA,CAAA,EACT;AACH;;;;"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { ComponentType, SVGProps } from 'react';
|
|
2
2
|
import type { IconColors } from '../foundations/color/semantic';
|
|
3
3
|
import type { ShadowOptions } from '../foundations/shadows';
|
|
4
|
-
import {
|
|
5
|
-
type IconSize = keyof typeof iconSizes;
|
|
4
|
+
import { IconSize } from '../foundations/spacing';
|
|
6
5
|
type SVGBaseProps = SVGProps<SVGSVGElement>;
|
|
7
6
|
export type IconProps = {
|
|
8
7
|
color?: IconColors;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../src/components/icon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAC3D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../src/components/icon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAEjD,KAAK,YAAY,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAA;AAE3C,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf,KAAK,CAAC,EAAE,QAAQ,CAAA;IAChB,KAAK,CAAC,EAAE,QAAQ,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,aAAa,CAAA;CACvB,CAAA;AAED,KAAK,YAAY,GAAG,YAAY,GAAG,SAAS,CAAA;AAE5C,MAAM,MAAM,aAAa,GAAG,aAAa,CAAC,YAAY,GAAG,YAAY,CAAC,CAAA"}
|
|
@@ -11,6 +11,7 @@ import '../../button/FollowButton/FollowButton.js';
|
|
|
11
11
|
import '../../button/FilterButton/FilterButton.js';
|
|
12
12
|
import { IconButton } from '../../button/IconButton/IconButton.js';
|
|
13
13
|
import { TextInput } from '../TextInput/TextInput.js';
|
|
14
|
+
import '../TextInput/types.js';
|
|
14
15
|
|
|
15
16
|
var messages = {
|
|
16
17
|
hidePasswordInput: 'Hide password input',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PasswordInput.js","sources":["../../../../src/components/input/PasswordInput/PasswordInput.tsx"],"sourcesContent":["import { forwardRef } from 'react'\n\nimport { useToggle } from 'react-use'\n\nimport { IconButton } from 'components/button'\nimport { IconVisibilityHidden, IconVisibilityPublic } from 'icons'\n\nimport { TextInput } from '../TextInput'\n\nimport type { PasswordInputProps } from './types'\n\nconst messages = {\n hidePasswordInput: 'Hide password input',\n showPasswordInput: 'Show password input'\n}\n\nexport const PasswordInput = forwardRef<HTMLInputElement, PasswordInputProps>(\n (props, ref) => {\n const { hideVisibilityToggle, ...restProps } = props\n const [isPasswordVisible, toggleIsPasswordVisible] = useToggle(false)\n const VisibilityIcon = isPasswordVisible\n ? IconVisibilityPublic\n : IconVisibilityHidden\n\n return (\n <TextInput\n ref={ref}\n type={isPasswordVisible ? 'text' : 'password'}\n endAdornment={\n hideVisibilityToggle ? null : (\n <IconButton\n icon={VisibilityIcon}\n color='subdued'\n onClick={toggleIsPasswordVisible}\n aria-label={\n isPasswordVisible\n ? messages.hidePasswordInput\n : messages.showPasswordInput\n }\n ripple\n />\n )\n }\n {...restProps}\n />\n )\n }\n)\n"],"names":["_jsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PasswordInput.js","sources":["../../../../src/components/input/PasswordInput/PasswordInput.tsx"],"sourcesContent":["import { forwardRef } from 'react'\n\nimport { useToggle } from 'react-use'\n\nimport { IconButton } from 'components/button'\nimport { IconVisibilityHidden, IconVisibilityPublic } from 'icons'\n\nimport { TextInput } from '../TextInput'\n\nimport type { PasswordInputProps } from './types'\n\nconst messages = {\n hidePasswordInput: 'Hide password input',\n showPasswordInput: 'Show password input'\n}\n\nexport const PasswordInput = forwardRef<HTMLInputElement, PasswordInputProps>(\n (props, ref) => {\n const { hideVisibilityToggle, ...restProps } = props\n const [isPasswordVisible, toggleIsPasswordVisible] = useToggle(false)\n const VisibilityIcon = isPasswordVisible\n ? IconVisibilityPublic\n : IconVisibilityHidden\n\n return (\n <TextInput\n ref={ref}\n type={isPasswordVisible ? 'text' : 'password'}\n endAdornment={\n hideVisibilityToggle ? null : (\n <IconButton\n icon={VisibilityIcon}\n color='subdued'\n onClick={toggleIsPasswordVisible}\n aria-label={\n isPasswordVisible\n ? messages.hidePasswordInput\n : messages.showPasswordInput\n }\n ripple\n />\n )\n }\n {...restProps}\n />\n )\n }\n)\n"],"names":["_jsx"],"mappings":";;;;;;;;;;;;;;;AAWA,IAAM,QAAQ,GAAG;AACf,IAAA,iBAAiB,EAAE,qBAAqB;AACxC,IAAA,iBAAiB,EAAE,qBAAqB;CACzC,CAAA;IAEY,aAAa,GAAG,UAAU,CACrC,UAAC,KAAK,EAAE,GAAG,EAAA;IACD,IAAA,oBAAoB,GAAmB,KAAK,CAAxB,oBAAA,EAAK,SAAS,GAAA,MAAA,CAAK,KAAK,EAA9C,CAAsC,sBAAA,CAAA,CAAF,CAAU;IAC9C,IAAA,EAAA,GAA+C,SAAS,CAAC,KAAK,CAAC,EAA9D,iBAAiB,GAAA,EAAA,CAAA,CAAA,CAAA,EAAE,uBAAuB,GAAA,EAAA,CAAA,CAAA,CAAoB,CAAA;IACrE,IAAM,cAAc,GAAG,iBAAiB;AACtC,UAAE,oBAAoB;UACpB,oBAAoB,CAAA;IAExB,QACEA,IAAC,SAAS,EAAA,QAAA,CAAA,EACR,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,iBAAiB,GAAG,MAAM,GAAG,UAAU,EAC7C,YAAY,EACV,oBAAoB,GAAG,IAAI,IACzBA,GAAA,CAAC,UAAU,EACT,EAAA,IAAI,EAAE,cAAc,EACpB,KAAK,EAAC,SAAS,EACf,OAAO,EAAE,uBAAuB,EAAA,YAAA,EAE9B,iBAAiB;kBACb,QAAQ,CAAC,iBAAiB;AAC5B,kBAAE,QAAQ,CAAC,iBAAiB,EAEhC,MAAM,EACN,IAAA,EAAA,CAAA,CACH,EAEC,EAAA,SAAS,CACb,CAAA,EACH;AACH,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectablePill.d.ts","sourceRoot":"","sources":["../../../../src/components/input/SelectablePill/SelectablePill.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"SelectablePill.d.ts","sourceRoot":"","sources":["../../../../src/components/input/SelectablePill/SelectablePill.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AASlD,eAAO,MAAM,cAAc,UAAW,mBAAmB,qDAuIxD,CAAA"}
|
|
@@ -7,12 +7,15 @@ import { Text } from '../../text/Text/Text.js';
|
|
|
7
7
|
|
|
8
8
|
var RadioInput = function (props) {
|
|
9
9
|
var _a = useRadioGroup(props), name = _a.name, checked = _a.checked, onChange = _a.onChange;
|
|
10
|
-
|
|
11
|
-
return (jsx(HiddenInput, __assign({}, props, { name: name, checked: checked !== null && checked !== void 0 ? checked : isSelected, onChange: onChange })));
|
|
10
|
+
return (jsx(HiddenInput, __assign({}, props, { name: name, checked: checked, onChange: onChange })));
|
|
12
11
|
};
|
|
13
12
|
var SelectablePill = function (props) {
|
|
14
|
-
var
|
|
13
|
+
var _a;
|
|
14
|
+
var isSelectedProp = props.isSelected, _b = props.size, size = _b === void 0 ? 'small' : _b, _isHovered = props._isHovered, Icon = props.icon, className = props.className, other = __rest(props, ["isSelected", "size", "_isHovered", "icon", "className"]);
|
|
15
15
|
var disabled = other.disabled, type = other.type;
|
|
16
|
+
var isSelected = type === 'checkbox' || type === 'radio'
|
|
17
|
+
? (_a = other.checked) !== null && _a !== void 0 ? _a : isSelectedProp
|
|
18
|
+
: isSelectedProp;
|
|
16
19
|
var theme = useTheme();
|
|
17
20
|
var spacing = theme.spacing;
|
|
18
21
|
var hoverCss = __assign({ backgroundColor: theme.color.secondary.s200, color: theme.color.static.white, border: "1px solid ".concat(theme.color.secondary.secondary) }, (size === 'large' && {
|
|
@@ -51,11 +54,10 @@ var SelectablePill = function (props) {
|
|
|
51
54
|
var pillContent = (jsxs(Fragment, { children: [Icon ? jsx(Icon, { css: iconCss }) : null, 'label' in other ? (jsx(Text, __assign({ variant: size === 'oversized' ? 'heading' : 'body', tag: 'span', css: size === 'oversized' && { textTransform: 'uppercase' } }, { children: other.label }))) : null] }));
|
|
52
55
|
switch (type) {
|
|
53
56
|
case 'checkbox': {
|
|
54
|
-
|
|
55
|
-
return (jsxs("label", __assign({}, rootProps, { children: [pillContent, jsx(HiddenInput, __assign({}, rest, { checked: checked !== null && checked !== void 0 ? checked : isSelected }))] })));
|
|
57
|
+
return (jsxs("label", __assign({}, rootProps, { children: [pillContent, jsx(HiddenInput, __assign({}, other, { checked: isSelected }))] })));
|
|
56
58
|
}
|
|
57
59
|
case 'radio': {
|
|
58
|
-
return (jsxs("label", __assign({}, rootProps, { children: [pillContent, jsx(RadioInput, __assign({}, other, {
|
|
60
|
+
return (jsxs("label", __assign({}, rootProps, { children: [pillContent, jsx(RadioInput, __assign({}, other, { checked: isSelected }))] })));
|
|
59
61
|
}
|
|
60
62
|
case 'button':
|
|
61
63
|
case 'reset':
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectablePill.js","sources":["../../../../src/components/input/SelectablePill/SelectablePill.tsx"],"sourcesContent":["import { ComponentProps } from 'react'\n\nimport { CSSObject, useTheme } from '@emotion/react'\n\nimport { HiddenInput } from 'components/common/HiddenInput'\nimport { useRadioGroup } from 'components/radio-group/useRadioGroup'\nimport { Text } from 'components/text'\n\nimport type { SelectablePillProps } from './types'\n\nconst RadioInput = (
|
|
1
|
+
{"version":3,"file":"SelectablePill.js","sources":["../../../../src/components/input/SelectablePill/SelectablePill.tsx"],"sourcesContent":["import { ComponentProps } from 'react'\n\nimport { CSSObject, useTheme } from '@emotion/react'\n\nimport { HiddenInput } from 'components/common/HiddenInput'\nimport { useRadioGroup } from 'components/radio-group/useRadioGroup'\nimport { Text } from 'components/text'\n\nimport type { SelectablePillProps } from './types'\n\nconst RadioInput = (props: ComponentProps<'input'>) => {\n const { name, checked, onChange } = useRadioGroup(props)\n return (\n <HiddenInput {...props} name={name} checked={checked} onChange={onChange} />\n )\n}\n\nexport const SelectablePill = (props: SelectablePillProps) => {\n const {\n isSelected: isSelectedProp,\n size = 'small',\n _isHovered,\n icon: Icon,\n className,\n ...other\n } = props\n\n const { disabled, type } = other\n const isSelected =\n type === 'checkbox' || type === 'radio'\n ? other.checked ?? isSelectedProp\n : isSelectedProp\n\n const theme = useTheme()\n const { spacing } = theme\n\n const hoverCss: CSSObject = {\n backgroundColor: theme.color.secondary.s200,\n color: theme.color.static.white,\n border: `1px solid ${theme.color.secondary.secondary}`,\n ...(size === 'large' && {\n backgroundColor: theme.color.secondary.s100,\n border: `1px solid ${theme.color.secondary.s200}`,\n boxShadow: 'none'\n })\n }\n\n const activeCss: CSSObject = {\n backgroundColor: theme.color.secondary.s400,\n color: theme.color.static.white,\n border: `1px solid ${theme.color.secondary.s400}`,\n\n ...(size === 'large' && {\n boxShadow: 'none'\n })\n }\n\n const rootCss: CSSObject = {\n display: 'inline-flex',\n position: 'relative',\n alignItems: 'center',\n justifyContent: 'center',\n gap: theme.spacing.xs,\n color: theme.color.text.default,\n backgroundColor: theme.color.background.white,\n cursor: 'pointer',\n userSelect: 'none',\n transition: 'all 0.12s ease-out',\n textWrap: 'nowrap',\n border: `1px solid ${theme.color.border.strong}`,\n borderRadius: theme.cornerRadius['2xl'],\n ...(size === 'small' && {\n height: theme.spacing.xl,\n paddingInline: theme.spacing.m\n }),\n ...(size === 'large' && {\n height: theme.spacing['2xl'],\n paddingInline: theme.spacing.l,\n boxShadow: theme.shadows.near\n }),\n ...(size === 'oversized' && {\n height: spacing.unit12,\n padding: spacing.m,\n borderWidth: 2\n }),\n ...(disabled && { opacity: 0.45 }),\n ...(_isHovered && hoverCss),\n ...(isSelected && activeCss),\n ...((disabled || _isHovered) && {\n pointerEvents: 'none'\n }),\n ':hover': hoverCss,\n ':active': activeCss\n }\n\n const iconCss = {\n width: spacing.l,\n height: spacing.l,\n\n '& path': {\n fill: 'currentColor'\n }\n }\n\n const rootProps = {\n css: rootCss,\n className\n }\n\n const pillContent = (\n <>\n {Icon ? <Icon css={iconCss} /> : null}\n {'label' in other ? (\n <Text\n variant={size === 'oversized' ? 'heading' : 'body'}\n tag='span'\n css={size === 'oversized' && { textTransform: 'uppercase' }}\n >\n {other.label}\n </Text>\n ) : null}\n </>\n )\n\n switch (type) {\n case 'checkbox': {\n return (\n <label {...rootProps}>\n {pillContent}\n <HiddenInput {...other} checked={isSelected} />\n </label>\n )\n }\n case 'radio': {\n return (\n <label {...rootProps}>\n {pillContent}\n <RadioInput {...other} checked={isSelected} />\n </label>\n )\n }\n case 'button':\n case 'reset':\n case 'submit':\n default: {\n return (\n <button {...rootProps} {...other}>\n {pillContent}\n </button>\n )\n }\n }\n}\n"],"names":["_jsx","_jsxs","_Fragment"],"mappings":";;;;;;;AAUA,IAAM,UAAU,GAAG,UAAC,KAA8B,EAAA;AAC1C,IAAA,IAAA,EAA8B,GAAA,aAAa,CAAC,KAAK,CAAC,EAAhD,IAAI,GAAA,EAAA,CAAA,IAAA,EAAE,OAAO,GAAA,EAAA,CAAA,OAAA,EAAE,QAAQ,cAAyB,CAAA;AACxD,IAAA,QACEA,GAAC,CAAA,WAAW,eAAK,KAAK,EAAA,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAA,CAAA,CAAI,EAC7E;AACH,CAAC,CAAA;AAEM,IAAM,cAAc,GAAG,UAAC,KAA0B,EAAA;;AAErD,IAAA,IAAY,cAAc,GAMxB,KAAK,CAAA,UANmB,EAC1B,EAKE,GAAA,KAAK,CALO,IAAA,EAAd,IAAI,GAAG,EAAA,KAAA,KAAA,CAAA,GAAA,OAAO,GAAA,EAAA,EACd,UAAU,GAIR,KAAK,CAJG,UAAA,EACJ,IAAI,GAGR,KAAK,CAH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AA,WAAW,EAAK,QAAA,CAAA,EAAA,EAAA,KAAK,IAAE,OAAO,EAAE,UAAU,EAAI,CAAA,CAAA,CAAA,EAAA,CAAA,CACzC,EACT;AACF,SAAA;QACD,KAAK,OAAO,EAAE;AACZ,YAAA,QACEC,IAAW,CAAA,OAAA,EAAA,QAAA,CAAA,EAAA,EAAA,SAAS,EACjB,EAAA,QAAA,EAAA,CAAA,WAAW,EACZD,GAAC,CAAA,UAAU,EAAK,QAAA,CAAA,EAAA,EAAA,KAAK,IAAE,OAAO,EAAE,UAAU,EAAI,CAAA,CAAA,CAAA,EAAA,CAAA,CACxC,EACT;AACF,SAAA;AACD,QAAA,KAAK,QAAQ,CAAC;AACd,QAAA,KAAK,OAAO,CAAC;AACb,QAAA,KAAK,QAAQ,CAAC;AACd,QAAA,SAAS;YACP,QACEA,2BAAY,SAAS,EAAM,KAAK,EAC7B,EAAA,QAAA,EAAA,WAAW,EACL,CAAA,CAAA,EACV;AACF,SAAA;AACF,KAAA;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/input/TextInput/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/input/TextInput/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -50,7 +50,7 @@ export type TextInputProps = Omit<ComponentPropsWithoutRef<'input'>, 'size' | 'r
|
|
|
50
50
|
*/
|
|
51
51
|
hideLabel?: boolean;
|
|
52
52
|
/**
|
|
53
|
-
* Label Text. Required
|
|
53
|
+
* Label Text. Required due to accessibility. If hideLabel is true, the label is set via aria-label
|
|
54
54
|
*/
|
|
55
55
|
label: string;
|
|
56
56
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../../../src/components/input/TextInput/types.ts"],"sourcesContent":["import type { ComponentPropsWithoutRef, ReactNode } from 'react'\n\nimport type { IconComponent, IconProps } from '../../icon'\n\nexport enum TextInputSize {\n SMALL = 'small',\n DEFAULT = 'default'\n}\n\ntype InternalProps = {\n /**\n * @ignore\n * This prop is for internal use only.\n * Toggles the incorrect error state for the storybook docs\n */\n _incorrectError?: boolean\n /**\n * @ignore\n * This prop is for internal use only.\n * Toggles the hover state for the storybook docs\n */\n _isHovered?: boolean\n /**\n * @ignore\n * This prop is for internal use only.\n * Toggles the focus state for the storybook docs\n */\n _isFocused?: boolean\n /**\n * @ignore\n * This prop is for internal use only.\n * Disabled pointer events for storybook docs\n */\n _disablePointerEvents?: boolean\n}\n\nexport type TextInputProps = Omit<\n ComponentPropsWithoutRef<'input'>,\n // Omitting required purely for storybook docs\n 'size' | 'required'\n> & {\n /**\n * Input sizes. NOTE: small inputs will not show the label\n * @default default\n */\n size?: TextInputSize\n /**\n * Toggles warning state (turns border warning color). NOTE: this is not used any where at the moment\n */\n warning?: boolean\n /**\n * Toggles error state\n */\n error?: boolean\n /**\n * Hides the label. If the label is hidden the placeholder will show by default instead.\n * @default false\n */\n hideLabel?: boolean\n /**\n * Label Text. Required
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../../src/components/input/TextInput/types.ts"],"sourcesContent":["import type { ComponentPropsWithoutRef, ReactNode } from 'react'\n\nimport type { IconComponent, IconProps } from '../../icon'\n\nexport enum TextInputSize {\n SMALL = 'small',\n DEFAULT = 'default'\n}\n\ntype InternalProps = {\n /**\n * @ignore\n * This prop is for internal use only.\n * Toggles the incorrect error state for the storybook docs\n */\n _incorrectError?: boolean\n /**\n * @ignore\n * This prop is for internal use only.\n * Toggles the hover state for the storybook docs\n */\n _isHovered?: boolean\n /**\n * @ignore\n * This prop is for internal use only.\n * Toggles the focus state for the storybook docs\n */\n _isFocused?: boolean\n /**\n * @ignore\n * This prop is for internal use only.\n * Disabled pointer events for storybook docs\n */\n _disablePointerEvents?: boolean\n}\n\nexport type TextInputProps = Omit<\n ComponentPropsWithoutRef<'input'>,\n // Omitting required purely for storybook docs\n 'size' | 'required'\n> & {\n /**\n * Input sizes. NOTE: small inputs will not show the label\n * @default default\n */\n size?: TextInputSize\n /**\n * Toggles warning state (turns border warning color). NOTE: this is not used any where at the moment\n */\n warning?: boolean\n /**\n * Toggles error state\n */\n error?: boolean\n /**\n * Hides the label. If the label is hidden the placeholder will show by default instead.\n * @default false\n */\n hideLabel?: boolean\n /**\n * Label Text. Required due to accessibility. If hideLabel is true, the label is set via aria-label\n */\n label: string\n /**\n * ClassName on the div wrapping the whole input container (doesn't include assistive text)\n */\n inputRootClassName?: string\n /**\n * Helper text (or JSX) that shows up below the input\n */\n helperText?: string | ReactNode\n /**\n * Floating text on the lefthand side of the input.\n */\n startAdornmentText?: string\n /**\n * Floating text on the righthand side of the input\n */\n endAdornmentText?: string\n /**\n * Floating icon on the lefthand side of the input. Note: will float to the left of the label & content\n */\n startIcon?: IconComponent\n /**\n * Floating icon on the righthand side of the input\n */\n endIcon?: IconComponent\n /**\n * Override props to supply the start or end Icon\n */\n IconProps?: Partial<IconProps>\n /**\n * @hidden\n * Floating component on the righthand side of the input. Meant for internal use only.\n */\n endAdornment?: ReactNode\n /**\n * Required or not. Will add an * to the label if required\n */\n required?: boolean\n /**\n * 0-1 number representating a percentage threshold to show the max character text. Default is 0.7 (70%)\n * @default 0.7\n */\n showMaxLengthThreshold?: number\n /**\n * 0-1 number representating a percentage threshold to turn the character limit text orange. Default is 0.9 (90%)\n * @default 0.9\n */\n maxLengthWarningThreshold?: number\n} & InternalProps\n"],"names":[],"mappings":"IAIY,cAGX;AAHD,CAAA,UAAY,aAAa,EAAA;AACvB,IAAA,aAAA,CAAA,OAAA,CAAA,GAAA,OAAe,CAAA;AACf,IAAA,aAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACrB,CAAC,EAHW,aAAa,KAAb,aAAa,GAGxB,EAAA,CAAA,CAAA;;;;"}
|
|
@@ -4,6 +4,7 @@ import { forwardRef, useCallback } from 'react';
|
|
|
4
4
|
import BN from 'bn.js';
|
|
5
5
|
import { useControlled } from '../../../hooks/useControlled.js';
|
|
6
6
|
import { TextInput } from '../TextInput/TextInput.js';
|
|
7
|
+
import '../TextInput/types.js';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Format a number to have commas
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TokenAmountInput.js","sources":["../../../../src/components/input/TokenAmountInput/TokenAmountInput.tsx"],"sourcesContent":["import { ChangeEventHandler, Ref, forwardRef, useCallback } from 'react'\n\nimport BN from 'bn.js'\n\nimport { useControlled } from 'hooks/useControlled'\n\nimport { TextInput } from '../TextInput'\n\nimport { TokenAmountInputProps } from './types'\n\n/**\n * Format a number to have commas\n */\nconst formatNumberCommas = (num: number | string) => {\n const parts = num.toString().split('.')\n return (\n parts[0].replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',') +\n (parts[1] !== undefined ? '.' + parts[1] : '')\n )\n}\n\nexport const TokenAmountInput = forwardRef(\n (props: TokenAmountInputProps, ref: Ref<HTMLInputElement>) => {\n const {\n tokenLabel,\n decimals = 0,\n isWhole = false,\n value: valueProp,\n onChange,\n ...other\n } = props\n\n const [value, setValueState] = useControlled({\n controlledProp: valueProp ? formatNumberCommas(valueProp) : valueProp,\n defaultValue: '',\n componentName: 'TokenAmountInput'\n })\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = useCallback(\n (e) => {\n const input = e.target.value.replace(/[^0-9.]+/g, '')\n // Regex to grab the whole and decimal parts of the number, stripping duplicate '.' characters\n const match = input.match(/^(?<whole>\\d*)(?<dot>.)?(?<decimal>\\d*)/)\n const { whole, decimal, dot } = match?.groups || {}\n\n // Conditionally render the decimal part, and only for the number of decimals specified\n const stringAmount =\n dot && decimals && !isWhole\n ? `${whole}.${decimal.substring(0, decimals)}`\n : whole\n\n // Also add the BN to the onChange event for convenience\n let amount = new BN(whole)\n amount = amount.mul(new BN(10 ** decimals))\n amount = amount.add(new BN(decimal.padEnd(decimals, '0')))\n setValueState(formatNumberCommas(stringAmount))\n if (onChange) {\n onChange(stringAmount, amount)\n }\n },\n [decimals, isWhole, setValueState, onChange]\n )\n return (\n <TextInput\n ref={ref}\n {...other}\n value={value}\n onChange={handleChange}\n endAdornmentText={tokenLabel}\n />\n )\n }\n)\n"],"names":["_jsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"TokenAmountInput.js","sources":["../../../../src/components/input/TokenAmountInput/TokenAmountInput.tsx"],"sourcesContent":["import { ChangeEventHandler, Ref, forwardRef, useCallback } from 'react'\n\nimport BN from 'bn.js'\n\nimport { useControlled } from 'hooks/useControlled'\n\nimport { TextInput } from '../TextInput'\n\nimport { TokenAmountInputProps } from './types'\n\n/**\n * Format a number to have commas\n */\nconst formatNumberCommas = (num: number | string) => {\n const parts = num.toString().split('.')\n return (\n parts[0].replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',') +\n (parts[1] !== undefined ? '.' + parts[1] : '')\n )\n}\n\nexport const TokenAmountInput = forwardRef(\n (props: TokenAmountInputProps, ref: Ref<HTMLInputElement>) => {\n const {\n tokenLabel,\n decimals = 0,\n isWhole = false,\n value: valueProp,\n onChange,\n ...other\n } = props\n\n const [value, setValueState] = useControlled({\n controlledProp: valueProp ? formatNumberCommas(valueProp) : valueProp,\n defaultValue: '',\n componentName: 'TokenAmountInput'\n })\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = useCallback(\n (e) => {\n const input = e.target.value.replace(/[^0-9.]+/g, '')\n // Regex to grab the whole and decimal parts of the number, stripping duplicate '.' characters\n const match = input.match(/^(?<whole>\\d*)(?<dot>.)?(?<decimal>\\d*)/)\n const { whole, decimal, dot } = match?.groups || {}\n\n // Conditionally render the decimal part, and only for the number of decimals specified\n const stringAmount =\n dot && decimals && !isWhole\n ? `${whole}.${decimal.substring(0, decimals)}`\n : whole\n\n // Also add the BN to the onChange event for convenience\n let amount = new BN(whole)\n amount = amount.mul(new BN(10 ** decimals))\n amount = amount.add(new BN(decimal.padEnd(decimals, '0')))\n setValueState(formatNumberCommas(stringAmount))\n if (onChange) {\n onChange(stringAmount, amount)\n }\n },\n [decimals, isWhole, setValueState, onChange]\n )\n return (\n <TextInput\n ref={ref}\n {...other}\n value={value}\n onChange={handleChange}\n endAdornmentText={tokenLabel}\n />\n )\n }\n)\n"],"names":["_jsx"],"mappings":";;;;;;;;AAUA;;AAEG;AACH,IAAM,kBAAkB,GAAG,UAAC,GAAoB,EAAA;IAC9C,IAAM,KAAK,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACvC,QACE,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,uBAAuB,EAAE,GAAG,CAAC;SAC7C,KAAK,CAAC,CAAC,CAAC,KAAK,SAAS,GAAG,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,EAC/C;AACH,CAAC,CAAA;IAEY,gBAAgB,GAAG,UAAU,CACxC,UAAC,KAA4B,EAAE,GAA0B,EAAA;AAErD,IAAA,IAAA,UAAU,GAMR,KAAK,CANG,UAAA,EACV,KAKE,KAAK,CAAA,QALK,EAAZ,QAAQ,mBAAG,CAAC,GAAA,EAAA,EACZ,EAIE,GAAA,KAAK,QAJQ,EAAf,OAAO,GAAG,EAAA,KAAA,KAAA,CAAA,GAAA,KAAK,KAAA,EACR,SAAS,GAGd,KAAK,CAAA,KAHS,EAChB,QAAQ,GAEN,KAAK,CAAA,QAFC,EACL,KAAK,GAAA,MAAA,CACN,KAAK,EAPH,CAAA,YAAA,EAAA,UAAA,EAAA,SAAA,EAAA,OAAA,EAAA,UAAA,CAOL,CADS,CACD;IAEH,IAAA,EAAA,GAAyB,aAAa,CAAC;AAC3C,QAAA,cAAc,EAA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AC,YAAY,CAAC,CAAC,CAAA;AAC/C,QAAA,IAAI,QAAQ,EAAE;AACZ,YAAA,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,CAAA;AAC/B,SAAA;KACF,EACD,CAAC,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,CAAC,CAC7C,CAAA;IACD,QACEA,IAAC,SAAS,EAAA,QAAA,CAAA,EACR,GAAG,EAAE,GAAG,EACJ,EAAA,KAAK,EACT,EAAA,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,YAAY,EACtB,gBAAgB,EAAE,UAAU,EAC5B,CAAA,CAAA,EACH;AACH,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../../src/components/text/Text/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAA4B,MAAM,OAAO,CAAA;AAU7D,eAAO,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../../src/components/text/Text/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAA4B,MAAM,OAAO,CAAA;AAU7D,eAAO,MAAM,IAAI,4WAoEhB,CAAA"}
|
|
@@ -8,10 +8,10 @@ import { variantTagMap, variantStylesMap } from './constants.js';
|
|
|
8
8
|
|
|
9
9
|
var Text = forwardRef(function (props, ref) {
|
|
10
10
|
var _a, _b;
|
|
11
|
-
var children = props.children, variant = props.variant, _c = props.strength, strength = _c === void 0 ? 'default' : _c, _d = props.size, size = _d === void 0 ? 'm' : _d, color = props.color, shadow = props.shadow, tag = props.tag, asChild = props.asChild, textAlign = props.textAlign, other = __rest(props, ["children", "variant", "strength", "size", "color", "shadow", "tag", "asChild", "textAlign"]);
|
|
11
|
+
var children = props.children, variant = props.variant, _c = props.strength, strength = _c === void 0 ? 'default' : _c, _d = props.size, size = _d === void 0 ? 'm' : _d, color = props.color, shadow = props.shadow, tag = props.tag, asChild = props.asChild, textAlign = props.textAlign, ellipses = props.ellipses, other = __rest(props, ["children", "variant", "strength", "size", "color", "shadow", "tag", "asChild", "textAlign", "ellipses"]);
|
|
12
12
|
var theme = useTheme();
|
|
13
13
|
var variantConfig = variant && variantStylesMap[variant];
|
|
14
|
-
var
|
|
14
|
+
var css = __assign(__assign(__assign(__assign(__assign(__assign({ fontFamily: "'Avenir Next LT Pro', 'Helvetica Neue', Helvetica,\n Arial, sans-serif", position: 'relative', boxSizing: 'border-box' }, (color &&
|
|
15
15
|
color === 'heading' && {
|
|
16
16
|
// inline is necessary to prevent text clipping
|
|
17
17
|
display: 'inline',
|
|
@@ -19,19 +19,23 @@ var Text = forwardRef(function (props, ref) {
|
|
|
19
19
|
WebkitTextFillColor: 'transparent',
|
|
20
20
|
backgroundClip: 'text',
|
|
21
21
|
backgroundImage: theme.color.text.heading
|
|
22
|
-
})), (color && color !== 'heading' && { color: theme.color.text[color] })), (variantConfig && __assign(
|
|
22
|
+
})), (color && color !== 'heading' && { color: theme.color.text[color] })), (variantConfig && __assign({
|
|
23
23
|
// @ts-ignore
|
|
24
24
|
fontSize: typography.size[variantConfig.fontSize[size]],
|
|
25
25
|
// @ts-ignore
|
|
26
26
|
lineHeight: typography.lineHeight[variantConfig.lineHeight[size]],
|
|
27
27
|
// @ts-ignore
|
|
28
|
-
fontWeight: typography.weight[variantConfig.fontWeight[strength]] }, ('css' in variantConfig && variantConfig.css)), (shadow && {
|
|
28
|
+
fontWeight: typography.weight[variantConfig.fontWeight[strength]] }, ('css' in variantConfig && variantConfig.css)))), (shadow && {
|
|
29
29
|
textShadow: typography.shadow[shadow]
|
|
30
|
-
})), { textAlign: textAlign })
|
|
30
|
+
})), { textAlign: textAlign }), (ellipses && {
|
|
31
|
+
overflow: 'hidden',
|
|
32
|
+
textOverflow: 'ellipsis',
|
|
33
|
+
whiteSpace: 'nowrap'
|
|
34
|
+
}));
|
|
31
35
|
// @ts-ignore
|
|
32
36
|
var variantTag = variant && ((_a = variantTagMap[variant]) === null || _a === void 0 ? void 0 : _a[size]);
|
|
33
|
-
var Tag = asChild ? Slot : (_b = tag !== null && tag !== void 0 ? tag : variantTag) !== null && _b !== void 0 ? _b : '
|
|
34
|
-
return (jsx(Tag, __assign({ ref: ref, css:
|
|
37
|
+
var Tag = asChild ? Slot : (_b = tag !== null && tag !== void 0 ? tag : variantTag) !== null && _b !== void 0 ? _b : 'span';
|
|
38
|
+
return (jsx(Tag, __assign({ ref: ref, css: css }, other, { children: children })));
|
|
35
39
|
});
|
|
36
40
|
|
|
37
41
|
export { Text };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.js","sources":["../../../../src/components/text/Text/Text.tsx"],"sourcesContent":["import { ElementType, ForwardedRef, forwardRef } from 'react'\n\nimport { useTheme } from '@emotion/react'\nimport { Slot } from '@radix-ui/react-slot'\n\nimport { typography } from '../../../foundations/typography'\n\nimport { variantStylesMap, variantTagMap } from './constants'\nimport type { TextProps } from './types'\n\nexport const Text = forwardRef(\n <TextComponentType extends ElementType = 'p'>(\n props: TextProps<TextComponentType>,\n ref: ForwardedRef<TextComponentType>\n ) => {\n const {\n children,\n variant,\n strength = 'default',\n size = 'm',\n color,\n shadow,\n tag,\n asChild,\n textAlign,\n ...other\n } = props\n\n const theme = useTheme()\n\n const variantConfig = variant && variantStylesMap[variant]\n const
|
|
1
|
+
{"version":3,"file":"Text.js","sources":["../../../../src/components/text/Text/Text.tsx"],"sourcesContent":["import { ElementType, ForwardedRef, forwardRef } from 'react'\n\nimport { useTheme } from '@emotion/react'\nimport { Slot } from '@radix-ui/react-slot'\n\nimport { typography } from '../../../foundations/typography'\n\nimport { variantStylesMap, variantTagMap } from './constants'\nimport type { TextProps } from './types'\n\nexport const Text = forwardRef(\n <TextComponentType extends ElementType = 'p'>(\n props: TextProps<TextComponentType>,\n ref: ForwardedRef<TextComponentType>\n ) => {\n const {\n children,\n variant,\n strength = 'default',\n size = 'm',\n color,\n shadow,\n tag,\n asChild,\n textAlign,\n ellipses,\n ...other\n } = props\n\n const theme = useTheme()\n\n const variantConfig = variant && variantStylesMap[variant]\n const css = {\n fontFamily: `'Avenir Next LT Pro', 'Helvetica Neue', Helvetica,\n Arial, sans-serif`,\n position: 'relative',\n boxSizing: 'border-box',\n ...(color &&\n color === 'heading' && {\n // inline is necessary to prevent text clipping\n display: 'inline',\n color: theme.color.secondary.secondary,\n WebkitTextFillColor: 'transparent',\n backgroundClip: 'text',\n backgroundImage: theme.color.text.heading\n }),\n ...(color && color !== 'heading' && { color: theme.color.text[color] }),\n ...(variantConfig && {\n // @ts-ignore\n fontSize: typography.size[variantConfig.fontSize[size]],\n // @ts-ignore\n lineHeight: typography.lineHeight[variantConfig.lineHeight[size]],\n // @ts-ignore\n fontWeight: typography.weight[variantConfig.fontWeight[strength]],\n ...('css' in variantConfig && variantConfig.css)\n }),\n ...(shadow && {\n textShadow: typography.shadow[shadow]\n }),\n textAlign,\n ...(ellipses && {\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap'\n })\n }\n\n // @ts-ignore\n const variantTag = variant && variantTagMap[variant]?.[size]\n\n const Tag: ElementType = asChild ? Slot : tag ?? variantTag ?? 'span'\n\n return (\n <Tag ref={ref} css={css} {...other}>\n {children}\n </Tag>\n )\n }\n)\n"],"names":["_jsx"],"mappings":";;;;;;;;IAUa,IAAI,GAAG,UAAU,CAC5B,UACE,KAAmC,EACnC,GAAoC,EAAA;;AAGlC,IAAA,IAAA,QAAQ,GAWN,KAAK,CAAA,QAXC,EACR,OAAO,GAUL,KAAK,CAVA,OAAA,EACP,EASE,GAAA,KAAK,SATa,EAApB,QAAQ,GAAG,EAAA,KAAA,KAAA,CAAA,GAAA,SAAS,GAAA,EAAA,EACpB,EAQE,GAAA,KAAK,CARG,IAAA,EAAV,IAAI,GAAA,EAAA,KAAA,KAAA,CAAA,GAAG,GAAG,GAAA,EAAA,EACV,KAAK,GAOH,KAAK,CAAA,KAPF,EACL,MA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AC,CAAC;;QAEjE,UAAU,EAAE,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,EAAA,GAC7D,KAAK,IAAI,aAAa,IAAI,aAAa,CAAC,GAAG,EAChD,EAAC,GACE,MAAM,IAAI;AACZ,QAAA,UAAU,EAAE,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC;AACtC,KAAA,MACD,SAAS,EAAA,SAAA,EACN,CAAA,GAAC,QAAQ,IAAI;AACd,QAAA,QAAQ,EAAE,QAAQ;AAClB,QAAA,YAAY,EAAE,UAAU;AACxB,QAAA,UAAU,EAAE,QAAQ;AACrB,KAAA,EACF,CAAA;;AAGD,IAAA,IAAM,UAAU,GAAG,OAAO,KAAI,CAAA,EAAA,GAAA,aAAa,CAAC,OAAO,CAAC,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAG,IAAI,CAAC,CAAA,CAAA;IAE5D,IAAM,GAAG,GAAgB,OAAO,GAAG,IAAI,GAAG,MAAA,GAAG,KAAA,IAAA,IAAH,GAAG,KAAH,KAAA,CAAA,GAAA,GAAG,GAAI,UAAU,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,MAAM,CAAA;AAErE,IAAA,QACEA,GAAC,CAAA,GAAG,EAAC,QAAA,CAAA,EAAA,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAM,EAAA,KAAK,cAC/B,QAAQ,EAAA,CAAA,CACL,EACP;AACH,CAAC;;;;"}
|
|
@@ -11,6 +11,7 @@ export type BaseTextProps<TextComponentType extends ElementType = 'p'> = {
|
|
|
11
11
|
shadow?: TextShadow;
|
|
12
12
|
asChild?: boolean;
|
|
13
13
|
textAlign?: CSSProperties['textAlign'];
|
|
14
|
+
ellipses?: boolean;
|
|
14
15
|
};
|
|
15
16
|
export type TextProps<TextComponentType extends ElementType = 'p'> = BaseTextProps<TextComponentType> & Omit<ComponentProps<TextComponentType>, keyof BaseTextProps | 'ref'>;
|
|
16
17
|
export type TextStrength = 'weak' | 'default' | 'strong';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/text/Text/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,WAAW,EACX,SAAS,EACV,MAAM,OAAO,CAAA;AAEd,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAA;AAErE,MAAM,MAAM,aAAa,CAAC,iBAAiB,SAAS,WAAW,GAAG,GAAG,IAAI;IACvE,GAAG,CAAC,EAAE,iBAAiB,CAAA;IACvB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,OAAO,CAAC,EAAE,WAAW,CAAA;IACrB,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/text/Text/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,WAAW,EACX,SAAS,EACV,MAAM,OAAO,CAAA;AAEd,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAA;AAErE,MAAM,MAAM,aAAa,CAAC,iBAAiB,SAAS,WAAW,GAAG,GAAG,IAAI;IACvE,GAAG,CAAC,EAAE,iBAAiB,CAAA;IACvB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,OAAO,CAAC,EAAE,WAAW,CAAA;IACrB,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,CAAA;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,SAAS,CAAC,iBAAiB,SAAS,WAAW,GAAG,GAAG,IAC/D,aAAa,CAAC,iBAAiB,CAAC,GAC9B,IAAI,CAAC,cAAc,CAAC,iBAAiB,CAAC,EAAE,MAAM,aAAa,GAAG,KAAK,CAAC,CAAA;AAExE,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAA;AAExD,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,CAAA;AAEpD,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAAA;AAC5E,MAAM,MAAM,UAAU,GAAG,UAAU,CAAA;AACnC,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAA"}
|
|
@@ -1,6 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
/**
|
|
3
3
|
* Also known as hyperlinks, these are words or phrases that can be clicked to navigate to a linked webpage.
|
|
4
4
|
*/
|
|
5
|
-
export declare const TextLink: (props:
|
|
5
|
+
export declare const TextLink: (props: {
|
|
6
|
+
[x: string]: any;
|
|
7
|
+
[x: number]: any;
|
|
8
|
+
[x: symbol]: any;
|
|
9
|
+
} & Omit<import("react").HTMLProps<HTMLAnchorElement>, "size" | "color" | "ref"> & {
|
|
10
|
+
asChild?: boolean | undefined;
|
|
11
|
+
variant?: "default" | "subdued" | "visible" | "inverted" | "secondary" | undefined;
|
|
12
|
+
textVariant?: import("../text/Text").TextVariant | undefined;
|
|
13
|
+
showUnderline?: boolean | undefined;
|
|
14
|
+
isActive?: boolean | undefined;
|
|
15
|
+
isExternal?: boolean | undefined;
|
|
16
|
+
applyHoverStylesToInnerSvg?: boolean | undefined;
|
|
17
|
+
} & import("react").RefAttributes<"a">) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
|
|
6
18
|
//# sourceMappingURL=TextLink.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextLink.d.ts","sourceRoot":"","sources":["../../../src/components/text-link/TextLink.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TextLink.d.ts","sourceRoot":"","sources":["../../../src/components/text-link/TextLink.tsx"],"names":[],"mappings":";AASA;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;wIA2EnB,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __rest, __assign } from '../../_virtual/_tslib.js';
|
|
2
2
|
import { jsx } from '@emotion/react/jsx-runtime';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
3
4
|
import { useTheme } from '@emotion/react';
|
|
4
5
|
import { Slot } from '@radix-ui/react-slot';
|
|
5
6
|
import { Text } from '../text/Text/Text.js';
|
|
@@ -7,20 +8,22 @@ import { Text } from '../text/Text/Text.js';
|
|
|
7
8
|
/**
|
|
8
9
|
* Also known as hyperlinks, these are words or phrases that can be clicked to navigate to a linked webpage.
|
|
9
10
|
*/
|
|
10
|
-
var TextLink = function (props) {
|
|
11
|
-
var _a = props.asChild, asChild = _a === void 0 ? false : _a, children = props.children, _b = props.variant, variant = _b === void 0 ? 'default' : _b, _c = props.isExternal, isExternal = _c === void 0 ? false : _c, onClick = props.onClick, textVariant = props.textVariant, showUnderline = props.showUnderline, applyHoverStylesToInnerSvg = props.applyHoverStylesToInnerSvg, other = __rest(props, ["asChild", "children", "variant", "isExternal", "onClick", "textVariant", "showUnderline", "applyHoverStylesToInnerSvg"]);
|
|
12
|
-
var
|
|
11
|
+
var TextLink = forwardRef(function (props, ref) {
|
|
12
|
+
var _a = props.asChild, asChild = _a === void 0 ? false : _a, children = props.children, _b = props.variant, variant = _b === void 0 ? 'default' : _b, isActive = props.isActive, _c = props.isExternal, isExternal = _c === void 0 ? false : _c, onClick = props.onClick, textVariant = props.textVariant, showUnderline = props.showUnderline, applyHoverStylesToInnerSvg = props.applyHoverStylesToInnerSvg, other = __rest(props, ["asChild", "children", "variant", "isActive", "isExternal", "onClick", "textVariant", "showUnderline", "applyHoverStylesToInnerSvg"]);
|
|
13
|
+
var _d = useTheme(), color = _d.color, spacing = _d.spacing;
|
|
13
14
|
var variantColors = {
|
|
14
15
|
default: color.link.default,
|
|
15
16
|
subdued: color.link.subdued,
|
|
16
17
|
visible: color.link.visible,
|
|
17
|
-
inverted: color.static.white
|
|
18
|
+
inverted: color.static.white,
|
|
19
|
+
secondary: color.secondary.secondary
|
|
18
20
|
};
|
|
19
21
|
var variantHoverColors = {
|
|
20
22
|
default: color.primary.p300,
|
|
21
23
|
subdued: color.primary.p300,
|
|
22
24
|
visible: color.link.visible,
|
|
23
|
-
inverted: color.static.white
|
|
25
|
+
inverted: color.static.white,
|
|
26
|
+
secondary: color.secondary.secondary
|
|
24
27
|
};
|
|
25
28
|
var hoverStyles = __assign({ textDecoration: 'underline', color: variantHoverColors[variant] }, (applyHoverStylesToInnerSvg
|
|
26
29
|
? {
|
|
@@ -29,8 +32,8 @@ var TextLink = function (props) {
|
|
|
29
32
|
}
|
|
30
33
|
}
|
|
31
34
|
: {}));
|
|
32
|
-
return (jsx(Text, __assign({ asChild: true, onClick: onClick, tag: 'a', css: __assign({ color: variantColors[variant], textDecoration: 'none', transition: 'none', ':hover': hoverStyles }, (showUnderline && hoverStyles)), variant: textVariant }, other, { children: asChild ? (jsx(Slot, { children: children })) : (jsx("a", __assign({ target: isExternal ? '_blank' : undefined, rel: isExternal ? 'noreferrer' : undefined }, { children: children }))) })));
|
|
33
|
-
};
|
|
35
|
+
return (jsx(Text, __assign({ ref: ref, asChild: true, onClick: onClick, tag: 'a', css: __assign(__assign({ display: 'inline-flex', gap: spacing.s, color: variantColors[variant], textDecoration: 'none', transition: 'none', ':hover': hoverStyles }, (isActive && __assign(__assign({}, hoverStyles), { textDecoration: 'none' }))), (showUnderline && hoverStyles)), variant: textVariant }, other, { children: asChild ? (jsx(Slot, { children: children })) : (jsx("a", __assign({ target: isExternal ? '_blank' : undefined, rel: isExternal ? 'noreferrer' : undefined }, { children: children }))) })));
|
|
36
|
+
});
|
|
34
37
|
|
|
35
38
|
export { TextLink };
|
|
36
39
|
//# sourceMappingURL=TextLink.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextLink.js","sources":["../../../src/components/text-link/TextLink.tsx"],"sourcesContent":["import { useTheme } from '@emotion/react'\nimport { Slot } from '@radix-ui/react-slot'\n\nimport { Text } from 'components/text/Text'\n\nimport type { TextLinkProps } from './types'\n\n/**\n * Also known as hyperlinks, these are words or phrases that can be clicked to navigate to a linked webpage.\n */\nexport const TextLink = (props: TextLinkProps) => {\n const {\n asChild = false,\n children,\n variant = 'default',\n isExternal = false,\n onClick,\n textVariant,\n showUnderline,\n applyHoverStylesToInnerSvg,\n ...other\n } = props\n\n const { color } = useTheme()\n\n const variantColors = {\n default: color.link.default,\n subdued: color.link.subdued,\n visible: color.link.visible,\n inverted: color.static.white\n }\n\n const variantHoverColors = {\n default: color.primary.p300,\n subdued: color.primary.p300,\n visible: color.link.visible,\n inverted: color.static.white\n }\n\n const hoverStyles = {\n textDecoration: 'underline',\n color: variantHoverColors[variant],\n ...(applyHoverStylesToInnerSvg\n ? {\n path: {\n fill: variantHoverColors[variant]\n }\n }\n : {})\n }\n\n return (\n <Text\n asChild\n onClick={onClick}\n tag='a'\n css={{\n color: variantColors[variant],\n textDecoration: 'none',\n transition: 'none',\n ':hover': hoverStyles,\n ...(showUnderline && hoverStyles)\n }}\n variant={textVariant}\n {...other}\n >\n {asChild ? (\n <Slot>{children}</Slot>\n ) : (\n <a\n target={isExternal ? '_blank' : undefined}\n rel={isExternal ? 'noreferrer' : undefined}\n >\n {children}\n </a>\n )}\n </Text>\n )\n}\n"],"names":["_jsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"TextLink.js","sources":["../../../src/components/text-link/TextLink.tsx"],"sourcesContent":["import { Ref, forwardRef } from 'react'\n\nimport { useTheme } from '@emotion/react'\nimport { Slot } from '@radix-ui/react-slot'\n\nimport { Text } from 'components/text/Text'\n\nimport type { TextLinkProps } from './types'\n\n/**\n * Also known as hyperlinks, these are words or phrases that can be clicked to navigate to a linked webpage.\n */\nexport const TextLink = forwardRef((props: TextLinkProps, ref: Ref<'a'>) => {\n const {\n asChild = false,\n children,\n variant = 'default',\n isActive,\n isExternal = false,\n onClick,\n textVariant,\n showUnderline,\n applyHoverStylesToInnerSvg,\n ...other\n } = props\n\n const { color, spacing } = useTheme()\n\n const variantColors = {\n default: color.link.default,\n subdued: color.link.subdued,\n visible: color.link.visible,\n inverted: color.static.white,\n secondary: color.secondary.secondary\n }\n\n const variantHoverColors = {\n default: color.primary.p300,\n subdued: color.primary.p300,\n visible: color.link.visible,\n inverted: color.static.white,\n secondary: color.secondary.secondary\n }\n\n const hoverStyles = {\n textDecoration: 'underline',\n color: variantHoverColors[variant],\n ...(applyHoverStylesToInnerSvg\n ? {\n path: {\n fill: variantHoverColors[variant]\n }\n }\n : {})\n }\n\n return (\n <Text\n ref={ref}\n asChild\n onClick={onClick}\n tag='a'\n css={{\n display: 'inline-flex',\n gap: spacing.s,\n color: variantColors[variant],\n textDecoration: 'none',\n transition: 'none',\n ':hover': hoverStyles,\n ...(isActive && { ...hoverStyles, textDecoration: 'none' }),\n ...(showUnderline && hoverStyles)\n }}\n variant={textVariant}\n {...other}\n >\n {asChild ? (\n <Slot>{children}</Slot>\n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AER,EAAA,QAAA,EAAA,OAAO,IACNA,GAAA,CAAC,IAAI,EAAA,EAAA,QAAA,EAAE,QAAQ,EAAA,CAAQ,KAEvBA,GAAA,CAAA,GAAA,EAAA,QAAA,CAAA,EACE,MAAM,EAAE,UAAU,GAAG,QAAQ,GAAG,SAAS,EACzC,GAAG,EAAE,UAAU,GAAG,YAAY,GAAG,SAAS,EAEzC,EAAA,EAAA,QAAA,EAAA,QAAQ,EACP,CAAA,CAAA,CACL,EACI,CAAA,CAAA,EACR;AACH,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/text-link/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/text-link/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { HTMLProps } from 'react';
|
|
2
2
|
import type { TextProps } from "../text/Text";
|
|
3
|
-
type TextLinkTextProps = Omit<TextProps
|
|
3
|
+
type TextLinkTextProps = Omit<TextProps<any>, 'variant' | 'color' | 'onClick'>;
|
|
4
4
|
export type TextLinkProps = TextLinkTextProps & Omit<HTMLProps<HTMLAnchorElement>, 'size' | 'color' | 'ref'> & {
|
|
5
5
|
/**
|
|
6
6
|
* Change the default rendered element for the one passed as a child,
|
|
@@ -11,7 +11,7 @@ export type TextLinkProps = TextLinkTextProps & Omit<HTMLProps<HTMLAnchorElement
|
|
|
11
11
|
* Which variant to display.
|
|
12
12
|
* @default default
|
|
13
13
|
*/
|
|
14
|
-
variant?: 'default' | 'subdued' | 'visible' | 'inverted';
|
|
14
|
+
variant?: 'default' | 'subdued' | 'visible' | 'inverted' | 'secondary';
|
|
15
15
|
/**
|
|
16
16
|
* Which text variant to display.
|
|
17
17
|
*/
|
|
@@ -21,6 +21,10 @@ export type TextLinkProps = TextLinkTextProps & Omit<HTMLProps<HTMLAnchorElement
|
|
|
21
21
|
* a text-link is present when next to other text.
|
|
22
22
|
*/
|
|
23
23
|
showUnderline?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* When `true`, render link in active style (e.g. hover color)
|
|
26
|
+
*/
|
|
27
|
+
isActive?: boolean;
|
|
24
28
|
/**
|
|
25
29
|
* Mark as true if the link destination is outside of the app. Causes the
|
|
26
30
|
* link to open in a new tab.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/text-link/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,SAAS,EAAE,qBAA4B;AAErD,KAAK,iBAAiB,GAAG,IAAI,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/text-link/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,SAAS,EAAE,qBAA4B;AAErD,KAAK,iBAAiB,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC,CAAA;AAE9E,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAC3C,IAAI,CACF,SAAS,CAAC,iBAAiB,CAAC,EAE5B,MAAM,GAAG,OAAO,GAAG,KAAK,CACzB,GAAG;IACF;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IAEjB;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,WAAW,CAAA;IAEtE;;OAEG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;IAElC;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IAEvB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IAEpB;;;;OAIG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAA;CACrC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spacing.d.ts","sourceRoot":"","sources":["../../../src/foundations/spacing/spacing.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CnB,CAAA;AAED,eAAO,MAAM,SAAS;;;;;;;;CAQrB,CAAA;AAED,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAA;AACpC,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,CAAA"}
|
|
1
|
+
{"version":3,"file":"spacing.d.ts","sourceRoot":"","sources":["../../../src/foundations/spacing/spacing.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CnB,CAAA;AAED,eAAO,MAAM,SAAS;;;;;;;;CAQrB,CAAA;AAED,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAA;AACpC,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,CAAA;AAC1C,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,SAAS,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spacing.js","sources":["../../../src/foundations/spacing/spacing.ts"],"sourcesContent":["export const spacing = {\n /* --- Base Unit Variables --- */\n unit: 4,\n unitHalf: 2,\n negativeUnit: -4,\n\n /* --- 4*n Unit Variables --- */\n unit1: 4,\n unit2: 8,\n unit3: 12,\n unit4: 16,\n unit5: 20,\n unit6: 24,\n unit7: 28,\n unit8: 32,\n unit9: 36,\n unit10: 40,\n unit11: 44,\n unit12: 48,\n unit13: 52,\n unit14: 56,\n unit15: 60,\n unit16: 64,\n unit17: 68,\n unit18: 72,\n unit19: 76,\n unit20: 80,\n unit21: 84,\n unit22: 88,\n unit23: 92,\n unit24: 96,\n\n /* --- Spacing Variables --- */\n '2xs': 2,\n xs: 4,\n s: 8,\n m: 12,\n l: 16,\n xl: 24,\n '2xl': 32,\n '3xl': 48,\n '4xl': 64,\n '5xl': 128\n}\n\nexport const iconSizes = {\n xs: 14,\n s: 16,\n m: 20,\n l: 24,\n xl: 30,\n '2xl': 32,\n '3xl': 40\n}\n\nexport type Spacing = typeof spacing\nexport type SpacingOptions = keyof Spacing\n"],"names":[],"mappings":"AAAa,IAAA,OAAO,GAAG;;AAErB,IAAA,IAAI,EAAE,CAAC;AACP,IAAA,QAAQ,EAAE,CAAC;IACX,YAAY,EAAE,CAAC,CAAC;;AAGhB,IAAA,KAAK,EAAE,CAAC;AACR,IAAA,KAAK,EAAE,CAAC;AACR,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,MAAM,EAAE,EAAE;;AAGV,IAAA,KAAK,EAAE,CAAC;AACR,IAAA,EAAE,EAAE,CAAC;AACL,IAAA,CAAC,EAAE,CAAC;AACJ,IAAA,CAAC,EAAE,EAAE;AACL,IAAA,CAAC,EAAE,EAAE;AACL,IAAA,EAAE,EAAE,EAAE;AACN,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,KAAK,EAAE,GAAG;EACX;AAEY,IAAA,SAAS,GAAG;AACvB,IAAA,EAAE,EAAE,EAAE;AACN,IAAA,CAAC,EAAE,EAAE;AACL,IAAA,CAAC,EAAE,EAAE;AACL,IAAA,CAAC,EAAE,EAAE;AACL,IAAA,EAAE,EAAE,EAAE;AACN,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,KAAK,EAAE,EAAE;;;;;"}
|
|
1
|
+
{"version":3,"file":"spacing.js","sources":["../../../src/foundations/spacing/spacing.ts"],"sourcesContent":["export const spacing = {\n /* --- Base Unit Variables --- */\n unit: 4,\n unitHalf: 2,\n negativeUnit: -4,\n\n /* --- 4*n Unit Variables --- */\n unit1: 4,\n unit2: 8,\n unit3: 12,\n unit4: 16,\n unit5: 20,\n unit6: 24,\n unit7: 28,\n unit8: 32,\n unit9: 36,\n unit10: 40,\n unit11: 44,\n unit12: 48,\n unit13: 52,\n unit14: 56,\n unit15: 60,\n unit16: 64,\n unit17: 68,\n unit18: 72,\n unit19: 76,\n unit20: 80,\n unit21: 84,\n unit22: 88,\n unit23: 92,\n unit24: 96,\n\n /* --- Spacing Variables --- */\n '2xs': 2,\n xs: 4,\n s: 8,\n m: 12,\n l: 16,\n xl: 24,\n '2xl': 32,\n '3xl': 48,\n '4xl': 64,\n '5xl': 128\n}\n\nexport const iconSizes = {\n xs: 14,\n s: 16,\n m: 20,\n l: 24,\n xl: 30,\n '2xl': 32,\n '3xl': 40\n}\n\nexport type Spacing = typeof spacing\nexport type SpacingOptions = keyof Spacing\nexport type IconSize = keyof typeof iconSizes\n"],"names":[],"mappings":"AAAa,IAAA,OAAO,GAAG;;AAErB,IAAA,IAAI,EAAE,CAAC;AACP,IAAA,QAAQ,EAAE,CAAC;IACX,YAAY,EAAE,CAAC,CAAC;;AAGhB,IAAA,KAAK,EAAE,CAAC;AACR,IAAA,KAAK,EAAE,CAAC;AACR,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,MAAM,EAAE,EAAE;;AAGV,IAAA,KAAK,EAAE,CAAC;AACR,IAAA,EAAE,EAAE,CAAC;AACL,IAAA,CAAC,EAAE,CAAC;AACJ,IAAA,CAAC,EAAE,EAAE;AACL,IAAA,CAAC,EAAE,EAAE;AACL,IAAA,EAAE,EAAE,EAAE;AACN,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,KAAK,EAAE,GAAG;EACX;AAEY,IAAA,SAAS,GAAG;AACvB,IAAA,EAAE,EAAE,EAAE;AACN,IAAA,CAAC,EAAE,EAAE;AACL,IAAA,CAAC,EAAE,EAAE;AACL,IAAA,CAAC,EAAE,EAAE;AACL,IAAA,EAAE,EAAE,EAAE;AACN,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,KAAK,EAAE,EAAE;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../src/foundations/theme/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../src/foundations/theme/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAKtC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEpC,KAAK,kBAAkB,GAAG;IACxB,KAAK,EAAE,KAAK,CAAA;IACZ,QAAQ,EAAE,SAAS,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,aAAa,UAAW,kBAAkB,qDAQtD,CAAA"}
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import { __assign } from '../../_virtual/_tslib.js';
|
|
2
2
|
import { jsx } from '@emotion/react/jsx-runtime';
|
|
3
|
-
import
|
|
4
|
-
import { CacheProvider, ThemeProvider as ThemeProvider$1 } from '@emotion/react';
|
|
3
|
+
import { ThemeProvider as ThemeProvider$1 } from '@emotion/react';
|
|
5
4
|
import { themes } from './theme.js';
|
|
6
5
|
|
|
7
|
-
var harmonyCache = createCache({
|
|
8
|
-
key: 'harmony',
|
|
9
|
-
prepend: true
|
|
10
|
-
});
|
|
11
6
|
var ThemeProvider = function (props) {
|
|
12
7
|
var children = props.children, theme = props.theme;
|
|
13
|
-
return (jsx(
|
|
8
|
+
return (jsx(ThemeProvider$1, __assign({ theme: themes[theme] }, { children: children })));
|
|
14
9
|
};
|
|
15
10
|
|
|
16
11
|
export { ThemeProvider };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeProvider.js","sources":["../../../src/foundations/theme/ThemeProvider.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport
|
|
1
|
+
{"version":3,"file":"ThemeProvider.js","sources":["../../../src/foundations/theme/ThemeProvider.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport { ThemeProvider as EmotionThemeProvider } from '@emotion/react'\n\nimport { themes } from './theme'\nimport type { Theme } from './types'\n\ntype ThemeProviderProps = {\n theme: Theme\n children: ReactNode\n}\n\nexport const ThemeProvider = (props: ThemeProviderProps) => {\n const { children, theme } = props\n\n return (\n <EmotionThemeProvider theme={themes[theme]}>\n {children}\n </EmotionThemeProvider>\n )\n}\n"],"names":["_jsx","EmotionThemeProvider"],"mappings":";;;;;AAYO,IAAM,aAAa,GAAG,UAAC,KAAyB,EAAA;IAC7C,IAAA,QAAQ,GAAY,KAAK,CAAA,QAAjB,EAAE,KAAK,GAAK,KAAK,CAAA,KAAV,CAAU;AAEjC,IAAA,QACEA,GAAA,CAACC,eAAoB,EAAA,QAAA,CAAA,EAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,EAAA,EAAA,EAAA,QAAA,EACvC,QAAQ,EAAA,CAAA,CACY,EACxB;AACH;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -12,6 +12,7 @@ export { iconSizes, spacing } from './foundations/spacing/spacing.js';
|
|
|
12
12
|
export { Avatar } from './components/avatar/Avatar.js';
|
|
13
13
|
export { SelectablePill } from './components/input/SelectablePill/SelectablePill.js';
|
|
14
14
|
export { TextInput } from './components/input/TextInput/TextInput.js';
|
|
15
|
+
export { TextInputSize } from './components/input/TextInput/types.js';
|
|
15
16
|
export { useFocusState } from './components/input/useFocusState.js';
|
|
16
17
|
export { PasswordInput } from './components/input/PasswordInput/PasswordInput.js';
|
|
17
18
|
export { TokenAmountInput } from './components/input/TokenAmountInput/TokenAmountInput.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@audius/harmony",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.28",
|
|
4
4
|
"description": "The Audius Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "Audius",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"react-merge-refs": "2.0.1",
|
|
77
77
|
"react-perfect-scrollbar": "1.5.8",
|
|
78
78
|
"react-spring": "8.0.27",
|
|
79
|
-
"react-use": "
|
|
79
|
+
"react-use": "17.5.0",
|
|
80
80
|
"react-use-measure": "2.1.1",
|
|
81
81
|
"remark-gfm": "3.0.1",
|
|
82
82
|
"rollup": "4.3.0",
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"react-merge-refs": "^2.0.1",
|
|
105
105
|
"react-perfect-scrollbar": "^1.5.8",
|
|
106
106
|
"react-spring": "^8.0.27",
|
|
107
|
-
"react-use": "^
|
|
107
|
+
"react-use": "^17.5.0",
|
|
108
108
|
"react-use-measure": "^2.1.1"
|
|
109
109
|
},
|
|
110
110
|
"dependencies": {
|