@ledgerhq/react-ui 0.37.0 → 0.38.0-nightly.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/lib/cjs/components/form/Radio/RadioElement.js +1 -1
- package/lib/cjs/components/form/Radio/RadioElement.js.map +2 -2
- package/lib/cjs/components/tabs/Chip/index.js +3 -0
- package/lib/cjs/components/tabs/Chip/index.js.map +2 -2
- package/lib/cjs/pre-ldls/components/MarketPercentIndicator/MarketPercentIndicator.js +85 -0
- package/lib/cjs/pre-ldls/components/MarketPercentIndicator/MarketPercentIndicator.js.map +7 -0
- package/lib/cjs/pre-ldls/components/MarketPercentIndicator/MarketPercentIndicator.stories.js +47 -0
- package/lib/cjs/pre-ldls/components/MarketPercentIndicator/MarketPercentIndicator.stories.js.map +7 -0
- package/lib/cjs/pre-ldls/components/MarketPriceIndicator/MarketPriceIndicator.js +77 -0
- package/lib/cjs/pre-ldls/components/MarketPriceIndicator/MarketPriceIndicator.js.map +7 -0
- package/lib/cjs/pre-ldls/components/MarketPriceIndicator/MarketPriceIndicator.stories.js +47 -0
- package/lib/cjs/pre-ldls/components/MarketPriceIndicator/MarketPriceIndicator.stories.js.map +7 -0
- package/lib/cjs/pre-ldls/components/Search/Search.js +25 -2
- package/lib/cjs/pre-ldls/components/Search/Search.js.map +2 -2
- package/lib/cjs/pre-ldls/components/index.js +2 -0
- package/lib/cjs/pre-ldls/components/index.js.map +2 -2
- package/lib/components/form/Radio/RadioElement.d.ts.map +1 -1
- package/lib/components/form/Radio/RadioElement.js +1 -2
- package/lib/components/form/Radio/RadioElement.js.map +1 -1
- package/lib/components/tabs/Chip/index.d.ts.map +1 -1
- package/lib/components/tabs/Chip/index.js +4 -1
- package/lib/components/tabs/Chip/index.js.map +1 -1
- package/lib/pre-ldls/components/MarketPercentIndicator/MarketPercentIndicator.d.ts +5 -0
- package/lib/pre-ldls/components/MarketPercentIndicator/MarketPercentIndicator.d.ts.map +1 -0
- package/lib/pre-ldls/components/MarketPercentIndicator/MarketPercentIndicator.js +34 -0
- package/lib/pre-ldls/components/MarketPercentIndicator/MarketPercentIndicator.js.map +1 -0
- package/lib/pre-ldls/components/MarketPercentIndicator/MarketPercentIndicator.stories.d.ts +10 -0
- package/lib/pre-ldls/components/MarketPercentIndicator/MarketPercentIndicator.stories.d.ts.map +1 -0
- package/lib/pre-ldls/components/MarketPercentIndicator/MarketPercentIndicator.stories.js +20 -0
- package/lib/pre-ldls/components/MarketPercentIndicator/MarketPercentIndicator.stories.js.map +1 -0
- package/lib/pre-ldls/components/MarketPriceIndicator/MarketPriceIndicator.d.ts +6 -0
- package/lib/pre-ldls/components/MarketPriceIndicator/MarketPriceIndicator.d.ts.map +1 -0
- package/lib/pre-ldls/components/MarketPriceIndicator/MarketPriceIndicator.js +32 -0
- package/lib/pre-ldls/components/MarketPriceIndicator/MarketPriceIndicator.js.map +1 -0
- package/lib/pre-ldls/components/MarketPriceIndicator/MarketPriceIndicator.stories.d.ts +10 -0
- package/lib/pre-ldls/components/MarketPriceIndicator/MarketPriceIndicator.stories.d.ts.map +1 -0
- package/lib/pre-ldls/components/MarketPriceIndicator/MarketPriceIndicator.stories.js +20 -0
- package/lib/pre-ldls/components/MarketPriceIndicator/MarketPriceIndicator.stories.js.map +1 -0
- package/lib/pre-ldls/components/Search/Search.d.ts +2 -1
- package/lib/pre-ldls/components/Search/Search.d.ts.map +1 -1
- package/lib/pre-ldls/components/Search/Search.js +12 -3
- package/lib/pre-ldls/components/Search/Search.js.map +1 -1
- package/lib/pre-ldls/components/index.d.ts +2 -0
- package/lib/pre-ldls/components/index.d.ts.map +1 -1
- package/lib/pre-ldls/components/index.js +2 -0
- package/lib/pre-ldls/components/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -196,7 +196,7 @@ const Element = ({
|
|
|
196
196
|
const context = (0, import_react.useContext)(import_index.RadioContext);
|
|
197
197
|
if (context === void 0)
|
|
198
198
|
throw new Error("RadioElement must be used within a RadioProvider");
|
|
199
|
-
const isChecked = (0, import_react.useMemo)(() => context.currentValue
|
|
199
|
+
const isChecked = (0, import_react.useMemo)(() => context.currentValue == value, [context.currentValue, value]);
|
|
200
200
|
const handleChange = (event) => {
|
|
201
201
|
context.onChange(event.target.value);
|
|
202
202
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/components/form/Radio/RadioElement.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, { InputHTMLAttributes, useContext, useMemo } from \"react\";\nimport styled, { css } from \"styled-components\";\n\nimport { rgba } from \"../../../styles/helpers\";\nimport Text from \"../../asorted/Text\";\nimport { RadioContext } from \"./index\";\n\nconst Label = styled(Text)`\n color: var(--ledger-ui-checkbox-color, ${p => p.theme.colors.neutral.c100});\n width: 266px;\n`;\n\nconst Input = styled.input`\n --ledger-ui-checkbox-color: ${p => p.theme.colors.neutral.c50};\n --ledger-ui-checkbox-size: 1.25rem;\n\n position: relative;\n appearance: none;\n width: var(--ledger-ui-checkbox-size);\n height: var(--ledger-ui-checkbox-size);\n flex-shrink: 0;\n border-radius: ${p => `${p.theme.radii[1]}px`};\n border: 1px solid var(--ledger-ui-checkbox-color);\n cursor: pointer;\n\n &:checked::before {\n position: absolute;\n display: block;\n content: \" \";\n background-color: var(--ledger-ui-checkbox-color);\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n margin: auto;\n border-radius: 2px;\n width: calc(var(--ledger-ui-checkbox-size) / 2);\n height: calc(var(--ledger-ui-checkbox-size) / 2);\n }\n\n &[data-variant=\"default\"] {\n :hover {\n --ledger-ui-checkbox-color: ${p => p.theme.colors.primary.c90};\n }\n :active {\n --ledger-ui-checkbox-color: ${p => p.theme.colors.primary.c100};\n }\n :checked,\n :focus {\n --ledger-ui-checkbox-color: ${p => p.theme.colors.primary.c80};\n }\n :focus {\n box-shadow: 0px 0px 0px 4px ${p => rgba(p.theme.colors.primary.c60, 0.48)};\n }\n }\n\n &[data-variant=\"main\"] {\n :hover {\n --ledger-ui-checkbox-color: ${p => p.theme.colors.neutral.c90};\n }\n :active,\n :checked,\n :focus {\n --ledger-ui-checkbox-color: ${p => p.theme.colors.neutral.c100};\n }\n :focus {\n box-shadow: 0px 0px 0px 4px ${p => rgba(p.theme.colors.neutral.c60, 0.48)};\n }\n }\n\n &[data-variant=\"success\"] {\n :hover,\n :checked:not([disabled]),\n :checked:not([disabled]) + ${Label}, :focus {\n --ledger-ui-checkbox-color: ${p => p.theme.colors.success.c50};\n }\n :focus {\n box-shadow: 0px 0px 0px 4px ${p => rgba(p.theme.colors.success.c50, 0.48)};\n }\n }\n\n &[data-variant=\"error\"] {\n :hover,\n :checked:not([disabled]),\n :checked:not([disabled]) + ${Label}, :focus {\n --ledger-ui-checkbox-color: ${p => p.theme.colors.error.c50};\n }\n :focus {\n box-shadow: 0px 0px 0px 4px ${p => rgba(p.theme.colors.error.c50, 0.48)};\n }\n }\n\n &[data-variant]:disabled {\n --ledger-ui-checkbox-color: ${p => p.theme.colors.neutral.c40};\n cursor: unset;\n background-color: ${p => p.theme.colors.neutral.c30};\n }\n`;\n\nconst outlinedCSS = css`\n padding: 20px;\n border: 1px solid ${p => p.theme.colors.neutral.c50};\n border-radius: ${p => p.theme.radii[2]}px;\n &[data-variant=\"default\"] {\n :hover {\n border-color: ${p => p.theme.colors.primary.c90};\n }\n &[data-checked] :active {\n border-color: ${p => p.theme.colors.primary.c100};\n }\n :focus {\n border-color: ${p => p.theme.colors.primary.c80};\n }\n }\n\n &[data-variant=\"main\"] {\n :hover {\n border-color: ${p => p.theme.colors.neutral.c90};\n }\n &[data-checked],\n :active :focus {\n border-color: ${p => p.theme.colors.neutral.c100};\n }\n }\n\n &[data-variant=\"success\"] {\n &[data-checked]:not([disabled]) {\n border-color: ${p => p.theme.colors.success.c50};\n }\n :hover {\n border-color: ${p => p.theme.colors.success.c50};\n }\n }\n\n &[data-variant=\"error\"] {\n &[data-checked]:not([disabled]) {\n border-color: ${p => p.theme.colors.error.c50};\n }\n :hover {\n border-color: ${p => p.theme.colors.error.c50};\n }\n }\n\n &[data-variant]:disabled {\n border-color: ${p => p.theme.colors.neutral.c40};\n cursor: unset;\n }\n`;\n\nconst RadioElement = styled.label.attrs({ tabIndex: -1 })<{\n outlined?: boolean;\n}>`\n display: inline-flex;\n column-gap: 0.75rem;\n align-items: center;\n cursor: pointer;\n &[data-variant]:disabled {\n cursor: unset;\n }\n ${p => p.outlined && outlinedCSS}\n`;\n\ntype InputAttributes = Omit<InputHTMLAttributes<HTMLInputElement>, \"type\" | \"onChange\" | \"name\">;\n\nexport type RadioElementProps = InputAttributes & {\n variant?: \"default\" | \"main\" | \"success\" | \"error\";\n label: string;\n outlined?: boolean;\n};\n\nconst Element = ({\n label,\n value,\n disabled,\n outlined,\n variant = \"default\",\n ...props\n}: RadioElementProps): JSX.Element => {\n const context = useContext(RadioContext);\n if (context === undefined) throw new Error(\"RadioElement must be used within a RadioProvider\");\n\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAgE;AAChE,+BAA4B;AAE5B,qBAAqB;AACrB,kBAAiB;AACjB,mBAA6B;AAE7B,MAAM,YAAQ,yBAAAA,SAAO,YAAAC,OAAI;AAAA,2CACkB,OAAK,EAAE,MAAM,OAAO,QAAQ,IAAI;AAAA;AAAA;AAI3E,MAAM,QAAQ,yBAAAD,QAAO;AAAA,gCACW,OAAK,EAAE,MAAM,OAAO,QAAQ,GAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAQ5C,OAAK,GAAG,EAAE,MAAM,MAAM,CAAC,CAAC,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oCAqBX,OAAK,EAAE,MAAM,OAAO,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AAQ,IAAI;AAAA;AAAA;AAAA,sBAGhC,OAAK,EAAE,MAAM,OAAO,QAAQ,GAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAM/B,OAAK,EAAE,MAAM,OAAO,QAAQ,GAAG;AAAA;AAAA;AAAA;AAAA,sBAI/B,OAAK,EAAE,MAAM,OAAO,QAAQ,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAMhC,OAAK,EAAE,MAAM,OAAO,QAAQ,GAAG;AAAA;AAAA;AAAA,sBAG/B,OAAK,EAAE,MAAM,OAAO,QAAQ,GAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAM/B,OAAK,EAAE,MAAM,OAAO,MAAM,GAAG;AAAA;AAAA;AAAA,sBAG7B,OAAK,EAAE,MAAM,OAAO,MAAM,GAAG;AAAA;AAAA;AAAA;AAAA;AAAA,oBAK/B,OAAK,EAAE,MAAM,OAAO,QAAQ,GAAG;AAAA;AAAA;AAAA;AAKnD,MAAM,eAAe,yBAAAA,QAAO,MAAM,MAAM,EAAE,UAAU,GAAG,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAUpD,OAAK,EAAE,YAAY,WAAW;AAAA;AAWlC,MAAM,UAAU,CAAC;AAAA,EACf;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV,GAAG;AACL,MAAsC;AACpC,QAAM,cAAU,yBAAW,yBAAY;AACvC,MAAI,YAAY;AAAW,UAAM,IAAI,MAAM,kDAAkD;
|
|
4
|
+
"sourcesContent": ["import React, { InputHTMLAttributes, useContext, useMemo } from \"react\";\nimport styled, { css } from \"styled-components\";\n\nimport { rgba } from \"../../../styles/helpers\";\nimport Text from \"../../asorted/Text\";\nimport { RadioContext } from \"./index\";\n\nconst Label = styled(Text)`\n color: var(--ledger-ui-checkbox-color, ${p => p.theme.colors.neutral.c100});\n width: 266px;\n`;\n\nconst Input = styled.input`\n --ledger-ui-checkbox-color: ${p => p.theme.colors.neutral.c50};\n --ledger-ui-checkbox-size: 1.25rem;\n\n position: relative;\n appearance: none;\n width: var(--ledger-ui-checkbox-size);\n height: var(--ledger-ui-checkbox-size);\n flex-shrink: 0;\n border-radius: ${p => `${p.theme.radii[1]}px`};\n border: 1px solid var(--ledger-ui-checkbox-color);\n cursor: pointer;\n\n &:checked::before {\n position: absolute;\n display: block;\n content: \" \";\n background-color: var(--ledger-ui-checkbox-color);\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n margin: auto;\n border-radius: 2px;\n width: calc(var(--ledger-ui-checkbox-size) / 2);\n height: calc(var(--ledger-ui-checkbox-size) / 2);\n }\n\n &[data-variant=\"default\"] {\n :hover {\n --ledger-ui-checkbox-color: ${p => p.theme.colors.primary.c90};\n }\n :active {\n --ledger-ui-checkbox-color: ${p => p.theme.colors.primary.c100};\n }\n :checked,\n :focus {\n --ledger-ui-checkbox-color: ${p => p.theme.colors.primary.c80};\n }\n :focus {\n box-shadow: 0px 0px 0px 4px ${p => rgba(p.theme.colors.primary.c60, 0.48)};\n }\n }\n\n &[data-variant=\"main\"] {\n :hover {\n --ledger-ui-checkbox-color: ${p => p.theme.colors.neutral.c90};\n }\n :active,\n :checked,\n :focus {\n --ledger-ui-checkbox-color: ${p => p.theme.colors.neutral.c100};\n }\n :focus {\n box-shadow: 0px 0px 0px 4px ${p => rgba(p.theme.colors.neutral.c60, 0.48)};\n }\n }\n\n &[data-variant=\"success\"] {\n :hover,\n :checked:not([disabled]),\n :checked:not([disabled]) + ${Label}, :focus {\n --ledger-ui-checkbox-color: ${p => p.theme.colors.success.c50};\n }\n :focus {\n box-shadow: 0px 0px 0px 4px ${p => rgba(p.theme.colors.success.c50, 0.48)};\n }\n }\n\n &[data-variant=\"error\"] {\n :hover,\n :checked:not([disabled]),\n :checked:not([disabled]) + ${Label}, :focus {\n --ledger-ui-checkbox-color: ${p => p.theme.colors.error.c50};\n }\n :focus {\n box-shadow: 0px 0px 0px 4px ${p => rgba(p.theme.colors.error.c50, 0.48)};\n }\n }\n\n &[data-variant]:disabled {\n --ledger-ui-checkbox-color: ${p => p.theme.colors.neutral.c40};\n cursor: unset;\n background-color: ${p => p.theme.colors.neutral.c30};\n }\n`;\n\nconst outlinedCSS = css`\n padding: 20px;\n border: 1px solid ${p => p.theme.colors.neutral.c50};\n border-radius: ${p => p.theme.radii[2]}px;\n &[data-variant=\"default\"] {\n :hover {\n border-color: ${p => p.theme.colors.primary.c90};\n }\n &[data-checked] :active {\n border-color: ${p => p.theme.colors.primary.c100};\n }\n :focus {\n border-color: ${p => p.theme.colors.primary.c80};\n }\n }\n\n &[data-variant=\"main\"] {\n :hover {\n border-color: ${p => p.theme.colors.neutral.c90};\n }\n &[data-checked],\n :active :focus {\n border-color: ${p => p.theme.colors.neutral.c100};\n }\n }\n\n &[data-variant=\"success\"] {\n &[data-checked]:not([disabled]) {\n border-color: ${p => p.theme.colors.success.c50};\n }\n :hover {\n border-color: ${p => p.theme.colors.success.c50};\n }\n }\n\n &[data-variant=\"error\"] {\n &[data-checked]:not([disabled]) {\n border-color: ${p => p.theme.colors.error.c50};\n }\n :hover {\n border-color: ${p => p.theme.colors.error.c50};\n }\n }\n\n &[data-variant]:disabled {\n border-color: ${p => p.theme.colors.neutral.c40};\n cursor: unset;\n }\n`;\n\nconst RadioElement = styled.label.attrs({ tabIndex: -1 })<{\n outlined?: boolean;\n}>`\n display: inline-flex;\n column-gap: 0.75rem;\n align-items: center;\n cursor: pointer;\n &[data-variant]:disabled {\n cursor: unset;\n }\n ${p => p.outlined && outlinedCSS}\n`;\n\ntype InputAttributes = Omit<InputHTMLAttributes<HTMLInputElement>, \"type\" | \"onChange\" | \"name\">;\n\nexport type RadioElementProps = InputAttributes & {\n variant?: \"default\" | \"main\" | \"success\" | \"error\";\n label: string;\n outlined?: boolean;\n};\n\nconst Element = ({\n label,\n value,\n disabled,\n outlined,\n variant = \"default\",\n ...props\n}: RadioElementProps): JSX.Element => {\n const context = useContext(RadioContext);\n if (context === undefined) throw new Error(\"RadioElement must be used within a RadioProvider\");\n\n const isChecked = useMemo(() => context.currentValue == value, [context.currentValue, value]);\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n context.onChange(event.target.value);\n };\n\n return (\n <RadioElement\n data-variant={variant}\n {...(isChecked ? { \"data-checked\": true } : {})}\n outlined={outlined}\n >\n <Input\n type=\"radio\"\n data-variant={variant}\n checked={isChecked}\n disabled={disabled}\n onChange={handleChange}\n value={value}\n name={context.name}\n {...props}\n />\n <Label variant=\"paragraph\">{label}</Label>\n </RadioElement>\n );\n};\n\nElement.displayName = \"Radio.Element\"; // For easy identification in the React devtools & in storybook\nElement.Label = Label;\n\nexport default Element;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAgE;AAChE,+BAA4B;AAE5B,qBAAqB;AACrB,kBAAiB;AACjB,mBAA6B;AAE7B,MAAM,YAAQ,yBAAAA,SAAO,YAAAC,OAAI;AAAA,2CACkB,OAAK,EAAE,MAAM,OAAO,QAAQ,IAAI;AAAA;AAAA;AAI3E,MAAM,QAAQ,yBAAAD,QAAO;AAAA,gCACW,OAAK,EAAE,MAAM,OAAO,QAAQ,GAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAQ5C,OAAK,GAAG,EAAE,MAAM,MAAM,CAAC,CAAC,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oCAqBX,OAAK,EAAE,MAAM,OAAO,QAAQ,GAAG;AAAA;AAAA;AAAA,oCAG/B,OAAK,EAAE,MAAM,OAAO,QAAQ,IAAI;AAAA;AAAA;AAAA;AAAA,oCAIhC,OAAK,EAAE,MAAM,OAAO,QAAQ,GAAG;AAAA;AAAA;AAA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AA,QACV;AAAA,QACA,MAAM,QAAQ;AAAA,QACb,GAAG;AAAA;AAAA,IACN;AAAA,IACA,6BAAAA,QAAA,cAAC,SAAM,SAAQ,eAAa,KAAM;AAAA,EACpC;AAEJ;AAEA,QAAQ,cAAc;AACtB,QAAQ,QAAQ;AAEhB,IAAO,uBAAQ;",
|
|
6
6
|
"names": ["styled", "Text", "React"]
|
|
7
7
|
}
|
|
@@ -56,6 +56,9 @@ const Item = (0, import_styled_components.default)(import_Flex.default).attrs({
|
|
|
56
56
|
`;
|
|
57
57
|
function BarTabs({ children, onTabChange, initialActiveIndex }) {
|
|
58
58
|
const [activeIndex, setActiveIndex] = (0, import_react.useState)(initialActiveIndex);
|
|
59
|
+
(0, import_react.useEffect)(() => {
|
|
60
|
+
setActiveIndex(initialActiveIndex);
|
|
61
|
+
}, [initialActiveIndex]);
|
|
59
62
|
return /* @__PURE__ */ import_react.default.createElement(Container, null, import_react.default.Children.toArray(children).map((child, index) => /* @__PURE__ */ import_react.default.createElement(
|
|
60
63
|
Item,
|
|
61
64
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/components/tabs/Chip/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, { useState } from \"react\";\nimport styled from \"styled-components\";\nimport Flex from \"../../layout/Flex\";\n\nexport type Props = React.PropsWithChildren<{\n /**\n * An optional callback that will be called when the active tab changes.\n */\n onTabChange?: (activeIndex: number) => void;\n /**\n * The tab index to mark as active when rendering for the first time.\n * If omitted, then initially no tabs will be selected.\n */\n initialActiveIndex?: number;\n}>;\ntype ItemProps = {\n active: boolean;\n};\n\nconst Container = styled(Flex).attrs({\n justifyContent: \"space-between\",\n flex: 1,\n columnGap: 1,\n})`\n border: 1px solid ${p => p.theme.colors.opacityDefault.c10};\n border-radius: 12px;\n padding: 4px;\n`;\n\nconst Item = styled(Flex).attrs({\n flex: 1,\n justifyContent: \"center\",\n alignItems: \"center\",\n})<ItemProps>`\n cursor: pointer;\n padding: 8px 12px 8px 12px;\n border-radius: 10px;\n color: ${p => (p.active ? p.theme.colors.neutral.c100 : p.theme.colors.neutral.c50)};\n background-color: ${p => (p.active ? p.theme.colors.opacityDefault.c10 : \"unset\")};\n`;\n\nexport default function BarTabs({ children, onTabChange, initialActiveIndex }: Props): JSX.Element {\n const [activeIndex, setActiveIndex] = useState(initialActiveIndex);\n return (\n <Container>\n {React.Children.toArray(children).map((child, index) => (\n <Item\n key={index}\n active={index === activeIndex}\n onClick={() => {\n setActiveIndex(index);\n onTabChange && onTabChange(index);\n }}\n >\n {child}\n </Item>\n ))}\n </Container>\n );\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
4
|
+
"sourcesContent": ["import React, { useState, useEffect } from \"react\";\nimport styled from \"styled-components\";\nimport Flex from \"../../layout/Flex\";\n\nexport type Props = React.PropsWithChildren<{\n /**\n * An optional callback that will be called when the active tab changes.\n */\n onTabChange?: (activeIndex: number) => void;\n /**\n * The tab index to mark as active when rendering for the first time.\n * If omitted, then initially no tabs will be selected.\n */\n initialActiveIndex?: number;\n}>;\ntype ItemProps = {\n active: boolean;\n};\n\nconst Container = styled(Flex).attrs({\n justifyContent: \"space-between\",\n flex: 1,\n columnGap: 1,\n})`\n border: 1px solid ${p => p.theme.colors.opacityDefault.c10};\n border-radius: 12px;\n padding: 4px;\n`;\n\nconst Item = styled(Flex).attrs({\n flex: 1,\n justifyContent: \"center\",\n alignItems: \"center\",\n})<ItemProps>`\n cursor: pointer;\n padding: 8px 12px 8px 12px;\n border-radius: 10px;\n color: ${p => (p.active ? p.theme.colors.neutral.c100 : p.theme.colors.neutral.c50)};\n background-color: ${p => (p.active ? p.theme.colors.opacityDefault.c10 : \"unset\")};\n`;\n\nexport default function BarTabs({ children, onTabChange, initialActiveIndex }: Props): JSX.Element {\n const [activeIndex, setActiveIndex] = useState(initialActiveIndex);\n\n useEffect(() => {\n setActiveIndex(initialActiveIndex);\n }, [initialActiveIndex]);\n\n return (\n <Container>\n {React.Children.toArray(children).map((child, index) => (\n <Item\n key={index}\n active={index === activeIndex}\n onClick={() => {\n setActiveIndex(index);\n onTabChange && onTabChange(index);\n }}\n >\n {child}\n </Item>\n ))}\n </Container>\n );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA2C;AAC3C,+BAAmB;AACnB,kBAAiB;AAiBjB,MAAM,gBAAY,yBAAAA,SAAO,YAAAC,OAAI,EAAE,MAAM;AAAA,EACnC,gBAAgB;AAAA,EAChB,MAAM;AAAA,EACN,WAAW;AACb,CAAC;AAAA,sBACqB,OAAK,EAAE,MAAM,OAAO,eAAe,GAAG;AAAA;AAAA;AAAA;AAK5D,MAAM,WAAO,yBAAAD,SAAO,YAAAC,OAAI,EAAE,MAAM;AAAA,EAC9B,MAAM;AAAA,EACN,gBAAgB;AAAA,EAChB,YAAY;AACd,CAAC;AAAA;AAAA;AAAA;AAAA,WAIU,OAAM,EAAE,SAAS,EAAE,MAAM,OAAO,QAAQ,OAAO,EAAE,MAAM,OAAO,QAAQ,GAAI;AAAA,sBAC/D,OAAM,EAAE,SAAS,EAAE,MAAM,OAAO,eAAe,MAAM,OAAQ;AAAA;AAGpE,SAAR,QAAyB,EAAE,UAAU,aAAa,mBAAmB,GAAuB;AACjG,QAAM,CAAC,aAAa,cAAc,QAAI,uBAAS,kBAAkB;AAEjE,8BAAU,MAAM;AACd,mBAAe,kBAAkB;AAAA,EACnC,GAAG,CAAC,kBAAkB,CAAC;AAEvB,SACE,6BAAAC,QAAA,cAAC,iBACE,aAAAA,QAAM,SAAS,QAAQ,QAAQ,EAAE,IAAI,CAAC,OAAO,UAC5C,6BAAAA,QAAA;AAAA,IAAC;AAAA;AAAA,MACC,KAAK;AAAA,MACL,QAAQ,UAAU;AAAA,MAClB,SAAS,MAAM;AACb,uBAAe,KAAK;AACpB,uBAAe,YAAY,KAAK;AAAA,MAClC;AAAA;AAAA,IAEC;AAAA,EACH,CACD,CACH;AAEJ;",
|
|
6
6
|
"names": ["styled", "Flex", "React"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var MarketPercentIndicator_exports = {};
|
|
30
|
+
__export(MarketPercentIndicator_exports, {
|
|
31
|
+
MarketPercentIndicator: () => MarketPercentIndicator
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(MarketPercentIndicator_exports);
|
|
34
|
+
var import_react = __toESM(require("react"));
|
|
35
|
+
var import_components = require("../../../components");
|
|
36
|
+
var import_styled_components = __toESM(require("styled-components"));
|
|
37
|
+
var import_libs = require("../../libs");
|
|
38
|
+
const Wrapper = (0, import_styled_components.default)(import_components.Flex)`
|
|
39
|
+
${(0, import_libs.withTokens)(
|
|
40
|
+
"colors-surface-status-success-default",
|
|
41
|
+
"colors-surface-status-success-strong-default",
|
|
42
|
+
"colors-surface-status-error-default",
|
|
43
|
+
"colors-surface-status-error-strong-default",
|
|
44
|
+
"colors-surface-transparent-hover",
|
|
45
|
+
"colors-content-default-default"
|
|
46
|
+
)}
|
|
47
|
+
`;
|
|
48
|
+
const getPercentageDisplay = (percent) => {
|
|
49
|
+
if (percent > 0) {
|
|
50
|
+
return {
|
|
51
|
+
backgroundColor: "var(--colors-surface-status-success-default)",
|
|
52
|
+
color: "var(--colors-surface-status-success-strong-default)",
|
|
53
|
+
text: `+${percent}%`
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
if (percent < 0) {
|
|
57
|
+
return {
|
|
58
|
+
backgroundColor: "var(--colors-surface-status-error-default)",
|
|
59
|
+
color: "var(--colors-surface-status-error-strong-default)",
|
|
60
|
+
text: `-${Math.abs(percent)}%`
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
backgroundColor: "var(--colors-surface-transparent-hover)",
|
|
65
|
+
color: "var(--colors-content-default-default)",
|
|
66
|
+
text: `${percent}%`
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
const MarketPercentIndicator = ({ percent }) => {
|
|
70
|
+
const percentageDisplay = getPercentageDisplay(percent);
|
|
71
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
72
|
+
Wrapper,
|
|
73
|
+
{
|
|
74
|
+
"data-testid": "market-percent-indicator",
|
|
75
|
+
flexDirection: "column",
|
|
76
|
+
alignItems: "flex-end",
|
|
77
|
+
width: "fit-content",
|
|
78
|
+
p: "4px",
|
|
79
|
+
borderRadius: "4px",
|
|
80
|
+
backgroundColor: percentageDisplay.backgroundColor
|
|
81
|
+
},
|
|
82
|
+
/* @__PURE__ */ import_react.default.createElement(import_components.Text, { color: percentageDisplay.color, fontSize: "12px" }, percentageDisplay.text)
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
//# sourceMappingURL=MarketPercentIndicator.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/pre-ldls/components/MarketPercentIndicator/MarketPercentIndicator.tsx"],
|
|
4
|
+
"sourcesContent": ["import React from \"react\";\nimport { Flex, Text } from \"../../../components\";\nimport styled from \"styled-components\";\nimport { withTokens } from \"../../libs\";\n\nconst Wrapper = styled(Flex)`\n ${withTokens(\n \"colors-surface-status-success-default\",\n \"colors-surface-status-success-strong-default\",\n \"colors-surface-status-error-default\",\n \"colors-surface-status-error-strong-default\",\n \"colors-surface-transparent-hover\",\n \"colors-content-default-default\",\n )}\n`;\n\nconst getPercentageDisplay = (percent: number) => {\n if (percent > 0) {\n return {\n backgroundColor: \"var(--colors-surface-status-success-default)\",\n color: \"var(--colors-surface-status-success-strong-default)\",\n text: `+${percent}%`,\n };\n }\n if (percent < 0) {\n return {\n backgroundColor: \"var(--colors-surface-status-error-default)\",\n color: \"var(--colors-surface-status-error-strong-default)\",\n text: `-${Math.abs(percent)}%`,\n };\n }\n return {\n backgroundColor: \"var(--colors-surface-transparent-hover)\",\n color: \"var(--colors-content-default-default)\",\n text: `${percent}%`,\n };\n};\n\nexport const MarketPercentIndicator = ({ percent }: { percent: number }) => {\n const percentageDisplay = getPercentageDisplay(percent);\n\n return (\n <Wrapper\n data-testid=\"market-percent-indicator\"\n flexDirection=\"column\"\n alignItems=\"flex-end\"\n width=\"fit-content\"\n p=\"4px\"\n borderRadius=\"4px\"\n backgroundColor={percentageDisplay.backgroundColor}\n >\n <Text color={percentageDisplay.color} fontSize=\"12px\">\n {percentageDisplay.text}\n </Text>\n </Wrapper>\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,wBAA2B;AAC3B,+BAAmB;AACnB,kBAA2B;AAE3B,MAAM,cAAU,yBAAAA,SAAO,sBAAI;AAAA,QACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAAA;AAGH,MAAM,uBAAuB,CAAC,YAAoB;AAChD,MAAI,UAAU,GAAG;AACf,WAAO;AAAA,MACL,iBAAiB;AAAA,MACjB,OAAO;AAAA,MACP,MAAM,IAAI,OAAO;AAAA,IACnB;AAAA,EACF;AACA,MAAI,UAAU,GAAG;AACf,WAAO;AAAA,MACL,iBAAiB;AAAA,MACjB,OAAO;AAAA,MACP,MAAM,IAAI,KAAK,IAAI,OAAO,CAAC;AAAA,IAC7B;AAAA,EACF;AACA,SAAO;AAAA,IACL,iBAAiB;AAAA,IACjB,OAAO;AAAA,IACP,MAAM,GAAG,OAAO;AAAA,EAClB;AACF;AAEO,MAAM,yBAAyB,CAAC,EAAE,QAAQ,MAA2B;AAC1E,QAAM,oBAAoB,qBAAqB,OAAO;AAEtD,SACE,6BAAAC,QAAA;AAAA,IAAC;AAAA;AAAA,MACC,eAAY;AAAA,MACZ,eAAc;AAAA,MACd,YAAW;AAAA,MACX,OAAM;AAAA,MACN,GAAE;AAAA,MACF,cAAa;AAAA,MACb,iBAAiB,kBAAkB;AAAA;AAAA,IAEnC,6BAAAA,QAAA,cAAC,0BAAK,OAAO,kBAAkB,OAAO,UAAS,UAC5C,kBAAkB,IACrB;AAAA,EACF;AAEJ;",
|
|
6
|
+
"names": ["styled", "React"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var MarketPercentIndicator_stories_exports = {};
|
|
20
|
+
__export(MarketPercentIndicator_stories_exports, {
|
|
21
|
+
Negative: () => Negative,
|
|
22
|
+
Positive: () => Positive,
|
|
23
|
+
TestMarketPercentIndicator: () => TestMarketPercentIndicator,
|
|
24
|
+
Zero: () => Zero,
|
|
25
|
+
default: () => MarketPercentIndicator_stories_default
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(MarketPercentIndicator_stories_exports);
|
|
28
|
+
var import_MarketPercentIndicator = require("./MarketPercentIndicator");
|
|
29
|
+
var import_test = require("@storybook/test");
|
|
30
|
+
const meta = {
|
|
31
|
+
component: import_MarketPercentIndicator.MarketPercentIndicator,
|
|
32
|
+
title: "PreLdls/Components/MarketPercentIndicator",
|
|
33
|
+
tags: ["autodocs"],
|
|
34
|
+
args: { percent: 30 }
|
|
35
|
+
};
|
|
36
|
+
var MarketPercentIndicator_stories_default = meta;
|
|
37
|
+
const Positive = { args: { percent: 30 } };
|
|
38
|
+
const Negative = { args: { percent: -30 } };
|
|
39
|
+
const Zero = { args: { percent: 0 } };
|
|
40
|
+
const TestMarketPercentIndicator = {
|
|
41
|
+
play: async ({ canvasElement }) => {
|
|
42
|
+
const canvas = (0, import_test.within)(canvasElement);
|
|
43
|
+
const input = canvas.getByTestId("market-percent-indicator");
|
|
44
|
+
await (0, import_test.expect)(input).toHaveTextContent("+30%");
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=MarketPercentIndicator.stories.js.map
|
package/lib/cjs/pre-ldls/components/MarketPercentIndicator/MarketPercentIndicator.stories.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/pre-ldls/components/MarketPercentIndicator/MarketPercentIndicator.stories.ts"],
|
|
4
|
+
"sourcesContent": ["import type { Meta, StoryObj } from \"@storybook/react\";\nimport { MarketPercentIndicator } from \"./MarketPercentIndicator\";\nimport { expect, within } from \"@storybook/test\";\n\nconst meta: Meta<typeof MarketPercentIndicator> = {\n component: MarketPercentIndicator,\n title: \"PreLdls/Components/MarketPercentIndicator\",\n tags: [\"autodocs\"],\n args: { percent: 30 },\n};\nexport default meta;\n\ntype Story = StoryObj<typeof MarketPercentIndicator>;\n\nexport const Positive: Story = { args: { percent: 30 } };\nexport const Negative: Story = { args: { percent: -30 } };\nexport const Zero: Story = { args: { percent: 0 } };\n\nexport const TestMarketPercentIndicator: Story = {\n play: async ({ canvasElement }: { canvasElement: HTMLElement }) => {\n const canvas = within(canvasElement);\n const input = canvas.getByTestId(\"market-percent-indicator\");\n await expect(input).toHaveTextContent(\"+30%\");\n },\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oCAAuC;AACvC,kBAA+B;AAE/B,MAAM,OAA4C;AAAA,EAChD,WAAW;AAAA,EACX,OAAO;AAAA,EACP,MAAM,CAAC,UAAU;AAAA,EACjB,MAAM,EAAE,SAAS,GAAG;AACtB;AACA,IAAO,yCAAQ;AAIR,MAAM,WAAkB,EAAE,MAAM,EAAE,SAAS,GAAG,EAAE;AAChD,MAAM,WAAkB,EAAE,MAAM,EAAE,SAAS,IAAI,EAAE;AACjD,MAAM,OAAc,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE;AAE3C,MAAM,6BAAoC;AAAA,EAC/C,MAAM,OAAO,EAAE,cAAc,MAAsC;AACjE,UAAM,aAAS,oBAAO,aAAa;AACnC,UAAM,QAAQ,OAAO,YAAY,0BAA0B;AAC3D,cAAM,oBAAO,KAAK,EAAE,kBAAkB,MAAM;AAAA,EAC9C;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var MarketPriceIndicator_exports = {};
|
|
30
|
+
__export(MarketPriceIndicator_exports, {
|
|
31
|
+
MarketPriceIndicator: () => MarketPriceIndicator
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(MarketPriceIndicator_exports);
|
|
34
|
+
var import_react = __toESM(require("react"));
|
|
35
|
+
var import_components = require("../../../components");
|
|
36
|
+
var import_styled_components = __toESM(require("styled-components"));
|
|
37
|
+
var import_libs = require("../../libs");
|
|
38
|
+
const Wrapper = (0, import_styled_components.default)(import_components.Flex)`
|
|
39
|
+
${(0, import_libs.withTokens)(
|
|
40
|
+
"colors-surface-status-success-strong-default",
|
|
41
|
+
"colors-surface-status-error-strong-default",
|
|
42
|
+
"colors-content-default-default"
|
|
43
|
+
)}
|
|
44
|
+
`;
|
|
45
|
+
const getPercentageDisplay = (percent) => {
|
|
46
|
+
if (percent > 0) {
|
|
47
|
+
return {
|
|
48
|
+
color: "var(--colors-surface-status-success-strong-default)",
|
|
49
|
+
text: `+${percent}%`
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
if (percent < 0) {
|
|
53
|
+
return {
|
|
54
|
+
color: "var(--colors-surface-status-error-strong-default)",
|
|
55
|
+
text: `-${percent}%`
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
color: "var(--colors-content-default-default)",
|
|
60
|
+
text: `${percent}%`
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
const MarketPriceIndicator = ({ percent, price }) => {
|
|
64
|
+
const percentageDisplay = getPercentageDisplay(percent);
|
|
65
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
66
|
+
Wrapper,
|
|
67
|
+
{
|
|
68
|
+
"data-testid": "market-price-indicator",
|
|
69
|
+
flexDirection: "column",
|
|
70
|
+
alignItems: "flex-end",
|
|
71
|
+
width: "fit-content"
|
|
72
|
+
},
|
|
73
|
+
/* @__PURE__ */ import_react.default.createElement(import_components.Text, { variant: "body", fontWeight: "semiBold", mb: "4px" }, price),
|
|
74
|
+
/* @__PURE__ */ import_react.default.createElement(import_components.Text, { color: percentageDisplay.color, fontSize: "12px" }, percentageDisplay.text)
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=MarketPriceIndicator.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/pre-ldls/components/MarketPriceIndicator/MarketPriceIndicator.tsx"],
|
|
4
|
+
"sourcesContent": ["import React from \"react\";\nimport { Flex, Text } from \"../../../components\";\nimport styled from \"styled-components\";\nimport { withTokens } from \"../../libs\";\n\nconst Wrapper = styled(Flex)`\n ${withTokens(\n \"colors-surface-status-success-strong-default\",\n \"colors-surface-status-error-strong-default\",\n \"colors-content-default-default\",\n )}\n`;\n\nconst getPercentageDisplay = (percent: number) => {\n if (percent > 0) {\n return {\n color: \"var(--colors-surface-status-success-strong-default)\",\n text: `+${percent}%`,\n };\n }\n if (percent < 0) {\n return {\n color: \"var(--colors-surface-status-error-strong-default)\",\n text: `-${percent}%`,\n };\n }\n return {\n color: \"var(--colors-content-default-default)\",\n text: `${percent}%`,\n };\n};\n\nexport const MarketPriceIndicator = ({ percent, price }: { percent: number; price: string }) => {\n const percentageDisplay = getPercentageDisplay(percent);\n\n return (\n <Wrapper\n data-testid=\"market-price-indicator\"\n flexDirection=\"column\"\n alignItems=\"flex-end\"\n width=\"fit-content\"\n >\n <Text variant=\"body\" fontWeight=\"semiBold\" mb=\"4px\">\n {price}\n </Text>\n <Text color={percentageDisplay.color} fontSize=\"12px\">\n {percentageDisplay.text}\n </Text>\n </Wrapper>\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,wBAA2B;AAC3B,+BAAmB;AACnB,kBAA2B;AAE3B,MAAM,cAAU,yBAAAA,SAAO,sBAAI;AAAA,QACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAAA;AAGH,MAAM,uBAAuB,CAAC,YAAoB;AAChD,MAAI,UAAU,GAAG;AACf,WAAO;AAAA,MACL,OAAO;AAAA,MACP,MAAM,IAAI,OAAO;AAAA,IACnB;AAAA,EACF;AACA,MAAI,UAAU,GAAG;AACf,WAAO;AAAA,MACL,OAAO;AAAA,MACP,MAAM,IAAI,OAAO;AAAA,IACnB;AAAA,EACF;AACA,SAAO;AAAA,IACL,OAAO;AAAA,IACP,MAAM,GAAG,OAAO;AAAA,EAClB;AACF;AAEO,MAAM,uBAAuB,CAAC,EAAE,SAAS,MAAM,MAA0C;AAC9F,QAAM,oBAAoB,qBAAqB,OAAO;AAEtD,SACE,6BAAAC,QAAA;AAAA,IAAC;AAAA;AAAA,MACC,eAAY;AAAA,MACZ,eAAc;AAAA,MACd,YAAW;AAAA,MACX,OAAM;AAAA;AAAA,IAEN,6BAAAA,QAAA,cAAC,0BAAK,SAAQ,QAAO,YAAW,YAAW,IAAG,SAC3C,KACH;AAAA,IACA,6BAAAA,QAAA,cAAC,0BAAK,OAAO,kBAAkB,OAAO,UAAS,UAC5C,kBAAkB,IACrB;AAAA,EACF;AAEJ;",
|
|
6
|
+
"names": ["styled", "React"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var MarketPriceIndicator_stories_exports = {};
|
|
20
|
+
__export(MarketPriceIndicator_stories_exports, {
|
|
21
|
+
Negative: () => Negative,
|
|
22
|
+
Positive: () => Positive,
|
|
23
|
+
TestMarketPriceIndicator: () => TestMarketPriceIndicator,
|
|
24
|
+
Zero: () => Zero,
|
|
25
|
+
default: () => MarketPriceIndicator_stories_default
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(MarketPriceIndicator_stories_exports);
|
|
28
|
+
var import_MarketPriceIndicator = require("./MarketPriceIndicator");
|
|
29
|
+
var import_test = require("@storybook/test");
|
|
30
|
+
const meta = {
|
|
31
|
+
component: import_MarketPriceIndicator.MarketPriceIndicator,
|
|
32
|
+
title: "PreLdls/Components/MarketPriceIndicator",
|
|
33
|
+
tags: ["autodocs"],
|
|
34
|
+
args: { percent: 30, price: "$100,000.00" }
|
|
35
|
+
};
|
|
36
|
+
var MarketPriceIndicator_stories_default = meta;
|
|
37
|
+
const Positive = { args: { percent: 30, price: "$100,000.00" } };
|
|
38
|
+
const Negative = { args: { percent: -30, price: "$100,000.00" } };
|
|
39
|
+
const Zero = { args: { percent: 0, price: "$100,000.00" } };
|
|
40
|
+
const TestMarketPriceIndicator = {
|
|
41
|
+
play: async ({ canvasElement }) => {
|
|
42
|
+
const canvas = (0, import_test.within)(canvasElement);
|
|
43
|
+
const input = canvas.getByTestId("market-price-indicator");
|
|
44
|
+
await (0, import_test.expect)(input).toHaveTextContent("$100,000.00");
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=MarketPriceIndicator.stories.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/pre-ldls/components/MarketPriceIndicator/MarketPriceIndicator.stories.ts"],
|
|
4
|
+
"sourcesContent": ["import type { Meta, StoryObj } from \"@storybook/react\";\nimport { MarketPriceIndicator } from \"./MarketPriceIndicator\";\nimport { expect, within } from \"@storybook/test\";\n\nconst meta: Meta<typeof MarketPriceIndicator> = {\n component: MarketPriceIndicator,\n title: \"PreLdls/Components/MarketPriceIndicator\",\n tags: [\"autodocs\"],\n args: { percent: 30, price: \"$100,000.00\" },\n};\nexport default meta;\n\ntype Story = StoryObj<typeof MarketPriceIndicator>;\n\nexport const Positive: Story = { args: { percent: 30, price: \"$100,000.00\" } };\nexport const Negative: Story = { args: { percent: -30, price: \"$100,000.00\" } };\nexport const Zero: Story = { args: { percent: 0, price: \"$100,000.00\" } };\n\nexport const TestMarketPriceIndicator: Story = {\n play: async ({ canvasElement }: { canvasElement: HTMLElement }) => {\n const canvas = within(canvasElement);\n const input = canvas.getByTestId(\"market-price-indicator\");\n await expect(input).toHaveTextContent(\"$100,000.00\");\n },\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kCAAqC;AACrC,kBAA+B;AAE/B,MAAM,OAA0C;AAAA,EAC9C,WAAW;AAAA,EACX,OAAO;AAAA,EACP,MAAM,CAAC,UAAU;AAAA,EACjB,MAAM,EAAE,SAAS,IAAI,OAAO,cAAc;AAC5C;AACA,IAAO,uCAAQ;AAIR,MAAM,WAAkB,EAAE,MAAM,EAAE,SAAS,IAAI,OAAO,cAAc,EAAE;AACtE,MAAM,WAAkB,EAAE,MAAM,EAAE,SAAS,KAAK,OAAO,cAAc,EAAE;AACvE,MAAM,OAAc,EAAE,MAAM,EAAE,SAAS,GAAG,OAAO,cAAc,EAAE;AAEjE,MAAM,2BAAkC;AAAA,EAC7C,MAAM,OAAO,EAAE,cAAc,MAAsC;AACjE,UAAM,aAAS,oBAAO,aAAa;AACnC,UAAM,QAAQ,OAAO,YAAY,wBAAwB;AACzD,cAAM,oBAAO,KAAK,EAAE,kBAAkB,aAAa;AAAA,EACrD;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -35,9 +35,24 @@ var import_react = __toESM(require("react"));
|
|
|
35
35
|
var import_assets = require("../../../assets");
|
|
36
36
|
var import_hooks = require("../../hooks");
|
|
37
37
|
var import__ = require("..");
|
|
38
|
-
function Search({
|
|
38
|
+
function Search({
|
|
39
|
+
onDebouncedChange,
|
|
40
|
+
debounceTime = 500,
|
|
41
|
+
onChange,
|
|
42
|
+
autoFocus = true,
|
|
43
|
+
...props
|
|
44
|
+
}) {
|
|
39
45
|
const initialValue = props.value ?? props.defaultValue ?? "";
|
|
40
46
|
const prevValue = (0, import_react.useRef)(String(initialValue));
|
|
47
|
+
const searchInputRef = (0, import_react.useRef)(null);
|
|
48
|
+
(0, import_react.useEffect)(() => {
|
|
49
|
+
if (autoFocus && searchInputRef.current) {
|
|
50
|
+
setTimeout(() => {
|
|
51
|
+
var _a;
|
|
52
|
+
(_a = searchInputRef.current) == null ? void 0 : _a.focus({ preventScroll: true });
|
|
53
|
+
}, 0);
|
|
54
|
+
}
|
|
55
|
+
}, [autoFocus]);
|
|
41
56
|
const handleDebouncedChange = (0, import_hooks.useDebouncedCallback)(
|
|
42
57
|
(0, import_react.useMemo)(() => {
|
|
43
58
|
if (!onDebouncedChange)
|
|
@@ -58,6 +73,14 @@ function Search({ onDebouncedChange, debounceTime = 500, onChange, ...props }) {
|
|
|
58
73
|
handleDebouncedChange == null ? void 0 : handleDebouncedChange(event);
|
|
59
74
|
};
|
|
60
75
|
}, [handleDebouncedChange, onChange]);
|
|
61
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
76
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
77
|
+
import__.Input,
|
|
78
|
+
{
|
|
79
|
+
...props,
|
|
80
|
+
ref: searchInputRef,
|
|
81
|
+
icon: /* @__PURE__ */ import_react.default.createElement(import_assets.Icons.Search, { size: "S" }),
|
|
82
|
+
onChange: handleChange
|
|
83
|
+
}
|
|
84
|
+
);
|
|
62
85
|
}
|
|
63
86
|
//# sourceMappingURL=Search.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/pre-ldls/components/Search/Search.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, { ChangeEvent, useMemo, useRef } from \"react\";\nimport { Icons } from \"../../../assets\";\nimport { useDebouncedCallback } from \"../../hooks\";\nimport { Input } from \"..\";\n\ntype InputProps = React.ComponentProps<\"input\">;\ntype Props = Readonly<\n InputProps & {\n onDebouncedChange?: (current: string, prev: string) => void;\n debounceTime?: number;\n }\n>;\n\nexport function Search({
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
4
|
+
"sourcesContent": ["import React, { ChangeEvent, useEffect, useMemo, useRef } from \"react\";\nimport { Icons } from \"../../../assets\";\nimport { useDebouncedCallback } from \"../../hooks\";\nimport { Input } from \"..\";\n\ntype InputProps = React.ComponentProps<\"input\">;\ntype Props = Readonly<\n InputProps & {\n onDebouncedChange?: (current: string, prev: string) => void;\n debounceTime?: number;\n autoFocus?: boolean;\n }\n>;\n\nexport function Search({\n onDebouncedChange,\n debounceTime = 500,\n onChange,\n autoFocus = true,\n ...props\n}: Props) {\n const initialValue = props.value ?? props.defaultValue ?? \"\";\n const prevValue = useRef(String(initialValue));\n const searchInputRef = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n if (autoFocus && searchInputRef.current) {\n // Delay focus to prevent layout shifts\n setTimeout(() => {\n searchInputRef.current?.focus({ preventScroll: true });\n }, 0);\n }\n }, [autoFocus]);\n\n const handleDebouncedChange = useDebouncedCallback(\n useMemo(() => {\n if (!onDebouncedChange) return;\n return (event: ChangeEvent<HTMLInputElement>) => {\n const current = event.target.value;\n onDebouncedChange(current, prevValue.current);\n prevValue.current = current;\n };\n }, [onDebouncedChange]),\n debounceTime,\n );\n\n const handleChange = useMemo(() => {\n if (!handleDebouncedChange && !onChange) return;\n return (event: ChangeEvent<HTMLInputElement>) => {\n onChange?.(event);\n handleDebouncedChange?.(event);\n };\n }, [handleDebouncedChange, onChange]);\n\n return (\n <Input\n {...props}\n ref={searchInputRef}\n icon={<Icons.Search size=\"S\" />}\n onChange={handleChange}\n />\n );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA+D;AAC/D,oBAAsB;AACtB,mBAAqC;AACrC,eAAsB;AAWf,SAAS,OAAO;AAAA,EACrB;AAAA,EACA,eAAe;AAAA,EACf;AAAA,EACA,YAAY;AAAA,EACZ,GAAG;AACL,GAAU;AACR,QAAM,eAAe,MAAM,SAAS,MAAM,gBAAgB;AAC1D,QAAM,gBAAY,qBAAO,OAAO,YAAY,CAAC;AAC7C,QAAM,qBAAiB,qBAAyB,IAAI;AAEpD,8BAAU,MAAM;AACd,QAAI,aAAa,eAAe,SAAS;AAEvC,iBAAW,MAAM;AA5BvB;AA6BQ,6BAAe,YAAf,mBAAwB,MAAM,EAAE,eAAe,KAAK;AAAA,MACtD,GAAG,CAAC;AAAA,IACN;AAAA,EACF,GAAG,CAAC,SAAS,CAAC;AAEd,QAAM,4BAAwB;AAAA,QAC5B,sBAAQ,MAAM;AACZ,UAAI,CAAC;AAAmB;AACxB,aAAO,CAAC,UAAyC;AAC/C,cAAM,UAAU,MAAM,OAAO;AAC7B,0BAAkB,SAAS,UAAU,OAAO;AAC5C,kBAAU,UAAU;AAAA,MACtB;AAAA,IACF,GAAG,CAAC,iBAAiB,CAAC;AAAA,IACtB;AAAA,EACF;AAEA,QAAM,mBAAe,sBAAQ,MAAM;AACjC,QAAI,CAAC,yBAAyB,CAAC;AAAU;AACzC,WAAO,CAAC,UAAyC;AAC/C,2CAAW;AACX,qEAAwB;AAAA,IAC1B;AAAA,EACF,GAAG,CAAC,uBAAuB,QAAQ,CAAC;AAEpC,SACE,6BAAAA,QAAA;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,KAAK;AAAA,MACL,MAAM,6BAAAA,QAAA,cAAC,oBAAM,QAAN,EAAa,MAAK,KAAI;AAAA,MAC7B,UAAU;AAAA;AAAA,EACZ;AAEJ;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -22,6 +22,8 @@ __reExport(components_exports, require("./AssetItem/AssetItem"), module.exports)
|
|
|
22
22
|
__reExport(components_exports, require("./AssetList/AssetList"), module.exports);
|
|
23
23
|
__reExport(components_exports, require("./CardButton/CardButton"), module.exports);
|
|
24
24
|
__reExport(components_exports, require("./ApyIndicator/ApyIndicator"), module.exports);
|
|
25
|
+
__reExport(components_exports, require("./MarketPriceIndicator/MarketPriceIndicator"), module.exports);
|
|
26
|
+
__reExport(components_exports, require("./MarketPercentIndicator/MarketPercentIndicator"), module.exports);
|
|
25
27
|
__reExport(components_exports, require("./Input/Input"), module.exports);
|
|
26
28
|
__reExport(components_exports, require("./NetworkItem/NetworkItem"), module.exports);
|
|
27
29
|
__reExport(components_exports, require("./NetworkList/NetworkList"), module.exports);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/pre-ldls/components/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * from \"./AccountItem/AccountItem\";\nexport * from \"./AccountList/AccountList\";\nexport * from \"./Address/Address\";\nexport * from \"./AssetItem/AssetItem\";\nexport * from \"./AssetList/AssetList\";\nexport * from \"./CardButton/CardButton\";\nexport * from \"./ApyIndicator/ApyIndicator\";\nexport * from \"./Input/Input\";\nexport * from \"./NetworkItem/NetworkItem\";\nexport * from \"./NetworkList/NetworkList\";\nexport * from \"./Search/Search\";\nexport * from \"./Tag/Tag\";\nexport * from \"./TextInput/TextInput\";\nexport * from \"./VirtualList/VirtualList\";\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,+BAAc,sCAAd;AACA,+BAAc,sCADd;AAEA,+BAAc,8BAFd;AAGA,+BAAc,kCAHd;AAIA,+BAAc,kCAJd;AAKA,+BAAc,oCALd;AAMA,+BAAc,wCANd;AAOA,+BAAc,
|
|
4
|
+
"sourcesContent": ["export * from \"./AccountItem/AccountItem\";\nexport * from \"./AccountList/AccountList\";\nexport * from \"./Address/Address\";\nexport * from \"./AssetItem/AssetItem\";\nexport * from \"./AssetList/AssetList\";\nexport * from \"./CardButton/CardButton\";\nexport * from \"./ApyIndicator/ApyIndicator\";\nexport * from \"./MarketPriceIndicator/MarketPriceIndicator\";\nexport * from \"./MarketPercentIndicator/MarketPercentIndicator\";\nexport * from \"./Input/Input\";\nexport * from \"./NetworkItem/NetworkItem\";\nexport * from \"./NetworkList/NetworkList\";\nexport * from \"./Search/Search\";\nexport * from \"./Tag/Tag\";\nexport * from \"./TextInput/TextInput\";\nexport * from \"./VirtualList/VirtualList\";\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,+BAAc,sCAAd;AACA,+BAAc,sCADd;AAEA,+BAAc,8BAFd;AAGA,+BAAc,kCAHd;AAIA,+BAAc,kCAJd;AAKA,+BAAc,oCALd;AAMA,+BAAc,wCANd;AAOA,+BAAc,wDAPd;AAQA,+BAAc,4DARd;AASA,+BAAc,0BATd;AAUA,+BAAc,sCAVd;AAWA,+BAAc,sCAXd;AAYA,+BAAc,4BAZd;AAaA,+BAAc,sBAbd;AAcA,+BAAc,kCAdd;AAeA,+BAAc,sCAfd;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioElement.d.ts","sourceRoot":"","sources":["../../../../src/components/form/Radio/RadioElement.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,mBAAmB,EAAuB,MAAM,OAAO,CAAC;AAkKxE,KAAK,eAAe,GAAG,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC,CAAC;AAEjG,MAAM,MAAM,iBAAiB,GAAG,eAAe,GAAG;IAChD,OAAO,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,QAAA,MAAM,OAAO;8DAOV,iBAAiB,GAAG,WAAW;;;
|
|
1
|
+
{"version":3,"file":"RadioElement.d.ts","sourceRoot":"","sources":["../../../../src/components/form/Radio/RadioElement.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,mBAAmB,EAAuB,MAAM,OAAO,CAAC;AAkKxE,KAAK,eAAe,GAAG,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC,CAAC;AAEjG,MAAM,MAAM,iBAAiB,GAAG,eAAe,GAAG;IAChD,OAAO,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,QAAA,MAAM,OAAO;8DAOV,iBAAiB,GAAG,WAAW;;;CA6BjC,CAAC;AAKF,eAAe,OAAO,CAAC"}
|
|
@@ -156,8 +156,7 @@ const Element = ({ label, value, disabled, outlined, variant = "default", ...pro
|
|
|
156
156
|
const context = useContext(RadioContext);
|
|
157
157
|
if (context === undefined)
|
|
158
158
|
throw new Error("RadioElement must be used within a RadioProvider");
|
|
159
|
-
|
|
160
|
-
const isChecked = useMemo(() => context.currentValue === value, [context.currentValue]);
|
|
159
|
+
const isChecked = useMemo(() => context.currentValue == value, [context.currentValue, value]);
|
|
161
160
|
const handleChange = (event) => {
|
|
162
161
|
context.onChange(event.target.value);
|
|
163
162
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioElement.js","sourceRoot":"","sources":["../../../../src/components/form/Radio/RadioElement.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAuB,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,IAAI,MAAM,oBAAoB,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;2CACiB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI;;CAE1E,CAAC;AAEF,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA;gCACM,CAAC,CAAC,EAAE,CAAC,CAAC,CA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,KAAK,EACZ,IAAI,EAAE,OAAO,CAAC,IAAI,KACd,KAAK,GACT;QACF,oBAAC,KAAK,IAAC,OAAO,EAAC,WAAW,IAAE,KAAK,CAAS,CAC7B,CAChB,CAAC;AACJ,CAAC,CAAC;AAEF,OAAO,CAAC,WAAW,GAAG,eAAe,CAAC,CAAC,+DAA+D;AACtG,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;AAEtB,eAAe,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/tabs/Chip/index.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/tabs/Chip/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAInD,MAAM,MAAM,KAAK,GAAG,KAAK,CAAC,iBAAiB,CAAC;IAC1C;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC,CAAC;AA2BH,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,kBAAkB,EAAE,EAAE,KAAK,GAAG,GAAG,CAAC,OAAO,CAuBjG"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
|
2
2
|
import styled from "styled-components";
|
|
3
3
|
import Flex from "../../layout/Flex";
|
|
4
4
|
const Container = styled(Flex).attrs({
|
|
@@ -23,6 +23,9 @@ const Item = styled(Flex).attrs({
|
|
|
23
23
|
`;
|
|
24
24
|
export default function BarTabs({ children, onTabChange, initialActiveIndex }) {
|
|
25
25
|
const [activeIndex, setActiveIndex] = useState(initialActiveIndex);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
setActiveIndex(initialActiveIndex);
|
|
28
|
+
}, [initialActiveIndex]);
|
|
26
29
|
return (React.createElement(Container, null, React.Children.toArray(children).map((child, index) => (React.createElement(Item, { key: index, active: index === activeIndex, onClick: () => {
|
|
27
30
|
setActiveIndex(index);
|
|
28
31
|
onTabChange && onTabChange(index);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/tabs/Chip/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/tabs/Chip/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,IAAI,MAAM,mBAAmB,CAAC;AAiBrC,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC;IACnC,cAAc,EAAE,eAAe;IAC/B,IAAI,EAAE,CAAC;IACP,SAAS,EAAE,CAAC;CACb,CAAC,CAAA;sBACoB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG;;;CAG3D,CAAC;AAEF,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC;IAC9B,IAAI,EAAE,CAAC;IACP,cAAc,EAAE,QAAQ;IACxB,UAAU,EAAE,QAAQ;CACrB,CAAC,CAAW;;;;WAIF,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC;sBAC/D,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC;CAClF,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,kBAAkB,EAAS;IAClF,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,kBAAkB,CAAC,CAAC;IAEnE,SAAS,CAAC,GAAG,EAAE;QACb,cAAc,CAAC,kBAAkB,CAAC,CAAC;IACrC,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAEzB,OAAO,CACL,oBAAC,SAAS,QACP,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CACtD,oBAAC,IAAI,IACH,GAAG,EAAE,KAAK,EACV,MAAM,EAAE,KAAK,KAAK,WAAW,EAC7B,OAAO,EAAE,GAAG,EAAE;YACZ,cAAc,CAAC,KAAK,CAAC,CAAC;YACtB,WAAW,IAAI,WAAW,CAAC,KAAK,CAAC,CAAC;QACpC,CAAC,IAEA,KAAK,CACD,CACR,CAAC,CACQ,CACb,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarketPercentIndicator.d.ts","sourceRoot":"","sources":["../../../../src/pre-ldls/components/MarketPercentIndicator/MarketPercentIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAsC1B,eAAO,MAAM,sBAAsB;aAA4B,MAAM;uBAkBpE,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Flex, Text } from "../../../components";
|
|
3
|
+
import styled from "styled-components";
|
|
4
|
+
import { withTokens } from "../../libs";
|
|
5
|
+
const Wrapper = styled(Flex) `
|
|
6
|
+
${withTokens("colors-surface-status-success-default", "colors-surface-status-success-strong-default", "colors-surface-status-error-default", "colors-surface-status-error-strong-default", "colors-surface-transparent-hover", "colors-content-default-default")}
|
|
7
|
+
`;
|
|
8
|
+
const getPercentageDisplay = (percent) => {
|
|
9
|
+
if (percent > 0) {
|
|
10
|
+
return {
|
|
11
|
+
backgroundColor: "var(--colors-surface-status-success-default)",
|
|
12
|
+
color: "var(--colors-surface-status-success-strong-default)",
|
|
13
|
+
text: `+${percent}%`,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
if (percent < 0) {
|
|
17
|
+
return {
|
|
18
|
+
backgroundColor: "var(--colors-surface-status-error-default)",
|
|
19
|
+
color: "var(--colors-surface-status-error-strong-default)",
|
|
20
|
+
text: `-${Math.abs(percent)}%`,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
backgroundColor: "var(--colors-surface-transparent-hover)",
|
|
25
|
+
color: "var(--colors-content-default-default)",
|
|
26
|
+
text: `${percent}%`,
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export const MarketPercentIndicator = ({ percent }) => {
|
|
30
|
+
const percentageDisplay = getPercentageDisplay(percent);
|
|
31
|
+
return (React.createElement(Wrapper, { "data-testid": "market-percent-indicator", flexDirection: "column", alignItems: "flex-end", width: "fit-content", p: "4px", borderRadius: "4px", backgroundColor: percentageDisplay.backgroundColor },
|
|
32
|
+
React.createElement(Text, { color: percentageDisplay.color, fontSize: "12px" }, percentageDisplay.text)));
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=MarketPercentIndicator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarketPercentIndicator.js","sourceRoot":"","sources":["../../../../src/pre-ldls/components/MarketPercentIndicator/MarketPercentIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAA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AAI,IAAC,KAAK,EAAE,iBAAiB,CAAC,KAAK,EAAE,QAAQ,EAAC,MAAM,IAClD,iBAAiB,CAAC,IAAI,CAClB,CACC,CACX,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { MarketPercentIndicator } from "./MarketPercentIndicator";
|
|
3
|
+
declare const meta: Meta<typeof MarketPercentIndicator>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof MarketPercentIndicator>;
|
|
6
|
+
export declare const Positive: Story;
|
|
7
|
+
export declare const Negative: Story;
|
|
8
|
+
export declare const Zero: Story;
|
|
9
|
+
export declare const TestMarketPercentIndicator: Story;
|
|
10
|
+
//# sourceMappingURL=MarketPercentIndicator.stories.d.ts.map
|
package/lib/pre-ldls/components/MarketPercentIndicator/MarketPercentIndicator.stories.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarketPercentIndicator.stories.d.ts","sourceRoot":"","sources":["../../../../src/pre-ldls/components/MarketPercentIndicator/MarketPercentIndicator.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGlE,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,sBAAsB,CAK7C,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAErD,eAAO,MAAM,QAAQ,EAAE,KAAiC,CAAC;AACzD,eAAO,MAAM,QAAQ,EAAE,KAAkC,CAAC;AAC1D,eAAO,MAAM,IAAI,EAAE,KAAgC,CAAC;AAEpD,eAAO,MAAM,0BAA0B,EAAE,KAMxC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { MarketPercentIndicator } from "./MarketPercentIndicator";
|
|
2
|
+
import { expect, within } from "@storybook/test";
|
|
3
|
+
const meta = {
|
|
4
|
+
component: MarketPercentIndicator,
|
|
5
|
+
title: "PreLdls/Components/MarketPercentIndicator",
|
|
6
|
+
tags: ["autodocs"],
|
|
7
|
+
args: { percent: 30 },
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
export const Positive = { args: { percent: 30 } };
|
|
11
|
+
export const Negative = { args: { percent: -30 } };
|
|
12
|
+
export const Zero = { args: { percent: 0 } };
|
|
13
|
+
export const TestMarketPercentIndicator = {
|
|
14
|
+
play: async ({ canvasElement }) => {
|
|
15
|
+
const canvas = within(canvasElement);
|
|
16
|
+
const input = canvas.getByTestId("market-percent-indicator");
|
|
17
|
+
await expect(input).toHaveTextContent("+30%");
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=MarketPercentIndicator.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarketPercentIndicator.stories.js","sourceRoot":"","sources":["../../../../src/pre-ldls/components/MarketPercentIndicator/MarketPercentIndicator.stories.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEjD,MAAM,IAAI,GAAwC;IAChD,SAAS,EAAE,sBAAsB;IACjC,KAAK,EAAE,2CAA2C;IAClD,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,IAAI,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;CACtB,CAAC;AACF,eAAe,IAAI,CAAC;AAIpB,MAAM,CAAC,MAAM,QAAQ,GAAU,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,CAAC;AACzD,MAAM,CAAC,MAAM,QAAQ,GAAU,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;AAC1D,MAAM,CAAC,MAAM,IAAI,GAAU,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC;AAEpD,MAAM,CAAC,MAAM,0BAA0B,GAAU;IAC/C,IAAI,EAAE,KAAK,EAAE,EAAE,aAAa,EAAkC,EAAE,EAAE;QAChE,MAAM,MAAM,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;QACrC,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC,0BAA0B,CAAC,CAAC;QAC7D,MAAM,MAAM,CAAC,KAAK,CAAC,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAChD,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarketPriceIndicator.d.ts","sourceRoot":"","sources":["../../../../src/pre-ldls/components/MarketPriceIndicator/MarketPriceIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAgC1B,eAAO,MAAM,oBAAoB;aAAmC,MAAM;WAAS,MAAM;uBAkBxF,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Flex, Text } from "../../../components";
|
|
3
|
+
import styled from "styled-components";
|
|
4
|
+
import { withTokens } from "../../libs";
|
|
5
|
+
const Wrapper = styled(Flex) `
|
|
6
|
+
${withTokens("colors-surface-status-success-strong-default", "colors-surface-status-error-strong-default", "colors-content-default-default")}
|
|
7
|
+
`;
|
|
8
|
+
const getPercentageDisplay = (percent) => {
|
|
9
|
+
if (percent > 0) {
|
|
10
|
+
return {
|
|
11
|
+
color: "var(--colors-surface-status-success-strong-default)",
|
|
12
|
+
text: `+${percent}%`,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
if (percent < 0) {
|
|
16
|
+
return {
|
|
17
|
+
color: "var(--colors-surface-status-error-strong-default)",
|
|
18
|
+
text: `-${percent}%`,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
color: "var(--colors-content-default-default)",
|
|
23
|
+
text: `${percent}%`,
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export const MarketPriceIndicator = ({ percent, price }) => {
|
|
27
|
+
const percentageDisplay = getPercentageDisplay(percent);
|
|
28
|
+
return (React.createElement(Wrapper, { "data-testid": "market-price-indicator", flexDirection: "column", alignItems: "flex-end", width: "fit-content" },
|
|
29
|
+
React.createElement(Text, { variant: "body", fontWeight: "semiBold", mb: "4px" }, price),
|
|
30
|
+
React.createElement(Text, { color: percentageDisplay.color, fontSize: "12px" }, percentageDisplay.text)));
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=MarketPriceIndicator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarketPriceIndicator.js","sourceRoot":"","sources":["../../../../src/pre-ldls/components/MarketPriceIndicator/MarketPriceIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;IACxB,UAAU,CACV,8CAA8C,EAC9C,4CAA4C,EAC5C,gCAAgC,CACjC;CACF,CAAC;AAEF,MAAM,oBAAoB,GAAG,CAAC,OAAe,EAAE,EAAE;IAC/C,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;QAChB,OAAO;YACL,KAAK,EAAE,qDAAqD;YAC5D,IAAI,EAAE,IAAI,OAAO,GAAG;SACrB,CAAC;IACJ,CAAC;IACD,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;QAChB,OAAO;YACL,KAAK,EAAE,mDAAmD;YAC1D,IAAI,EAAE,IAAI,OAAO,GAAG;SACrB,CAAC;IACJ,CAAC;IACD,OAAO;QACL,KAAK,EAAE,uCAAuC;QAC9C,IAAI,EAAE,GAAG,OAAO,GAAG;KACpB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EAAE,OAAO,EAAE,KAAK,EAAsC,EAAE,EAAE;IAC7F,MAAM,iBAAiB,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAExD,OAAO,CACL,oBAAC,OAAO,mBACM,wBAAwB,EACpC,aAAa,EAAC,QAAQ,EACtB,UAAU,EAAC,UAAU,EACrB,KAAK,EAAC,aAAa;QAEnB,oBAAC,IAAI,IAAC,OAAO,EAAC,MAAM,EAAC,UAAU,EAAC,UAAU,EAAC,EAAE,EAAC,KAAK,IAChD,KAAK,CACD;QACP,oBAAC,IAAI,IAAC,KAAK,EAAE,iBAAiB,CAAC,KAAK,EAAE,QAAQ,EAAC,MAAM,IAClD,iBAAiB,CAAC,IAAI,CAClB,CACC,CACX,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { MarketPriceIndicator } from "./MarketPriceIndicator";
|
|
3
|
+
declare const meta: Meta<typeof MarketPriceIndicator>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof MarketPriceIndicator>;
|
|
6
|
+
export declare const Positive: Story;
|
|
7
|
+
export declare const Negative: Story;
|
|
8
|
+
export declare const Zero: Story;
|
|
9
|
+
export declare const TestMarketPriceIndicator: Story;
|
|
10
|
+
//# sourceMappingURL=MarketPriceIndicator.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarketPriceIndicator.stories.d.ts","sourceRoot":"","sources":["../../../../src/pre-ldls/components/MarketPriceIndicator/MarketPriceIndicator.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAG9D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,oBAAoB,CAK3C,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAEnD,eAAO,MAAM,QAAQ,EAAE,KAAuD,CAAC;AAC/E,eAAO,MAAM,QAAQ,EAAE,KAAwD,CAAC;AAChF,eAAO,MAAM,IAAI,EAAE,KAAsD,CAAC;AAE1E,eAAO,MAAM,wBAAwB,EAAE,KAMtC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { MarketPriceIndicator } from "./MarketPriceIndicator";
|
|
2
|
+
import { expect, within } from "@storybook/test";
|
|
3
|
+
const meta = {
|
|
4
|
+
component: MarketPriceIndicator,
|
|
5
|
+
title: "PreLdls/Components/MarketPriceIndicator",
|
|
6
|
+
tags: ["autodocs"],
|
|
7
|
+
args: { percent: 30, price: "$100,000.00" },
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
export const Positive = { args: { percent: 30, price: "$100,000.00" } };
|
|
11
|
+
export const Negative = { args: { percent: -30, price: "$100,000.00" } };
|
|
12
|
+
export const Zero = { args: { percent: 0, price: "$100,000.00" } };
|
|
13
|
+
export const TestMarketPriceIndicator = {
|
|
14
|
+
play: async ({ canvasElement }) => {
|
|
15
|
+
const canvas = within(canvasElement);
|
|
16
|
+
const input = canvas.getByTestId("market-price-indicator");
|
|
17
|
+
await expect(input).toHaveTextContent("$100,000.00");
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=MarketPriceIndicator.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarketPriceIndicator.stories.js","sourceRoot":"","sources":["../../../../src/pre-ldls/components/MarketPriceIndicator/MarketPriceIndicator.stories.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEjD,MAAM,IAAI,GAAsC;IAC9C,SAAS,EAAE,oBAAoB;IAC/B,KAAK,EAAE,yCAAyC;IAChD,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,IAAI,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE;CAC5C,CAAC;AACF,eAAe,IAAI,CAAC;AAIpB,MAAM,CAAC,MAAM,QAAQ,GAAU,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE,CAAC;AAC/E,MAAM,CAAC,MAAM,QAAQ,GAAU,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE,CAAC;AAChF,MAAM,CAAC,MAAM,IAAI,GAAU,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE,CAAC;AAE1E,MAAM,CAAC,MAAM,wBAAwB,GAAU;IAC7C,IAAI,EAAE,KAAK,EAAE,EAAE,aAAa,EAAkC,EAAE,EAAE;QAChE,MAAM,MAAM,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;QACrC,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC,wBAAwB,CAAC,CAAC;QAC3D,MAAM,MAAM,CAAC,KAAK,CAAC,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAC;IACvD,CAAC;CACF,CAAC"}
|
|
@@ -3,7 +3,8 @@ type InputProps = React.ComponentProps<"input">;
|
|
|
3
3
|
type Props = Readonly<InputProps & {
|
|
4
4
|
onDebouncedChange?: (current: string, prev: string) => void;
|
|
5
5
|
debounceTime?: number;
|
|
6
|
+
autoFocus?: boolean;
|
|
6
7
|
}>;
|
|
7
|
-
export declare function Search({ onDebouncedChange, debounceTime, onChange, ...props }: Props): React.JSX.Element;
|
|
8
|
+
export declare function Search({ onDebouncedChange, debounceTime, onChange, autoFocus, ...props }: Props): React.JSX.Element;
|
|
8
9
|
export {};
|
|
9
10
|
//# sourceMappingURL=Search.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Search.d.ts","sourceRoot":"","sources":["../../../../src/pre-ldls/components/Search/Search.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Search.d.ts","sourceRoot":"","sources":["../../../../src/pre-ldls/components/Search/Search.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAKvE,KAAK,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;AAChD,KAAK,KAAK,GAAG,QAAQ,CACnB,UAAU,GAAG;IACX,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CACF,CAAC;AAEF,wBAAgB,MAAM,CAAC,EACrB,iBAAiB,EACjB,YAAkB,EAClB,QAAQ,EACR,SAAgB,EAChB,GAAG,KAAK,EACT,EAAE,KAAK,qBA0CP"}
|
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
import React, { useMemo, useRef } from "react";
|
|
1
|
+
import React, { useEffect, useMemo, useRef } from "react";
|
|
2
2
|
import { Icons } from "../../../assets";
|
|
3
3
|
import { useDebouncedCallback } from "../../hooks";
|
|
4
4
|
import { Input } from "..";
|
|
5
|
-
export function Search({ onDebouncedChange, debounceTime = 500, onChange, ...props }) {
|
|
5
|
+
export function Search({ onDebouncedChange, debounceTime = 500, onChange, autoFocus = true, ...props }) {
|
|
6
6
|
const initialValue = props.value ?? props.defaultValue ?? "";
|
|
7
7
|
const prevValue = useRef(String(initialValue));
|
|
8
|
+
const searchInputRef = useRef(null);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (autoFocus && searchInputRef.current) {
|
|
11
|
+
// Delay focus to prevent layout shifts
|
|
12
|
+
setTimeout(() => {
|
|
13
|
+
searchInputRef.current?.focus({ preventScroll: true });
|
|
14
|
+
}, 0);
|
|
15
|
+
}
|
|
16
|
+
}, [autoFocus]);
|
|
8
17
|
const handleDebouncedChange = useDebouncedCallback(useMemo(() => {
|
|
9
18
|
if (!onDebouncedChange)
|
|
10
19
|
return;
|
|
@@ -22,6 +31,6 @@ export function Search({ onDebouncedChange, debounceTime = 500, onChange, ...pro
|
|
|
22
31
|
handleDebouncedChange?.(event);
|
|
23
32
|
};
|
|
24
33
|
}, [handleDebouncedChange, onChange]);
|
|
25
|
-
return React.createElement(Input, { ...props, icon: React.createElement(Icons.Search, { size: "S" }), onChange: handleChange });
|
|
34
|
+
return (React.createElement(Input, { ...props, ref: searchInputRef, icon: React.createElement(Icons.Search, { size: "S" }), onChange: handleChange }));
|
|
26
35
|
}
|
|
27
36
|
//# sourceMappingURL=Search.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Search.js","sourceRoot":"","sources":["../../../../src/pre-ldls/components/Search/Search.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAe,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Search.js","sourceRoot":"","sources":["../../../../src/pre-ldls/components/Search/Search.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAe,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACvE,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,KAAK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,CAAC,KAAK,CAAC,CAAC;YAClB,qBAAqB,EAAE,CAAC,KAAK,CAAC,CAAC;QACjC,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,qBAAqB,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEtC,OAAO,CACL,oBAAC,KAAK,OACA,KAAK,EACT,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE,oBAAC,KAAK,CAAC,MAAM,IAAC,IAAI,EAAC,GAAG,GAAG,EAC/B,QAAQ,EAAE,YAAY,GACtB,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -5,6 +5,8 @@ export * from "./AssetItem/AssetItem";
|
|
|
5
5
|
export * from "./AssetList/AssetList";
|
|
6
6
|
export * from "./CardButton/CardButton";
|
|
7
7
|
export * from "./ApyIndicator/ApyIndicator";
|
|
8
|
+
export * from "./MarketPriceIndicator/MarketPriceIndicator";
|
|
9
|
+
export * from "./MarketPercentIndicator/MarketPercentIndicator";
|
|
8
10
|
export * from "./Input/Input";
|
|
9
11
|
export * from "./NetworkItem/NetworkItem";
|
|
10
12
|
export * from "./NetworkList/NetworkList";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pre-ldls/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,eAAe,CAAC;AAC9B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pre-ldls/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6CAA6C,CAAC;AAC5D,cAAc,iDAAiD,CAAC;AAChE,cAAc,eAAe,CAAC;AAC9B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC"}
|
|
@@ -5,6 +5,8 @@ export * from "./AssetItem/AssetItem";
|
|
|
5
5
|
export * from "./AssetList/AssetList";
|
|
6
6
|
export * from "./CardButton/CardButton";
|
|
7
7
|
export * from "./ApyIndicator/ApyIndicator";
|
|
8
|
+
export * from "./MarketPriceIndicator/MarketPriceIndicator";
|
|
9
|
+
export * from "./MarketPercentIndicator/MarketPercentIndicator";
|
|
8
10
|
export * from "./Input/Input";
|
|
9
11
|
export * from "./NetworkItem/NetworkItem";
|
|
10
12
|
export * from "./NetworkList/NetworkList";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/pre-ldls/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,eAAe,CAAC;AAC9B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/pre-ldls/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6CAA6C,CAAC;AAC5D,cAAc,iDAAiD,CAAC;AAChE,cAAc,eAAe,CAAC;AAC9B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/react-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.38.0-nightly.0",
|
|
4
4
|
"description": "Ledger Live - Desktop UI",
|
|
5
5
|
"author": "Ledger Live Team <team-live@ledger.fr>",
|
|
6
6
|
"repository": {
|
|
@@ -75,8 +75,8 @@
|
|
|
75
75
|
"react-transition-group": "^4.4.2",
|
|
76
76
|
"react-window": "^1.8.6",
|
|
77
77
|
"styled-system": "^5.1.5",
|
|
78
|
-
"@ledgerhq/crypto-icons-ui": "^1.
|
|
79
|
-
"@ledgerhq/icons-ui": "^0.
|
|
78
|
+
"@ledgerhq/crypto-icons-ui": "^1.19.0-nightly.1",
|
|
79
|
+
"@ledgerhq/icons-ui": "^0.14.0-nightly.0",
|
|
80
80
|
"@ledgerhq/ui-shared": "^0.4.0"
|
|
81
81
|
},
|
|
82
82
|
"peerDependencies": {
|