@ledgerhq/react-ui 0.33.0 → 0.34.0-nightly.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/lib/cjs/pre-ldls/components/AccountItem/AccountItem.js +29 -2
  2. package/lib/cjs/pre-ldls/components/AccountItem/AccountItem.js.map +2 -2
  3. package/lib/cjs/pre-ldls/components/AccountItem/AccountItem.stories.js +42 -20
  4. package/lib/cjs/pre-ldls/components/AccountItem/AccountItem.stories.js.map +2 -2
  5. package/lib/cjs/pre-ldls/components/Checkbox/Checkbox.js +109 -0
  6. package/lib/cjs/pre-ldls/components/Checkbox/Checkbox.js.map +7 -0
  7. package/lib/cjs/pre-ldls/components/Checkbox/Checkbox.stories.js +33 -0
  8. package/lib/cjs/pre-ldls/components/Checkbox/Checkbox.stories.js.map +7 -0
  9. package/lib/cjs/pre-ldls/components/TextInput/TextInput.js +226 -0
  10. package/lib/cjs/pre-ldls/components/TextInput/TextInput.js.map +7 -0
  11. package/lib/cjs/pre-ldls/components/TextInput/TextInput.stories.js +93 -0
  12. package/lib/cjs/pre-ldls/components/TextInput/TextInput.stories.js.map +7 -0
  13. package/lib/cjs/pre-ldls/components/index.js +1 -0
  14. package/lib/cjs/pre-ldls/components/index.js.map +2 -2
  15. package/lib/cjs/pre-ldls/libs/index.js +4 -2
  16. package/lib/cjs/pre-ldls/libs/index.js.map +2 -2
  17. package/lib/pre-ldls/components/AccountItem/AccountItem.d.ts +8 -4
  18. package/lib/pre-ldls/components/AccountItem/AccountItem.d.ts.map +1 -1
  19. package/lib/pre-ldls/components/AccountItem/AccountItem.js +27 -5
  20. package/lib/pre-ldls/components/AccountItem/AccountItem.js.map +1 -1
  21. package/lib/pre-ldls/components/Checkbox/Checkbox.d.ts +10 -0
  22. package/lib/pre-ldls/components/Checkbox/Checkbox.d.ts.map +1 -0
  23. package/lib/pre-ldls/components/Checkbox/Checkbox.js +62 -0
  24. package/lib/pre-ldls/components/Checkbox/Checkbox.js.map +1 -0
  25. package/lib/pre-ldls/components/TextInput/TextInput.d.ts +20 -0
  26. package/lib/pre-ldls/components/TextInput/TextInput.d.ts.map +1 -0
  27. package/lib/pre-ldls/components/TextInput/TextInput.js +159 -0
  28. package/lib/pre-ldls/components/TextInput/TextInput.js.map +1 -0
  29. package/lib/pre-ldls/components/index.d.ts +1 -0
  30. package/lib/pre-ldls/components/index.d.ts.map +1 -1
  31. package/lib/pre-ldls/components/index.js +1 -0
  32. package/lib/pre-ldls/components/index.js.map +1 -1
  33. package/lib/pre-ldls/libs/index.d.ts +2 -0
  34. package/lib/pre-ldls/libs/index.d.ts.map +1 -1
  35. package/lib/pre-ldls/libs/index.js +2 -0
  36. package/lib/pre-ldls/libs/index.js.map +1 -1
  37. package/package.json +2 -2
@@ -0,0 +1,226 @@
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 TextInput_exports = {};
30
+ __export(TextInput_exports, {
31
+ TextInput: () => TextInput
32
+ });
33
+ module.exports = __toCommonJS(TextInput_exports);
34
+ var import_debounce = __toESM(require("lodash/debounce"));
35
+ var import_react = __toESM(require("react"));
36
+ var import_styled_components = __toESM(require("styled-components"));
37
+ var import_assets = require("../../../assets");
38
+ var import_components = require("../../../components");
39
+ var import_libs = require("../../libs");
40
+ const DEBOUNCE_MS = 250;
41
+ const COLORS_BORDER_STATUS_ERROR_DEFAULT = "colors-border-status-error-default";
42
+ const EXTRA_FONT_SIZE = "0.75rem";
43
+ const ICON_BUTTONS_SIZE = "32px";
44
+ const LABEL_OFFSET_Y = `calc(-0.5 * ${EXTRA_FONT_SIZE})`;
45
+ const LABEL_OFFSET_X = "var(--spacing-s, 16px)";
46
+ const LABEL_PADDING = "5px";
47
+ const ClearButton = import_styled_components.default.button`
48
+ ${(0, import_libs.withTokens)("colors-surface-dark-default")}
49
+
50
+ all: unset;
51
+ cursor: pointer;
52
+ display: inline-flex;
53
+ align-items: center;
54
+ justify-content: center;
55
+ height: ${ICON_BUTTONS_SIZE};
56
+ width: ${ICON_BUTTONS_SIZE};
57
+ `;
58
+ const Container = import_styled_components.default.div`
59
+ ${(0, import_libs.withTokens)("spacing-xxs")}
60
+
61
+ display: flex;
62
+ flex-direction: column;
63
+ gap: var(--spacing-xxs, 4px);
64
+ position: relative;
65
+ min-width: 328px;
66
+ `;
67
+ const Label = import_styled_components.default.label`
68
+ ${(0, import_libs.withTokens)(
69
+ COLORS_BORDER_STATUS_ERROR_DEFAULT,
70
+ "colors-border-active-default",
71
+ "colors-content-disabled",
72
+ "colors-content-subdued-default-default",
73
+ "spacing-s"
74
+ )}
75
+ color: ${({ hasError, isDisabled, isFocused }) => isDisabled ? "var(--colors-content-disabled)" : hasError ? `var(--${COLORS_BORDER_STATUS_ERROR_DEFAULT});` : isFocused ? "var(--colors-border-active-default)" : "var(--colors-content-subdued-default-default);"};
76
+ font-size: ${EXTRA_FONT_SIZE};
77
+ padding-inline: ${LABEL_PADDING};
78
+ position: absolute;
79
+ top: ${LABEL_OFFSET_Y};
80
+ left: calc(${LABEL_OFFSET_X} - ${LABEL_PADDING});
81
+ `;
82
+ const Wrapper = import_styled_components.default.div`
83
+ ${(0, import_libs.withTokens)(
84
+ "colors-content-default-default",
85
+ "colors-surface-transparent-subdued-default",
86
+ "radius-s",
87
+ "spacing-s",
88
+ "spacing-xxs"
89
+ )}
90
+
91
+ align-items: center;
92
+ border-radius: var(--radius-s);
93
+ display: flex;
94
+ gap: var(--spacing-xxs, 8px);
95
+ height: 56px;
96
+ padding: ${({ hasEnd, hasStart }) => `0 ${hasEnd ? "var(--spacing-xs, 8px)" : LABEL_OFFSET_X} 0 ${hasStart ? "var(--spacing-xs, 8px)" : LABEL_OFFSET_X}`};
97
+ position: relative;
98
+ transition: height 0.3s linear;
99
+ `;
100
+ const StyledInput = import_styled_components.default.input`
101
+ ${(0, import_libs.withTokens)("colors-border-disabled-default")}
102
+
103
+ flex: 1;
104
+ background: none;
105
+ border: none;
106
+ cursor: text;
107
+ &[disabled] {
108
+ color: var(--colors-border-disabled-default);
109
+ cursor: not-allowed;
110
+ }
111
+ `;
112
+ const Fieldset = import_styled_components.default.fieldset`
113
+ ${(0, import_libs.withTokens)(
114
+ COLORS_BORDER_STATUS_ERROR_DEFAULT,
115
+ "colors-border-active-default",
116
+ "colors-content-subdued-default-default",
117
+ "colors-content-disabled",
118
+ "spacing-s"
119
+ )}
120
+ border-radius: var(--radius-s);
121
+ border-color: ${({ isDisabled, hasError, isFocused }) => isDisabled ? "var(--colors-content-disabled)" : hasError ? `var(--${COLORS_BORDER_STATUS_ERROR_DEFAULT})` : isFocused ? "var(--colors-border-active-default)" : "var(--colors-content-subdued-default-default)"};
122
+ border-style: solid;
123
+ border-width: 1px;
124
+ bottom: 0;
125
+ font-size: ${EXTRA_FONT_SIZE};
126
+ left: 0;
127
+ overflow: hidden;
128
+ padding: 0 calc(${LABEL_OFFSET_X} - ${LABEL_PADDING});
129
+ pointer-events: none;
130
+ position: absolute;
131
+ right: 0;
132
+ top: ${({ hasLabel }) => hasLabel ? LABEL_OFFSET_Y : "0"};
133
+ `;
134
+ const Legend = import_styled_components.default.legend`
135
+ visibility: hidden;
136
+ padding-inline: ${LABEL_PADDING};
137
+ `;
138
+ const HelperContainer = (0, import_styled_components.default)(import_components.Flex)`
139
+ ${(0, import_libs.withTokens)(COLORS_BORDER_STATUS_ERROR_DEFAULT)}
140
+ align-items: center;
141
+ `;
142
+ const HelperText = import_styled_components.default.span`
143
+ ${(0, import_libs.withTokens)(COLORS_BORDER_STATUS_ERROR_DEFAULT, "colors-border-disabled-default")}
144
+ ${({ isDisabled, hasError }) => isDisabled ? "var(--colors-border-disabled-default)" : hasError ? `color: var(--${COLORS_BORDER_STATUS_ERROR_DEFAULT});` : ""}
145
+ font-size: ${EXTRA_FONT_SIZE};
146
+ `;
147
+ const TextInput = import_react.default.forwardRef(
148
+ ({
149
+ label,
150
+ name,
151
+ defaultValue = "",
152
+ startAdornment = null,
153
+ endAdornment = null,
154
+ error = false,
155
+ helperText,
156
+ style,
157
+ onFocus,
158
+ onBlur,
159
+ onChange,
160
+ ...rest
161
+ }, ref) => {
162
+ const inputRef = import_react.default.useRef(null);
163
+ const [isFocused, setIsFocused] = import_react.default.useState(false);
164
+ const [value, setValue] = import_react.default.useState(defaultValue);
165
+ import_react.default.useImperativeHandle(ref, () => inputRef.current);
166
+ const hideClearDebounced = import_react.default.useMemo(
167
+ () => (0, import_debounce.default)(() => setIsFocused(false), DEBOUNCE_MS),
168
+ []
169
+ );
170
+ const handleFocus = (e) => {
171
+ hideClearDebounced.cancel();
172
+ setIsFocused(true);
173
+ onFocus == null ? void 0 : onFocus(e);
174
+ };
175
+ const handleBlur = (e) => {
176
+ onBlur == null ? void 0 : onBlur(e);
177
+ hideClearDebounced();
178
+ };
179
+ import_react.default.useEffect(() => () => hideClearDebounced.cancel(), [hideClearDebounced]);
180
+ const handleChange = (e) => {
181
+ setValue(e.target.value);
182
+ onChange == null ? void 0 : onChange(e);
183
+ };
184
+ const clearInput = () => {
185
+ if (inputRef.current) {
186
+ inputRef.current.value = "";
187
+ setValue("");
188
+ inputRef.current.focus();
189
+ }
190
+ };
191
+ const showClear = value.length > 0 && (isFocused || error);
192
+ const hasEnd = showClear || Boolean(endAdornment);
193
+ const hasError = Boolean(error);
194
+ const hasLabel = Boolean(label);
195
+ const isDisabled = Boolean(rest.disabled);
196
+ return /* @__PURE__ */ import_react.default.createElement(Container, { style }, label && /* @__PURE__ */ import_react.default.createElement(Label, { isDisabled, hasError, isFocused, htmlFor: name }, label), /* @__PURE__ */ import_react.default.createElement(Wrapper, { hasStart: Boolean(startAdornment), hasEnd }, startAdornment, /* @__PURE__ */ import_react.default.createElement(
197
+ StyledInput,
198
+ {
199
+ name,
200
+ defaultValue,
201
+ onFocus: handleFocus,
202
+ onBlur: handleBlur,
203
+ onChange: handleChange,
204
+ ...rest,
205
+ ref: inputRef
206
+ }
207
+ ), showClear ? /* @__PURE__ */ import_react.default.createElement(ClearButton, { onClick: clearInput, "aria-label": "Clear" }, /* @__PURE__ */ import_react.default.createElement(import_assets.Icons.DeleteCircleFill, { size: "S", color: "var(--colors-surface-dark-default)" })) : endAdornment, /* @__PURE__ */ import_react.default.createElement(
208
+ Fieldset,
209
+ {
210
+ hasError,
211
+ hasLabel,
212
+ isDisabled,
213
+ isFocused
214
+ },
215
+ label ? /* @__PURE__ */ import_react.default.createElement(Legend, null, label) : null
216
+ )), helperText ? /* @__PURE__ */ import_react.default.createElement(HelperContainer, { columnGap: 2 }, hasError ? /* @__PURE__ */ import_react.default.createElement(
217
+ import_assets.Icons.DeleteCircleFill,
218
+ {
219
+ size: "S",
220
+ color: `var(--${COLORS_BORDER_STATUS_ERROR_DEFAULT})`
221
+ }
222
+ ) : null, /* @__PURE__ */ import_react.default.createElement(HelperText, { isDisabled, hasError }, helperText)) : null);
223
+ }
224
+ );
225
+ TextInput.displayName = "TextInput";
226
+ //# sourceMappingURL=TextInput.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/pre-ldls/components/TextInput/TextInput.tsx"],
4
+ "sourcesContent": ["import debounce from \"lodash/debounce\";\nimport React from \"react\";\nimport styled from \"styled-components\";\nimport { Icons } from \"../../../assets\";\nimport { Flex } from \"../../../components\";\nimport { withTokens } from \"../../libs\";\n\nconst DEBOUNCE_MS = 250;\n\nconst COLORS_BORDER_STATUS_ERROR_DEFAULT = \"colors-border-status-error-default\";\nconst EXTRA_FONT_SIZE = \"0.75rem\";\nconst ICON_BUTTONS_SIZE = \"32px\";\nconst LABEL_OFFSET_Y = `calc(-0.5 * ${EXTRA_FONT_SIZE})`;\nconst LABEL_OFFSET_X = \"var(--spacing-s, 16px)\";\nconst LABEL_PADDING = \"5px\";\n\ntype NativeInputProps = Omit<React.ComponentProps<\"input\">, \"value\" | \"defaultValue\">;\n\nexport type TextInputProps = Readonly<\n NativeInputProps & {\n defaultValue?: string;\n label?: string;\n startAdornment?: React.ReactNode;\n endAdornment?: React.ReactNode;\n error?: boolean;\n helperText?: string;\n }\n>;\n\nconst ClearButton = styled.button`\n ${withTokens(\"colors-surface-dark-default\")}\n\n all: unset;\n cursor: pointer;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n height: ${ICON_BUTTONS_SIZE};\n width: ${ICON_BUTTONS_SIZE};\n`;\n\nconst Container = styled.div`\n ${withTokens(\"spacing-xxs\")}\n\n display: flex;\n flex-direction: column;\n gap: var(--spacing-xxs, 4px);\n position: relative;\n min-width: 328px;\n`;\n\nconst Label = styled.label<{ isDisabled: boolean; hasError: boolean; isFocused: boolean }>`\n ${withTokens(\n COLORS_BORDER_STATUS_ERROR_DEFAULT,\n \"colors-border-active-default\",\n \"colors-content-disabled\",\n \"colors-content-subdued-default-default\",\n \"spacing-s\",\n )}\n color: ${({ hasError, isDisabled, isFocused }) =>\n isDisabled\n ? \"var(--colors-content-disabled)\"\n : hasError\n ? `var(--${COLORS_BORDER_STATUS_ERROR_DEFAULT});`\n : isFocused\n ? \"var(--colors-border-active-default)\"\n : \"var(--colors-content-subdued-default-default);\"};\n font-size: ${EXTRA_FONT_SIZE};\n padding-inline: ${LABEL_PADDING};\n position: absolute;\n top: ${LABEL_OFFSET_Y};\n left: calc(${LABEL_OFFSET_X} - ${LABEL_PADDING});\n`;\n\nconst Wrapper = styled.div<{\n hasStart: boolean;\n hasEnd: boolean;\n}>`\n ${withTokens(\n \"colors-content-default-default\",\n \"colors-surface-transparent-subdued-default\",\n \"radius-s\",\n \"spacing-s\",\n \"spacing-xxs\",\n )}\n\n align-items: center;\n border-radius: var(--radius-s);\n display: flex;\n gap: var(--spacing-xxs, 8px);\n height: 56px;\n padding: ${({ hasEnd, hasStart }) =>\n `0 ${hasEnd ? \"var(--spacing-xs, 8px)\" : LABEL_OFFSET_X} 0 ${\n hasStart ? \"var(--spacing-xs, 8px)\" : LABEL_OFFSET_X\n }`};\n position: relative;\n transition: height 0.3s linear;\n`;\n\nconst StyledInput = styled.input`\n ${withTokens(\"colors-border-disabled-default\")}\n\n flex: 1;\n background: none;\n border: none;\n cursor: text;\n &[disabled] {\n color: var(--colors-border-disabled-default);\n cursor: not-allowed;\n }\n`;\n\nconst Fieldset = styled.fieldset<{\n hasError: boolean;\n hasLabel: boolean;\n isDisabled: boolean;\n isFocused: boolean;\n}>`\n ${withTokens(\n COLORS_BORDER_STATUS_ERROR_DEFAULT,\n \"colors-border-active-default\",\n \"colors-content-subdued-default-default\",\n \"colors-content-disabled\",\n \"spacing-s\",\n )}\n border-radius: var(--radius-s);\n border-color: ${({ isDisabled, hasError, isFocused }) =>\n isDisabled\n ? \"var(--colors-content-disabled)\"\n : hasError\n ? `var(--${COLORS_BORDER_STATUS_ERROR_DEFAULT})`\n : isFocused\n ? \"var(--colors-border-active-default)\"\n : \"var(--colors-content-subdued-default-default)\"};\n border-style: solid;\n border-width: 1px;\n bottom: 0;\n font-size: ${EXTRA_FONT_SIZE};\n left: 0;\n overflow: hidden;\n padding: 0 calc(${LABEL_OFFSET_X} - ${LABEL_PADDING});\n pointer-events: none;\n position: absolute;\n right: 0;\n top: ${({ hasLabel }) => (hasLabel ? LABEL_OFFSET_Y : \"0\")};\n`;\n\nconst Legend = styled.legend`\n visibility: hidden;\n padding-inline: ${LABEL_PADDING};\n`;\n\nconst HelperContainer = styled(Flex)`\n ${withTokens(COLORS_BORDER_STATUS_ERROR_DEFAULT)}\n align-items: center;\n`;\n\n// TODO what's the color for disabled helperText?\nconst HelperText = styled.span<{ hasError: boolean; isDisabled: boolean }>`\n ${withTokens(COLORS_BORDER_STATUS_ERROR_DEFAULT, \"colors-border-disabled-default\")}\n ${({ isDisabled, hasError }) =>\n isDisabled\n ? \"var(--colors-border-disabled-default)\"\n : hasError\n ? `color: var(--${COLORS_BORDER_STATUS_ERROR_DEFAULT});`\n : \"\"}\n font-size: ${EXTRA_FONT_SIZE};\n`;\n\nexport const TextInput = React.forwardRef<HTMLInputElement, TextInputProps>(\n (\n {\n label,\n name,\n defaultValue = \"\",\n startAdornment = null,\n endAdornment = null,\n error = false,\n helperText,\n style,\n onFocus,\n onBlur,\n onChange,\n ...rest\n },\n ref,\n ) => {\n const inputRef = React.useRef<HTMLInputElement>(null);\n const [isFocused, setIsFocused] = React.useState(false);\n const [value, setValue] = React.useState(defaultValue);\n\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n React.useImperativeHandle(ref, () => inputRef.current as HTMLInputElement);\n\n const hideClearDebounced = React.useMemo(\n () => debounce(() => setIsFocused(false), DEBOUNCE_MS),\n [],\n );\n\n const handleFocus = (e: React.FocusEvent<HTMLInputElement>) => {\n hideClearDebounced.cancel();\n setIsFocused(true);\n onFocus?.(e);\n };\n\n const handleBlur = (e: React.FocusEvent<HTMLInputElement>) => {\n onBlur?.(e);\n hideClearDebounced();\n };\n\n React.useEffect(() => () => hideClearDebounced.cancel(), [hideClearDebounced]);\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n setValue(e.target.value);\n onChange?.(e);\n };\n\n const clearInput = () => {\n if (inputRef.current) {\n inputRef.current.value = \"\";\n setValue(\"\");\n inputRef.current.focus();\n }\n };\n\n const showClear = value.length > 0 && (isFocused || error);\n const hasEnd = showClear || Boolean(endAdornment);\n const hasError = Boolean(error);\n const hasLabel = Boolean(label);\n const isDisabled = Boolean(rest.disabled);\n\n return (\n <Container style={style}>\n {label && (\n <Label isDisabled={isDisabled} hasError={hasError} isFocused={isFocused} htmlFor={name}>\n {label}\n </Label>\n )}\n\n <Wrapper hasStart={Boolean(startAdornment)} hasEnd={hasEnd}>\n {startAdornment}\n\n <StyledInput\n name={name}\n defaultValue={defaultValue}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onChange={handleChange}\n {...rest}\n ref={inputRef}\n />\n\n {showClear ? (\n <ClearButton onClick={clearInput} aria-label=\"Clear\">\n <Icons.DeleteCircleFill size=\"S\" color=\"var(--colors-surface-dark-default)\" />\n </ClearButton>\n ) : (\n endAdornment\n )}\n\n <Fieldset\n hasError={hasError}\n hasLabel={hasLabel}\n isDisabled={isDisabled}\n isFocused={isFocused}\n >\n {label ? <Legend>{label}</Legend> : null}\n </Fieldset>\n </Wrapper>\n\n {helperText ? (\n <HelperContainer columnGap={2}>\n {hasError ? (\n <Icons.DeleteCircleFill\n size=\"S\"\n color={`var(--${COLORS_BORDER_STATUS_ERROR_DEFAULT})`}\n />\n ) : null}\n <HelperText isDisabled={isDisabled} hasError={hasError}>\n {helperText}\n </HelperText>\n </HelperContainer>\n ) : null}\n </Container>\n );\n },\n);\n\nTextInput.displayName = \"TextInput\";\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAqB;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AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,MAEC,QAAQ,6BAAAA,QAAA,cAAC,cAAQ,KAAM,IAAY;AAAA,IACtC,CACF,GAEC,aACC,6BAAAA,QAAA,cAAC,mBAAgB,WAAW,KACzB,WACC,6BAAAA,QAAA;AAAA,MAAC,oBAAM;AAAA,MAAN;AAAA,QACC,MAAK;AAAA,QACL,OAAO,SAAS,kCAAkC;AAAA;AAAA,IACpD,IACE,MACJ,6BAAAA,QAAA,cAAC,cAAW,YAAwB,YACjC,UACH,CACF,IACE,IACN;AAAA,EAEJ;AACF;AAEA,UAAU,cAAc;",
6
+ "names": ["styled", "React", "debounce"]
7
+ }
@@ -0,0 +1,93 @@
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 TextInput_stories_exports = {};
30
+ __export(TextInput_stories_exports, {
31
+ Default: () => Default,
32
+ Disabled: () => Disabled,
33
+ Filled: () => Filled,
34
+ WithAdornments: () => WithAdornments,
35
+ WithError: () => WithError,
36
+ WithLabel: () => WithLabel,
37
+ default: () => TextInput_stories_default
38
+ });
39
+ module.exports = __toCommonJS(TextInput_stories_exports);
40
+ var import_react = __toESM(require("react"));
41
+ var import_assets = require("../../../assets");
42
+ var import_TextInput = require("./TextInput");
43
+ const meta = {
44
+ component: import_TextInput.TextInput,
45
+ title: "PreLdls/Components/TextInput",
46
+ tags: ["autodocs"]
47
+ };
48
+ var TextInput_stories_default = meta;
49
+ const Default = {
50
+ args: {
51
+ name: "plain",
52
+ placeholder: "Type here"
53
+ }
54
+ };
55
+ const WithLabel = {
56
+ args: {
57
+ name: "labelled",
58
+ label: "Your comment",
59
+ placeholder: "Write something"
60
+ }
61
+ };
62
+ const WithAdornments = {
63
+ args: {
64
+ name: "adorned",
65
+ startAdornment: /* @__PURE__ */ import_react.default.createElement(import_assets.Icons.Search, { size: "S" }),
66
+ placeholder: "Search accounts"
67
+ }
68
+ };
69
+ const WithError = {
70
+ args: {
71
+ name: "errorDemo",
72
+ label: "Errored label",
73
+ defaultValue: "-20.00",
74
+ error: true,
75
+ helperText: "Amount must be a positive number"
76
+ }
77
+ };
78
+ const Filled = {
79
+ args: {
80
+ name: "filledDemo",
81
+ defaultValue: "Clear me",
82
+ helperText: "This is a filled input"
83
+ }
84
+ };
85
+ const Disabled = {
86
+ args: {
87
+ name: "disabled",
88
+ label: "Disabled label",
89
+ placeholder: "Disabled",
90
+ disabled: true
91
+ }
92
+ };
93
+ //# sourceMappingURL=TextInput.stories.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/pre-ldls/components/TextInput/TextInput.stories.tsx"],
4
+ "sourcesContent": ["import type { Meta, StoryObj } from \"@storybook/react\";\nimport React from \"react\";\nimport { Icons } from \"../../../assets\";\nimport { TextInput, TextInputProps } from \"./TextInput\";\n\nconst meta: Meta<typeof TextInput> = {\n component: TextInput,\n title: \"PreLdls/Components/TextInput\",\n tags: [\"autodocs\"],\n};\nexport default meta;\n\ntype Story = StoryObj<TextInputProps>;\n\nexport const Default: Story = {\n args: {\n name: \"plain\",\n placeholder: \"Type here\",\n },\n};\n\nexport const WithLabel: Story = {\n args: {\n name: \"labelled\",\n label: \"Your comment\",\n placeholder: \"Write something\",\n },\n};\n\nexport const WithAdornments: Story = {\n args: {\n name: \"adorned\",\n startAdornment: <Icons.Search size=\"S\" />,\n placeholder: \"Search accounts\",\n },\n};\n\nexport const WithError: Story = {\n args: {\n name: \"errorDemo\",\n label: \"Errored label\",\n defaultValue: \"-20.00\",\n error: true,\n helperText: \"Amount must be a positive number\",\n },\n};\n\nexport const Filled: Story = {\n args: {\n name: \"filledDemo\",\n defaultValue: \"Clear me\",\n helperText: \"This is a filled input\",\n },\n};\n\nexport const Disabled: Story = {\n args: {\n name: \"disabled\",\n label: \"Disabled label\",\n placeholder: \"Disabled\",\n disabled: true,\n },\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAClB,oBAAsB;AACtB,uBAA0C;AAE1C,MAAM,OAA+B;AAAA,EACnC,WAAW;AAAA,EACX,OAAO;AAAA,EACP,MAAM,CAAC,UAAU;AACnB;AACA,IAAO,4BAAQ;AAIR,MAAM,UAAiB;AAAA,EAC5B,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AACF;AAEO,MAAM,YAAmB;AAAA,EAC9B,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AACF;AAEO,MAAM,iBAAwB;AAAA,EACnC,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,gBAAgB,6BAAAA,QAAA,cAAC,oBAAM,QAAN,EAAa,MAAK,KAAI;AAAA,IACvC,aAAa;AAAA,EACf;AACF;AAEO,MAAM,YAAmB;AAAA,EAC9B,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,OAAO;AAAA,IACP,cAAc;AAAA,IACd,OAAO;AAAA,IACP,YAAY;AAAA,EACd;AACF;AAEO,MAAM,SAAgB;AAAA,EAC3B,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,cAAc;AAAA,IACd,YAAY;AAAA,EACd;AACF;AAEO,MAAM,WAAkB;AAAA,EAC7B,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,OAAO;AAAA,IACP,aAAa;AAAA,IACb,UAAU;AAAA,EACZ;AACF;",
6
+ "names": ["React"]
7
+ }
@@ -26,5 +26,6 @@ __reExport(components_exports, require("./NetworkItem/NetworkItem"), module.expo
26
26
  __reExport(components_exports, require("./NetworkList/NetworkList"), module.exports);
27
27
  __reExport(components_exports, require("./Search/Search"), module.exports);
28
28
  __reExport(components_exports, require("./Tag/Tag"), module.exports);
29
+ __reExport(components_exports, require("./TextInput/TextInput"), module.exports);
29
30
  __reExport(components_exports, require("./VirtualList/VirtualList"), module.exports);
30
31
  //# sourceMappingURL=index.js.map
@@ -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 \"./Input/Input\";\nexport * from \"./NetworkItem/NetworkItem\";\nexport * from \"./NetworkList/NetworkList\";\nexport * from \"./Search/Search\";\nexport * from \"./Tag/Tag\";\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,0BANd;AAOA,+BAAc,sCAPd;AAQA,+BAAc,sCARd;AASA,+BAAc,4BATd;AAUA,+BAAc,sBAVd;AAWA,+BAAc,sCAXd;",
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 \"./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,0BANd;AAOA,+BAAc,sCAPd;AAQA,+BAAc,sCARd;AASA,+BAAc,4BATd;AAUA,+BAAc,sBAVd;AAWA,+BAAc,kCAXd;AAYA,+BAAc,sCAZd;",
6
6
  "names": []
7
7
  }
@@ -66,12 +66,14 @@ const overrideColor = {
66
66
  // override from colours
67
67
  "border-subdued-default-hover": "#D5D5D5",
68
68
  // override from colours
69
- "border-subdued-default-pressed": "#C1C1C1"
69
+ "border-subdued-default-pressed": "#C1C1C1",
70
70
  // missing from colours
71
+ "background-active": "#D4A0FF"
71
72
  },
72
73
  dark: {
73
- "opacity-default-10": "#FFFFFF1A"
74
+ "opacity-default-10": "#FFFFFF1A",
74
75
  // missing from colours
76
+ "background-active": "#D4A0FF"
75
77
  }
76
78
  };
77
79
  const withTokens = (...usedTokens) => {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/pre-ldls/libs/index.ts"],
4
- "sourcesContent": ["import memoize from \"lodash/memoize\";\nimport { css, DefaultTheme } from \"styled-components\";\nimport { dark, light, ModeColors, spacing, SpacingScale } from \"./design-tokens\";\n\n// Add temporarily missing and override incorrect tokens here\nconst overrideOther = {\n \"radius-m\": \"12px\", // missing from tokens\n \"radius-s\": \"8px\", // missing from tokens\n \"radius-xs\": \"4px\", // missing from tokens\n \"border-width-default\": \"1px\", // missing from tokens\n \"border-width-focus\": \"2px\", // missing from tokens\n \"margin-xs\": \"8px\", // redefines marging-xs\n \"margin-s\": \"16px\", // redefines marging-s\n \"margin-m\": \"24px\", // redefines marging-m\n \"margin-l\": \"32px\", // redefines marging-l\n\n \"spacing-xs\": \"12px\", // override from \"spacing-xxs\": \"12px\"\n \"spacing-xxs\": \"8px\", // override from \"spacing-xs\": \"8px\"\n} as const;\n\n// Add temporarily missing and override incorrect colours here\nconst overrideColor = {\n light: {\n \"surface-transparent-hover\": \"#0000000D\", // override from colours\n \"surface-transparent-pressed\": \"#0000001A\", // override from colours\n \"border-subdued-default-hover\": \"#D5D5D5\", // override from colours\n\n \"border-subdued-default-pressed\": \"#C1C1C1\", // missing from colours\n },\n dark: {\n \"opacity-default-10\": \"#FFFFFF1A\", // missing from colours\n },\n} as const;\n\ntype ColorToken =\n | `colors-${keyof ModeColors}`\n | `colors-${keyof typeof overrideColor.light}`\n | `colors-${keyof typeof overrideColor.dark}`;\ntype OtherToken = keyof (SpacingScale & typeof overrideOther);\n\nexport const withTokens = (...usedTokens: Array<ColorToken | OtherToken>) => {\n const filterTokens = memoize((theme: DefaultTheme[\"theme\"]) => {\n const colors = {\n dark: { ...dark, ...overrideColor.dark },\n light: { ...light, ...overrideColor.light },\n }[theme];\n\n const colorEntries = Object.entries(colors).flatMap(([key, value]) => {\n const color = `colors-${key}` as ColorToken;\n if (!usedTokens.includes(color)) return [];\n return [[`--${color}`, value]];\n });\n const otherEntries = [spacing, overrideOther]\n .flatMap(Object.entries)\n .flatMap(([key, value]) => {\n if (!usedTokens.includes(key as OtherToken)) return [];\n return [[`--${key}`, value]];\n });\n\n return Object.fromEntries([...colorEntries, ...otherEntries]);\n });\n\n return css(({ theme }) => filterTokens(theme.colors.type as DefaultTheme[\"theme\"]));\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAoB;AACpB,+BAAkC;AAClC,2BAA+D;AAG/D,MAAM,gBAAgB;AAAA,EACpB,YAAY;AAAA;AAAA,EACZ,YAAY;AAAA;AAAA,EACZ,aAAa;AAAA;AAAA,EACb,wBAAwB;AAAA;AAAA,EACxB,sBAAsB;AAAA;AAAA,EACtB,aAAa;AAAA;AAAA,EACb,YAAY;AAAA;AAAA,EACZ,YAAY;AAAA;AAAA,EACZ,YAAY;AAAA;AAAA,EAEZ,cAAc;AAAA;AAAA,EACd,eAAe;AAAA;AACjB;AAGA,MAAM,gBAAgB;AAAA,EACpB,OAAO;AAAA,IACL,6BAA6B;AAAA;AAAA,IAC7B,+BAA+B;AAAA;AAAA,IAC/B,gCAAgC;AAAA;AAAA,IAEhC,kCAAkC;AAAA;AAAA,EACpC;AAAA,EACA,MAAM;AAAA,IACJ,sBAAsB;AAAA;AAAA,EACxB;AACF;AAQO,MAAM,aAAa,IAAI,eAA+C;AAC3E,QAAM,mBAAe,eAAAA,SAAQ,CAAC,UAAiC;AAC7D,UAAM,SAAS;AAAA,MACb,MAAM,EAAE,GAAG,2BAAM,GAAG,cAAc,KAAK;AAAA,MACvC,OAAO,EAAE,GAAG,4BAAO,GAAG,cAAc,MAAM;AAAA,IAC5C,EAAE,KAAK;AAEP,UAAM,eAAe,OAAO,QAAQ,MAAM,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AACpE,YAAM,QAAQ,UAAU,GAAG;AAC3B,UAAI,CAAC,WAAW,SAAS,KAAK;AAAG,eAAO,CAAC;AACzC,aAAO,CAAC,CAAC,KAAK,KAAK,IAAI,KAAK,CAAC;AAAA,IAC/B,CAAC;AACD,UAAM,eAAe,CAAC,8BAAS,aAAa,EACzC,QAAQ,OAAO,OAAO,EACtB,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AACzB,UAAI,CAAC,WAAW,SAAS,GAAiB;AAAG,eAAO,CAAC;AACrD,aAAO,CAAC,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC;AAAA,IAC7B,CAAC;AAEH,WAAO,OAAO,YAAY,CAAC,GAAG,cAAc,GAAG,YAAY,CAAC;AAAA,EAC9D,CAAC;AAED,aAAO,8BAAI,CAAC,EAAE,MAAM,MAAM,aAAa,MAAM,OAAO,IAA6B,CAAC;AACpF;",
4
+ "sourcesContent": ["import memoize from \"lodash/memoize\";\nimport { css, DefaultTheme } from \"styled-components\";\nimport { dark, light, ModeColors, spacing, SpacingScale } from \"./design-tokens\";\n\n// Add temporarily missing and override incorrect tokens here\nconst overrideOther = {\n \"radius-m\": \"12px\", // missing from tokens\n \"radius-s\": \"8px\", // missing from tokens\n \"radius-xs\": \"4px\", // missing from tokens\n \"border-width-default\": \"1px\", // missing from tokens\n \"border-width-focus\": \"2px\", // missing from tokens\n \"margin-xs\": \"8px\", // redefines marging-xs\n \"margin-s\": \"16px\", // redefines marging-s\n \"margin-m\": \"24px\", // redefines marging-m\n \"margin-l\": \"32px\", // redefines marging-l\n\n \"spacing-xs\": \"12px\", // override from \"spacing-xxs\": \"12px\"\n \"spacing-xxs\": \"8px\", // override from \"spacing-xs\": \"8px\"\n} as const;\n\n// Add temporarily missing and override incorrect colours here\nconst overrideColor = {\n light: {\n \"surface-transparent-hover\": \"#0000000D\", // override from colours\n \"surface-transparent-pressed\": \"#0000001A\", // override from colours\n \"border-subdued-default-hover\": \"#D5D5D5\", // override from colours\n\n \"border-subdued-default-pressed\": \"#C1C1C1\", // missing from colours\n \"background-active\": \"#D4A0FF\",\n },\n dark: {\n \"opacity-default-10\": \"#FFFFFF1A\", // missing from colours\n \"background-active\": \"#D4A0FF\",\n },\n} as const;\n\ntype ColorToken =\n | `colors-${keyof ModeColors}`\n | `colors-${keyof typeof overrideColor.light}`\n | `colors-${keyof typeof overrideColor.dark}`;\ntype OtherToken = keyof (SpacingScale & typeof overrideOther);\n\nexport const withTokens = (...usedTokens: Array<ColorToken | OtherToken>) => {\n const filterTokens = memoize((theme: DefaultTheme[\"theme\"]) => {\n const colors = {\n dark: { ...dark, ...overrideColor.dark },\n light: { ...light, ...overrideColor.light },\n }[theme];\n\n const colorEntries = Object.entries(colors).flatMap(([key, value]) => {\n const color = `colors-${key}` as ColorToken;\n if (!usedTokens.includes(color)) return [];\n return [[`--${color}`, value]];\n });\n const otherEntries = [spacing, overrideOther]\n .flatMap(Object.entries)\n .flatMap(([key, value]) => {\n if (!usedTokens.includes(key as OtherToken)) return [];\n return [[`--${key}`, value]];\n });\n\n return Object.fromEntries([...colorEntries, ...otherEntries]);\n });\n\n return css(({ theme }) => filterTokens(theme.colors.type as DefaultTheme[\"theme\"]));\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAoB;AACpB,+BAAkC;AAClC,2BAA+D;AAG/D,MAAM,gBAAgB;AAAA,EACpB,YAAY;AAAA;AAAA,EACZ,YAAY;AAAA;AAAA,EACZ,aAAa;AAAA;AAAA,EACb,wBAAwB;AAAA;AAAA,EACxB,sBAAsB;AAAA;AAAA,EACtB,aAAa;AAAA;AAAA,EACb,YAAY;AAAA;AAAA,EACZ,YAAY;AAAA;AAAA,EACZ,YAAY;AAAA;AAAA,EAEZ,cAAc;AAAA;AAAA,EACd,eAAe;AAAA;AACjB;AAGA,MAAM,gBAAgB;AAAA,EACpB,OAAO;AAAA,IACL,6BAA6B;AAAA;AAAA,IAC7B,+BAA+B;AAAA;AAAA,IAC/B,gCAAgC;AAAA;AAAA,IAEhC,kCAAkC;AAAA;AAAA,IAClC,qBAAqB;AAAA,EACvB;AAAA,EACA,MAAM;AAAA,IACJ,sBAAsB;AAAA;AAAA,IACtB,qBAAqB;AAAA,EACvB;AACF;AAQO,MAAM,aAAa,IAAI,eAA+C;AAC3E,QAAM,mBAAe,eAAAA,SAAQ,CAAC,UAAiC;AAC7D,UAAM,SAAS;AAAA,MACb,MAAM,EAAE,GAAG,2BAAM,GAAG,cAAc,KAAK;AAAA,MACvC,OAAO,EAAE,GAAG,4BAAO,GAAG,cAAc,MAAM;AAAA,IAC5C,EAAE,KAAK;AAEP,UAAM,eAAe,OAAO,QAAQ,MAAM,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AACpE,YAAM,QAAQ,UAAU,GAAG;AAC3B,UAAI,CAAC,WAAW,SAAS,KAAK;AAAG,eAAO,CAAC;AACzC,aAAO,CAAC,CAAC,KAAK,KAAK,IAAI,KAAK,CAAC;AAAA,IAC/B,CAAC;AACD,UAAM,eAAe,CAAC,8BAAS,aAAa,EACzC,QAAQ,OAAO,OAAO,EACtB,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AACzB,UAAI,CAAC,WAAW,SAAS,GAAiB;AAAG,eAAO,CAAC;AACrD,aAAO,CAAC,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC;AAAA,IAC7B,CAAC;AAEH,WAAO,OAAO,YAAY,CAAC,GAAG,cAAc,GAAG,YAAY,CAAC;AAAA,EAC9D,CAAC;AAED,aAAO,8BAAI,CAAC,EAAE,MAAM,MAAM,aAAa,MAAM,OAAO,IAA6B,CAAC;AACpF;",
6
6
  "names": ["memoize"]
7
7
  }
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import type { CheckboxProps } from "../../../components/form/Checkbox/Checkbox";
2
+ import type { CheckboxProps } from "../Checkbox/Checkbox";
3
3
  export type Account = {
4
4
  address: string;
5
5
  balance?: string;
@@ -11,14 +11,18 @@ export type Account = {
11
11
  protocol?: string;
12
12
  ticker?: string;
13
13
  };
14
+ export type RightElementArrow = {
15
+ type: "arrow";
16
+ };
14
17
  export type RightElementCheckbox = {
15
18
  type: "checkbox";
16
19
  checkbox: CheckboxProps;
17
20
  };
18
- export type RightElementArrow = {
19
- type: "arrow";
21
+ export type RightElementEdit = {
22
+ type: "edit";
23
+ onClick: () => void;
20
24
  };
21
- export type RightElement = RightElementCheckbox | RightElementArrow;
25
+ export type RightElement = RightElementArrow | RightElementCheckbox | RightElementEdit;
22
26
  export type AccountItemProps = {
23
27
  onClick?: () => void;
24
28
  account: Account;
@@ -1 +1 @@
1
- {"version":3,"file":"AccountItem.d.ts","sourceRoot":"","sources":["../../../../src/pre-ldls/components/AccountItem/AccountItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4CAA4C,CAAC;AAMhF,MAAM,MAAM,OAAO,GAAG;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,aAAa,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,oBAAoB,GAAG,iBAAiB,CAAC;AAEpE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,CAAC,EAAE,MAAM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AO,CAAC;IACjB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAkHF,eAAO,MAAM,WAAW,mEAMrB,gBAAgB,sBA2ElB,CAAC"}
@@ -1,9 +1,24 @@
1
1
  import React from "react";
2
2
  import styled from "styled-components";
3
- import { Checkbox, Icon, Text, Flex } from "../../../components";
3
+ import { Icons } from "../../../assets";
4
+ import { Flex, Icon, Text } from "../../../components";
4
5
  import { withTokens } from "../../libs";
5
6
  import { Address } from "../Address/Address";
7
+ import { Checkbox } from "../Checkbox/Checkbox";
6
8
  import { Tag } from "../Tag/Tag";
9
+ const ICON_BUTTONS_SIZE = "32px";
10
+ // TODO a proper IconButton component that handles hover and pressed states.
11
+ const IconButton = styled.button `
12
+ ${withTokens("colors-content-default-default")}
13
+
14
+ all: unset;
15
+ cursor: pointer;
16
+ display: inline-flex;
17
+ align-items: center;
18
+ justify-content: center;
19
+ height: ${ICON_BUTTONS_SIZE};
20
+ width: ${ICON_BUTTONS_SIZE};
21
+ `;
7
22
  const Wrapper = styled.div `
8
23
  ${withTokens("spacing-xxxs", "spacing-xxs", "spacing-xs", "margin-s", "radius-s", "radius-m", "colors-content-default-default", "colors-surface-transparent-hover", "colors-surface-transparent-pressed", "colors-content-subdued-default-default", "colors-surface-transparent-subdued-default")}
9
24
 
@@ -83,7 +98,7 @@ const BalanceContainer = styled.div `
83
98
  `;
84
99
  export const AccountItem = ({ onClick, account, rightElement, showIcon = true, backgroundColor, }) => {
85
100
  const { name, balance, fiatValue, protocol, address, ticker, cryptoId, parentId } = account;
86
- return (React.createElement(Wrapper, { onClick: onClick, backgroundColor: backgroundColor, isClickable: !!onClick },
101
+ return (React.createElement(Wrapper, { backgroundColor: backgroundColor, isClickable: Boolean(onClick), onClick: onClick },
87
102
  React.createElement(ContentContainer, null,
88
103
  React.createElement(AccountInfoContainer, null,
89
104
  React.createElement(NameRow, null,
@@ -100,9 +115,16 @@ export const AccountItem = ({ onClick, account, rightElement, showIcon = true, b
100
115
  React.createElement(BalanceContainer, null,
101
116
  fiatValue && React.createElement(Text, { fontSize: "14px" }, fiatValue),
102
117
  balance && (React.createElement(Text, { fontSize: "12px", color: "var(--colors-content-subdued-default-default)" }, balance))),
103
- rightElement && rightElement.type === "checkbox" && (React.createElement(Flex, { "data-testid": "right-element-checkbox" },
118
+ rightElement && rightElement.type === "checkbox" && (React.createElement(Flex, { "data-testid": "right-element-checkbox", "aria-label": "Checkbox account item" },
104
119
  React.createElement(Checkbox, { ...rightElement.checkbox, size: 20 }))),
105
- rightElement && rightElement.type === "arrow" && (React.createElement(Flex, { "data-testid": "right-element-arrow-icon" },
106
- React.createElement(Icon, { name: "ChevronRight", size: 24 }))))));
120
+ rightElement && rightElement.type === "arrow" && (React.createElement(Flex, { "data-testid": "right-element-arrow-icon", "aria-label": "Arrow account item" },
121
+ React.createElement(Icon, { name: "ChevronRight", size: 24 }))),
122
+ rightElement && rightElement.type === "edit" && (React.createElement(IconButton, { "aria-label": "Edit account item", "data-testid": "right-element-edit-icon", onClick: e => {
123
+ e.stopPropagation();
124
+ if (rightElement?.type === "edit") {
125
+ rightElement.onClick();
126
+ }
127
+ } },
128
+ React.createElement(Icons.PenEdit, { size: "S", color: "var(--colors-content-default-default)" }))))));
107
129
  };
108
130
  //# sourceMappingURL=AccountItem.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AccountItem.js","sourceRoot":"","sources":["../../../../src/pre-ldls/components/AccountItem/AccountItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,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,IAAI,EAAE,EAAE,GAAI,CAC5C,CACR;YACA,YAAY,IAAI,YAAY,CAAC,IAAI,KAAK,OAAO,IAAI,CAChD,oBAAC,IAAI,mBAAa,0BAA0B;gBAC1C,oBAAC,IAAI,IAAC,IAAI,EAAC,cAAc,EAAC,IAAI,EAAE,EAAE,GAAI,CACjC,CACR,CACgB,CACX,CACX,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"file":"AccountItem.js","sourceRoot":"","sources":["../../../../src/pre-ldls/components/AccountItem/AccountItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAsCjC,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAEjC,4EAA4E;AAC5E,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAA;IAC5B,UAAU,CAAC,gCAAgC,CAAC;;;;;;;YAOpC,iBAAiB;WAClB,iBAAiB;CAC3B,CAAC;AAEF,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAoD;IAC1E,UAAU,CACV,cAAc,EACd,aAAa,EACb,YAAY,EACZ,UAAU,EACV,UAAU,EACV,UAAU,EACV,gCAAgC,EAChC,kCAAkC,EAClC,oCAAoC,EACpC,wCAAwC,EACxC,4CAA4C,CAC7C;;;YAGS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,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EAAE,CAAC,CAAC,EAAE;oBACX,CAAC,CAAC,eAAe,EAAE,CAAC;oBACpB,IAAI,YAAY,EAAE,IAAI,KAAK,MAAM,EAAE,CAAC;wBAClC,YAAY,CAAC,OAAO,EAAE,CAAC;oBACzB,CAAC;gBACH,CAAC;gBAED,oBAAC,KAAK,CAAC,OAAO,IAAC,IAAI,EAAC,GAAG,EAAC,KAAK,EAAC,uCAAuC,GAAG,CAC7D,CACd,CACgB,CACX,CACX,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ export type CheckboxProps = {
3
+ isDisabled?: boolean;
4
+ isChecked: boolean;
5
+ name: string;
6
+ onChange: (value: boolean) => void;
7
+ size?: number;
8
+ };
9
+ export declare const Checkbox: ({ isDisabled, isChecked, name, onChange, size, }: CheckboxProps) => JSX.Element;
10
+ //# sourceMappingURL=Checkbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../../src/pre-ldls/components/Checkbox/Checkbox.tsx"],"names":[],"mappings":";AA2DA,MAAM,MAAM,aAAa,GAAG;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,QAAQ,qDAMlB,aAAa,KAAG,WAiBlB,CAAC"}
@@ -0,0 +1,62 @@
1
+ import React from "react";
2
+ import styled from "styled-components";
3
+ import CheckAloneMedium from "@ledgerhq/icons-ui/reactLegacy/CheckAloneMedium";
4
+ import { renderToStaticMarkup } from "react-dom/server";
5
+ import { withTokens } from "../../libs";
6
+ const Icon = () => React.cloneElement(CheckAloneMedium({ size: 13, color: "currentColor" }), {
7
+ // the xmlns attribute is required to properly display the checkbox
8
+ xmlns: "http://www.w3.org/2000/svg",
9
+ });
10
+ const CheckMarkIcon = encodeURIComponent(renderToStaticMarkup(React.createElement(Icon, null)));
11
+ const Input = styled.input `
12
+ background-color: transparent;
13
+
14
+ border-radius: ${p => `${p.theme.radii[1]}px`};
15
+ position: relative;
16
+
17
+ min-width: ${p => (p.size ? `${p.size}px` : `${p.theme.space[7]}px`)};
18
+ height: ${p => (p.size ? `${p.size}px` : `${p.theme.space[7]}px`)};
19
+ appearance: none;
20
+ border: 1px solid ${props => props.theme.colors.opacityDefault.c30};
21
+ box-shadow: none;
22
+
23
+ &:checked {
24
+ background-color: currentColor;
25
+ border-color: currentColor;
26
+ }
27
+
28
+ &:checked::after {
29
+ content: " ";
30
+ width: ${p => (p.size ? `${p.size}px` : `${p.theme.space[7]}px`)};
31
+ height: ${p => (p.size ? `${p.size}px` : `${p.theme.space[7]}px`)};
32
+ display: inline-block;
33
+ color: ${props => props.theme.colors.neutral.c00};
34
+
35
+ background-image: url("data:image/svg+xml,${CheckMarkIcon}");
36
+ background-position: center;
37
+ background-repeat: no-repeat;
38
+
39
+ /* Trick to center the check mark by taking into account the border */
40
+ position: absolute;
41
+ top: -1px;
42
+ left: -1px;
43
+ }
44
+ `;
45
+ const Container = styled.div `
46
+ ${withTokens("colors-background-active")}
47
+
48
+ color: var(--colors-background-active);
49
+
50
+ display: inline-flex;
51
+ column-gap: ${p => p.theme.space[5]}px;
52
+ align-items: center;
53
+ cursor: pointer;
54
+ `;
55
+ export const Checkbox = ({ isDisabled = false, isChecked, name, onChange, size, }) => (React.createElement(Container, { "data-disabled": isDisabled },
56
+ React.createElement(Input, { type: "checkbox", name: name, id: name, checked: isChecked, disabled: isDisabled, onChange: e => {
57
+ // TODO Checkbox should be an uncontrolled component that exposes the event onChange.
58
+ // (leave stopPropagation to the parent)
59
+ e.stopPropagation();
60
+ onChange(!isChecked);
61
+ }, size: size })));
62
+ //# sourceMappingURL=Checkbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3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