@frontify/guideline-blocks-settings 0.31.3 → 0.31.4

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,16 +1,16 @@
1
- import { BACKGROUND_COLOR_DEFAULT_VALUE as c } from "./defaultValues.es.js";
2
- const g = (a) => {
3
- const d = a != null && a.id ? `hasBackground${a.id}` : "hasBackground", e = a != null && a.id ? `backgroundColor${a.id}` : "backgroundColor", l = a != null && a.preventDefaultColor ? void 0 : (a == null ? void 0 : a.defaultColor) || c, r = a != null && a.switchLabel ? a.switchLabel : void 0;
1
+ import { BACKGROUND_COLOR_DEFAULT_VALUE as u } from "./defaultValues.es.js";
2
+ const g = (l) => {
3
+ const a = l != null && l.id ? `hasBackground${l.id}` : "hasBackground", e = l != null && l.id ? `backgroundColor${l.id}` : "backgroundColor", d = l != null && l.preventDefaultColor ? void 0 : (l == null ? void 0 : l.defaultColor) || u, r = l != null && l.label ? l.label : "Background", c = l != null && l.switchLabel ? l.switchLabel : void 0;
4
4
  return {
5
- id: d,
6
- label: "Background",
5
+ id: a,
6
+ label: r,
7
7
  type: "switch",
8
- switchLabel: r,
9
- defaultValue: !!(a != null && a.defaultValue),
8
+ switchLabel: c,
9
+ defaultValue: !!(l != null && l.defaultValue),
10
10
  on: [
11
11
  {
12
12
  id: e,
13
- defaultValue: l,
13
+ defaultValue: d,
14
14
  type: "colorInput"
15
15
  }
16
16
  ]
@@ -1 +1 @@
1
- {"version":3,"file":"background.es.js","sources":["../../src/settings/background.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { Color } from '@frontify/fondue';\nimport { BACKGROUND_COLOR_DEFAULT_VALUE } from './defaultValues';\nimport { SettingBlock } from '../';\n\n/**\n * Returns background settings: background switch, background color\n *\n * @param options Options for the settings\n * @param options.id Custom suffix for the setting ids\n * @param options.defaultValue Default value for the background switch\n * @param options.defaultColor Default value for the background color\n * @param options.preventDefaultColor Whether the background color should be empty by default\n * @param options.switchLabel Label for the background switch\n * @returns {SettingBlock} Returns background settings\n */\n\ntype BackgroundSettingsType = {\n id?: string;\n defaultValue?: boolean;\n defaultColor?: Color;\n preventDefaultColor?: boolean;\n switchLabel?: string;\n};\n\nexport const getBackgroundSettings = (options?: BackgroundSettingsType): SettingBlock => {\n const hasId = options?.id ? `hasBackground${options.id}` : 'hasBackground';\n const colorId = options?.id ? `backgroundColor${options.id}` : 'backgroundColor';\n const defaultColor = !!options?.preventDefaultColor\n ? undefined\n : options?.defaultColor || BACKGROUND_COLOR_DEFAULT_VALUE;\n const switchLabel = options?.switchLabel ? options.switchLabel : undefined;\n\n return {\n id: hasId,\n label: 'Background',\n type: 'switch',\n switchLabel,\n defaultValue: !!options?.defaultValue,\n on: [\n {\n id: colorId,\n defaultValue: defaultColor,\n type: 'colorInput',\n },\n ],\n };\n};\n"],"names":["getBackgroundSettings","options","hasId","colorId","defaultColor","BACKGROUND_COLOR_DEFAULT_VALUE","switchLabel"],"mappings":";AA0Ba,MAAAA,IAAwB,CAACC,MAAmD;AACrF,QAAMC,IAAQD,KAAA,QAAAA,EAAS,KAAK,gBAAgBA,EAAQ,EAAE,KAAK,iBACrDE,IAAUF,KAAA,QAAAA,EAAS,KAAK,kBAAkBA,EAAQ,EAAE,KAAK,mBACzDG,IAAiBH,KAAA,QAAAA,EAAS,sBAC1B,UACAA,KAAA,gBAAAA,EAAS,iBAAgBI,GACzBC,IAAcL,KAAA,QAAAA,EAAS,cAAcA,EAAQ,cAAc;AAE1D,SAAA;AAAA,IACH,IAAIC;AAAA,IACJ,OAAO;AAAA,IACP,MAAM;AAAA,IACN,aAAAI;AAAA,IACA,cAAc,CAAC,EAACL,KAAA,QAAAA,EAAS;AAAA,IACzB,IAAI;AAAA,MACA;AAAA,QACI,IAAIE;AAAA,QACJ,cAAcC;AAAA,QACd,MAAM;AAAA,MACV;AAAA,IACJ;AAAA,EAAA;AAER;"}
1
+ {"version":3,"file":"background.es.js","sources":["../../src/settings/background.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { Color } from '@frontify/fondue';\nimport { BACKGROUND_COLOR_DEFAULT_VALUE } from './defaultValues';\nimport { SettingBlock } from '../';\n\ntype BackgroundSettingsType = {\n id?: string;\n defaultValue?: boolean;\n defaultColor?: Color;\n preventDefaultColor?: boolean;\n switchLabel?: string;\n label?: string;\n};\n\n/**\n * Returns background settings: background switch, background color\n *\n * @param options Options for the settings\n * @param options.id Custom suffix for the setting ids\n * @param options.defaultValue Default value for the background switch\n * @param options.defaultColor Default value for the background color\n * @param options.preventDefaultColor Whether the background color should be empty by default\n * @param options.label Label for the background input\n * @param options.switchLabel Label for the background switch\n * @returns {SettingBlock} Returns background settings\n */\n\nexport const getBackgroundSettings = (options?: BackgroundSettingsType): SettingBlock => {\n const hasId = options?.id ? `hasBackground${options.id}` : 'hasBackground';\n const colorId = options?.id ? `backgroundColor${options.id}` : 'backgroundColor';\n const defaultColor = !!options?.preventDefaultColor\n ? undefined\n : options?.defaultColor || BACKGROUND_COLOR_DEFAULT_VALUE;\n const label = options?.label ? options.label : 'Background';\n const switchLabel = options?.switchLabel ? options.switchLabel : undefined;\n\n return {\n id: hasId,\n label,\n type: 'switch',\n switchLabel,\n defaultValue: !!options?.defaultValue,\n on: [\n {\n id: colorId,\n defaultValue: defaultColor,\n type: 'colorInput',\n },\n ],\n };\n};\n"],"names":["getBackgroundSettings","options","hasId","colorId","defaultColor","BACKGROUND_COLOR_DEFAULT_VALUE","label","switchLabel"],"mappings":";AA4Ba,MAAAA,IAAwB,CAACC,MAAmD;AACrF,QAAMC,IAAQD,KAAA,QAAAA,EAAS,KAAK,gBAAgBA,EAAQ,EAAE,KAAK,iBACrDE,IAAUF,KAAA,QAAAA,EAAS,KAAK,kBAAkBA,EAAQ,EAAE,KAAK,mBACzDG,IAAiBH,KAAA,QAAAA,EAAS,sBAC1B,UACAA,KAAA,gBAAAA,EAAS,iBAAgBI,GACzBC,IAAQL,KAAA,QAAAA,EAAS,QAAQA,EAAQ,QAAQ,cACzCM,IAAcN,KAAA,QAAAA,EAAS,cAAcA,EAAQ,cAAc;AAE1D,SAAA;AAAA,IACH,IAAIC;AAAA,IACJ,OAAAI;AAAA,IACA,MAAM;AAAA,IACN,aAAAC;AAAA,IACA,cAAc,CAAC,EAACN,KAAA,QAAAA,EAAS;AAAA,IACzB,IAAI;AAAA,MACA;AAAA,QACI,IAAIE;AAAA,QACJ,cAAcC;AAAA,QACd,MAAM;AAAA,MACV;AAAA,IACJ;AAAA,EAAA;AAER;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontify/guideline-blocks-settings",
3
- "version": "0.31.3",
3
+ "version": "0.31.4",
4
4
  "description": "Provides types and helpers for the guideline block development",
5
5
  "sideEffects": false,
6
6
  "main": "dist/index.umd.js",
@@ -4,6 +4,15 @@ import { Color } from '@frontify/fondue';
4
4
  import { BACKGROUND_COLOR_DEFAULT_VALUE } from './defaultValues';
5
5
  import { SettingBlock } from '../';
6
6
 
7
+ type BackgroundSettingsType = {
8
+ id?: string;
9
+ defaultValue?: boolean;
10
+ defaultColor?: Color;
11
+ preventDefaultColor?: boolean;
12
+ switchLabel?: string;
13
+ label?: string;
14
+ };
15
+
7
16
  /**
8
17
  * Returns background settings: background switch, background color
9
18
  *
@@ -12,29 +21,23 @@ import { SettingBlock } from '../';
12
21
  * @param options.defaultValue Default value for the background switch
13
22
  * @param options.defaultColor Default value for the background color
14
23
  * @param options.preventDefaultColor Whether the background color should be empty by default
24
+ * @param options.label Label for the background input
15
25
  * @param options.switchLabel Label for the background switch
16
26
  * @returns {SettingBlock} Returns background settings
17
27
  */
18
28
 
19
- type BackgroundSettingsType = {
20
- id?: string;
21
- defaultValue?: boolean;
22
- defaultColor?: Color;
23
- preventDefaultColor?: boolean;
24
- switchLabel?: string;
25
- };
26
-
27
29
  export const getBackgroundSettings = (options?: BackgroundSettingsType): SettingBlock => {
28
30
  const hasId = options?.id ? `hasBackground${options.id}` : 'hasBackground';
29
31
  const colorId = options?.id ? `backgroundColor${options.id}` : 'backgroundColor';
30
32
  const defaultColor = !!options?.preventDefaultColor
31
33
  ? undefined
32
34
  : options?.defaultColor || BACKGROUND_COLOR_DEFAULT_VALUE;
35
+ const label = options?.label ? options.label : 'Background';
33
36
  const switchLabel = options?.switchLabel ? options.switchLabel : undefined;
34
37
 
35
38
  return {
36
39
  id: hasId,
37
- label: 'Background',
40
+ label,
38
41
  type: 'switch',
39
42
  switchLabel,
40
43
  defaultValue: !!options?.defaultValue,