@swisspost/design-system-components 1.3.1 → 1.3.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/dist/cjs/check-type-f24cf91d.js +24 -0
- package/dist/cjs/check-type-f24cf91d.js.map +1 -0
- package/dist/cjs/{index-8880977f.js → index-a8b23f1b.js} +1 -1
- package/dist/cjs/{index-8880977f.js.map → index-a8b23f1b.js.map} +1 -1
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/loader.cjs.js.map +1 -1
- package/dist/cjs/post-collapsible.cjs.entry.js +11 -19
- package/dist/cjs/post-collapsible.cjs.entry.js.map +1 -1
- package/dist/cjs/post-components.cjs.js +3 -3
- package/dist/cjs/post-components.cjs.js.map +1 -1
- package/dist/cjs/post-icon.cjs.entry.js +39 -29
- package/dist/cjs/post-icon.cjs.entry.js.map +1 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/post-collapsible/post-collapsible.css +1251 -3863
- package/dist/collection/components/post-collapsible/post-collapsible.js +12 -10
- package/dist/collection/components/post-collapsible/post-collapsible.js.map +1 -1
- package/dist/collection/components/post-icon/post-icon.js +41 -46
- package/dist/collection/components/post-icon/post-icon.js.map +1 -1
- package/dist/collection/utils/get-element-height.js +0 -3
- package/dist/collection/utils/get-element-height.js.map +1 -1
- package/dist/collection/utils/index.js +0 -3
- package/dist/collection/utils/index.js.map +1 -1
- package/dist/collection/utils/on-transition-end.js +0 -3
- package/dist/collection/utils/on-transition-end.js.map +1 -1
- package/dist/collection/utils/property-checkers/check-one-of.js +5 -0
- package/dist/collection/utils/property-checkers/check-one-of.js.map +1 -0
- package/dist/collection/utils/property-checkers/check-type.js +13 -0
- package/dist/collection/utils/property-checkers/check-type.js.map +1 -0
- package/dist/collection/utils/property-checkers/empty-or.js +9 -0
- package/dist/collection/utils/property-checkers/empty-or.js.map +1 -0
- package/dist/collection/utils/property-checkers/index.js +8 -0
- package/dist/collection/utils/property-checkers/index.js.map +1 -0
- package/dist/collection/utils/should-reduce-motion.js +0 -3
- package/dist/collection/utils/should-reduce-motion.js.map +1 -1
- package/dist/components/check-type.js +21 -0
- package/dist/components/check-type.js.map +1 -0
- package/dist/components/post-collapsible.js +12 -19
- package/dist/components/post-collapsible.js.map +1 -1
- package/dist/components/post-icon.js +37 -30
- package/dist/components/post-icon.js.map +1 -1
- package/dist/docs.json +2 -2
- package/dist/esm/check-type-67411ed3.js +21 -0
- package/dist/esm/check-type-67411ed3.js.map +1 -0
- package/dist/esm/{index-6d5a72fa.js → index-401f2d6a.js} +1 -1
- package/dist/esm/{index-6d5a72fa.js.map → index-401f2d6a.js.map} +1 -1
- package/dist/esm/loader.js +4 -4
- package/dist/esm/loader.js.map +1 -1
- package/dist/esm/post-collapsible.entry.js +10 -18
- package/dist/esm/post-collapsible.entry.js.map +1 -1
- package/dist/esm/post-components.js +4 -4
- package/dist/esm/post-components.js.map +1 -1
- package/dist/esm/post-icon.entry.js +35 -25
- package/dist/esm/post-icon.entry.js.map +1 -1
- package/dist/post-components/{p-d1bc7b0b.entry.js → p-07a51673.entry.js} +2 -2
- package/dist/post-components/p-07a51673.entry.js.map +1 -0
- package/dist/post-components/p-416f1e74.entry.js +2 -0
- package/dist/post-components/p-416f1e74.entry.js.map +1 -0
- package/dist/post-components/{p-a93114b9.js → p-f214c52a.js} +1 -1
- package/dist/post-components/{p-a93114b9.js.map → p-f214c52a.js.map} +1 -1
- package/dist/post-components/p-f549b3fc.js +2 -0
- package/dist/post-components/p-f549b3fc.js.map +1 -0
- package/dist/post-components/post-components.esm.js +1 -1
- package/dist/post-components/post-components.esm.js.map +1 -1
- package/dist/types/components/post-collapsible/post-collapsible.d.ts +14 -13
- package/dist/types/components/post-icon/post-icon.d.ts +22 -22
- package/dist/types/utils/property-checkers/check-one-of.d.ts +1 -0
- package/dist/types/utils/property-checkers/check-type.d.ts +2 -0
- package/dist/types/utils/property-checkers/empty-or.d.ts +1 -0
- package/dist/types/utils/property-checkers/index.d.ts +4 -0
- package/package.json +17 -11
- package/dist/cjs/property-checkers-586ad9d4.js +0 -40
- package/dist/cjs/property-checkers-586ad9d4.js.map +0 -1
- package/dist/collection/utils/property-checkers.js +0 -31
- package/dist/collection/utils/property-checkers.js.map +0 -1
- package/dist/components/property-checkers.js +0 -34
- package/dist/components/property-checkers.js.map +0 -1
- package/dist/esm/property-checkers-484ca671.js +0 -34
- package/dist/esm/property-checkers-484ca671.js.map +0 -1
- package/dist/post-components/p-7cd9c1ad.js +0 -2
- package/dist/post-components/p-7cd9c1ad.js.map +0 -1
- package/dist/post-components/p-b07185a3.entry.js +0 -2
- package/dist/post-components/p-b07185a3.entry.js.map +0 -1
- package/dist/post-components/p-d1bc7b0b.entry.js.map +0 -1
- package/dist/types/utils/property-checkers.d.ts +0 -5
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function checkOneOf(value, possibleValues, error) {
|
|
4
|
+
if (!possibleValues.includes(value))
|
|
5
|
+
throw new Error(error);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function checkType(value, type, error) {
|
|
9
|
+
const typeIsArray = type === 'array';
|
|
10
|
+
const valueIsArray = Array.isArray(value);
|
|
11
|
+
if (typeIsArray || valueIsArray) {
|
|
12
|
+
if (valueIsArray !== typeIsArray)
|
|
13
|
+
throw new Error(error);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
if (typeof value !== type)
|
|
17
|
+
throw new Error(error);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
exports.checkOneOf = checkOneOf;
|
|
22
|
+
exports.checkType = checkType;
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=check-type-f24cf91d.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"check-type-f24cf91d.js","mappings":";;SAAgB,UAAU,CAAI,KAAQ,EAAE,cAAmB,EAAE,KAAa;EACxE,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC;IAAE,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;AAC9D;;SCMgB,SAAS,CAAC,KAAc,EAAE,IAAkB,EAAE,KAAa;EACzE,MAAM,WAAW,GAAG,IAAI,KAAK,OAAO,CAAC;EACrC,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;EAE1C,IAAI,WAAW,IAAI,YAAY,EAAE;IAC/B,IAAI,YAAY,KAAK,WAAW;MAAE,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;GAC1D;OAAM;IACL,IAAI,OAAO,KAAK,KAAK,IAAI;MAAE,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;GACnD;AACH;;;;;","names":[],"sources":["./src/utils/property-checkers/check-one-of.ts","./src/utils/property-checkers/check-type.ts"],"sourcesContent":["export function checkOneOf<T>(value: T, possibleValues: T[], error: string) {\n if (!possibleValues.includes(value)) throw new Error(error);\n}\n","export type PropertyType =\n | 'boolean'\n | 'number'\n | 'string'\n | 'array'\n | 'object'\n | 'function';\n\nexport function checkType(value: unknown, type: PropertyType, error: string) {\n const typeIsArray = type === 'array';\n const valueIsArray = Array.isArray(value);\n\n if (typeIsArray || valueIsArray) {\n if (valueIsArray !== typeIsArray) throw new Error(error);\n } else {\n if (typeof value !== type) throw new Error(error);\n }\n}\n"],"version":3}
|