lkb-fields-document 1.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/component-blocks/dist/lkb-fields-document-component-blocks.cjs.d.ts +2 -0
- package/component-blocks/dist/lkb-fields-document-component-blocks.cjs.js +306 -0
- package/component-blocks/dist/lkb-fields-document-component-blocks.esm.js +300 -0
- package/component-blocks/dist/lkb-fields-document-component-blocks.node.cjs.js +306 -0
- package/component-blocks/dist/lkb-fields-document-component-blocks.node.esm.js +300 -0
- package/component-blocks/package.json +4 -0
- package/dist/Cell-0ac0ac66.node.cjs.js +21 -0
- package/dist/Cell-242f7404.esm.js +17 -0
- package/dist/Cell-3103f73d.node.esm.js +17 -0
- package/dist/Cell-bfb56d74.cjs.js +21 -0
- package/dist/Field-0e0f75ed.node.cjs.js +1628 -0
- package/dist/Field-28177061.cjs.js +1628 -0
- package/dist/Field-35b79e6b.node.esm.js +1619 -0
- package/dist/Field-92d13205.esm.js +1619 -0
- package/dist/api-2f524611.esm.js +502 -0
- package/dist/api-73636987.cjs.js +506 -0
- package/dist/api-8e2b20b8.node.cjs.js +506 -0
- package/dist/api-c32e360e.node.esm.js +502 -0
- package/dist/callout-ui-2aded278.cjs.js +131 -0
- package/dist/callout-ui-3e5ca544.node.esm.js +126 -0
- package/dist/callout-ui-8b5f2376.esm.js +126 -0
- package/dist/callout-ui-ad50f301.node.cjs.js +131 -0
- package/dist/declarations/src/component-blocks.d.ts +4 -0
- package/dist/declarations/src/component-blocks.d.ts.map +1 -0
- package/dist/declarations/src/document-editor/component-blocks/api.d.ts +120 -0
- package/dist/declarations/src/document-editor/component-blocks/api.d.ts.map +1 -0
- package/dist/declarations/src/document-editor/component-blocks/types.d.ts +241 -0
- package/dist/declarations/src/document-editor/component-blocks/types.d.ts.map +1 -0
- package/dist/declarations/src/document-editor/toolset/relationship/relationship-shared.d.ts +10 -0
- package/dist/declarations/src/document-editor/toolset/relationship/relationship-shared.d.ts.map +1 -0
- package/dist/declarations/src/index.d.ts +7 -0
- package/dist/declarations/src/index.d.ts.map +1 -0
- package/dist/declarations/src/my-component-blocks/index.d.ts +46 -0
- package/dist/declarations/src/my-component-blocks/index.d.ts.map +1 -0
- package/dist/declarations/src/structure/Cell.d.ts +5 -0
- package/dist/declarations/src/structure/Cell.d.ts.map +1 -0
- package/dist/declarations/src/structure/Field.d.ts +5 -0
- package/dist/declarations/src/structure/Field.d.ts.map +1 -0
- package/dist/declarations/src/structure/controller.d.ts +10 -0
- package/dist/declarations/src/structure/controller.d.ts.map +1 -0
- package/dist/declarations/src/structure/structure.d.ts +4 -0
- package/dist/declarations/src/structure/structure.d.ts.map +1 -0
- package/dist/declarations/src/structure-views.d.ts +5 -0
- package/dist/declarations/src/structure-views.d.ts.map +1 -0
- package/dist/declarations/src/types/DocumentFeatures.d.ts +33 -0
- package/dist/declarations/src/types/DocumentFeatures.d.ts.map +1 -0
- package/dist/declarations/src/types/DocumentFieldConfig.d.ts +18 -0
- package/dist/declarations/src/types/DocumentFieldConfig.d.ts.map +1 -0
- package/dist/declarations/src/types/FormattingConfig.d.ts +28 -0
- package/dist/declarations/src/types/FormattingConfig.d.ts.map +1 -0
- package/dist/declarations/src/types/RelationshipsConfig.d.ts +9 -0
- package/dist/declarations/src/types/RelationshipsConfig.d.ts.map +1 -0
- package/dist/declarations/src/types/StructureFieldConfig.d.ts +10 -0
- package/dist/declarations/src/types/StructureFieldConfig.d.ts.map +1 -0
- package/dist/declarations/src/validation/structure-validation.d.ts +218 -0
- package/dist/declarations/src/validation/structure-validation.d.ts.map +1 -0
- package/dist/declarations/src/views/Cell.d.ts +5 -0
- package/dist/declarations/src/views/Cell.d.ts.map +1 -0
- package/dist/declarations/src/views/Field.d.ts +5 -0
- package/dist/declarations/src/views/Field.d.ts.map +1 -0
- package/dist/declarations/src/views/controller.d.ts +15 -0
- package/dist/declarations/src/views/controller.d.ts.map +1 -0
- package/dist/declarations/src/views/document.d.ts +4 -0
- package/dist/declarations/src/views/document.d.ts.map +1 -0
- package/dist/declarations/src/views.d.ts +7 -0
- package/dist/declarations/src/views.d.ts.map +1 -0
- package/dist/editor-shared-a6e340e6.node.esm.js +1993 -0
- package/dist/editor-shared-a997ae98.node.cjs.js +2007 -0
- package/dist/editor-shared-cc1293ed.cjs.js +2007 -0
- package/dist/editor-shared-da518ba3.esm.js +1993 -0
- package/dist/form-from-preview-2042b9ef.cjs.js +512 -0
- package/dist/form-from-preview-5df6e492.node.esm.js +508 -0
- package/dist/form-from-preview-9e501058.node.cjs.js +512 -0
- package/dist/form-from-preview-b3a66f37.esm.js +508 -0
- package/dist/index-06c36775.cjs.js +14 -0
- package/dist/index-586adb8f.node.esm.js +11 -0
- package/dist/index-67d52357.esm.js +11 -0
- package/dist/index-c3223fdc.node.cjs.js +14 -0
- package/dist/layouts-6412fa2a.esm.js +189 -0
- package/dist/layouts-a4a3cf0b.node.cjs.js +196 -0
- package/dist/layouts-ba9a558b.cjs.js +196 -0
- package/dist/layouts-e653b908.node.esm.js +189 -0
- package/dist/lkb-fields-document.cjs.d.ts +2 -0
- package/dist/lkb-fields-document.cjs.js +1167 -0
- package/dist/lkb-fields-document.esm.js +1162 -0
- package/dist/lkb-fields-document.node.cjs.js +1167 -0
- package/dist/lkb-fields-document.node.esm.js +1162 -0
- package/dist/shared-0533009e.cjs.js +594 -0
- package/dist/shared-4684cc24.node.cjs.js +594 -0
- package/dist/shared-5e864055.node.esm.js +579 -0
- package/dist/shared-aaba5901.esm.js +579 -0
- package/dist/toolbar-state-3359e2f3.cjs.js +994 -0
- package/dist/toolbar-state-945823b8.node.esm.js +971 -0
- package/dist/toolbar-state-9611743f.node.cjs.js +994 -0
- package/dist/toolbar-state-bc8fe661.esm.js +971 -0
- package/dist/utils-06bcddc4.node.cjs.js +747 -0
- package/dist/utils-200ff260.node.esm.js +722 -0
- package/dist/utils-6409f730.cjs.js +747 -0
- package/dist/utils-bc6a0b82.esm.js +722 -0
- package/package.json +118 -0
- package/structure-views/dist/lkb-fields-document-structure-views.cjs.d.ts +2 -0
- package/structure-views/dist/lkb-fields-document-structure-views.cjs.js +138 -0
- package/structure-views/dist/lkb-fields-document-structure-views.esm.js +131 -0
- package/structure-views/dist/lkb-fields-document-structure-views.node.cjs.js +138 -0
- package/structure-views/dist/lkb-fields-document-structure-views.node.esm.js +131 -0
- package/structure-views/package.json +4 -0
- package/views/dist/lkb-fields-document-views.cjs.d.ts +2 -0
- package/views/dist/lkb-fields-document-views.cjs.js +114 -0
- package/views/dist/lkb-fields-document-views.esm.js +95 -0
- package/views/dist/lkb-fields-document-views.node.cjs.js +114 -0
- package/views/dist/lkb-fields-document-views.node.esm.js +95 -0
- package/views/package.json +4 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { ActionGroup, Item } from '@keystar/ui/action-group';
|
|
3
|
+
import { ActionButton } from '@keystar/ui/button';
|
|
4
|
+
import { TooltipTrigger, Tooltip } from '@keystar/ui/tooltip';
|
|
5
|
+
import { Text } from '@keystar/ui/typography';
|
|
6
|
+
import { trash2Icon } from '@keystar/ui/icon/icons/trash2Icon';
|
|
7
|
+
import { Icon } from '@keystar/ui/icon';
|
|
8
|
+
import { Flex, Divider } from '@keystar/ui/layout';
|
|
9
|
+
import { alertOctagonIcon } from '@keystar/ui/icon/icons/alertOctagonIcon';
|
|
10
|
+
import { alertTriangleIcon } from '@keystar/ui/icon/icons/alertTriangleIcon';
|
|
11
|
+
import { checkCircle2Icon } from '@keystar/ui/icon/icons/checkCircle2Icon';
|
|
12
|
+
import { infoIcon } from '@keystar/ui/icon/icons/infoIcon';
|
|
13
|
+
import { css, tokenSchema } from '@keystar/ui/style';
|
|
14
|
+
import { N as NotEditable } from './api-c32e360e.node.esm.js';
|
|
15
|
+
import { KeystarProvider } from '@keystar/ui/core';
|
|
16
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
17
|
+
import 'lkb-core';
|
|
18
|
+
import '@keystar/ui/drag-and-drop';
|
|
19
|
+
import 'react';
|
|
20
|
+
import './index-586adb8f.node.esm.js';
|
|
21
|
+
import 'slate';
|
|
22
|
+
import '@braintree/sanitize-url';
|
|
23
|
+
import '@react-aria/i18n';
|
|
24
|
+
import '@keystar/ui/number-field';
|
|
25
|
+
import '@keystar/ui/picker';
|
|
26
|
+
import '@keystar/ui/combobox';
|
|
27
|
+
import '@keystar/ui/text-field';
|
|
28
|
+
import '@keystar/ui/tag';
|
|
29
|
+
import '@keystar/ui/checkbox';
|
|
30
|
+
|
|
31
|
+
const toneToIcon = {
|
|
32
|
+
caution: alertTriangleIcon,
|
|
33
|
+
critical: alertOctagonIcon,
|
|
34
|
+
info: infoIcon,
|
|
35
|
+
positive: checkCircle2Icon
|
|
36
|
+
};
|
|
37
|
+
const toneToColor = {
|
|
38
|
+
caution: 'caution',
|
|
39
|
+
critical: 'critical',
|
|
40
|
+
info: 'accent',
|
|
41
|
+
positive: 'positive'
|
|
42
|
+
};
|
|
43
|
+
function Callout({
|
|
44
|
+
children,
|
|
45
|
+
tone = 'info',
|
|
46
|
+
...props
|
|
47
|
+
}) {
|
|
48
|
+
let icon = toneToIcon[tone];
|
|
49
|
+
let color = toneToColor[tone];
|
|
50
|
+
return /*#__PURE__*/jsxs("div", {
|
|
51
|
+
...props,
|
|
52
|
+
className: css({
|
|
53
|
+
borderRadius: tokenSchema.size.radius.regular,
|
|
54
|
+
background: 'var(--bg)',
|
|
55
|
+
color: 'var(--fg)',
|
|
56
|
+
display: 'flex',
|
|
57
|
+
gap: '1em',
|
|
58
|
+
padding: '1em',
|
|
59
|
+
svg: {
|
|
60
|
+
flexShrink: 0,
|
|
61
|
+
fill: 'none',
|
|
62
|
+
stroke: 'currentColor',
|
|
63
|
+
height: 20,
|
|
64
|
+
width: 20
|
|
65
|
+
}
|
|
66
|
+
}),
|
|
67
|
+
style: {
|
|
68
|
+
// @ts-expect-error
|
|
69
|
+
'--bg': tokenSchema.color.background[color],
|
|
70
|
+
'--fg': tokenSchema.color.foreground[color]
|
|
71
|
+
},
|
|
72
|
+
children: [/*#__PURE__*/jsx(NotEditable, {
|
|
73
|
+
children: /*#__PURE__*/jsx(Icon, {
|
|
74
|
+
src: icon
|
|
75
|
+
})
|
|
76
|
+
}), /*#__PURE__*/jsx("div", {
|
|
77
|
+
children: children
|
|
78
|
+
})]
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function CalloutToolbar(props) {
|
|
82
|
+
return /*#__PURE__*/jsx(KeystarProvider, {
|
|
83
|
+
children: /*#__PURE__*/jsxs(Flex, {
|
|
84
|
+
gap: "regular",
|
|
85
|
+
padding: "regular",
|
|
86
|
+
children: [/*#__PURE__*/jsx(ActionGroup, {
|
|
87
|
+
selectionMode: "single",
|
|
88
|
+
prominence: "low",
|
|
89
|
+
density: "compact",
|
|
90
|
+
buttonLabelBehavior: "hide",
|
|
91
|
+
onAction: key => {
|
|
92
|
+
props.onChange(key);
|
|
93
|
+
},
|
|
94
|
+
selectedKeys: [props.tone],
|
|
95
|
+
items: props.tones,
|
|
96
|
+
children: item => /*#__PURE__*/jsxs(Item, {
|
|
97
|
+
textValue: item.label,
|
|
98
|
+
children: [/*#__PURE__*/jsx(Icon, {
|
|
99
|
+
src: toneToIcon[item.value]
|
|
100
|
+
}), /*#__PURE__*/jsx(Text, {
|
|
101
|
+
children: item.label
|
|
102
|
+
})]
|
|
103
|
+
}, item.value)
|
|
104
|
+
}), /*#__PURE__*/jsx(Divider, {
|
|
105
|
+
orientation: "vertical"
|
|
106
|
+
}), /*#__PURE__*/jsxs(TooltipTrigger, {
|
|
107
|
+
children: [/*#__PURE__*/jsx(ActionButton, {
|
|
108
|
+
prominence: "low",
|
|
109
|
+
onPress: () => {
|
|
110
|
+
props.onRemove();
|
|
111
|
+
},
|
|
112
|
+
children: /*#__PURE__*/jsx(Icon, {
|
|
113
|
+
src: trash2Icon
|
|
114
|
+
})
|
|
115
|
+
}), /*#__PURE__*/jsx(Tooltip, {
|
|
116
|
+
tone: "critical",
|
|
117
|
+
children: /*#__PURE__*/jsx(Text, {
|
|
118
|
+
children: "Remove"
|
|
119
|
+
})
|
|
120
|
+
})]
|
|
121
|
+
})]
|
|
122
|
+
})
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export { Callout, CalloutToolbar };
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { ActionGroup, Item } from '@keystar/ui/action-group';
|
|
3
|
+
import { ActionButton } from '@keystar/ui/button';
|
|
4
|
+
import { TooltipTrigger, Tooltip } from '@keystar/ui/tooltip';
|
|
5
|
+
import { Text } from '@keystar/ui/typography';
|
|
6
|
+
import { trash2Icon } from '@keystar/ui/icon/icons/trash2Icon';
|
|
7
|
+
import { Icon } from '@keystar/ui/icon';
|
|
8
|
+
import { Flex, Divider } from '@keystar/ui/layout';
|
|
9
|
+
import { alertOctagonIcon } from '@keystar/ui/icon/icons/alertOctagonIcon';
|
|
10
|
+
import { alertTriangleIcon } from '@keystar/ui/icon/icons/alertTriangleIcon';
|
|
11
|
+
import { checkCircle2Icon } from '@keystar/ui/icon/icons/checkCircle2Icon';
|
|
12
|
+
import { infoIcon } from '@keystar/ui/icon/icons/infoIcon';
|
|
13
|
+
import { css, tokenSchema } from '@keystar/ui/style';
|
|
14
|
+
import { N as NotEditable } from './api-2f524611.esm.js';
|
|
15
|
+
import { KeystarProvider } from '@keystar/ui/core';
|
|
16
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
17
|
+
import 'lkb-core';
|
|
18
|
+
import '@keystar/ui/drag-and-drop';
|
|
19
|
+
import 'react';
|
|
20
|
+
import './index-67d52357.esm.js';
|
|
21
|
+
import 'slate';
|
|
22
|
+
import '@braintree/sanitize-url';
|
|
23
|
+
import '@react-aria/i18n';
|
|
24
|
+
import '@keystar/ui/number-field';
|
|
25
|
+
import '@keystar/ui/picker';
|
|
26
|
+
import '@keystar/ui/combobox';
|
|
27
|
+
import '@keystar/ui/text-field';
|
|
28
|
+
import '@keystar/ui/tag';
|
|
29
|
+
import '@keystar/ui/checkbox';
|
|
30
|
+
|
|
31
|
+
const toneToIcon = {
|
|
32
|
+
caution: alertTriangleIcon,
|
|
33
|
+
critical: alertOctagonIcon,
|
|
34
|
+
info: infoIcon,
|
|
35
|
+
positive: checkCircle2Icon
|
|
36
|
+
};
|
|
37
|
+
const toneToColor = {
|
|
38
|
+
caution: 'caution',
|
|
39
|
+
critical: 'critical',
|
|
40
|
+
info: 'accent',
|
|
41
|
+
positive: 'positive'
|
|
42
|
+
};
|
|
43
|
+
function Callout({
|
|
44
|
+
children,
|
|
45
|
+
tone = 'info',
|
|
46
|
+
...props
|
|
47
|
+
}) {
|
|
48
|
+
let icon = toneToIcon[tone];
|
|
49
|
+
let color = toneToColor[tone];
|
|
50
|
+
return /*#__PURE__*/jsxs("div", {
|
|
51
|
+
...props,
|
|
52
|
+
className: css({
|
|
53
|
+
borderRadius: tokenSchema.size.radius.regular,
|
|
54
|
+
background: 'var(--bg)',
|
|
55
|
+
color: 'var(--fg)',
|
|
56
|
+
display: 'flex',
|
|
57
|
+
gap: '1em',
|
|
58
|
+
padding: '1em',
|
|
59
|
+
svg: {
|
|
60
|
+
flexShrink: 0,
|
|
61
|
+
fill: 'none',
|
|
62
|
+
stroke: 'currentColor',
|
|
63
|
+
height: 20,
|
|
64
|
+
width: 20
|
|
65
|
+
}
|
|
66
|
+
}),
|
|
67
|
+
style: {
|
|
68
|
+
// @ts-expect-error
|
|
69
|
+
'--bg': tokenSchema.color.background[color],
|
|
70
|
+
'--fg': tokenSchema.color.foreground[color]
|
|
71
|
+
},
|
|
72
|
+
children: [/*#__PURE__*/jsx(NotEditable, {
|
|
73
|
+
children: /*#__PURE__*/jsx(Icon, {
|
|
74
|
+
src: icon
|
|
75
|
+
})
|
|
76
|
+
}), /*#__PURE__*/jsx("div", {
|
|
77
|
+
children: children
|
|
78
|
+
})]
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function CalloutToolbar(props) {
|
|
82
|
+
return /*#__PURE__*/jsx(KeystarProvider, {
|
|
83
|
+
children: /*#__PURE__*/jsxs(Flex, {
|
|
84
|
+
gap: "regular",
|
|
85
|
+
padding: "regular",
|
|
86
|
+
children: [/*#__PURE__*/jsx(ActionGroup, {
|
|
87
|
+
selectionMode: "single",
|
|
88
|
+
prominence: "low",
|
|
89
|
+
density: "compact",
|
|
90
|
+
buttonLabelBehavior: "hide",
|
|
91
|
+
onAction: key => {
|
|
92
|
+
props.onChange(key);
|
|
93
|
+
},
|
|
94
|
+
selectedKeys: [props.tone],
|
|
95
|
+
items: props.tones,
|
|
96
|
+
children: item => /*#__PURE__*/jsxs(Item, {
|
|
97
|
+
textValue: item.label,
|
|
98
|
+
children: [/*#__PURE__*/jsx(Icon, {
|
|
99
|
+
src: toneToIcon[item.value]
|
|
100
|
+
}), /*#__PURE__*/jsx(Text, {
|
|
101
|
+
children: item.label
|
|
102
|
+
})]
|
|
103
|
+
}, item.value)
|
|
104
|
+
}), /*#__PURE__*/jsx(Divider, {
|
|
105
|
+
orientation: "vertical"
|
|
106
|
+
}), /*#__PURE__*/jsxs(TooltipTrigger, {
|
|
107
|
+
children: [/*#__PURE__*/jsx(ActionButton, {
|
|
108
|
+
prominence: "low",
|
|
109
|
+
onPress: () => {
|
|
110
|
+
props.onRemove();
|
|
111
|
+
},
|
|
112
|
+
children: /*#__PURE__*/jsx(Icon, {
|
|
113
|
+
src: trash2Icon
|
|
114
|
+
})
|
|
115
|
+
}), /*#__PURE__*/jsx(Tooltip, {
|
|
116
|
+
tone: "critical",
|
|
117
|
+
children: /*#__PURE__*/jsx(Text, {
|
|
118
|
+
children: "Remove"
|
|
119
|
+
})
|
|
120
|
+
})]
|
|
121
|
+
})]
|
|
122
|
+
})
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export { Callout, CalloutToolbar };
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var actionGroup = require('@keystar/ui/action-group');
|
|
7
|
+
var button = require('@keystar/ui/button');
|
|
8
|
+
var tooltip = require('@keystar/ui/tooltip');
|
|
9
|
+
var typography = require('@keystar/ui/typography');
|
|
10
|
+
var trash2Icon = require('@keystar/ui/icon/icons/trash2Icon');
|
|
11
|
+
var icon = require('@keystar/ui/icon');
|
|
12
|
+
var layout = require('@keystar/ui/layout');
|
|
13
|
+
var alertOctagonIcon = require('@keystar/ui/icon/icons/alertOctagonIcon');
|
|
14
|
+
var alertTriangleIcon = require('@keystar/ui/icon/icons/alertTriangleIcon');
|
|
15
|
+
var checkCircle2Icon = require('@keystar/ui/icon/icons/checkCircle2Icon');
|
|
16
|
+
var infoIcon = require('@keystar/ui/icon/icons/infoIcon');
|
|
17
|
+
var style = require('@keystar/ui/style');
|
|
18
|
+
var api = require('./api-8e2b20b8.node.cjs.js');
|
|
19
|
+
var core = require('@keystar/ui/core');
|
|
20
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
21
|
+
require('lkb-core');
|
|
22
|
+
require('@keystar/ui/drag-and-drop');
|
|
23
|
+
require('react');
|
|
24
|
+
require('./index-c3223fdc.node.cjs.js');
|
|
25
|
+
require('slate');
|
|
26
|
+
require('@braintree/sanitize-url');
|
|
27
|
+
require('@react-aria/i18n');
|
|
28
|
+
require('@keystar/ui/number-field');
|
|
29
|
+
require('@keystar/ui/picker');
|
|
30
|
+
require('@keystar/ui/combobox');
|
|
31
|
+
require('@keystar/ui/text-field');
|
|
32
|
+
require('@keystar/ui/tag');
|
|
33
|
+
require('@keystar/ui/checkbox');
|
|
34
|
+
|
|
35
|
+
const toneToIcon = {
|
|
36
|
+
caution: alertTriangleIcon.alertTriangleIcon,
|
|
37
|
+
critical: alertOctagonIcon.alertOctagonIcon,
|
|
38
|
+
info: infoIcon.infoIcon,
|
|
39
|
+
positive: checkCircle2Icon.checkCircle2Icon
|
|
40
|
+
};
|
|
41
|
+
const toneToColor = {
|
|
42
|
+
caution: 'caution',
|
|
43
|
+
critical: 'critical',
|
|
44
|
+
info: 'accent',
|
|
45
|
+
positive: 'positive'
|
|
46
|
+
};
|
|
47
|
+
function Callout({
|
|
48
|
+
children,
|
|
49
|
+
tone = 'info',
|
|
50
|
+
...props
|
|
51
|
+
}) {
|
|
52
|
+
let icon$1 = toneToIcon[tone];
|
|
53
|
+
let color = toneToColor[tone];
|
|
54
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
55
|
+
...props,
|
|
56
|
+
className: style.css({
|
|
57
|
+
borderRadius: style.tokenSchema.size.radius.regular,
|
|
58
|
+
background: 'var(--bg)',
|
|
59
|
+
color: 'var(--fg)',
|
|
60
|
+
display: 'flex',
|
|
61
|
+
gap: '1em',
|
|
62
|
+
padding: '1em',
|
|
63
|
+
svg: {
|
|
64
|
+
flexShrink: 0,
|
|
65
|
+
fill: 'none',
|
|
66
|
+
stroke: 'currentColor',
|
|
67
|
+
height: 20,
|
|
68
|
+
width: 20
|
|
69
|
+
}
|
|
70
|
+
}),
|
|
71
|
+
style: {
|
|
72
|
+
// @ts-expect-error
|
|
73
|
+
'--bg': style.tokenSchema.color.background[color],
|
|
74
|
+
'--fg': style.tokenSchema.color.foreground[color]
|
|
75
|
+
},
|
|
76
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(api.NotEditable, {
|
|
77
|
+
children: /*#__PURE__*/jsxRuntime.jsx(icon.Icon, {
|
|
78
|
+
src: icon$1
|
|
79
|
+
})
|
|
80
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
81
|
+
children: children
|
|
82
|
+
})]
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function CalloutToolbar(props) {
|
|
86
|
+
return /*#__PURE__*/jsxRuntime.jsx(core.KeystarProvider, {
|
|
87
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(layout.Flex, {
|
|
88
|
+
gap: "regular",
|
|
89
|
+
padding: "regular",
|
|
90
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(actionGroup.ActionGroup, {
|
|
91
|
+
selectionMode: "single",
|
|
92
|
+
prominence: "low",
|
|
93
|
+
density: "compact",
|
|
94
|
+
buttonLabelBehavior: "hide",
|
|
95
|
+
onAction: key => {
|
|
96
|
+
props.onChange(key);
|
|
97
|
+
},
|
|
98
|
+
selectedKeys: [props.tone],
|
|
99
|
+
items: props.tones,
|
|
100
|
+
children: item => /*#__PURE__*/jsxRuntime.jsxs(actionGroup.Item, {
|
|
101
|
+
textValue: item.label,
|
|
102
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(icon.Icon, {
|
|
103
|
+
src: toneToIcon[item.value]
|
|
104
|
+
}), /*#__PURE__*/jsxRuntime.jsx(typography.Text, {
|
|
105
|
+
children: item.label
|
|
106
|
+
})]
|
|
107
|
+
}, item.value)
|
|
108
|
+
}), /*#__PURE__*/jsxRuntime.jsx(layout.Divider, {
|
|
109
|
+
orientation: "vertical"
|
|
110
|
+
}), /*#__PURE__*/jsxRuntime.jsxs(tooltip.TooltipTrigger, {
|
|
111
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(button.ActionButton, {
|
|
112
|
+
prominence: "low",
|
|
113
|
+
onPress: () => {
|
|
114
|
+
props.onRemove();
|
|
115
|
+
},
|
|
116
|
+
children: /*#__PURE__*/jsxRuntime.jsx(icon.Icon, {
|
|
117
|
+
src: trash2Icon.trash2Icon
|
|
118
|
+
})
|
|
119
|
+
}), /*#__PURE__*/jsxRuntime.jsx(tooltip.Tooltip, {
|
|
120
|
+
tone: "critical",
|
|
121
|
+
children: /*#__PURE__*/jsxRuntime.jsx(typography.Text, {
|
|
122
|
+
children: "Remove"
|
|
123
|
+
})
|
|
124
|
+
})]
|
|
125
|
+
})]
|
|
126
|
+
})
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
exports.Callout = Callout;
|
|
131
|
+
exports.CalloutToolbar = CalloutToolbar;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { NotEditable, component, fields } from "./document-editor/component-blocks/api.js";
|
|
2
|
+
export type { ArrayField, ChildField, ComponentBlock, ComponentSchema, ConditionalField, FormField, InferRenderersForComponentBlocks, ObjectField, RelationshipData, RelationshipField, } from "./document-editor/component-blocks/types.js";
|
|
3
|
+
export { componentBlocks } from "./my-component-blocks/index.js";
|
|
4
|
+
//# sourceMappingURL=component-blocks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-blocks.d.ts","sourceRoot":"../../../src","sources":["component-blocks.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,kDAA8C;AACvF,YAAY,EACV,UAAU,EACV,UAAU,EACV,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,SAAS,EACT,gCAAgC,EAChC,WAAW,EACX,gBAAgB,EAChB,iBAAiB,GAClB,oDAAgD;AAEjD,OAAO,EAAE,eAAe,EAAE,uCAA6B"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactElement, type ReactNode } from 'react';
|
|
2
|
+
import type { BlockFormattingConfig, ChildField, ConditionalField, ComponentBlock, ComponentSchema, GenericPreviewProps, InlineMarksConfig, ObjectField, RelationshipField, FormField, ArrayField } from "./types.js";
|
|
3
|
+
export * from "./types.js";
|
|
4
|
+
export declare const fields: {
|
|
5
|
+
file({ label, isImage, defaultValue, allowedFileTypes, onUpload, }: {
|
|
6
|
+
label: string;
|
|
7
|
+
isImage?: boolean;
|
|
8
|
+
defaultValue?: string;
|
|
9
|
+
allowedFileTypes?: string[];
|
|
10
|
+
onUpload?: (file: File) => Promise<string>;
|
|
11
|
+
}): FormField<string, undefined>;
|
|
12
|
+
text({ label, defaultValue, displayMode, }: {
|
|
13
|
+
label: string;
|
|
14
|
+
defaultValue?: string;
|
|
15
|
+
displayMode?: "input" | "textarea";
|
|
16
|
+
}): FormField<string, undefined>;
|
|
17
|
+
integer({ label, defaultValue, }: {
|
|
18
|
+
label: string;
|
|
19
|
+
defaultValue?: number;
|
|
20
|
+
}): FormField<number, undefined>;
|
|
21
|
+
url({ label, defaultValue, }: {
|
|
22
|
+
label: string;
|
|
23
|
+
defaultValue?: string;
|
|
24
|
+
}): FormField<string, undefined>;
|
|
25
|
+
select<const Option extends {
|
|
26
|
+
label: string;
|
|
27
|
+
value: string;
|
|
28
|
+
}>({ label, options, defaultValue, }: {
|
|
29
|
+
label: string;
|
|
30
|
+
options: readonly Option[];
|
|
31
|
+
defaultValue: Option["value"];
|
|
32
|
+
}): FormField<Option["value"], readonly Option[]>;
|
|
33
|
+
multiselect<const Option extends {
|
|
34
|
+
label: string;
|
|
35
|
+
value: string;
|
|
36
|
+
}>({ label, options, defaultValue, }: {
|
|
37
|
+
label: string;
|
|
38
|
+
options: readonly Option[];
|
|
39
|
+
defaultValue: readonly Option["value"][];
|
|
40
|
+
}): FormField<readonly Option["value"][], readonly Option[]>;
|
|
41
|
+
checkbox({ label, defaultValue, }: {
|
|
42
|
+
label: string;
|
|
43
|
+
defaultValue?: boolean;
|
|
44
|
+
}): FormField<boolean, undefined>;
|
|
45
|
+
empty(): {
|
|
46
|
+
kind: "form";
|
|
47
|
+
Input(): null;
|
|
48
|
+
options: undefined;
|
|
49
|
+
defaultValue: null;
|
|
50
|
+
validate(value: unknown): value is null | undefined;
|
|
51
|
+
};
|
|
52
|
+
child(options: {
|
|
53
|
+
kind: "block";
|
|
54
|
+
placeholder: string;
|
|
55
|
+
formatting?: BlockFormattingConfig | "inherit";
|
|
56
|
+
dividers?: "inherit";
|
|
57
|
+
links?: "inherit";
|
|
58
|
+
relationships?: "inherit";
|
|
59
|
+
componentBlocks?: "inherit";
|
|
60
|
+
} | {
|
|
61
|
+
kind: "inline";
|
|
62
|
+
placeholder: string;
|
|
63
|
+
formatting?: "inherit" | {
|
|
64
|
+
inlineMarks?: InlineMarksConfig;
|
|
65
|
+
softBreaks?: "inherit";
|
|
66
|
+
};
|
|
67
|
+
links?: "inherit";
|
|
68
|
+
relationships?: "inherit";
|
|
69
|
+
}): ChildField;
|
|
70
|
+
object<Fields extends Record<string, ComponentSchema>>(fields: Fields): {
|
|
71
|
+
kind: "object";
|
|
72
|
+
fields: Fields;
|
|
73
|
+
};
|
|
74
|
+
conditional<DiscriminantField extends {
|
|
75
|
+
defaultValue: any;
|
|
76
|
+
}, ConditionalValues extends { [Key in `${DiscriminantField["defaultValue"]}`]: ComponentSchema; }>(discriminant: DiscriminantField, values: ConditionalValues): ConditionalField<DiscriminantField, ConditionalValues>;
|
|
77
|
+
relationship<Many extends boolean | undefined = false>({ listKey, label, labelField, selection, many, }: {
|
|
78
|
+
listKey: string;
|
|
79
|
+
label: string;
|
|
80
|
+
/** The label field to use for this relationship when showing the select */
|
|
81
|
+
labelField?: string;
|
|
82
|
+
/** The GraphQL selection to use for this relationship when hydrating .data */
|
|
83
|
+
selection?: string;
|
|
84
|
+
} & (Many extends undefined | false ? {
|
|
85
|
+
many?: Many;
|
|
86
|
+
} : {
|
|
87
|
+
many: Many;
|
|
88
|
+
})): RelationshipField<Many extends true ? true : false>;
|
|
89
|
+
array<ElementField extends ComponentSchema>(element: ElementField, opts?: {
|
|
90
|
+
itemLabel?: (props: GenericPreviewProps<ElementField, unknown>) => string;
|
|
91
|
+
label?: string;
|
|
92
|
+
}): ArrayField<ElementField>;
|
|
93
|
+
};
|
|
94
|
+
export type PreviewProps<Schema extends ComponentSchema> = GenericPreviewProps<Schema, ReactNode>;
|
|
95
|
+
export type PreviewPropsForToolbar<Schema extends ComponentSchema> = GenericPreviewProps<Schema, undefined>;
|
|
96
|
+
export declare function component<Schema extends {
|
|
97
|
+
[Key in any]: ComponentSchema;
|
|
98
|
+
}>(options: {
|
|
99
|
+
/** The preview component shown in the editor */
|
|
100
|
+
preview: (props: PreviewProps<ObjectField<Schema>>) => ReactElement | null;
|
|
101
|
+
/** The schema for the props that the preview component, toolbar and rendered component will receive */
|
|
102
|
+
schema: Schema;
|
|
103
|
+
/** The label to show in the insert menu and chrome around the block if chromeless is false */
|
|
104
|
+
label: string;
|
|
105
|
+
} & ({
|
|
106
|
+
chromeless: true;
|
|
107
|
+
toolbar?: (props: {
|
|
108
|
+
props: PreviewPropsForToolbar<ObjectField<Schema>>;
|
|
109
|
+
onRemove(): void;
|
|
110
|
+
}) => ReactElement;
|
|
111
|
+
} | {
|
|
112
|
+
chromeless?: false;
|
|
113
|
+
toolbar?: (props: {
|
|
114
|
+
props: PreviewPropsForToolbar<ObjectField<Schema>>;
|
|
115
|
+
onShowEditMode(): void;
|
|
116
|
+
onRemove(): void;
|
|
117
|
+
}) => ReactElement;
|
|
118
|
+
})): ComponentBlock<Schema>;
|
|
119
|
+
export declare function NotEditable({ children, ...props }: HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
120
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"../../../../../src/document-editor/component-blocks","sources":["api.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAY,KAAK,cAAc,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAExF,OAAO,KAAK,EACV,qBAAqB,EACrB,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,SAAS,EACT,UAAU,EACX,mBAAe;AAYhB,2BAAuB;AAQvB,eAAO,MAAM,MAAM;wEAOd;QACD,KAAK,EAAE,MAAM,CAAA;QACb,OAAO,CAAC,EAAE,OAAO,CAAA;QACjB,YAAY,CAAC,EAAE,MAAM,CAAA;QACrB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;QAC3B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAA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