@ledgerhq/react-ui 0.22.0 → 0.23.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/asorted/Icon/Icons.stories.js +1 -2
- package/lib/cjs/components/asorted/Icon/Icons.stories.js.map +2 -2
- package/lib/cjs/components/asorted/Icon/NotificationIcon.stories.js +1 -1
- package/lib/cjs/components/asorted/Icon/NotificationIcon.stories.js.map +1 -1
- package/lib/cjs/components/cta/Toggle/Toggle.stories.js.map +2 -2
- package/lib/cjs/components/form/Checkbox/Checkbox.stories.js.map +2 -2
- package/lib/cjs/components/form/Radio/Radio.stories.js.map +2 -2
- package/lib/cjs/components/form/Switch/Switch.stories.js.map +2 -2
- package/lib/cjs/components/layout/Carousel/Carousel.stories.js.map +2 -2
- package/lib/cjs/components/layout/Drawer/Drawer.stories.js.map +2 -2
- package/lib/cjs/components/layout/Popin/Popin.stories.js.map +2 -2
- package/lib/cjs/components/navigation/FlowStepper/FlowStepper.stories.js.map +2 -2
- package/lib/cjs/components/navigation/sideBar/SideBar/SideBar.stories.js.map +2 -2
- package/lib/cjs/pre-ldls/components/AssetItem/AssetItem.js +100 -0
- package/lib/cjs/pre-ldls/components/AssetItem/AssetItem.js.map +7 -0
- package/lib/cjs/pre-ldls/components/AssetItem/AssetItem.stories.js +45 -0
- package/lib/cjs/pre-ldls/components/AssetItem/AssetItem.stories.js.map +7 -0
- package/lib/cjs/pre-ldls/components/AssetList/AssetList.js +50 -0
- package/lib/cjs/pre-ldls/components/AssetList/AssetList.js.map +7 -0
- package/lib/cjs/pre-ldls/components/AssetList/AssetList.stories.js +62 -0
- package/lib/cjs/pre-ldls/components/AssetList/AssetList.stories.js.map +7 -0
- package/lib/cjs/pre-ldls/components/Input/Input.stories.js.map +2 -2
- package/lib/cjs/pre-ldls/components/Search/Search.js +63 -0
- package/lib/cjs/pre-ldls/components/Search/Search.js.map +7 -0
- package/lib/cjs/pre-ldls/components/Search/Search.stories.js +63 -0
- package/lib/cjs/pre-ldls/components/Search/Search.stories.js.map +7 -0
- package/lib/cjs/pre-ldls/components/VirtualList/VirtualList.js +54 -0
- package/lib/cjs/pre-ldls/components/VirtualList/VirtualList.js.map +7 -0
- package/lib/cjs/pre-ldls/components/VirtualList/VirtualList.stories.js +70 -0
- package/lib/cjs/pre-ldls/components/VirtualList/VirtualList.stories.js.map +7 -0
- package/lib/cjs/pre-ldls/components/index.js +4 -0
- package/lib/cjs/pre-ldls/components/index.js.map +2 -2
- package/lib/cjs/pre-ldls/{types.js → hooks/index.js} +5 -3
- package/lib/cjs/pre-ldls/hooks/index.js.map +7 -0
- package/lib/cjs/pre-ldls/hooks/useDebouncedCallback.js +39 -0
- package/lib/cjs/pre-ldls/hooks/useDebouncedCallback.js.map +7 -0
- package/lib/cjs/pre-ldls/hooks/useDebouncedCallback.stories.js +91 -0
- package/lib/cjs/pre-ldls/hooks/useDebouncedCallback.stories.js.map +7 -0
- package/lib/cjs/pre-ldls/libs/index.js +13 -3
- package/lib/cjs/pre-ldls/libs/index.js.map +2 -2
- package/lib/pre-ldls/components/AssetItem/AssetItem.d.ts +11 -0
- package/lib/pre-ldls/components/AssetItem/AssetItem.d.ts.map +1 -0
- package/lib/pre-ldls/components/AssetItem/AssetItem.js +43 -0
- package/lib/pre-ldls/components/AssetItem/AssetItem.js.map +1 -0
- package/lib/pre-ldls/components/AssetList/AssetList.d.ts +7 -0
- package/lib/pre-ldls/components/AssetList/AssetList.d.ts.map +1 -0
- package/lib/pre-ldls/components/AssetList/AssetList.js +7 -0
- package/lib/pre-ldls/components/AssetList/AssetList.js.map +1 -0
- package/lib/pre-ldls/components/Search/Search.d.ts +9 -0
- package/lib/pre-ldls/components/Search/Search.d.ts.map +1 -0
- package/lib/pre-ldls/components/Search/Search.js +27 -0
- package/lib/pre-ldls/components/Search/Search.js.map +1 -0
- package/lib/pre-ldls/components/VirtualList/VirtualList.d.ts +7 -0
- package/lib/pre-ldls/components/VirtualList/VirtualList.d.ts.map +1 -0
- package/lib/pre-ldls/components/VirtualList/VirtualList.js +7 -0
- package/lib/pre-ldls/components/VirtualList/VirtualList.js.map +1 -0
- package/lib/pre-ldls/components/index.d.ts +4 -0
- package/lib/pre-ldls/components/index.d.ts.map +1 -1
- package/lib/pre-ldls/components/index.js +4 -0
- package/lib/pre-ldls/components/index.js.map +1 -1
- package/lib/pre-ldls/hooks/index.d.ts +2 -0
- package/lib/pre-ldls/hooks/index.d.ts.map +1 -0
- package/lib/pre-ldls/hooks/index.js +2 -0
- package/lib/pre-ldls/hooks/index.js.map +1 -0
- package/lib/pre-ldls/hooks/useDebouncedCallback.d.ts +2 -0
- package/lib/pre-ldls/hooks/useDebouncedCallback.d.ts.map +1 -0
- package/lib/pre-ldls/hooks/useDebouncedCallback.js +16 -0
- package/lib/pre-ldls/hooks/useDebouncedCallback.js.map +1 -0
- package/lib/pre-ldls/libs/index.d.ts +2 -2
- package/lib/pre-ldls/libs/index.d.ts.map +1 -1
- package/lib/pre-ldls/libs/index.js +14 -3
- package/lib/pre-ldls/libs/index.js.map +1 -1
- package/package.json +7 -3
- package/lib/cjs/pre-ldls/types.js.map +0 -7
- package/lib/pre-ldls/types.d.ts +0 -4
- package/lib/pre-ldls/types.d.ts.map +0 -1
- package/lib/pre-ldls/types.js +0 -2
- package/lib/pre-ldls/types.js.map +0 -1
|
@@ -0,0 +1,45 @@
|
|
|
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 AssetItem_stories_exports = {};
|
|
20
|
+
__export(AssetItem_stories_exports, {
|
|
21
|
+
Default: () => Default,
|
|
22
|
+
TestAssetItem: () => TestAssetItem,
|
|
23
|
+
default: () => AssetItem_stories_default
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(AssetItem_stories_exports);
|
|
26
|
+
var import_AssetItem = require("./AssetItem");
|
|
27
|
+
var import_test = require("@storybook/test");
|
|
28
|
+
const meta = {
|
|
29
|
+
component: import_AssetItem.AssetItem,
|
|
30
|
+
title: "PreLdls/Components/AssetItem",
|
|
31
|
+
tags: ["autodocs"],
|
|
32
|
+
args: { name: "Bitcoin", ticker: "BTC" }
|
|
33
|
+
};
|
|
34
|
+
var AssetItem_stories_default = meta;
|
|
35
|
+
const Default = {};
|
|
36
|
+
const TestAssetItem = {
|
|
37
|
+
play: async ({ canvasElement }) => {
|
|
38
|
+
const canvas = (0, import_test.within)(canvasElement);
|
|
39
|
+
const name = canvas.getByText("Bitcoin");
|
|
40
|
+
const ticker = canvas.getByText("BTC");
|
|
41
|
+
await (0, import_test.expect)(name).toBeInTheDocument();
|
|
42
|
+
await (0, import_test.expect)(ticker).toBeInTheDocument();
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=AssetItem.stories.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/pre-ldls/components/AssetItem/AssetItem.stories.tsx"],
|
|
4
|
+
"sourcesContent": ["import type { Meta, StoryObj } from \"@storybook/react\";\nimport { AssetItem } from \"./AssetItem\";\nimport { expect, within } from \"@storybook/test\";\n\nconst meta: Meta<typeof AssetItem> = {\n component: AssetItem,\n title: \"PreLdls/Components/AssetItem\",\n tags: [\"autodocs\"],\n args: { name: \"Bitcoin\", ticker: \"BTC\" },\n};\nexport default meta;\n\ntype Story = StoryObj<typeof AssetItem>;\n\nexport const Default: Story = {};\n\nexport const TestAssetItem: Story = {\n play: async ({ canvasElement }) => {\n const canvas = within(canvasElement);\n\n const name = canvas.getByText(\"Bitcoin\");\n const ticker = canvas.getByText(\"BTC\");\n\n await expect(name).toBeInTheDocument();\n await expect(ticker).toBeInTheDocument();\n },\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,uBAA0B;AAC1B,kBAA+B;AAE/B,MAAM,OAA+B;AAAA,EACnC,WAAW;AAAA,EACX,OAAO;AAAA,EACP,MAAM,CAAC,UAAU;AAAA,EACjB,MAAM,EAAE,MAAM,WAAW,QAAQ,MAAM;AACzC;AACA,IAAO,4BAAQ;AAIR,MAAM,UAAiB,CAAC;AAExB,MAAM,gBAAuB;AAAA,EAClC,MAAM,OAAO,EAAE,cAAc,MAAM;AACjC,UAAM,aAAS,oBAAO,aAAa;AAEnC,UAAM,OAAO,OAAO,UAAU,SAAS;AACvC,UAAM,SAAS,OAAO,UAAU,KAAK;AAErC,cAAM,oBAAO,IAAI,EAAE,kBAAkB;AACrC,cAAM,oBAAO,MAAM,EAAE,kBAAkB;AAAA,EACzC;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
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 AssetList_exports = {};
|
|
30
|
+
__export(AssetList_exports, {
|
|
31
|
+
AssetList: () => AssetList
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(AssetList_exports);
|
|
34
|
+
var import_react = __toESM(require("react"));
|
|
35
|
+
var import_AssetItem = require("../AssetItem/AssetItem");
|
|
36
|
+
var import_VirtualList = require("../VirtualList/VirtualList");
|
|
37
|
+
const AssetList = ({
|
|
38
|
+
assets,
|
|
39
|
+
onClick
|
|
40
|
+
}) => {
|
|
41
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
42
|
+
import_VirtualList.VirtualList,
|
|
43
|
+
{
|
|
44
|
+
itemHeight: 64,
|
|
45
|
+
count: assets.length,
|
|
46
|
+
renderItem: (i) => /* @__PURE__ */ import_react.default.createElement(import_AssetItem.AssetItem, { name: assets[i].name, ticker: assets[i].ticker, onClick })
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=AssetList.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/pre-ldls/components/AssetList/AssetList.tsx"],
|
|
4
|
+
"sourcesContent": ["import React from \"react\";\nimport { AssetItem, AssetType } from \"../AssetItem/AssetItem\";\nimport { VirtualList } from \"../VirtualList/VirtualList\";\n\nexport const AssetList = ({\n assets,\n onClick,\n}: {\n assets: AssetType[];\n onClick: (asset: AssetType) => void;\n}) => {\n return (\n <VirtualList\n itemHeight={64}\n count={assets.length}\n renderItem={(i: number) => (\n <AssetItem name={assets[i].name} ticker={assets[i].ticker} onClick={onClick} />\n )}\n />\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,uBAAqC;AACrC,yBAA4B;AAErB,MAAM,YAAY,CAAC;AAAA,EACxB;AAAA,EACA;AACF,MAGM;AACJ,SACE,6BAAAA,QAAA;AAAA,IAAC;AAAA;AAAA,MACC,YAAY;AAAA,MACZ,OAAO,OAAO;AAAA,MACd,YAAY,CAAC,MACX,6BAAAA,QAAA,cAAC,8BAAU,MAAM,OAAO,CAAC,EAAE,MAAM,QAAQ,OAAO,CAAC,EAAE,QAAQ,SAAkB;AAAA;AAAA,EAEjF;AAEJ;",
|
|
6
|
+
"names": ["React"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
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 AssetList_stories_exports = {};
|
|
30
|
+
__export(AssetList_stories_exports, {
|
|
31
|
+
Default: () => Default,
|
|
32
|
+
TestAssetClick: () => TestAssetClick,
|
|
33
|
+
default: () => AssetList_stories_default
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(AssetList_stories_exports);
|
|
36
|
+
var import_AssetList = require("./AssetList");
|
|
37
|
+
var import_test = require("@storybook/test");
|
|
38
|
+
var import_react = __toESM(require("react"));
|
|
39
|
+
const testFn = (0, import_test.fn)();
|
|
40
|
+
const meta = {
|
|
41
|
+
component: import_AssetList.AssetList,
|
|
42
|
+
decorators: [
|
|
43
|
+
(Story) => /* @__PURE__ */ import_react.default.createElement("div", { style: { height: "400px" } }, /* @__PURE__ */ import_react.default.createElement(Story, null))
|
|
44
|
+
],
|
|
45
|
+
title: "PreLdls/Components/AssetList",
|
|
46
|
+
tags: ["autodocs"],
|
|
47
|
+
args: {
|
|
48
|
+
assets: Array.from({ length: 50 }).map((_, i) => ({ name: `Bitcoin ${i}`, ticker: "BTC" })),
|
|
49
|
+
onClick: testFn
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var AssetList_stories_default = meta;
|
|
53
|
+
const Default = {};
|
|
54
|
+
const TestAssetClick = {
|
|
55
|
+
play: async ({ canvasElement }) => {
|
|
56
|
+
const canvas = (0, import_test.within)(canvasElement);
|
|
57
|
+
const input = canvas.getByText("Bitcoin 1");
|
|
58
|
+
await import_test.userEvent.click(input);
|
|
59
|
+
await (0, import_test.expect)(testFn).toHaveBeenCalledWith({ name: "Bitcoin 1", ticker: "BTC" });
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=AssetList.stories.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/pre-ldls/components/AssetList/AssetList.stories.tsx"],
|
|
4
|
+
"sourcesContent": ["import type { Meta, StoryObj } from \"@storybook/react\";\nimport { AssetList } from \"./AssetList\";\nimport { expect, fn, userEvent, within } from \"@storybook/test\";\nimport React from \"react\";\n\nconst testFn = fn();\n\nconst meta: Meta<typeof AssetList> = {\n component: AssetList,\n decorators: [\n Story => (\n <div style={{ height: \"400px\" }}>\n <Story />\n </div>\n ),\n ],\n title: \"PreLdls/Components/AssetList\",\n tags: [\"autodocs\"],\n args: {\n assets: Array.from({ length: 50 }).map((_, i) => ({ name: `Bitcoin ${i}`, ticker: \"BTC\" })),\n onClick: testFn,\n },\n};\nexport default meta;\n\ntype Story = StoryObj<typeof AssetList>;\n\nexport const Default: Story = {};\n\nexport const TestAssetClick: Story = {\n play: async ({ canvasElement }) => {\n const canvas = within(canvasElement);\n const input = canvas.getByText(\"Bitcoin 1\");\n await userEvent.click(input);\n await expect(testFn).toHaveBeenCalledWith({ name: \"Bitcoin 1\", ticker: \"BTC\" });\n },\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,uBAA0B;AAC1B,kBAA8C;AAC9C,mBAAkB;AAElB,MAAM,aAAS,gBAAG;AAElB,MAAM,OAA+B;AAAA,EACnC,WAAW;AAAA,EACX,YAAY;AAAA,IACV,WACE,6BAAAA,QAAA,cAAC,SAAI,OAAO,EAAE,QAAQ,QAAQ,KAC5B,6BAAAA,QAAA,cAAC,WAAM,CACT;AAAA,EAEJ;AAAA,EACA,OAAO;AAAA,EACP,MAAM,CAAC,UAAU;AAAA,EACjB,MAAM;AAAA,IACJ,QAAQ,MAAM,KAAK,EAAE,QAAQ,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,OAAO,EAAE,MAAM,WAAW,CAAC,IAAI,QAAQ,MAAM,EAAE;AAAA,IAC1F,SAAS;AAAA,EACX;AACF;AACA,IAAO,4BAAQ;AAIR,MAAM,UAAiB,CAAC;AAExB,MAAM,iBAAwB;AAAA,EACnC,MAAM,OAAO,EAAE,cAAc,MAAM;AACjC,UAAM,aAAS,oBAAO,aAAa;AACnC,UAAM,QAAQ,OAAO,UAAU,WAAW;AAC1C,UAAM,sBAAU,MAAM,KAAK;AAC3B,cAAM,oBAAO,MAAM,EAAE,qBAAqB,EAAE,MAAM,aAAa,QAAQ,MAAM,CAAC;AAAA,EAChF;AACF;",
|
|
6
|
+
"names": ["React"]
|
|
7
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/pre-ldls/components/Input/Input.stories.tsx"],
|
|
4
|
-
"sourcesContent": ["import React from \"react\";\nimport type { Meta, StoryObj } from \"@storybook/react\";\nimport { expect, userEvent, within } from \"@storybook/test\";\nimport { Icons } from \"../../../assets\";\nimport
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,kBAA0C;AAC1C,oBAAsB;
|
|
4
|
+
"sourcesContent": ["import React from \"react\";\nimport type { Meta, StoryObj } from \"@storybook/react\";\nimport { expect, userEvent, within } from \"@storybook/test\";\nimport { Icons } from \"../../../assets\";\nimport { Input } from \"./Input\";\n\nconst meta: Meta<typeof Input> = {\n component: Input,\n title: \"PreLdls/Components/Input\",\n tags: [\"autodocs\"],\n args: {},\n};\nexport default meta;\n\ntype Story = StoryObj<typeof Input>;\n\nexport const Default: Story = {\n args: {},\n};\n\nexport const Search: Story = {\n args: {\n placeholder: \"Search\",\n icon: <Icons.Search size=\"S\" />,\n },\n};\n\n// Interaction Testing\nexport const WithInteraction: Story = {\n args: {},\n play: async ({ canvasElement }) => {\n const canvas = within(canvasElement);\n const input = canvas.getByRole(\"textbox\");\n await userEvent.type(input, \"Write something\");\n expect(input).toHaveValue(\"Write something\");\n },\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,kBAA0C;AAC1C,oBAAsB;AACtB,mBAAsB;AAEtB,MAAM,OAA2B;AAAA,EAC/B,WAAW;AAAA,EACX,OAAO;AAAA,EACP,MAAM,CAAC,UAAU;AAAA,EACjB,MAAM,CAAC;AACT;AACA,IAAO,wBAAQ;AAIR,MAAM,UAAiB;AAAA,EAC5B,MAAM,CAAC;AACT;AAEO,MAAM,SAAgB;AAAA,EAC3B,MAAM;AAAA,IACJ,aAAa;AAAA,IACb,MAAM,6BAAAA,QAAA,cAAC,oBAAM,QAAN,EAAa,MAAK,KAAI;AAAA,EAC/B;AACF;AAGO,MAAM,kBAAyB;AAAA,EACpC,MAAM,CAAC;AAAA,EACP,MAAM,OAAO,EAAE,cAAc,MAAM;AACjC,UAAM,aAAS,oBAAO,aAAa;AACnC,UAAM,QAAQ,OAAO,UAAU,SAAS;AACxC,UAAM,sBAAU,KAAK,OAAO,iBAAiB;AAC7C,4BAAO,KAAK,EAAE,YAAY,iBAAiB;AAAA,EAC7C;AACF;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
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 Search_exports = {};
|
|
30
|
+
__export(Search_exports, {
|
|
31
|
+
Search: () => Search
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(Search_exports);
|
|
34
|
+
var import_react = __toESM(require("react"));
|
|
35
|
+
var import_assets = require("../../../assets");
|
|
36
|
+
var import_hooks = require("../../hooks");
|
|
37
|
+
var import__ = require("..");
|
|
38
|
+
function Search({ onDebouncedChange, debounceTime = 500, onChange, ...props }) {
|
|
39
|
+
const initialValue = props.value ?? props.defaultValue ?? "";
|
|
40
|
+
const prevValue = (0, import_react.useRef)(String(initialValue));
|
|
41
|
+
const handleDebouncedChange = (0, import_hooks.useDebouncedCallback)(
|
|
42
|
+
(0, import_react.useMemo)(() => {
|
|
43
|
+
if (!onDebouncedChange)
|
|
44
|
+
return;
|
|
45
|
+
return (event) => {
|
|
46
|
+
const current = event.target.value;
|
|
47
|
+
onDebouncedChange(current, prevValue.current);
|
|
48
|
+
prevValue.current = current;
|
|
49
|
+
};
|
|
50
|
+
}, [onDebouncedChange]),
|
|
51
|
+
debounceTime
|
|
52
|
+
);
|
|
53
|
+
const handleChange = (0, import_react.useMemo)(() => {
|
|
54
|
+
if (!handleDebouncedChange && !onChange)
|
|
55
|
+
return;
|
|
56
|
+
return (event) => {
|
|
57
|
+
onChange == null ? void 0 : onChange(event);
|
|
58
|
+
handleDebouncedChange == null ? void 0 : handleDebouncedChange(event);
|
|
59
|
+
};
|
|
60
|
+
}, [handleDebouncedChange, onChange]);
|
|
61
|
+
return /* @__PURE__ */ import_react.default.createElement(import__.Input, { ...props, icon: /* @__PURE__ */ import_react.default.createElement(import_assets.Icons.Search, { size: "S" }), onChange: handleChange });
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=Search.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 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({ onDebouncedChange, debounceTime = 500, onChange, ...props }: Props) {\n const initialValue = props.value ?? props.defaultValue ?? \"\";\n const prevValue = useRef(String(initialValue));\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 <Input {...props} icon={<Icons.Search size=\"S\" />} onChange={handleChange} />;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAoD;AACpD,oBAAsB;AACtB,mBAAqC;AACrC,eAAsB;AAUf,SAAS,OAAO,EAAE,mBAAmB,eAAe,KAAK,UAAU,GAAG,MAAM,GAAU;AAC3F,QAAM,eAAe,MAAM,SAAS,MAAM,gBAAgB;AAC1D,QAAM,gBAAY,qBAAO,OAAO,YAAY,CAAC;AAE7C,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,SAAO,6BAAAA,QAAA,cAAC,kBAAO,GAAG,OAAO,MAAM,6BAAAA,QAAA,cAAC,oBAAM,QAAN,EAAa,MAAK,KAAI,GAAI,UAAU,cAAc;AACpF;",
|
|
6
|
+
"names": ["React"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
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 Search_stories_exports = {};
|
|
20
|
+
__export(Search_stories_exports, {
|
|
21
|
+
Default: () => Default,
|
|
22
|
+
WithInteraction: () => WithInteraction,
|
|
23
|
+
default: () => Search_stories_default
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(Search_stories_exports);
|
|
26
|
+
var import_test = require("@storybook/test");
|
|
27
|
+
var import_Search = require("./Search");
|
|
28
|
+
const onDebouncedChange = (0, import_test.fn)();
|
|
29
|
+
const onChange = (0, import_test.fn)();
|
|
30
|
+
const meta = {
|
|
31
|
+
component: import_Search.Search,
|
|
32
|
+
title: "PreLdls/Components/Search",
|
|
33
|
+
tags: ["autodocs"],
|
|
34
|
+
args: {
|
|
35
|
+
debounceTime: 500,
|
|
36
|
+
placeholder: "Search",
|
|
37
|
+
onDebouncedChange,
|
|
38
|
+
onChange
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
var Search_stories_default = meta;
|
|
42
|
+
const Default = {};
|
|
43
|
+
const WithInteraction = {
|
|
44
|
+
args: {
|
|
45
|
+
debounceTime: 100
|
|
46
|
+
},
|
|
47
|
+
play: async ({ canvasElement }) => {
|
|
48
|
+
const canvas = (0, import_test.within)(canvasElement);
|
|
49
|
+
const search = canvas.getByRole("textbox");
|
|
50
|
+
await import_test.userEvent.type(search, "Write something");
|
|
51
|
+
(0, import_test.expect)(search).toHaveValue("Write something");
|
|
52
|
+
(0, import_test.expect)(onChange).toHaveBeenCalledTimes("Write something".length);
|
|
53
|
+
(0, import_test.expect)(onDebouncedChange).not.toHaveBeenCalled();
|
|
54
|
+
await (0, import_test.waitFor)(() => (0, import_test.expect)(onDebouncedChange).toHaveBeenCalledTimes(1), { timeout: 200 });
|
|
55
|
+
(0, import_test.expect)(onDebouncedChange).toHaveBeenCalledWith("Write something", "");
|
|
56
|
+
await import_test.userEvent.clear(search);
|
|
57
|
+
await import_test.userEvent.type(search, "Write something else");
|
|
58
|
+
(0, import_test.expect)(onDebouncedChange).toHaveBeenCalledTimes(1);
|
|
59
|
+
await (0, import_test.waitFor)(() => (0, import_test.expect)(onDebouncedChange).toHaveBeenCalledTimes(2), { timeout: 200 });
|
|
60
|
+
(0, import_test.expect)(onDebouncedChange).toHaveBeenCalledWith("Write something else", "Write something");
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=Search.stories.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/pre-ldls/components/Search/Search.stories.tsx"],
|
|
4
|
+
"sourcesContent": ["import { type Meta, type StoryObj } from \"@storybook/react\";\nimport { expect, fn, userEvent, waitFor, within } from \"@storybook/test\";\nimport { Search } from \"./Search\";\n\nconst onDebouncedChange = fn();\nconst onChange = fn();\n\nconst meta: Meta<typeof Search> = {\n component: Search,\n title: \"PreLdls/Components/Search\",\n tags: [\"autodocs\"],\n args: {\n debounceTime: 500,\n placeholder: \"Search\",\n onDebouncedChange,\n onChange,\n },\n};\nexport default meta;\n\ntype Story = StoryObj<typeof Search>;\n\nexport const Default: Story = {};\n\n// Interaction Testing\nexport const WithInteraction: Story = {\n args: {\n debounceTime: 100,\n },\n play: async ({ canvasElement }) => {\n const canvas = within(canvasElement);\n const search = canvas.getByRole(\"textbox\");\n\n await userEvent.type(search, \"Write something\");\n expect(search).toHaveValue(\"Write something\");\n expect(onChange).toHaveBeenCalledTimes(\"Write something\".length);\n expect(onDebouncedChange).not.toHaveBeenCalled();\n await waitFor(() => expect(onDebouncedChange).toHaveBeenCalledTimes(1), { timeout: 200 });\n expect(onDebouncedChange).toHaveBeenCalledWith(\"Write something\", \"\");\n\n await userEvent.clear(search);\n await userEvent.type(search, \"Write something else\");\n expect(onDebouncedChange).toHaveBeenCalledTimes(1);\n await waitFor(() => expect(onDebouncedChange).toHaveBeenCalledTimes(2), { timeout: 200 });\n expect(onDebouncedChange).toHaveBeenCalledWith(\"Write something else\", \"Write something\");\n },\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAuD;AACvD,oBAAuB;AAEvB,MAAM,wBAAoB,gBAAG;AAC7B,MAAM,eAAW,gBAAG;AAEpB,MAAM,OAA4B;AAAA,EAChC,WAAW;AAAA,EACX,OAAO;AAAA,EACP,MAAM,CAAC,UAAU;AAAA,EACjB,MAAM;AAAA,IACJ,cAAc;AAAA,IACd,aAAa;AAAA,IACb;AAAA,IACA;AAAA,EACF;AACF;AACA,IAAO,yBAAQ;AAIR,MAAM,UAAiB,CAAC;AAGxB,MAAM,kBAAyB;AAAA,EACpC,MAAM;AAAA,IACJ,cAAc;AAAA,EAChB;AAAA,EACA,MAAM,OAAO,EAAE,cAAc,MAAM;AACjC,UAAM,aAAS,oBAAO,aAAa;AACnC,UAAM,SAAS,OAAO,UAAU,SAAS;AAEzC,UAAM,sBAAU,KAAK,QAAQ,iBAAiB;AAC9C,4BAAO,MAAM,EAAE,YAAY,iBAAiB;AAC5C,4BAAO,QAAQ,EAAE,sBAAsB,kBAAkB,MAAM;AAC/D,4BAAO,iBAAiB,EAAE,IAAI,iBAAiB;AAC/C,cAAM,qBAAQ,UAAM,oBAAO,iBAAiB,EAAE,sBAAsB,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC;AACxF,4BAAO,iBAAiB,EAAE,qBAAqB,mBAAmB,EAAE;AAEpE,UAAM,sBAAU,MAAM,MAAM;AAC5B,UAAM,sBAAU,KAAK,QAAQ,sBAAsB;AACnD,4BAAO,iBAAiB,EAAE,sBAAsB,CAAC;AACjD,cAAM,qBAAQ,UAAM,oBAAO,iBAAiB,EAAE,sBAAsB,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC;AACxF,4BAAO,iBAAiB,EAAE,qBAAqB,wBAAwB,iBAAiB;AAAA,EAC1F;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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 VirtualList_exports = {};
|
|
30
|
+
__export(VirtualList_exports, {
|
|
31
|
+
VirtualList: () => VirtualList
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(VirtualList_exports);
|
|
34
|
+
var import_react = __toESM(require("react"));
|
|
35
|
+
var import_react_window = require("react-window");
|
|
36
|
+
var import_react_virtualized_auto_sizer = __toESM(require("react-virtualized-auto-sizer"));
|
|
37
|
+
const VirtualList = ({
|
|
38
|
+
count,
|
|
39
|
+
itemHeight,
|
|
40
|
+
renderItem
|
|
41
|
+
}) => {
|
|
42
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react_virtualized_auto_sizer.default, { style: { height: "100%", width: "100%" } }, ({ height }) => /* @__PURE__ */ import_react.default.createElement(
|
|
43
|
+
import_react_window.FixedSizeList,
|
|
44
|
+
{
|
|
45
|
+
height,
|
|
46
|
+
itemCount: count,
|
|
47
|
+
itemSize: itemHeight,
|
|
48
|
+
layout: "vertical",
|
|
49
|
+
width: "100%"
|
|
50
|
+
},
|
|
51
|
+
({ index, style }) => /* @__PURE__ */ import_react.default.createElement("div", { style }, renderItem(index))
|
|
52
|
+
));
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=VirtualList.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/pre-ldls/components/VirtualList/VirtualList.tsx"],
|
|
4
|
+
"sourcesContent": ["import React, { ReactNode } from \"react\";\nimport { FixedSizeList as List } from \"react-window\";\nimport AutoSizer from \"react-virtualized-auto-sizer\";\n\nexport const VirtualList = ({\n count,\n itemHeight,\n renderItem,\n}: {\n count: number;\n itemHeight: number;\n renderItem: (index: number) => ReactNode;\n}) => {\n return (\n <AutoSizer style={{ height: \"100%\", width: \"100%\" }}>\n {({ height }: { height: number }) => (\n <List\n height={height}\n itemCount={count}\n itemSize={itemHeight}\n layout=\"vertical\"\n width=\"100%\"\n >\n {({ index, style }) => <div style={style}>{renderItem(index)}</div>}\n </List>\n )}\n </AutoSizer>\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAiC;AACjC,0BAAsC;AACtC,0CAAsB;AAEf,MAAM,cAAc,CAAC;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AACF,MAIM;AACJ,SACE,6BAAAA,QAAA,cAAC,oCAAAC,SAAA,EAAU,OAAO,EAAE,QAAQ,QAAQ,OAAO,OAAO,KAC/C,CAAC,EAAE,OAAO,MACT,6BAAAD,QAAA;AAAA,IAAC,oBAAAE;AAAA,IAAA;AAAA,MACC;AAAA,MACA,WAAW;AAAA,MACX,UAAU;AAAA,MACV,QAAO;AAAA,MACP,OAAM;AAAA;AAAA,IAEL,CAAC,EAAE,OAAO,MAAM,MAAM,6BAAAF,QAAA,cAAC,SAAI,SAAe,WAAW,KAAK,CAAE;AAAA,EAC/D,CAEJ;AAEJ;",
|
|
6
|
+
"names": ["React", "AutoSizer", "List"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
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 VirtualList_stories_exports = {};
|
|
30
|
+
__export(VirtualList_stories_exports, {
|
|
31
|
+
Default: () => Default,
|
|
32
|
+
TestVirtualList: () => TestVirtualList,
|
|
33
|
+
default: () => VirtualList_stories_default
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(VirtualList_stories_exports);
|
|
36
|
+
var import_react = __toESM(require("react"));
|
|
37
|
+
var import_VirtualList = require("./VirtualList");
|
|
38
|
+
var import_test = require("@storybook/test");
|
|
39
|
+
const meta = {
|
|
40
|
+
component: import_VirtualList.VirtualList,
|
|
41
|
+
decorators: [
|
|
42
|
+
(Story) => /* @__PURE__ */ import_react.default.createElement("div", { style: { height: "400px" } }, /* @__PURE__ */ import_react.default.createElement(Story, null))
|
|
43
|
+
],
|
|
44
|
+
title: "PreLdls/Components/VirtualList",
|
|
45
|
+
tags: ["autodocs"],
|
|
46
|
+
args: {
|
|
47
|
+
itemHeight: 64,
|
|
48
|
+
count: 50,
|
|
49
|
+
renderItem: (i) => /* @__PURE__ */ import_react.default.createElement("h1", { tabIndex: i }, "Item #", i)
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var VirtualList_stories_default = meta;
|
|
53
|
+
const Default = {};
|
|
54
|
+
const TestVirtualList = {
|
|
55
|
+
play: async ({ canvasElement }) => {
|
|
56
|
+
const canvas = (0, import_test.within)(canvasElement);
|
|
57
|
+
const visible = canvas.getAllByText(/Item #/i);
|
|
58
|
+
const firstVisible = visible[0];
|
|
59
|
+
const lastVisible = visible[visible.length - 1];
|
|
60
|
+
await (0, import_test.expect)(visible.length).toBeLessThanOrEqual(10);
|
|
61
|
+
await (0, import_test.expect)(firstVisible).toBeInTheDocument();
|
|
62
|
+
await import_test.userEvent.pointer([
|
|
63
|
+
{ keys: "[TouchA>]", target: lastVisible },
|
|
64
|
+
{ target: firstVisible },
|
|
65
|
+
{ keys: "[/TouchA]" }
|
|
66
|
+
]);
|
|
67
|
+
await (0, import_test.waitFor)(() => (0, import_test.expect)(firstVisible).not.toBeInTheDocument());
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=VirtualList.stories.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/pre-ldls/components/VirtualList/VirtualList.stories.tsx"],
|
|
4
|
+
"sourcesContent": ["import React from \"react\";\nimport type { Meta, StoryObj } from \"@storybook/react\";\nimport { VirtualList } from \"./VirtualList\";\nimport { expect, userEvent, waitFor, within } from \"@storybook/test\";\n\nconst meta: Meta<typeof VirtualList> = {\n component: VirtualList,\n decorators: [\n Story => (\n <div style={{ height: \"400px\" }}>\n <Story />\n </div>\n ),\n ],\n title: \"PreLdls/Components/VirtualList\",\n tags: [\"autodocs\"],\n args: {\n itemHeight: 64,\n count: 50,\n renderItem: (i: number) => <h1 tabIndex={i}>Item #{i}</h1>,\n },\n};\nexport default meta;\n\ntype Story = StoryObj<typeof VirtualList>;\n\nexport const Default: Story = {};\n\nexport const TestVirtualList: Story = {\n play: async ({ canvasElement }) => {\n const canvas = within(canvasElement);\n\n const visible = canvas.getAllByText(/Item #/i);\n const firstVisible = visible[0];\n const lastVisible = visible[visible.length - 1];\n\n await expect(visible.length).toBeLessThanOrEqual(10);\n\n await expect(firstVisible).toBeInTheDocument();\n await userEvent.pointer([\n { keys: \"[TouchA>]\", target: lastVisible },\n { target: firstVisible },\n { keys: \"[/TouchA]\" },\n ]);\n await waitFor(() => expect(firstVisible).not.toBeInTheDocument());\n },\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,yBAA4B;AAC5B,kBAAmD;AAEnD,MAAM,OAAiC;AAAA,EACrC,WAAW;AAAA,EACX,YAAY;AAAA,IACV,WACE,6BAAAA,QAAA,cAAC,SAAI,OAAO,EAAE,QAAQ,QAAQ,KAC5B,6BAAAA,QAAA,cAAC,WAAM,CACT;AAAA,EAEJ;AAAA,EACA,OAAO;AAAA,EACP,MAAM,CAAC,UAAU;AAAA,EACjB,MAAM;AAAA,IACJ,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,YAAY,CAAC,MAAc,6BAAAA,QAAA,cAAC,QAAG,UAAU,KAAG,UAAO,CAAE;AAAA,EACvD;AACF;AACA,IAAO,8BAAQ;AAIR,MAAM,UAAiB,CAAC;AAExB,MAAM,kBAAyB;AAAA,EACpC,MAAM,OAAO,EAAE,cAAc,MAAM;AACjC,UAAM,aAAS,oBAAO,aAAa;AAEnC,UAAM,UAAU,OAAO,aAAa,SAAS;AAC7C,UAAM,eAAe,QAAQ,CAAC;AAC9B,UAAM,cAAc,QAAQ,QAAQ,SAAS,CAAC;AAE9C,cAAM,oBAAO,QAAQ,MAAM,EAAE,oBAAoB,EAAE;AAEnD,cAAM,oBAAO,YAAY,EAAE,kBAAkB;AAC7C,UAAM,sBAAU,QAAQ;AAAA,MACtB,EAAE,MAAM,aAAa,QAAQ,YAAY;AAAA,MACzC,EAAE,QAAQ,aAAa;AAAA,MACvB,EAAE,MAAM,YAAY;AAAA,IACtB,CAAC;AACD,cAAM,qBAAQ,UAAM,oBAAO,YAAY,EAAE,IAAI,kBAAkB,CAAC;AAAA,EAClE;AACF;",
|
|
6
|
+
"names": ["React"]
|
|
7
|
+
}
|
|
@@ -15,5 +15,9 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
|
|
|
15
15
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
16
|
var components_exports = {};
|
|
17
17
|
module.exports = __toCommonJS(components_exports);
|
|
18
|
+
__reExport(components_exports, require("./AssetItem/AssetItem"), module.exports);
|
|
19
|
+
__reExport(components_exports, require("./AssetList/AssetList"), module.exports);
|
|
18
20
|
__reExport(components_exports, require("./Input/Input"), module.exports);
|
|
21
|
+
__reExport(components_exports, require("./Search/Search"), module.exports);
|
|
22
|
+
__reExport(components_exports, require("./VirtualList/VirtualList"), module.exports);
|
|
19
23
|
//# 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 \"./Input/Input\";\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,+BAAc,
|
|
4
|
+
"sourcesContent": ["export * from \"./AssetItem/AssetItem\";\nexport * from \"./AssetList/AssetList\";\nexport * from \"./Input/Input\";\nexport * from \"./Search/Search\";\nexport * from \"./VirtualList/VirtualList\";\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,+BAAc,kCAAd;AACA,+BAAc,kCADd;AAEA,+BAAc,0BAFd;AAGA,+BAAc,4BAHd;AAIA,+BAAc,sCAJd;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -11,7 +11,9 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
11
11
|
}
|
|
12
12
|
return to;
|
|
13
13
|
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
15
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var
|
|
16
|
-
module.exports = __toCommonJS(
|
|
17
|
-
|
|
16
|
+
var hooks_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(hooks_exports);
|
|
18
|
+
__reExport(hooks_exports, require("./useDebouncedCallback"), module.exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,39 @@
|
|
|
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 useDebouncedCallback_exports = {};
|
|
20
|
+
__export(useDebouncedCallback_exports, {
|
|
21
|
+
useDebouncedCallback: () => useDebouncedCallback
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(useDebouncedCallback_exports);
|
|
24
|
+
var import_react = require("react");
|
|
25
|
+
function useDebouncedCallback(callback, delay) {
|
|
26
|
+
const [debouncedCallback, setDebouncedCallback] = (0, import_react.useState)();
|
|
27
|
+
const timeout = (0, import_react.useRef)();
|
|
28
|
+
(0, import_react.useEffect)(() => {
|
|
29
|
+
if (!callback)
|
|
30
|
+
return setDebouncedCallback(void 0);
|
|
31
|
+
setDebouncedCallback(() => (...args) => {
|
|
32
|
+
clearTimeout(timeout.current);
|
|
33
|
+
timeout.current = setTimeout(() => callback(...args), delay);
|
|
34
|
+
});
|
|
35
|
+
return () => clearTimeout(timeout.current);
|
|
36
|
+
}, [callback, delay]);
|
|
37
|
+
return debouncedCallback;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=useDebouncedCallback.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/pre-ldls/hooks/useDebouncedCallback.ts"],
|
|
4
|
+
"sourcesContent": ["import { useEffect, useRef, useState } from \"react\";\n\nexport function useDebouncedCallback<T extends unknown[]>(\n callback: ((...args: T) => void) | undefined,\n delay?: number,\n) {\n const [debouncedCallback, setDebouncedCallback] = useState<(...args: T) => void>();\n const timeout = useRef<number>();\n\n useEffect(() => {\n if (!callback) return setDebouncedCallback(undefined);\n\n setDebouncedCallback(() => (...args: T) => {\n clearTimeout(timeout.current);\n timeout.current = setTimeout(() => callback(...args), delay);\n });\n\n return () => clearTimeout(timeout.current);\n }, [callback, delay]);\n\n return debouncedCallback;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA4C;AAErC,SAAS,qBACd,UACA,OACA;AACA,QAAM,CAAC,mBAAmB,oBAAoB,QAAI,uBAA+B;AACjF,QAAM,cAAU,qBAAe;AAE/B,8BAAU,MAAM;AACd,QAAI,CAAC;AAAU,aAAO,qBAAqB,MAAS;AAEpD,yBAAqB,MAAM,IAAI,SAAY;AACzC,mBAAa,QAAQ,OAAO;AAC5B,cAAQ,UAAU,WAAW,MAAM,SAAS,GAAG,IAAI,GAAG,KAAK;AAAA,IAC7D,CAAC;AAED,WAAO,MAAM,aAAa,QAAQ,OAAO;AAAA,EAC3C,GAAG,CAAC,UAAU,KAAK,CAAC;AAEpB,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|