@macive/ui 0.0.8 → 0.0.10
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/dist/css/Text.css +8 -0
- package/dist/src/components/Text/Text.classnames.js +47 -46
- package/dist/src/components/Text/Text.js +3 -3
- package/dist/src/utilities/components.js +5 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/src/components/Scrollable/Scrollable.d.ts +1 -1
- package/dist/types/src/components/Text/Text.classnames.d.ts +5 -4
- package/dist/types/src/components/Text/Text.classnames.d.ts.map +1 -1
- package/dist/types/src/components/Text/Text.d.ts +2 -1
- package/dist/types/src/components/Text/Text.d.ts.map +1 -1
- package/dist/types/src/utilities/components.d.ts +3 -1
- package/dist/types/src/utilities/components.d.ts.map +1 -1
- package/dist/ui.min.css +1 -1
- package/package.json +1 -1
package/dist/css/Text.css
CHANGED
|
@@ -273,4 +273,12 @@
|
|
|
273
273
|
|
|
274
274
|
.Text-line-through {
|
|
275
275
|
text-decoration-line: line-through;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.Text-clamp-text {
|
|
279
|
+
display: -webkit-box;
|
|
280
|
+
-webkit-box-orient: vertical;
|
|
281
|
+
overflow: hidden;
|
|
282
|
+
-webkit-line-clamp: var(--lines);
|
|
283
|
+
line-clamp: var(--lines);
|
|
276
284
|
}
|
|
@@ -1,51 +1,52 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const TextClassnames = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
4
|
+
root: 'Text-root',
|
|
5
|
+
block: 'Text-block',
|
|
6
|
+
truncate: 'Text-truncate',
|
|
7
|
+
visuallyHidden: 'Text-visuallyHidden',
|
|
8
|
+
start: 'Text-start',
|
|
9
|
+
center: 'Text-center',
|
|
10
|
+
end: 'Text-end',
|
|
11
|
+
justify: 'Text-justify',
|
|
12
|
+
text: 'Text-text',
|
|
13
|
+
link: 'Text-link',
|
|
14
|
+
brand: 'Text-brand',
|
|
15
|
+
success: 'Text-success',
|
|
16
|
+
critical: 'Text-critical',
|
|
17
|
+
warning: 'Text-warning',
|
|
18
|
+
accent: 'Text-accent',
|
|
19
|
+
muted: 'Text-muted',
|
|
20
|
+
subdued: 'Text-subdued',
|
|
21
|
+
'text-inverse': 'Text-text-inverse',
|
|
22
|
+
heading: 'Text-heading',
|
|
23
|
+
bodyXs: 'Text-bodyXs',
|
|
24
|
+
tiny: 'Text-tiny',
|
|
25
|
+
headingXs: 'Text-headingXs',
|
|
26
|
+
headingSm: 'Text-headingSm',
|
|
27
|
+
headingMd: 'Text-headingMd',
|
|
28
|
+
headingLg: 'Text-headingLg',
|
|
29
|
+
headingXl: 'Text-headingXl',
|
|
30
|
+
heading2xl: 'Text-heading2xl',
|
|
31
|
+
heading3xl: 'Text-heading3xl',
|
|
32
|
+
heading4xl: 'Text-heading4xl',
|
|
33
|
+
bodySm: 'Text-bodySm',
|
|
34
|
+
bodyMd: 'Text-bodyMd',
|
|
35
|
+
bodyLg: 'Text-bodyLg',
|
|
36
|
+
regular: 'Text-regular',
|
|
37
|
+
medium: 'Text-medium',
|
|
38
|
+
semibold: 'Text-semibold',
|
|
39
|
+
bold: 'Text-bold',
|
|
40
|
+
break: 'Text-break',
|
|
41
|
+
numeric: 'Text-numeric',
|
|
42
|
+
base: 'Text-base',
|
|
43
|
+
inherit: 'Text-inherit',
|
|
44
|
+
disabled: 'Text-disabled',
|
|
45
|
+
caution: 'Text-caution',
|
|
46
|
+
magic: 'Text-magic',
|
|
47
|
+
'magic-subdued': 'Text-magic-subdued',
|
|
48
|
+
'text-inverse-secondary': 'Text-text-inverse-secondary',
|
|
49
|
+
'line-through': 'Text-line-through',
|
|
50
|
+
'clamp-text': 'Text-clamp-text',
|
|
50
51
|
};
|
|
51
52
|
exports.default = TextClassnames;
|
|
@@ -10,7 +10,7 @@ const Text_classnames_1 = __importDefault(require("./Text.classnames"));
|
|
|
10
10
|
const deprecatedVariants = {
|
|
11
11
|
heading3xl: 'heading2xl',
|
|
12
12
|
};
|
|
13
|
-
const Text = ({ alignment, as, breakWord, children, tone, fontWeight, id, numeric = false, truncate = false, variant, visuallyHidden = false, textDecorationLine, }) => {
|
|
13
|
+
const Text = ({ alignment, as, breakWord, children, tone, fontWeight, id, numeric = false, truncate = false, variant, visuallyHidden = false, textDecorationLine, color, lines, }) => {
|
|
14
14
|
if (process.env.NODE_ENV === 'development' &&
|
|
15
15
|
variant &&
|
|
16
16
|
Object.prototype.hasOwnProperty.call(deprecatedVariants, variant)) {
|
|
@@ -18,7 +18,7 @@ const Text = ({ alignment, as, breakWord, children, tone, fontWeight, id, numeri
|
|
|
18
18
|
console.warn(`Deprecation: <Text variant="${variant}" />. The value "${variant}" will be removed in a future major version of Polaris. Use "${deprecatedVariants[variant]}" instead.`);
|
|
19
19
|
}
|
|
20
20
|
const Component = as || (visuallyHidden ? 'span' : 'p');
|
|
21
|
-
const className = (0, css_1.classNames)(Text_classnames_1.default.root, variant && Text_classnames_1.default[variant], fontWeight && Text_classnames_1.default[fontWeight], (alignment || truncate) && Text_classnames_1.default.block, alignment && Text_classnames_1.default[alignment], breakWord && Text_classnames_1.default.break, tone && Text_classnames_1.default[tone], numeric && Text_classnames_1.default.numeric, truncate && Text_classnames_1.default.truncate, visuallyHidden && Text_classnames_1.default.visuallyHidden, textDecorationLine && Text_classnames_1.default[textDecorationLine]);
|
|
22
|
-
return ((0, jsx_runtime_1.jsx)(Component, { className: className, ...(id && { id }), children: children }));
|
|
21
|
+
const className = (0, css_1.classNames)(Text_classnames_1.default.root, variant && Text_classnames_1.default[variant], fontWeight && Text_classnames_1.default[fontWeight], (alignment || truncate) && Text_classnames_1.default.block, alignment && Text_classnames_1.default[alignment], breakWord && Text_classnames_1.default.break, tone && Text_classnames_1.default[tone], numeric && Text_classnames_1.default.numeric, truncate && Text_classnames_1.default.truncate, visuallyHidden && Text_classnames_1.default.visuallyHidden, textDecorationLine && Text_classnames_1.default[textDecorationLine], color && Text_classnames_1.default[color], lines && Text_classnames_1.default['clamp-text']);
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)(Component, { className: className, ...(id && { id }), style: { ...(lines && { '--lines': lines }) }, children: children }));
|
|
23
23
|
};
|
|
24
24
|
exports.Text = Text;
|
|
@@ -10,7 +10,9 @@ function wrapWithComponent(element, Component, props) {
|
|
|
10
10
|
if (element == null) {
|
|
11
11
|
return null;
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
// Separate the `key` prop from other props
|
|
14
|
+
const { key, ...restProps } = props;
|
|
15
|
+
return isElementOfType(element, Component) ? (element) : ((0, jsx_runtime_1.jsx)(Component, { ...restProps, children: element }, key));
|
|
14
16
|
}
|
|
15
17
|
exports.wrapWithComponent = wrapWithComponent;
|
|
16
18
|
// In development, we compare based on the name of the function because
|
|
@@ -21,14 +23,14 @@ const isComponent = process.env.NODE_ENV === 'development'
|
|
|
21
23
|
: (AComponent, AnotherComponent) => AComponent === AnotherComponent;
|
|
22
24
|
// Checks whether `element` is a React element of type `Component` (or one of
|
|
23
25
|
// the passed components, if `Component` is an array of React components).
|
|
26
|
+
// Checks whether `element` is a React element of type `Component` (or one of
|
|
27
|
+
// the passed components, if `Component` is an array of React components).
|
|
24
28
|
function isElementOfType(element, Component) {
|
|
25
29
|
var _a;
|
|
26
30
|
if (element == null || !(0, react_1.isValidElement)(element) || typeof element.type === 'string') {
|
|
27
31
|
return false;
|
|
28
32
|
}
|
|
29
33
|
const { type: defaultType } = element;
|
|
30
|
-
// Type override allows components to bypass default wrapping behavior. Ex: Stack, ResourceList...
|
|
31
|
-
// See https://github.com/Airsoko/app-extension-libs/issues/996#issuecomment-710437088
|
|
32
34
|
const overrideType = (_a = element.props) === null || _a === void 0 ? void 0 : _a.__type__;
|
|
33
35
|
const type = overrideType || defaultType;
|
|
34
36
|
const Components = Array.isArray(Component) ? Component : [Component];
|