@frontify/guideline-blocks-settings 2.0.0 → 2.0.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/components/Attachments/AttachmentItem.es.js +83 -83
- package/dist/components/Attachments/AttachmentItem.es.js.map +1 -1
- package/dist/components/Attachments/Attachments.es.js +51 -54
- package/dist/components/Attachments/Attachments.es.js.map +1 -1
- package/dist/components/BlockInjectButton/BlockInjectButton.es.js +56 -57
- package/dist/components/BlockInjectButton/BlockInjectButton.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js +25 -25
- package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/context/MultiFlyoutContext.es.js +3 -3
- package/dist/components/Link/LinkInput.es.js +35 -35
- package/dist/components/Link/LinkInput.es.js.map +1 -1
- package/dist/components/Link/LinkSelector/LinkSelector.es.js +31 -31
- package/dist/components/Link/LinkSelector/LinkSelector.es.js.map +1 -1
- package/dist/components/Link/helpers/filterDocumentSectionsWithUnreadableTitles.es.js +2 -5
- package/dist/components/Link/helpers/filterDocumentSectionsWithUnreadableTitles.es.js.map +1 -1
- package/dist/components/Link/utils/getUrl.es.js +9 -15
- package/dist/components/Link/utils/getUrl.es.js.map +1 -1
- package/dist/components/RichTextEditor/RichTextEditor.es.js +39 -39
- package/dist/components/RichTextEditor/RichTextEditor.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.es.js +24 -25
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.es.js +6 -6
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.es.js +25 -25
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.es.js +29 -33
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.es.js +6 -6
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.es.js +22 -23
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.es.js +61 -63
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.es.js +6 -6
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.es.js +6 -7
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/withButton.es.js +21 -21
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/withButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ColumnBreakPlugin/ColumnBreakPlugin.es.js +15 -19
- package/dist/components/RichTextEditor/plugins/ColumnBreakPlugin/ColumnBreakPlugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js +5 -5
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.es.js +13 -13
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.es.js +23 -23
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.es.js +7 -8
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/index.es.js +23 -27
- package/dist/components/RichTextEditor/plugins/LinkPlugin/index.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/getUrl.es.js +6 -9
- package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/getUrl.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js +24 -28
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js +24 -28
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js +24 -28
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js +24 -28
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js +24 -28
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js +24 -28
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.es.js +24 -28
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.es.js +25 -29
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js +25 -29
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js +26 -30
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js +26 -30
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js.map +1 -1
- package/dist/helpers/customCoordinatesGetterFactory.es.js +18 -18
- package/dist/helpers/customCoordinatesGetterFactory.es.js.map +1 -1
- package/dist/hooks/useAttachments.es.js +6 -6
- package/dist/hooks/useAttachments.es.js.map +1 -1
- package/dist/index.cjs.js +7 -7
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +0 -15
- package/dist/index.es.js +208 -208
- package/dist/index.umd.js +7 -7
- package/dist/index.umd.js.map +1 -1
- package/dist/settings/background.es.js +4 -4
- package/dist/settings/background.es.js.map +1 -1
- package/dist/settings/border.es.js +17 -17
- package/dist/settings/border.es.js.map +1 -1
- package/dist/settings/borderRadius.es.js +12 -15
- package/dist/settings/borderRadius.es.js.map +1 -1
- package/dist/settings/borderRadiusExtended.es.js +25 -28
- package/dist/settings/borderRadiusExtended.es.js.map +1 -1
- package/dist/settings/gutter.es.js +17 -20
- package/dist/settings/gutter.es.js.map +1 -1
- package/dist/settings/margin.es.js +14 -14
- package/dist/settings/margin.es.js.map +1 -1
- package/dist/settings/marginExtended.es.js +29 -29
- package/dist/settings/marginExtended.es.js.map +1 -1
- package/dist/settings/padding.es.js +14 -14
- package/dist/settings/padding.es.js.map +1 -1
- package/dist/settings/paddingExtended.es.js +28 -28
- package/dist/settings/paddingExtended.es.js.map +1 -1
- package/dist/settings/securityDownloadable.es.js +8 -11
- package/dist/settings/securityDownloadable.es.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/utilities/color/getReadableColor.es.js +6 -6
- package/dist/utilities/color/getReadableColor.es.js.map +1 -1
- package/dist/utilities/color/isDark.es.js +4 -4
- package/dist/utilities/color/isDark.es.js.map +1 -1
- package/package.json +16 -16
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { BACKGROUND_COLOR_DEFAULT_VALUE as u } from "./defaultValues.es.js";
|
|
2
|
-
const
|
|
3
|
-
const a = l
|
|
2
|
+
const o = (l) => {
|
|
3
|
+
const a = l?.id ? `hasBackground${l.id}` : "hasBackground", e = l?.id ? `backgroundColor${l.id}` : "backgroundColor", d = l?.preventDefaultColor ? void 0 : l?.defaultColor || u, r = l?.label ? l.label : "Background", c = l?.switchLabel ? l.switchLabel : void 0;
|
|
4
4
|
return {
|
|
5
5
|
id: a,
|
|
6
6
|
label: r,
|
|
7
7
|
type: "switch",
|
|
8
8
|
switchLabel: c,
|
|
9
|
-
defaultValue: !!
|
|
9
|
+
defaultValue: !!l?.defaultValue,
|
|
10
10
|
on: [
|
|
11
11
|
{
|
|
12
12
|
id: e,
|
|
@@ -17,6 +17,6 @@ const g = (l) => {
|
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
19
|
export {
|
|
20
|
-
|
|
20
|
+
o as getBackgroundSettings
|
|
21
21
|
};
|
|
22
22
|
//# sourceMappingURL=background.es.js.map
|
|
@@ -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/fondue';\n\nimport { type SettingBlock } from '../';\n\nimport { BACKGROUND_COLOR_DEFAULT_VALUE } from './defaultValues';\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":";AA8BO,MAAMA,IAAwB,CAACC,MAAmD;AACrF,QAAMC,IAAQD,
|
|
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/fondue';\n\nimport { type SettingBlock } from '../';\n\nimport { BACKGROUND_COLOR_DEFAULT_VALUE } from './defaultValues';\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":";AA8BO,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,24 +1,24 @@
|
|
|
1
1
|
/* empty css */
|
|
2
|
-
import {
|
|
3
|
-
import { BORDER_COLOR_DEFAULT_VALUE as
|
|
2
|
+
import { numericalOrPixelRule as m, MultiInputLayout as b, appendUnit as h, minimumNumericalOrPixelRule as n, maximumNumericalOrPixelOrAutoRule as f } from "@frontify/sidebar-settings";
|
|
3
|
+
import { BORDER_COLOR_DEFAULT_VALUE as s, BORDER_WIDTH_DEFAULT_VALUE as y } from "./defaultValues.es.js";
|
|
4
4
|
import { BorderStyle as l } from "./types.es.js";
|
|
5
|
-
const
|
|
6
|
-
const r = e
|
|
5
|
+
const S = (e) => {
|
|
6
|
+
const r = e?.id ? `hasBorder_${e.id}` : "hasBorder", t = e?.id ? `borderSelection_${e.id}` : "borderSelection", a = e?.id ? `borderStyle_${e.id}` : "borderStyle", d = e?.id ? `borderWidth_${e.id}` : "borderWidth", u = e?.id ? `borderColor_${e.id}` : "borderColor", i = e?.defaultColor || s, o = e?.switchLabel ? e.switchLabel : void 0;
|
|
7
7
|
return {
|
|
8
8
|
id: r,
|
|
9
9
|
label: "Border",
|
|
10
10
|
type: "switch",
|
|
11
|
-
switchLabel:
|
|
12
|
-
defaultValue: !!
|
|
11
|
+
switchLabel: o,
|
|
12
|
+
defaultValue: !!e?.defaultValue,
|
|
13
13
|
on: [
|
|
14
14
|
{
|
|
15
|
-
id:
|
|
15
|
+
id: t,
|
|
16
16
|
type: "multiInput",
|
|
17
|
-
layout:
|
|
17
|
+
layout: b.Columns,
|
|
18
18
|
lastItemFullWidth: !0,
|
|
19
19
|
blocks: [
|
|
20
20
|
{
|
|
21
|
-
id:
|
|
21
|
+
id: a,
|
|
22
22
|
type: "dropdown",
|
|
23
23
|
defaultValue: l.Solid,
|
|
24
24
|
choices: [
|
|
@@ -39,19 +39,19 @@ const C = (e) => {
|
|
|
39
39
|
{
|
|
40
40
|
id: d,
|
|
41
41
|
type: "input",
|
|
42
|
-
defaultValue:
|
|
42
|
+
defaultValue: y,
|
|
43
43
|
rules: [
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
m,
|
|
45
|
+
n(0),
|
|
46
|
+
f(500)
|
|
47
47
|
],
|
|
48
48
|
placeholder: "e.g. 3px",
|
|
49
|
-
onChange: (
|
|
49
|
+
onChange: (c) => h(c, d)
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
|
-
id:
|
|
52
|
+
id: u,
|
|
53
53
|
type: "colorInput",
|
|
54
|
-
defaultValue:
|
|
54
|
+
defaultValue: i
|
|
55
55
|
}
|
|
56
56
|
]
|
|
57
57
|
}
|
|
@@ -60,6 +60,6 @@ const C = (e) => {
|
|
|
60
60
|
};
|
|
61
61
|
};
|
|
62
62
|
export {
|
|
63
|
-
|
|
63
|
+
S as getBorderSettings
|
|
64
64
|
};
|
|
65
65
|
//# sourceMappingURL=border.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"border.es.js","sources":["../../src/settings/border.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type Color,\n MultiInputLayout,\n type SettingBlock,\n appendUnit,\n maximumNumericalOrPixelOrAutoRule,\n minimumNumericalOrPixelRule,\n numericalOrPixelRule,\n} from '../';\n\nimport { BORDER_COLOR_DEFAULT_VALUE, BORDER_WIDTH_DEFAULT_VALUE } from './defaultValues';\nimport { BorderStyle } from './types';\n\n/**\n * Returns border settings: border switch, border style, border width, border color\n *\n * @param options Options for the settings\n * @param options.id Custom suffix for the setting ids\n * @param options.switchLabel Label for the border switch\n * @param options.defaultValue Default value for the border switch\n * @returns {SettingBlock} Returns border settings\n */\n\ntype BorderSettingsType = {\n id?: string;\n defaultValue?: boolean;\n defaultColor?: Color;\n switchLabel?: string;\n};\n\nexport const getBorderSettings = (options?: BorderSettingsType): SettingBlock => {\n const hasId = options?.id ? `hasBorder_${options.id}` : 'hasBorder';\n const selectionId = options?.id ? `borderSelection_${options.id}` : 'borderSelection';\n const styleId = options?.id ? `borderStyle_${options.id}` : 'borderStyle';\n const widthId = options?.id ? `borderWidth_${options.id}` : 'borderWidth';\n const colorId = options?.id ? `borderColor_${options.id}` : 'borderColor';\n const defaultColor = options?.defaultColor || BORDER_COLOR_DEFAULT_VALUE;\n const switchLabel = options?.switchLabel ? options.switchLabel : undefined;\n\n return {\n id: hasId,\n label: 'Border',\n type: 'switch',\n switchLabel,\n defaultValue: !!options?.defaultValue,\n on: [\n {\n id: selectionId,\n type: 'multiInput',\n layout: MultiInputLayout.Columns,\n lastItemFullWidth: true,\n blocks: [\n {\n id: styleId,\n type: 'dropdown',\n defaultValue: BorderStyle.Solid,\n choices: [\n {\n value: BorderStyle.Solid,\n label: BorderStyle.Solid,\n },\n {\n value: BorderStyle.Dotted,\n label: BorderStyle.Dotted,\n },\n {\n value: BorderStyle.Dashed,\n label: BorderStyle.Dashed,\n },\n ],\n },\n {\n id: widthId,\n type: 'input',\n defaultValue: BORDER_WIDTH_DEFAULT_VALUE,\n rules: [\n numericalOrPixelRule,\n minimumNumericalOrPixelRule(0),\n maximumNumericalOrPixelOrAutoRule(500),\n ],\n placeholder: 'e.g. 3px',\n onChange: (bundle) => appendUnit(bundle, widthId),\n },\n {\n id: colorId,\n type: 'colorInput',\n defaultValue: defaultColor,\n },\n ],\n },\n ],\n off: [],\n };\n};\n"],"names":["getBorderSettings","options","hasId","selectionId","styleId","widthId","colorId","defaultColor","BORDER_COLOR_DEFAULT_VALUE","switchLabel","MultiInputLayout","BorderStyle","BORDER_WIDTH_DEFAULT_VALUE","numericalOrPixelRule","minimumNumericalOrPixelRule","maximumNumericalOrPixelOrAutoRule","bundle","appendUnit"],"mappings":";;;;AAgCO,MAAMA,IAAoB,CAACC,MAA+C;AAC7E,QAAMC,IAAQD,
|
|
1
|
+
{"version":3,"file":"border.es.js","sources":["../../src/settings/border.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type Color,\n MultiInputLayout,\n type SettingBlock,\n appendUnit,\n maximumNumericalOrPixelOrAutoRule,\n minimumNumericalOrPixelRule,\n numericalOrPixelRule,\n} from '../';\n\nimport { BORDER_COLOR_DEFAULT_VALUE, BORDER_WIDTH_DEFAULT_VALUE } from './defaultValues';\nimport { BorderStyle } from './types';\n\n/**\n * Returns border settings: border switch, border style, border width, border color\n *\n * @param options Options for the settings\n * @param options.id Custom suffix for the setting ids\n * @param options.switchLabel Label for the border switch\n * @param options.defaultValue Default value for the border switch\n * @returns {SettingBlock} Returns border settings\n */\n\ntype BorderSettingsType = {\n id?: string;\n defaultValue?: boolean;\n defaultColor?: Color;\n switchLabel?: string;\n};\n\nexport const getBorderSettings = (options?: BorderSettingsType): SettingBlock => {\n const hasId = options?.id ? `hasBorder_${options.id}` : 'hasBorder';\n const selectionId = options?.id ? `borderSelection_${options.id}` : 'borderSelection';\n const styleId = options?.id ? `borderStyle_${options.id}` : 'borderStyle';\n const widthId = options?.id ? `borderWidth_${options.id}` : 'borderWidth';\n const colorId = options?.id ? `borderColor_${options.id}` : 'borderColor';\n const defaultColor = options?.defaultColor || BORDER_COLOR_DEFAULT_VALUE;\n const switchLabel = options?.switchLabel ? options.switchLabel : undefined;\n\n return {\n id: hasId,\n label: 'Border',\n type: 'switch',\n switchLabel,\n defaultValue: !!options?.defaultValue,\n on: [\n {\n id: selectionId,\n type: 'multiInput',\n layout: MultiInputLayout.Columns,\n lastItemFullWidth: true,\n blocks: [\n {\n id: styleId,\n type: 'dropdown',\n defaultValue: BorderStyle.Solid,\n choices: [\n {\n value: BorderStyle.Solid,\n label: BorderStyle.Solid,\n },\n {\n value: BorderStyle.Dotted,\n label: BorderStyle.Dotted,\n },\n {\n value: BorderStyle.Dashed,\n label: BorderStyle.Dashed,\n },\n ],\n },\n {\n id: widthId,\n type: 'input',\n defaultValue: BORDER_WIDTH_DEFAULT_VALUE,\n rules: [\n numericalOrPixelRule,\n minimumNumericalOrPixelRule(0),\n maximumNumericalOrPixelOrAutoRule(500),\n ],\n placeholder: 'e.g. 3px',\n onChange: (bundle) => appendUnit(bundle, widthId),\n },\n {\n id: colorId,\n type: 'colorInput',\n defaultValue: defaultColor,\n },\n ],\n },\n ],\n off: [],\n };\n};\n"],"names":["getBorderSettings","options","hasId","selectionId","styleId","widthId","colorId","defaultColor","BORDER_COLOR_DEFAULT_VALUE","switchLabel","MultiInputLayout","BorderStyle","BORDER_WIDTH_DEFAULT_VALUE","numericalOrPixelRule","minimumNumericalOrPixelRule","maximumNumericalOrPixelOrAutoRule","bundle","appendUnit"],"mappings":";;;;AAgCO,MAAMA,IAAoB,CAACC,MAA+C;AAC7E,QAAMC,IAAQD,GAAS,KAAK,aAAaA,EAAQ,EAAE,KAAK,aAClDE,IAAcF,GAAS,KAAK,mBAAmBA,EAAQ,EAAE,KAAK,mBAC9DG,IAAUH,GAAS,KAAK,eAAeA,EAAQ,EAAE,KAAK,eACtDI,IAAUJ,GAAS,KAAK,eAAeA,EAAQ,EAAE,KAAK,eACtDK,IAAUL,GAAS,KAAK,eAAeA,EAAQ,EAAE,KAAK,eACtDM,IAAeN,GAAS,gBAAgBO,GACxCC,IAAcR,GAAS,cAAcA,EAAQ,cAAc;AAEjE,SAAO;AAAA,IACH,IAAIC;AAAA,IACJ,OAAO;AAAA,IACP,MAAM;AAAA,IACN,aAAAO;AAAA,IACA,cAAc,CAAC,CAACR,GAAS;AAAA,IACzB,IAAI;AAAA,MACA;AAAA,QACI,IAAIE;AAAA,QACJ,MAAM;AAAA,QACN,QAAQO,EAAiB;AAAA,QACzB,mBAAmB;AAAA,QACnB,QAAQ;AAAA,UACJ;AAAA,YACI,IAAIN;AAAA,YACJ,MAAM;AAAA,YACN,cAAcO,EAAY;AAAA,YAC1B,SAAS;AAAA,cACL;AAAA,gBACI,OAAOA,EAAY;AAAA,gBACnB,OAAOA,EAAY;AAAA,cAAA;AAAA,cAEvB;AAAA,gBACI,OAAOA,EAAY;AAAA,gBACnB,OAAOA,EAAY;AAAA,cAAA;AAAA,cAEvB;AAAA,gBACI,OAAOA,EAAY;AAAA,gBACnB,OAAOA,EAAY;AAAA,cAAA;AAAA,YACvB;AAAA,UACJ;AAAA,UAEJ;AAAA,YACI,IAAIN;AAAA,YACJ,MAAM;AAAA,YACN,cAAcO;AAAA,YACd,OAAO;AAAA,cACHC;AAAA,cACAC,EAA4B,CAAC;AAAA,cAC7BC,EAAkC,GAAG;AAAA,YAAA;AAAA,YAEzC,aAAa;AAAA,YACb,UAAU,CAACC,MAAWC,EAAWD,GAAQX,CAAO;AAAA,UAAA;AAAA,UAEpD;AAAA,YACI,IAAIC;AAAA,YACJ,MAAM;AAAA,YACN,cAAcC;AAAA,UAAA;AAAA,QAClB;AAAA,MACJ;AAAA,IACJ;AAAA,IAEJ,KAAK,CAAA;AAAA,EAAC;AAEd;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* empty css */
|
|
2
|
-
import {
|
|
3
|
-
import { Radius as a, radiusStyleMap as
|
|
4
|
-
const
|
|
2
|
+
import { numericalOrPixelRule as t, appendUnit as n, presetCustomValue as s } from "@frontify/sidebar-settings";
|
|
3
|
+
import { Radius as a, radiusStyleMap as o } from "./types.es.js";
|
|
4
|
+
const c = (e, l = a.None) => ({
|
|
5
5
|
id: e,
|
|
6
6
|
type: "segmentedControls",
|
|
7
7
|
defaultValue: l,
|
|
@@ -23,8 +23,8 @@ const t = (e, l = a.None) => ({
|
|
|
23
23
|
label: "L"
|
|
24
24
|
}
|
|
25
25
|
]
|
|
26
|
-
}),
|
|
27
|
-
const l = e
|
|
26
|
+
}), f = (e) => {
|
|
27
|
+
const l = e?.id ? `hasRadius_${e.id}` : "hasRadius", u = e?.id ? `radiusValue_${e.id}` : "radiusValue", r = e?.id ? `radiusChoice_${e.id}` : "radiusChoice", i = e?.defaultRadius || a.None;
|
|
28
28
|
return {
|
|
29
29
|
id: l,
|
|
30
30
|
label: "Corner radius",
|
|
@@ -32,25 +32,22 @@ const t = (e, l = a.None) => ({
|
|
|
32
32
|
switchLabel: "Custom",
|
|
33
33
|
defaultValue: !1,
|
|
34
34
|
info: "Determining how rounded the corners are.",
|
|
35
|
-
show: (d) =>
|
|
36
|
-
|
|
37
|
-
return e != null && e.dependentSettingId ? !!((c = d.getBlock(e.dependentSettingId)) != null && c.value) : !0;
|
|
38
|
-
},
|
|
39
|
-
onChange: (d) => f(d, r, u, (e == null ? void 0 : e.radiusStyleMap) || i),
|
|
35
|
+
show: (d) => e?.dependentSettingId ? !!d.getBlock(e.dependentSettingId)?.value : !0,
|
|
36
|
+
onChange: (d) => s(d, r, u, e?.radiusStyleMap || o),
|
|
40
37
|
on: [
|
|
41
38
|
{
|
|
42
39
|
id: u,
|
|
43
40
|
type: "input",
|
|
44
41
|
placeholder: "e.g. 10px",
|
|
45
|
-
rules: [
|
|
46
|
-
onChange: (d) =>
|
|
42
|
+
rules: [t],
|
|
43
|
+
onChange: (d) => n(d, u)
|
|
47
44
|
}
|
|
48
45
|
],
|
|
49
|
-
off: [
|
|
46
|
+
off: [c(r, i)]
|
|
50
47
|
};
|
|
51
48
|
};
|
|
52
49
|
export {
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
f as getBorderRadiusSettings,
|
|
51
|
+
c as getBorderRadiusSlider
|
|
55
52
|
};
|
|
56
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 { type SettingBlock, appendUnit, numericalOrPixelRule, presetCustomValue } 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],\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","
|
|
1
|
+
{"version":3,"file":"borderRadius.es.js","sources":["../../src/settings/borderRadius.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type SettingBlock, appendUnit, numericalOrPixelRule, presetCustomValue } 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],\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","appendUnit"],"mappings":";;;AAsBO,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,IAEX;AAAA,MACI,OAAOA,EAAO;AAAA,MACd,OAAO;AAAA,IAAA;AAAA,IAEX;AAAA,MACI,OAAOA,EAAO;AAAA,MACd,OAAO;AAAA,IAAA;AAAA,IAEX;AAAA,MACI,OAAOA,EAAO;AAAA,MACd,OAAO;AAAA,IAAA;AAAA,EACX;AAER,IAEaC,IAA0B,CAACC,MAAqD;AACzF,QAAMC,IAAQD,GAAS,KAAK,aAAaA,EAAQ,EAAE,KAAK,aAClDE,IAAUF,GAAS,KAAK,eAAeA,EAAQ,EAAE,KAAK,eACtDG,IAAWH,GAAS,KAAK,gBAAgBA,EAAQ,EAAE,KAAK,gBACxDH,IAAeG,GAAS,iBAAiBF,EAAO;AAEtD,SAAO;AAAA,IACH,IAAIG;AAAA,IACJ,OAAO;AAAA,IACP,MAAM;AAAA,IACN,aAAa;AAAA,IACb,cAAc;AAAA,IACd,MAAM;AAAA,IACN,MAAM,CAACG,MAAYJ,GAAS,qBAAqB,CAAC,CAACI,EAAO,SAASJ,EAAQ,kBAAkB,GAAG,QAAQ;AAAA,IACxG,UAAU,CAACI,MAAWC,EAAkBD,GAAQD,GAAUD,GAASF,GAAS,kBAAkBM,CAAc;AAAA,IAC5G,IAAI;AAAA,MACA;AAAA,QACI,IAAIJ;AAAA,QACJ,MAAM;AAAA,QACN,aAAa;AAAA,QACb,OAAO,CAACK,CAAoB;AAAA,QAC5B,UAAU,CAACH,MAAWI,EAAWJ,GAAQF,CAAO;AAAA,MAAA;AAAA,IACpD;AAAA,IAEJ,KAAK,CAACP,EAAsBQ,GAAUN,CAAY,CAAC;AAAA,EAAA;AAE3D;"}
|
|
@@ -1,64 +1,61 @@
|
|
|
1
1
|
/* empty css */
|
|
2
|
-
import {
|
|
3
|
-
import { getBorderRadiusSlider as
|
|
4
|
-
import { radiusStyleMap as
|
|
5
|
-
const
|
|
6
|
-
const
|
|
2
|
+
import { numericalOrPixelRule as i, MultiInputLayout as m, appendUnit as a, presetCustomValue as u } from "@frontify/sidebar-settings";
|
|
3
|
+
import { getBorderRadiusSlider as g } from "./borderRadius.es.js";
|
|
4
|
+
import { radiusStyleMap as n } from "./types.es.js";
|
|
5
|
+
const C = (e) => {
|
|
6
|
+
const R = e?.id ? `hasExtendedCustomRadius_${e.id}` : "hasExtendedCustomRadius", h = e?.id ? `extendedRadiusValue_${e.id}` : "extendedRadiusValue", d = e?.id ? `extendedRadiusChoice_${e.id}` : "extendedRadiusChoice", o = e?.id ? `extendedRadiusTopLeft_${e.id}` : "extendedRadiusTopLeft", l = e?.id ? `extendedRadiusTopRight_${e.id}` : "extendedRadiusTopRight", r = e?.id ? `extendedRadiusBottomLeft_${e.id}` : "extendedRadiusBottomLeft", s = e?.id ? `extendedRadiusBottomRight_${e.id}` : "extendedRadiusBottomRight";
|
|
7
7
|
return {
|
|
8
|
-
id:
|
|
8
|
+
id: R,
|
|
9
9
|
label: "Corner radius",
|
|
10
10
|
type: "switch",
|
|
11
11
|
switchLabel: "Custom",
|
|
12
12
|
defaultValue: !1,
|
|
13
13
|
info: "Determining how rounded the corners are.",
|
|
14
|
-
show: (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
},
|
|
18
|
-
onChange: (d) => {
|
|
19
|
-
l(d, t, R, r), l(d, t, h, r), l(d, t, m, r), l(d, t, g, r);
|
|
14
|
+
show: (t) => e?.dependentSettingId ? !!t.getBlock(e.dependentSettingId)?.value : !0,
|
|
15
|
+
onChange: (t) => {
|
|
16
|
+
u(t, d, o, n), u(t, d, l, n), u(t, d, r, n), u(t, d, s, n);
|
|
20
17
|
},
|
|
21
18
|
on: [
|
|
22
19
|
{
|
|
23
|
-
id:
|
|
20
|
+
id: h,
|
|
24
21
|
type: "multiInput",
|
|
25
|
-
layout:
|
|
22
|
+
layout: m.Columns,
|
|
26
23
|
blocks: [
|
|
27
24
|
{
|
|
28
|
-
id:
|
|
25
|
+
id: o,
|
|
29
26
|
type: "input",
|
|
30
27
|
label: "Top Left",
|
|
31
|
-
rules: [
|
|
32
|
-
onChange: (
|
|
28
|
+
rules: [i],
|
|
29
|
+
onChange: (t) => a(t, o)
|
|
33
30
|
},
|
|
34
31
|
{
|
|
35
|
-
id:
|
|
32
|
+
id: l,
|
|
36
33
|
type: "input",
|
|
37
34
|
label: "Top Right",
|
|
38
|
-
rules: [
|
|
39
|
-
onChange: (
|
|
35
|
+
rules: [i],
|
|
36
|
+
onChange: (t) => a(t, l)
|
|
40
37
|
},
|
|
41
38
|
{
|
|
42
|
-
id:
|
|
39
|
+
id: r,
|
|
43
40
|
type: "input",
|
|
44
41
|
label: "Bottom Left",
|
|
45
|
-
rules: [
|
|
46
|
-
onChange: (
|
|
42
|
+
rules: [i],
|
|
43
|
+
onChange: (t) => a(t, r)
|
|
47
44
|
},
|
|
48
45
|
{
|
|
49
|
-
id:
|
|
46
|
+
id: s,
|
|
50
47
|
type: "input",
|
|
51
48
|
label: "Bottom Right",
|
|
52
|
-
rules: [
|
|
53
|
-
onChange: (
|
|
49
|
+
rules: [i],
|
|
50
|
+
onChange: (t) => a(t, s)
|
|
54
51
|
}
|
|
55
52
|
]
|
|
56
53
|
}
|
|
57
54
|
],
|
|
58
|
-
off: [
|
|
55
|
+
off: [g(d, e?.defaultValue)]
|
|
59
56
|
};
|
|
60
57
|
};
|
|
61
58
|
export {
|
|
62
|
-
|
|
59
|
+
C as getExtendedBorderRadiusSettings
|
|
63
60
|
};
|
|
64
61
|
//# sourceMappingURL=borderRadiusExtended.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"borderRadiusExtended.es.js","sources":["../../src/settings/borderRadiusExtended.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { MultiInputLayout, type SettingBlock, appendUnit, numericalOrPixelRule, presetCustomValue } from '../';\n\nimport { getBorderRadiusSlider } from './borderRadius';\nimport { type Radius, radiusStyleMap } from './types';\n\n/**\n * Returns border radius settings: border radius switch, radius slider, custom radius inputs for every corner\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 defaultValue?: Radius;\n};\n\nexport const getExtendedBorderRadiusSettings = (options?: BorderRadiusSettingsType): SettingBlock => {\n const hasId = options?.id ? `hasExtendedCustomRadius_${options.id}` : 'hasExtendedCustomRadius';\n const valueId = options?.id ? `extendedRadiusValue_${options.id}` : 'extendedRadiusValue';\n const choiceId = options?.id ? `extendedRadiusChoice_${options.id}` : 'extendedRadiusChoice';\n const topLeftId = options?.id ? `extendedRadiusTopLeft_${options.id}` : 'extendedRadiusTopLeft';\n const topRightId = options?.id ? `extendedRadiusTopRight_${options.id}` : 'extendedRadiusTopRight';\n const bottomLeftId = options?.id ? `extendedRadiusBottomLeft_${options.id}` : 'extendedRadiusBottomLeft';\n const bottomRightId = options?.id ? `extendedRadiusBottomRight_${options.id}` : 'extendedRadiusBottomRight';\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) => {\n presetCustomValue(bundle, choiceId, topLeftId, radiusStyleMap);\n presetCustomValue(bundle, choiceId, topRightId, radiusStyleMap);\n presetCustomValue(bundle, choiceId, bottomLeftId, radiusStyleMap);\n presetCustomValue(bundle, choiceId, bottomRightId, radiusStyleMap);\n },\n on: [\n {\n id: valueId,\n type: 'multiInput',\n layout: MultiInputLayout.Columns,\n blocks: [\n {\n id: topLeftId,\n type: 'input',\n label: 'Top Left',\n rules: [numericalOrPixelRule],\n onChange: (bundle) => appendUnit(bundle, topLeftId),\n },\n {\n id: topRightId,\n type: 'input',\n label: 'Top Right',\n rules: [numericalOrPixelRule],\n onChange: (bundle) => appendUnit(bundle, topRightId),\n },\n {\n id: bottomLeftId,\n type: 'input',\n label: 'Bottom Left',\n rules: [numericalOrPixelRule],\n onChange: (bundle) => appendUnit(bundle, bottomLeftId),\n },\n {\n id: bottomRightId,\n type: 'input',\n label: 'Bottom Right',\n rules: [numericalOrPixelRule],\n onChange: (bundle) => appendUnit(bundle, bottomRightId),\n },\n ],\n },\n ],\n off: [getBorderRadiusSlider(choiceId, options?.defaultValue)],\n };\n};\n"],"names":["getExtendedBorderRadiusSettings","options","hasId","valueId","choiceId","topLeftId","topRightId","bottomLeftId","bottomRightId","bundle","
|
|
1
|
+
{"version":3,"file":"borderRadiusExtended.es.js","sources":["../../src/settings/borderRadiusExtended.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { MultiInputLayout, type SettingBlock, appendUnit, numericalOrPixelRule, presetCustomValue } from '../';\n\nimport { getBorderRadiusSlider } from './borderRadius';\nimport { type Radius, radiusStyleMap } from './types';\n\n/**\n * Returns border radius settings: border radius switch, radius slider, custom radius inputs for every corner\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 defaultValue?: Radius;\n};\n\nexport const getExtendedBorderRadiusSettings = (options?: BorderRadiusSettingsType): SettingBlock => {\n const hasId = options?.id ? `hasExtendedCustomRadius_${options.id}` : 'hasExtendedCustomRadius';\n const valueId = options?.id ? `extendedRadiusValue_${options.id}` : 'extendedRadiusValue';\n const choiceId = options?.id ? `extendedRadiusChoice_${options.id}` : 'extendedRadiusChoice';\n const topLeftId = options?.id ? `extendedRadiusTopLeft_${options.id}` : 'extendedRadiusTopLeft';\n const topRightId = options?.id ? `extendedRadiusTopRight_${options.id}` : 'extendedRadiusTopRight';\n const bottomLeftId = options?.id ? `extendedRadiusBottomLeft_${options.id}` : 'extendedRadiusBottomLeft';\n const bottomRightId = options?.id ? `extendedRadiusBottomRight_${options.id}` : 'extendedRadiusBottomRight';\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) => {\n presetCustomValue(bundle, choiceId, topLeftId, radiusStyleMap);\n presetCustomValue(bundle, choiceId, topRightId, radiusStyleMap);\n presetCustomValue(bundle, choiceId, bottomLeftId, radiusStyleMap);\n presetCustomValue(bundle, choiceId, bottomRightId, radiusStyleMap);\n },\n on: [\n {\n id: valueId,\n type: 'multiInput',\n layout: MultiInputLayout.Columns,\n blocks: [\n {\n id: topLeftId,\n type: 'input',\n label: 'Top Left',\n rules: [numericalOrPixelRule],\n onChange: (bundle) => appendUnit(bundle, topLeftId),\n },\n {\n id: topRightId,\n type: 'input',\n label: 'Top Right',\n rules: [numericalOrPixelRule],\n onChange: (bundle) => appendUnit(bundle, topRightId),\n },\n {\n id: bottomLeftId,\n type: 'input',\n label: 'Bottom Left',\n rules: [numericalOrPixelRule],\n onChange: (bundle) => appendUnit(bundle, bottomLeftId),\n },\n {\n id: bottomRightId,\n type: 'input',\n label: 'Bottom Right',\n rules: [numericalOrPixelRule],\n onChange: (bundle) => appendUnit(bundle, bottomRightId),\n },\n ],\n },\n ],\n off: [getBorderRadiusSlider(choiceId, options?.defaultValue)],\n };\n};\n"],"names":["getExtendedBorderRadiusSettings","options","hasId","valueId","choiceId","topLeftId","topRightId","bottomLeftId","bottomRightId","bundle","presetCustomValue","radiusStyleMap","MultiInputLayout","numericalOrPixelRule","appendUnit","getBorderRadiusSlider"],"mappings":";;;;AAsBO,MAAMA,IAAkC,CAACC,MAAqD;AACjG,QAAMC,IAAQD,GAAS,KAAK,2BAA2BA,EAAQ,EAAE,KAAK,2BAChEE,IAAUF,GAAS,KAAK,uBAAuBA,EAAQ,EAAE,KAAK,uBAC9DG,IAAWH,GAAS,KAAK,wBAAwBA,EAAQ,EAAE,KAAK,wBAChEI,IAAYJ,GAAS,KAAK,yBAAyBA,EAAQ,EAAE,KAAK,yBAClEK,IAAaL,GAAS,KAAK,0BAA0BA,EAAQ,EAAE,KAAK,0BACpEM,IAAeN,GAAS,KAAK,4BAA4BA,EAAQ,EAAE,KAAK,4BACxEO,IAAgBP,GAAS,KAAK,6BAA6BA,EAAQ,EAAE,KAAK;AAEhF,SAAO;AAAA,IACH,IAAIC;AAAA,IACJ,OAAO;AAAA,IACP,MAAM;AAAA,IACN,aAAa;AAAA,IACb,cAAc;AAAA,IACd,MAAM;AAAA,IACN,MAAM,CAACO,MAAYR,GAAS,qBAAqB,CAAC,CAACQ,EAAO,SAASR,EAAQ,kBAAkB,GAAG,QAAQ;AAAA,IACxG,UAAU,CAACQ,MAAW;AAClB,MAAAC,EAAkBD,GAAQL,GAAUC,GAAWM,CAAc,GAC7DD,EAAkBD,GAAQL,GAAUE,GAAYK,CAAc,GAC9DD,EAAkBD,GAAQL,GAAUG,GAAcI,CAAc,GAChED,EAAkBD,GAAQL,GAAUI,GAAeG,CAAc;AAAA,IACrE;AAAA,IACA,IAAI;AAAA,MACA;AAAA,QACI,IAAIR;AAAA,QACJ,MAAM;AAAA,QACN,QAAQS,EAAiB;AAAA,QACzB,QAAQ;AAAA,UACJ;AAAA,YACI,IAAIP;AAAA,YACJ,MAAM;AAAA,YACN,OAAO;AAAA,YACP,OAAO,CAACQ,CAAoB;AAAA,YAC5B,UAAU,CAACJ,MAAWK,EAAWL,GAAQJ,CAAS;AAAA,UAAA;AAAA,UAEtD;AAAA,YACI,IAAIC;AAAA,YACJ,MAAM;AAAA,YACN,OAAO;AAAA,YACP,OAAO,CAACO,CAAoB;AAAA,YAC5B,UAAU,CAACJ,MAAWK,EAAWL,GAAQH,CAAU;AAAA,UAAA;AAAA,UAEvD;AAAA,YACI,IAAIC;AAAA,YACJ,MAAM;AAAA,YACN,OAAO;AAAA,YACP,OAAO,CAACM,CAAoB;AAAA,YAC5B,UAAU,CAACJ,MAAWK,EAAWL,GAAQF,CAAY;AAAA,UAAA;AAAA,UAEzD;AAAA,YACI,IAAIC;AAAA,YACJ,MAAM;AAAA,YACN,OAAO;AAAA,YACP,OAAO,CAACK,CAAoB;AAAA,YAC5B,UAAU,CAACJ,MAAWK,EAAWL,GAAQD,CAAa;AAAA,UAAA;AAAA,QAC1D;AAAA,MACJ;AAAA,IACJ;AAAA,IAEJ,KAAK,CAACO,EAAsBX,GAAUH,GAAS,YAAY,CAAC;AAAA,EAAA;AAEpE;"}
|
|
@@ -1,48 +1,45 @@
|
|
|
1
1
|
/* empty css */
|
|
2
|
-
import {
|
|
3
|
-
import { GutterSpacing as
|
|
4
|
-
const
|
|
5
|
-
const
|
|
2
|
+
import { numericalOrPixelRule as d, appendUnit as s, presetCustomValue as g } from "@frontify/sidebar-settings";
|
|
3
|
+
import { GutterSpacing as a, gutterSpacingStyleMap as o } from "./types.es.js";
|
|
4
|
+
const m = (e) => {
|
|
5
|
+
const c = e?.id ? e.id : "hasCustomSpacing", i = e?.dependentSettingId ? e.dependentSettingId : "columns", u = e?.spacingChoiceId ? e.spacingChoiceId : "spacingChoice", l = e?.spacingCustomId ? e.spacingCustomId : "spacingCustom", n = e?.defaultValueChoices ? e.defaultValueChoices : a.M;
|
|
6
6
|
return {
|
|
7
|
-
id:
|
|
7
|
+
id: c,
|
|
8
8
|
type: "switch",
|
|
9
9
|
defaultValue: !1,
|
|
10
10
|
switchLabel: "Custom",
|
|
11
11
|
label: "Gutter",
|
|
12
12
|
info: "An official nerds term for ‘gap’",
|
|
13
|
-
onChange: (
|
|
14
|
-
show: (
|
|
15
|
-
var d;
|
|
16
|
-
return ((d = a.getBlock(g)) == null ? void 0 : d.value) !== "1";
|
|
17
|
-
},
|
|
13
|
+
onChange: (t) => g(t, u, l, o),
|
|
14
|
+
show: (t) => t.getBlock(i)?.value !== "1",
|
|
18
15
|
on: [
|
|
19
16
|
{
|
|
20
|
-
id:
|
|
17
|
+
id: l,
|
|
21
18
|
type: "input",
|
|
22
|
-
rules: [
|
|
23
|
-
onChange: (
|
|
19
|
+
rules: [d],
|
|
20
|
+
onChange: (t) => s(t, l)
|
|
24
21
|
}
|
|
25
22
|
],
|
|
26
23
|
off: [
|
|
27
24
|
{
|
|
28
|
-
id:
|
|
25
|
+
id: u,
|
|
29
26
|
type: "slider",
|
|
30
|
-
defaultValue:
|
|
27
|
+
defaultValue: n,
|
|
31
28
|
choices: [
|
|
32
29
|
{
|
|
33
|
-
value:
|
|
30
|
+
value: a.Auto,
|
|
34
31
|
label: "Auto"
|
|
35
32
|
},
|
|
36
33
|
{
|
|
37
|
-
value:
|
|
34
|
+
value: a.S,
|
|
38
35
|
label: "S"
|
|
39
36
|
},
|
|
40
37
|
{
|
|
41
|
-
value:
|
|
38
|
+
value: a.M,
|
|
42
39
|
label: "M"
|
|
43
40
|
},
|
|
44
41
|
{
|
|
45
|
-
value:
|
|
42
|
+
value: a.L,
|
|
46
43
|
label: "L"
|
|
47
44
|
}
|
|
48
45
|
]
|
|
@@ -51,6 +48,6 @@ const I = (e) => {
|
|
|
51
48
|
};
|
|
52
49
|
};
|
|
53
50
|
export {
|
|
54
|
-
|
|
51
|
+
m as getGutterSettings
|
|
55
52
|
};
|
|
56
53
|
//# sourceMappingURL=gutter.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gutter.es.js","sources":["../../src/settings/gutter.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type SettingBlock, appendUnit, numericalOrPixelRule, presetCustomValue } from '../';\n\nimport { GutterSpacing, gutterSpacingStyleMap } from './types';\n\n/**\n * Returns gutter settings: gutter switch, gutter choices or gutter custom input\n *\n * @param options Options for the settings\n * @param options.id Custom id for the gutters switch\n * @param options.dependentSettingId Id of the dependent setting\n * @param options.spacingChoiceId Id of the spacing choice\n * @param options.defaultValueChoices Default value for the spacing choice\n * @returns {SettingBlock} Returns the gutter settings\n */\n\ntype GutterSettingsType = {\n id?: string;\n dependentSettingId?: string;\n spacingChoiceId?: string;\n spacingCustomId?: string;\n defaultValueChoices?: GutterSpacing;\n};\n\nexport const getGutterSettings = (options?: GutterSettingsType): SettingBlock => {\n const id = options?.id ? options.id : 'hasCustomSpacing';\n const dependentSettingId = options?.dependentSettingId ? options.dependentSettingId : 'columns';\n const spacingChoiceId = options?.spacingChoiceId ? options.spacingChoiceId : 'spacingChoice';\n const spacingCustomId = options?.spacingCustomId ? options.spacingCustomId : 'spacingCustom';\n const defaultValueChoices = options?.defaultValueChoices ? options.defaultValueChoices : GutterSpacing.M;\n\n return {\n id,\n type: 'switch',\n defaultValue: false,\n switchLabel: 'Custom',\n label: 'Gutter',\n info: 'An official nerds term for ‘gap’',\n onChange: (bundle) => presetCustomValue(bundle, spacingChoiceId, spacingCustomId, gutterSpacingStyleMap),\n show: (bundle) => bundle.getBlock(dependentSettingId)?.value !== '1',\n on: [\n {\n id: spacingCustomId,\n type: 'input',\n rules: [numericalOrPixelRule],\n onChange: (bundle) => appendUnit(bundle, spacingCustomId),\n },\n ],\n off: [\n {\n id: spacingChoiceId,\n type: 'slider',\n defaultValue: defaultValueChoices,\n choices: [\n {\n value: GutterSpacing.Auto,\n label: 'Auto',\n },\n {\n value: GutterSpacing.S,\n label: 'S',\n },\n {\n value: GutterSpacing.M,\n label: 'M',\n },\n {\n value: GutterSpacing.L,\n label: 'L',\n },\n ],\n },\n ],\n };\n};\n"],"names":["getGutterSettings","options","id","dependentSettingId","spacingChoiceId","spacingCustomId","defaultValueChoices","GutterSpacing","bundle","presetCustomValue","gutterSpacingStyleMap","
|
|
1
|
+
{"version":3,"file":"gutter.es.js","sources":["../../src/settings/gutter.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type SettingBlock, appendUnit, numericalOrPixelRule, presetCustomValue } from '../';\n\nimport { GutterSpacing, gutterSpacingStyleMap } from './types';\n\n/**\n * Returns gutter settings: gutter switch, gutter choices or gutter custom input\n *\n * @param options Options for the settings\n * @param options.id Custom id for the gutters switch\n * @param options.dependentSettingId Id of the dependent setting\n * @param options.spacingChoiceId Id of the spacing choice\n * @param options.defaultValueChoices Default value for the spacing choice\n * @returns {SettingBlock} Returns the gutter settings\n */\n\ntype GutterSettingsType = {\n id?: string;\n dependentSettingId?: string;\n spacingChoiceId?: string;\n spacingCustomId?: string;\n defaultValueChoices?: GutterSpacing;\n};\n\nexport const getGutterSettings = (options?: GutterSettingsType): SettingBlock => {\n const id = options?.id ? options.id : 'hasCustomSpacing';\n const dependentSettingId = options?.dependentSettingId ? options.dependentSettingId : 'columns';\n const spacingChoiceId = options?.spacingChoiceId ? options.spacingChoiceId : 'spacingChoice';\n const spacingCustomId = options?.spacingCustomId ? options.spacingCustomId : 'spacingCustom';\n const defaultValueChoices = options?.defaultValueChoices ? options.defaultValueChoices : GutterSpacing.M;\n\n return {\n id,\n type: 'switch',\n defaultValue: false,\n switchLabel: 'Custom',\n label: 'Gutter',\n info: 'An official nerds term for ‘gap’',\n onChange: (bundle) => presetCustomValue(bundle, spacingChoiceId, spacingCustomId, gutterSpacingStyleMap),\n show: (bundle) => bundle.getBlock(dependentSettingId)?.value !== '1',\n on: [\n {\n id: spacingCustomId,\n type: 'input',\n rules: [numericalOrPixelRule],\n onChange: (bundle) => appendUnit(bundle, spacingCustomId),\n },\n ],\n off: [\n {\n id: spacingChoiceId,\n type: 'slider',\n defaultValue: defaultValueChoices,\n choices: [\n {\n value: GutterSpacing.Auto,\n label: 'Auto',\n },\n {\n value: GutterSpacing.S,\n label: 'S',\n },\n {\n value: GutterSpacing.M,\n label: 'M',\n },\n {\n value: GutterSpacing.L,\n label: 'L',\n },\n ],\n },\n ],\n };\n};\n"],"names":["getGutterSettings","options","id","dependentSettingId","spacingChoiceId","spacingCustomId","defaultValueChoices","GutterSpacing","bundle","presetCustomValue","gutterSpacingStyleMap","numericalOrPixelRule","appendUnit"],"mappings":";;;AAyBO,MAAMA,IAAoB,CAACC,MAA+C;AAC7E,QAAMC,IAAKD,GAAS,KAAKA,EAAQ,KAAK,oBAChCE,IAAqBF,GAAS,qBAAqBA,EAAQ,qBAAqB,WAChFG,IAAkBH,GAAS,kBAAkBA,EAAQ,kBAAkB,iBACvEI,IAAkBJ,GAAS,kBAAkBA,EAAQ,kBAAkB,iBACvEK,IAAsBL,GAAS,sBAAsBA,EAAQ,sBAAsBM,EAAc;AAEvG,SAAO;AAAA,IACH,IAAAL;AAAA,IACA,MAAM;AAAA,IACN,cAAc;AAAA,IACd,aAAa;AAAA,IACb,OAAO;AAAA,IACP,MAAM;AAAA,IACN,UAAU,CAACM,MAAWC,EAAkBD,GAAQJ,GAAiBC,GAAiBK,CAAqB;AAAA,IACvG,MAAM,CAACF,MAAWA,EAAO,SAASL,CAAkB,GAAG,UAAU;AAAA,IACjE,IAAI;AAAA,MACA;AAAA,QACI,IAAIE;AAAA,QACJ,MAAM;AAAA,QACN,OAAO,CAACM,CAAoB;AAAA,QAC5B,UAAU,CAACH,MAAWI,EAAWJ,GAAQH,CAAe;AAAA,MAAA;AAAA,IAC5D;AAAA,IAEJ,KAAK;AAAA,MACD;AAAA,QACI,IAAID;AAAA,QACJ,MAAM;AAAA,QACN,cAAcE;AAAA,QACd,SAAS;AAAA,UACL;AAAA,YACI,OAAOC,EAAc;AAAA,YACrB,OAAO;AAAA,UAAA;AAAA,UAEX;AAAA,YACI,OAAOA,EAAc;AAAA,YACrB,OAAO;AAAA,UAAA;AAAA,UAEX;AAAA,YACI,OAAOA,EAAc;AAAA,YACrB,OAAO;AAAA,UAAA;AAAA,UAEX;AAAA,YACI,OAAOA,EAAc;AAAA,YACrB,OAAO;AAAA,UAAA;AAAA,QACX;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AAER;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* empty css */
|
|
2
|
-
import {
|
|
3
|
-
import { MARGIN_DEFAULT_PLACEHOLDER as
|
|
4
|
-
import { Margin as a, marginStyleMap as
|
|
5
|
-
const
|
|
2
|
+
import { numericalOrPixelRule as t, appendUnit as u, maximumNumericalOrPixelOrAutoRule as m, presetCustomValue as o } from "@frontify/sidebar-settings";
|
|
3
|
+
import { MARGIN_DEFAULT_PLACEHOLDER as g } from "./defaultValues.es.js";
|
|
4
|
+
import { Margin as a, marginStyleMap as c } from "./types.es.js";
|
|
5
|
+
const d = (e) => ({
|
|
6
6
|
id: e,
|
|
7
7
|
type: "segmentedControls",
|
|
8
8
|
defaultValue: a.None,
|
|
@@ -24,30 +24,30 @@ const f = (e) => ({
|
|
|
24
24
|
label: "L"
|
|
25
25
|
}
|
|
26
26
|
]
|
|
27
|
-
}),
|
|
28
|
-
const
|
|
27
|
+
}), C = (e) => {
|
|
28
|
+
const n = e?.id ? `hasCustomMarginValue_${e?.id}` : "hasCustomMarginValue", l = e?.id ? `marginValue_${e?.id}` : "marginValue", r = e?.id ? `marginChoice_${e?.id}` : "marginChoice";
|
|
29
29
|
return {
|
|
30
|
-
id:
|
|
30
|
+
id: n,
|
|
31
31
|
label: "Margin",
|
|
32
32
|
type: "switch",
|
|
33
33
|
switchLabel: "Custom",
|
|
34
34
|
defaultValue: !1,
|
|
35
35
|
info: "The spacing around UI elements to create more space",
|
|
36
|
-
onChange: (
|
|
36
|
+
onChange: (i) => o(i, r, l, e?.marginStyleMap || c),
|
|
37
37
|
on: [
|
|
38
38
|
{
|
|
39
39
|
id: l,
|
|
40
40
|
type: "input",
|
|
41
|
-
placeholder:
|
|
42
|
-
rules: [
|
|
43
|
-
onChange: (
|
|
41
|
+
placeholder: g,
|
|
42
|
+
rules: [t, m(500)],
|
|
43
|
+
onChange: (i) => u(i, l)
|
|
44
44
|
}
|
|
45
45
|
],
|
|
46
|
-
off: [
|
|
46
|
+
off: [d(r)]
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
49
|
export {
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
C as getMarginSettings,
|
|
51
|
+
d as getMarginSlider
|
|
52
52
|
};
|
|
53
53
|
//# sourceMappingURL=margin.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"margin.es.js","sources":["../../src/settings/margin.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type SettingBlock,\n appendUnit,\n maximumNumericalOrPixelOrAutoRule,\n numericalOrPixelRule,\n presetCustomValue,\n} from '../';\n\nimport { MARGIN_DEFAULT_PLACEHOLDER } from './defaultValues';\nimport { Margin, marginStyleMap } from './types';\n\ntype MarginSettingsType = {\n id?: string;\n marginStyleMap?: Record<Margin, string>;\n};\n\n/**\n * Returns margin settings: margin switch, margin slider, custom margin input\n *\n * @param {string} id Custom suffix for the setting ids\n * @returns {SettingBlock} Returns margin settings\n */\nexport const getMarginSlider = (id: string): SettingBlock => ({\n id,\n type: 'segmentedControls',\n defaultValue: Margin.None,\n choices: [\n {\n value: Margin.None,\n label: 'None',\n },\n {\n value: Margin.Small,\n label: 'S',\n },\n {\n value: Margin.Medium,\n label: 'M',\n },\n {\n value: Margin.Large,\n label: 'L',\n },\n ],\n});\n\nexport const getMarginSettings = (options?: MarginSettingsType): SettingBlock => {\n const hasId = options?.id ? `hasCustomMarginValue_${options?.id}` : 'hasCustomMarginValue';\n const valueId = options?.id ? `marginValue_${options?.id}` : 'marginValue';\n const choiceId = options?.id ? `marginChoice_${options?.id}` : 'marginChoice';\n\n return {\n id: hasId,\n label: 'Margin',\n type: 'switch',\n switchLabel: 'Custom',\n defaultValue: false,\n info: 'The spacing around UI elements to create more space',\n onChange: (bundle) => presetCustomValue(bundle, choiceId, valueId, options?.marginStyleMap || marginStyleMap),\n on: [\n {\n id: valueId,\n type: 'input',\n placeholder: MARGIN_DEFAULT_PLACEHOLDER,\n rules: [numericalOrPixelRule, maximumNumericalOrPixelOrAutoRule(500)],\n onChange: (bundle) => appendUnit(bundle, valueId),\n },\n ],\n off: [getMarginSlider(choiceId)],\n };\n};\n"],"names":["getMarginSlider","id","Margin","getMarginSettings","options","hasId","valueId","choiceId","bundle","presetCustomValue","marginStyleMap","MARGIN_DEFAULT_PLACEHOLDER","numericalOrPixelRule","maximumNumericalOrPixelOrAutoRule","appendUnit"],"mappings":";;;;AAwBO,MAAMA,IAAkB,CAACC,OAA8B;AAAA,EAC1D,IAAAA;AAAA,EACA,MAAM;AAAA,EACN,cAAcC,EAAO;AAAA,EACrB,SAAS;AAAA,IACL;AAAA,MACI,OAAOA,EAAO;AAAA,MACd,OAAO;AAAA,IAAA;AAAA,IAEX;AAAA,MACI,OAAOA,EAAO;AAAA,MACd,OAAO;AAAA,IAAA;AAAA,IAEX;AAAA,MACI,OAAOA,EAAO;AAAA,MACd,OAAO;AAAA,IAAA;AAAA,IAEX;AAAA,MACI,OAAOA,EAAO;AAAA,MACd,OAAO;AAAA,IAAA;AAAA,EACX;AAER,IAEaC,IAAoB,CAACC,MAA+C;AAC7E,QAAMC,IAAQD,
|
|
1
|
+
{"version":3,"file":"margin.es.js","sources":["../../src/settings/margin.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n type SettingBlock,\n appendUnit,\n maximumNumericalOrPixelOrAutoRule,\n numericalOrPixelRule,\n presetCustomValue,\n} from '../';\n\nimport { MARGIN_DEFAULT_PLACEHOLDER } from './defaultValues';\nimport { Margin, marginStyleMap } from './types';\n\ntype MarginSettingsType = {\n id?: string;\n marginStyleMap?: Record<Margin, string>;\n};\n\n/**\n * Returns margin settings: margin switch, margin slider, custom margin input\n *\n * @param {string} id Custom suffix for the setting ids\n * @returns {SettingBlock} Returns margin settings\n */\nexport const getMarginSlider = (id: string): SettingBlock => ({\n id,\n type: 'segmentedControls',\n defaultValue: Margin.None,\n choices: [\n {\n value: Margin.None,\n label: 'None',\n },\n {\n value: Margin.Small,\n label: 'S',\n },\n {\n value: Margin.Medium,\n label: 'M',\n },\n {\n value: Margin.Large,\n label: 'L',\n },\n ],\n});\n\nexport const getMarginSettings = (options?: MarginSettingsType): SettingBlock => {\n const hasId = options?.id ? `hasCustomMarginValue_${options?.id}` : 'hasCustomMarginValue';\n const valueId = options?.id ? `marginValue_${options?.id}` : 'marginValue';\n const choiceId = options?.id ? `marginChoice_${options?.id}` : 'marginChoice';\n\n return {\n id: hasId,\n label: 'Margin',\n type: 'switch',\n switchLabel: 'Custom',\n defaultValue: false,\n info: 'The spacing around UI elements to create more space',\n onChange: (bundle) => presetCustomValue(bundle, choiceId, valueId, options?.marginStyleMap || marginStyleMap),\n on: [\n {\n id: valueId,\n type: 'input',\n placeholder: MARGIN_DEFAULT_PLACEHOLDER,\n rules: [numericalOrPixelRule, maximumNumericalOrPixelOrAutoRule(500)],\n onChange: (bundle) => appendUnit(bundle, valueId),\n },\n ],\n off: [getMarginSlider(choiceId)],\n };\n};\n"],"names":["getMarginSlider","id","Margin","getMarginSettings","options","hasId","valueId","choiceId","bundle","presetCustomValue","marginStyleMap","MARGIN_DEFAULT_PLACEHOLDER","numericalOrPixelRule","maximumNumericalOrPixelOrAutoRule","appendUnit"],"mappings":";;;;AAwBO,MAAMA,IAAkB,CAACC,OAA8B;AAAA,EAC1D,IAAAA;AAAA,EACA,MAAM;AAAA,EACN,cAAcC,EAAO;AAAA,EACrB,SAAS;AAAA,IACL;AAAA,MACI,OAAOA,EAAO;AAAA,MACd,OAAO;AAAA,IAAA;AAAA,IAEX;AAAA,MACI,OAAOA,EAAO;AAAA,MACd,OAAO;AAAA,IAAA;AAAA,IAEX;AAAA,MACI,OAAOA,EAAO;AAAA,MACd,OAAO;AAAA,IAAA;AAAA,IAEX;AAAA,MACI,OAAOA,EAAO;AAAA,MACd,OAAO;AAAA,IAAA;AAAA,EACX;AAER,IAEaC,IAAoB,CAACC,MAA+C;AAC7E,QAAMC,IAAQD,GAAS,KAAK,wBAAwBA,GAAS,EAAE,KAAK,wBAC9DE,IAAUF,GAAS,KAAK,eAAeA,GAAS,EAAE,KAAK,eACvDG,IAAWH,GAAS,KAAK,gBAAgBA,GAAS,EAAE,KAAK;AAE/D,SAAO;AAAA,IACH,IAAIC;AAAA,IACJ,OAAO;AAAA,IACP,MAAM;AAAA,IACN,aAAa;AAAA,IACb,cAAc;AAAA,IACd,MAAM;AAAA,IACN,UAAU,CAACG,MAAWC,EAAkBD,GAAQD,GAAUD,GAASF,GAAS,kBAAkBM,CAAc;AAAA,IAC5G,IAAI;AAAA,MACA;AAAA,QACI,IAAIJ;AAAA,QACJ,MAAM;AAAA,QACN,aAAaK;AAAA,QACb,OAAO,CAACC,GAAsBC,EAAkC,GAAG,CAAC;AAAA,QACpE,UAAU,CAACL,MAAWM,EAAWN,GAAQF,CAAO;AAAA,MAAA;AAAA,IACpD;AAAA,IAEJ,KAAK,CAACN,EAAgBO,CAAQ,CAAC;AAAA,EAAA;AAEvC;"}
|
|
@@ -1,65 +1,65 @@
|
|
|
1
1
|
/* empty css */
|
|
2
|
-
import { numericalOrPixelRule as
|
|
3
|
-
import { MARGIN_DEFAULT_PLACEHOLDER as
|
|
4
|
-
import { getMarginSlider as
|
|
5
|
-
import { marginStyleMap as
|
|
6
|
-
const
|
|
7
|
-
const
|
|
2
|
+
import { numericalOrPixelRule as i, MultiInputLayout as M, maximumNumericalOrPixelOrAutoRule as a, appendUnit as n, presetCustomValue as r } from "@frontify/sidebar-settings";
|
|
3
|
+
import { MARGIN_DEFAULT_PLACEHOLDER as l } from "./defaultValues.es.js";
|
|
4
|
+
import { getMarginSlider as x } from "./margin.es.js";
|
|
5
|
+
import { marginStyleMap as g } from "./types.es.js";
|
|
6
|
+
const _ = (e) => {
|
|
7
|
+
const h = e?.id ? `hasExtendedCustomMargin_${e?.id}` : "hasExtendedCustomMargin", p = e?.id ? `extendedMarginValues_${e?.id}` : "extendedMarginValues", d = e?.id ? `extendedMarginChoice_${e?.id}` : "extendedMarginChoice", o = e?.id ? `extendedMarginTop_${e?.id}` : "extendedMarginTop", u = e?.id ? `extendedMarginLeft_${e?.id}` : "extendedMarginLeft", m = e?.id ? `extendedMarginRight_${e?.id}` : "extendedMarginRight", c = e?.id ? `extendedMarginBottom_${e?.id}` : "extendedMarginBottom";
|
|
8
8
|
return {
|
|
9
|
-
id:
|
|
9
|
+
id: h,
|
|
10
10
|
label: "Margin",
|
|
11
11
|
type: "switch",
|
|
12
12
|
switchLabel: "Custom",
|
|
13
13
|
defaultValue: !1,
|
|
14
14
|
info: "The spacing around UI elements to create more negative space",
|
|
15
|
-
onChange: (
|
|
16
|
-
|
|
15
|
+
onChange: (t) => {
|
|
16
|
+
r(t, d, o, g), r(t, d, u, g), r(t, d, m, g), r(t, d, c, g);
|
|
17
17
|
},
|
|
18
18
|
on: [
|
|
19
19
|
{
|
|
20
|
-
id:
|
|
20
|
+
id: p,
|
|
21
21
|
type: "multiInput",
|
|
22
|
-
layout:
|
|
22
|
+
layout: M.Spider,
|
|
23
23
|
blocks: [
|
|
24
24
|
{
|
|
25
|
-
id:
|
|
25
|
+
id: o,
|
|
26
26
|
type: "input",
|
|
27
27
|
label: "Top",
|
|
28
|
-
placeholder:
|
|
29
|
-
onChange: (
|
|
30
|
-
rules: [
|
|
28
|
+
placeholder: l,
|
|
29
|
+
onChange: (t) => n(t, o),
|
|
30
|
+
rules: [i, a(500)]
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
|
-
id:
|
|
33
|
+
id: u,
|
|
34
34
|
type: "input",
|
|
35
35
|
label: "Left",
|
|
36
|
-
placeholder:
|
|
37
|
-
onChange: (
|
|
38
|
-
rules: [
|
|
36
|
+
placeholder: l,
|
|
37
|
+
onChange: (t) => n(t, u),
|
|
38
|
+
rules: [i, a(500)]
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
|
-
id:
|
|
41
|
+
id: m,
|
|
42
42
|
type: "input",
|
|
43
43
|
label: "Right",
|
|
44
|
-
placeholder:
|
|
45
|
-
onChange: (
|
|
46
|
-
rules: [
|
|
44
|
+
placeholder: l,
|
|
45
|
+
onChange: (t) => n(t, m),
|
|
46
|
+
rules: [i, a(500)]
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
|
-
id:
|
|
49
|
+
id: c,
|
|
50
50
|
type: "input",
|
|
51
51
|
label: "Bottom",
|
|
52
|
-
placeholder:
|
|
53
|
-
onChange: (
|
|
54
|
-
rules: [
|
|
52
|
+
placeholder: l,
|
|
53
|
+
onChange: (t) => n(t, c),
|
|
54
|
+
rules: [i, a(500)]
|
|
55
55
|
}
|
|
56
56
|
]
|
|
57
57
|
}
|
|
58
58
|
],
|
|
59
|
-
off: [
|
|
59
|
+
off: [x(d)]
|
|
60
60
|
};
|
|
61
61
|
};
|
|
62
62
|
export {
|
|
63
|
-
|
|
63
|
+
_ as getMarginExtendedSettings
|
|
64
64
|
};
|
|
65
65
|
//# sourceMappingURL=marginExtended.es.js.map
|