@uxf/ui 11.34.1 → 11.36.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/_tokens/generated/figma-colors.js +118 -0
- package/bin/generate-css-tokens.js +116 -0
- package/button/README.md +1 -1
- package/button/button.d.ts +2 -1
- package/button/button.stories.js +1 -1
- package/button-list/button-list.js +3 -2
- package/chip/chip.d.ts +2 -0
- package/chip/chip.js +3 -2
- package/components.d.ts +5 -0
- package/components.js +5 -0
- package/css/badge.css +1 -1
- package/css/button.css +50 -48
- package/css/colors-dark.css +118 -0
- package/css/colors-light.css +118 -0
- package/css/colors-primitives.css +312 -0
- package/css/figma-colors.css +540 -0
- package/css/icon-button.css +9 -0
- package/css/modal-header.css +4 -4
- package/css/pagination.css +2 -2
- package/css/radio-group.css +1 -1
- package/css/text-link.css +1 -1
- package/css/toggle.css +1 -1
- package/dropdown/dropdown.d.ts +2 -0
- package/dropdown/dropdown.js +3 -2
- package/dropzone/README.md +99 -1
- package/dropzone/dropzone-input.d.ts +4 -2
- package/dropzone/dropzone-input.js +5 -16
- package/dropzone/dropzone-list.d.ts +5 -2
- package/dropzone/dropzone-list.js +8 -7
- package/dropzone/dropzone.stories.d.ts +1 -2
- package/dropzone/dropzone.stories.js +29 -37
- package/dropzone/handle-rejected-files.d.ts +2 -0
- package/dropzone/handle-rejected-files.js +17 -0
- package/dropzone/index.d.ts +2 -1
- package/figma-colors.js +118 -0
- package/icon-button/README.md +9 -0
- package/icon-button/icon-button.d.ts +9 -0
- package/icon-button/icon-button.js +15 -0
- package/icon-button/icon-button.spec.d.ts +1 -0
- package/icon-button/icon-button.spec.js +9 -0
- package/icon-button/icon-button.stories.d.ts +2 -0
- package/icon-button/icon-button.stories.js +58 -0
- package/icon-button/index.d.ts +2 -0
- package/icon-button/index.js +5 -0
- package/list-item/list-item.d.ts +2 -0
- package/list-item/list-item.js +3 -2
- package/modal-header/README.md +1 -0
- package/package.json +44 -38
- package/readmes.d.ts +1 -0
- package/readmes.js +58 -56
- package/scripts/generate-tw-tokens.js +1 -0
- package/text-link/text-link.d.ts +2 -0
- package/text-link/text-link.js +3 -2
- package/toggle/toggle.stories.js +7 -7
- package/tokens/figma-colors.js +118 -0
- package/tw-tokens/tw-colors.d.ts +115 -0
- package/tw-tokens/tw-colors.js +115 -0
- package/tw-tokens/tw-containers.js +1 -7
- package/tw-tokens/tw-screens.js +1 -7
- package/utils/storybook-config.d.ts +5 -0
- package/utils/storybook-config.js +5 -0
- package/utils/tailwind-config.js +7 -0
- package/css/colors.css +0 -99
- /package/{button → utils}/next-link.d.ts +0 -0
- /package/{button → utils}/next-link.js +0 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
const figmaColors = {
|
|
2
|
+
base_border_border: "var(--uxf-color-base-border-border)",
|
|
3
|
+
base_border_input: "var(--uxf-color-base-border-input)",
|
|
4
|
+
base_border_inverted_border: "var(--uxf-color-base-border-inverted-border)",
|
|
5
|
+
base_border_inverted_input: "var(--uxf-color-base-border-inverted-input)",
|
|
6
|
+
base_icon_disabled: "var(--uxf-color-base-icon-disabled)",
|
|
7
|
+
base_icon_high_emphasis: "var(--uxf-color-base-icon-high-emphasis)",
|
|
8
|
+
base_icon_low_emphasis: "var(--uxf-color-base-icon-low-emphasis)",
|
|
9
|
+
base_icon_medium_emphasis: "var(--uxf-color-base-icon-medium-emphasis)",
|
|
10
|
+
base_icon_inverted_low_emphasis: "var(--uxf-color-base-icon-inverted-low-emphasis)",
|
|
11
|
+
base_icon_inverted_disabled: "var(--uxf-color-base-icon-inverted-disabled)",
|
|
12
|
+
base_icon_inverted_high_emphasis: "var(--uxf-color-base-icon-inverted-high-emphasis)",
|
|
13
|
+
base_shadow_shadow_md: "var(--uxf-color-base-shadow-shadow-md)",
|
|
14
|
+
base_shadow_shadow_sm: "var(--uxf-color-base-shadow-shadow-sm)",
|
|
15
|
+
base_surface_background: "var(--uxf-color-base-surface-background)",
|
|
16
|
+
base_surface_disabled: "var(--uxf-color-base-surface-disabled)",
|
|
17
|
+
base_surface_input: "var(--uxf-color-base-surface-input)",
|
|
18
|
+
base_surface_input_disabled: "var(--uxf-color-base-surface-input-disabled)",
|
|
19
|
+
base_surface_input_hover: "var(--uxf-color-base-surface-input-hover)",
|
|
20
|
+
base_surface_main: "var(--uxf-color-base-surface-main)",
|
|
21
|
+
base_surface_main_hover: "var(--uxf-color-base-surface-main-hover)",
|
|
22
|
+
base_surface_popup: "var(--uxf-color-base-surface-popup)",
|
|
23
|
+
base_surface_tooltip: "var(--uxf-color-base-surface-tooltip)",
|
|
24
|
+
base_surface_inverted_default: "var(--uxf-color-base-surface-inverted-default)",
|
|
25
|
+
base_surface_inverted_default_hover: "var(--uxf-color-base-surface-inverted-default-hover)",
|
|
26
|
+
base_surface_inverted_disabled: "var(--uxf-color-base-surface-inverted-disabled)",
|
|
27
|
+
base_surface_inverted_main: "var(--uxf-color-base-surface-inverted-main)",
|
|
28
|
+
base_surface_inverted_main_hover: "var(--uxf-color-base-surface-inverted-main-hover)",
|
|
29
|
+
base_text_disabled: "var(--uxf-color-base-text-disabled)",
|
|
30
|
+
base_text_high_emphasis: "var(--uxf-color-base-text-high-emphasis)",
|
|
31
|
+
base_text_link: "var(--uxf-color-base-text-link)",
|
|
32
|
+
base_text_link_pressed: "var(--uxf-color-base-text-link-pressed)",
|
|
33
|
+
base_text_low_emphasis: "var(--uxf-color-base-text-low-emphasis)",
|
|
34
|
+
base_text_inverted_disabled: "var(--uxf-color-base-text-inverted-disabled)",
|
|
35
|
+
base_text_inverted_high_emphasis: "var(--uxf-color-base-text-inverted-high-emphasis)",
|
|
36
|
+
base_text_inverted_link: "var(--uxf-color-base-text-inverted-link)",
|
|
37
|
+
base_text_inverted_low_emphasis: "var(--uxf-color-base-text-inverted-low-emphasis)",
|
|
38
|
+
brand_border: "var(--uxf-color-brand-border)",
|
|
39
|
+
brand_icon: "var(--uxf-color-brand-icon)",
|
|
40
|
+
brand_icon_on_muted: "var(--uxf-color-brand-icon-on-muted)",
|
|
41
|
+
brand_text: "var(--uxf-color-brand-text)",
|
|
42
|
+
brand_text_on_muted: "var(--uxf-color-brand-text-on-muted)",
|
|
43
|
+
brand_surface_bolder: "var(--uxf-color-brand-surface-bolder)",
|
|
44
|
+
brand_surface_bolder_hover: "var(--uxf-color-brand-surface-bolder-hover)",
|
|
45
|
+
brand_surface_default: "var(--uxf-color-brand-surface-default)",
|
|
46
|
+
brand_surface_default_hover: "var(--uxf-color-brand-surface-default-hover)",
|
|
47
|
+
brand_surface_muted: "var(--uxf-color-brand-surface-muted)",
|
|
48
|
+
brand_surface_muted_hover: "var(--uxf-color-brand-surface-muted-hover)",
|
|
49
|
+
brand_surface_subtle: "var(--uxf-color-brand-surface-subtle)",
|
|
50
|
+
brand_surface_subtle_hover: "var(--uxf-color-brand-surface-subtle-hover)",
|
|
51
|
+
info_border: "var(--uxf-color-info-border)",
|
|
52
|
+
info_icon: "var(--uxf-color-info-icon)",
|
|
53
|
+
info_icon_on_muted: "var(--uxf-color-info-icon-on-muted)",
|
|
54
|
+
info_text: "var(--uxf-color-info-text)",
|
|
55
|
+
info_text_on_muted: "var(--uxf-color-info-text-on-muted)",
|
|
56
|
+
info_surface_default: "var(--uxf-color-info-surface-default)",
|
|
57
|
+
info_surface_default_hover: "var(--uxf-color-info-surface-default-hover)",
|
|
58
|
+
info_surface_muted: "var(--uxf-color-info-surface-muted)",
|
|
59
|
+
info_surface_muted_hover: "var(--uxf-color-info-surface-muted-hover)",
|
|
60
|
+
info_surface_subtle: "var(--uxf-color-info-surface-subtle)",
|
|
61
|
+
info_surface_subtle_hover: "var(--uxf-color-info-surface-subtle-hover)",
|
|
62
|
+
inverted_border: "var(--uxf-color-inverted-border)",
|
|
63
|
+
inverted_icon: "var(--uxf-color-inverted-icon)",
|
|
64
|
+
inverted_icon_on_muted: "var(--uxf-color-inverted-icon-on-muted)",
|
|
65
|
+
inverted_text_default: "var(--uxf-color-inverted-text-default)",
|
|
66
|
+
inverted_text_disabled: "var(--uxf-color-inverted-text-disabled)",
|
|
67
|
+
inverted_text_muted: "var(--uxf-color-inverted-text-muted)",
|
|
68
|
+
inverted_text_on_muted: "var(--uxf-color-inverted-text-on-muted)",
|
|
69
|
+
negative_border: "var(--uxf-color-negative-border)",
|
|
70
|
+
negative_icon: "var(--uxf-color-negative-icon)",
|
|
71
|
+
negative_icon_on_muted: "var(--uxf-color-negative-icon-on-muted)",
|
|
72
|
+
negative_text: "var(--uxf-color-negative-text)",
|
|
73
|
+
negative_text_on_muted: "var(--uxf-color-negative-text-on-muted)",
|
|
74
|
+
negative_surface_default: "var(--uxf-color-negative-surface-default)",
|
|
75
|
+
negative_surface_default_hover: "var(--uxf-color-negative-surface-default-hover)",
|
|
76
|
+
negative_surface_muted: "var(--uxf-color-negative-surface-muted)",
|
|
77
|
+
negative_surface_muted_hover: "var(--uxf-color-negative-surface-muted-hover)",
|
|
78
|
+
negative_surface_subtle: "var(--uxf-color-negative-surface-subtle)",
|
|
79
|
+
negative_surface_subtle_hover: "var(--uxf-color-negative-surface-subtle-hover)",
|
|
80
|
+
neutral_border: "var(--uxf-color-neutral-border)",
|
|
81
|
+
neutral_icon: "var(--uxf-color-neutral-icon)",
|
|
82
|
+
neutral_icon_on_muted: "var(--uxf-color-neutral-icon-on-muted)",
|
|
83
|
+
neutral_text: "var(--uxf-color-neutral-text)",
|
|
84
|
+
neutral_text_on_muted: "var(--uxf-color-neutral-text-on-muted)",
|
|
85
|
+
neutral_surface_bolder: "var(--uxf-color-neutral-surface-bolder)",
|
|
86
|
+
neutral_surface_bolder_hover: "var(--uxf-color-neutral-surface-bolder-hover)",
|
|
87
|
+
neutral_surface_default: "var(--uxf-color-neutral-surface-default)",
|
|
88
|
+
neutral_surface_default_hover: "var(--uxf-color-neutral-surface-default-hover)",
|
|
89
|
+
neutral_surface_muted: "var(--uxf-color-neutral-surface-muted)",
|
|
90
|
+
neutral_surface_muted_hover: "var(--uxf-color-neutral-surface-muted-hover)",
|
|
91
|
+
neutral_surface_subtle: "var(--uxf-color-neutral-surface-subtle)",
|
|
92
|
+
neutral_surface_subtle_hover: "var(--uxf-color-neutral-surface-subtle-hover)",
|
|
93
|
+
positive_border: "var(--uxf-color-positive-border)",
|
|
94
|
+
positive_icon: "var(--uxf-color-positive-icon)",
|
|
95
|
+
positive_icon_on_muted: "var(--uxf-color-positive-icon-on-muted)",
|
|
96
|
+
positive_text: "var(--uxf-color-positive-text)",
|
|
97
|
+
positive_text_on_muted: "var(--uxf-color-positive-text-on-muted)",
|
|
98
|
+
positive_surface_default: "var(--uxf-color-positive-surface-default)",
|
|
99
|
+
positive_surface_default_hover: "var(--uxf-color-positive-surface-default-hover)",
|
|
100
|
+
positive_surface_muted: "var(--uxf-color-positive-surface-muted)",
|
|
101
|
+
positive_surface_muted_hover: "var(--uxf-color-positive-surface-muted-hover)",
|
|
102
|
+
positive_surface_subtle: "var(--uxf-color-positive-surface-subtle)",
|
|
103
|
+
positive_surface_subtle_hover: "var(--uxf-color-positive-surface-subtle-hover)",
|
|
104
|
+
warning_border: "var(--uxf-color-warning-border)",
|
|
105
|
+
warning_icon: "var(--uxf-color-warning-icon)",
|
|
106
|
+
warning_icon_on_muted: "var(--uxf-color-warning-icon-on-muted)",
|
|
107
|
+
warning_text: "var(--uxf-color-warning-text)",
|
|
108
|
+
warning_text_on_muted: "var(--uxf-color-warning-text-on-muted)",
|
|
109
|
+
warning_surface_default: "var(--uxf-color-warning-surface-default)",
|
|
110
|
+
warning_surface_default_hover: "var(--uxf-color-warning-surface-default-hover)",
|
|
111
|
+
warning_surface_muted: "var(--uxf-color-warning-surface-muted)",
|
|
112
|
+
warning_surface_muted_hover: "var(--uxf-color-warning-surface-muted-hover)",
|
|
113
|
+
warning_surface_subtle: "var(--uxf-color-warning-surface-subtle)",
|
|
114
|
+
warning_surface_subtle_hover: "var(--uxf-color-warning-surface-subtle-hover)",
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
module.exports = { figmaColors }
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const fs = require("fs");
|
|
3
|
+
const path = require("path");
|
|
4
|
+
|
|
5
|
+
// helper functions
|
|
6
|
+
|
|
7
|
+
function throwError(message) {
|
|
8
|
+
throw new Error(message);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function getOption(name) {
|
|
12
|
+
const args = process.argv.slice(2);
|
|
13
|
+
const optionArg = args.find((arg) => arg.startsWith(`--${name}=`));
|
|
14
|
+
|
|
15
|
+
if (optionArg) {
|
|
16
|
+
return optionArg.split("=")[1];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function indentLines(cssContent, indentCount) {
|
|
23
|
+
return cssContent
|
|
24
|
+
.split("\n")
|
|
25
|
+
.map((line) => line.trim())
|
|
26
|
+
.map((line) => " ".repeat(indentCount) + line)
|
|
27
|
+
.join("\n")
|
|
28
|
+
.trim();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// script
|
|
32
|
+
|
|
33
|
+
try {
|
|
34
|
+
const sourceDirectory =
|
|
35
|
+
getOption("source") ?? throwError('Argument --source="/path/to/source-directory" is required.');
|
|
36
|
+
const outputDirectory =
|
|
37
|
+
getOption("output") ?? throwError('Argument --output="/path/to/output-directory/" is required.');
|
|
38
|
+
|
|
39
|
+
const colorsLightFile = path.join(sourceDirectory, "colors-light.css");
|
|
40
|
+
const colorsDarkFile = path.join(sourceDirectory, "colors-dark.css");
|
|
41
|
+
const primitivesFile = path.join(sourceDirectory, "colors-primitives.css");
|
|
42
|
+
|
|
43
|
+
// Check if the necessary files exist
|
|
44
|
+
if (!fs.existsSync(colorsLightFile) || !fs.existsSync(colorsDarkFile) || !fs.existsSync(primitivesFile)) {
|
|
45
|
+
console.error("Error: One or more required CSS files are missing in the source directory.");
|
|
46
|
+
console.error("Ensure the following files are present in the source directory:");
|
|
47
|
+
console.error(" - colors-light.css");
|
|
48
|
+
console.error(" - colors-dark.css");
|
|
49
|
+
console.error(" - colors-primitives.css");
|
|
50
|
+
process.exit(1);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (!fs.existsSync(outputDirectory)) {
|
|
54
|
+
fs.mkdirSync(outputDirectory, { recursive: true });
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const removeComments = (cssContent) => {
|
|
58
|
+
return cssContent.replace(/\/\*[\s\S]*?\*\//g, "").trim();
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const primitives = removeComments(fs.readFileSync(primitivesFile, "utf-8"));
|
|
62
|
+
const colorsLight = removeComments(fs.readFileSync(colorsLightFile, "utf-8"));
|
|
63
|
+
const colorsDark = removeComments(fs.readFileSync(colorsDarkFile, "utf-8"));
|
|
64
|
+
|
|
65
|
+
const UXF_PREFIX = "--uxf-color-";
|
|
66
|
+
const ROOT_REGEXP = /:root\s*{\s*|}\s*$/g;
|
|
67
|
+
const PREFIX_REGEXP = /^\s*--/gm;
|
|
68
|
+
|
|
69
|
+
const cleanedPrimitives = primitives.replace(ROOT_REGEXP, "");
|
|
70
|
+
const cleanedColorsLight = colorsLight.replace(ROOT_REGEXP, "").replace(PREFIX_REGEXP, "" + UXF_PREFIX);
|
|
71
|
+
const cleanedColorsDark = colorsDark.replace(ROOT_REGEXP, "").replace(PREFIX_REGEXP, "" + UXF_PREFIX);
|
|
72
|
+
|
|
73
|
+
const mergedTokens = `/* this file is generated automatically, do not change anything manually in the contents of this file */
|
|
74
|
+
:root {
|
|
75
|
+
${indentLines(cleanedPrimitives, 4)}
|
|
76
|
+
|
|
77
|
+
${indentLines(cleanedColorsLight, 4)}
|
|
78
|
+
|
|
79
|
+
.dark {
|
|
80
|
+
${indentLines(cleanedColorsDark, 8)}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
`;
|
|
84
|
+
|
|
85
|
+
fs.writeFileSync(path.join(outputDirectory, "figma-colors.css"), mergedTokens, "utf-8");
|
|
86
|
+
|
|
87
|
+
const extractVariables = (cssContent) => {
|
|
88
|
+
const variableRegex = /(--[a-zA-Z0-9-]+):/g;
|
|
89
|
+
return [...cssContent.matchAll(variableRegex)].map((match) => match[1]);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const lightVariables = extractVariables(colorsLight);
|
|
93
|
+
|
|
94
|
+
const tailwindConfig = lightVariables.reduce((config, variable) => {
|
|
95
|
+
const variableWithPrefix = variable.replace(/--/g, UXF_PREFIX);
|
|
96
|
+
const tailwindKey = variable.replace("--", "").replace(/-/g, "_");
|
|
97
|
+
config[tailwindKey] = `var(${variableWithPrefix})`;
|
|
98
|
+
return config;
|
|
99
|
+
}, {});
|
|
100
|
+
|
|
101
|
+
const tailwindConfigString = `const figmaColors = {
|
|
102
|
+
${Object.entries(tailwindConfig)
|
|
103
|
+
.map(([key, value]) => ` ${key}: "${value}",`)
|
|
104
|
+
.join("\n")}
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
module.exports = { figmaColors }
|
|
109
|
+
`;
|
|
110
|
+
|
|
111
|
+
fs.writeFileSync(path.join(outputDirectory, "figma-colors.js"), tailwindConfigString, "utf-8");
|
|
112
|
+
|
|
113
|
+
console.log(`CSS tokens and Tailwind config colors generated successfully in ${outputDirectory} folder!`);
|
|
114
|
+
} catch (e) {
|
|
115
|
+
console.error(e.message);
|
|
116
|
+
}
|
package/button/README.md
CHANGED
package/button/button.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { UseAnchorProps } from "@uxf/core-react/hooks/use-anchor-props";
|
|
2
2
|
import { ButtonColors, ButtonSizes, ButtonVariants } from "@uxf/ui/button/theme";
|
|
3
3
|
import React, { AnchorHTMLAttributes } from "react";
|
|
4
|
-
import { NextLink } from "
|
|
4
|
+
import { NextLink } from "../utils/next-link";
|
|
5
5
|
export type ButtonVariant = keyof ButtonVariants;
|
|
6
6
|
export type ButtonSize = keyof ButtonSizes;
|
|
7
7
|
export type ButtonColor = keyof ButtonColors;
|
|
@@ -9,6 +9,7 @@ export interface ButtonProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement
|
|
|
9
9
|
as?: NextLink | "a";
|
|
10
10
|
color?: ButtonColor;
|
|
11
11
|
isFullWidth?: boolean;
|
|
12
|
+
/** @deprecated use IconButton component instead */
|
|
12
13
|
isIconButton?: boolean;
|
|
13
14
|
size?: ButtonSize;
|
|
14
15
|
variant?: ButtonVariant;
|
package/button/button.stories.js
CHANGED
|
@@ -47,7 +47,7 @@ function Basic() {
|
|
|
47
47
|
"variant=",
|
|
48
48
|
variant))),
|
|
49
49
|
react_1.default.createElement("div", null),
|
|
50
|
-
config.variants.flatMap((variant) => config.sizes.map((size) => (react_1.default.createElement("div", { className: "text-center text-xs text-gray-400", key: variant },
|
|
50
|
+
config.variants.flatMap((variant) => config.sizes.map((size) => (react_1.default.createElement("div", { className: "text-center text-xs text-gray-400", key: `${variant}${size}` },
|
|
51
51
|
"size=",
|
|
52
52
|
size))))),
|
|
53
53
|
config.colors.map((color) => (react_1.default.createElement("div", { className: color === "inverted" ? "min-w-fit bg-[#1F2A37] dark:bg-white" : undefined, key: color },
|
|
@@ -36,12 +36,13 @@ const use_dropdown_1 = require("../hooks/use-dropdown");
|
|
|
36
36
|
const icon_1 = require("../icon");
|
|
37
37
|
const MenuButton = (0, react_3.forwardRef)((props, ref) => {
|
|
38
38
|
// eslint-disable-next-line react/destructuring-assignment,@typescript-eslint/no-unused-vars
|
|
39
|
-
const { variant, color, isIconButton, isFullWidth, size, icon, label, className, ...restProps } = props;
|
|
39
|
+
const { as = "a", variant, color, isIconButton, isFullWidth, size, icon, label, className, ...restProps } = props;
|
|
40
|
+
const Component = as;
|
|
40
41
|
const anchorProps = (0, use_anchor_props_1.useAnchorProps)({
|
|
41
42
|
...restProps,
|
|
42
43
|
className: (0, cx_1.cx)("uxf-button-list__menu-button", `uxf-button-list__menu-button--color-${color !== null && color !== void 0 ? color : "default"}`, `uxf-button-list__menu-button--variant-${variant !== null && variant !== void 0 ? variant : "default"}`, className),
|
|
43
44
|
});
|
|
44
|
-
return (react_3.default.createElement(
|
|
45
|
+
return (react_3.default.createElement(Component, { ref: ref, ...anchorProps },
|
|
45
46
|
icon && react_3.default.createElement(icon_1.Icon, { className: "uxf-button-list__menu-button-icon", name: icon }),
|
|
46
47
|
label && react_3.default.createElement("span", { className: "uxf-button-list__menu-button-label" }, label)));
|
|
47
48
|
});
|
package/chip/chip.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { UseAnchorProps } from "@uxf/core-react/hooks/use-anchor-props";
|
|
2
2
|
import { ChipColor, ChipSize, ChipVariant } from "@uxf/ui/chip/theme";
|
|
3
3
|
import React, { AnchorHTMLAttributes, MouseEventHandler } from "react";
|
|
4
|
+
import { NextLink } from "../utils/next-link";
|
|
4
5
|
export interface ChipProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "color" | "type">, UseAnchorProps {
|
|
6
|
+
as?: NextLink | "a";
|
|
5
7
|
color?: ChipColor;
|
|
6
8
|
onClose?: MouseEventHandler;
|
|
7
9
|
size?: ChipSize;
|
package/chip/chip.js
CHANGED
|
@@ -42,14 +42,15 @@ const CloseButton = (props) => {
|
|
|
42
42
|
};
|
|
43
43
|
exports.Chip = (0, react_1.forwardRef)((props, ref) => {
|
|
44
44
|
var _a, _b, _c;
|
|
45
|
-
const { children, className, onClose, suppressFocus, tabIndex, ...restProps } = props;
|
|
45
|
+
const { as = "a", children, className, onClose, suppressFocus, tabIndex, ...restProps } = props;
|
|
46
46
|
const chipClassName = (0, cx_1.cx)("uxf-chip", `uxf-chip--color-${(_a = props.color) !== null && _a !== void 0 ? _a : "default"}`, `uxf-chip--size-${(_b = props.size) !== null && _b !== void 0 ? _b : "default"}`, `uxf-chip--variant-${(_c = props.variant) !== null && _c !== void 0 ? _c : "default"}`, (0, is_not_nil_1.isNotNil)(onClose) && "has-button", className);
|
|
47
|
+
const Component = as;
|
|
47
48
|
const anchorProps = (0, use_anchor_props_1.useAnchorProps)({
|
|
48
49
|
className: (0, cx_1.cx)(chipClassName),
|
|
49
50
|
tabIndex: suppressFocus ? -1 : tabIndex,
|
|
50
51
|
...restProps,
|
|
51
52
|
});
|
|
52
|
-
return (react_1.default.createElement(
|
|
53
|
+
return (react_1.default.createElement(Component, { ref: ref, ...anchorProps },
|
|
53
54
|
typeof children === "string" ? react_1.default.createElement("span", { className: "uxf-chip__text" }, children) : children,
|
|
54
55
|
(0, is_not_nil_1.isNotNil)(onClose) && react_1.default.createElement(CloseButton, { onClose: onClose })));
|
|
55
56
|
});
|
package/components.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ import * as fileInputStories from "./file-input/file-input.stories";
|
|
|
27
27
|
import * as flashMessagesStories from "./flash-messages/flash-messages.stories";
|
|
28
28
|
import * as formComponentStories from "./form-component/form-component.stories";
|
|
29
29
|
import * as iconStories from "./icon/icon.stories";
|
|
30
|
+
import * as iconButtonStories from "./icon-button/icon-button.stories";
|
|
30
31
|
import * as imageGalleryStories from "./image-gallery/image-gallery.stories";
|
|
31
32
|
import * as inputStories from "./input/input.stories";
|
|
32
33
|
import * as labelStories from "./label/label.stories";
|
|
@@ -172,6 +173,10 @@ export declare const components: {
|
|
|
172
173
|
readonly title: "Icon";
|
|
173
174
|
readonly stories: typeof iconStories;
|
|
174
175
|
};
|
|
176
|
+
readonly "icon-button": {
|
|
177
|
+
readonly title: "IconButton";
|
|
178
|
+
readonly stories: typeof iconButtonStories;
|
|
179
|
+
};
|
|
175
180
|
readonly "image-gallery": {
|
|
176
181
|
readonly title: "ImageGallery";
|
|
177
182
|
readonly stories: typeof imageGalleryStories;
|
package/components.js
CHANGED
|
@@ -54,6 +54,7 @@ const fileInputStories = __importStar(require("./file-input/file-input.stories")
|
|
|
54
54
|
const flashMessagesStories = __importStar(require("./flash-messages/flash-messages.stories"));
|
|
55
55
|
const formComponentStories = __importStar(require("./form-component/form-component.stories"));
|
|
56
56
|
const iconStories = __importStar(require("./icon/icon.stories"));
|
|
57
|
+
const iconButtonStories = __importStar(require("./icon-button/icon-button.stories"));
|
|
57
58
|
const imageGalleryStories = __importStar(require("./image-gallery/image-gallery.stories"));
|
|
58
59
|
const inputStories = __importStar(require("./input/input.stories"));
|
|
59
60
|
const labelStories = __importStar(require("./label/label.stories"));
|
|
@@ -199,6 +200,10 @@ exports.components = {
|
|
|
199
200
|
title: "Icon",
|
|
200
201
|
stories: iconStories
|
|
201
202
|
},
|
|
203
|
+
"icon-button": {
|
|
204
|
+
title: "IconButton",
|
|
205
|
+
stories: iconButtonStories
|
|
206
|
+
},
|
|
202
207
|
"image-gallery": {
|
|
203
208
|
title: "ImageGallery",
|
|
204
209
|
stories: imageGalleryStories
|
package/css/badge.css
CHANGED
package/css/button.css
CHANGED
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
width: 100%;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
/* Deprecated class, replaced with .uxf-icon-button class. Should be removed, when it will be possible */
|
|
60
61
|
&--icon-button {
|
|
61
62
|
flex-shrink: 0;
|
|
62
63
|
padding: 0;
|
|
@@ -87,6 +88,7 @@
|
|
|
87
88
|
width: var(--uxf-button-loading-size);
|
|
88
89
|
}
|
|
89
90
|
|
|
91
|
+
/* Deprecated class, replaced with .uxf-icon-button class. Should be removed, when it will be possible */
|
|
90
92
|
&.uxf-button--icon-button::after {
|
|
91
93
|
margin-left: 0;
|
|
92
94
|
}
|
|
@@ -126,137 +128,137 @@
|
|
|
126
128
|
/* VARIANTS */
|
|
127
129
|
|
|
128
130
|
&--variant-default {
|
|
129
|
-
--uxf-button-text-color:
|
|
131
|
+
--uxf-button-text-color: theme("colors.base_text_inverted_high_emphasis");
|
|
130
132
|
|
|
131
133
|
&.uxf-button--color-default {
|
|
132
|
-
--uxf-button-background-color:
|
|
133
|
-
--uxf-button-background-color-hover:
|
|
134
|
+
--uxf-button-background-color: theme("colors.primary_surface_default");
|
|
135
|
+
--uxf-button-background-color-hover: theme("colors.primary_surface_default_hover");
|
|
134
136
|
}
|
|
135
137
|
|
|
136
138
|
&.uxf-button--color-positive {
|
|
137
|
-
--uxf-button-background-color:
|
|
138
|
-
--uxf-button-background-color-hover:
|
|
139
|
+
--uxf-button-background-color: theme("colors.positive_surface_default");
|
|
140
|
+
--uxf-button-background-color-hover: theme("colors.positive_surface_default_hover");
|
|
139
141
|
}
|
|
140
142
|
|
|
141
143
|
&.uxf-button--color-negative {
|
|
142
|
-
--uxf-button-background-color:
|
|
143
|
-
--uxf-button-background-color-hover:
|
|
144
|
+
--uxf-button-background-color: theme("colors.negative_surface_default");
|
|
145
|
+
--uxf-button-background-color-hover: theme("colors.negative_surface_default_hover");
|
|
144
146
|
}
|
|
145
147
|
|
|
146
148
|
&.uxf-button--color-warning {
|
|
147
|
-
--uxf-button-background-color:
|
|
148
|
-
--uxf-button-background-color-hover:
|
|
149
|
+
--uxf-button-background-color: theme("colors.warning_surface_default");
|
|
150
|
+
--uxf-button-background-color-hover: theme("colors.warning_surface_default_hover");
|
|
149
151
|
}
|
|
150
152
|
|
|
151
153
|
&.uxf-button--color-info {
|
|
152
|
-
--uxf-button-background-color:
|
|
153
|
-
--uxf-button-background-color-hover:
|
|
154
|
+
--uxf-button-background-color: theme("colors.info_surface_default");
|
|
155
|
+
--uxf-button-background-color-hover: theme("colors.info_surface_default_hover");
|
|
154
156
|
}
|
|
155
157
|
|
|
156
158
|
&.uxf-button--color-inverted {
|
|
157
|
-
--uxf-button-background-color:
|
|
158
|
-
--uxf-button-background-color-hover:
|
|
159
|
-
--uxf-button-text-color:
|
|
159
|
+
--uxf-button-background-color: theme("colors.base_surface_main");
|
|
160
|
+
--uxf-button-background-color-hover: theme("colors.base_surface_main_hover");
|
|
161
|
+
--uxf-button-text-color: theme("colors.base_text_high_emphasis");
|
|
160
162
|
|
|
161
163
|
&.is-disabled {
|
|
162
|
-
--uxf-button-background-color:
|
|
163
|
-
--uxf-button-text-color:
|
|
164
|
+
--uxf-button-background-color: theme("colors.base_surface_input_disabled");
|
|
165
|
+
--uxf-button-text-color: theme("colors.base_text_disabled");
|
|
164
166
|
}
|
|
165
167
|
}
|
|
166
168
|
|
|
167
169
|
&.uxf-button--is-disabled {
|
|
168
170
|
--uxf-button-text-color: theme("colors.white");
|
|
169
|
-
--uxf-button-background-color:
|
|
171
|
+
--uxf-button-background-color: theme("colors.base_surface_disabled");
|
|
170
172
|
}
|
|
171
173
|
}
|
|
172
174
|
|
|
173
175
|
&--variant-secondary {
|
|
174
|
-
--uxf-button-background-color-hover:
|
|
175
|
-
--uxf-button-background-color:
|
|
176
|
+
--uxf-button-background-color-hover: theme("colors.base_surface_main_hover");
|
|
177
|
+
--uxf-button-background-color: theme("colors.base_surface_main");
|
|
176
178
|
|
|
177
179
|
border-style: solid;
|
|
178
180
|
border-width: 1px;
|
|
179
181
|
|
|
180
182
|
&.uxf-button--color-default {
|
|
181
|
-
--uxf-button-border-color:
|
|
182
|
-
--uxf-button-text-color:
|
|
183
|
+
--uxf-button-border-color: theme("colors.base_border_input");
|
|
184
|
+
--uxf-button-text-color: theme("colors.base_text_high_emphasis");
|
|
183
185
|
}
|
|
184
186
|
|
|
185
187
|
&.uxf-button--color-positive {
|
|
186
|
-
--uxf-button-border-color:
|
|
187
|
-
--uxf-button-text-color:
|
|
188
|
+
--uxf-button-border-color: theme("colors.positive_border");
|
|
189
|
+
--uxf-button-text-color: theme("colors.positive_text");
|
|
188
190
|
}
|
|
189
191
|
|
|
190
192
|
&.uxf-button--color-negative {
|
|
191
|
-
--uxf-button-border-color:
|
|
192
|
-
--uxf-button-text-color:
|
|
193
|
+
--uxf-button-border-color: theme("colors.negative_border");
|
|
194
|
+
--uxf-button-text-color: theme("colors.negative_text");
|
|
193
195
|
}
|
|
194
196
|
|
|
195
197
|
&.uxf-button--color-warning {
|
|
196
|
-
--uxf-button-border-color:
|
|
197
|
-
--uxf-button-text-color:
|
|
198
|
+
--uxf-button-border-color: theme("colors.warning_border");
|
|
199
|
+
--uxf-button-text-color: theme("colors.warning_text");
|
|
198
200
|
}
|
|
199
201
|
|
|
200
202
|
&.uxf-button--color-info {
|
|
201
|
-
--uxf-button-border-color:
|
|
202
|
-
--uxf-button-text-color:
|
|
203
|
+
--uxf-button-border-color: theme("colors.info_border");
|
|
204
|
+
--uxf-button-text-color: theme("colors.info_text");
|
|
203
205
|
}
|
|
204
206
|
|
|
205
207
|
&.uxf-button--color-inverted {
|
|
206
|
-
--uxf-button-border-color:
|
|
207
|
-
--uxf-button-text-color:
|
|
208
|
-
--uxf-button-background-color:
|
|
209
|
-
--uxf-button-background-color-hover:
|
|
208
|
+
--uxf-button-border-color: theme("colors.base_border_inverted_border");
|
|
209
|
+
--uxf-button-text-color: theme("colors.base_text_inverted_high_emphasis");
|
|
210
|
+
--uxf-button-background-color: theme("colors.base_surface_inverted_main");
|
|
211
|
+
--uxf-button-background-color-hover: theme("colors.base_surface_inverted_main_hover");
|
|
210
212
|
|
|
211
213
|
&.uxf-button--is-disabled {
|
|
212
|
-
--uxf-button-text-color:
|
|
213
|
-
--uxf-button-background-color:
|
|
214
|
+
--uxf-button-text-color: theme("colors.base_text_inverted_disabled");
|
|
215
|
+
--uxf-button-background-color: theme("colors.base_surface_inverted_main");
|
|
214
216
|
}
|
|
215
217
|
}
|
|
216
218
|
|
|
217
219
|
&.uxf-button--is-disabled {
|
|
218
|
-
--uxf-button-border-color:
|
|
219
|
-
--uxf-button-text-color:
|
|
220
|
-
--uxf-button-background-color:
|
|
220
|
+
--uxf-button-border-color: theme("colors.base_border_input");
|
|
221
|
+
--uxf-button-text-color: theme("colors.base_text_disabled");
|
|
222
|
+
--uxf-button-background-color: theme("colors.base_surface_input_disabled");
|
|
221
223
|
}
|
|
222
224
|
}
|
|
223
225
|
|
|
224
226
|
&--variant-text {
|
|
225
|
-
--uxf-button-background-color-hover:
|
|
227
|
+
--uxf-button-background-color-hover: theme("colors.base_surface_main_hover");
|
|
226
228
|
|
|
227
229
|
box-shadow: none;
|
|
228
230
|
|
|
229
231
|
&.uxf-button--color-default {
|
|
230
|
-
--uxf-button-text-color:
|
|
232
|
+
--uxf-button-text-color: theme("colors.base_text_high_emphasis");
|
|
231
233
|
}
|
|
232
234
|
|
|
233
235
|
&.uxf-button--color-positive {
|
|
234
|
-
--uxf-button-text-color:
|
|
236
|
+
--uxf-button-text-color: theme("colors.positive_text");
|
|
235
237
|
}
|
|
236
238
|
|
|
237
239
|
&.uxf-button--color-negative {
|
|
238
|
-
--uxf-button-text-color:
|
|
240
|
+
--uxf-button-text-color: theme("colors.negative_text");
|
|
239
241
|
}
|
|
240
242
|
|
|
241
243
|
&.uxf-button--color-warning {
|
|
242
|
-
--uxf-button-text-color:
|
|
244
|
+
--uxf-button-text-color: theme("colors.warning_text");
|
|
243
245
|
}
|
|
244
246
|
|
|
245
247
|
&.uxf-button--color-info {
|
|
246
|
-
--uxf-button-text-color:
|
|
248
|
+
--uxf-button-text-color: theme("colors.info_text");
|
|
247
249
|
}
|
|
248
250
|
|
|
249
251
|
&.uxf-button--color-inverted {
|
|
250
|
-
--uxf-button-text-color:
|
|
251
|
-
--uxf-button-background-color-hover:
|
|
252
|
+
--uxf-button-text-color: theme("colors.base_text_inverted_high_emphasis");
|
|
253
|
+
--uxf-button-background-color-hover: theme("colors.base_surface_inverted_main_hover");
|
|
252
254
|
|
|
253
255
|
&.uxf-button--is-disabled {
|
|
254
|
-
--uxf-button-text-color:
|
|
256
|
+
--uxf-button-text-color: theme("colors.base_text_inverted_disabled");
|
|
255
257
|
}
|
|
256
258
|
}
|
|
257
259
|
|
|
258
260
|
&.uxf-button--is-disabled {
|
|
259
|
-
--uxf-button-text-color:
|
|
261
|
+
--uxf-button-text-color: theme("colors.base_text_disabled");
|
|
260
262
|
}
|
|
261
263
|
}
|
|
262
264
|
}
|