@rededor/cura 0.2.0 → 0.3.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 (96) hide show
  1. package/dist/cjs/app-globals-5f5b9fbf.js +398 -0
  2. package/dist/cjs/cura-display_3.cjs.entry.js +187 -0
  3. package/dist/cjs/cura-icon.cjs.entry.js +59 -0
  4. package/dist/cjs/{cura-icon_2.cjs.entry.js → cura-icons-view.cjs.entry.js} +2 -56
  5. package/dist/cjs/cura.cjs.js +3 -3
  6. package/dist/cjs/{index-9092c64d.js → index-8686299e.js} +29 -0
  7. package/dist/cjs/loader.cjs.js +3 -3
  8. package/dist/collection/api/cura-api.js +10 -1
  9. package/dist/collection/api/modules/cura-theme-colors-module.js +69 -0
  10. package/dist/collection/api/modules/cura-theme-fonts-module.js +35 -0
  11. package/dist/collection/api/modules/cura-theme-module.js +4 -0
  12. package/dist/collection/api/theme-presets/static.js +103 -0
  13. package/dist/collection/api/theme-presets/theme-default.js +28 -22
  14. package/dist/collection/api/theme-presets/theme-maternity.js +10 -12
  15. package/dist/collection/collection-manifest.json +3 -1
  16. package/dist/collection/components/cura-icon/cura-icon.css +1 -42
  17. package/dist/collection/components/cura-icon/cura-icon.js +15 -12
  18. package/dist/collection/components/cura-icons-view/cura-icons-view.js +1 -1
  19. package/dist/collection/components/text/cura-display/cura-display.css +61 -0
  20. package/dist/collection/components/text/cura-display/cura-display.js +110 -0
  21. package/dist/collection/components/text/cura-heading/cura-heading.css +69 -0
  22. package/dist/collection/components/text/cura-heading/cura-heading.js +136 -0
  23. package/dist/collection/components/text/cura-paragraph/cura-paragraph.css +81 -0
  24. package/dist/collection/components/text/cura-paragraph/cura-paragraph.js +76 -0
  25. package/dist/components/{dummy-component.d.ts → cura-display.d.ts} +4 -4
  26. package/dist/components/cura-display.js +86 -0
  27. package/dist/components/cura-heading.d.ts +11 -0
  28. package/dist/components/cura-heading.js +95 -0
  29. package/dist/components/cura-icon2.js +12 -13
  30. package/dist/components/cura-icons-view.js +1 -1
  31. package/dist/components/cura-paragraph.d.ts +11 -0
  32. package/dist/components/cura-paragraph.js +69 -0
  33. package/dist/components/index.d.ts +3 -1
  34. package/dist/components/index.js +261 -36
  35. package/dist/cura/cura.esm.js +1 -1
  36. package/dist/cura/cura.js +1 -1
  37. package/dist/cura/p-22290742.entry.js +1 -0
  38. package/dist/cura/p-265c1706.js +1 -0
  39. package/dist/cura/p-3d8bbf37.system.js +1 -0
  40. package/dist/cura/p-5ae0d10c.system.entry.js +1 -0
  41. package/dist/cura/p-80dc1c9f.entry.js +1 -0
  42. package/dist/cura/p-9312a846.system.entry.js +1 -0
  43. package/dist/cura/p-a50716bc.js +2 -0
  44. package/dist/cura/p-a8dcaaed.system.js +1 -0
  45. package/dist/cura/p-d29b9e16.entry.js +1 -0
  46. package/dist/cura/p-e447016d.system.js +2 -0
  47. package/dist/cura/p-e8fadcfa.system.entry.js +1 -0
  48. package/dist/esm/app-globals-d7dd3a4d.js +396 -0
  49. package/dist/esm/cura-display_3.entry.js +181 -0
  50. package/dist/esm/cura-icon.entry.js +55 -0
  51. package/dist/esm/{cura-icon_2.entry.js → cura-icons-view.entry.js} +3 -56
  52. package/dist/esm/cura.js +3 -3
  53. package/dist/esm/{index-cec9b650.js → index-c3d31886.js} +29 -0
  54. package/dist/esm/loader.js +3 -3
  55. package/dist/esm-es5/app-globals-d7dd3a4d.js +1 -0
  56. package/dist/esm-es5/cura-display_3.entry.js +1 -0
  57. package/dist/esm-es5/cura-icon.entry.js +1 -0
  58. package/dist/esm-es5/cura-icons-view.entry.js +1 -0
  59. package/dist/esm-es5/cura.js +1 -1
  60. package/dist/esm-es5/index-c3d31886.js +2 -0
  61. package/dist/esm-es5/loader.js +1 -1
  62. package/dist/types/api/cura-api.type.d.ts +9 -0
  63. package/dist/types/api/modules/cura-theme-colors-module.d.ts +48 -0
  64. package/dist/types/api/modules/cura-theme-fonts-module.d.ts +24 -0
  65. package/dist/types/api/modules/cura-theme-module.d.ts +4 -0
  66. package/dist/types/api/theme-presets/static.d.ts +78 -0
  67. package/dist/types/api/theme-presets/theme-default.d.ts +28 -22
  68. package/dist/types/api/theme-presets/theme-maternity.d.ts +23 -19
  69. package/dist/types/api/theme-presets/theme-presets.d.ts +51 -41
  70. package/dist/types/components/cura-icon/cura-icon.d.ts +1 -1
  71. package/dist/types/components/text/cura-display/cura-display.d.ts +28 -0
  72. package/dist/types/components/text/cura-heading/cura-heading.d.ts +33 -0
  73. package/dist/types/components/text/cura-paragraph/cura-paragraph.d.ts +22 -0
  74. package/dist/types/components.d.ts +83 -9
  75. package/package.json +2 -2
  76. package/dist/cjs/app-globals-af978331.js +0 -175
  77. package/dist/cjs/dummy-component.cjs.entry.js +0 -19
  78. package/dist/collection/components/dummy-component/dummy-component.css +0 -3
  79. package/dist/collection/components/dummy-component/dummy-component.js +0 -18
  80. package/dist/components/dummy-component.js +0 -33
  81. package/dist/cura/p-3132f4b7.system.js +0 -2
  82. package/dist/cura/p-70abb532.system.js +0 -1
  83. package/dist/cura/p-81ae13d7.entry.js +0 -1
  84. package/dist/cura/p-a0cd4b75.system.js +0 -1
  85. package/dist/cura/p-abcda1d1.js +0 -2
  86. package/dist/cura/p-ac79f9d1.entry.js +0 -1
  87. package/dist/cura/p-b4c69836.system.entry.js +0 -1
  88. package/dist/cura/p-d2dcd470.js +0 -1
  89. package/dist/cura/p-e1e4b2ea.system.entry.js +0 -1
  90. package/dist/esm/app-globals-962e5cc3.js +0 -173
  91. package/dist/esm/dummy-component.entry.js +0 -15
  92. package/dist/esm-es5/app-globals-962e5cc3.js +0 -1
  93. package/dist/esm-es5/cura-icon_2.entry.js +0 -1
  94. package/dist/esm-es5/dummy-component.entry.js +0 -1
  95. package/dist/esm-es5/index-cec9b650.js +0 -2
  96. package/dist/types/components/dummy-component/dummy-component.d.ts +0 -3
@@ -2,60 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-9092c64d.js');
6
-
7
- const curaIconCss = ":host{--stroke-color:#B7B7B7}:host svg.icon-neutral{--stroke-color:#B7B7B7}:host svg.icon-primary{--stroke-color:var(--cura-color-primary-base, #004186)}:host svg.icon-secondary{--stroke-color:var(--cura-color-secondary-base, #AA8E0B)}:host svg.icon-accent{--stroke-color:var(--cura-color-accent-base, #DF8D2C)}:host svg.icon-success{--stroke-color:#5FD290}:host svg.icon-info{--stroke-color:#6EA8FF}:host svg.icon-error{--stroke-color:#EB5757}:host svg.icon-warning{--stroke-color:#FFCF3C}:host svg.icon-white{--stroke-color:#F6F6F6}:host svg.icon-black{--stroke-color:#262626}:host svg.icon-disabled{--stroke-color:#D4D4D4}:host{width:var(--size);height:var(--size)}:host svg{display:inline-block;stroke:var(--stroke-color);width:var(--size);height:var(--size);stroke-width:var(--stroke);fill:none}";
8
-
9
- const CuraIcon = class {
10
- constructor(hostRef) {
11
- index.registerInstance(this, hostRef);
12
- this.name = '';
13
- this.color = 'neutral';
14
- this.iconset = 'default';
15
- this.disabled = false;
16
- this.sizes = {
17
- "128": { size: 128, stroke: 5.25 },
18
- "72": { size: 72, stroke: 3.5 },
19
- "64": { size: 64, stroke: 3.25 },
20
- "48": { size: 48, stroke: 2.75 },
21
- "40": { size: 40, stroke: 2.5 },
22
- "32": { size: 32, stroke: 2.25 },
23
- "24": { size: 24, stroke: 2 },
24
- "20": { size: 20, stroke: 1.75 },
25
- "16": { size: 16, stroke: 1.5 },
26
- "default": { size: 24, stroke: 2 }
27
- };
28
- }
29
- sizeHandler(size) {
30
- const scaledStroke = (iconSize) => {
31
- return `${this.sizes[iconSize].stroke * (this.sizes.default.size / this.sizes[iconSize].size)}px`;
32
- };
33
- this.setHostProperty('--size', this.sizes[`${size}`] ? `${this.sizes[size].size}px` : `${this.sizes.default.size}px`);
34
- this.setHostProperty('--stroke', this.sizes[`${size}`] ? scaledStroke(size) : scaledStroke("default"));
35
- }
36
- connectedCallback() {
37
- this.assetsPath = window.CuraAPI.localAssetsPath;
38
- this.sizeHandler(this.size);
39
- }
40
- getClasses() {
41
- const classes = {};
42
- classes[`icon-${this.color}`] = true;
43
- if (this.disabled)
44
- classes[`icon-disabled`] = true;
45
- return classes;
46
- }
47
- setHostProperty(prop, value) {
48
- this.host.style.setProperty(prop, value);
49
- }
50
- render() {
51
- return (index.h(index.Host, null, index.h("svg", { version: "1.1", viewBox: "0 0 24 24", preserveAspectRatio: "xMidYMid meet", xmlns: "http://www.w3.org/2000/svg", class: this.getClasses() }, index.h("use", { xlinkHref: `${this.assetsPath}/icons/iconset-${this.iconset}.svg#${this.name}` }))));
52
- }
53
- get host() { return index.getElement(this); }
54
- static get watchers() { return {
55
- "size": ["sizeHandler"]
56
- }; }
57
- };
58
- CuraIcon.style = curaIconCss;
5
+ const index = require('./index-8686299e.js');
59
6
 
60
7
  const iconsetdefaulticons = ["360", "accessibility", "alertCircle", "alertTriangle", "arrowDown", "arrowDownCircle", "arrowLeft", "arrowLeftCircle", "arrowRight", "arrowRightCircle", "arrowUp", "arrowUpCircle", "attach", "avatarF", "avatarM", "biometry", "bloodGroup", "calendar", "cam", "camOff", "central", "chatCircle", "check", "checkBadge", "checkCircle", "checkDouble", "clock", "close", "closeCircle", "collapse", "config", "delete", "desktop", "deslike", "download", "duplicate", "edit", "exam", "expand", "fileBmp", "fileJpg", "filePdf", "filePng", "fileUpload", "fileXls", "filter", "fullscreen", "gallery", "geotag", "hate", "healthPlan", "height", "height2", "home", "horizontalList", "imageUp", "info2", "infoCircle", "key", "language", "language2", "languageEN", "languagePT", "like", "link", "linkExternal", "list", "login", "logout", "love", "mail", "mail2", "medical", "menuHamburguer", "menuKebab", "menuMeatballs", "mic", "micOff", "minus", "minusCircle", "minusSquare", "mobile", "neutral", "news", "notification", "order", "partner", "phone", "play", "plus", "plusCircle", "plusSquare", "print", "profile", "profile2", "pulldownG", "pulldownP", "pullupG", "pullupP", "questionCircle", "questionSquare", "range", "reload", "schedule", "search", "secure", "share", "share2", "sound", "soundOff", "subItem", "target", "team", "unLink", "unSecure", "upload", "verticalList", "viewFalse", "viewTrue", "weight", "wifi", "zoomIn", "zoomOut"];
61
8
 
@@ -72,10 +19,9 @@ const CuraIconsView = class {
72
19
  };
73
20
  }
74
21
  render() {
75
- return (index.h(index.Host, null, index.h("div", { class: "iconDetail" }, index.h("h4", null, this.selected), index.h("div", { class: "iconSizes" }, this.sizes.map(size => index.h("div", { class: "size" }, index.h("cura-icon", { name: this.selected, size: size }), index.h("span", null, size)))), index.h("div", { class: "iconSizes invert" }, this.sizes.map(size => index.h("div", { class: "size" }, index.h("cura-icon", { name: this.selected, size: size, color: "white" }), index.h("span", null, size)))), index.h("div", { class: "iconSizes" }, this.colors.map(color => index.h("div", { class: "size" }, index.h("cura-icon", { name: this.selected, color: color }), index.h("span", null, color))), index.h("div", { class: "size" }, index.h("cura-icon", { name: this.selected, disabled: true }), index.h("span", null, "Disabled")))), index.h("div", { class: "icons" }, iconsetdefaulticons.map(icon => index.h("div", { class: "icon", onClick: () => this.setSelected(icon) }, index.h("cura-icon", { name: icon }), index.h("span", null, icon))))));
22
+ return (index.h(index.Host, null, index.h("div", { class: "iconDetail" }, index.h("h4", null, this.selected), index.h("div", { class: "iconSizes" }, this.sizes.map(size => index.h("div", { class: "size" }, index.h("cura-icon", { name: this.selected, size: size }), index.h("span", null, size)))), index.h("div", { class: "iconSizes invert" }, this.sizes.map(size => index.h("div", { class: "size" }, index.h("cura-icon", { name: this.selected, size: size, color: "neutral-white" }), index.h("span", null, size)))), index.h("div", { class: "iconSizes" }, this.colors.map(color => index.h("div", { class: "size" }, index.h("cura-icon", { name: this.selected, color: color }), index.h("span", null, color))), index.h("div", { class: "size" }, index.h("cura-icon", { name: this.selected, disabled: true }), index.h("span", null, "Disabled")))), index.h("div", { class: "icons" }, iconsetdefaulticons.map(icon => index.h("div", { class: "icon", onClick: () => this.setSelected(icon) }, index.h("cura-icon", { name: icon }), index.h("span", null, icon))))));
76
23
  }
77
24
  };
78
25
  CuraIconsView.style = curaIconsViewCss;
79
26
 
80
- exports.cura_icon = CuraIcon;
81
27
  exports.cura_icons_view = CuraIconsView;
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-9092c64d.js');
4
- const appGlobals = require('./app-globals-af978331.js');
3
+ const index = require('./index-8686299e.js');
4
+ const appGlobals = require('./app-globals-5f5b9fbf.js');
5
5
 
6
6
  /*
7
7
  Stencil Client Patch Browser v2.18.1 | MIT Licensed | https://stenciljs.com
@@ -17,5 +17,5 @@ const patchBrowser = () => {
17
17
 
18
18
  patchBrowser().then(options => {
19
19
  appGlobals.globalScripts();
20
- return index.bootstrapLazy([["dummy-component.cjs",[[1,"dummy-component"]]],["cura-icon_2.cjs",[[1,"cura-icons-view",{"selected":[32]}],[1,"cura-icon",{"name":[513],"color":[513],"size":[8],"iconset":[513],"disabled":[516]}]]]], options);
20
+ return index.bootstrapLazy([["cura-icon.cjs",[[1,"cura-icon",{"name":[513],"color":[1],"size":[8],"iconset":[513],"disabled":[4]}]]],["cura-icons-view.cjs",[[1,"cura-icons-view",{"selected":[32]}]]],["cura-display_3.cjs",[[1,"cura-display",{"level":[514],"size":[513]}],[1,"cura-heading",{"level":[514],"size":[513],"weight":[513]}],[1,"cura-paragraph",{"size":[513]}]]]], options);
21
21
  });
@@ -174,6 +174,10 @@ const parsePropertyValue = (propValue, propType) => {
174
174
  // but we'll cheat here and say that the string "false" is the boolean false
175
175
  return propValue === 'false' ? false : propValue === '' || !!propValue;
176
176
  }
177
+ if (propType & 2 /* MEMBER_FLAGS.Number */) {
178
+ // force it to be a number
179
+ return parseFloat(propValue);
180
+ }
177
181
  if (propType & 1 /* MEMBER_FLAGS.String */) {
178
182
  // could have been passed as a number or boolean
179
183
  // but we still want it as a string
@@ -288,6 +292,31 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
288
292
  classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
289
293
  classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
290
294
  }
295
+ else if (memberName === 'style') {
296
+ // update style attribute, css properties and values
297
+ {
298
+ for (const prop in oldValue) {
299
+ if (!newValue || newValue[prop] == null) {
300
+ if (prop.includes('-')) {
301
+ elm.style.removeProperty(prop);
302
+ }
303
+ else {
304
+ elm.style[prop] = '';
305
+ }
306
+ }
307
+ }
308
+ }
309
+ for (const prop in newValue) {
310
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
311
+ if (prop.includes('-')) {
312
+ elm.style.setProperty(prop, newValue[prop]);
313
+ }
314
+ else {
315
+ elm.style[prop] = newValue[prop];
316
+ }
317
+ }
318
+ }
319
+ }
291
320
  else if ((!isProp ) &&
292
321
  memberName[0] === 'o' &&
293
322
  memberName[1] === 'n') {
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-9092c64d.js');
6
- const appGlobals = require('./app-globals-af978331.js');
5
+ const index = require('./index-8686299e.js');
6
+ const appGlobals = require('./app-globals-5f5b9fbf.js');
7
7
 
8
8
  /*
9
9
  Stencil Client Patch Esm v2.18.1 | MIT Licensed | https://stenciljs.com
@@ -16,7 +16,7 @@ const defineCustomElements = (win, options) => {
16
16
  if (typeof window === 'undefined') return Promise.resolve();
17
17
  return patchEsm().then(() => {
18
18
  appGlobals.globalScripts();
19
- return index.bootstrapLazy([["dummy-component.cjs",[[1,"dummy-component"]]],["cura-icon_2.cjs",[[1,"cura-icons-view",{"selected":[32]}],[1,"cura-icon",{"name":[513],"color":[513],"size":[8],"iconset":[513],"disabled":[516]}]]]], options);
19
+ return index.bootstrapLazy([["cura-icon.cjs",[[1,"cura-icon",{"name":[513],"color":[1],"size":[8],"iconset":[513],"disabled":[4]}]]],["cura-icons-view.cjs",[[1,"cura-icons-view",{"selected":[32]}]]],["cura-display_3.cjs",[[1,"cura-display",{"level":[514],"size":[513]}],[1,"cura-heading",{"level":[514],"size":[513],"weight":[513]}],[1,"cura-paragraph",{"size":[513]}]]]], options);
20
20
  });
21
21
  };
22
22
 
@@ -5,7 +5,16 @@ export default class CuraAPI {
5
5
  const themeModule = new CuraThemeModule();
6
6
  this.theme = {
7
7
  load: function (themeTag) { themeModule.load(themeTag); },
8
- setCustom: function (customThemeDefinitions) { themeModule.setCustom(customThemeDefinitions); }
8
+ setCustom: function (customThemeDefinitions) { themeModule.setCustom(customThemeDefinitions); },
9
+ colors: {
10
+ getColor: function (colorWithDepth) { return themeModule.colors.getColor(colorWithDepth); },
11
+ },
12
+ fonts: {
13
+ getFamily: function (type) { return themeModule.fonts.getFamily(type); },
14
+ getWeights: function () { return themeModule.fonts.getWeights(); },
15
+ getSize: function () { return themeModule.fonts.getSize(); },
16
+ getColor: function () { return themeModule.fonts.getColor(); }
17
+ }
9
18
  };
10
19
  if (config && config.customTheme) {
11
20
  this.theme.setCustom(config.customTheme);
@@ -0,0 +1,69 @@
1
+ import { Static } from "../theme-presets/static";
2
+ export default class CuraThemeColorsModule {
3
+ constructor() {
4
+ this.NeutralDepthAlias = {
5
+ 'purewhite': '0',
6
+ 'white': '100',
7
+ 'pale': '200',
8
+ 'lighter': '300',
9
+ 'light': '400',
10
+ 'base': '500',
11
+ 'medium': '600',
12
+ 'dark': '700',
13
+ 'darker': '800',
14
+ 'black': '900',
15
+ };
16
+ this.ColorDepthAlias = {
17
+ 'lighter': '100',
18
+ 'light': '300',
19
+ 'base': '500',
20
+ 'dark': '700',
21
+ 'darker': '900'
22
+ };
23
+ }
24
+ /**
25
+ * Get theme color.
26
+ * @param colorWithDepth string Ex.: primary-light
27
+ * @returns css color property. Color definition or related css var from the theme.
28
+ */
29
+ getColor(colorWithDepth = "primary-base") {
30
+ const { color, depth } = this.splitColorDepth(colorWithDepth);
31
+ const staticColor = this.getStatic(color, depth);
32
+ if (staticColor)
33
+ return staticColor;
34
+ return this.getDynamic(color, depth);
35
+ }
36
+ /**
37
+ * Internal: Look for static color by name and depth.
38
+ * @param color Color name.
39
+ * @param depth Depth number or alias.
40
+ * @returns Static color definition.
41
+ */
42
+ getStatic(color, depth) {
43
+ var _a, _b;
44
+ return ((_a = Static.color[color]) === null || _a === void 0 ? void 0 : _a[depth]) || ((_b = Static.color[color]) === null || _b === void 0 ? void 0 : _b[this.NeutralDepthAlias[depth]]) || null;
45
+ }
46
+ /**
47
+ * Internal: Look for theme dynamic colors.
48
+ * @param color Color name.
49
+ * @param depth Depth number or alias.
50
+ * @returns Related CSS variable defined by the theme.
51
+ */
52
+ getDynamic(color, depth) {
53
+ const themeVar = this.ColorDepthAlias[depth]
54
+ ? `--cura-color-${color}-${this.ColorDepthAlias[depth]}`
55
+ : `--cura-color-${color}-${depth}`;
56
+ return getComputedStyle(document.body).getPropertyValue(themeVar)
57
+ ? `var(${themeVar})`
58
+ : `var(--cura-color-primary-500)`;
59
+ }
60
+ /**
61
+ * Internal: Split color strings
62
+ * @param colorWithDepth Color string [color]-[depth]. Ex.: primary-dark or primary-700.
63
+ * @returns Object { color: string, depth: string }.
64
+ */
65
+ splitColorDepth(colorWithDepth) {
66
+ const [color, depth] = colorWithDepth.toLowerCase().split(/-(.*)/);
67
+ return { color: color !== null && color !== void 0 ? color : "primary", depth: depth !== null && depth !== void 0 ? depth : "base" };
68
+ }
69
+ }
@@ -0,0 +1,35 @@
1
+ import { ThemeDefault } from "../theme-presets/theme-default";
2
+ export default class CuraThemeFontsModule {
3
+ constructor() {
4
+ /**
5
+ * Get the CSS variable related to the font size base defined by the theme.
6
+ * @returns Related CSS variable as a string.
7
+ */
8
+ this.getSize = () => `var(--cura-font-size)`;
9
+ /**
10
+ * Get CSS variable related to the font color defined by the theme.
11
+ * @returns Related CSS variable as a string.
12
+ */
13
+ this.getColor = () => `var(--cura-font-color)`;
14
+ }
15
+ /**
16
+ * Get the CSS variable related to the font family defined by the theme.
17
+ * @param type 'body' | 'heading' | 'display'
18
+ * @returns Related css variable as a string.
19
+ */
20
+ getFamily(type = "body") {
21
+ const curaFontFamilyCSSVar = `--cura-font-${type.toLowerCase()}`;
22
+ return getComputedStyle(document.body).getPropertyValue(curaFontFamilyCSSVar)
23
+ ? `var(${curaFontFamilyCSSVar})`
24
+ : 'var(--cura-font-body)';
25
+ }
26
+ /**
27
+ * Get the CSS variables related to font weights defined by the theme.
28
+ * @returns Object with CSS vars weights definitions for thin, light, regular, medium, bold and black fonts.
29
+ */
30
+ getWeights() {
31
+ const weights = {};
32
+ Object.keys(ThemeDefault.font.weights).forEach((key) => weights[key] = `var(--cura-font-weights-${key})`);
33
+ return weights;
34
+ }
35
+ }
@@ -1,7 +1,11 @@
1
1
  import { ThemePresets } from "../theme-presets/theme-presets";
2
+ import CuraThemeColorsModule from "./cura-theme-colors-module";
3
+ import CuraThemeFontsModule from "./cura-theme-fonts-module";
2
4
  export default class CuraThemeModule {
3
5
  constructor() {
4
6
  this.prefix = '--cura';
7
+ this.colors = new CuraThemeColorsModule();
8
+ this.fonts = new CuraThemeFontsModule();
5
9
  /* Private */
6
10
  /** Set css var based on object structure */
7
11
  this.setCssVar = (prop, path) => {
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Static
3
+ */
4
+ export const Static = {
5
+ /* Colors */
6
+ color: {
7
+ success: {
8
+ lighter: '#DFF6E9',
9
+ light: '#94E1B5',
10
+ base: '#5FD290',
11
+ dark: '#3F8C60',
12
+ darker: '#132A1D',
13
+ depth100: '#DFF6E9',
14
+ depth300: '#94E1B5',
15
+ depth500: '#5FD290',
16
+ depth700: '#3F8C60',
17
+ depth900: '#132A1D',
18
+ },
19
+ info: {
20
+ lighter: '#CFE2FF',
21
+ light: '#95BFFF',
22
+ base: '#6EA8FF',
23
+ dark: '#517BBB',
24
+ darker: '#253855',
25
+ depth100: '#CFE2FF',
26
+ depth300: '#95BFFF',
27
+ depth500: '#6EA8FF',
28
+ depth700: '#517BBB',
29
+ depth900: '#253855',
30
+ },
31
+ error: {
32
+ lighter: '#FBDDDD',
33
+ light: '#F28F8F',
34
+ base: '#EB5757',
35
+ dark: '#9D3A3A',
36
+ darker: '#2F1111',
37
+ depth100: '#FBDDDD',
38
+ depth300: '#F28F8F',
39
+ depth500: '#EB5757',
40
+ depth700: '#9D3A3A',
41
+ depth900: '#2F1111',
42
+ },
43
+ warning: {
44
+ lighter: '#FCFAC4',
45
+ light: '#F8F489',
46
+ base: '#F5EF4E',
47
+ dark: '#A39F34',
48
+ darker: '#313010',
49
+ depth100: '#FCFAC4',
50
+ depth300: '#F8F489',
51
+ depth500: '#F5EF4E',
52
+ depth700: '#A39F34',
53
+ depth900: '#313010',
54
+ },
55
+ /* neutral: {
56
+ 'pure-white': '#FFFFFF',
57
+ white: '#F6F6F6',
58
+ pale: '#E9E9E9',
59
+ lighter: '#E2E2E2',
60
+ light: '#D4D4D4',
61
+ base: '#B7B7B7',
62
+ medium: '#929292',
63
+ dark: '#6E6E6E',
64
+ darker: '#4A4A4A',
65
+ black: '#262626',
66
+ depth0: '#FFFFFF',
67
+ depth100: '#F6F6F6',
68
+ depth200: '#E9E9E9',
69
+ depth300: '#E2E2E2',
70
+ depth400: '#D4D4D4',
71
+ depth500: '#B7B7B7',
72
+ depth600: '#929292',
73
+ depth700: '#6E6E6E',
74
+ depth800: '#4A4A4A',
75
+ depth900: '#262626',
76
+ }, */
77
+ neutral: {
78
+ '0': '#FFFFFF',
79
+ '100': '#F6F6F6',
80
+ '200': '#E9E9E9',
81
+ '300': '#E2E2E2',
82
+ '400': '#D4D4D4',
83
+ '500': '#B7B7B7',
84
+ '600': '#929292',
85
+ '700': '#6E6E6E',
86
+ '800': '#4A4A4A',
87
+ '900': '#262626',
88
+ },
89
+ },
90
+ /* Icons */
91
+ icons: {
92
+ 'sizes': ['128', '72', '64', '48', '40', '32', '24', '20', '16'],
93
+ 'strokes': ['5.25', '3.5', '3.25', '2.75', '2.5', '2.25', '2', '1.75', '1.5'],
94
+ 'default-size': '24',
95
+ },
96
+ /* Breakpoints */
97
+ breakpoints: {
98
+ small: '576px',
99
+ medium: '768px',
100
+ large: '992px',
101
+ xlarge: '1200px',
102
+ },
103
+ };
@@ -5,39 +5,45 @@ export const ThemeDefault = {
5
5
  /* Colors */
6
6
  color: {
7
7
  primary: {
8
- depth100: '#CCD9E7',
9
- depth300: '#5580AE',
10
- base: '#004186',
11
- depth700: '#002B59',
12
- depth900: '#00133B'
8
+ '100': '#71C5E8',
9
+ '300': '#449CD5',
10
+ '500': '#005EB8',
11
+ '700': '#004890',
12
+ '900': '#002855'
13
13
  },
14
14
  secondary: {
15
- depth100: '#EEE8CE',
16
- depth300: '#C6B45C',
17
- base: '#AA8E0B',
18
- depth700: '#715F07',
19
- depth900: '#221C02'
15
+ '100': '#F5ECE3',
16
+ '300': '#DDC0A2',
17
+ '500': '#CCA074',
18
+ '700': '#886B4D',
19
+ '900': '#292017'
20
20
  },
21
21
  accent: {
22
- depth100: '#F9E8D5',
23
- depth300: '#E4A04F',
24
- base: '#DF8D2C',
25
- depth700: '#955E1D',
26
- depth900: '#2D1C09'
22
+ '100': '#F9E8D5',
23
+ '300': '#E4A04F',
24
+ '500': '#DF8D2C',
25
+ '700': '#955E1D',
26
+ '900': '#2D1C09'
27
27
  }
28
28
  },
29
29
  /* Spacing */
30
30
  spacing: {
31
- base: '8px',
31
+ base: 4,
32
32
  },
33
33
  /* Fonts */
34
34
  font: {
35
- family: {
36
- title: 'serif',
37
- body: '"Roboto", Helvetica, Arial, sans-serif'
35
+ size: '14px',
36
+ color: '#4A4A4A',
37
+ body: "'Roboto', Arial, Helvetica, sans-serif",
38
+ heading: "'Roboto', Arial, Helvetica, sans-serif",
39
+ display: "'Roboto', Arial, Helvetica, sans-serif",
40
+ weights: {
41
+ thin: 100,
42
+ light: 300,
43
+ regular: 400,
44
+ medium: 500,
45
+ bold: 700,
46
+ black: 900
38
47
  },
39
- size: {
40
- base: '16px',
41
- }
42
48
  }
43
49
  };
@@ -7,20 +7,18 @@ export const ThemeMaternity = Object.assign(Object.assign({}, ThemeDefault), {
7
7
  /* Colors */
8
8
  color: {
9
9
  primary: {
10
- base: '#CD4D9A',
11
- depth100: '#FCEFF6',
12
- depth300: '#FFBFE5',
13
- depth500: '#FF7FCB',
14
- depth700: '#99126C',
15
- depth900: '#00133B'
10
+ '100': '#FCEFF6',
11
+ '300': '#FFBFE5',
12
+ '500': '#CD4D9A',
13
+ '700': '#99126C',
14
+ '900': '#00133B'
16
15
  },
17
16
  secondary: {
18
- base: '#189AB4',
19
- depth100: '#EDF3FF',
20
- depth300: '#BDD2FF',
21
- depth500: '#496BB6',
22
- depth700: '#001C58',
23
- depth900: '#430E31'
17
+ '100': '#EDF3FF',
18
+ '300': '#BDD2FF',
19
+ '500': '#189AB4',
20
+ '700': '#001C58',
21
+ '900': '#430E31'
24
22
  }
25
23
  }
26
24
  });
@@ -2,7 +2,9 @@
2
2
  "entries": [
3
3
  "./components/cura-icon/cura-icon.js",
4
4
  "./components/cura-icons-view/cura-icons-view.js",
5
- "./components/dummy-component/dummy-component.js"
5
+ "./components/text/cura-display/cura-display.js",
6
+ "./components/text/cura-heading/cura-heading.js",
7
+ "./components/text/cura-paragraph/cura-paragraph.js"
6
8
  ],
7
9
  "compiler": {
8
10
  "name": "@stencil/core",
@@ -1,51 +1,10 @@
1
- /* SASS Variables Map */
2
- /* Private */
3
- /* Colors */
4
- /* Lists */
5
- :host {
6
- --stroke-color: #B7B7B7;
7
- }
8
- :host svg.icon-neutral {
9
- --stroke-color: #B7B7B7;
10
- }
11
- :host svg.icon-primary {
12
- --stroke-color: var(--cura-color-primary-base, #004186);
13
- }
14
- :host svg.icon-secondary {
15
- --stroke-color: var(--cura-color-secondary-base, #AA8E0B);
16
- }
17
- :host svg.icon-accent {
18
- --stroke-color: var(--cura-color-accent-base, #DF8D2C);
19
- }
20
- :host svg.icon-success {
21
- --stroke-color: #5FD290;
22
- }
23
- :host svg.icon-info {
24
- --stroke-color: #6EA8FF;
25
- }
26
- :host svg.icon-error {
27
- --stroke-color: #EB5757;
28
- }
29
- :host svg.icon-warning {
30
- --stroke-color: #FFCF3C;
31
- }
32
- :host svg.icon-white {
33
- --stroke-color: #F6F6F6;
34
- }
35
- :host svg.icon-black {
36
- --stroke-color: #262626;
37
- }
38
- :host svg.icon-disabled {
39
- --stroke-color: #D4D4D4;
40
- }
41
-
42
1
  :host {
43
2
  width: var(--size);
44
3
  height: var(--size);
45
4
  }
46
5
  :host svg {
47
6
  display: inline-block;
48
- stroke: var(--stroke-color);
7
+ stroke: var(--color);
49
8
  width: var(--size);
50
9
  height: var(--size);
51
10
  stroke-width: var(--stroke);
@@ -2,7 +2,7 @@ import { Host, h } from '@stencil/core';
2
2
  export class CuraIcon {
3
3
  constructor() {
4
4
  this.name = '';
5
- this.color = 'neutral';
5
+ this.color = 'neutral-base';
6
6
  this.iconset = 'default';
7
7
  this.disabled = false;
8
8
  this.sizes = {
@@ -25,22 +25,19 @@ export class CuraIcon {
25
25
  this.setHostProperty('--size', this.sizes[`${size}`] ? `${this.sizes[size].size}px` : `${this.sizes.default.size}px`);
26
26
  this.setHostProperty('--stroke', this.sizes[`${size}`] ? scaledStroke(size) : scaledStroke("default"));
27
27
  }
28
+ colorHandler() {
29
+ this.setHostProperty('--color', window.CuraAPI.theme.colors.getColor(this.disabled ? 'neutral-light' : this.color));
30
+ }
28
31
  connectedCallback() {
29
32
  this.assetsPath = window.CuraAPI.localAssetsPath;
30
33
  this.sizeHandler(this.size);
31
- }
32
- getClasses() {
33
- const classes = {};
34
- classes[`icon-${this.color}`] = true;
35
- if (this.disabled)
36
- classes[`icon-disabled`] = true;
37
- return classes;
34
+ this.colorHandler();
38
35
  }
39
36
  setHostProperty(prop, value) {
40
37
  this.host.style.setProperty(prop, value);
41
38
  }
42
39
  render() {
43
- return (h(Host, null, h("svg", { version: "1.1", viewBox: "0 0 24 24", preserveAspectRatio: "xMidYMid meet", xmlns: "http://www.w3.org/2000/svg", class: this.getClasses() }, h("use", { xlinkHref: `${this.assetsPath}/icons/iconset-${this.iconset}.svg#${this.name}` }))));
40
+ return (h(Host, null, h("svg", { version: "1.1", viewBox: "0 0 24 24", preserveAspectRatio: "xMidYMid meet", xmlns: "http://www.w3.org/2000/svg" }, h("use", { xlinkHref: `${this.assetsPath}/icons/iconset-${this.iconset}.svg#${this.name}` }))));
44
41
  }
45
42
  static get is() { return "cura-icon"; }
46
43
  static get encapsulation() { return "shadow"; }
@@ -89,8 +86,8 @@ export class CuraIcon {
89
86
  "text": ""
90
87
  },
91
88
  "attribute": "color",
92
- "reflect": true,
93
- "defaultValue": "'neutral'"
89
+ "reflect": false,
90
+ "defaultValue": "'neutral-base'"
94
91
  },
95
92
  "size": {
96
93
  "type": "any",
@@ -142,7 +139,7 @@ export class CuraIcon {
142
139
  "text": ""
143
140
  },
144
141
  "attribute": "disabled",
145
- "reflect": true,
142
+ "reflect": false,
146
143
  "defaultValue": "false"
147
144
  }
148
145
  };
@@ -152,6 +149,12 @@ export class CuraIcon {
152
149
  return [{
153
150
  "propName": "size",
154
151
  "methodName": "sizeHandler"
152
+ }, {
153
+ "propName": "color",
154
+ "methodName": "colorHandler"
155
+ }, {
156
+ "propName": "disabled",
157
+ "methodName": "colorHandler"
155
158
  }];
156
159
  }
157
160
  }
@@ -10,7 +10,7 @@ export class CuraIconsView {
10
10
  };
11
11
  }
12
12
  render() {
13
- return (h(Host, null, h("div", { class: "iconDetail" }, h("h4", null, this.selected), h("div", { class: "iconSizes" }, this.sizes.map(size => h("div", { class: "size" }, h("cura-icon", { name: this.selected, size: size }), h("span", null, size)))), h("div", { class: "iconSizes invert" }, this.sizes.map(size => h("div", { class: "size" }, h("cura-icon", { name: this.selected, size: size, color: "white" }), h("span", null, size)))), h("div", { class: "iconSizes" }, this.colors.map(color => h("div", { class: "size" }, h("cura-icon", { name: this.selected, color: color }), h("span", null, color))), h("div", { class: "size" }, h("cura-icon", { name: this.selected, disabled: true }), h("span", null, "Disabled")))), h("div", { class: "icons" }, iconsetdefaulticons.map(icon => h("div", { class: "icon", onClick: () => this.setSelected(icon) }, h("cura-icon", { name: icon }), h("span", null, icon))))));
13
+ return (h(Host, null, h("div", { class: "iconDetail" }, h("h4", null, this.selected), h("div", { class: "iconSizes" }, this.sizes.map(size => h("div", { class: "size" }, h("cura-icon", { name: this.selected, size: size }), h("span", null, size)))), h("div", { class: "iconSizes invert" }, this.sizes.map(size => h("div", { class: "size" }, h("cura-icon", { name: this.selected, size: size, color: "neutral-white" }), h("span", null, size)))), h("div", { class: "iconSizes" }, this.colors.map(color => h("div", { class: "size" }, h("cura-icon", { name: this.selected, color: color }), h("span", null, color))), h("div", { class: "size" }, h("cura-icon", { name: this.selected, disabled: true }), h("span", null, "Disabled")))), h("div", { class: "icons" }, iconsetdefaulticons.map(icon => h("div", { class: "icon", onClick: () => this.setSelected(icon) }, h("cura-icon", { name: icon }), h("span", null, icon))))));
14
14
  }
15
15
  static get is() { return "cura-icons-view"; }
16
16
  static get encapsulation() { return "shadow"; }