@macive/ui 0.0.9 → 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 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
- "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"
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;
@@ -37,21 +37,6 @@ function isElementOfType(element, Component) {
37
37
  return Components.some((AComponent) => typeof type !== 'string' && isComponent(AComponent, type));
38
38
  }
39
39
  exports.isElementOfType = isElementOfType;
40
- // export function isElementOfType<TProps>(
41
- // element: React.ReactNode | null | undefined,
42
- // Component: React.ComponentType<TProps> | React.ComponentType<TProps>[],
43
- // ): boolean {
44
- // if (element == null || !isValidElement(element) || typeof element.type === 'string') {
45
- // return false
46
- // }
47
- // const { type: defaultType } = element
48
- // // Type override allows components to bypass default wrapping behavior. Ex: Stack, ResourceList...
49
- // // See https://github.com/Airsoko/app-extension-libs/issues/996#issuecomment-710437088
50
- // const overrideType = element.props?.__type__
51
- // const type = overrideType || defaultType
52
- // const Components = Array.isArray(Component) ? Component : [Component]
53
- // return Components.some((AComponent) => typeof type !== 'string' && isComponent(AComponent, type))
54
- // }
55
40
  // Returns all children that are valid elements as an array. Can optionally be
56
41
  // filtered by passing `predicate`.
57
42
  function elementChildren(children, predicate = () => true) {