@betterstart/cli 0.1.3 → 0.1.5
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/README.md +133 -0
- package/dist/cli.d.ts +1 -9
- package/dist/cli.js +13585 -367
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +24 -266
- package/dist/index.js +4 -11378
- package/dist/index.js.map +1 -1
- package/package.json +29 -42
- package/templates/schema.json +959 -0
- package/templates/tiptap/hooks/use-composed-ref.ts +43 -0
- package/templates/tiptap/hooks/use-cursor-visibility.ts +68 -0
- package/templates/tiptap/hooks/use-element-rect.ts +166 -0
- package/templates/tiptap/hooks/use-is-breakpoint.ts +32 -0
- package/templates/tiptap/hooks/use-menu-navigation.ts +182 -0
- package/templates/tiptap/hooks/use-scrolling.ts +64 -0
- package/templates/tiptap/hooks/use-throttled-callback.ts +146 -0
- package/templates/tiptap/hooks/use-tiptap-editor.ts +46 -0
- package/templates/tiptap/hooks/use-unmount.ts +21 -0
- package/templates/tiptap/hooks/use-window-size.ts +87 -0
- package/templates/tiptap/lib/tiptap-utils.ts +587 -0
- package/templates/tiptap/styles/_keyframe-animations.scss +91 -0
- package/templates/tiptap/styles/_variables.scss +296 -0
- package/templates/tiptap/tiptap-extension/node-background-extension.ts +138 -0
- package/templates/tiptap/tiptap-icons/align-center-icon.tsx +38 -0
- package/templates/tiptap/tiptap-icons/align-justify-icon.tsx +38 -0
- package/templates/tiptap/tiptap-icons/align-left-icon.tsx +38 -0
- package/templates/tiptap/tiptap-icons/align-right-icon.tsx +38 -0
- package/templates/tiptap/tiptap-icons/arrow-left-icon.tsx +24 -0
- package/templates/tiptap/tiptap-icons/ban-icon.tsx +26 -0
- package/templates/tiptap/tiptap-icons/blockquote-icon.tsx +44 -0
- package/templates/tiptap/tiptap-icons/bold-icon.tsx +26 -0
- package/templates/tiptap/tiptap-icons/chevron-down-icon.tsx +26 -0
- package/templates/tiptap/tiptap-icons/close-icon.tsx +24 -0
- package/templates/tiptap/tiptap-icons/code-block-icon.tsx +38 -0
- package/templates/tiptap/tiptap-icons/code2-icon.tsx +32 -0
- package/templates/tiptap/tiptap-icons/corner-down-left-icon.tsx +26 -0
- package/templates/tiptap/tiptap-icons/external-link-icon.tsx +28 -0
- package/templates/tiptap/tiptap-icons/heading-five-icon.tsx +28 -0
- package/templates/tiptap/tiptap-icons/heading-four-icon.tsx +28 -0
- package/templates/tiptap/tiptap-icons/heading-icon.tsx +24 -0
- package/templates/tiptap/tiptap-icons/heading-one-icon.tsx +28 -0
- package/templates/tiptap/tiptap-icons/heading-six-icon.tsx +30 -0
- package/templates/tiptap/tiptap-icons/heading-three-icon.tsx +36 -0
- package/templates/tiptap/tiptap-icons/heading-two-icon.tsx +28 -0
- package/templates/tiptap/tiptap-icons/highlighter-icon.tsx +26 -0
- package/templates/tiptap/tiptap-icons/image-plus-icon.tsx +26 -0
- package/templates/tiptap/tiptap-icons/italic-icon.tsx +24 -0
- package/templates/tiptap/tiptap-icons/link-icon.tsx +28 -0
- package/templates/tiptap/tiptap-icons/list-icon.tsx +56 -0
- package/templates/tiptap/tiptap-icons/list-ordered-icon.tsx +56 -0
- package/templates/tiptap/tiptap-icons/list-todo-icon.tsx +50 -0
- package/templates/tiptap/tiptap-icons/moon-star-icon.tsx +30 -0
- package/templates/tiptap/tiptap-icons/redo2-icon.tsx +26 -0
- package/templates/tiptap/tiptap-icons/strike-icon.tsx +28 -0
- package/templates/tiptap/tiptap-icons/subscript-icon.tsx +38 -0
- package/templates/tiptap/tiptap-icons/sun-icon.tsx +58 -0
- package/templates/tiptap/tiptap-icons/superscript-icon.tsx +38 -0
- package/templates/tiptap/tiptap-icons/trash-icon.tsx +26 -0
- package/templates/tiptap/tiptap-icons/underline-icon.tsx +26 -0
- package/templates/tiptap/tiptap-icons/undo2-icon.tsx +26 -0
- package/templates/tiptap/tiptap-node/blockquote-node/blockquote-node.scss +37 -0
- package/templates/tiptap/tiptap-node/code-block-node/code-block-node.scss +54 -0
- package/templates/tiptap/tiptap-node/heading-node/heading-node.scss +45 -0
- package/templates/tiptap/tiptap-node/horizontal-rule-node/horizontal-rule-node-extension.ts +10 -0
- package/templates/tiptap/tiptap-node/horizontal-rule-node/horizontal-rule-node.scss +25 -0
- package/templates/tiptap/tiptap-node/image-node/image-node.scss +35 -0
- package/templates/tiptap/tiptap-node/image-upload-node/image-upload-node-extension.ts +154 -0
- package/templates/tiptap/tiptap-node/image-upload-node/image-upload-node.scss +249 -0
- package/templates/tiptap/tiptap-node/image-upload-node/image-upload-node.tsx +522 -0
- package/templates/tiptap/tiptap-node/image-upload-node/index.tsx +1 -0
- package/templates/tiptap/tiptap-node/list-node/list-node.scss +208 -0
- package/templates/tiptap/tiptap-node/paragraph-node/paragraph-node.scss +273 -0
- package/templates/tiptap/tiptap-ui/blockquote-button/blockquote-button.tsx +104 -0
- package/templates/tiptap/tiptap-ui/blockquote-button/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/blockquote-button/use-blockquote.ts +252 -0
- package/templates/tiptap/tiptap-ui/code-block-button/code-block-button.tsx +106 -0
- package/templates/tiptap/tiptap-ui/code-block-button/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/code-block-button/use-code-block.ts +261 -0
- package/templates/tiptap/tiptap-ui/color-highlight-button/color-highlight-button.scss +49 -0
- package/templates/tiptap/tiptap-ui/color-highlight-button/color-highlight-button.tsx +153 -0
- package/templates/tiptap/tiptap-ui/color-highlight-button/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/color-highlight-button/use-color-highlight.ts +345 -0
- package/templates/tiptap/tiptap-ui/color-highlight-popover/color-highlight-popover.tsx +207 -0
- package/templates/tiptap/tiptap-ui/color-highlight-popover/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui/heading-button/heading-button.tsx +107 -0
- package/templates/tiptap/tiptap-ui/heading-button/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/heading-button/use-heading.ts +314 -0
- package/templates/tiptap/tiptap-ui/heading-dropdown-menu/heading-dropdown-menu.tsx +131 -0
- package/templates/tiptap/tiptap-ui/heading-dropdown-menu/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/heading-dropdown-menu/use-heading-dropdown-menu.ts +130 -0
- package/templates/tiptap/tiptap-ui/image-upload-button/image-upload-button.tsx +114 -0
- package/templates/tiptap/tiptap-ui/image-upload-button/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/image-upload-button/use-image-upload.ts +192 -0
- package/templates/tiptap/tiptap-ui/link-popover/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/link-popover/link-popover.tsx +285 -0
- package/templates/tiptap/tiptap-ui/link-popover/use-link-popover.ts +286 -0
- package/templates/tiptap/tiptap-ui/list-button/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/list-button/list-button.tsx +108 -0
- package/templates/tiptap/tiptap-ui/list-button/use-list.ts +329 -0
- package/templates/tiptap/tiptap-ui/list-dropdown-menu/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui/list-dropdown-menu/list-dropdown-menu.tsx +123 -0
- package/templates/tiptap/tiptap-ui/list-dropdown-menu/use-list-dropdown-menu.ts +203 -0
- package/templates/tiptap/tiptap-ui/mark-button/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/mark-button/mark-button.tsx +107 -0
- package/templates/tiptap/tiptap-ui/mark-button/use-mark.ts +206 -0
- package/templates/tiptap/tiptap-ui/text-align-button/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/text-align-button/text-align-button.tsx +118 -0
- package/templates/tiptap/tiptap-ui/text-align-button/use-text-align.ts +212 -0
- package/templates/tiptap/tiptap-ui/undo-redo-button/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/undo-redo-button/undo-redo-button.tsx +105 -0
- package/templates/tiptap/tiptap-ui/undo-redo-button/use-undo-redo.ts +173 -0
- package/templates/tiptap/tiptap-ui-primitive/badge/badge-colors.scss +395 -0
- package/templates/tiptap/tiptap-ui-primitive/badge/badge-group.scss +16 -0
- package/templates/tiptap/tiptap-ui-primitive/badge/badge.scss +99 -0
- package/templates/tiptap/tiptap-ui-primitive/badge/badge.tsx +46 -0
- package/templates/tiptap/tiptap-ui-primitive/badge/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/button/button-colors.scss +429 -0
- package/templates/tiptap/tiptap-ui-primitive/button/button-group.scss +22 -0
- package/templates/tiptap/tiptap-ui-primitive/button/button.scss +314 -0
- package/templates/tiptap/tiptap-ui-primitive/button/button.tsx +102 -0
- package/templates/tiptap/tiptap-ui-primitive/button/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/card/card.scss +77 -0
- package/templates/tiptap/tiptap-ui-primitive/card/card.tsx +59 -0
- package/templates/tiptap/tiptap-ui-primitive/card/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/dropdown-menu/dropdown-menu.scss +63 -0
- package/templates/tiptap/tiptap-ui-primitive/dropdown-menu/dropdown-menu.tsx +95 -0
- package/templates/tiptap/tiptap-ui-primitive/dropdown-menu/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/input/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/input/input.scss +45 -0
- package/templates/tiptap/tiptap-ui-primitive/input/input.tsx +18 -0
- package/templates/tiptap/tiptap-ui-primitive/popover/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/popover/popover.scss +63 -0
- package/templates/tiptap/tiptap-ui-primitive/popover/popover.tsx +33 -0
- package/templates/tiptap/tiptap-ui-primitive/separator/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/separator/separator.scss +23 -0
- package/templates/tiptap/tiptap-ui-primitive/separator/separator.tsx +33 -0
- package/templates/tiptap/tiptap-ui-primitive/spacer/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/spacer/spacer.tsx +21 -0
- package/templates/tiptap/tiptap-ui-primitive/toolbar/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/toolbar/toolbar.scss +98 -0
- package/templates/tiptap/tiptap-ui-primitive/toolbar/toolbar.tsx +113 -0
- package/templates/tiptap/tiptap-ui-primitive/tooltip/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/tooltip/tooltip.scss +43 -0
- package/templates/tiptap/tiptap-ui-primitive/tooltip/tooltip.tsx +223 -0
- package/templates/ui/accordion.tsx +52 -0
- package/templates/ui/alert-dialog.tsx +116 -0
- package/templates/ui/alert.tsx +48 -0
- package/templates/ui/aspect-ratio.tsx +7 -0
- package/templates/ui/avatar.tsx +46 -0
- package/templates/ui/badge.tsx +32 -0
- package/templates/ui/breadcrumb.tsx +98 -0
- package/templates/ui/button-group.tsx +77 -0
- package/templates/ui/button.tsx +48 -0
- package/templates/ui/calendar.tsx +176 -0
- package/templates/ui/card.tsx +54 -0
- package/templates/ui/carousel.tsx +234 -0
- package/templates/ui/chart.tsx +349 -0
- package/templates/ui/checkbox.tsx +27 -0
- package/templates/ui/collapsible.tsx +11 -0
- package/templates/ui/command.tsx +142 -0
- package/templates/ui/context-menu.tsx +188 -0
- package/templates/ui/curriculum-editor.tsx +601 -0
- package/templates/ui/date-picker.tsx +70 -0
- package/templates/ui/dialog.tsx +103 -0
- package/templates/ui/drawer.tsx +99 -0
- package/templates/ui/dropdown-menu.tsx +185 -0
- package/templates/ui/dynamic-list-field.tsx +95 -0
- package/templates/ui/empty.tsx +90 -0
- package/templates/ui/field.tsx +231 -0
- package/templates/ui/file-upload-example.tsx +113 -0
- package/templates/ui/form.tsx +172 -0
- package/templates/ui/hover-card.tsx +28 -0
- package/templates/ui/icon-picker.tsx +435 -0
- package/templates/ui/icons-data.ts +6 -0
- package/templates/ui/image-upload-field.tsx +360 -0
- package/templates/ui/input-group.tsx +160 -0
- package/templates/ui/input-otp.tsx +70 -0
- package/templates/ui/input.tsx +21 -0
- package/templates/ui/item.tsx +171 -0
- package/templates/ui/kbd.tsx +28 -0
- package/templates/ui/label.tsx +20 -0
- package/templates/ui/logo.tsx +113 -0
- package/templates/ui/markdown-editor.tsx +303 -0
- package/templates/ui/markdown-utils.ts +128 -0
- package/templates/ui/media-upload-field.tsx +255 -0
- package/templates/ui/menubar.tsx +230 -0
- package/templates/ui/navigation-menu.tsx +119 -0
- package/templates/ui/pagination.tsx +96 -0
- package/templates/ui/placeholder.tsx +25 -0
- package/templates/ui/popover.tsx +32 -0
- package/templates/ui/progress.tsx +24 -0
- package/templates/ui/radio-group.tsx +37 -0
- package/templates/ui/resizable.tsx +41 -0
- package/templates/ui/rich-text-editor.tsx +374 -0
- package/templates/ui/scroll-area.tsx +45 -0
- package/templates/ui/select.tsx +151 -0
- package/templates/ui/separator.tsx +25 -0
- package/templates/ui/sheet.tsx +120 -0
- package/templates/ui/sidebar.tsx +687 -0
- package/templates/ui/skeleton.tsx +7 -0
- package/templates/ui/slider.tsx +24 -0
- package/templates/ui/sonner.tsx +29 -0
- package/templates/ui/spinner.tsx +15 -0
- package/templates/ui/switch.tsx +28 -0
- package/templates/ui/table.tsx +93 -0
- package/templates/ui/tabs.tsx +54 -0
- package/templates/ui/textarea.tsx +20 -0
- package/templates/ui/toast.tsx +127 -0
- package/templates/ui/toggle-group.tsx +56 -0
- package/templates/ui/toggle.tsx +43 -0
- package/templates/ui/tooltip.tsx +31 -0
- package/templates/ui/use-mobile.tsx +19 -0
- package/templates/ui/video-upload-field.tsx +368 -0
- package/dist/chunk-EIH4RRIJ.js +0 -183
- package/dist/chunk-EIH4RRIJ.js.map +0 -1
- package/dist/chunk-NKRQYAS6.js +0 -260
- package/dist/chunk-NKRQYAS6.js.map +0 -1
- package/dist/chunk-QLVSHP7X.js +0 -235
- package/dist/chunk-QLVSHP7X.js.map +0 -1
- package/dist/chunk-WY6BC55D.js +0 -357
- package/dist/chunk-WY6BC55D.js.map +0 -1
- package/dist/config/index.d.ts +0 -93
- package/dist/config/index.js +0 -58
- package/dist/config/index.js.map +0 -1
- package/dist/core/index.d.ts +0 -415
- package/dist/core/index.js +0 -906
- package/dist/core/index.js.map +0 -1
- package/dist/import-resolver-BaZ-rzkH.d.ts +0 -123
- package/dist/logger-awLb347n.d.ts +0 -81
- package/dist/plugins/index.d.ts +0 -213
- package/dist/plugins/index.js +0 -365
- package/dist/plugins/index.js.map +0 -1
- package/dist/types-ByX_gl6y.d.ts +0 -232
- package/dist/types-eI549DEG.d.ts +0 -331
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
.tiptap-button {
|
|
2
|
+
font-size: 0.875rem;
|
|
3
|
+
font-weight: 500;
|
|
4
|
+
font-feature-settings:
|
|
5
|
+
"salt" on,
|
|
6
|
+
"cv01" on;
|
|
7
|
+
line-height: 1.15;
|
|
8
|
+
height: 2rem;
|
|
9
|
+
min-width: 2rem;
|
|
10
|
+
border: none;
|
|
11
|
+
padding: 0.5rem;
|
|
12
|
+
gap: 0.25rem;
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
border-radius: var(--tt-radius-lg, 0.75rem);
|
|
17
|
+
transition-property: background, color, opacity;
|
|
18
|
+
transition-duration: var(--tt-transition-duration-default);
|
|
19
|
+
transition-timing-function: var(--tt-transition-easing-default);
|
|
20
|
+
|
|
21
|
+
// focus-visible
|
|
22
|
+
&:focus-visible {
|
|
23
|
+
outline: none;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&[data-highlighted="true"],
|
|
27
|
+
&[data-focus-visible="true"] {
|
|
28
|
+
background-color: var(--tt-button-hover-bg-color);
|
|
29
|
+
color: var(--tt-button-hover-text-color);
|
|
30
|
+
// outline: 2px solid var(--tt-button-active-icon-color);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&[data-weight="small"] {
|
|
34
|
+
width: 1.5rem;
|
|
35
|
+
min-width: 1.5rem;
|
|
36
|
+
padding-right: 0;
|
|
37
|
+
padding-left: 0;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* button size large */
|
|
41
|
+
&[data-size="large"] {
|
|
42
|
+
font-size: 0.9375rem;
|
|
43
|
+
height: 2.375rem;
|
|
44
|
+
min-width: 2.375rem;
|
|
45
|
+
padding: 0.625rem;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* button size small */
|
|
49
|
+
&[data-size="small"] {
|
|
50
|
+
font-size: 0.75rem;
|
|
51
|
+
line-height: 1.2;
|
|
52
|
+
height: 1.5rem;
|
|
53
|
+
min-width: 1.5rem;
|
|
54
|
+
padding: 0.3125rem;
|
|
55
|
+
border-radius: var(--tt-radius-md, 0.5rem);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* trim / expand text of the button */
|
|
59
|
+
.tiptap-button-text {
|
|
60
|
+
padding: 0 0.125rem;
|
|
61
|
+
flex-grow: 1;
|
|
62
|
+
text-align: left;
|
|
63
|
+
line-height: 1.5rem;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&[data-text-trim="on"] {
|
|
67
|
+
.tiptap-button-text {
|
|
68
|
+
text-overflow: ellipsis;
|
|
69
|
+
overflow: hidden;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* global icon settings */
|
|
74
|
+
.tiptap-button-icon,
|
|
75
|
+
.tiptap-button-icon-sub,
|
|
76
|
+
.tiptap-button-dropdown-arrows,
|
|
77
|
+
.tiptap-button-dropdown-small {
|
|
78
|
+
flex-shrink: 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* standard icon, what is used */
|
|
82
|
+
.tiptap-button-icon {
|
|
83
|
+
width: 1rem;
|
|
84
|
+
height: 1rem;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&[data-size="large"] .tiptap-button-icon {
|
|
88
|
+
width: 1.125rem;
|
|
89
|
+
height: 1.125rem;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&[data-size="small"] .tiptap-button-icon {
|
|
93
|
+
width: 0.875rem;
|
|
94
|
+
height: 0.875rem;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* if 2 icons are used and this icon should be more subtle */
|
|
98
|
+
.tiptap-button-icon-sub {
|
|
99
|
+
width: 1rem;
|
|
100
|
+
height: 1rem;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&[data-size="large"] .tiptap-button-icon-sub {
|
|
104
|
+
width: 1.125rem;
|
|
105
|
+
height: 1.125rem;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
&[data-size="small"] .tiptap-button-icon-sub {
|
|
109
|
+
width: 0.875rem;
|
|
110
|
+
height: 0.875rem;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* dropdown menus or arrows that are slightly smaller */
|
|
114
|
+
.tiptap-button-dropdown-arrows {
|
|
115
|
+
width: 0.75rem;
|
|
116
|
+
height: 0.75rem;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
&[data-size="large"] .tiptap-button-dropdown-arrows {
|
|
120
|
+
width: 0.875rem;
|
|
121
|
+
height: 0.875rem;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
&[data-size="small"] .tiptap-button-dropdown-arrows {
|
|
125
|
+
width: 0.625rem;
|
|
126
|
+
height: 0.625rem;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/* dropdown menu for icon buttons only */
|
|
130
|
+
.tiptap-button-dropdown-small {
|
|
131
|
+
width: 0.625rem;
|
|
132
|
+
height: 0.625rem;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
&[data-size="large"] .tiptap-button-dropdown-small {
|
|
136
|
+
width: 0.75rem;
|
|
137
|
+
height: 0.75rem;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
&[data-size="small"] .tiptap-button-dropdown-small {
|
|
141
|
+
width: 0.5rem;
|
|
142
|
+
height: 0.5rem;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/* button only has icons */
|
|
146
|
+
&:has(> svg):not(:has(> :not(svg))) {
|
|
147
|
+
gap: 0.125rem;
|
|
148
|
+
|
|
149
|
+
&[data-size="large"],
|
|
150
|
+
&[data-size="small"] {
|
|
151
|
+
gap: 0.125rem;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/* button only has 2 icons and one of them is dropdown small */
|
|
156
|
+
&:has(> svg:nth-of-type(2)):has(> .tiptap-button-dropdown-small):not(
|
|
157
|
+
:has(> svg:nth-of-type(3))
|
|
158
|
+
):not(:has(> .tiptap-button-text)) {
|
|
159
|
+
gap: 0;
|
|
160
|
+
padding-right: 0.25rem;
|
|
161
|
+
|
|
162
|
+
&[data-size="large"] {
|
|
163
|
+
padding-right: 0.375rem;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
&[data-size="small"] {
|
|
167
|
+
padding-right: 0.25rem;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/* Emoji is used in a button */
|
|
172
|
+
.tiptap-button-emoji {
|
|
173
|
+
width: 1rem;
|
|
174
|
+
display: flex;
|
|
175
|
+
justify-content: center;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
&[data-size="large"] .tiptap-button-emoji {
|
|
179
|
+
width: 1.125rem;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
&[data-size="small"] .tiptap-button-emoji {
|
|
183
|
+
width: 0.875rem;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/* --------------------------------------------
|
|
188
|
+
----------- BUTTON COLOR SETTINGS -------------
|
|
189
|
+
-------------------------------------------- */
|
|
190
|
+
|
|
191
|
+
.tiptap-button {
|
|
192
|
+
background-color: var(--tt-button-default-bg-color);
|
|
193
|
+
color: var(--tt-button-default-text-color);
|
|
194
|
+
|
|
195
|
+
.tiptap-button-icon {
|
|
196
|
+
color: var(--tt-button-default-icon-color);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.tiptap-button-icon-sub {
|
|
200
|
+
color: var(--tt-button-default-icon-sub-color);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.tiptap-button-dropdown-arrows {
|
|
204
|
+
color: var(--tt-button-default-dropdown-arrows-color);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.tiptap-button-dropdown-small {
|
|
208
|
+
color: var(--tt-button-default-dropdown-arrows-color);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/* hover state of a button */
|
|
212
|
+
&:hover:not([data-active-item="true"]):not([disabled]),
|
|
213
|
+
&[data-active-item="true"]:not([disabled]),
|
|
214
|
+
&[data-highlighted]:not([disabled]):not([data-highlighted="false"]) {
|
|
215
|
+
background-color: var(--tt-button-hover-bg-color);
|
|
216
|
+
color: var(--tt-button-hover-text-color);
|
|
217
|
+
|
|
218
|
+
.tiptap-button-icon {
|
|
219
|
+
color: var(--tt-button-hover-icon-color);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.tiptap-button-icon-sub {
|
|
223
|
+
color: var(--tt-button-hover-icon-sub-color);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.tiptap-button-dropdown-arrows,
|
|
227
|
+
.tiptap-button-dropdown-small {
|
|
228
|
+
color: var(--tt-button-hover-dropdown-arrows-color);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/* Active state of a button */
|
|
233
|
+
&[data-active-state="on"]:not([disabled]),
|
|
234
|
+
&[data-state="open"]:not([disabled]) {
|
|
235
|
+
background-color: var(--tt-button-active-bg-color);
|
|
236
|
+
color: var(--tt-button-active-text-color);
|
|
237
|
+
|
|
238
|
+
.tiptap-button-icon {
|
|
239
|
+
color: var(--tt-button-active-icon-color);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.tiptap-button-icon-sub {
|
|
243
|
+
color: var(--tt-button-active-icon-sub-color);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.tiptap-button-dropdown-arrows,
|
|
247
|
+
.tiptap-button-dropdown-small {
|
|
248
|
+
color: var(--tt-button-active-dropdown-arrows-color);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
&:hover {
|
|
252
|
+
background-color: var(--tt-button-active-hover-bg-color);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/* Emphasized */
|
|
256
|
+
&[data-appearance="emphasized"] {
|
|
257
|
+
background-color: var(--tt-button-active-bg-color-emphasized);
|
|
258
|
+
color: var(--tt-button-active-text-color-emphasized);
|
|
259
|
+
|
|
260
|
+
.tiptap-button-icon {
|
|
261
|
+
color: var(--tt-button-active-icon-color-emphasized);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.tiptap-button-icon-sub {
|
|
265
|
+
color: var(--tt-button-active-icon-sub-color-emphasized);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.tiptap-button-dropdown-arrows,
|
|
269
|
+
.tiptap-button-dropdown-small {
|
|
270
|
+
color: var(--tt-button-active-dropdown-arrows-color-emphasized);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
&:hover {
|
|
274
|
+
background-color: var(--tt-button-active-hover-bg-color-emphasized);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/* Subdued */
|
|
279
|
+
&[data-appearance="subdued"] {
|
|
280
|
+
background-color: var(--tt-button-active-bg-color-subdued);
|
|
281
|
+
color: var(--tt-button-active-text-color-subdued);
|
|
282
|
+
|
|
283
|
+
.tiptap-button-icon {
|
|
284
|
+
color: var(--tt-button-active-icon-color-subdued);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.tiptap-button-icon-sub {
|
|
288
|
+
color: var(--tt-button-active-icon-sub-color-subdued);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.tiptap-button-dropdown-arrows,
|
|
292
|
+
.tiptap-button-dropdown-small {
|
|
293
|
+
color: var(--tt-button-active-dropdown-arrows-color-subdued);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
&:hover {
|
|
297
|
+
background-color: var(--tt-button-active-hover-bg-color-subdued);
|
|
298
|
+
|
|
299
|
+
.tiptap-button-icon {
|
|
300
|
+
color: var(--tt-button-active-icon-color-subdued);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
&:disabled {
|
|
307
|
+
background-color: var(--tt-button-disabled-bg-color);
|
|
308
|
+
color: var(--tt-button-disabled-text-color);
|
|
309
|
+
|
|
310
|
+
.tiptap-button-icon {
|
|
311
|
+
color: var(--tt-button-disabled-icon-color);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { Fragment, forwardRef, useMemo } from 'react'
|
|
4
|
+
// --- Lib ---
|
|
5
|
+
import { cn, parseShortcutKeys } from '../../lib/tiptap-utils'
|
|
6
|
+
// --- Tiptap UI Primitive ---
|
|
7
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from '../tooltip'
|
|
8
|
+
|
|
9
|
+
import './button-colors.scss'
|
|
10
|
+
import './button-group.scss'
|
|
11
|
+
import './button.scss'
|
|
12
|
+
|
|
13
|
+
export type ButtonVariant = 'ghost' | 'primary'
|
|
14
|
+
export type ButtonSize = 'small' | 'default' | 'large'
|
|
15
|
+
|
|
16
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
17
|
+
showTooltip?: boolean
|
|
18
|
+
tooltip?: React.ReactNode
|
|
19
|
+
shortcutKeys?: string
|
|
20
|
+
variant?: ButtonVariant
|
|
21
|
+
size?: ButtonSize
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const ShortcutDisplay: React.FC<{ shortcuts: string[] }> = ({ shortcuts }) => {
|
|
25
|
+
if (shortcuts.length === 0) return null
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<div>
|
|
29
|
+
{shortcuts.map((key, index) => (
|
|
30
|
+
<Fragment key={index}>
|
|
31
|
+
{index > 0 && <kbd>+</kbd>}
|
|
32
|
+
<kbd>{key}</kbd>
|
|
33
|
+
</Fragment>
|
|
34
|
+
))}
|
|
35
|
+
</div>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
|
40
|
+
(
|
|
41
|
+
{ className, children, tooltip, showTooltip = true, shortcutKeys, variant, size, ...props },
|
|
42
|
+
ref
|
|
43
|
+
) => {
|
|
44
|
+
const shortcuts = useMemo<string[]>(() => parseShortcutKeys({ shortcutKeys }), [shortcutKeys])
|
|
45
|
+
|
|
46
|
+
if (!tooltip || !showTooltip) {
|
|
47
|
+
return (
|
|
48
|
+
<button
|
|
49
|
+
className={cn('tiptap-button', className)}
|
|
50
|
+
ref={ref}
|
|
51
|
+
data-style={variant}
|
|
52
|
+
data-size={size}
|
|
53
|
+
{...props}
|
|
54
|
+
>
|
|
55
|
+
{children}
|
|
56
|
+
</button>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<Tooltip delay={200}>
|
|
62
|
+
<TooltipTrigger
|
|
63
|
+
className={cn('tiptap-button', className)}
|
|
64
|
+
ref={ref}
|
|
65
|
+
data-style={variant}
|
|
66
|
+
data-size={size}
|
|
67
|
+
{...props}
|
|
68
|
+
>
|
|
69
|
+
{children}
|
|
70
|
+
</TooltipTrigger>
|
|
71
|
+
<TooltipContent>
|
|
72
|
+
{tooltip}
|
|
73
|
+
<ShortcutDisplay shortcuts={shortcuts} />
|
|
74
|
+
</TooltipContent>
|
|
75
|
+
</Tooltip>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
Button.displayName = 'Button'
|
|
81
|
+
|
|
82
|
+
export const ButtonGroup = forwardRef<
|
|
83
|
+
HTMLDivElement,
|
|
84
|
+
React.ComponentProps<'div'> & {
|
|
85
|
+
orientation?: 'horizontal' | 'vertical'
|
|
86
|
+
}
|
|
87
|
+
>(({ className, children, orientation = 'vertical', ...props }, ref) => {
|
|
88
|
+
return (
|
|
89
|
+
<div
|
|
90
|
+
ref={ref}
|
|
91
|
+
className={cn('tiptap-button-group', className)}
|
|
92
|
+
data-orientation={orientation}
|
|
93
|
+
role="group"
|
|
94
|
+
{...props}
|
|
95
|
+
>
|
|
96
|
+
{children}
|
|
97
|
+
</div>
|
|
98
|
+
)
|
|
99
|
+
})
|
|
100
|
+
ButtonGroup.displayName = 'ButtonGroup'
|
|
101
|
+
|
|
102
|
+
export default Button
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './button'
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--tiptap-card-bg-color: var(--white);
|
|
3
|
+
--tiptap-card-border-color: var(--tt-gray-light-a-100);
|
|
4
|
+
--tiptap-card-group-label-color: var(--tt-gray-light-a-800);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.dark {
|
|
8
|
+
--tiptap-card-bg-color: var(--tt-gray-dark-50);
|
|
9
|
+
--tiptap-card-border-color: var(--tt-gray-dark-a-100);
|
|
10
|
+
--tiptap-card-group-label-color: var(--tt-gray-dark-a-800);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.tiptap-card {
|
|
14
|
+
--padding: 0.375rem;
|
|
15
|
+
--border-width: 1px;
|
|
16
|
+
|
|
17
|
+
border-radius: calc(var(--padding) + var(--tt-radius-lg));
|
|
18
|
+
box-shadow: var(--tt-shadow-elevated-md);
|
|
19
|
+
background-color: var(--tiptap-card-bg-color);
|
|
20
|
+
border: 1px solid var(--tiptap-card-border-color);
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
outline: none;
|
|
24
|
+
align-items: center;
|
|
25
|
+
|
|
26
|
+
position: relative;
|
|
27
|
+
min-width: 0;
|
|
28
|
+
word-wrap: break-word;
|
|
29
|
+
background-clip: border-box;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.tiptap-card-header {
|
|
33
|
+
padding: 0.375rem;
|
|
34
|
+
flex: 0 0 auto;
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
justify-content: space-between;
|
|
38
|
+
width: 100%;
|
|
39
|
+
border-bottom: var(--border-width) solid var(--tiptap-card-border-color);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.tiptap-card-body {
|
|
43
|
+
padding: 0.375rem;
|
|
44
|
+
flex: 1 1 auto;
|
|
45
|
+
overflow-y: auto;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.tiptap-card-item-group {
|
|
49
|
+
position: relative;
|
|
50
|
+
display: flex;
|
|
51
|
+
vertical-align: middle;
|
|
52
|
+
min-width: max-content;
|
|
53
|
+
|
|
54
|
+
&[data-orientation="vertical"] {
|
|
55
|
+
flex-direction: column;
|
|
56
|
+
justify-content: center;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&[data-orientation="horizontal"] {
|
|
60
|
+
gap: 0.25rem;
|
|
61
|
+
flex-direction: row;
|
|
62
|
+
align-items: center;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.tiptap-card-group-label {
|
|
67
|
+
padding-top: 0.75rem;
|
|
68
|
+
padding-left: 0.5rem;
|
|
69
|
+
padding-right: 0.5rem;
|
|
70
|
+
padding-bottom: 0.25rem;
|
|
71
|
+
line-height: normal;
|
|
72
|
+
font-size: 0.75rem;
|
|
73
|
+
font-weight: 600;
|
|
74
|
+
line-height: normal;
|
|
75
|
+
text-transform: capitalize;
|
|
76
|
+
color: var(--tiptap-card-group-label-color);
|
|
77
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { forwardRef } from 'react'
|
|
4
|
+
import { cn } from '../../lib/tiptap-utils'
|
|
5
|
+
import './card.scss'
|
|
6
|
+
|
|
7
|
+
const Card = forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(
|
|
8
|
+
({ className, ...props }, ref) => {
|
|
9
|
+
return <div ref={ref} className={cn('tiptap-card', className)} {...props} />
|
|
10
|
+
}
|
|
11
|
+
)
|
|
12
|
+
Card.displayName = 'Card'
|
|
13
|
+
|
|
14
|
+
const CardHeader = forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(
|
|
15
|
+
({ className, ...props }, ref) => {
|
|
16
|
+
return <div ref={ref} className={cn('tiptap-card-header', className)} {...props} />
|
|
17
|
+
}
|
|
18
|
+
)
|
|
19
|
+
CardHeader.displayName = 'CardHeader'
|
|
20
|
+
|
|
21
|
+
const CardBody = forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(
|
|
22
|
+
({ className, ...props }, ref) => {
|
|
23
|
+
return <div ref={ref} className={cn('tiptap-card-body', className)} {...props} />
|
|
24
|
+
}
|
|
25
|
+
)
|
|
26
|
+
CardBody.displayName = 'CardBody'
|
|
27
|
+
|
|
28
|
+
const CardItemGroup = forwardRef<
|
|
29
|
+
HTMLDivElement,
|
|
30
|
+
React.ComponentProps<'div'> & {
|
|
31
|
+
orientation?: 'horizontal' | 'vertical'
|
|
32
|
+
}
|
|
33
|
+
>(({ className, orientation = 'vertical', ...props }, ref) => {
|
|
34
|
+
return (
|
|
35
|
+
<div
|
|
36
|
+
ref={ref}
|
|
37
|
+
data-orientation={orientation}
|
|
38
|
+
className={cn('tiptap-card-item-group', className)}
|
|
39
|
+
{...props}
|
|
40
|
+
/>
|
|
41
|
+
)
|
|
42
|
+
})
|
|
43
|
+
CardItemGroup.displayName = 'CardItemGroup'
|
|
44
|
+
|
|
45
|
+
const CardGroupLabel = forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(
|
|
46
|
+
({ className, ...props }, ref) => {
|
|
47
|
+
return <div ref={ref} className={cn('tiptap-card-group-label', className)} {...props} />
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
CardGroupLabel.displayName = 'CardGroupLabel'
|
|
51
|
+
|
|
52
|
+
const CardFooter = forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(
|
|
53
|
+
({ className, ...props }, ref) => {
|
|
54
|
+
return <div ref={ref} className={cn('tiptap-card-footer', className)} {...props} />
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
CardFooter.displayName = 'CardFooter'
|
|
58
|
+
|
|
59
|
+
export { Card, CardHeader, CardFooter, CardBody, CardItemGroup, CardGroupLabel }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './card'
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
.tiptap-dropdown-menu {
|
|
2
|
+
--tt-dropdown-menu-bg-color: var(--white);
|
|
3
|
+
--tt-dropdown-menu-border-color: var(--tt-gray-light-a-100);
|
|
4
|
+
--tt-dropdown-menu-text-color: var(--tt-gray-light-a-600);
|
|
5
|
+
|
|
6
|
+
.dark & {
|
|
7
|
+
--tt-dropdown-menu-border-color: var(--tt-gray-dark-a-50);
|
|
8
|
+
--tt-dropdown-menu-bg-color: var(--tt-gray-dark-50);
|
|
9
|
+
--tt-dropdown-menu-text-color: var(--tt-gray-dark-a-600);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/* --------------------------------------------
|
|
14
|
+
--------- DROPDOWN MENU STYLING SETTINGS -----------
|
|
15
|
+
-------------------------------------------- */
|
|
16
|
+
.tiptap-dropdown-menu {
|
|
17
|
+
z-index: 50;
|
|
18
|
+
outline: none;
|
|
19
|
+
transform-origin: var(--radix-dropdown-menu-content-transform-origin);
|
|
20
|
+
max-height: var(--radix-dropdown-menu-content-available-height);
|
|
21
|
+
|
|
22
|
+
> * {
|
|
23
|
+
max-height: var(--radix-dropdown-menu-content-available-height);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* Animation states */
|
|
27
|
+
&[data-state="open"] {
|
|
28
|
+
animation:
|
|
29
|
+
fadeIn 150ms cubic-bezier(0.16, 1, 0.3, 1),
|
|
30
|
+
zoomIn 150ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&[data-state="closed"] {
|
|
34
|
+
animation:
|
|
35
|
+
fadeOut 150ms cubic-bezier(0.16, 1, 0.3, 1),
|
|
36
|
+
zoomOut 150ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* Position-based animations */
|
|
40
|
+
&[data-side="top"],
|
|
41
|
+
&[data-side="top-start"],
|
|
42
|
+
&[data-side="top-end"] {
|
|
43
|
+
animation: slideFromBottom 150ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&[data-side="right"],
|
|
47
|
+
&[data-side="right-start"],
|
|
48
|
+
&[data-side="right-end"] {
|
|
49
|
+
animation: slideFromLeft 150ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&[data-side="bottom"],
|
|
53
|
+
&[data-side="bottom-start"],
|
|
54
|
+
&[data-side="bottom-end"] {
|
|
55
|
+
animation: slideFromTop 150ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
&[data-side="left"],
|
|
59
|
+
&[data-side="left-start"],
|
|
60
|
+
&[data-side="left-end"] {
|
|
61
|
+
animation: slideFromRight 150ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
62
|
+
}
|
|
63
|
+
}
|