@ptsecurity/mosaic 14.7.1 → 14.8.0

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.
Files changed (93) hide show
  1. package/_theming.scss +22 -9
  2. package/_visual.scss +8 -3
  3. package/core/pop-up/constants.d.ts +2 -1
  4. package/design-tokens/legacy-2017/tokens/components/link.json5 +8 -2
  5. package/design-tokens/legacy-2017/tokens/components/markdown.json5 +2 -2
  6. package/design-tokens/legacy-2017/tokens/components/modal.json5 +1 -1
  7. package/design-tokens/legacy-2017/tokens/components/popover.json5 +1 -1
  8. package/design-tokens/legacy-2017/tokens/components/sidepanel.json5 +5 -0
  9. package/design-tokens/legacy-2017/tokens.d.ts +8 -3
  10. package/design-tokens/pt-2022/tokens/components/link.json5 +8 -2
  11. package/design-tokens/pt-2022/tokens/components/markdown.json5 +2 -2
  12. package/design-tokens/pt-2022/tokens/components/modal.json5 +1 -1
  13. package/design-tokens/pt-2022/tokens/components/popover.json5 +1 -1
  14. package/design-tokens/pt-2022/tokens/components/sidepanel.json5 +5 -0
  15. package/design-tokens/pt-2022/tokens.d.ts +8 -3
  16. package/design-tokens/style-dictionary/build.js +0 -13
  17. package/design-tokens/style-dictionary/configs/index.js +1 -3
  18. package/esm2020/core/pop-up/constants.mjs +4 -2
  19. package/esm2020/core/pop-up/pop-up-trigger.mjs +2 -1
  20. package/esm2020/core/version.mjs +2 -2
  21. package/esm2020/design-tokens/legacy-2017/tokens.mjs +9 -4
  22. package/esm2020/design-tokens/pt-2022/tokens.mjs +9 -4
  23. package/esm2020/link/link.component.mjs +12 -2
  24. package/esm2020/modal/modal.component.mjs +4 -4
  25. package/esm2020/modal/modal.type.mjs +4 -2
  26. package/esm2020/popover/popover-confirm.component.mjs +2 -2
  27. package/esm2020/popover/popover.component.mjs +6 -6
  28. package/esm2020/select/select.component.mjs +11 -3
  29. package/esm2020/select/select.module.mjs +8 -4
  30. package/esm2020/sidepanel/sidepanel-config.mjs +8 -1
  31. package/esm2020/sidepanel/sidepanel-container.component.mjs +7 -3
  32. package/esm2020/timezone/timezone-select.component.mjs +3 -3
  33. package/esm2020/toast/toast-container.component.mjs +2 -2
  34. package/fesm2015/ptsecurity-mosaic-core.mjs +5 -2
  35. package/fesm2015/ptsecurity-mosaic-core.mjs.map +1 -1
  36. package/fesm2015/ptsecurity-mosaic-design-tokens.mjs +25 -10
  37. package/fesm2015/ptsecurity-mosaic-design-tokens.mjs.map +1 -1
  38. package/fesm2015/ptsecurity-mosaic-link.mjs +11 -1
  39. package/fesm2015/ptsecurity-mosaic-link.mjs.map +1 -1
  40. package/fesm2015/ptsecurity-mosaic-modal.mjs +6 -4
  41. package/fesm2015/ptsecurity-mosaic-modal.mjs.map +1 -1
  42. package/fesm2015/ptsecurity-mosaic-popover.mjs +7 -7
  43. package/fesm2015/ptsecurity-mosaic-popover.mjs.map +1 -1
  44. package/fesm2015/ptsecurity-mosaic-select.mjs +17 -5
  45. package/fesm2015/ptsecurity-mosaic-select.mjs.map +1 -1
  46. package/fesm2015/ptsecurity-mosaic-sidepanel.mjs +14 -3
  47. package/fesm2015/ptsecurity-mosaic-sidepanel.mjs.map +1 -1
  48. package/fesm2015/ptsecurity-mosaic-timezone.mjs +2 -2
  49. package/fesm2015/ptsecurity-mosaic-timezone.mjs.map +1 -1
  50. package/fesm2015/ptsecurity-mosaic-toast.mjs +2 -2
  51. package/fesm2015/ptsecurity-mosaic-toast.mjs.map +1 -1
  52. package/fesm2020/ptsecurity-mosaic-core.mjs +5 -2
  53. package/fesm2020/ptsecurity-mosaic-core.mjs.map +1 -1
  54. package/fesm2020/ptsecurity-mosaic-design-tokens.mjs +25 -10
  55. package/fesm2020/ptsecurity-mosaic-design-tokens.mjs.map +1 -1
  56. package/fesm2020/ptsecurity-mosaic-link.mjs +11 -1
  57. package/fesm2020/ptsecurity-mosaic-link.mjs.map +1 -1
  58. package/fesm2020/ptsecurity-mosaic-modal.mjs +6 -4
  59. package/fesm2020/ptsecurity-mosaic-modal.mjs.map +1 -1
  60. package/fesm2020/ptsecurity-mosaic-popover.mjs +7 -7
  61. package/fesm2020/ptsecurity-mosaic-popover.mjs.map +1 -1
  62. package/fesm2020/ptsecurity-mosaic-select.mjs +17 -5
  63. package/fesm2020/ptsecurity-mosaic-select.mjs.map +1 -1
  64. package/fesm2020/ptsecurity-mosaic-sidepanel.mjs +14 -3
  65. package/fesm2020/ptsecurity-mosaic-sidepanel.mjs.map +1 -1
  66. package/fesm2020/ptsecurity-mosaic-timezone.mjs +2 -2
  67. package/fesm2020/ptsecurity-mosaic-timezone.mjs.map +1 -1
  68. package/fesm2020/ptsecurity-mosaic-toast.mjs +2 -2
  69. package/fesm2020/ptsecurity-mosaic-toast.mjs.map +1 -1
  70. package/link/link.component.d.ts +4 -1
  71. package/modal/modal.type.d.ts +2 -1
  72. package/package.json +13 -4
  73. package/prebuilt-themes/dark-theme.css +1 -1
  74. package/prebuilt-themes/default-theme.css +1 -1
  75. package/select/select.component.d.ts +5 -1
  76. package/select/select.module.d.ts +1 -1
  77. package/sidepanel/sidepanel-config.d.ts +6 -0
  78. package/sidepanel/sidepanel-container.component.d.ts +1 -0
  79. package/design-tokens/style-dictionary/configs/figma.js +0 -11
  80. package/design-tokens/style-dictionary/figma-types.js +0 -41
  81. package/design-tokens/style-dictionary/formats/figma.js +0 -104
  82. package/design-tokens/style-dictionary/transformGroups/figma.js +0 -21
  83. package/design-tokens/style-dictionary/transforms/attribute/figma-border.js +0 -18
  84. package/design-tokens/style-dictionary/transforms/attribute/figma-color.js +0 -25
  85. package/design-tokens/style-dictionary/transforms/attribute/figma-default.js +0 -10
  86. package/design-tokens/style-dictionary/transforms/attribute/figma-font.js +0 -31
  87. package/design-tokens/style-dictionary/transforms/attribute/figma-group.js +0 -17
  88. package/design-tokens/style-dictionary/transforms/attribute/figma-opacity.js +0 -10
  89. package/design-tokens/style-dictionary/transforms/attribute/figma-shadow.js +0 -66
  90. package/design-tokens/style-dictionary/transforms/attribute/figma-sizing.js +0 -16
  91. package/design-tokens/style-dictionary/transforms/attribute/figma-spacing.js +0 -15
  92. package/design-tokens/style-dictionary/transforms/attribute/figma-typography.js +0 -24
  93. package/design-tokens/style-dictionary/transforms/value/figma-values.js +0 -7
@@ -1,104 +0,0 @@
1
- const { typographySingleTypes, figmaTypes } = require('../figma-types');
2
- const setProperty = require('lodash/set');
3
-
4
- const JSON_INDENTATION = 2;
5
-
6
- function buildTypography(tokens) {
7
- return {
8
- value: Object.entries(tokens).reduce(
9
- (accum, [, item]) => {
10
- const { value, attributes: { figmaPropType }} = item;
11
- accum[figmaPropType] = cleanValue(value);
12
-
13
- return accum;
14
- },
15
- {}
16
- ),
17
- type: figmaTypes.typography
18
- };
19
- }
20
-
21
- function rebuildTokes(tokens, parentCategory = null) {
22
- if (tokens.value === undefined) {
23
- const firstItemType = Object.values(tokens)[0] ?.attributes?.figmaPropType;
24
- if (Object.values(typographySingleTypes).includes(firstItemType)) {
25
- return buildTypography(tokens);
26
- }
27
-
28
- return Object.entries(tokens).reduce(
29
- (accum, [tokenKey, tokenValue]) => {
30
- accum[tokenKey] = cleanValue(rebuildTokes(tokenValue, parentCategory));
31
-
32
- return accum;
33
- },
34
- {}
35
- );
36
- }
37
-
38
- if (typeof tokens.value === 'object') {
39
- return rebuildTokes(tokens.value, tokens.attributes.category);
40
- }
41
-
42
- let { category, figmaPropType, figmaValue, figmaLink } = tokens.attributes;
43
- const { original } = tokens;
44
- figmaValue = figmaLink ? `{${figmaValue}}` : figmaValue;
45
- let value = figmaValue ?? original.value;
46
-
47
- if (parentCategory && category !== parentCategory) {
48
- value = buildRefFromAttributes(tokens.attributes);
49
- }
50
-
51
- return { value: cleanValue(value), type: figmaPropType };
52
- }
53
-
54
- function cleanValue(value) {
55
- return typeof value === 'string' ? value.replace(/\.value\./g, '.') : value;
56
- }
57
-
58
- function buildRefFromAttributes(attributes) {
59
- const { category, type, item, subitem } = attributes;
60
- const ref = [category, type, item, subitem].filter((refPart) => !!refPart);
61
-
62
- return `{${ref.join('.')}}`;
63
- }
64
-
65
- function findLastLeafAttributes(property) {
66
- if (!property.attributes) {
67
- return findLastLeafAttributes(property[Object.keys(property)[0]]);
68
- }
69
-
70
- return property.attributes;
71
- }
72
-
73
- function prepareFigmaTitle(value) {
74
- return value
75
- .replace(/-/g, ' ')
76
- .split(' ')
77
- .map((titlePart) => titlePart.charAt(0).toUpperCase() + titlePart.slice(1))
78
- .join(' ');
79
- }
80
-
81
- module.exports = (styleDictionary) => {
82
- styleDictionary.registerFormat({
83
- name: 'figmaTokensPlugin',
84
- formatter: ({ dictionary }) => {
85
- const groupedDict = Object.entries(dictionary.tokens)
86
- .filter(([, propValue]) => typeof propValue === 'object')
87
- .reduce(
88
- (accum, [propName, propValue]) => {
89
- const { group, subgroup } = findLastLeafAttributes(propValue);
90
- const propPath = group === 'properties'
91
- ? `${prepareFigmaTitle(group)}.${propName}`
92
- : `${prepareFigmaTitle(subgroup)}.${propName}`;
93
- setProperty(accum, propPath, propValue);
94
-
95
- return accum;
96
- },
97
- {}
98
- );
99
- const figmaTokens = rebuildTokes(groupedDict);
100
-
101
- return JSON.stringify(figmaTokens, null, JSON_INDENTATION);
102
- }
103
- });
104
- };
@@ -1,21 +0,0 @@
1
- module.exports = (StyleDictionary) => {
2
-
3
- StyleDictionary.registerTransformGroup({
4
- name: 'mc/figma',
5
- transforms: [
6
- 'attribute/cti',
7
- "name/cti/kebab",
8
- 'mc-attribute/figma-group',
9
- 'mc-attribute/figma-border',
10
- 'mc-attribute/figma-typography',
11
- 'mc-attribute/figma-font',
12
- 'mc-attribute/figma-opacity',
13
- 'mc-attribute/figma-spacing',
14
- 'mc-attribute/figma-sizing',
15
- 'mc-attribute/figma-shadow',
16
- 'mc-attribute/figma-color',
17
- 'mc-attribute/figma-default',
18
- 'mc-value/figma-values',
19
- ]
20
- });
21
- };
@@ -1,18 +0,0 @@
1
- const { figmaTypes } = require('../../figma-types');
2
-
3
- module.exports = (styleDictionary) => {
4
- styleDictionary.registerTransform({
5
- name: 'mc-attribute/figma-border',
6
- type: 'attribute',
7
- matcher: ({ name, attributes }) => name.includes('border') && !attributes.figmaPropType,
8
- transformer: ({ name, attributes }) => {
9
- const props = {
10
- width: figmaTypes.borderWidth,
11
- radius: figmaTypes.borderRadius
12
- };
13
- const entry = Object.entries(props).find(([key]) => name.includes(key));
14
-
15
- return entry ? { figmaPropType: entry[1] } : attributes;
16
- }
17
- });
18
- };
@@ -1,25 +0,0 @@
1
- const { figmaTypes } = require('../../figma-types');
2
-
3
- const COLOR_MAX_PARTS = 4;
4
-
5
- module.exports = (styleDictionary) => {
6
- styleDictionary.registerTransform({
7
- name: 'mc-attribute/figma-color',
8
- type: 'attribute',
9
- matcher: ({name, value, attributes: { category, figmaPropType }}) => {
10
- if (figmaPropType) {
11
- return false;
12
- }
13
-
14
- const stringValue = value.toString();
15
- const isColorValue = (
16
- stringValue.startsWith('#') ||
17
- stringValue.startsWith('rgba') ||
18
- name.includes('color')
19
- ) && stringValue.split(' ').length <= COLOR_MAX_PARTS;
20
-
21
- return isColorValue || category === 'palette';
22
- },
23
- transformer: () => ({ figmaPropType: figmaTypes.color })
24
- });
25
- };
@@ -1,10 +0,0 @@
1
- const { figmaTypes } = require('../../figma-types');
2
-
3
- module.exports = (styleDictionary) => {
4
- styleDictionary.registerTransform({
5
- name: 'mc-attribute/figma-default',
6
- type: 'attribute',
7
- matcher: ({ attributes }) => !attributes.figmaPropType,
8
- transformer: () => ({ figmaPropType: figmaTypes.other })
9
- });
10
- };
@@ -1,31 +0,0 @@
1
- const { figmaTypes } = require('../../figma-types');
2
-
3
- module.exports = (styleDictionary) => {
4
- styleDictionary.registerTransform({
5
- name: 'mc-attribute/figma-font',
6
- type: 'attribute',
7
- matcher: ({ name, attributes }) => name.includes('font') && !attributes.figmaPropType,
8
- transformer: ({ name, value }) => {
9
- const props = {
10
- family: figmaTypes.fontFamilies,
11
- size: figmaTypes.fontSizes,
12
- weight: figmaTypes.fontWeights,
13
- height: figmaTypes.lineHeights,
14
- spacing: figmaTypes.letterSpacing,
15
- transform: figmaTypes.textCase,
16
- settings: figmaTypes.fontFeatureSettings
17
- };
18
- const [, typeName] = Object.entries(props).find(([key]) => name.includes(key)) ?? [];
19
-
20
- if (!typeName) {
21
- return {
22
- figmaPropType: 'typography',
23
- figmaValue: `typography.${value}`,
24
- figmaLink: true
25
- };
26
- }
27
-
28
- return { figmaPropType: typeName };
29
- }
30
- });
31
- };
@@ -1,17 +0,0 @@
1
- const path = require('path');
2
-
3
- const GROUP_BACK_STEP_INDEX = 2;
4
-
5
- module.exports = (styleDictionary) => {
6
- styleDictionary.registerTransform({
7
- name: 'mc-attribute/figma-group',
8
- type: 'attribute',
9
- transformer: (prop) => {
10
- const filePathParts = prop.filePath.split('/');
11
- const group = filePathParts[filePathParts.length - GROUP_BACK_STEP_INDEX];
12
- const subgroup = path.parse(prop.filePath).name;
13
-
14
- return { group, subgroup };
15
- }
16
- });
17
- };
@@ -1,10 +0,0 @@
1
- const { figmaTypes } = require('../../figma-types');
2
-
3
- module.exports = (styleDictionary) => {
4
- styleDictionary.registerTransform({
5
- name: 'mc-attribute/figma-opacity',
6
- type: 'attribute',
7
- matcher: ({ name, attributes }) => name.includes('opacity') && !attributes.figmaPropType,
8
- transformer: () => ({ figmaPropType: figmaTypes.opacity })
9
- });
10
- };
@@ -1,66 +0,0 @@
1
- const { figmaTypes } = require('../../figma-types');
2
-
3
- const BLUR_SHADOW_INDEX = 2;
4
- const SPREAD_SHADOW_INDEX = 3;
5
- const X_SHADOW_INDEX = 0;
6
- const Y_SHADOW_INDEX = 1;
7
- const SHADOW_MIN_PARTS = 4;
8
-
9
- function transformShadow(value) {
10
- const isInnerShadow = value.includes('inset');
11
- const valueParts = value.split(' ');
12
-
13
- if (isInnerShadow) {
14
- valueParts.shift();
15
- }
16
-
17
- return {
18
- color: valueParts.pop(),
19
- type: isInnerShadow ? 'innerShadow' : 'dropShadow',
20
- x: valueParts[X_SHADOW_INDEX] ?? 0,
21
- y: valueParts[Y_SHADOW_INDEX] ?? 0,
22
- blur: valueParts[BLUR_SHADOW_INDEX] ?? 0,
23
- spread: valueParts[SPREAD_SHADOW_INDEX] ?? 0
24
- };
25
- }
26
-
27
- module.exports = (styleDictionary) => {
28
- styleDictionary.registerTransform({
29
- name: 'mc-attribute/figma-shadow',
30
- type: 'attribute',
31
- matcher: ({name, value, attributes }) => (
32
- name.includes('shadow') &&
33
- value.split(' ').length > SHADOW_MIN_PARTS &&
34
- !attributes.figmaPropType
35
- ),
36
- transformer: ({ value }) => {
37
- const rgbaGroups = [];
38
- let figmaValue = value;
39
-
40
- const check = figmaValue.match(/(rgba\([\w\d\. \,]+\))/) ?? [];
41
-
42
- for (let i = 1; i < check.length; i++) {
43
- figmaValue = figmaValue.replace(check[i], `rgba${i - 1}`);
44
- rgbaGroups.push(check[i]);
45
- }
46
-
47
- const shadowParts = figmaValue.split(',');
48
- figmaValue = shadowParts.length > 1
49
- ? shadowParts.map(transformShadow)
50
- : transformShadow(figmaValue);
51
-
52
- rgbaGroups.forEach((rgbaValue, rgbaIndex) => {
53
- if (Array.isArray(figmaValue)) {
54
- figmaValue.forEach((shadow) => {
55
- shadow.color = shadow.color.replace(`rgba${rgbaIndex}`, rgbaValue);
56
- });
57
-
58
- return;
59
- }
60
- figmaValue.color = figmaValue.color.replace(`rgba${rgbaIndex}`, rgbaValue);
61
- });
62
-
63
- return { figmaPropType: figmaTypes.boxShadow, figmaValue };
64
- }
65
- });
66
- };
@@ -1,16 +0,0 @@
1
- const { figmaTypes } = require('../../figma-types');
2
-
3
- module.exports = (styleDictionary) => {
4
- styleDictionary.registerTransform({
5
- name: 'mc-attribute/figma-sizing',
6
- type: 'attribute',
7
- matcher: ({name, attributes}) => (
8
- (
9
- name.includes('height') ||
10
- name.includes('width') ||
11
- name.includes('size')
12
- ) && !attributes.figmaPropType
13
- ),
14
- transformer: () => ({ figmaPropType: figmaTypes.sizing })
15
- });
16
- };
@@ -1,15 +0,0 @@
1
- const { figmaTypes } = require('../../figma-types');
2
-
3
- module.exports = (styleDictionary) => {
4
- styleDictionary.registerTransform({
5
- name: 'mc-attribute/figma-spacing',
6
- type: 'attribute',
7
- matcher: ({name, attributes}) => (
8
- (
9
- name.includes('padding') ||
10
- name.includes('margin')
11
- ) && !attributes.figmaPropType
12
- ),
13
- transformer: (() => ({ figmaPropType: figmaTypes.spacing }))
14
- });
15
- };
@@ -1,24 +0,0 @@
1
- const { figmaTypes } = require('../../figma-types');
2
-
3
- module.exports = (styleDictionary) => {
4
- styleDictionary.registerTransform({
5
- name: 'mc-attribute/figma-typography',
6
- type: 'attribute',
7
- matcher: ({ name, attributes}) => name.includes('typography') && !attributes.figmaPropType,
8
- transformer: ({ name, attributes }) => {
9
- const props = {
10
- spacing: figmaTypes.letterSpacing,
11
- transform: figmaTypes.textCase,
12
- settings: figmaTypes.fontFeatureSettings,
13
- family: figmaTypes.fontFamily,
14
- size: figmaTypes.fontSize,
15
- weight: figmaTypes.fontWeight,
16
- height: figmaTypes.lineHeight
17
- };
18
-
19
- const entry = Object.entries(props).find(([key]) => name.includes(key));
20
-
21
- return entry ? { figmaPropType: entry[1] } : attributes;
22
- }
23
- });
24
- };
@@ -1,7 +0,0 @@
1
- module.exports = (styleDictionary) => {
2
- styleDictionary.registerTransform({
3
- name: 'mc-value/figma-values',
4
- type: 'value',
5
- transformer: ({ value }) => value === 'null' ? 'none' : value
6
- });
7
- };