create-starlight-cms 0.9.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/LICENSE +21 -0
- package/README.md +18 -0
- package/THIRD_PARTY_NOTICES.md +4 -0
- package/bin/index.js +147 -0
- package/package.json +46 -0
- package/template/.nvmrc +1 -0
- package/template/LICENSE +21 -0
- package/template/README.md +68 -0
- package/template/THIRD_PARTY_NOTICES.md +12 -0
- package/template/_gitignore +14 -0
- package/template/astro.config.mjs +26 -0
- package/template/migrations/0001_schema.sql +73 -0
- package/template/migrations/0002_publish_delivery.sql +16 -0
- package/template/package-lock.json.template +9123 -0
- package/template/package.json +89 -0
- package/template/scripts/build-admin.mjs +38 -0
- package/template/scripts/check-linux-bindings.mjs +18 -0
- package/template/scripts/dev.mjs +94 -0
- package/template/src/admin/admin.scss +182 -0
- package/template/src/admin/app.ts +130 -0
- package/template/src/admin/client.tsx +684 -0
- package/template/src/admin/components/tiptap-extension/node-background-extension.ts +150 -0
- package/template/src/admin/components/tiptap-icons/align-center-icon.tsx +38 -0
- package/template/src/admin/components/tiptap-icons/align-justify-icon.tsx +38 -0
- package/template/src/admin/components/tiptap-icons/align-left-icon.tsx +38 -0
- package/template/src/admin/components/tiptap-icons/align-right-icon.tsx +38 -0
- package/template/src/admin/components/tiptap-icons/arrow-left-icon.tsx +24 -0
- package/template/src/admin/components/tiptap-icons/arrow-right-icon.tsx +26 -0
- package/template/src/admin/components/tiptap-icons/ban-icon.tsx +26 -0
- package/template/src/admin/components/tiptap-icons/blockquote-icon.tsx +44 -0
- package/template/src/admin/components/tiptap-icons/bold-icon.tsx +26 -0
- package/template/src/admin/components/tiptap-icons/case-sensitive-icon.tsx +32 -0
- package/template/src/admin/components/tiptap-icons/check-icon.tsx +26 -0
- package/template/src/admin/components/tiptap-icons/chevron-down-icon.tsx +26 -0
- package/template/src/admin/components/tiptap-icons/chevron-up-icon.tsx +22 -0
- package/template/src/admin/components/tiptap-icons/close-icon.tsx +24 -0
- package/template/src/admin/components/tiptap-icons/code-block-icon.tsx +38 -0
- package/template/src/admin/components/tiptap-icons/code2-icon.tsx +32 -0
- package/template/src/admin/components/tiptap-icons/corner-down-left-icon.tsx +26 -0
- package/template/src/admin/components/tiptap-icons/external-link-icon.tsx +28 -0
- package/template/src/admin/components/tiptap-icons/heading-five-icon.tsx +28 -0
- package/template/src/admin/components/tiptap-icons/heading-four-icon.tsx +28 -0
- package/template/src/admin/components/tiptap-icons/heading-icon.tsx +24 -0
- package/template/src/admin/components/tiptap-icons/heading-one-icon.tsx +28 -0
- package/template/src/admin/components/tiptap-icons/heading-six-icon.tsx +30 -0
- package/template/src/admin/components/tiptap-icons/heading-three-icon.tsx +36 -0
- package/template/src/admin/components/tiptap-icons/heading-two-icon.tsx +28 -0
- package/template/src/admin/components/tiptap-icons/highlighter-icon.tsx +26 -0
- package/template/src/admin/components/tiptap-icons/image-plus-icon.tsx +26 -0
- package/template/src/admin/components/tiptap-icons/italic-icon.tsx +24 -0
- package/template/src/admin/components/tiptap-icons/link-icon.tsx +28 -0
- package/template/src/admin/components/tiptap-icons/list-icon.tsx +56 -0
- package/template/src/admin/components/tiptap-icons/list-ordered-icon.tsx +56 -0
- package/template/src/admin/components/tiptap-icons/list-todo-icon.tsx +50 -0
- package/template/src/admin/components/tiptap-icons/moon-star-icon.tsx +30 -0
- package/template/src/admin/components/tiptap-icons/redo2-icon.tsx +26 -0
- package/template/src/admin/components/tiptap-icons/search-icon.tsx +26 -0
- package/template/src/admin/components/tiptap-icons/strike-icon.tsx +28 -0
- package/template/src/admin/components/tiptap-icons/subscript-icon.tsx +38 -0
- package/template/src/admin/components/tiptap-icons/sun-icon.tsx +58 -0
- package/template/src/admin/components/tiptap-icons/superscript-icon.tsx +38 -0
- package/template/src/admin/components/tiptap-icons/trash-icon.tsx +26 -0
- package/template/src/admin/components/tiptap-icons/underline-icon.tsx +26 -0
- package/template/src/admin/components/tiptap-icons/undo2-icon.tsx +26 -0
- package/template/src/admin/components/tiptap-icons/whole-word-icon.tsx +36 -0
- package/template/src/admin/components/tiptap-node/blockquote-node/blockquote-node.scss +37 -0
- package/template/src/admin/components/tiptap-node/code-block-node/code-block-node.scss +54 -0
- package/template/src/admin/components/tiptap-node/heading-node/heading-node.scss +45 -0
- package/template/src/admin/components/tiptap-node/horizontal-rule-node/horizontal-rule-node-extension.ts +14 -0
- package/template/src/admin/components/tiptap-node/horizontal-rule-node/horizontal-rule-node.scss +25 -0
- package/template/src/admin/components/tiptap-node/image-node/image-node.scss +35 -0
- package/template/src/admin/components/tiptap-node/image-upload-node/image-upload-node-extension.ts +161 -0
- package/template/src/admin/components/tiptap-node/image-upload-node/image-upload-node.scss +249 -0
- package/template/src/admin/components/tiptap-node/image-upload-node/image-upload-node.tsx +554 -0
- package/template/src/admin/components/tiptap-node/image-upload-node/index.tsx +1 -0
- package/template/src/admin/components/tiptap-node/list-node/list-node.scss +208 -0
- package/template/src/admin/components/tiptap-node/paragraph-node/paragraph-node.scss +217 -0
- package/template/src/admin/components/tiptap-templates/simple/NOTICE.md +14 -0
- package/template/src/admin/components/tiptap-templates/simple/data/content.json +477 -0
- package/template/src/admin/components/tiptap-templates/simple/simple-editor.scss +97 -0
- package/template/src/admin/components/tiptap-templates/simple/simple-editor.tsx +348 -0
- package/template/src/admin/components/tiptap-templates/simple/theme-toggle.tsx +44 -0
- package/template/src/admin/components/tiptap-ui/blockquote-button/blockquote-button.tsx +122 -0
- package/template/src/admin/components/tiptap-ui/blockquote-button/index.tsx +2 -0
- package/template/src/admin/components/tiptap-ui/blockquote-button/use-blockquote.ts +273 -0
- package/template/src/admin/components/tiptap-ui/code-block-button/code-block-button.tsx +122 -0
- package/template/src/admin/components/tiptap-ui/code-block-button/index.tsx +2 -0
- package/template/src/admin/components/tiptap-ui/code-block-button/use-code-block.ts +283 -0
- package/template/src/admin/components/tiptap-ui/color-highlight-button/color-highlight-button.scss +49 -0
- package/template/src/admin/components/tiptap-ui/color-highlight-button/color-highlight-button.tsx +170 -0
- package/template/src/admin/components/tiptap-ui/color-highlight-button/index.tsx +2 -0
- package/template/src/admin/components/tiptap-ui/color-highlight-button/use-color-highlight.ts +380 -0
- package/template/src/admin/components/tiptap-ui/color-highlight-popover/color-highlight-popover.tsx +231 -0
- package/template/src/admin/components/tiptap-ui/color-highlight-popover/index.tsx +1 -0
- package/template/src/admin/components/tiptap-ui/heading-button/heading-button.tsx +124 -0
- package/template/src/admin/components/tiptap-ui/heading-button/index.tsx +2 -0
- package/template/src/admin/components/tiptap-ui/heading-button/use-heading.ts +348 -0
- package/template/src/admin/components/tiptap-ui/heading-dropdown-menu/heading-dropdown-menu.tsx +128 -0
- package/template/src/admin/components/tiptap-ui/heading-dropdown-menu/index.tsx +2 -0
- package/template/src/admin/components/tiptap-ui/heading-dropdown-menu/use-heading-dropdown-menu.ts +132 -0
- package/template/src/admin/components/tiptap-ui/image-upload-button/image-upload-button.tsx +130 -0
- package/template/src/admin/components/tiptap-ui/image-upload-button/index.tsx +2 -0
- package/template/src/admin/components/tiptap-ui/image-upload-button/use-image-upload.ts +197 -0
- package/template/src/admin/components/tiptap-ui/link-popover/index.tsx +2 -0
- package/template/src/admin/components/tiptap-ui/link-popover/link-popover.scss +16 -0
- package/template/src/admin/components/tiptap-ui/link-popover/link-popover.tsx +315 -0
- package/template/src/admin/components/tiptap-ui/link-popover/use-link-popover.ts +297 -0
- package/template/src/admin/components/tiptap-ui/list-button/index.tsx +2 -0
- package/template/src/admin/components/tiptap-ui/list-button/list-button.tsx +120 -0
- package/template/src/admin/components/tiptap-ui/list-button/use-list.ts +353 -0
- package/template/src/admin/components/tiptap-ui/list-dropdown-menu/index.tsx +2 -0
- package/template/src/admin/components/tiptap-ui/list-dropdown-menu/list-dropdown-menu.tsx +126 -0
- package/template/src/admin/components/tiptap-ui/list-dropdown-menu/use-list-dropdown-menu.ts +220 -0
- package/template/src/admin/components/tiptap-ui/mark-button/index.tsx +2 -0
- package/template/src/admin/components/tiptap-ui/mark-button/mark-button.tsx +122 -0
- package/template/src/admin/components/tiptap-ui/mark-button/use-mark.ts +219 -0
- package/template/src/admin/components/tiptap-ui/search-and-replace/index.tsx +2 -0
- package/template/src/admin/components/tiptap-ui/search-and-replace/search-and-replace.scss +300 -0
- package/template/src/admin/components/tiptap-ui/search-and-replace/search-and-replace.tsx +718 -0
- package/template/src/admin/components/tiptap-ui/search-and-replace/use-search-and-replace.ts +528 -0
- package/template/src/admin/components/tiptap-ui/text-align-button/index.tsx +2 -0
- package/template/src/admin/components/tiptap-ui/text-align-button/text-align-button.tsx +144 -0
- package/template/src/admin/components/tiptap-ui/text-align-button/use-text-align.ts +237 -0
- package/template/src/admin/components/tiptap-ui/undo-redo-button/index.tsx +2 -0
- package/template/src/admin/components/tiptap-ui/undo-redo-button/undo-redo-button.tsx +125 -0
- package/template/src/admin/components/tiptap-ui/undo-redo-button/use-undo-redo.ts +200 -0
- package/template/src/admin/components/tiptap-ui-primitive/badge/badge-colors.scss +395 -0
- package/template/src/admin/components/tiptap-ui-primitive/badge/badge-group.scss +16 -0
- package/template/src/admin/components/tiptap-ui-primitive/badge/badge.scss +99 -0
- package/template/src/admin/components/tiptap-ui-primitive/badge/badge.tsx +44 -0
- package/template/src/admin/components/tiptap-ui-primitive/badge/index.tsx +1 -0
- package/template/src/admin/components/tiptap-ui-primitive/button/button-colors.scss +613 -0
- package/template/src/admin/components/tiptap-ui-primitive/button/button.scss +390 -0
- package/template/src/admin/components/tiptap-ui-primitive/button/button.tsx +158 -0
- package/template/src/admin/components/tiptap-ui-primitive/button/index.tsx +1 -0
- package/template/src/admin/components/tiptap-ui-primitive/button-group/button-group.scss +89 -0
- package/template/src/admin/components/tiptap-ui-primitive/button-group/button-group.tsx +72 -0
- package/template/src/admin/components/tiptap-ui-primitive/button-group/index.tsx +1 -0
- package/template/src/admin/components/tiptap-ui-primitive/card/card.scss +74 -0
- package/template/src/admin/components/tiptap-ui-primitive/card/card.tsx +79 -0
- package/template/src/admin/components/tiptap-ui-primitive/card/index.tsx +1 -0
- package/template/src/admin/components/tiptap-ui-primitive/dropdown-menu/dropdown-menu.scss +152 -0
- package/template/src/admin/components/tiptap-ui-primitive/dropdown-menu/dropdown-menu.tsx +262 -0
- package/template/src/admin/components/tiptap-ui-primitive/dropdown-menu/index.tsx +1 -0
- package/template/src/admin/components/tiptap-ui-primitive/input/index.tsx +1 -0
- package/template/src/admin/components/tiptap-ui-primitive/input/input.scss +41 -0
- package/template/src/admin/components/tiptap-ui-primitive/input/input.tsx +22 -0
- package/template/src/admin/components/tiptap-ui-primitive/input-group/index.tsx +1 -0
- package/template/src/admin/components/tiptap-ui-primitive/input-group/input-group.scss +225 -0
- package/template/src/admin/components/tiptap-ui-primitive/input-group/input-group.tsx +135 -0
- package/template/src/admin/components/tiptap-ui-primitive/popover/index.tsx +1 -0
- package/template/src/admin/components/tiptap-ui-primitive/popover/popover.scss +64 -0
- package/template/src/admin/components/tiptap-ui-primitive/popover/popover.tsx +35 -0
- package/template/src/admin/components/tiptap-ui-primitive/separator/index.tsx +1 -0
- package/template/src/admin/components/tiptap-ui-primitive/separator/separator.scss +23 -0
- package/template/src/admin/components/tiptap-ui-primitive/separator/separator.tsx +28 -0
- package/template/src/admin/components/tiptap-ui-primitive/spacer/index.tsx +1 -0
- package/template/src/admin/components/tiptap-ui-primitive/spacer/spacer.tsx +24 -0
- package/template/src/admin/components/tiptap-ui-primitive/switch/index.tsx +1 -0
- package/template/src/admin/components/tiptap-ui-primitive/switch/switch.scss +86 -0
- package/template/src/admin/components/tiptap-ui-primitive/switch/switch.tsx +29 -0
- package/template/src/admin/components/tiptap-ui-primitive/textarea/index.tsx +1 -0
- package/template/src/admin/components/tiptap-ui-primitive/textarea/textarea.scss +42 -0
- package/template/src/admin/components/tiptap-ui-primitive/textarea/textarea.tsx +16 -0
- package/template/src/admin/components/tiptap-ui-primitive/toolbar/index.tsx +1 -0
- package/template/src/admin/components/tiptap-ui-primitive/toolbar/toolbar.scss +98 -0
- package/template/src/admin/components/tiptap-ui-primitive/toolbar/toolbar.tsx +203 -0
- package/template/src/admin/components/tiptap-ui-primitive/tooltip/index.tsx +1 -0
- package/template/src/admin/components/tiptap-ui-primitive/tooltip/tooltip.scss +43 -0
- package/template/src/admin/components/tiptap-ui-primitive/tooltip/tooltip.tsx +241 -0
- package/template/src/admin/hooks/use-composed-ref.ts +46 -0
- package/template/src/admin/hooks/use-cursor-visibility.ts +69 -0
- package/template/src/admin/hooks/use-element-rect.ts +166 -0
- package/template/src/admin/hooks/use-is-breakpoint.ts +35 -0
- package/template/src/admin/hooks/use-menu-navigation.ts +204 -0
- package/template/src/admin/hooks/use-scrolling.ts +75 -0
- package/template/src/admin/hooks/use-throttled-callback.ts +48 -0
- package/template/src/admin/hooks/use-tiptap-editor.ts +69 -0
- package/template/src/admin/hooks/use-unmount.ts +21 -0
- package/template/src/admin/hooks/use-window-size.ts +93 -0
- package/template/src/admin/html.ts +17 -0
- package/template/src/admin/lib/tiptap-utils.ts +652 -0
- package/template/src/admin/navigation-tree.tsx +82 -0
- package/template/src/admin/preview.ts +73 -0
- package/template/src/admin/styles/_cms-theme.scss +58 -0
- package/template/src/admin/styles/_keyframe-animations.scss +91 -0
- package/template/src/admin/styles/_variables.scss +298 -0
- package/template/src/assets/favicon.svg +1 -0
- package/template/src/assets/logo.svg +1 -0
- package/template/src/astro-env.d.ts +1 -0
- package/template/src/content.config.ts +12 -0
- package/template/src/db/bootstrap.ts +36 -0
- package/template/src/db/client.ts +7 -0
- package/template/src/db/schema.ts +45 -0
- package/template/src/documents/service.ts +178 -0
- package/template/src/documents/validation.ts +9 -0
- package/template/src/env.ts +9 -0
- package/template/src/index.ts +10 -0
- package/template/src/locales.ts +10 -0
- package/template/src/media/service.ts +120 -0
- package/template/src/navigation/service.ts +171 -0
- package/template/src/pages/[locale]/cms-preview-shell.astro +12 -0
- package/template/src/pages/cms-preview-shell.astro +5 -0
- package/template/src/publish/deploy-hook.ts +42 -0
- package/template/src/publish/record.ts +20 -0
- package/template/src/publish/service.ts +135 -0
- package/template/src/scss.d.ts +5 -0
- package/template/src/site.config.ts +7 -0
- package/template/src/sql.d.ts +4 -0
- package/template/src/starlight/cms-origin.ts +4 -0
- package/template/src/starlight/loader.ts +21 -0
- package/template/src/starlight/preview-render.ts +162 -0
- package/template/src/starlight/preview-shell.astro +14 -0
- package/template/src/starlight/render.ts +59 -0
- package/template/src/starlight/schema.ts +34 -0
- package/template/src/starlight/sidebar.ts +35 -0
- package/template/src/starlight/snapshot.ts +47 -0
- package/template/src/starlight/source.ts +26 -0
- package/template/src/starlight/tiptap.ts +29 -0
- package/template/src/styles/starlight.css +12 -0
- package/template/test-files/content.test.template.ts +82 -0
- package/template/test-files/deploy-hook.test.template.ts +32 -0
- package/template/test-files/media.test.template.ts +39 -0
- package/template/test-files/publishing.integration.test.template.ts +156 -0
- package/template/tsconfig.admin.json +18 -0
- package/template/tsconfig.json +23 -0
- package/template/worker-configuration.d.ts +15389 -0
- package/template/wrangler.jsonc +26 -0
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--tt-ig-placeholder: var(--tt-gray-light-a-400);
|
|
3
|
+
--tt-ig-border: var(--tt-gray-light-a-200);
|
|
4
|
+
--tt-ig-border-focus: var(--tt-gray-light-a-300);
|
|
5
|
+
--tt-ig-addon-color: var(--tt-gray-light-a-400);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.dark {
|
|
9
|
+
--tt-ig-placeholder: var(--tt-gray-dark-a-400);
|
|
10
|
+
--tt-ig-border: var(--tt-gray-dark-a-200);
|
|
11
|
+
--tt-ig-border-focus: var(--tt-gray-dark-a-300);
|
|
12
|
+
--tt-ig-addon-color: var(--tt-gray-dark-a-400);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/* ── InputGroup ─────────────────────────────────────────────── */
|
|
16
|
+
.tiptap-input-group {
|
|
17
|
+
position: relative;
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
width: 100%;
|
|
21
|
+
min-width: 0;
|
|
22
|
+
height: 2rem;
|
|
23
|
+
border: 1px solid var(--tt-ig-border);
|
|
24
|
+
border-radius: 0.5rem;
|
|
25
|
+
background-color: transparent;
|
|
26
|
+
outline: none;
|
|
27
|
+
transition:
|
|
28
|
+
color,
|
|
29
|
+
background-color,
|
|
30
|
+
border-color 150ms;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* Height overrides */
|
|
34
|
+
.tiptap-input-group:has(> textarea),
|
|
35
|
+
.tiptap-input-group:has(> [data-align="block-end"]),
|
|
36
|
+
.tiptap-input-group:has(> [data-align="block-start"]) {
|
|
37
|
+
height: auto;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* Column layout for block-aligned addons */
|
|
41
|
+
.tiptap-input-group:has(> [data-align="block-end"]),
|
|
42
|
+
.tiptap-input-group:has(> [data-align="block-start"]) {
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* Inner input padding when addons are present */
|
|
47
|
+
.tiptap-input-group:has(> [data-align="inline-end"]) > input {
|
|
48
|
+
padding-right: 0.375rem;
|
|
49
|
+
}
|
|
50
|
+
.tiptap-input-group:has(> [data-align="inline-start"]) > input {
|
|
51
|
+
padding-left: 0.375rem;
|
|
52
|
+
}
|
|
53
|
+
.tiptap-input-group:has(> [data-align="block-end"]) > input {
|
|
54
|
+
padding-top: 0.75rem;
|
|
55
|
+
}
|
|
56
|
+
.tiptap-input-group:has(> [data-align="block-start"]) > input {
|
|
57
|
+
padding-bottom: 0.75rem;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* Focus */
|
|
61
|
+
.tiptap-input-group:has(
|
|
62
|
+
[data-slot="tiptap-input-group-control"]:focus-visible
|
|
63
|
+
) {
|
|
64
|
+
border-color: var(--tt-ig-border-focus);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/* Combobox override */
|
|
68
|
+
[data-slot="combobox-content"] .tiptap-input-group:focus-within {
|
|
69
|
+
border-color: inherit;
|
|
70
|
+
box-shadow: none;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* ── InputGroupAddon ────────────────────────────────────────── */
|
|
74
|
+
.tiptap-input-group-addon {
|
|
75
|
+
display: flex;
|
|
76
|
+
align-items: center;
|
|
77
|
+
justify-content: center;
|
|
78
|
+
height: auto;
|
|
79
|
+
gap: 0.5rem;
|
|
80
|
+
padding: 0.375rem 0;
|
|
81
|
+
font-size: 0.875rem;
|
|
82
|
+
font-weight: 500;
|
|
83
|
+
color: var(--tt-ig-addon-color);
|
|
84
|
+
cursor: text;
|
|
85
|
+
user-select: none;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.tiptap-input-group-addon > svg:not([class*="size-"]) {
|
|
89
|
+
width: 1rem;
|
|
90
|
+
height: 1rem;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.tiptap-input-group-addon > kbd {
|
|
94
|
+
border-radius: calc(9999px - 5px);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.tiptap-input-group[data-disabled="true"] .tiptap-input-group-addon {
|
|
98
|
+
opacity: 0.5;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/* Inline-start */
|
|
102
|
+
.tiptap-input-group-addon--inline-start {
|
|
103
|
+
order: -1;
|
|
104
|
+
padding-left: 0.5rem;
|
|
105
|
+
}
|
|
106
|
+
.tiptap-input-group-addon--inline-start:has(> button) {
|
|
107
|
+
margin-left: -0.3rem;
|
|
108
|
+
}
|
|
109
|
+
.tiptap-input-group-addon--inline-start:has(> kbd) {
|
|
110
|
+
margin-left: -0.15rem;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* Inline-end */
|
|
114
|
+
.tiptap-input-group-addon--inline-end {
|
|
115
|
+
order: 9999;
|
|
116
|
+
padding-right: 0.5rem;
|
|
117
|
+
}
|
|
118
|
+
.tiptap-input-group-addon--inline-end:has(> button) {
|
|
119
|
+
margin-right: -0.3rem;
|
|
120
|
+
}
|
|
121
|
+
.tiptap-input-group-addon--inline-end:has(> kbd) {
|
|
122
|
+
margin-right: -0.15rem;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/* Block-start */
|
|
126
|
+
.tiptap-input-group-addon--block-start {
|
|
127
|
+
order: -1;
|
|
128
|
+
width: 100%;
|
|
129
|
+
justify-content: flex-start;
|
|
130
|
+
padding: 0.5rem 0.625rem 0;
|
|
131
|
+
}
|
|
132
|
+
.tiptap-input-group-addon--block-start .border-b {
|
|
133
|
+
padding-bottom: 0.5rem;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/* Block-end */
|
|
137
|
+
.tiptap-input-group-addon--block-end {
|
|
138
|
+
order: 9999;
|
|
139
|
+
width: 100%;
|
|
140
|
+
justify-content: flex-start;
|
|
141
|
+
padding: 0 0.625rem 0.5rem;
|
|
142
|
+
}
|
|
143
|
+
.tiptap-input-group-addon--block-end .border-t {
|
|
144
|
+
padding-top: 0.5rem;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/* ── InputGroupButton ───────────────────────────────────────── */
|
|
148
|
+
.tiptap-input-group-button {
|
|
149
|
+
display: flex;
|
|
150
|
+
align-items: center;
|
|
151
|
+
gap: 0.5rem;
|
|
152
|
+
font-size: 0.875rem;
|
|
153
|
+
box-shadow: none;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.tiptap-input-group-button--xs {
|
|
157
|
+
height: 1.5rem;
|
|
158
|
+
gap: 0.25rem;
|
|
159
|
+
border-radius: calc(9999px - 3px);
|
|
160
|
+
padding: 0 0.375rem;
|
|
161
|
+
}
|
|
162
|
+
.tiptap-input-group-button--xs > svg:not([class*="size-"]) {
|
|
163
|
+
width: 0.875rem;
|
|
164
|
+
height: 0.875rem;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.tiptap-input-group-button--icon-xs {
|
|
168
|
+
width: 1.5rem;
|
|
169
|
+
height: 1.5rem;
|
|
170
|
+
min-width: auto;
|
|
171
|
+
border-radius: calc(9999px - 3px);
|
|
172
|
+
padding: 0;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.tiptap-input-group-button--icon-sm {
|
|
176
|
+
width: 2rem;
|
|
177
|
+
height: 2rem;
|
|
178
|
+
padding: 0;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/* ── InputGroupText ─────────────────────────────────────────── */
|
|
182
|
+
.tiptap-input-group-text {
|
|
183
|
+
display: flex;
|
|
184
|
+
align-items: center;
|
|
185
|
+
gap: 0.5rem;
|
|
186
|
+
font-size: 0.875rem;
|
|
187
|
+
color: var(--tt-ig-addon-color);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.tiptap-input-group-text svg:not([class*="size-"]) {
|
|
191
|
+
width: 1rem;
|
|
192
|
+
height: 1rem;
|
|
193
|
+
}
|
|
194
|
+
.tiptap-input-group-text svg {
|
|
195
|
+
pointer-events: none;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/* ── InputGroupControl ──────────────────────────────────────── */
|
|
199
|
+
.tiptap-input-group-control {
|
|
200
|
+
flex: 1;
|
|
201
|
+
border: 0;
|
|
202
|
+
border-radius: 0;
|
|
203
|
+
background: transparent;
|
|
204
|
+
box-shadow: none;
|
|
205
|
+
outline: none;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.tiptap-input-group-control:focus-visible,
|
|
209
|
+
.tiptap-input-group-control[aria-invalid="true"],
|
|
210
|
+
.tiptap-input-group-control:disabled {
|
|
211
|
+
background: transparent;
|
|
212
|
+
box-shadow: none;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
@media (prefers-color-scheme: dark) {
|
|
216
|
+
.tiptap-input-group-control,
|
|
217
|
+
.tiptap-input-group-control:disabled {
|
|
218
|
+
background: transparent;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.tiptap-input-group-control--textarea {
|
|
223
|
+
padding-block: 0.5rem;
|
|
224
|
+
resize: none;
|
|
225
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
3
|
+
|
|
4
|
+
import { cn } from "@/lib/tiptap-utils"
|
|
5
|
+
|
|
6
|
+
import { Input } from "@/components/tiptap-ui-primitive/input"
|
|
7
|
+
import { Button } from "@/components/tiptap-ui-primitive/button"
|
|
8
|
+
import { Textarea } from "@/components/tiptap-ui-primitive/textarea"
|
|
9
|
+
|
|
10
|
+
import "./input-group.scss"
|
|
11
|
+
|
|
12
|
+
function InputGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
13
|
+
return (
|
|
14
|
+
<div
|
|
15
|
+
data-slot="tiptap-input-group"
|
|
16
|
+
role="group"
|
|
17
|
+
className={cn("tiptap-input-group", className)}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const inputGroupAddonVariants = cva("tiptap-input-group-addon", {
|
|
24
|
+
variants: {
|
|
25
|
+
align: {
|
|
26
|
+
"inline-start": "tiptap-input-group-addon--inline-start",
|
|
27
|
+
"inline-end": "tiptap-input-group-addon--inline-end",
|
|
28
|
+
"block-start": "tiptap-input-group-addon--block-start",
|
|
29
|
+
"block-end": "tiptap-input-group-addon--block-end",
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
defaultVariants: {
|
|
33
|
+
align: "inline-start",
|
|
34
|
+
},
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
function InputGroupAddon({
|
|
38
|
+
className,
|
|
39
|
+
align = "inline-start",
|
|
40
|
+
...props
|
|
41
|
+
}: React.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>) {
|
|
42
|
+
return (
|
|
43
|
+
<div
|
|
44
|
+
role="group"
|
|
45
|
+
data-slot="tiptap-input-group-addon"
|
|
46
|
+
data-align={align}
|
|
47
|
+
className={cn(inputGroupAddonVariants({ align }), className)}
|
|
48
|
+
onClick={(e) => {
|
|
49
|
+
if ((e.target as HTMLElement).closest("button")) return
|
|
50
|
+
e.currentTarget.parentElement?.querySelector("input")?.focus()
|
|
51
|
+
}}
|
|
52
|
+
{...props}
|
|
53
|
+
/>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const inputGroupButtonVariants = cva("tiptap-input-group-button", {
|
|
58
|
+
variants: {
|
|
59
|
+
size: {
|
|
60
|
+
xs: "tiptap-input-group-button--xs",
|
|
61
|
+
sm: "tiptap-input-group-button--sm",
|
|
62
|
+
"icon-xs": "tiptap-input-group-button--icon-xs",
|
|
63
|
+
"icon-sm": "tiptap-input-group-button--icon-sm",
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
defaultVariants: {
|
|
67
|
+
size: "xs",
|
|
68
|
+
},
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
function InputGroupButton({
|
|
72
|
+
className,
|
|
73
|
+
type = "button",
|
|
74
|
+
variant = "ghost",
|
|
75
|
+
size = "xs",
|
|
76
|
+
...props
|
|
77
|
+
}: Omit<React.ComponentProps<typeof Button>, "size" | "type"> &
|
|
78
|
+
VariantProps<typeof inputGroupButtonVariants> & {
|
|
79
|
+
type?: "button" | "submit" | "reset"
|
|
80
|
+
}) {
|
|
81
|
+
return (
|
|
82
|
+
<Button
|
|
83
|
+
type={type}
|
|
84
|
+
data-size={size}
|
|
85
|
+
variant={variant}
|
|
86
|
+
className={cn(inputGroupButtonVariants({ size }), className)}
|
|
87
|
+
{...props}
|
|
88
|
+
/>
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function InputGroupText({ className, ...props }: React.ComponentProps<"span">) {
|
|
93
|
+
return (
|
|
94
|
+
<span className={cn("tiptap-input-group-text", className)} {...props} />
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const InputGroupInput = React.forwardRef<
|
|
99
|
+
HTMLInputElement,
|
|
100
|
+
React.ComponentProps<"input">
|
|
101
|
+
>(({ className, ...props }, ref) => (
|
|
102
|
+
<Input
|
|
103
|
+
ref={ref}
|
|
104
|
+
data-slot="tiptap-input-group-control"
|
|
105
|
+
className={cn("tiptap-input-group-control", className)}
|
|
106
|
+
{...props}
|
|
107
|
+
/>
|
|
108
|
+
))
|
|
109
|
+
|
|
110
|
+
InputGroupInput.displayName = "InputGroupInput"
|
|
111
|
+
|
|
112
|
+
function InputGroupTextarea({
|
|
113
|
+
className,
|
|
114
|
+
...props
|
|
115
|
+
}: React.ComponentProps<"textarea">) {
|
|
116
|
+
return (
|
|
117
|
+
<Textarea
|
|
118
|
+
data-slot="tiptap-input-group-control"
|
|
119
|
+
className={cn(
|
|
120
|
+
"tiptap-input-group-control tiptap-input-group-control--textarea",
|
|
121
|
+
className
|
|
122
|
+
)}
|
|
123
|
+
{...props}
|
|
124
|
+
/>
|
|
125
|
+
)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export {
|
|
129
|
+
InputGroup,
|
|
130
|
+
InputGroupAddon,
|
|
131
|
+
InputGroupButton,
|
|
132
|
+
InputGroupText,
|
|
133
|
+
InputGroupInput,
|
|
134
|
+
InputGroupTextarea,
|
|
135
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./popover"
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
.tiptap-popover {
|
|
2
|
+
--tt-popover-bg-color: var(--white);
|
|
3
|
+
--tt-popover-border-color: var(--tt-gray-light-a-100);
|
|
4
|
+
--tt-popover-text-color: var(--tt-gray-light-a-600);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
:root.dark,
|
|
8
|
+
.dark {
|
|
9
|
+
--tt-popover-border-color: var(--tt-gray-dark-a-50);
|
|
10
|
+
--tt-popover-bg-color: var(--tt-gray-dark-50);
|
|
11
|
+
--tt-popover-text-color: var(--tt-gray-dark-a-600);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/* --------------------------------------------
|
|
15
|
+
--------- POPOVER STYLING SETTINGS -----------
|
|
16
|
+
-------------------------------------------- */
|
|
17
|
+
.tiptap-popover {
|
|
18
|
+
z-index: 50;
|
|
19
|
+
outline: none;
|
|
20
|
+
transform-origin: var(--radix-popover-content-transform-origin);
|
|
21
|
+
max-height: var(--radix-popover-content-available-height);
|
|
22
|
+
|
|
23
|
+
> * {
|
|
24
|
+
max-height: var(--radix-popover-content-available-height);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* Animation states */
|
|
28
|
+
&[data-state="open"] {
|
|
29
|
+
animation:
|
|
30
|
+
fadeIn 150ms cubic-bezier(0.16, 1, 0.3, 1),
|
|
31
|
+
zoomIn 150ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&[data-state="closed"] {
|
|
35
|
+
animation:
|
|
36
|
+
fadeOut 150ms cubic-bezier(0.16, 1, 0.3, 1),
|
|
37
|
+
zoomOut 150ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* Position-based animations */
|
|
41
|
+
&[data-side="top"],
|
|
42
|
+
&[data-side="top-start"],
|
|
43
|
+
&[data-side="top-end"] {
|
|
44
|
+
animation: slideFromBottom 150ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&[data-side="right"],
|
|
48
|
+
&[data-side="right-start"],
|
|
49
|
+
&[data-side="right-end"] {
|
|
50
|
+
animation: slideFromLeft 150ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&[data-side="bottom"],
|
|
54
|
+
&[data-side="bottom-start"],
|
|
55
|
+
&[data-side="bottom-end"] {
|
|
56
|
+
animation: slideFromTop 150ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&[data-side="left"],
|
|
60
|
+
&[data-side="left-start"],
|
|
61
|
+
&[data-side="left-end"] {
|
|
62
|
+
animation: slideFromRight 150ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover"
|
|
2
|
+
import { cn } from "@/lib/tiptap-utils"
|
|
3
|
+
import "@/components/tiptap-ui-primitive/popover/popover.scss"
|
|
4
|
+
|
|
5
|
+
function Popover({
|
|
6
|
+
...props
|
|
7
|
+
}: React.ComponentProps<typeof PopoverPrimitive.Root>) {
|
|
8
|
+
return <PopoverPrimitive.Root {...props} />
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function PopoverTrigger({
|
|
12
|
+
...props
|
|
13
|
+
}: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {
|
|
14
|
+
return <PopoverPrimitive.Trigger {...props} />
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function PopoverContent({
|
|
18
|
+
className,
|
|
19
|
+
align = "center",
|
|
20
|
+
sideOffset = 4,
|
|
21
|
+
...props
|
|
22
|
+
}: React.ComponentProps<typeof PopoverPrimitive.Content>) {
|
|
23
|
+
return (
|
|
24
|
+
<PopoverPrimitive.Portal>
|
|
25
|
+
<PopoverPrimitive.Content
|
|
26
|
+
align={align}
|
|
27
|
+
sideOffset={sideOffset}
|
|
28
|
+
className={cn("tiptap-popover", className)}
|
|
29
|
+
{...props}
|
|
30
|
+
/>
|
|
31
|
+
</PopoverPrimitive.Portal>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { Popover, PopoverTrigger, PopoverContent }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./separator"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
.tiptap-separator {
|
|
2
|
+
--tt-link-border-color: var(--tt-gray-light-a-200);
|
|
3
|
+
|
|
4
|
+
.dark & {
|
|
5
|
+
--tt-link-border-color: var(--tt-gray-dark-a-200);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.tiptap-separator {
|
|
10
|
+
flex-shrink: 0;
|
|
11
|
+
background-color: var(--tt-link-border-color);
|
|
12
|
+
|
|
13
|
+
&[data-orientation="horizontal"] {
|
|
14
|
+
height: 1px;
|
|
15
|
+
width: 100%;
|
|
16
|
+
margin: 0.5rem 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&[data-orientation="vertical"] {
|
|
20
|
+
height: 1.5rem;
|
|
21
|
+
width: 1px;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import "@/components/tiptap-ui-primitive/separator/separator.scss"
|
|
2
|
+
import { cn } from "@/lib/tiptap-utils"
|
|
3
|
+
|
|
4
|
+
export type Orientation = "horizontal" | "vertical"
|
|
5
|
+
|
|
6
|
+
export function Separator({
|
|
7
|
+
decorative,
|
|
8
|
+
orientation = "vertical",
|
|
9
|
+
className,
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<"div"> & {
|
|
12
|
+
orientation?: Orientation
|
|
13
|
+
decorative?: boolean
|
|
14
|
+
}) {
|
|
15
|
+
const ariaOrientation = orientation === "vertical" ? orientation : undefined
|
|
16
|
+
const semanticProps = decorative
|
|
17
|
+
? { role: "none" }
|
|
18
|
+
: { "aria-orientation": ariaOrientation, role: "separator" }
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<div
|
|
22
|
+
className={cn("tiptap-separator", className)}
|
|
23
|
+
data-orientation={orientation}
|
|
24
|
+
{...semanticProps}
|
|
25
|
+
{...props}
|
|
26
|
+
/>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./spacer"
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
export type SpacerOrientation = "horizontal" | "vertical"
|
|
4
|
+
|
|
5
|
+
export function Spacer({
|
|
6
|
+
orientation = "horizontal",
|
|
7
|
+
size,
|
|
8
|
+
style = {},
|
|
9
|
+
...props
|
|
10
|
+
}: React.ComponentProps<"div"> & {
|
|
11
|
+
orientation?: SpacerOrientation
|
|
12
|
+
size?: string | number
|
|
13
|
+
}) {
|
|
14
|
+
const computedStyle = {
|
|
15
|
+
...style,
|
|
16
|
+
...(orientation === "horizontal" && !size && { flex: 1 }),
|
|
17
|
+
...(size && {
|
|
18
|
+
width: orientation === "vertical" ? "1px" : size,
|
|
19
|
+
height: orientation === "horizontal" ? "1px" : size,
|
|
20
|
+
}),
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return <div {...props} style={computedStyle} />
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./switch"
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--tiptap-switch-track: var(--tt-gray-light-a-300);
|
|
3
|
+
--tiptap-switch-track-checked: var(--tt-brand-color-500);
|
|
4
|
+
--tiptap-switch-thumb: var(--white);
|
|
5
|
+
--tiptap-switch-ring: var(--tt-brand-color-500);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.dark {
|
|
9
|
+
--tiptap-switch-track: var(--tt-gray-dark-a-300);
|
|
10
|
+
--tiptap-switch-track-checked: var(--tt-brand-color-500);
|
|
11
|
+
--tiptap-switch-thumb: var(--white);
|
|
12
|
+
--tiptap-switch-ring: var(--tt-brand-color-500);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.tiptap-switch {
|
|
16
|
+
position: relative;
|
|
17
|
+
display: inline-flex;
|
|
18
|
+
flex-shrink: 0;
|
|
19
|
+
align-items: center;
|
|
20
|
+
border: 1px solid transparent;
|
|
21
|
+
border-radius: 9999px;
|
|
22
|
+
background-color: var(--tiptap-switch-track);
|
|
23
|
+
outline: none;
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
transition:
|
|
26
|
+
background-color 150ms ease,
|
|
27
|
+
box-shadow 150ms ease,
|
|
28
|
+
border-color 150ms ease;
|
|
29
|
+
|
|
30
|
+
/* Enlarged invisible hit area (after:-inset-x-3 after:-inset-y-2). */
|
|
31
|
+
&::after {
|
|
32
|
+
content: "";
|
|
33
|
+
position: absolute;
|
|
34
|
+
inset: -0.5rem -0.75rem;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&[data-size="default"] {
|
|
38
|
+
width: 32px;
|
|
39
|
+
height: 18.4px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&[data-size="sm"] {
|
|
43
|
+
width: 24px;
|
|
44
|
+
height: 14px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&[data-checked] {
|
|
48
|
+
background-color: var(--tiptap-switch-track-checked);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&:focus-visible {
|
|
52
|
+
border-color: var(--tiptap-switch-ring);
|
|
53
|
+
box-shadow: 0 0 0 3px
|
|
54
|
+
color-mix(in srgb, var(--tiptap-switch-ring) 50%, transparent);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&[data-disabled] {
|
|
58
|
+
cursor: not-allowed;
|
|
59
|
+
opacity: 0.5;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.tiptap-switch-thumb {
|
|
64
|
+
pointer-events: none;
|
|
65
|
+
display: block;
|
|
66
|
+
border-radius: 9999px;
|
|
67
|
+
background-color: var(--tiptap-switch-thumb);
|
|
68
|
+
transform: translateX(0);
|
|
69
|
+
transition: transform 150ms ease;
|
|
70
|
+
|
|
71
|
+
.tiptap-switch[data-size="default"] & {
|
|
72
|
+
width: 16px;
|
|
73
|
+
height: 16px;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.tiptap-switch[data-size="sm"] & {
|
|
77
|
+
width: 12px;
|
|
78
|
+
height: 12px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* Slide to the opposite end; relative to the thumb's own width so it works
|
|
82
|
+
at every size (matches translate-x-[calc(100%-2px)]). */
|
|
83
|
+
.tiptap-switch[data-checked] & {
|
|
84
|
+
transform: translateX(calc(100% - 2px));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Switch as SwitchPrimitive } from "@base-ui/react/switch"
|
|
2
|
+
|
|
3
|
+
import { cn } from "@/lib/tiptap-utils"
|
|
4
|
+
|
|
5
|
+
import "./switch.scss"
|
|
6
|
+
|
|
7
|
+
function Switch({
|
|
8
|
+
className,
|
|
9
|
+
size = "default",
|
|
10
|
+
...props
|
|
11
|
+
}: SwitchPrimitive.Root.Props & {
|
|
12
|
+
size?: "sm" | "default"
|
|
13
|
+
}) {
|
|
14
|
+
return (
|
|
15
|
+
<SwitchPrimitive.Root
|
|
16
|
+
data-slot="tiptap-switch"
|
|
17
|
+
data-size={size}
|
|
18
|
+
className={cn("tiptap-switch", className)}
|
|
19
|
+
{...props}
|
|
20
|
+
>
|
|
21
|
+
<SwitchPrimitive.Thumb
|
|
22
|
+
data-slot="tiptap-switch-thumb"
|
|
23
|
+
className="tiptap-switch-thumb"
|
|
24
|
+
/>
|
|
25
|
+
</SwitchPrimitive.Root>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { Switch }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./textarea"
|