@lumx/core 4.3.2-alpha.5 → 4.3.2-alpha.7

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.
@@ -198,3 +198,12 @@ export declare const ColorVariant: {
198
198
  export type ColorVariant = ValueOf<typeof ColorVariant>;
199
199
  /** ColorPalette with all possible color variant combination */
200
200
  export type ColorWithVariants = ColorPalette | Exclude<`${ColorPalette}-${ColorVariant}`, `light-D${number}` | `dark-D${number}`>;
201
+ export declare const REAL_SIZE_FOR_LUMX_SIZE: {
202
+ xxs: number;
203
+ xs: number;
204
+ s: number;
205
+ m: number;
206
+ l: number;
207
+ xl: number;
208
+ xxl: number;
209
+ };
@@ -151,5 +151,14 @@ const ColorVariant = {
151
151
  L6: 'L6',
152
152
  N: 'N',
153
153
  };
154
+ const REAL_SIZE_FOR_LUMX_SIZE = {
155
+ [Size.xxs]: 14,
156
+ [Size.xs]: 20,
157
+ [Size.s]: 24,
158
+ [Size.m]: 36,
159
+ [Size.l]: 64,
160
+ [Size.xl]: 128,
161
+ [Size.xxl]: 256,
162
+ };
154
163
 
155
- export { Alignment, AspectRatio, ColorPalette, ColorVariant, Emphasis, Kind, Orientation, Size, Theme, Typography, TypographyCustom, TypographyInterface, TypographyTitleCustom, WhiteSpace };
164
+ export { Alignment, AspectRatio, ColorPalette, ColorVariant, Emphasis, Kind, Orientation, REAL_SIZE_FOR_LUMX_SIZE, Size, Theme, Typography, TypographyCustom, TypographyInterface, TypographyTitleCustom, WhiteSpace };
@@ -1,4 +1,4 @@
1
1
  export { BACKSPACE_KEY_CODE, DOWN_KEY_CODE, ENTER_KEY_CODE, ESCAPE_KEY_CODE, LEFT_KEY_CODE, RIGHT_KEY_CODE, SPACE_KEY_CODE, TAB_KEY_CODE, UP_KEY_CODE } from './keycodes/index.js';
2
2
  export { DIALOG_TRANSITION_DURATION, EXPANSION_PANEL_TRANSITION_DURATION, NOTIFICATION_TRANSITION_DURATION, SLIDESHOW_TRANSITION_DURATION, TOOLTIP_HOVER_DELAY, TOOLTIP_LONG_PRESS_DELAY } from './components/index.js';
3
- export { Alignment, AspectRatio, ColorPalette, ColorVariant, Emphasis, Kind, Orientation, Size, Theme, Typography, TypographyCustom, TypographyInterface, TypographyTitleCustom, WhiteSpace } from './enums/index.js';
3
+ export { Alignment, AspectRatio, ColorPalette, ColorVariant, Emphasis, Kind, Orientation, REAL_SIZE_FOR_LUMX_SIZE, Size, Theme, Typography, TypographyCustom, TypographyInterface, TypographyTitleCustom, WhiteSpace } from './enums/index.js';
4
4
  export { VISUALLY_HIDDEN } from './className/index.js';
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Same as `Partial` but for one property only.
3
+ *
4
+ * @example PartialBy<Foo, 'bar'> => produces a type almost identical to `Foo` but with the `bar` property as optional.
5
+ */
6
+ export type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
7
+ /**
8
+ * Same as `Partial` but for all except some properties only.
9
+ *
10
+ * @example PartialExcept<Foo, 'bar'> => produces a type almost identical to `Foo` but with the `bar` property as it is on the original type.
11
+ */
12
+ export type PartialExcept<T, K extends keyof T> = Pick<T, K> & Partial<Omit<T, K>>;
@@ -25,3 +25,4 @@ export type { HasChecked } from './HasChecked';
25
25
  export type { HasDisabled } from './HasDisabled';
26
26
  export type { AriaAttributes } from './AriaAttributes';
27
27
  export type { Selector } from './Selector';
28
+ export type { PartialBy, PartialExcept } from './PartialBy';
@@ -1,3 +1,4 @@
1
+ import { ClassValue } from 'classnames/types';
1
2
  import { type Modifier } from './modifier';
2
3
  /**
3
4
  * Generates a BEM block + modifier class name string.
@@ -11,5 +12,5 @@ import { type Modifier } from './modifier';
11
12
  * block('button'); // 'button'
12
13
  * block('button', { active: true, disabled: false }); // 'button button--active'
13
14
  */
14
- export declare function block(baseName: string, additionalClasses: string[]): string;
15
- export declare function block(baseName: string, modifiers?: Modifier, additionalClasses?: string[]): string;
15
+ export declare function block(baseName: string, additionalClasses: ClassValue[]): string;
16
+ export declare function block(baseName: string, modifiers?: Modifier, additionalClasses?: ClassValue[]): string;
@@ -1,3 +1,4 @@
1
+ import { ClassValue } from 'classnames/types';
1
2
  import type { Modifier } from './modifier';
2
3
  /**
3
4
  * Creates a BEM element class generator function for the given base class.
@@ -12,5 +13,5 @@ import type { Modifier } from './modifier';
12
13
  * element('my-button', 'icon'); // 'my-button__icon'
13
14
  * element('my-button', 'icon', { active: true }); // 'my-button__icon my-button__icon--active'
14
15
  */
15
- export declare function element(baseClass: string, elem: string, additionalClasses: string[]): string;
16
- export declare function element(baseClass: string, elem: string, modifiers?: Modifier, additionalClasses?: string[]): string;
16
+ export declare function element(baseClass: string, elem: string, additionalClasses: ClassValue[]): string;
17
+ export declare function element(baseClass: string, elem: string, modifiers?: Modifier, additionalClasses?: ClassValue[]): string;
@@ -1,3 +1,4 @@
1
+ import { ClassValue } from 'classnames/types';
1
2
  import { block } from './block';
2
3
  import { element } from './element';
3
4
  import { type Modifier } from './modifier';
@@ -6,12 +7,12 @@ import { type Modifier } from './modifier';
6
7
  */
7
8
  export declare function bem(baseName: string): {
8
9
  block: {
9
- (additionalClasses: string[]): string;
10
- (modifiers?: Modifier, additionalClasses?: string[]): string;
10
+ (additionalClasses: ClassValue[]): string;
11
+ (modifiers?: Modifier, additionalClasses?: ClassValue[]): string;
11
12
  };
12
13
  element: {
13
- (elem: string, additionalClasses: string[]): string;
14
- (elem: string, modifiers?: Modifier, additionalClasses?: string[]): string;
14
+ (elem: string, additionalClasses: ClassValue[]): string;
15
+ (elem: string, modifiers?: Modifier, additionalClasses?: ClassValue[]): string;
15
16
  };
16
17
  modifier: (modifiers: Modifier) => string;
17
18
  };
package/lumx.css CHANGED
@@ -685,6 +685,18 @@
685
685
  * List of deprecated v2 variables that have been removed or renamed.
686
686
  * Warning: These will be removed in the next major version.
687
687
  */
688
+ /**
689
+ * Add styles before & after an element while avoiding having a "before" section display if an "after" section was
690
+ displayed.
691
+ */
692
+ /**
693
+ * Automatic divider between elements of a list using border before and after the element
694
+ *
695
+ * @param $orientation Required 'vertical'/'horizontal' orientation
696
+ * @param $selector Optional element selector to apply to (default to parent '&' selector)
697
+ * @param $theme Optional 'theme-light'/'theme-dark' (defaults to 'theme-light')
698
+ * @param $spacing Optional spacing around dividers (defaults to $lumx-spacing-unit-regular)
699
+ */
688
700
  /* stylelint-disable custom-property-pattern */
689
701
  /** @deprecated: replaced with $lumx-progress-circular-size-map */
690
702
  /**
@@ -5057,6 +5069,88 @@ table {
5057
5069
  width: 100%;
5058
5070
  }
5059
5071
 
5072
+ /* ==========================================================================
5073
+ Combobox Divider
5074
+ ========================================================================== */
5075
+ .lumx-combobox-divider:last-child, .lumx-combobox-divider:first-child {
5076
+ display: none;
5077
+ }
5078
+
5079
+ /* ==========================================================================
5080
+ Combobox Option
5081
+ ========================================================================== */
5082
+ .lumx-combobox-option {
5083
+ position: relative;
5084
+ }
5085
+ .lumx-combobox-option__content {
5086
+ gap: 0;
5087
+ }
5088
+ .lumx-combobox-option__content--is-disabled {
5089
+ opacity: 0.5;
5090
+ }
5091
+ .lumx-combobox-option__trigger {
5092
+ color: rgba(0, 0, 0, 0.87);
5093
+ text-decoration: none;
5094
+ overflow: hidden;
5095
+ overflow-wrap: break-word;
5096
+ }
5097
+ .lumx-combobox-option__trigger::before {
5098
+ content: "";
5099
+ cursor: pointer;
5100
+ position: absolute;
5101
+ left: 0;
5102
+ bottom: 0;
5103
+ right: 0;
5104
+ top: 0;
5105
+ z-index: 2;
5106
+ }
5107
+ .lumx-combobox-option__after {
5108
+ z-index: 3;
5109
+ }
5110
+
5111
+ /* ==========================================================================
5112
+ Combobox Listbox
5113
+ ========================================================================== */
5114
+ .lumx-combobox-listbox:empty {
5115
+ padding: 0;
5116
+ }
5117
+ .lumx-combobox-listbox__state {
5118
+ text-align: center;
5119
+ margin: 8px;
5120
+ }
5121
+
5122
+ /* ==========================================================================
5123
+ Combobox Option more Info
5124
+ ========================================================================== */
5125
+ .lumx-combobox-option-more-info__popover {
5126
+ padding: 16px;
5127
+ max-width: 256px;
5128
+ }
5129
+
5130
+ /* ==========================================================================
5131
+ Combobox Section
5132
+ ========================================================================== */
5133
+ .lumx-combobox-section:not(:first-child):not(.lumx-combobox-section + .lumx-combobox-section):not(.visually-hidden + .lumx-combobox-section)::before {
5134
+ content: "";
5135
+ display: block;
5136
+ height: 1px;
5137
+ margin: 0;
5138
+ border: none;
5139
+ background-color: var(--lumx-color-dark-L5);
5140
+ margin-top: 8px;
5141
+ margin-bottom: 8px;
5142
+ }
5143
+ .lumx-combobox-section:not(:last-child):not(:has(+ .visually-hidden)):not(:has(+ [aria-hidden=true]))::after {
5144
+ content: "";
5145
+ display: block;
5146
+ height: 1px;
5147
+ margin: 0;
5148
+ border: none;
5149
+ background-color: var(--lumx-color-dark-L5);
5150
+ margin-top: 8px;
5151
+ margin-bottom: 8px;
5152
+ }
5153
+
5060
5154
  /* ==========================================================================
5061
5155
  Checkbox
5062
5156
  ========================================================================== */
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "url": "https://github.com/lumapps/design-system/issues"
7
7
  },
8
8
  "dependencies": {
9
- "@lumx/icons": "^4.3.2-alpha.5",
9
+ "@lumx/icons": "^4.3.2-alpha.7",
10
10
  "classnames": "^2.3.2",
11
11
  "focus-visible": "^5.0.2",
12
12
  "lodash": "4.17.23",
@@ -22,11 +22,6 @@
22
22
  "license": "MIT",
23
23
  "type": "module",
24
24
  "name": "@lumx/core",
25
- "exports": {
26
- "./src/js/constants/*": "./src/js/constants/*",
27
- "./src/js/types/*": "./src/js/types/*",
28
- "./src/js/utils/*": "./src/js/utils/*"
29
- },
30
25
  "publishConfig": {
31
26
  "directory": "dist"
32
27
  },
@@ -42,7 +37,7 @@
42
37
  "update-version-changelog": "yarn version-changelog ../../CHANGELOG.md"
43
38
  },
44
39
  "sideEffects": false,
45
- "version": "4.3.2-alpha.5",
40
+ "version": "4.3.2-alpha.7",
46
41
  "devDependencies": {
47
42
  "@rollup/plugin-typescript": "^12.3.0",
48
43
  "@testing-library/dom": "^10.4.1",
@@ -3,6 +3,7 @@
3
3
  @import "./components/checkbox/mixins";
4
4
  @import "./components/chip/variables";
5
5
  @import "./components/chip/mixins";
6
+ @import "./components/combobox/mixins";
6
7
  @import "./components/dialog/variables";
7
8
  @import "./components/divider/variables";
8
9
  @import "./components/divider/mixins";
@@ -0,0 +1,86 @@
1
+ /* ==========================================================================
2
+ Combobox Divider
3
+ ========================================================================== */
4
+
5
+ .#{$lumx-base-prefix}-combobox-divider {
6
+ // Hide if first or last in list
7
+ &:last-child,
8
+ &:first-child {
9
+ display: none;
10
+ }
11
+ }
12
+
13
+ /* ==========================================================================
14
+ Combobox Option
15
+ ========================================================================== */
16
+
17
+ .#{$lumx-base-prefix}-combobox-option {
18
+ position: relative;
19
+
20
+ &__content {
21
+ // TODO: migrate away from using lumx-list-item styles https://lumapps.atlassian.net/browse/DSW-288
22
+ gap: 0;
23
+
24
+ &--is-disabled {
25
+ opacity: .5;
26
+ }
27
+ }
28
+
29
+ &__trigger {
30
+ color: $lumx-color-dark-N;
31
+ text-decoration: none;
32
+ overflow: hidden;
33
+ overflow-wrap: break-word;
34
+
35
+ // Make the whole item clickable
36
+ &::before {
37
+ content: '';
38
+ cursor: pointer;
39
+ position: absolute;
40
+ left: 0;
41
+ bottom: 0;
42
+ right: 0;
43
+ top: 0;
44
+ z-index: 2;
45
+ }
46
+ }
47
+
48
+ &__after {
49
+ z-index: 3;
50
+ }
51
+ }
52
+
53
+ /* ==========================================================================
54
+ Combobox Listbox
55
+ ========================================================================== */
56
+
57
+ .#{$lumx-base-prefix}-combobox-listbox {
58
+ &:empty {
59
+ padding: 0;
60
+ }
61
+
62
+ &__state {
63
+ text-align: center;
64
+ margin: $lumx-spacing-unit-regular;
65
+ }
66
+ }
67
+
68
+ /* ==========================================================================
69
+ Combobox Option more Info
70
+ ========================================================================== */
71
+
72
+ .#{$lumx-base-prefix}-combobox-option-more-info {
73
+ &__popover {
74
+ padding: $lumx-spacing-unit-big;
75
+ max-width: $lumx-size-xxl;
76
+ }
77
+ }
78
+
79
+
80
+ /* ==========================================================================
81
+ Combobox Section
82
+ ========================================================================== */
83
+
84
+ .#{$lumx-base-prefix}-combobox-section {
85
+ @include auto-list-divider($orientation: 'vertical');
86
+ }
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Add styles before & after an element while avoiding having a "before" section display if an "after" section was
3
+ displayed.
4
+ */
5
+ @mixin between($selector) {
6
+ &:not(:first-child):not(#{$selector} + #{$selector}):not(.visually-hidden + #{$selector}) {
7
+ @content('before')
8
+ }
9
+ &:not(:last-child):not(:has(+ .visually-hidden)):not(:has(+ [aria-hidden=true])) {
10
+ @content('after')
11
+ }
12
+ }
13
+
14
+ @mixin vertical-divider($color: 'theme-light') {
15
+ @include lumx-divider($color);
16
+ height: 20px;
17
+ margin: auto 0;
18
+ width: 1px;
19
+ }
20
+
21
+ /**
22
+ * Automatic divider between elements of a list using border before and after the element
23
+ *
24
+ * @param $orientation Required 'vertical'/'horizontal' orientation
25
+ * @param $selector Optional element selector to apply to (default to parent '&' selector)
26
+ * @param $theme Optional 'theme-light'/'theme-dark' (defaults to 'theme-light')
27
+ * @param $spacing Optional spacing around dividers (defaults to $lumx-spacing-unit-regular)
28
+ */
29
+ @mixin auto-list-divider($orientation, $selector: &, $theme: 'theme-light', $spacing: $lumx-spacing-unit-regular) {
30
+ $start: if($orientation == 'vertical', 'top', 'left');
31
+ $end: if($orientation == 'vertical', 'bottom', 'right');
32
+
33
+ @include between($selector) using($position) {
34
+ @if $position == 'before' {
35
+ &::before {
36
+ content: '';
37
+ display: block;
38
+ @if $orientation == 'horizontal' {
39
+ @include vertical-divider($theme);
40
+ }
41
+ @if $orientation == 'vertical' {
42
+ @include lumx-divider($theme);
43
+ }
44
+ margin-#{$start}: $spacing;
45
+ margin-#{$end}: $spacing;
46
+ }
47
+ }
48
+ @if $position == 'after' {
49
+ &::after {
50
+ content: '';
51
+ display: block;
52
+ @if $orientation == 'horizontal' {
53
+ @include vertical-divider($theme);
54
+ }
55
+ @if $orientation == 'vertical' {
56
+ @include lumx-divider($theme);
57
+ }
58
+ margin-#{$start}: $spacing;
59
+ margin-#{$end}: $spacing;
60
+ }
61
+ }
62
+ }
63
+ }
package/scss/lumx.scss CHANGED
@@ -20,6 +20,7 @@
20
20
  @import "./components/avatar/index";
21
21
  @import "./components/badge/index";
22
22
  @import "./components/button/index";
23
+ @import "./components/combobox/index";
23
24
  @import "./components/checkbox/index";
24
25
  @import "./components/chip/index";
25
26
  @import "./components/comment-block/index";