@builder.io/sdk-svelte 1.0.27 → 1.0.28
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/lib/browser/blocks/accordion/accordion.svelte +160 -0
- package/lib/browser/blocks/accordion/accordion.svelte.d.ts +24 -0
- package/lib/browser/blocks/accordion/accordion.types.d.ts +12 -0
- package/lib/browser/blocks/accordion/accordion.types.js +1 -0
- package/lib/browser/blocks/accordion/component-info.d.ts +2 -0
- package/lib/browser/blocks/accordion/component-info.js +123 -0
- package/lib/browser/blocks/accordion/helpers.d.ts +1 -0
- package/lib/browser/blocks/accordion/helpers.js +3 -0
- package/lib/browser/blocks/accordion/index.d.ts +1 -0
- package/lib/browser/blocks/accordion/index.js +1 -0
- package/lib/browser/blocks/tabs/tabs.svelte +13 -10
- package/lib/browser/blocks/tabs/tabs.svelte.d.ts +2 -2
- package/lib/browser/components/block/animator.d.ts +0 -1
- package/lib/browser/components/block/animator.js +3 -3
- package/lib/browser/components/block/block.helpers.js +2 -2
- package/lib/browser/components/block/components/block-styles.svelte +2 -2
- package/lib/browser/components/content/components/enable-editor.svelte +1 -1
- package/lib/browser/components/content-variants/content-variants.types.d.ts +1 -1
- package/lib/browser/constants/builder-registered-components.js +5 -0
- package/lib/browser/constants/sdk-version.d.ts +1 -1
- package/lib/browser/constants/sdk-version.js +1 -1
- package/lib/browser/functions/camel-to-kebab-case.d.ts +1 -1
- package/lib/browser/functions/camel-to-kebab-case.js +1 -1
- package/lib/edge/blocks/accordion/accordion.svelte +160 -0
- package/lib/edge/blocks/accordion/accordion.svelte.d.ts +24 -0
- package/lib/edge/blocks/accordion/accordion.types.d.ts +12 -0
- package/lib/edge/blocks/accordion/accordion.types.js +1 -0
- package/lib/edge/blocks/accordion/component-info.d.ts +2 -0
- package/lib/edge/blocks/accordion/component-info.js +123 -0
- package/lib/edge/blocks/accordion/helpers.d.ts +1 -0
- package/lib/edge/blocks/accordion/helpers.js +3 -0
- package/lib/edge/blocks/accordion/index.d.ts +1 -0
- package/lib/edge/blocks/accordion/index.js +1 -0
- package/lib/edge/blocks/tabs/tabs.svelte +13 -10
- package/lib/edge/blocks/tabs/tabs.svelte.d.ts +2 -2
- package/lib/edge/components/block/animator.d.ts +0 -1
- package/lib/edge/components/block/animator.js +3 -3
- package/lib/edge/components/block/block.helpers.js +2 -2
- package/lib/edge/components/block/components/block-styles.svelte +2 -2
- package/lib/edge/components/content/components/enable-editor.svelte +1 -1
- package/lib/edge/components/content-variants/content-variants.types.d.ts +1 -1
- package/lib/edge/constants/builder-registered-components.js +5 -0
- package/lib/edge/constants/sdk-version.d.ts +1 -1
- package/lib/edge/constants/sdk-version.js +1 -1
- package/lib/edge/functions/camel-to-kebab-case.d.ts +1 -1
- package/lib/edge/functions/camel-to-kebab-case.js +1 -1
- package/lib/node/blocks/accordion/accordion.svelte +160 -0
- package/lib/node/blocks/accordion/accordion.svelte.d.ts +24 -0
- package/lib/node/blocks/accordion/accordion.types.d.ts +12 -0
- package/lib/node/blocks/accordion/accordion.types.js +1 -0
- package/lib/node/blocks/accordion/component-info.d.ts +2 -0
- package/lib/node/blocks/accordion/component-info.js +123 -0
- package/lib/node/blocks/accordion/helpers.d.ts +1 -0
- package/lib/node/blocks/accordion/helpers.js +3 -0
- package/lib/node/blocks/accordion/index.d.ts +1 -0
- package/lib/node/blocks/accordion/index.js +1 -0
- package/lib/node/blocks/tabs/tabs.svelte +13 -10
- package/lib/node/blocks/tabs/tabs.svelte.d.ts +2 -2
- package/lib/node/components/block/animator.d.ts +0 -1
- package/lib/node/components/block/animator.js +3 -3
- package/lib/node/components/block/block.helpers.js +2 -2
- package/lib/node/components/block/components/block-styles.svelte +2 -2
- package/lib/node/components/content/components/enable-editor.svelte +1 -1
- package/lib/node/components/content-variants/content-variants.types.d.ts +1 -1
- package/lib/node/constants/builder-registered-components.js +5 -0
- package/lib/node/constants/sdk-version.d.ts +1 -1
- package/lib/node/constants/sdk-version.js +1 -1
- package/lib/node/functions/camel-to-kebab-case.d.ts +1 -1
- package/lib/node/functions/camel-to-kebab-case.js +1 -1
- package/package.json +1 -1
- package/src/blocks/accordion/accordion.svelte +197 -0
- package/src/blocks/accordion/accordion.types.ts +12 -0
- package/src/blocks/accordion/component-info.ts +124 -0
- package/src/blocks/accordion/helpers.ts +3 -0
- package/src/blocks/accordion/index.ts +1 -0
- package/src/blocks/tabs/tabs.svelte +12 -10
- package/src/components/block/animator.ts +3 -3
- package/src/components/block/block.helpers.ts +2 -2
- package/src/components/block/components/block-styles.svelte +2 -2
- package/src/components/content/components/enable-editor.svelte +1 -1
- package/src/components/content-variants/content-variants.types.ts +1 -1
- package/src/constants/builder-registered-components.ts +5 -0
- package/src/constants/sdk-version.ts +1 -1
- package/src/functions/camel-to-kebab-case.ts +1 -1
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
<script>import Blocks from "../../components/blocks/index";
|
|
2
|
+
import { convertOrderNumberToString } from "./helpers";
|
|
3
|
+
import "../../functions/camel-to-kebab-case";
|
|
4
|
+
export let grid = undefined;
|
|
5
|
+
export let oneAtATime = undefined;
|
|
6
|
+
export let items;
|
|
7
|
+
export let gridRowWidth = undefined;
|
|
8
|
+
export let builderBlock;
|
|
9
|
+
export let builderContext;
|
|
10
|
+
export let builderComponents;
|
|
11
|
+
export let builderLinkComponent = undefined;
|
|
12
|
+
function stringifyStyles(stylesObj) {
|
|
13
|
+
let styles = "";
|
|
14
|
+
for (let key in stylesObj) {
|
|
15
|
+
const dashedKey = key.replace(/[A-Z]/g, function (match) {
|
|
16
|
+
return "-" + match.toLowerCase();
|
|
17
|
+
});
|
|
18
|
+
styles += dashedKey + ":" + stylesObj[key] + ";";
|
|
19
|
+
}
|
|
20
|
+
return styles;
|
|
21
|
+
}
|
|
22
|
+
function getAccordionTitleClassName(index) {
|
|
23
|
+
return `builder-accordion-title builder-accordion-title-${open.includes(index) ? "open" : "closed"}`;
|
|
24
|
+
}
|
|
25
|
+
function getAccordionDetailClassName(index) {
|
|
26
|
+
return `builder-accordion-detail builder-accordion-detail-${open.includes(index) ? "open" : "closed"}`;
|
|
27
|
+
}
|
|
28
|
+
function onClick(index) {
|
|
29
|
+
if (open.includes(index)) {
|
|
30
|
+
open = onlyOneAtATime() ? [] : open.filter((item) => item !== index);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
open = onlyOneAtATime() ? [index] : open.concat(index);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
$: onlyOneAtATime = () => {
|
|
37
|
+
return Boolean(grid || oneAtATime);
|
|
38
|
+
};
|
|
39
|
+
$: accordionStyles = () => {
|
|
40
|
+
const styles = {
|
|
41
|
+
display: "flex",
|
|
42
|
+
alignItems: "stretch",
|
|
43
|
+
flexDirection: "column",
|
|
44
|
+
...(grid && {
|
|
45
|
+
flexDirection: "row",
|
|
46
|
+
alignItems: "flex-start",
|
|
47
|
+
flexWrap: "wrap",
|
|
48
|
+
}),
|
|
49
|
+
};
|
|
50
|
+
return styles;
|
|
51
|
+
};
|
|
52
|
+
$: accordionTitleStyles = () => {
|
|
53
|
+
const shared = {
|
|
54
|
+
display: "flex",
|
|
55
|
+
flexDirection: "column",
|
|
56
|
+
};
|
|
57
|
+
const styles = {
|
|
58
|
+
...shared,
|
|
59
|
+
alignItems: "stretch",
|
|
60
|
+
cursor: "pointer",
|
|
61
|
+
};
|
|
62
|
+
return Object.fromEntries(Object.entries(styles).filter(([_, value]) => value !== undefined));
|
|
63
|
+
};
|
|
64
|
+
$: openGridItemOrder = () => {
|
|
65
|
+
let itemOrder = null;
|
|
66
|
+
const getOpenGridItemPosition = grid && open.length;
|
|
67
|
+
if (getOpenGridItemPosition && document) {
|
|
68
|
+
const openItemIndex = open[0];
|
|
69
|
+
const openItem = document.querySelector(`.builder-accordion-title[data-index="${openItemIndex}"]`);
|
|
70
|
+
let subjectItem = openItem;
|
|
71
|
+
itemOrder = openItemIndex;
|
|
72
|
+
if (subjectItem) {
|
|
73
|
+
let prevItemRect = subjectItem.getBoundingClientRect();
|
|
74
|
+
while ((subjectItem = subjectItem && subjectItem.nextElementSibling)) {
|
|
75
|
+
if (subjectItem) {
|
|
76
|
+
if (subjectItem.classList.contains("builder-accordion-detail")) {
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
const subjectItemRect = subjectItem.getBoundingClientRect();
|
|
80
|
+
if (subjectItemRect.left > prevItemRect.left) {
|
|
81
|
+
const index = parseInt(subjectItem.getAttribute("data-index") || "", 10);
|
|
82
|
+
if (!isNaN(index)) {
|
|
83
|
+
prevItemRect = subjectItemRect;
|
|
84
|
+
itemOrder = index;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (typeof itemOrder === "number") {
|
|
95
|
+
itemOrder = itemOrder + 1;
|
|
96
|
+
}
|
|
97
|
+
return itemOrder;
|
|
98
|
+
};
|
|
99
|
+
$: accordionDetailStyles = () => {
|
|
100
|
+
const styles = {
|
|
101
|
+
...{
|
|
102
|
+
order: typeof openGridItemOrder() === "number"
|
|
103
|
+
? openGridItemOrder()
|
|
104
|
+
: undefined,
|
|
105
|
+
},
|
|
106
|
+
...(grid && {
|
|
107
|
+
width: "100%",
|
|
108
|
+
}),
|
|
109
|
+
};
|
|
110
|
+
return Object.fromEntries(Object.entries(styles).filter(([_, value]) => value !== undefined));
|
|
111
|
+
};
|
|
112
|
+
let open = [];
|
|
113
|
+
</script>
|
|
114
|
+
|
|
115
|
+
<div style={stringifyStyles(accordionStyles())} class="builder-accordion">
|
|
116
|
+
{#each items as item, index}
|
|
117
|
+
<div
|
|
118
|
+
style={stringifyStyles({
|
|
119
|
+
...accordionTitleStyles(),
|
|
120
|
+
width: grid ? gridRowWidth : undefined,
|
|
121
|
+
...{
|
|
122
|
+
order:
|
|
123
|
+
openGridItemOrder() !== null
|
|
124
|
+
? convertOrderNumberToString(index)
|
|
125
|
+
: convertOrderNumberToString(index + 1),
|
|
126
|
+
},
|
|
127
|
+
})}
|
|
128
|
+
class={getAccordionTitleClassName(index)}
|
|
129
|
+
data-index={index}
|
|
130
|
+
on:click={(event) => {
|
|
131
|
+
onClick(index);
|
|
132
|
+
}}
|
|
133
|
+
>
|
|
134
|
+
<Blocks
|
|
135
|
+
blocks={item.title}
|
|
136
|
+
path={`items.${index}.title`}
|
|
137
|
+
parent={builderBlock.id}
|
|
138
|
+
context={builderContext}
|
|
139
|
+
registeredComponents={builderComponents}
|
|
140
|
+
linkComponent={builderLinkComponent}
|
|
141
|
+
/>
|
|
142
|
+
</div>
|
|
143
|
+
|
|
144
|
+
{#if open.includes(index)}
|
|
145
|
+
<div
|
|
146
|
+
style={stringifyStyles(accordionDetailStyles())}
|
|
147
|
+
class={getAccordionDetailClassName(index)}
|
|
148
|
+
>
|
|
149
|
+
<Blocks
|
|
150
|
+
blocks={item.detail}
|
|
151
|
+
path={`items.${index}.detail`}
|
|
152
|
+
parent={builderBlock.id}
|
|
153
|
+
context={builderContext}
|
|
154
|
+
registeredComponents={builderComponents}
|
|
155
|
+
linkComponent={builderLinkComponent}
|
|
156
|
+
/>
|
|
157
|
+
</div>
|
|
158
|
+
{/if}
|
|
159
|
+
{/each}
|
|
160
|
+
</div>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { AccordionProps } from "./accordion.types";
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
grid?: AccordionProps["grid"];
|
|
6
|
+
oneAtATime?: AccordionProps["oneAtATime"];
|
|
7
|
+
items: AccordionProps["items"];
|
|
8
|
+
gridRowWidth?: AccordionProps["gridRowWidth"];
|
|
9
|
+
builderBlock: AccordionProps["builderBlock"];
|
|
10
|
+
builderContext: AccordionProps["builderContext"];
|
|
11
|
+
builderComponents: AccordionProps["builderComponents"];
|
|
12
|
+
builderLinkComponent?: AccordionProps["builderLinkComponent"];
|
|
13
|
+
};
|
|
14
|
+
events: {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
};
|
|
17
|
+
slots: {};
|
|
18
|
+
};
|
|
19
|
+
type AccordionProps_ = typeof __propDef.props;
|
|
20
|
+
export { AccordionProps_ as AccordionProps };
|
|
21
|
+
export type AccordionEvents = typeof __propDef.events;
|
|
22
|
+
export type AccordionSlots = typeof __propDef.slots;
|
|
23
|
+
export default class Accordion extends SvelteComponent<AccordionProps, AccordionEvents, AccordionSlots> {
|
|
24
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { BuilderBlock } from '../../types/builder-block';
|
|
2
|
+
import type { BuilderComponentsProp, BuilderDataProps, BuilderLinkComponentProp } from '../../types/builder-props';
|
|
3
|
+
export interface AccordionProps extends BuilderComponentsProp, BuilderLinkComponentProp, BuilderDataProps {
|
|
4
|
+
items: {
|
|
5
|
+
title: BuilderBlock[];
|
|
6
|
+
detail: BuilderBlock[];
|
|
7
|
+
}[];
|
|
8
|
+
oneAtATime?: boolean;
|
|
9
|
+
grid?: boolean;
|
|
10
|
+
gridRowWidth?: string;
|
|
11
|
+
useChildrenForItems?: boolean;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
const defaultTitle = {
|
|
2
|
+
'@type': '@builder.io/sdk:Element',
|
|
3
|
+
layerName: 'Accordion item title',
|
|
4
|
+
responsiveStyles: {
|
|
5
|
+
large: {
|
|
6
|
+
marginTop: '10px',
|
|
7
|
+
position: 'relative',
|
|
8
|
+
display: 'flex',
|
|
9
|
+
alignItems: 'stretch',
|
|
10
|
+
flexDirection: 'column',
|
|
11
|
+
paddingBottom: '10px'
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
children: [{
|
|
15
|
+
'@type': '@builder.io/sdk:Element',
|
|
16
|
+
responsiveStyles: {
|
|
17
|
+
large: {
|
|
18
|
+
textAlign: 'left',
|
|
19
|
+
display: 'flex',
|
|
20
|
+
flexDirection: 'column'
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
component: {
|
|
24
|
+
name: 'Text',
|
|
25
|
+
options: {
|
|
26
|
+
text: 'I am an accordion title. Click me!'
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}]
|
|
30
|
+
};
|
|
31
|
+
const defaultDetail = {
|
|
32
|
+
'@type': '@builder.io/sdk:Element',
|
|
33
|
+
layerName: 'Accordion item detail',
|
|
34
|
+
responsiveStyles: {
|
|
35
|
+
large: {
|
|
36
|
+
position: 'relative',
|
|
37
|
+
display: 'flex',
|
|
38
|
+
alignItems: 'stretch',
|
|
39
|
+
flexDirection: 'column',
|
|
40
|
+
marginTop: '10px',
|
|
41
|
+
paddingBottom: '10px'
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
children: [{
|
|
45
|
+
'@type': '@builder.io/sdk:Element',
|
|
46
|
+
responsiveStyles: {
|
|
47
|
+
large: {
|
|
48
|
+
paddingTop: '50px',
|
|
49
|
+
textAlign: 'left',
|
|
50
|
+
display: 'flex',
|
|
51
|
+
flexDirection: 'column',
|
|
52
|
+
paddingBottom: '50px'
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
component: {
|
|
56
|
+
name: 'Text',
|
|
57
|
+
options: {
|
|
58
|
+
text: 'I am an accordion detail, hello!'
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}]
|
|
62
|
+
};
|
|
63
|
+
export const componentInfo = {
|
|
64
|
+
name: 'Builder:Accordion',
|
|
65
|
+
canHaveChildren: true,
|
|
66
|
+
image: 'https://cdn.builder.io/api/v1/image/assets%2FagZ9n5CUKRfbL9t6CaJOyVSK4Es2%2Ffab6c1fd3fe542408cbdec078bca7f35',
|
|
67
|
+
defaultStyles: {
|
|
68
|
+
display: 'flex',
|
|
69
|
+
flexDirection: 'column',
|
|
70
|
+
alignItems: 'stretch'
|
|
71
|
+
},
|
|
72
|
+
inputs: [{
|
|
73
|
+
name: 'items',
|
|
74
|
+
type: 'list',
|
|
75
|
+
broadcast: true,
|
|
76
|
+
subFields: [{
|
|
77
|
+
name: 'title',
|
|
78
|
+
type: 'uiBlocks',
|
|
79
|
+
hideFromUI: true,
|
|
80
|
+
defaultValue: [defaultTitle]
|
|
81
|
+
}, {
|
|
82
|
+
name: 'detail',
|
|
83
|
+
type: 'uiBlocks',
|
|
84
|
+
hideFromUI: true,
|
|
85
|
+
defaultValue: [defaultDetail]
|
|
86
|
+
}],
|
|
87
|
+
defaultValue: [{
|
|
88
|
+
title: [defaultTitle],
|
|
89
|
+
detail: [defaultDetail]
|
|
90
|
+
}, {
|
|
91
|
+
title: [defaultTitle],
|
|
92
|
+
detail: [defaultDetail]
|
|
93
|
+
}],
|
|
94
|
+
showIf: (options) => !options.get('useChildrenForItems')
|
|
95
|
+
}, {
|
|
96
|
+
name: 'oneAtATime',
|
|
97
|
+
helperText: 'Only allow opening one at a time (collapse all others when new item openned)',
|
|
98
|
+
type: 'boolean',
|
|
99
|
+
defaultValue: false
|
|
100
|
+
}, {
|
|
101
|
+
name: 'grid',
|
|
102
|
+
helperText: 'Display as a grid',
|
|
103
|
+
type: 'boolean',
|
|
104
|
+
defaultValue: false
|
|
105
|
+
}, {
|
|
106
|
+
name: 'gridRowWidth',
|
|
107
|
+
helperText: 'Display as a grid',
|
|
108
|
+
type: 'string',
|
|
109
|
+
showIf: (options) => options.get('grid'),
|
|
110
|
+
defaultValue: '25%'
|
|
111
|
+
}, {
|
|
112
|
+
name: 'useChildrenForItems',
|
|
113
|
+
type: 'boolean',
|
|
114
|
+
helperText: 'Use child elements for each slide, instead of the array. Useful for dynamically repeating items',
|
|
115
|
+
advanced: true,
|
|
116
|
+
defaultValue: false,
|
|
117
|
+
onChange: (options) => {
|
|
118
|
+
if (options.get('useChildrenForItems') === true) {
|
|
119
|
+
options.set('items', []);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}]
|
|
123
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const convertOrderNumberToString: (order: number) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './accordion.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './accordion.svelte';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script>import Blocks from "../../components/blocks/blocks.svelte";
|
|
2
2
|
export let defaultActiveTab = undefined;
|
|
3
3
|
export let tabs;
|
|
4
|
-
export let activeTabStyle = undefined;
|
|
5
|
-
export let tabHeaderLayout = undefined;
|
|
6
4
|
export let collapsible = undefined;
|
|
5
|
+
export let tabHeaderLayout = undefined;
|
|
6
|
+
export let activeTabStyle = undefined;
|
|
7
7
|
export let builderBlock;
|
|
8
8
|
export let builderContext;
|
|
9
9
|
export let builderComponents;
|
|
@@ -21,8 +21,13 @@ function stringifyStyles(stylesObj) {
|
|
|
21
21
|
function activeTabContent(active) {
|
|
22
22
|
return tabs && tabs[active].content;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
|
|
24
|
+
function onClick(index) {
|
|
25
|
+
if (index === activeTab && collapsible) {
|
|
26
|
+
activeTab = -1;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
activeTab = index;
|
|
30
|
+
}
|
|
26
31
|
}
|
|
27
32
|
let activeTab = defaultActiveTab ? defaultActiveTab - 1 : 0;
|
|
28
33
|
</script>
|
|
@@ -39,16 +44,14 @@ let activeTab = defaultActiveTab ? defaultActiveTab - 1 : 0;
|
|
|
39
44
|
>
|
|
40
45
|
{#each tabs as tab, index (index)}
|
|
41
46
|
<span
|
|
42
|
-
style={stringifyStyles(
|
|
47
|
+
style={stringifyStyles({
|
|
48
|
+
...(activeTab === index ? activeTabStyle : {}),
|
|
49
|
+
})}
|
|
43
50
|
class={`builder-tab-wrap ${
|
|
44
51
|
activeTab === index ? "builder-tab-active" : ""
|
|
45
52
|
}`}
|
|
46
53
|
on:click={(event) => {
|
|
47
|
-
|
|
48
|
-
activeTab = -1;
|
|
49
|
-
} else {
|
|
50
|
-
activeTab = index;
|
|
51
|
-
}
|
|
54
|
+
onClick(index);
|
|
52
55
|
}}
|
|
53
56
|
><Blocks
|
|
54
57
|
parent={builderBlock.id}
|
|
@@ -4,9 +4,9 @@ declare const __propDef: {
|
|
|
4
4
|
props: {
|
|
5
5
|
defaultActiveTab?: TabsProps["defaultActiveTab"];
|
|
6
6
|
tabs: TabsProps["tabs"];
|
|
7
|
-
activeTabStyle?: TabsProps["activeTabStyle"];
|
|
8
|
-
tabHeaderLayout?: TabsProps["tabHeaderLayout"];
|
|
9
7
|
collapsible?: TabsProps["collapsible"];
|
|
8
|
+
tabHeaderLayout?: TabsProps["tabHeaderLayout"];
|
|
9
|
+
activeTabStyle?: TabsProps["activeTabStyle"];
|
|
10
10
|
builderBlock: TabsProps["builderBlock"];
|
|
11
11
|
builderContext: TabsProps["builderContext"];
|
|
12
12
|
builderComponents: TabsProps["builderComponents"];
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { BuilderAnimation } from '../../types/builder-block';
|
|
2
|
-
export declare const camelCaseToKebabCase: (str?: string) => string;
|
|
3
2
|
export declare function bindAnimations(animations: BuilderAnimation[]): void;
|
|
4
3
|
export declare function triggerAnimation(animation: BuilderAnimation): void;
|
|
5
4
|
export declare function bindScrollInViewAnimation(animation: BuilderAnimation): void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { camelToKebabCase } from '../../functions/camel-to-kebab-case';
|
|
1
2
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
2
3
|
function throttle(func, wait, options = {}) {
|
|
3
4
|
let context;
|
|
@@ -54,7 +55,6 @@ function assign(target, ..._args) {
|
|
|
54
55
|
}
|
|
55
56
|
return to;
|
|
56
57
|
}
|
|
57
|
-
export const camelCaseToKebabCase = (str) => str ? str.replace(/([A-Z])/g, g => `-${g[0].toLowerCase()}`) : '';
|
|
58
58
|
export function bindAnimations(animations) {
|
|
59
59
|
for (const animation of animations) {
|
|
60
60
|
switch (animation.trigger) {
|
|
@@ -120,7 +120,7 @@ export function triggerAnimation(animation) {
|
|
|
120
120
|
// TODO: only include properties explicitly set in the animation
|
|
121
121
|
// using Object.keys(styles)
|
|
122
122
|
setTimeout(() => {
|
|
123
|
-
element.style.transition = `all ${animation.duration}s ${
|
|
123
|
+
element.style.transition = `all ${animation.duration}s ${camelToKebabCase(animation.easing)}`;
|
|
124
124
|
if (animation.delay) {
|
|
125
125
|
element.style.transitionDelay = animation.delay + 's';
|
|
126
126
|
}
|
|
@@ -193,7 +193,7 @@ export function bindScrollInViewAnimation(animation) {
|
|
|
193
193
|
attachDefaultState();
|
|
194
194
|
// TODO: queue/batch these timeouts!
|
|
195
195
|
setTimeout(() => {
|
|
196
|
-
element.style.transition = `all ${animation.duration}s ${
|
|
196
|
+
element.style.transition = `all ${animation.duration}s ${camelToKebabCase(animation.easing)}`;
|
|
197
197
|
if (animation.delay) {
|
|
198
198
|
element.style.transitionDelay = animation.delay + 's';
|
|
199
199
|
}
|
|
@@ -74,8 +74,8 @@ export const getInheritedStyles = ({ block, context }) => {
|
|
|
74
74
|
return extractTextStyles(style);
|
|
75
75
|
};
|
|
76
76
|
export const shouldPassLinkComponent = (block) => {
|
|
77
|
-
return block && (block.isRSC || ['Core:Button', 'Symbol', 'Columns', 'Form:Form', 'Builder: Tabs'].includes(block.name));
|
|
77
|
+
return block && (block.isRSC || ['Core:Button', 'Symbol', 'Columns', 'Form:Form', 'Builder: Tabs', 'Builder:Accordion'].includes(block.name));
|
|
78
78
|
};
|
|
79
79
|
export const shouldPassRegisteredComponents = (block) => {
|
|
80
|
-
return block && (block.isRSC || ['Symbol', 'Columns', 'Form:Form', 'Builder: Tabs'].includes(block.name));
|
|
80
|
+
return block && (block.isRSC || ['Symbol', 'Columns', 'Form:Form', 'Builder: Tabs', 'Builder:Accordion'].includes(block.name));
|
|
81
81
|
};
|
|
@@ -6,7 +6,7 @@ import { getProcessedBlock } from "../../../functions/get-processed-block";
|
|
|
6
6
|
import { createCssClass } from "../../../helpers/css";
|
|
7
7
|
import { checkIsDefined } from "../../../helpers/nullable";
|
|
8
8
|
import InlinedStyles from "../../inlined-styles.svelte";
|
|
9
|
-
import {
|
|
9
|
+
import { camelToKebabCase } from "../../../functions/camel-to-kebab-case";
|
|
10
10
|
export let block;
|
|
11
11
|
export let context;
|
|
12
12
|
$: canShowBlock = () => {
|
|
@@ -76,7 +76,7 @@ $: css = () => {
|
|
|
76
76
|
className: `${className}:hover`,
|
|
77
77
|
styles: {
|
|
78
78
|
...hoverStyles,
|
|
79
|
-
transition: `all ${hoverAnimation.duration}s ${
|
|
79
|
+
transition: `all ${hoverAnimation.duration}s ${camelToKebabCase(hoverAnimation.easing)}`,
|
|
80
80
|
transitionDelay: hoverAnimation.delay
|
|
81
81
|
? `${hoverAnimation.delay}s`
|
|
82
82
|
: "0s",
|
|
@@ -272,7 +272,7 @@ onMount(() => {
|
|
|
272
272
|
});
|
|
273
273
|
onMount(() => {
|
|
274
274
|
if (!apiKey) {
|
|
275
|
-
logger.error("No API key provided to `
|
|
275
|
+
logger.error("No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop.");
|
|
276
276
|
}
|
|
277
277
|
evaluateJsCode();
|
|
278
278
|
runHttpRequests();
|
|
@@ -22,7 +22,7 @@ export interface ContentVariantsPrps {
|
|
|
22
22
|
*/
|
|
23
23
|
context?: BuilderRenderContext;
|
|
24
24
|
/**
|
|
25
|
-
* Your API Key: needed to dynamically fetch symbols (required).
|
|
25
|
+
* Your API Key: needed to enable visual editing, and to dynamically fetch symbols (required).
|
|
26
26
|
*/
|
|
27
27
|
apiKey: string;
|
|
28
28
|
apiVersion?: ApiVersion;
|
|
@@ -16,6 +16,8 @@ import { componentInfo as tabsComponentInfo } from '../blocks/tabs/component-inf
|
|
|
16
16
|
import { default as Tabs } from '../blocks/tabs/index';
|
|
17
17
|
import { componentInfo as textComponentInfo } from '../blocks/text/component-info';
|
|
18
18
|
import { default as Text } from '../blocks/text/index';
|
|
19
|
+
import { default as Accordion } from '../blocks/accordion/index';
|
|
20
|
+
import { componentInfo as accordionComponentInfo } from '../blocks/accordion/component-info';
|
|
19
21
|
import { getExtraComponents } from './extra-components';
|
|
20
22
|
import { TARGET } from './target';
|
|
21
23
|
/**
|
|
@@ -49,4 +51,7 @@ export const getDefaultRegisteredComponents = () => [{
|
|
|
49
51
|
}, ...(TARGET === 'rsc' ? [] : [{
|
|
50
52
|
component: Tabs,
|
|
51
53
|
...tabsComponentInfo
|
|
54
|
+
}, {
|
|
55
|
+
component: Accordion,
|
|
56
|
+
...accordionComponentInfo
|
|
52
57
|
}]), ...getExtraComponents()];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.0.
|
|
1
|
+
export declare const SDK_VERSION = "1.0.28";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "1.0.
|
|
1
|
+
export const SDK_VERSION = "1.0.28";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const camelToKebabCase: (
|
|
1
|
+
export declare const camelToKebabCase: (str?: string) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const camelToKebabCase = (
|
|
1
|
+
export const camelToKebabCase = (str) => str ? str.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, '$1-$2').toLowerCase() : '';
|