@frontify/guideline-blocks-settings 2.1.16 → 3.0.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.
- package/dist/components/BlockInjectButton/BlockInjectButton.es.js +50 -49
- package/dist/components/BlockInjectButton/BlockInjectButton.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.es.js +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.es.js.map +1 -1
- package/dist/index.cjs.js +6 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +3 -34
- package/dist/index.es.js +169 -180
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +7 -7
- package/dist/index.umd.js.map +1 -1
- package/dist/settings/background.es.js.map +1 -1
- package/dist/settings/borderRadius.es.js +10 -10
- package/dist/settings/borderRadius.es.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/utilities/color/toColorObject.es.js.map +1 -1
- package/dist/utilities/color/toHex8String.es.js.map +1 -1
- package/dist/utilities/color/toHexString.es.js.map +1 -1
- package/dist/utilities/color/toRgbaString.es.js.map +1 -1
- package/dist/utilities/color/toShortRgba.es.js.map +1 -1
- package/dist/utilities/react/getBackgroundColorStyles.es.js.map +1 -1
- package/dist/utilities/react/getBorderStyles.es.js.map +1 -1
- package/package.json +1 -1
- package/tailwind.config.ts +0 -14
- package/dist/components/DownloadButton/DownloadButton.es.js +0 -26
- package/dist/components/DownloadButton/DownloadButton.es.js.map +0 -1
- package/dist/helpers/customCoordinatesGetterFactory.es.js +0 -32
- package/dist/helpers/customCoordinatesGetterFactory.es.js.map +0 -1
- package/dist/helpers/mapColorPalettes.es.js +0 -28
- package/dist/helpers/mapColorPalettes.es.js.map +0 -1
- package/dist/hooks/useDndSensors.es.js +0 -18
- package/dist/hooks/useDndSensors.es.js.map +0 -1
- package/dist/utilities/moveItemInArray.es.js +0 -12
- package/dist/utilities/moveItemInArray.es.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"background.es.js","sources":["../../src/settings/background.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type Color } from '@frontify/
|
|
1
|
+
{"version":3,"file":"background.es.js","sources":["../../src/settings/background.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type Color } from '@frontify/sidebar-settings';\n\nimport { type SettingBlock } from '../';\n\nimport { BACKGROUND_COLOR_DEFAULT_VALUE } from './defaultValues';\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":";AA6BO,MAAMA,IAAwB,CAACC,MAAmD;AACrF,QAAMC,IAAQD,GAAS,KAAK,gBAAgBA,EAAQ,EAAE,KAAK,iBACrDE,IAAUF,GAAS,KAAK,kBAAkBA,EAAQ,EAAE,KAAK,mBACzDG,IAAeH,GAAS,sBACxB,SACAA,GAAS,gBAAgBI,GACzBC,IAAQL,GAAS,QAAQA,EAAQ,QAAQ,cACzCM,IAAcN,GAAS,cAAcA,EAAQ,cAAc;AAEjE,SAAO;AAAA,IACH,IAAIC;AAAA,IACJ,OAAAI;AAAA,IACA,MAAM;AAAA,IACN,aAAAC;AAAA,IACA,cAAc,CAAC,CAACN,GAAS;AAAA,IACzB,IAAI;AAAA,MACA;AAAA,QACI,IAAIE;AAAA,QACJ,cAAcC;AAAA,QACd,MAAM;AAAA,MAAA;AAAA,IACV;AAAA,EACJ;AAER;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* empty css */
|
|
2
|
-
import { numericalOrPixelRule as t, appendUnit as n,
|
|
3
|
-
import { Radius as a, radiusStyleMap as
|
|
4
|
-
const
|
|
2
|
+
import { numericalOrPixelRule as t, appendUnit as n, minimumNumericalOrPixelRule as s, presetCustomValue as o } from "@frontify/sidebar-settings";
|
|
3
|
+
import { Radius as a, radiusStyleMap as c } from "./types.es.js";
|
|
4
|
+
const m = (e, l = a.None) => ({
|
|
5
5
|
id: e,
|
|
6
6
|
type: "segmentedControls",
|
|
7
7
|
defaultValue: l,
|
|
@@ -23,8 +23,8 @@ const c = (e, l = a.None) => ({
|
|
|
23
23
|
label: "L"
|
|
24
24
|
}
|
|
25
25
|
]
|
|
26
|
-
}),
|
|
27
|
-
const l = e?.id ? `hasRadius_${e.id}` : "hasRadius", u = e?.id ? `radiusValue_${e.id}` : "radiusValue",
|
|
26
|
+
}), p = (e) => {
|
|
27
|
+
const l = e?.id ? `hasRadius_${e.id}` : "hasRadius", u = e?.id ? `radiusValue_${e.id}` : "radiusValue", i = e?.id ? `radiusChoice_${e.id}` : "radiusChoice", r = e?.defaultRadius || a.None;
|
|
28
28
|
return {
|
|
29
29
|
id: l,
|
|
30
30
|
label: "Corner radius",
|
|
@@ -33,21 +33,21 @@ const c = (e, l = a.None) => ({
|
|
|
33
33
|
defaultValue: !1,
|
|
34
34
|
info: "Determining how rounded the corners are.",
|
|
35
35
|
show: (d) => e?.dependentSettingId ? !!d.getBlock(e.dependentSettingId)?.value : !0,
|
|
36
|
-
onChange: (d) =>
|
|
36
|
+
onChange: (d) => o(d, i, u, e?.radiusStyleMap || c),
|
|
37
37
|
on: [
|
|
38
38
|
{
|
|
39
39
|
id: u,
|
|
40
40
|
type: "input",
|
|
41
41
|
placeholder: "e.g. 10px",
|
|
42
|
-
rules: [t],
|
|
42
|
+
rules: [t, s(0)],
|
|
43
43
|
onChange: (d) => n(d, u)
|
|
44
44
|
}
|
|
45
45
|
],
|
|
46
|
-
off: [
|
|
46
|
+
off: [m(i, r)]
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
49
|
export {
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
p as getBorderRadiusSettings,
|
|
51
|
+
m as getBorderRadiusSlider
|
|
52
52
|
};
|
|
53
53
|
//# sourceMappingURL=borderRadius.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"borderRadius.es.js","sources":["../../src/settings/borderRadius.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {
|
|
1
|
+
{"version":3,"file":"borderRadius.es.js","sources":["../../src/settings/borderRadius.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type SettingBlock,\n appendUnit,\n minimumNumericalOrPixelRule,\n numericalOrPixelRule,\n presetCustomValue,\n} from '../';\n\nimport { Radius, radiusStyleMap } from './types';\n\n/**\n * Returns border radius settings: border radius switch, radius slider, custom radius input\n *\n * @param options Options for the settings\n * @param options.id Custom suffix for the setting ids\n * @param options.dependentSettingId Id of setting which the border radius is dependent on\n * @returns {SettingBlock} Returns border settings\n */\n\ntype BorderRadiusSettingsType = {\n id?: string;\n dependentSettingId?: string;\n radiusStyleMap?: Record<Radius, string>;\n defaultRadius?: Radius;\n};\n\nexport const getBorderRadiusSlider = (id: string, defaultValue: Radius = Radius.None): SettingBlock => ({\n id,\n type: 'segmentedControls',\n defaultValue,\n choices: [\n {\n value: Radius.None,\n label: 'None',\n },\n {\n value: Radius.Small,\n label: 'S',\n },\n {\n value: Radius.Medium,\n label: 'M',\n },\n {\n value: Radius.Large,\n label: 'L',\n },\n ],\n});\n\nexport const getBorderRadiusSettings = (options?: BorderRadiusSettingsType): SettingBlock => {\n const hasId = options?.id ? `hasRadius_${options.id}` : 'hasRadius';\n const valueId = options?.id ? `radiusValue_${options.id}` : 'radiusValue';\n const choiceId = options?.id ? `radiusChoice_${options.id}` : 'radiusChoice';\n const defaultValue = options?.defaultRadius || Radius.None;\n\n return {\n id: hasId,\n label: 'Corner radius',\n type: 'switch',\n switchLabel: 'Custom',\n defaultValue: false,\n info: 'Determining how rounded the corners are.',\n show: (bundle) => (options?.dependentSettingId ? !!bundle.getBlock(options.dependentSettingId)?.value : true),\n onChange: (bundle) => presetCustomValue(bundle, choiceId, valueId, options?.radiusStyleMap || radiusStyleMap),\n on: [\n {\n id: valueId,\n type: 'input',\n placeholder: 'e.g. 10px',\n rules: [numericalOrPixelRule, minimumNumericalOrPixelRule(0)],\n onChange: (bundle) => appendUnit(bundle, valueId),\n },\n ],\n off: [getBorderRadiusSlider(choiceId, defaultValue)],\n };\n};\n"],"names":["getBorderRadiusSlider","id","defaultValue","Radius","getBorderRadiusSettings","options","hasId","valueId","choiceId","bundle","presetCustomValue","radiusStyleMap","numericalOrPixelRule","minimumNumericalOrPixelRule","appendUnit"],"mappings":";;;AA4BO,MAAMA,IAAwB,CAACC,GAAYC,IAAuBC,EAAO,UAAwB;AAAA,EACpG,IAAAF;AAAA,EACA,MAAM;AAAA,EACN,cAAAC;AAAA,EACA,SAAS;AAAA,IACL;AAAA,MACI,OAAOC,EAAO;AAAA,MACd,OAAO;AAAA,IAAA;AAAA,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