@mezzanine-ui/core 0.6.1 → 0.7.1

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.
@@ -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) / 2};
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';
@@ -59,11 +60,8 @@
59
60
  --#{$cell-prefix}-text-color: #{palette.color(text-primary)};
60
61
 
61
62
  position: relative;
62
- display: flex;
63
- justify-content: center;
64
- align-items: center;
65
63
  width: 100%;
66
- aspect-ratio: 1 / 1;
64
+ padding-top: 100%;
67
65
  color: var(--#{$cell-prefix}-text-color);
68
66
  user-select: none;
69
67
 
@@ -74,15 +72,29 @@
74
72
  height: 100%;
75
73
  }
76
74
 
75
+ &__inner {
76
+ display: flex;
77
+ justify-content: center;
78
+ align-items: center;
79
+ position: absolute;
80
+ top: 0;
81
+ left: 0;
82
+ width: 100%;
83
+ height: 100%;
84
+ }
85
+
77
86
  &--today {
78
87
  --#{$cell-prefix}-text-color: #{palette.color(primary)};
79
88
 
80
89
  &::after {
90
+ $dot-width: 2px;
91
+
81
92
  content: '';
82
93
  position: absolute;
94
+ left: calc(50% - #{math.div($dot-width, 2)});
83
95
  display: block;
84
- width: 2px;
85
- height: 2px;
96
+ width: $dot-width;
97
+ height: $dot-width;
86
98
  border-radius: 50%;
87
99
  bottom: 6px;
88
100
  background-color: var(--#{$cell-prefix}-text-color);
@@ -29,6 +29,7 @@ export declare const calendarClasses: {
29
29
  row: string;
30
30
  /** Cell classes */
31
31
  cell: string;
32
+ cellInner: string;
32
33
  cellToday: string;
33
34
  cellActive: string;
34
35
  cellDisabled: string;
@@ -20,6 +20,7 @@ const calendarClasses = {
20
20
  row: calendarRowPrefix,
21
21
  /** Cell classes */
22
22
  cell: calendarCellPrefix,
23
+ cellInner: `${calendarCellPrefix}__inner`,
23
24
  cellToday: `${calendarCellPrefix}--today`,
24
25
  cellActive: `${calendarCellPrefix}--active`,
25
26
  cellDisabled: `${calendarCellPrefix}--disabled`,
@@ -6,5 +6,21 @@
6
6
  input {
7
7
  padding-left: var(--#{text-field.$prefix}-padding-left);
8
8
  padding-right: var(--#{text-field.$prefix}-padding-right);
9
+
10
+ /* clears the 'X' from Internet Explorer */
11
+ &[type="search"]::-ms-clear,
12
+ &[type="search"]::-ms-reveal {
13
+ display: none;
14
+ width: 0;
15
+ height: 0;
16
+ }
17
+
18
+ /* clears the 'X' from Chrome */
19
+ &[type="search"]::-webkit-search-decoration,
20
+ &[type="search"]::-webkit-search-cancel-button,
21
+ &[type="search"]::-webkit-search-results-button,
22
+ &[type="search"]::-webkit-search-results-decoration {
23
+ display: none;
24
+ }
9
25
  }
10
26
  }
@@ -7,9 +7,9 @@
7
7
 
8
8
  $height: 40px !default;
9
9
  $padding-left: 12px !default;
10
- $padding-right: 24px !default;
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.6.1",
3
+ "version": "0.7.1",
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.5.2",
27
+ "@mezzanine-ui/system": "^0.7.0",
28
28
  "tslib": "^2.1.0"
29
29
  }
30
30
  }
@@ -32,8 +32,8 @@ $tags-gap: 4px !default;
32
32
  }
33
33
 
34
34
  /* clears the 'X' from Internet Explorer */
35
- &[type=search]::-ms-clear,
36
- &[type=search]::-ms-reveal {
35
+ &[type="search"]::-ms-clear,
36
+ &[type="search"]::-ms-reveal {
37
37
  display: none;
38
38
  width: 0;
39
39
  height: 0;
@@ -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 / $handler-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 / $handler-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';
@@ -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
- show?: boolean;
79
- current?: number;
80
- onChange?(page: number): void;
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;
@@ -16,7 +16,6 @@ $count-gap: 4px !default;
16
16
  padding: #{$padding-y} 0;
17
17
 
18
18
  textarea {
19
- height: 100%;
20
19
  margin: 0;
21
20
  padding-left: var(--#{text-field.$prefix}-padding-left);
22
21
  padding-right: var(--#{text-field.$prefix}-padding-right);
@@ -47,11 +47,6 @@ $padding: 16px !default;
47
47
  .#{$column-prefix} {
48
48
  $cell-height: 32px;
49
49
 
50
- @mixin buttonBase {
51
- display: block;
52
- aspect-ratio: 1 / 1;
53
- }
54
-
55
50
  @include typography.variant(input3);
56
51
 
57
52
  width: 48px;
@@ -66,20 +61,31 @@ $padding: 16px !default;
66
61
  }
67
62
 
68
63
  &__button {
69
- @include buttonBase;
70
-
64
+ display: inline-flex;
65
+ justify-content: center;
66
+ align-items: center;
67
+ width: $cell-height;
71
68
  height: $cell-height;
72
69
  }
73
70
 
74
71
  &__control-button {
75
- @include buttonBase;
76
-
72
+ display: inline-flex;
73
+ justify-content: center;
74
+ align-items: center;
77
75
  width: 24px;
78
76
  height: 24px;
79
77
  margin: 0 auto 0 4px;
80
78
  font-size: 24px;
81
79
  }
82
80
 
81
+ &__ratio-box-inner {
82
+ position: absolute;
83
+ top: 0;
84
+ left: 0;
85
+ width: 100%;
86
+ height: 100%;
87
+ }
88
+
83
89
  &__cells {
84
90
  height: $cell-height * 5;
85
91
  overflow: hidden;
@@ -26,6 +26,7 @@ export declare const timePanelClasses: {
26
26
  columnButton: string;
27
27
  columnControlButton: string;
28
28
  columnCells: string;
29
+ columnRatioBoxInner: string;
29
30
  };
30
31
  /** Helpers */
31
32
  export declare function getUnitLabel(target: string | number, digits: number, fill?: string): string;
@@ -19,6 +19,7 @@ const timePanelClasses = {
19
19
  columnButton: `${timePanelColumnPrefix}__button`,
20
20
  columnControlButton: `${timePanelColumnPrefix}__control-button`,
21
21
  columnCells: `${timePanelColumnPrefix}__cells`,
22
+ columnRatioBoxInner: `${timePanelColumnPrefix}__ratio-box-inner`,
22
23
  };
23
24
  /** Helpers */
24
25
  function getUnitLabel(target, digits, fill = '0') {