@eturnity/eturnity_reusable_components 8.40.5 → 8.40.6

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,25 +1,64 @@
1
- let supported;
2
- let perf;
3
- function isPerformanceSupported() {
4
- var _a;
5
- if (supported !== void 0) {
6
- return supported;
1
+ function makeMap(str, expectsLowerCase) {
2
+ const map = /* @__PURE__ */ Object.create(null);
3
+ const list = str.split(",");
4
+ for (let i = 0; i < list.length; i++) {
5
+ map[list[i]] = true;
7
6
  }
8
- if (typeof window !== "undefined" && window.performance) {
9
- supported = true;
10
- perf = window.performance;
11
- } else if (typeof globalThis !== "undefined" && ((_a = globalThis.perf_hooks) === null || _a === void 0 ? void 0 : _a.performance)) {
12
- supported = true;
13
- perf = globalThis.perf_hooks.performance;
14
- } else {
15
- supported = false;
16
- }
17
- return supported;
18
- }
19
- function now() {
20
- return isPerformanceSupported() ? perf.now() : Date.now();
7
+ return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
21
8
  }
9
+ !!(process.env.NODE_ENV !== "production") ? Object.freeze({}) : {};
10
+ !!(process.env.NODE_ENV !== "production") ? Object.freeze([]) : [];
11
+ const NOOP = () => {
12
+ };
13
+ const extend = Object.assign;
14
+ const hasOwnProperty = Object.prototype.hasOwnProperty;
15
+ const hasOwn = (val, key) => hasOwnProperty.call(val, key);
16
+ const isArray = Array.isArray;
17
+ const isMap = (val) => toTypeString(val) === "[object Map]";
18
+ const isFunction = (val) => typeof val === "function";
19
+ const isString = (val) => typeof val === "string";
20
+ const isSymbol = (val) => typeof val === "symbol";
21
+ const isObject = (val) => val !== null && typeof val === "object";
22
+ const objectToString = Object.prototype.toString;
23
+ const toTypeString = (value) => objectToString.call(value);
24
+ const toRawType = (value) => {
25
+ return toTypeString(value).slice(8, -1);
26
+ };
27
+ const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
28
+ const cacheStringFunction = (fn) => {
29
+ const cache = /* @__PURE__ */ Object.create(null);
30
+ return (str) => {
31
+ const hit = cache[str];
32
+ return hit || (cache[str] = fn(str));
33
+ };
34
+ };
35
+ const capitalize = cacheStringFunction(
36
+ (str) => str.charAt(0).toUpperCase() + str.slice(1)
37
+ );
38
+ const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
39
+ const def = (obj, key, value) => {
40
+ Object.defineProperty(obj, key, {
41
+ configurable: true,
42
+ enumerable: false,
43
+ value
44
+ });
45
+ };
22
46
  export {
23
- isPerformanceSupported,
24
- now
47
+ NOOP,
48
+ capitalize,
49
+ def,
50
+ extend,
51
+ hasChanged,
52
+ hasOwn,
53
+ isArray,
54
+ isFunction,
55
+ isIntegerKey,
56
+ isMap,
57
+ isObject,
58
+ isString,
59
+ isSymbol,
60
+ makeMap,
61
+ objectToString,
62
+ toRawType,
63
+ toTypeString
25
64
  };
@@ -1,64 +1,25 @@
1
- function makeMap(str, expectsLowerCase) {
2
- const map = /* @__PURE__ */ Object.create(null);
3
- const list = str.split(",");
4
- for (let i = 0; i < list.length; i++) {
5
- map[list[i]] = true;
1
+ let supported;
2
+ let perf;
3
+ function isPerformanceSupported() {
4
+ var _a;
5
+ if (supported !== void 0) {
6
+ return supported;
6
7
  }
7
- return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
8
+ if (typeof window !== "undefined" && window.performance) {
9
+ supported = true;
10
+ perf = window.performance;
11
+ } else if (typeof globalThis !== "undefined" && ((_a = globalThis.perf_hooks) === null || _a === void 0 ? void 0 : _a.performance)) {
12
+ supported = true;
13
+ perf = globalThis.perf_hooks.performance;
14
+ } else {
15
+ supported = false;
16
+ }
17
+ return supported;
18
+ }
19
+ function now() {
20
+ return isPerformanceSupported() ? perf.now() : Date.now();
8
21
  }
9
- !!(process.env.NODE_ENV !== "production") ? Object.freeze({}) : {};
10
- !!(process.env.NODE_ENV !== "production") ? Object.freeze([]) : [];
11
- const NOOP = () => {
12
- };
13
- const extend = Object.assign;
14
- const hasOwnProperty = Object.prototype.hasOwnProperty;
15
- const hasOwn = (val, key) => hasOwnProperty.call(val, key);
16
- const isArray = Array.isArray;
17
- const isMap = (val) => toTypeString(val) === "[object Map]";
18
- const isFunction = (val) => typeof val === "function";
19
- const isString = (val) => typeof val === "string";
20
- const isSymbol = (val) => typeof val === "symbol";
21
- const isObject = (val) => val !== null && typeof val === "object";
22
- const objectToString = Object.prototype.toString;
23
- const toTypeString = (value) => objectToString.call(value);
24
- const toRawType = (value) => {
25
- return toTypeString(value).slice(8, -1);
26
- };
27
- const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
28
- const cacheStringFunction = (fn) => {
29
- const cache = /* @__PURE__ */ Object.create(null);
30
- return (str) => {
31
- const hit = cache[str];
32
- return hit || (cache[str] = fn(str));
33
- };
34
- };
35
- const capitalize = cacheStringFunction(
36
- (str) => str.charAt(0).toUpperCase() + str.slice(1)
37
- );
38
- const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
39
- const def = (obj, key, value) => {
40
- Object.defineProperty(obj, key, {
41
- configurable: true,
42
- enumerable: false,
43
- value
44
- });
45
- };
46
22
  export {
47
- NOOP,
48
- capitalize,
49
- def,
50
- extend,
51
- hasChanged,
52
- hasOwn,
53
- isArray,
54
- isFunction,
55
- isIntegerKey,
56
- isMap,
57
- isObject,
58
- isString,
59
- isSymbol,
60
- makeMap,
61
- objectToString,
62
- toRawType,
63
- toTypeString
23
+ isPerformanceSupported,
24
+ now
64
25
  };
package/dist/main.es9.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import styled from "./main.es7.js";
2
- import _sfc_main$1 from "./main.es15.js";
2
+ import _sfc_main$1 from "./main.es17.js";
3
3
  import theme from "./main.es8.js";
4
4
  import "./main.es3.js";
5
5
  import _export_sfc from "./main.es11.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_reusable_components",
3
- "version": "8.40.5",
3
+ "version": "8.40.6",
4
4
  "files": [
5
5
  "dist",
6
6
  "src"
@@ -45,6 +45,7 @@
45
45
  ? calculatePercentageTotal(item.label) !== 100
46
46
  : false
47
47
  "
48
+ :is-relative-error-message="true"
48
49
  :min-decimals="0"
49
50
  :number-precision="fieldMode === 'percentage' ? 2 : 0"
50
51
  text-align="center"
@@ -44,7 +44,7 @@ export const FieldsWrapper = styled.div`
44
44
 
45
45
  export const InputRow = styled.div`
46
46
  display: flex;
47
- align-items: center;
47
+ align-items: flex-start;
48
48
  justify-content: space-around;
49
49
  gap: 8px;
50
50
  padding-left: 12px;
@@ -63,7 +63,6 @@ export const InputGroup = styled('div', {
63
63
  display: flex;
64
64
  justify-content: center;
65
65
  position: relative;
66
-
67
66
  input[readonly] {
68
67
  border: 1px solid ${(props) => props.theme.colors.grey4} !important;
69
68
  }
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <ComponentWrapper>
3
- <TextOverlay :margin-top="marginTop">
3
+ <TextOverlay :is-relative="isRelative" :margin-top="marginTop">
4
4
  <slot></slot>
5
5
  </TextOverlay>
6
6
  </ComponentWrapper>
@@ -13,9 +13,10 @@
13
13
 
14
14
  import styled from 'vue3-styled-components'
15
15
 
16
- const TextOverlay = styled('div', { marginTop: String })`
17
- position: absolute;
18
- top: calc(100% + ${(props) => props.marginTop});
16
+ const TextOverlay = styled('div', { marginTop: String, isRelative: Boolean })`
17
+ position: ${(props) => (props.isRelative ? 'relative' : 'absolute')};
18
+ top: ${(props) =>
19
+ props.isRelative ? '8px' : `calc(100% + ${props.marginTop})`};
19
20
  background: ${(props) => props.theme.colors.red};
20
21
  padding: 10px;
21
22
  width: max-content;
@@ -26,7 +27,7 @@
26
27
  border-radius: 4px;
27
28
  z-index: 999;
28
29
  color: ${(props) => props.theme.colors.white};
29
-
30
+ margin-bottom: 8px;
30
31
  :before {
31
32
  content: '';
32
33
  background-color: ${(props) => props.theme.colors.red};
@@ -51,6 +52,10 @@
51
52
  ComponentWrapper,
52
53
  },
53
54
  props: {
55
+ isRelative: {
56
+ required: false,
57
+ default: false,
58
+ },
54
59
  marginTop: {
55
60
  required: false,
56
61
  default: '13px',
@@ -1,5 +1,9 @@
1
1
  <template>
2
- <Container :align-items="alignItems" :input-width="inputWidth">
2
+ <Container
3
+ :align-items="alignItems"
4
+ :input-width="inputWidth"
5
+ :is-relative-error-message="isRelativeErrorMessage"
6
+ >
3
7
  <LabelSlotWrapper
4
8
  v-if="hasLabelSlot"
5
9
  :align-items="alignItems"
@@ -193,9 +197,12 @@
193
197
  </ArrowButton>
194
198
  </ArrowControls>
195
199
  </InputWrapper>
196
- <ErrorMessage v-if="isError && errorMessage">{{
197
- errorMessage
198
- }}</ErrorMessage>
200
+
201
+ <ErrorMessage
202
+ v-if="isError && errorMessage"
203
+ :is-relative="isRelativeErrorMessage"
204
+ >{{ errorMessage }}</ErrorMessage
205
+ >
199
206
  </Container>
200
207
  </template>
201
208
 
@@ -270,14 +277,15 @@
270
277
  readOnly: Boolean,
271
278
  isBorderErrorOnly: Boolean,
272
279
  isInfoBorder: Boolean,
280
+ isRelativeErrorMessage: Boolean,
273
281
  }
274
-
275
282
  const Container = styled('div', inputProps)`
276
283
  width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
277
284
  position: relative;
278
- display: grid;
285
+ display: ${(props) => (props.isRelativeErrorMessage ? 'flex' : 'grid')};
279
286
  grid-template-columns: ${(props) =>
280
287
  props.alignItems === 'vertical' ? '1fr' : 'auto 1fr'};
288
+ ${(props) => props.isRelativeErrorMessage && 'flex-direction: column'};
281
289
  `
282
290
 
283
291
  const InputContainer = styled('input', inputProps)`
@@ -811,6 +819,10 @@
811
819
  type: Boolean,
812
820
  default: false,
813
821
  },
822
+ isRelativeErrorMessage: {
823
+ type: Boolean,
824
+ default: false,
825
+ },
814
826
  },
815
827
  data() {
816
828
  return {