@mezzanine-ui/core 0.6.2 → 0.7.2
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/_internal/overlay-with-slide-fade/_index.scss +1 -0
- package/_internal/overlay-with-slide-fade/_overlay-with-slide-fade-styles.scss +7 -0
- package/_internal/overlay-with-slide-fade/_overlay-with-slider-fade.scss +1 -0
- package/_internal/overlay-with-slide-fade/index.d.ts +1 -0
- package/_internal/overlay-with-slide-fade/index.js +1 -0
- package/_internal/overlay-with-slide-fade/overlayWithSlideFade.d.ts +4 -0
- package/_internal/overlay-with-slide-fade/overlayWithSlideFade.js +6 -0
- package/alert/_alert-styles.scss +2 -1
- package/calendar/_calendar-styles.scss +6 -2
- package/drawer/_drawer-styles.scss +0 -2
- package/icon/_icon-styles.scss +4 -0
- package/icon/icon.d.ts +2 -0
- package/icon/icon.js +29 -18
- package/message/_message-styles.scss +4 -3
- package/package.json +2 -2
- package/slider/_slider-styles.scss +3 -2
- package/slider/index.js +1 -1
- package/slider/slider.d.ts +3 -0
- package/slider/slider.js +37 -3
- package/table/table.d.ts +4 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@forward './overlay-with-slider-fade';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
$prefix: mzn-overlay-with-slide-fade;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './overlayWithSlideFade';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { overlayWithSlideFadeClasses, overlayWithSlideFadePrefix } from './overlayWithSlideFade.js';
|
package/alert/_alert-styles.scss
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@use 'sass:math';
|
|
1
2
|
@use '~@mezzanine-ui/system/palette';
|
|
2
3
|
@use '~@mezzanine-ui/system/transition';
|
|
3
4
|
@use '~@mezzanine-ui/system/typography';
|
|
@@ -18,7 +19,7 @@ $close-icon-width: $icon-size + 12px;
|
|
|
18
19
|
width: 100%;
|
|
19
20
|
|
|
20
21
|
&__icon {
|
|
21
|
-
$vertical-padding: #{($box-height - $icon-size
|
|
22
|
+
$vertical-padding: #{math.div($box-height - $icon-size, 2)};
|
|
22
23
|
|
|
23
24
|
padding: $vertical-padding $icon-horizontal-padding;
|
|
24
25
|
font-size: typography.px-to-rem($icon-size);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@use 'sass:math';
|
|
1
2
|
@use '~@mezzanine-ui/system/typography';
|
|
2
3
|
@use '~@mezzanine-ui/system/palette';
|
|
3
4
|
@use '~@mezzanine-ui/system/transition';
|
|
@@ -86,11 +87,14 @@
|
|
|
86
87
|
--#{$cell-prefix}-text-color: #{palette.color(primary)};
|
|
87
88
|
|
|
88
89
|
&::after {
|
|
90
|
+
$dot-width: 2px;
|
|
91
|
+
|
|
89
92
|
content: '';
|
|
90
93
|
position: absolute;
|
|
94
|
+
left: calc(50% - #{math.div($dot-width, 2)});
|
|
91
95
|
display: block;
|
|
92
|
-
width:
|
|
93
|
-
height:
|
|
96
|
+
width: $dot-width;
|
|
97
|
+
height: $dot-width;
|
|
94
98
|
border-radius: 50%;
|
|
95
99
|
bottom: 6px;
|
|
96
100
|
background-color: var(--#{$cell-prefix}-text-color);
|
package/icon/_icon-styles.scss
CHANGED
package/icon/icon.d.ts
CHANGED
|
@@ -3,11 +3,13 @@ import { MainColor } from '@mezzanine-ui/system/palette';
|
|
|
3
3
|
export declare type IconColor = 'inherit' | MainColor | 'disabled';
|
|
4
4
|
export interface IconCssVars {
|
|
5
5
|
color?: IconColor;
|
|
6
|
+
size?: number;
|
|
6
7
|
}
|
|
7
8
|
export declare const iconPrefix = "mzn-icon";
|
|
8
9
|
export declare const iconClasses: {
|
|
9
10
|
readonly host: "mzn-icon";
|
|
10
11
|
readonly color: "mzn-icon--color";
|
|
11
12
|
readonly spin: "mzn-icon--spin";
|
|
13
|
+
readonly size: "mzn-icon--size";
|
|
12
14
|
};
|
|
13
15
|
export declare function toIconCssVars(variables: IconCssVars): CssVarInterpolations;
|
package/icon/icon.js
CHANGED
|
@@ -6,28 +6,39 @@ const iconClasses = {
|
|
|
6
6
|
host: iconPrefix,
|
|
7
7
|
color: `${iconPrefix}--color`,
|
|
8
8
|
spin: `${iconPrefix}--spin`,
|
|
9
|
+
size: `${iconPrefix}--size`,
|
|
9
10
|
};
|
|
10
11
|
function toIconCssVars(variables) {
|
|
11
|
-
const { color } = variables;
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
const { color, size } = variables;
|
|
13
|
+
let result = {};
|
|
14
|
+
/** color mapping */
|
|
15
|
+
if (color) {
|
|
16
|
+
let colorValue;
|
|
17
|
+
if (color === 'inherit') {
|
|
18
|
+
colorValue = color;
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
/**
|
|
22
|
+
* Use `action-disabled` color of palette as `disabled` color of icon.
|
|
23
|
+
*/
|
|
24
|
+
const colorName = color === 'disabled'
|
|
25
|
+
? 'action-disabled'
|
|
26
|
+
: color;
|
|
27
|
+
colorValue = toCssVar(`${palettePrefix}-${colorName}`);
|
|
28
|
+
}
|
|
29
|
+
result = {
|
|
30
|
+
...result,
|
|
31
|
+
[`--${iconPrefix}-color`]: colorValue,
|
|
32
|
+
};
|
|
14
33
|
}
|
|
15
|
-
|
|
16
|
-
if (
|
|
17
|
-
|
|
34
|
+
/** size mapping */
|
|
35
|
+
if (typeof size !== 'undefined') {
|
|
36
|
+
result = {
|
|
37
|
+
...result,
|
|
38
|
+
[`--${iconPrefix}-size`]: `${size}px`,
|
|
39
|
+
};
|
|
18
40
|
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Use `action-disabled` color of palette as `disabled` color of icon.
|
|
22
|
-
*/
|
|
23
|
-
const colorName = color === 'disabled'
|
|
24
|
-
? 'action-disabled'
|
|
25
|
-
: color;
|
|
26
|
-
colorValue = toCssVar(`${palettePrefix}-${colorName}`);
|
|
27
|
-
}
|
|
28
|
-
return {
|
|
29
|
-
[`--${iconPrefix}-color`]: colorValue,
|
|
30
|
-
};
|
|
41
|
+
return result;
|
|
31
42
|
}
|
|
32
43
|
|
|
33
44
|
export { iconClasses, iconPrefix, toIconCssVars };
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
|
|
8
8
|
$height: 40px !default;
|
|
9
9
|
$padding-left: 12px !default;
|
|
10
|
-
$padding-right:
|
|
10
|
+
$padding-right: 12px !default;
|
|
11
|
+
$content-padding: 12px !default;
|
|
11
12
|
$icon-size: 24px !default;
|
|
12
|
-
$icon-gap: 12px !default;
|
|
13
13
|
|
|
14
14
|
.#{$prefix} {
|
|
15
15
|
display: flex;
|
|
@@ -28,12 +28,13 @@ $icon-gap: 12px !default;
|
|
|
28
28
|
&__icon {
|
|
29
29
|
color: var(--#{$prefix}-color);
|
|
30
30
|
font-size: typography.px-to-rem($icon-size);
|
|
31
|
-
margin-right: $icon-gap;
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
&__content {
|
|
35
34
|
@include typography.variant(body1);
|
|
36
35
|
@include typography.overflow-ellipsis();
|
|
36
|
+
|
|
37
|
+
padding: 0 $content-padding;
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
@each $severity in $severities {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mezzanine-ui/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "Core for mezzanine-ui",
|
|
5
5
|
"author": "Mezzanine",
|
|
6
6
|
"repository": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@mezzanine-ui/icons": "^0.5.0",
|
|
27
|
-
"@mezzanine-ui/system": "^0.
|
|
27
|
+
"@mezzanine-ui/system": "^0.7.0",
|
|
28
28
|
"tslib": "^2.1.0"
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@use 'sass:math';
|
|
1
2
|
@use '~@mezzanine-ui/system/palette';
|
|
2
3
|
@use './slider' as *;
|
|
3
4
|
|
|
@@ -90,13 +91,13 @@ $handler-scale-size: 24px !default;
|
|
|
90
91
|
box-sizing: border-box;
|
|
91
92
|
|
|
92
93
|
&:hover {
|
|
93
|
-
transform: scale($handler-scale-size
|
|
94
|
+
transform: scale(math.div($handler-scale-size, $handler-size));
|
|
94
95
|
background-color: palette.color(primary-light);
|
|
95
96
|
}
|
|
96
97
|
|
|
97
98
|
&--active {
|
|
98
99
|
z-index: 1;
|
|
99
|
-
transform: scale($handler-scale-size
|
|
100
|
+
transform: scale(math.div($handler-scale-size, $handler-size));
|
|
100
101
|
background-color: palette.color(primary-dark);
|
|
101
102
|
|
|
102
103
|
&:hover {
|
package/slider/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { findClosetValueIndex, getPercentage, getSliderRect, getValueFromClientX, isRangeSlider, roundToStep, sliderClasses, sliderHandlerPrefix, sliderPrefix, sortSliderValue, toSliderCssVars } from './slider.js';
|
|
1
|
+
export { findClosetValueIndex, fixRangeSliderValue, fixSingleSliderValue, getPercentage, getPrecision, getSliderRect, getValueFromClientX, isRangeSlider, roundToStep, sliderClasses, sliderHandlerPrefix, sliderPrefix, sortSliderValue, toSliderCssVars } from './slider.js';
|
package/slider/slider.d.ts
CHANGED
|
@@ -53,5 +53,8 @@ export declare function sortSliderValue(value: RangeSliderValue): RangeSliderVal
|
|
|
53
53
|
export declare function getSliderRect(element: HTMLDivElement): SliderRect;
|
|
54
54
|
export declare function getValueFromClientX(clientX: number, trackDims: SliderRect, min: number, max: number): number;
|
|
55
55
|
export declare function getPercentage(value: number, min: number, max: number): number;
|
|
56
|
+
export declare function getPrecision(step: number): number;
|
|
57
|
+
export declare function fixSingleSliderValue(value: SingleSliderValue, min: number, max: number): SingleSliderValue;
|
|
58
|
+
export declare function fixRangeSliderValue(value: RangeSliderValue, min: number, max: number): RangeSliderValue;
|
|
56
59
|
export declare function roundToStep(value: number, step: number, min: number, max: number): number;
|
|
57
60
|
export declare function findClosetValueIndex(value: SliderValue, newValue: number): number;
|
package/slider/slider.js
CHANGED
|
@@ -67,8 +67,42 @@ function getValueFromClientX(clientX, trackDims, min, max) {
|
|
|
67
67
|
return value + min;
|
|
68
68
|
}
|
|
69
69
|
function getPercentage(value, min, max) {
|
|
70
|
+
if (min > max)
|
|
71
|
+
return 0;
|
|
70
72
|
return Math.max(0, Math.min(100, (value / Math.abs(max - min)) * 100));
|
|
71
73
|
}
|
|
74
|
+
function getPrecision(step) {
|
|
75
|
+
const stepString = step.toString();
|
|
76
|
+
let precision = 0;
|
|
77
|
+
if (stepString.indexOf('.') >= 0) {
|
|
78
|
+
precision = stepString.length - stepString.indexOf('.') - 1;
|
|
79
|
+
}
|
|
80
|
+
return precision;
|
|
81
|
+
}
|
|
82
|
+
function fixSingleSliderValue(value, min, max) {
|
|
83
|
+
if (value < min) {
|
|
84
|
+
return min;
|
|
85
|
+
}
|
|
86
|
+
if (value > max) {
|
|
87
|
+
return max;
|
|
88
|
+
}
|
|
89
|
+
return value;
|
|
90
|
+
}
|
|
91
|
+
function fixRangeSliderValue(value, min, max) {
|
|
92
|
+
if (value[0] > max && value[1] > max) {
|
|
93
|
+
return [max, max];
|
|
94
|
+
}
|
|
95
|
+
if (value[0] < min && value[1] < min) {
|
|
96
|
+
return [min, min];
|
|
97
|
+
}
|
|
98
|
+
if (value[0] < min) {
|
|
99
|
+
return [min, value[1]];
|
|
100
|
+
}
|
|
101
|
+
if (value[1] > max) {
|
|
102
|
+
return [value[0], max];
|
|
103
|
+
}
|
|
104
|
+
return value;
|
|
105
|
+
}
|
|
72
106
|
function roundToStep(value, step, min, max) {
|
|
73
107
|
let left = min;
|
|
74
108
|
let right = max;
|
|
@@ -77,9 +111,9 @@ function roundToStep(value, step, min, max) {
|
|
|
77
111
|
}
|
|
78
112
|
right = Math.min(left + step, max);
|
|
79
113
|
if (value - left < right - value) {
|
|
80
|
-
return left;
|
|
114
|
+
return parseFloat(left.toFixed(getPrecision(step)));
|
|
81
115
|
}
|
|
82
|
-
return right;
|
|
116
|
+
return parseFloat(right.toFixed(getPrecision(step)));
|
|
83
117
|
}
|
|
84
118
|
function findClosetValueIndex(value, newValue) {
|
|
85
119
|
if (!isRangeSlider(value))
|
|
@@ -88,4 +122,4 @@ function findClosetValueIndex(value, newValue) {
|
|
|
88
122
|
return value.findIndex((element) => element === closetValue);
|
|
89
123
|
}
|
|
90
124
|
|
|
91
|
-
export { findClosetValueIndex, getPercentage, getSliderRect, getValueFromClientX, isRangeSlider, roundToStep, sliderClasses, sliderHandlerPrefix, sliderPrefix, sortSliderValue, toSliderCssVars };
|
|
125
|
+
export { findClosetValueIndex, fixRangeSliderValue, fixSingleSliderValue, getPercentage, getPrecision, getSliderRect, getValueFromClientX, isRangeSlider, roundToStep, sliderClasses, sliderHandlerPrefix, sliderPrefix, sortSliderValue, toSliderCssVars };
|
package/table/table.d.ts
CHANGED
|
@@ -75,9 +75,10 @@ export interface TableExpandable<SourceType> {
|
|
|
75
75
|
}
|
|
76
76
|
/** === Feature Pagination */
|
|
77
77
|
export interface TablePagination {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
current: number;
|
|
79
|
+
/** @NOTE set this to true, should control pageSize properly to make layout correct */
|
|
80
|
+
disableAutoSlicing?: boolean;
|
|
81
|
+
onChange(page: number): void;
|
|
81
82
|
total?: number;
|
|
82
83
|
options?: {
|
|
83
84
|
boundaryCount?: number;
|