@fibery/ui-kit 3.0.0 → 4.1.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/CHANGELOG.md +18 -0
- package/esfint.config.mjs +0 -17
- package/package.json +18 -13
- package/scripts/generate-icons.mjs +45 -44
- package/src/actions-menu/actions-menu-item.tsx +2 -1
- package/src/actions-menu/actions-menu.tsx +1 -3
- package/src/actions-menu/context-actions-menu.tsx +1 -1
- package/src/animated-height-container.tsx +1 -1
- package/src/antd/ant-modal.tsx +158 -9
- package/src/antd/ant-upload.tsx +285 -27
- package/src/antd/auto-complete.tsx +145 -0
- package/src/antd/auto-width-transparent-textarea.tsx +9 -2
- package/src/antd/global-overrides.ts +352 -0
- package/src/antd/index.tsx +3 -2
- package/src/antd/input-number.tsx +97 -11
- package/src/antd/input.tsx +127 -8
- package/src/antd/styles.ts +92 -32
- package/src/antd/tabs.tsx +139 -27
- package/src/app-icon-with-fallback.tsx +3 -7
- package/src/app-icon-wrapper.tsx +1 -13
- package/src/avatar.tsx +2 -56
- package/src/breadcrumb.tsx +5 -1
- package/src/color-adjuster.ts +24 -1
- package/src/color-utils.test.ts +2 -2
- package/src/color-utils.ts +2 -2
- package/src/copy-to-clipboard.ts +14 -3
- package/src/count-badge.tsx +10 -1
- package/src/date-picker/contexts.ts +6 -3
- package/src/date-picker/date-range-picker.tsx +7 -8
- package/src/date-picker/single-date-picker.tsx +3 -5
- package/src/date-picker/types.ts +1 -1
- package/src/date-picker/with-popup-control.tsx +3 -9
- package/src/day-select/iso-week-day-select.tsx +2 -2
- package/src/design-system/colors-callout.warm-dark.test.ts +22 -22
- package/src/design-system/colors-callout.warm-light.test.ts +19 -19
- package/src/design-system/colors-css.ts +1 -1
- package/src/design-system/colors-enum.dark.warm.test.ts +63 -63
- package/src/design-system/colors-enum.light.warm.test.ts +54 -54
- package/src/design-system/colors-highlight.warm-dark.test.ts +21 -21
- package/src/design-system/colors-highlight.warm-light.test.ts +21 -21
- package/src/design-system/colors.ts +4 -4
- package/src/design-system/fns.badge.dark.warm.test.ts +34 -34
- package/src/design-system/fns.badge.light.warm.test.ts +31 -31
- package/src/design-system/fns.deneutralize.test.ts +44 -0
- package/src/design-system/fns.icon.dark.warm.test.ts +21 -21
- package/src/design-system/fns.icon.light.warm.test.ts +17 -17
- package/src/design-system/fns.icon.ts +21 -13
- package/src/design-system/fns.ts +27 -3
- package/src/design-system/typography.ts +1 -1
- package/src/design-system.ts +1 -1
- package/src/emoji-picker/icon-emoji-picker.tsx +3 -3
- package/src/fibermoji-placeholder.tsx +2 -3
- package/src/icons/ast/index.tsx +446 -446
- package/src/icons/icon.tsx +23 -1
- package/src/icons/icons-integrity.test.ts +145 -0
- package/src/icons/react/index.tsx +446 -446
- package/src/icons/types.ts +1 -1
- package/src/images-gallery/images-gallery.tsx +2 -2
- package/src/images-gallery/slide-buttons.tsx +2 -4
- package/src/layout-styles.ts +5 -1
- package/src/link-input/components/ant-text-area-with-custom-read-state.tsx +2 -1
- package/src/lists/actions-menu-row-surface.tsx +1 -1
- package/src/media-query-utils.ts +5 -14
- package/src/mobile-keyboard-aware-popup.tsx +1 -1
- package/src/number-input/decimal.ts +6 -9
- package/src/number-input/number-input-inline-with-autosize.tsx +1 -1
- package/src/online-users.tsx +4 -5
- package/src/palettes/inspect.defs.colors.neutral-arch.test.ts +4 -4
- package/src/palettes/inspect.defs.colors.neutral-user.test.ts +4 -4
- package/src/palettes/inspect.defs.colors.warm-arch.test.ts +141 -141
- package/src/palettes/inspect.defs.colors.warm-user.test.ts +141 -141
- package/src/palettes/warm.ts +2 -0
- package/src/popover/index.tsx +4 -4
- package/src/popover/mobile-popover-context.tsx +1 -1
- package/src/popover/modifiers.tsx +1 -1
- package/src/rich-input-loader.tsx +1 -1
- package/src/root-theme-provider.test.tsx +1 -1
- package/src/select/components/menu-list-virtua.tsx +15 -16
- package/src/select/components/menu-list-virtualized.tsx +26 -29
- package/src/select/components/menu.tsx +3 -3
- package/src/select/index.tsx +4 -4
- package/src/select/reflection.ts +4 -5
- package/src/select/select-in-popover.tsx +34 -51
- package/src/select/select.tsx +5 -5
- package/src/select/styles.ts +1 -7
- package/src/select/util.ts +2 -2
- package/src/theme-provider.test.tsx +1 -1
- package/src/theme-provider.tsx +3 -9
- package/src/theme-snapshots.test.ts +9 -13
- package/src/{theming/build.ts → theming.build.ts} +6 -9
- package/src/{theming/theming-fibery.snapshot.css → theming.generated.css} +60 -60
- package/src/{theming/theming-fibery.snapshot.ts → theming.generated.ts} +60 -60
- package/src/type-badge.tsx +1 -2
- package/src/{themed-ink.tsx → type-label.tsx} +2 -5
- package/src/use-on-screen-keyboard-data.tsx +1 -1
- package/src/with-data.tsx +1 -1
- package/src/antd/auto-complete.d.ts +0 -2
- package/src/antd/auto-complete.ts +0 -37
- package/src/antd/tabs.d.ts +0 -5
- package/src/theming/index.ts +0 -20
- package/src/theming/theming-vzdbery.snapshot.css +0 -2001
- package/src/theming/theming-vzdbery.snapshot.ts +0 -2519
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @fibery/ui-kit
|
|
2
2
|
|
|
3
|
+
## 4.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- fb2ba1d: Add `isRecord`, `noop`, `identity`, `truthy` to `_.ts` in `@fibery/helpers`; drop `lodash` from `@fibery/ui-kit` dependencies.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [fb2ba1d]
|
|
12
|
+
- @fibery/helpers@3.1.0
|
|
13
|
+
- @fibery/react@1.5.4
|
|
14
|
+
|
|
15
|
+
## 4.0.0
|
|
16
|
+
|
|
17
|
+
### Major Changes
|
|
18
|
+
|
|
19
|
+
- 5025ffe: Inline antd dep monolith (tabs,input,select,autocomplete,upload) for -50kb gzipped impact
|
|
20
|
+
|
|
3
21
|
## 3.0.0
|
|
4
22
|
|
|
5
23
|
### Major Changes
|
package/esfint.config.mjs
CHANGED
|
@@ -13,21 +13,4 @@ export default [
|
|
|
13
13
|
"unicorn/filename-case": "off",
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
|
-
{
|
|
17
|
-
files: ["src/design-system/**/*"],
|
|
18
|
-
rules: {
|
|
19
|
-
"no-restricted-imports": [
|
|
20
|
-
"error",
|
|
21
|
-
{
|
|
22
|
-
patterns: [
|
|
23
|
-
{group: ["@fibery/ui-kit/*"]},
|
|
24
|
-
{
|
|
25
|
-
group: ["lodash", "lodash/*", "lodash-es", "lodash-es/*"],
|
|
26
|
-
message: "lodash is not allowed in design-system",
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
},
|
|
30
|
-
],
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
16
|
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fibery/ui-kit",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"dependencies": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"@radix-ui/react-collapsible": "1.1.0",
|
|
11
11
|
"@radix-ui/react-context-menu": "2.2.1",
|
|
12
12
|
"@radix-ui/react-dropdown-menu": "2.1.1",
|
|
13
|
-
"@radix-ui/react-focus-scope": "
|
|
13
|
+
"@radix-ui/react-focus-scope": "1.1.8",
|
|
14
14
|
"@radix-ui/react-navigation-menu": "1.2.1",
|
|
15
15
|
"@radix-ui/react-slot": "1.2.4",
|
|
16
16
|
"@radix-ui/react-toast": "1.2.2",
|
|
@@ -20,13 +20,12 @@
|
|
|
20
20
|
"@tanstack/hotkeys": "0.7.1",
|
|
21
21
|
"@tanstack/react-hotkeys": "0.9.1",
|
|
22
22
|
"@types/apca-w3": "0.1.3",
|
|
23
|
-
"@types/d3-shape": "
|
|
24
|
-
"@types/react-select-country-list": "
|
|
25
|
-
"@types/setimmediate": "
|
|
26
|
-
"antd": "4.24.7",
|
|
23
|
+
"@types/d3-shape": "3.1.6",
|
|
24
|
+
"@types/react-select-country-list": "2.2.3",
|
|
25
|
+
"@types/setimmediate": "1.0.4",
|
|
27
26
|
"apca-w3": "0.1.9",
|
|
28
27
|
"apcach": "github:antiflasher/apcach#54077b3",
|
|
29
|
-
"chrono-node": "
|
|
28
|
+
"chrono-node": "2.9.0",
|
|
30
29
|
"classnames": "2.3.1",
|
|
31
30
|
"cmdk": "1.0.0",
|
|
32
31
|
"color-hash": "1.0.3",
|
|
@@ -34,15 +33,22 @@
|
|
|
34
33
|
"d3-shape": "1.3.7",
|
|
35
34
|
"date-fns": "2.29.2",
|
|
36
35
|
"invariant": "2.2.4",
|
|
37
|
-
"lodash": "4.17.21",
|
|
38
36
|
"lru-cache": "11.2.2",
|
|
39
37
|
"md5": "2.2.1",
|
|
40
38
|
"moment": "2.29.4",
|
|
39
|
+
"node-types-local": "npm:@types/node@^24",
|
|
41
40
|
"photoswipe": "5.4.4",
|
|
42
41
|
"popper-max-size-modifier": "0.2.0",
|
|
43
42
|
"prop-types": "15.7.2",
|
|
43
|
+
"rc-dialog": "9.0.4",
|
|
44
|
+
"rc-input": "0.1.4",
|
|
44
45
|
"rc-input-number": "8.5.0",
|
|
46
|
+
"rc-input-number-v7": "npm:rc-input-number@7.3.11",
|
|
45
47
|
"rc-progress": "3.4.1",
|
|
48
|
+
"rc-select": "14.1.18",
|
|
49
|
+
"rc-tabs": "12.5.10",
|
|
50
|
+
"rc-textarea": "0.4.7",
|
|
51
|
+
"rc-upload": "4.3.4",
|
|
46
52
|
"react-color": "2.19.3",
|
|
47
53
|
"react-day-picker": "8.10.1",
|
|
48
54
|
"react-intersection-observer": "9.3.5",
|
|
@@ -54,8 +60,8 @@
|
|
|
54
60
|
"tabbable": "5.2.1",
|
|
55
61
|
"virtua": "0.48.8",
|
|
56
62
|
"@fibery/emoji-data": "2.7.3",
|
|
57
|
-
"@fibery/helpers": "3.
|
|
58
|
-
"@fibery/react": "1.5.
|
|
63
|
+
"@fibery/helpers": "3.1.0",
|
|
64
|
+
"@fibery/react": "1.5.4"
|
|
59
65
|
},
|
|
60
66
|
"devDependencies": {
|
|
61
67
|
"@babel/core": "7.28.5",
|
|
@@ -68,7 +74,6 @@
|
|
|
68
74
|
"@types/culori": "4.0.1",
|
|
69
75
|
"@types/history": "4.7.11",
|
|
70
76
|
"@types/invariant": "2.2.34",
|
|
71
|
-
"@types/lodash": "4.14.172",
|
|
72
77
|
"@types/prop-types": "15.7.5",
|
|
73
78
|
"@types/react": "18.3.12",
|
|
74
79
|
"@types/react-color": "2.13.5",
|
|
@@ -76,7 +81,7 @@
|
|
|
76
81
|
"@typescript/native-preview": "beta",
|
|
77
82
|
"csstype": "3.0.8",
|
|
78
83
|
"fs-extra": "10.0.0",
|
|
79
|
-
"glob": "
|
|
84
|
+
"glob": "13.0.6",
|
|
80
85
|
"react": "18.3.1",
|
|
81
86
|
"react-dom": "18.3.1",
|
|
82
87
|
"svg-parser": "2.0.4",
|
|
@@ -94,7 +99,7 @@
|
|
|
94
99
|
"test:ci": "../../scripts/test.sh --ci",
|
|
95
100
|
"test:coverage": "../../scripts/test.sh --ci --coverage",
|
|
96
101
|
"check": "../../scripts/check.sh",
|
|
97
|
-
"lint": "
|
|
102
|
+
"lint": "pnpm -w lint .",
|
|
98
103
|
"generate-icons": "node scripts/generate-icons.mjs",
|
|
99
104
|
"show-colors": "cd ../.. && SHOW_COLORS=1 ./node_modules/.bin/vitest run --project ui-kit --disable-console-intercept -t 'show all current colors'",
|
|
100
105
|
"typecheck": "../../scripts/typecheck.sh"
|
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
import {readFile} from "fs/promises";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import {fileURLToPath} from "url";
|
|
4
|
-
import {promisify} from "util";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import {fileURLToPath} from "node:url";
|
|
5
4
|
|
|
6
5
|
import fs from "fs-extra";
|
|
7
|
-
import glob from "glob";
|
|
8
|
-
import _ from "lodash";
|
|
6
|
+
import {glob} from "glob";
|
|
9
7
|
import {parse} from "svg-parser";
|
|
10
8
|
import svgo from "svgo";
|
|
11
9
|
import {recursiveReduce} from "unist-util-reduce";
|
|
12
10
|
|
|
11
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
12
|
+
const __dirname = path.dirname(__filename);
|
|
13
|
+
|
|
14
|
+
const WORD_RE = /[A-Z]+(?![a-z])|[A-Z]?[a-z]+|\d+/g;
|
|
15
|
+
const words = (s) => String(s).match(WORD_RE) ?? [];
|
|
16
|
+
const cap = (w) => w[0].toUpperCase() + w.slice(1).toLowerCase();
|
|
17
|
+
const pascalCase = (s) => words(s).map(cap).join("");
|
|
18
|
+
const camelCase = (s) =>
|
|
19
|
+
words(s)
|
|
20
|
+
.map((w, i) => (i ? cap(w) : w.toLowerCase()))
|
|
21
|
+
.join("");
|
|
22
|
+
const kebabCase = (s) =>
|
|
23
|
+
words(s)
|
|
24
|
+
.map((w) => w.toLowerCase())
|
|
25
|
+
.join("-");
|
|
26
|
+
|
|
13
27
|
const svgoConfig = (prefix) => ({
|
|
14
28
|
plugins: [
|
|
15
29
|
{
|
|
@@ -24,55 +38,55 @@ const svgoConfig = (prefix) => ({
|
|
|
24
38
|
],
|
|
25
39
|
});
|
|
26
40
|
|
|
27
|
-
const
|
|
28
|
-
const __dirname = path.dirname(__filename);
|
|
29
|
-
|
|
30
|
-
const preludeTemplate = `/**
|
|
41
|
+
const preludeTemplate = ({source, generator}) => `/**
|
|
31
42
|
* This file was automatically generated. Do not edit manually.
|
|
32
|
-
*
|
|
33
|
-
|
|
34
|
-
|
|
43
|
+
* ${
|
|
44
|
+
source
|
|
45
|
+
? `
|
|
46
|
+
* @see import("${source}")`
|
|
47
|
+
: ""
|
|
48
|
+
}
|
|
49
|
+
* @see import("${generator}")
|
|
35
50
|
*/
|
|
36
51
|
`;
|
|
37
52
|
|
|
38
|
-
const render =
|
|
39
|
-
`${preludeTemplate}
|
|
53
|
+
const render = ({source, generator, svgIdentifier, svgIdentifierPath}) =>
|
|
54
|
+
`${preludeTemplate({source, generator})}
|
|
40
55
|
import {forwardRef} from "react";
|
|
41
|
-
import
|
|
56
|
+
import ${svgIdentifier}Svg from "../ast/${svgIdentifierPath}";
|
|
42
57
|
import {Icon} from "../icon";
|
|
43
58
|
import type {IconBaseProps} from "../types";
|
|
44
59
|
|
|
45
|
-
const
|
|
60
|
+
const ${svgIdentifier} = forwardRef<SVGSVGElement, IconBaseProps>(function ${svgIdentifier}(
|
|
46
61
|
props: IconBaseProps,
|
|
47
62
|
ref: React.Ref<SVGSVGElement>
|
|
48
|
-
) {return <Icon {...props} className={props.className} ref={ref} icon={
|
|
63
|
+
) {return <Icon {...props} className={props.className} ref={ref} icon={${svgIdentifier}Svg} />});
|
|
49
64
|
|
|
50
|
-
export default
|
|
51
|
-
`.trim()
|
|
52
|
-
);
|
|
65
|
+
export default ${svgIdentifier};
|
|
66
|
+
`.trim();
|
|
53
67
|
|
|
54
|
-
const defTemplate =
|
|
68
|
+
const defTemplate = ({source, generator, identifier, content}) => `${preludeTemplate({source, generator})}
|
|
55
69
|
import type {IconDefinition} from "../types";
|
|
56
70
|
|
|
57
|
-
const
|
|
71
|
+
const ${identifier}: IconDefinition = ${content};
|
|
58
72
|
|
|
59
|
-
export default
|
|
60
|
-
|
|
73
|
+
export default ${identifier};
|
|
74
|
+
`;
|
|
61
75
|
|
|
62
76
|
const iconsDir = path.join(__dirname, "../src/icons");
|
|
63
77
|
const iconsSvgPathDir = path.join(iconsDir, "./svg");
|
|
64
78
|
const iconsReactPathDir = path.join(iconsDir, "./react");
|
|
65
79
|
const iconsAstPathDir = path.join(iconsDir, "./ast");
|
|
66
80
|
const pattern = "**/*.svg";
|
|
67
|
-
const icons = await
|
|
81
|
+
const icons = await glob(pattern, {cwd: iconsSvgPathDir});
|
|
68
82
|
|
|
69
83
|
await fs.remove(iconsReactPathDir);
|
|
70
84
|
await fs.remove(iconsAstPathDir);
|
|
71
85
|
|
|
72
86
|
const generator = path.relative(iconsReactPathDir, __filename);
|
|
73
|
-
let barrelExportContent =
|
|
87
|
+
let barrelExportContent = preludeTemplate({source: null, generator: generator}) + "\n";
|
|
74
88
|
for (const icon of icons) {
|
|
75
|
-
const name =
|
|
89
|
+
const name = pascalCase(icon.replace("/", "-").replace(".svg", ""));
|
|
76
90
|
const resultFileName = icon.replaceAll("/", "-").replace(".svg", "");
|
|
77
91
|
const iconPath = path.join(iconsSvgPathDir, icon);
|
|
78
92
|
const source = path.relative(iconsReactPathDir, iconPath);
|
|
@@ -97,17 +111,17 @@ for (const icon of icons) {
|
|
|
97
111
|
value.split(";").forEach((styleItem) => {
|
|
98
112
|
const [styleKey, styleValue] = styleItem.split(":").map((s) => s.trim());
|
|
99
113
|
if (styleKey && styleValue) {
|
|
100
|
-
style[
|
|
114
|
+
style[camelCase(styleKey)] = styleValue;
|
|
101
115
|
}
|
|
102
116
|
});
|
|
103
|
-
return [
|
|
117
|
+
return [camelCase(key), style];
|
|
104
118
|
}
|
|
105
|
-
return [
|
|
119
|
+
return [camelCase(key), value];
|
|
106
120
|
})
|
|
107
121
|
),
|
|
108
122
|
};
|
|
109
123
|
}),
|
|
110
|
-
name:
|
|
124
|
+
name: kebabCase(name),
|
|
111
125
|
}),
|
|
112
126
|
})
|
|
113
127
|
);
|
|
@@ -126,16 +140,3 @@ for (const icon of icons) {
|
|
|
126
140
|
}
|
|
127
141
|
await fs.outputFile(path.join(iconsReactPathDir, `./index.tsx`), barrelExportContent);
|
|
128
142
|
await fs.outputFile(path.join(iconsAstPathDir, `./index.tsx`), barrelExportContent);
|
|
129
|
-
|
|
130
|
-
// import {getSvg, iconNames} from "../Icon";
|
|
131
|
-
//
|
|
132
|
-
// it.skip("generate", async () => {
|
|
133
|
-
// console.log(iconNames);
|
|
134
|
-
// for (const iconName of iconNames) {
|
|
135
|
-
// await fs.outputFile(
|
|
136
|
-
// path.join(__dirname, "./icons", iconName.replace(":icon", "svg") + ".svg"),
|
|
137
|
-
// `<?xml version="1.0" standalone="no"?>\n` + getSvg({name: iconName})
|
|
138
|
-
// );
|
|
139
|
-
// }
|
|
140
|
-
// expect(true).toEqual(true);
|
|
141
|
-
// });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import {noop} from "@fibery/helpers/src/_";
|
|
1
2
|
import {stopPropagation} from "@fibery/react/src/stop-propagation";
|
|
2
3
|
import {useCallbackRef} from "@fibery/react/src/use-callback-ref";
|
|
3
4
|
import {css, cx} from "@linaria/core";
|
|
4
|
-
import noop from "lodash/noop";
|
|
5
5
|
import type {FunctionComponent, ReactNode} from "react";
|
|
6
6
|
import {memo, useId} from "react";
|
|
7
7
|
|
|
@@ -79,6 +79,7 @@ const rowWithDescriptionCss = css`
|
|
|
79
79
|
`;
|
|
80
80
|
|
|
81
81
|
const rowContentCss = css`
|
|
82
|
+
min-width: 0;
|
|
82
83
|
flex-grow: 1;
|
|
83
84
|
`;
|
|
84
85
|
|
|
@@ -4,7 +4,6 @@ import {css, cx} from "@linaria/core";
|
|
|
4
4
|
import {useEffect, useState} from "react";
|
|
5
5
|
|
|
6
6
|
import * as DropdownMenu from "../dropdown-menu";
|
|
7
|
-
import {useFeatures} from "../features";
|
|
8
7
|
import * as ModalMenu from "../modal-menu";
|
|
9
8
|
import {useOpenPopoverTracker} from "../open-popover-tracker";
|
|
10
9
|
import {useIsPhone} from "../use-is-phone";
|
|
@@ -47,7 +46,6 @@ export const ActionsMenu = ({
|
|
|
47
46
|
sticky,
|
|
48
47
|
height,
|
|
49
48
|
}: ActionsMenuProps): JSX.Element => {
|
|
50
|
-
const features = useFeatures<{enableMobileMenus: boolean}>();
|
|
51
49
|
const [isOpen = false, setOpen] = useControllableState({value: open, onChange: onOpenChange});
|
|
52
50
|
const isPhone = useIsPhone();
|
|
53
51
|
const [confirmation, setConfirmation] = useState<ActionsMenuConfirmationProps | null>(null);
|
|
@@ -58,7 +56,7 @@ export const ActionsMenu = ({
|
|
|
58
56
|
return () => onOpenPopoverChange(false);
|
|
59
57
|
}, [isOpen, onOpenPopoverChange]);
|
|
60
58
|
|
|
61
|
-
const MenuPrimitive = isPhone &&
|
|
59
|
+
const MenuPrimitive = isPhone && supportsMobile ? ModalMenu : DropdownMenu;
|
|
62
60
|
|
|
63
61
|
return (
|
|
64
62
|
<ActionsMenuContextProvider
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import {noop} from "@fibery/helpers/src/_";
|
|
1
2
|
import {preventDefault} from "@fibery/react/src/prevent-default";
|
|
2
3
|
import {useControllableState} from "@fibery/react/src/use-controllable-state";
|
|
3
|
-
import noop from "lodash/noop";
|
|
4
4
|
import {useState} from "react";
|
|
5
5
|
|
|
6
6
|
import * as ContextMenu from "../context-menu";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import {noop} from "@fibery/helpers/src/_";
|
|
1
2
|
import {useComposedRefs} from "@fibery/react/src/use-composed-refs";
|
|
2
3
|
import {useSize} from "@fibery/react/src/use-size";
|
|
3
|
-
import noop from "lodash/noop";
|
|
4
4
|
import type {ComponentProps} from "react";
|
|
5
5
|
import React, {forwardRef, useEffect, useRef, useState} from "react";
|
|
6
6
|
|
package/src/antd/ant-modal.tsx
CHANGED
|
@@ -1,32 +1,181 @@
|
|
|
1
1
|
import {css, cx} from "@linaria/core";
|
|
2
|
-
import
|
|
3
|
-
import "
|
|
4
|
-
import type {
|
|
5
|
-
import type {ReactNode} from "react";
|
|
2
|
+
import Dialog from "rc-dialog";
|
|
3
|
+
import type {IDialogPropTypes} from "rc-dialog/lib/IDialogPropTypes";
|
|
4
|
+
import type {CSSProperties, MouseEvent as ReactMouseEvent, ReactNode} from "react";
|
|
6
5
|
|
|
7
|
-
import {border, space, themeVars} from "../design-system";
|
|
6
|
+
import {border, space, themeVars, transitions} from "../design-system";
|
|
7
|
+
import CloseIcon from "../icons/react/close";
|
|
8
8
|
import {ThemeProvider} from "../theme-provider";
|
|
9
9
|
|
|
10
|
+
const defaultCloseIcon = <CloseIcon />;
|
|
11
|
+
|
|
10
12
|
const modalCss = css`
|
|
11
|
-
& .ant-modal-
|
|
13
|
+
:where(&) .ant-modal-mask {
|
|
14
|
+
position: fixed;
|
|
15
|
+
inset: 0;
|
|
16
|
+
z-index: 1000;
|
|
17
|
+
height: 100%;
|
|
18
|
+
background-color: ${themeVars.modalBg};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
:where(&) .ant-modal-wrap {
|
|
22
|
+
position: fixed;
|
|
23
|
+
inset: 0;
|
|
24
|
+
z-index: 1000;
|
|
25
|
+
overflow: auto;
|
|
26
|
+
outline: 0;
|
|
27
|
+
-webkit-overflow-scrolling: touch;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
:where(&) .ant-modal {
|
|
31
|
+
position: relative;
|
|
32
|
+
top: 100px;
|
|
33
|
+
margin: 0 auto;
|
|
34
|
+
padding-bottom: 24px;
|
|
35
|
+
pointer-events: none;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
:where(&) .ant-modal-centered {
|
|
39
|
+
text-align: center;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
:where(&) .ant-modal-centered::before {
|
|
43
|
+
display: inline-block;
|
|
44
|
+
width: 0;
|
|
45
|
+
height: 100%;
|
|
46
|
+
vertical-align: middle;
|
|
47
|
+
content: "";
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
:where(&) .ant-modal-centered .ant-modal {
|
|
51
|
+
top: 0;
|
|
52
|
+
display: inline-block;
|
|
53
|
+
padding-bottom: 0;
|
|
54
|
+
text-align: left;
|
|
55
|
+
vertical-align: middle;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
:where(&) .ant-modal-content {
|
|
59
|
+
position: relative;
|
|
12
60
|
box-shadow: ${themeVars.shadowPopup};
|
|
13
61
|
margin-left: ${space.s6}px;
|
|
14
62
|
margin-right: ${space.s6}px;
|
|
15
63
|
background-color: ${themeVars.modalContentBg};
|
|
16
64
|
border-radius: ${border.radius8}px;
|
|
65
|
+
pointer-events: auto;
|
|
17
66
|
}
|
|
18
67
|
|
|
19
|
-
& .ant-modal-body {
|
|
68
|
+
:where(&) .ant-modal-body {
|
|
20
69
|
padding: ${space.s20}px;
|
|
21
70
|
}
|
|
71
|
+
|
|
72
|
+
:where(&) .ant-modal-close {
|
|
73
|
+
position: absolute;
|
|
74
|
+
top: 0;
|
|
75
|
+
right: 0;
|
|
76
|
+
z-index: 10;
|
|
77
|
+
display: flex;
|
|
78
|
+
align-items: center;
|
|
79
|
+
justify-content: center;
|
|
80
|
+
width: 56px;
|
|
81
|
+
height: 56px;
|
|
82
|
+
padding: 0;
|
|
83
|
+
color: ${themeVars.iconColor};
|
|
84
|
+
background: transparent;
|
|
85
|
+
border: 0;
|
|
86
|
+
outline: 0;
|
|
87
|
+
cursor: pointer;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
:where(&) .ant-fade-enter,
|
|
91
|
+
:where(&) .ant-fade-appear {
|
|
92
|
+
opacity: 0;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
:where(&) .ant-fade-enter-active,
|
|
96
|
+
:where(&) .ant-fade-appear-active {
|
|
97
|
+
opacity: 1;
|
|
98
|
+
transition: opacity ${transitions.normal};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
:where(&) .ant-fade-leave {
|
|
102
|
+
opacity: 1;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
:where(&) .ant-fade-leave-active {
|
|
106
|
+
opacity: 0;
|
|
107
|
+
transition: opacity ${transitions.normal};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
:where(&) .ant-zoom-enter,
|
|
111
|
+
:where(&) .ant-zoom-appear {
|
|
112
|
+
opacity: 0;
|
|
113
|
+
transform: scale(0.96);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
:where(&) .ant-zoom-enter-active,
|
|
117
|
+
:where(&) .ant-zoom-appear-active {
|
|
118
|
+
opacity: 1;
|
|
119
|
+
transform: scale(1);
|
|
120
|
+
transition:
|
|
121
|
+
opacity ${transitions.normal},
|
|
122
|
+
transform ${transitions.normal};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
:where(&) .ant-zoom-leave {
|
|
126
|
+
opacity: 1;
|
|
127
|
+
transform: scale(1);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
:where(&) .ant-zoom-leave-active {
|
|
131
|
+
opacity: 0;
|
|
132
|
+
transform: scale(0.96);
|
|
133
|
+
transition:
|
|
134
|
+
opacity ${transitions.normal},
|
|
135
|
+
transform ${transitions.normal};
|
|
136
|
+
}
|
|
22
137
|
`;
|
|
23
138
|
|
|
24
139
|
function renderWithTheme(node: ReactNode): ReactNode {
|
|
25
140
|
return <ThemeProvider portal>{node}</ThemeProvider>;
|
|
26
141
|
}
|
|
27
142
|
|
|
28
|
-
export
|
|
143
|
+
export type AntModalProps = Omit<IDialogPropTypes, "visible" | "onClose" | "prefixCls"> & {
|
|
144
|
+
open?: boolean;
|
|
145
|
+
onCancel?: (e: ReactMouseEvent<HTMLElement>) => void;
|
|
146
|
+
centered?: boolean;
|
|
147
|
+
bodyStyle?: CSSProperties;
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export function AntModal({
|
|
151
|
+
open,
|
|
152
|
+
onCancel,
|
|
153
|
+
centered,
|
|
154
|
+
bodyStyle = {},
|
|
155
|
+
className,
|
|
156
|
+
wrapClassName,
|
|
157
|
+
rootClassName,
|
|
158
|
+
width = 520,
|
|
159
|
+
transitionName = "ant-zoom",
|
|
160
|
+
maskTransitionName = "ant-fade",
|
|
161
|
+
closeIcon = defaultCloseIcon,
|
|
162
|
+
...restProps
|
|
163
|
+
}: AntModalProps) {
|
|
29
164
|
return (
|
|
30
|
-
<
|
|
165
|
+
<Dialog
|
|
166
|
+
prefixCls="ant-modal"
|
|
167
|
+
visible={open}
|
|
168
|
+
onClose={onCancel as IDialogPropTypes["onClose"]}
|
|
169
|
+
bodyStyle={bodyStyle}
|
|
170
|
+
className={className}
|
|
171
|
+
wrapClassName={cx(wrapClassName, centered && "ant-modal-centered")}
|
|
172
|
+
rootClassName={cx(rootClassName, modalCss)}
|
|
173
|
+
width={width}
|
|
174
|
+
transitionName={transitionName}
|
|
175
|
+
maskTransitionName={maskTransitionName}
|
|
176
|
+
closeIcon={closeIcon}
|
|
177
|
+
modalRender={renderWithTheme}
|
|
178
|
+
{...restProps}
|
|
179
|
+
/>
|
|
31
180
|
);
|
|
32
181
|
}
|