@lumx/core 3.20.1-alpha.8 → 3.21.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/package.json CHANGED
@@ -6,7 +6,6 @@
6
6
  "url": "https://github.com/lumapps/design-system/issues"
7
7
  },
8
8
  "dependencies": {
9
- "@lumx/icons": "3.19.0",
10
9
  "classnames": "^2.3.2",
11
10
  "focus-visible": "^5.0.2",
12
11
  "lodash": "4.17.21",
@@ -34,7 +33,7 @@
34
33
  "update-version-changelog": "yarn version-changelog ../../CHANGELOG.md"
35
34
  },
36
35
  "sideEffects": false,
37
- "version": "3.20.1-alpha.8",
36
+ "version": "3.21.0",
38
37
  "devDependencies": {
39
38
  "@rollup/plugin-commonjs": "^19.0.2",
40
39
  "@rollup/plugin-terser": "^0.4.4",
@@ -104,7 +104,9 @@
104
104
  }
105
105
 
106
106
  &__input-native {
107
- #{$self}--theme-light & {
107
+ resize: none;
108
+
109
+ #{$self}--theme-light &, &--theme-light {
108
110
  @include lumx-text-field-input-native(lumx-base-const("theme", "LIGHT"));
109
111
  @include lumx-text-field-input-content-color(
110
112
  lumx-base-const("state", "DEFAULT"),
@@ -119,7 +121,7 @@
119
121
  }
120
122
  }
121
123
 
122
- #{$self}--theme-dark & {
124
+ #{$self}--theme-dark &, &--theme-dark {
123
125
  @include lumx-text-field-input-native(lumx-base-const("theme", "DARK"));
124
126
  @include lumx-text-field-input-content-color(
125
127
  lumx-base-const("state", "DEFAULT"),
@@ -140,10 +142,6 @@
140
142
  min-width: $lumx-text-field-min-width;
141
143
  line-height: var(--lumx-material-chip-size-s-height);
142
144
  }
143
-
144
- &--textarea {
145
- resize: none;
146
- }
147
145
  }
148
146
 
149
147
  &__input-clear,
@@ -1,136 +0,0 @@
1
- import classNames from 'classnames';
2
-
3
- import { mdiAlertCircle } from '@lumx/icons';
4
-
5
- import { GenericProps, HasTheme } from '../../types';
6
- import { getRootClassName, handleBasicClasses, resolveColorWithVariants } from '../../utils/className';
7
- import { ColorPalette, ColorVariant, ColorWithVariants, Size, Theme } from '../../constants';
8
- import { InputHelper } from '../InputHelper';
9
-
10
- export type IconSizes = Extract<Size, 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl'>;
11
-
12
- /**
13
- * Defines the props of the component.
14
- */
15
- export interface IconProps extends GenericProps, HasTheme {
16
- /** Color variant. */
17
- color?: ColorWithVariants;
18
- /** Lightened or darkened variant of the selected icon color. */
19
- colorVariant?: ColorVariant;
20
- /** Whether the icon has a shape. */
21
- hasShape?: boolean;
22
- /**
23
- * Icon (SVG path) draw code (`d` property of the `<path>` SVG element).
24
- * See https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths
25
- */
26
- icon: string;
27
- /** Size variant. */
28
- size?: IconSizes;
29
- /** Sets an alternative text on the svg. Will set an `img` role to the svg. */
30
- alt?: string;
31
- }
32
-
33
- /**
34
- * Component display name.
35
- */
36
- const COMPONENT_NAME = 'Icon';
37
-
38
- /**
39
- * Component default class name and class prefix.
40
- */
41
- const CLASSNAME = getRootClassName(COMPONENT_NAME);
42
-
43
- /**
44
- * Component default props.
45
- */
46
- const DEFAULT_PROPS: Partial<IconProps> = {};
47
-
48
- /**
49
- * Icon component.
50
- *
51
- * @param props Component props.
52
- * @param ref Component ref.
53
- * @return React element.
54
- */
55
- export const Icon = (props: IconProps) => {
56
- console.log(props);
57
- const {
58
- className,
59
- color: propColor,
60
- colorVariant: propColorVariant,
61
- hasShape,
62
- icon,
63
- size,
64
- theme,
65
- alt,
66
- ref,
67
- ...forwardedProps
68
- } = props;
69
- const [color, colorVariant] = resolveColorWithVariants(propColor, propColorVariant);
70
-
71
- // Color
72
- let iconColor = color;
73
- if (!iconColor && (hasShape || theme)) {
74
- iconColor = theme === Theme.dark ? ColorPalette.light : ColorPalette.dark;
75
- }
76
-
77
- // Color variant
78
- let iconColorVariant = colorVariant;
79
- if (!iconColorVariant && hasShape && iconColor === ColorPalette.dark) {
80
- iconColorVariant = 'L2';
81
- }
82
-
83
- // Size
84
- let iconSize = size;
85
- if (size && hasShape) {
86
- if (size === Size.xxs || size === Size.xs) {
87
- iconSize = Size.s;
88
- } else if (size === Size.xxl) {
89
- iconSize = Size.xl;
90
- }
91
- } else if (hasShape) {
92
- iconSize = Size.m;
93
- }
94
-
95
- return (
96
- <i
97
- ref={ref}
98
- {...forwardedProps}
99
- className={classNames(
100
- className,
101
- handleBasicClasses({
102
- color: iconColor,
103
- colorVariant: iconColorVariant,
104
- hasShape,
105
- prefix: CLASSNAME,
106
- theme,
107
- size: iconSize,
108
- }),
109
- !hasShape && `${CLASSNAME}--no-shape`,
110
- !hasShape &&
111
- iconColor === ColorPalette.yellow &&
112
- icon === mdiAlertCircle &&
113
- `${CLASSNAME}--has-dark-layer`,
114
- `${CLASSNAME}--path`,
115
- )}
116
- >
117
- <InputHelper>test</InputHelper>
118
- <svg
119
- aria-hidden={alt ? undefined : 'true'}
120
- role={alt ? 'img' : undefined}
121
- aria-label={alt}
122
- height="1em"
123
- preserveAspectRatio="xMidYMid meet"
124
- style={{ verticalAlign: '-0.125em' }}
125
- viewBox="0 0 24 24"
126
- width="1em"
127
- >
128
- <path d={icon} fill="currentColor" />
129
- </svg>
130
- </i>
131
- );
132
- };
133
-
134
- Icon.displayName = COMPONENT_NAME;
135
- Icon.className = CLASSNAME;
136
- Icon.defaultProps = DEFAULT_PROPS;
@@ -1,69 +0,0 @@
1
- import classNames from 'classnames';
2
-
3
- import { Theme, Kind } from '../../constants';
4
- import { GenericProps, HasTheme } from '../../types';
5
- import { getRootClassName, handleBasicClasses } from '../../utils/className';
6
-
7
- export const INPUT_HELPER_CONFIGURATION: Record<string, { color: string }> = {
8
- error: {
9
- color: 'red',
10
- },
11
- success: {
12
- color: 'green',
13
- },
14
- warning: {
15
- color: 'yellow',
16
- },
17
- };
18
-
19
- /**
20
- * Defines the props of the component.
21
- */
22
- export interface InputHelperProps extends GenericProps, HasTheme {
23
- /** Helper variant. */
24
- kind?: Kind;
25
- }
26
-
27
- /**
28
- * Component display name.
29
- */
30
- const COMPONENT_NAME = 'InputHelper';
31
-
32
- /**
33
- * Component default class name and class prefix.
34
- */
35
- const CLASSNAME = getRootClassName(COMPONENT_NAME);
36
-
37
- /**
38
- * Component default props.
39
- */
40
- const DEFAULT_PROPS: Partial<InputHelperProps> = {
41
- kind: Kind.info,
42
- };
43
-
44
- /**
45
- * InputHelper component.
46
- *
47
- * @param props Component props.
48
- * @param ref Component ref.
49
- * @return React element.
50
- */
51
- export const InputHelper = (props: InputHelperProps, options) => {
52
- const defaultTheme = Theme.light;
53
- const { className, kind = DEFAULT_PROPS.kind, theme = defaultTheme, ...forwardedProps } = props;
54
- const childrenToRender = options && options.slots && options.slots.default ? options.slots.default() : props.children;
55
- const { color } = INPUT_HELPER_CONFIGURATION[kind as any] || {};
56
-
57
- return (
58
- <p
59
- {...forwardedProps}
60
- className={classNames(className, handleBasicClasses({ prefix: CLASSNAME, color, theme }))}
61
- >
62
- {childrenToRender}
63
- </p>
64
- );
65
- };
66
-
67
- InputHelper.displayName = COMPONENT_NAME;
68
- InputHelper.className = CLASSNAME;
69
- InputHelper.defaultProps = DEFAULT_PROPS;