@placeholderco/placeholder-ui 2.1.0 → 2.2.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.
Files changed (80) hide show
  1. package/dist/editors/CodeMirror.svelte +295 -297
  2. package/dist/editors/tiptap/LinkActionMenu.svelte +6 -1
  3. package/dist/editors/tiptap/extensions/Alert.js +17 -17
  4. package/dist/editors/tiptap/extensions/Div.js +19 -19
  5. package/dist/editors/tiptap/extensions/Span.js +14 -14
  6. package/dist/editors/tiptap/toolbar/AlertButton.svelte +254 -253
  7. package/dist/editors/tiptap/toolbar/AlignCenterButton.svelte +11 -11
  8. package/dist/editors/tiptap/toolbar/AlignJustifyButton.svelte +11 -11
  9. package/dist/editors/tiptap/toolbar/AlignLeftButton.svelte +11 -11
  10. package/dist/editors/tiptap/toolbar/AlignRightButton.svelte +11 -11
  11. package/dist/editors/tiptap/toolbar/BoldButton.svelte +11 -11
  12. package/dist/editors/tiptap/toolbar/BulletListButton.svelte +11 -11
  13. package/dist/editors/tiptap/toolbar/CodeButton.svelte +11 -11
  14. package/dist/editors/tiptap/toolbar/ColorButton.svelte +265 -265
  15. package/dist/editors/tiptap/toolbar/DocumentButton.svelte +51 -51
  16. package/dist/editors/tiptap/toolbar/HeadingButton.svelte +21 -21
  17. package/dist/editors/tiptap/toolbar/HtmlButton.svelte +48 -52
  18. package/dist/editors/tiptap/toolbar/ImageButton.svelte +35 -39
  19. package/dist/editors/tiptap/toolbar/ItalicButton.svelte +11 -11
  20. package/dist/editors/tiptap/toolbar/LinkButton.svelte +249 -249
  21. package/dist/editors/tiptap/toolbar/OrderedListButton.svelte +11 -11
  22. package/dist/editors/tiptap/toolbar/RedoButton.svelte +11 -11
  23. package/dist/editors/tiptap/toolbar/StrikethroughButton.svelte +11 -11
  24. package/dist/editors/tiptap/toolbar/SubscriptButton.svelte +11 -11
  25. package/dist/editors/tiptap/toolbar/SuperscriptButton.svelte +11 -11
  26. package/dist/editors/tiptap/toolbar/TableButton.svelte +231 -224
  27. package/dist/editors/tiptap/toolbar/ToolbarButton.svelte +59 -65
  28. package/dist/editors/tiptap/toolbar/UnderlineButton.svelte +11 -11
  29. package/dist/editors/tiptap/toolbar/UndoButton.svelte +11 -11
  30. package/dist/form/Autocomplete.svelte +24 -22
  31. package/dist/form/AutocompleteMulti.svelte +24 -22
  32. package/dist/form/Checkbox.svelte +4 -4
  33. package/dist/form/Chips.svelte +15 -7
  34. package/dist/form/ColorPicker.svelte +5 -20
  35. package/dist/form/ComboBox.svelte +4 -4
  36. package/dist/form/ComboBoxItemBuilder.svelte +14 -32
  37. package/dist/form/ComboBoxMulti.svelte +7 -3
  38. package/dist/form/CronBuilder.svelte +32 -110
  39. package/dist/form/DatePicker.svelte +9 -28
  40. package/dist/form/DateRangePicker.svelte +46 -36
  41. package/dist/form/DateTimePicker.svelte +11 -30
  42. package/dist/form/Number.svelte +1 -3
  43. package/dist/form/RadioGroup.svelte +1 -3
  44. package/dist/form/Select.svelte +25 -28
  45. package/dist/form/SelectMulti.svelte +36 -38
  46. package/dist/form/StringArrayBuilder.svelte +1 -3
  47. package/dist/form/TextArea.svelte +5 -6
  48. package/dist/form/Textbox.svelte +10 -4
  49. package/dist/form/TimePicker.svelte +10 -4
  50. package/dist/icon/Icon.svelte +5 -1
  51. package/dist/index.d.ts +147 -146
  52. package/dist/index.js +78 -77
  53. package/dist/layout/CustomNavbar.svelte +1 -1
  54. package/dist/layout/NavbarItemDisplay.svelte +1 -1
  55. package/dist/layout/NavbarItemView.svelte +3 -1
  56. package/dist/layout/Sidenav.svelte +1 -1
  57. package/dist/models/ComboBoxItem.d.ts +4 -4
  58. package/dist/models/NotifyModel.js +0 -1
  59. package/dist/theme.svelte.d.ts +1 -1
  60. package/dist/theme.svelte.js +46 -22
  61. package/dist/ui/Accordion.svelte +1 -3
  62. package/dist/ui/Badge.svelte +4 -5
  63. package/dist/ui/Button.svelte +7 -1
  64. package/dist/ui/ContextMenu.svelte +5 -11
  65. package/dist/ui/Dialog.svelte +16 -3
  66. package/dist/ui/Dialog.svelte.d.ts +7 -1
  67. package/dist/ui/Dropdown.svelte +21 -10
  68. package/dist/ui/MultiSortable.svelte +1 -3
  69. package/dist/ui/Pagination.svelte +2 -2
  70. package/dist/ui/Popover.svelte +16 -37
  71. package/dist/ui/ProgressBar.svelte +1 -4
  72. package/dist/ui/ThemeSwitcher.svelte +2 -1
  73. package/dist/ui/Tooltip.svelte +1 -37
  74. package/dist/util/DateFunctions.js +1 -1
  75. package/dist/util/Floating.d.ts +70 -0
  76. package/dist/util/Floating.js +321 -0
  77. package/dist/util/NavigateTo.js +2 -2
  78. package/dist/util/Transitions.d.ts +1 -1
  79. package/dist/util/Transitions.js +1 -1
  80. package/package.json +25 -25
@@ -1,58 +1,58 @@
1
1
  <script lang="ts">
2
- import type { Editor } from '@tiptap/core'
3
- import ToolbarButton from './ToolbarButton.svelte'
4
- import { iconPaperclip } from '../../../icon/index.js'
5
- import type { DocumentUploadResult } from '../TipTap.svelte'
6
-
7
- interface Props {
8
- editor: Editor
9
- onDocumentUpload?: (file: File) => Promise<DocumentUploadResult | null>
10
- }
11
-
12
- let { editor, onDocumentUpload }: Props = $props()
13
-
14
- let fileInputElement: HTMLInputElement | undefined = $state()
15
-
16
- const handleFileSelect = async (event: Event) => {
17
- const target = event.target as HTMLInputElement
18
- const file = target.files?.[0]
19
-
20
- if (!file || !onDocumentUpload) return
21
-
22
- try {
23
- const result = await onDocumentUpload(file)
24
-
25
- if (result) {
26
- editor
27
- .chain()
28
- .focus()
29
- .insertContent({
30
- type: 'text',
31
- text: result.label,
32
- marks: [{ type: 'link', attrs: { href: result.url } }]
33
- })
34
- .run()
35
- }
36
- } catch (error) {
37
- console.error('Failed to upload document:', error)
38
- }
39
-
40
- // Reset the input
41
- if (fileInputElement) {
42
- fileInputElement.value = ''
43
- }
44
- }
45
-
46
- const openFilePicker = () => {
47
- fileInputElement?.click()
48
- }
2
+ import type { Editor } from '@tiptap/core';
3
+ import ToolbarButton from './ToolbarButton.svelte';
4
+ import { iconPaperclip } from '../../../icon/index.js';
5
+ import type { DocumentUploadResult } from '../TipTap.svelte';
6
+
7
+ interface Props {
8
+ editor: Editor;
9
+ onDocumentUpload?: (file: File) => Promise<DocumentUploadResult | null>;
10
+ }
11
+
12
+ let { editor, onDocumentUpload }: Props = $props();
13
+
14
+ let fileInputElement: HTMLInputElement | undefined = $state();
15
+
16
+ const handleFileSelect = async (event: Event) => {
17
+ const target = event.target as HTMLInputElement;
18
+ const file = target.files?.[0];
19
+
20
+ if (!file || !onDocumentUpload) return;
21
+
22
+ try {
23
+ const result = await onDocumentUpload(file);
24
+
25
+ if (result) {
26
+ editor
27
+ .chain()
28
+ .focus()
29
+ .insertContent({
30
+ type: 'text',
31
+ text: result.label,
32
+ marks: [{ type: 'link', attrs: { href: result.url } }]
33
+ })
34
+ .run();
35
+ }
36
+ } catch (error) {
37
+ console.error('Failed to upload document:', error);
38
+ }
39
+
40
+ // Reset the input
41
+ if (fileInputElement) {
42
+ fileInputElement.value = '';
43
+ }
44
+ };
45
+
46
+ const openFilePicker = () => {
47
+ fileInputElement?.click();
48
+ };
49
49
  </script>
50
50
 
51
51
  <input
52
- type="file"
53
- bind:this={fileInputElement}
54
- onchange={handleFileSelect}
55
- style="display: none;"
52
+ type="file"
53
+ bind:this={fileInputElement}
54
+ onchange={handleFileSelect}
55
+ style="display: none;"
56
56
  />
57
57
 
58
58
  <ToolbarButton icon={iconPaperclip} title="Attach Document" onclick={openFilePicker} />
@@ -1,30 +1,30 @@
1
1
  <script lang="ts">
2
- import type { Editor } from '@tiptap/core'
3
- import ToolbarButton from './ToolbarButton.svelte'
4
- import { iconH1, iconH2, iconH3, iconH4, iconH5, iconH6 } from '../../../icon/index.js'
2
+ import type { Editor } from '@tiptap/core';
3
+ import ToolbarButton from './ToolbarButton.svelte';
4
+ import { iconH1, iconH2, iconH3, iconH4, iconH5, iconH6 } from '../../../icon/index.js';
5
5
 
6
- interface Props {
7
- editor: Editor
8
- level?: 1 | 2 | 3 | 4 | 5 | 6
9
- }
6
+ interface Props {
7
+ editor: Editor;
8
+ level?: 1 | 2 | 3 | 4 | 5 | 6;
9
+ }
10
10
 
11
- let { editor, level = 1 }: Props = $props()
11
+ let { editor, level = 1 }: Props = $props();
12
12
 
13
- const iconMap = {
14
- 1: iconH1,
15
- 2: iconH2,
16
- 3: iconH3,
17
- 4: iconH4,
18
- 5: iconH5,
19
- 6: iconH6
20
- }
13
+ const iconMap = {
14
+ 1: iconH1,
15
+ 2: iconH2,
16
+ 3: iconH3,
17
+ 4: iconH4,
18
+ 5: iconH5,
19
+ 6: iconH6
20
+ };
21
21
 
22
- const icon = $derived(iconMap[level])
22
+ const icon = $derived(iconMap[level]);
23
23
  </script>
24
24
 
25
25
  <ToolbarButton
26
- {icon}
27
- title="Heading {level}"
28
- active={editor.isActive('heading', { level })}
29
- onclick={() => editor.chain().focus().toggleHeading({ level }).run()}
26
+ {icon}
27
+ title="Heading {level}"
28
+ active={editor.isActive('heading', { level })}
29
+ onclick={() => editor.chain().focus().toggleHeading({ level }).run()}
30
30
  />
@@ -1,68 +1,64 @@
1
1
  <script lang="ts">
2
- import type { Editor } from '@tiptap/core'
3
- import ToolbarButton from './ToolbarButton.svelte'
4
- import Dialog from '../../../ui/Dialog.svelte'
5
- import Button from '../../../ui/Button.svelte'
6
- import CodeMirror from '../../CodeMirror.svelte'
7
- import { iconCode } from '../../../icon/index.js'
8
- import { themeState } from '../../../theme.svelte.js'
2
+ import type { Editor } from '@tiptap/core';
3
+ import ToolbarButton from './ToolbarButton.svelte';
4
+ import Dialog from '../../../ui/Dialog.svelte';
5
+ import Button from '../../../ui/Button.svelte';
6
+ import CodeMirror from '../../CodeMirror.svelte';
7
+ import { iconCode } from '../../../icon/index.js';
8
+ import { themeState } from '../../../theme.svelte.js';
9
9
 
10
- interface Props {
11
- editor: Editor
12
- }
10
+ interface Props {
11
+ editor: Editor;
12
+ }
13
13
 
14
- let { editor }: Props = $props()
14
+ let { editor }: Props = $props();
15
15
 
16
- let showDialog = $state(false)
17
- let htmlContent = $state('')
18
- let codeMirrorRef: any
16
+ let showDialog = $state(false);
17
+ let htmlContent = $state('');
18
+ let codeMirrorRef: any;
19
19
 
20
- const openHtmlEditor = () => {
21
- htmlContent = editor.getHTML()
22
- showDialog = true
23
- }
20
+ const openHtmlEditor = () => {
21
+ htmlContent = editor.getHTML();
22
+ showDialog = true;
23
+ };
24
24
 
25
- const closeDialog = () => {
26
- showDialog = false
27
- }
25
+ const closeDialog = () => {
26
+ showDialog = false;
27
+ };
28
28
 
29
- const saveHtml = () => {
30
- if (codeMirrorRef) {
31
- const newHtml = codeMirrorRef.getValue()
32
- editor.commands.setContent(newHtml)
33
- }
34
- closeDialog()
35
- }
29
+ const saveHtml = () => {
30
+ if (codeMirrorRef) {
31
+ const newHtml = codeMirrorRef.getValue();
32
+ editor.commands.setContent(newHtml);
33
+ }
34
+ closeDialog();
35
+ };
36
36
  </script>
37
37
 
38
- <ToolbarButton
39
- icon={iconCode}
40
- title="Edit HTML"
41
- onclick={openHtmlEditor}
42
- />
38
+ <ToolbarButton icon={iconCode} title="Edit HTML" onclick={openHtmlEditor} />
43
39
 
44
40
  <Dialog bind:show={showDialog} title="Edit HTML" size="full" preventOverflow={false}>
45
- <div class="html-editor-container">
46
- <CodeMirror
47
- bind:this={codeMirrorRef}
48
- value={htmlContent}
49
- language="html"
50
- theme={themeState.isDarkMode ? 'dark' : 'light'}
51
- height="100%"
52
- />
53
- </div>
41
+ <div class="html-editor-container">
42
+ <CodeMirror
43
+ bind:this={codeMirrorRef}
44
+ value={htmlContent}
45
+ language="html"
46
+ theme={themeState.isDarkMode ? 'dark' : 'light'}
47
+ height="100%"
48
+ />
49
+ </div>
54
50
 
55
- {#snippet footer()}
56
- <Button variant="secondary" onclick={closeDialog}>Cancel</Button>
57
- <Button onclick={saveHtml}>Save</Button>
58
- {/snippet}
51
+ {#snippet footer()}
52
+ <Button variant="secondary" onclick={closeDialog}>Cancel</Button>
53
+ <Button onclick={saveHtml}>Save</Button>
54
+ {/snippet}
59
55
  </Dialog>
60
56
 
61
57
  <style>
62
- .html-editor-container {
63
- width: 100%;
64
- height: calc(100vh - 200px);
65
- max-height: 600px;
66
- min-height: 300px;
67
- }
58
+ .html-editor-container {
59
+ width: 100%;
60
+ height: calc(100vh - 200px);
61
+ max-height: 600px;
62
+ min-height: 300px;
63
+ }
68
64
  </style>
@@ -1,54 +1,50 @@
1
1
  <script lang="ts">
2
- import type { Editor } from '@tiptap/core'
3
- import ToolbarButton from './ToolbarButton.svelte'
4
- import { iconPhoto } from '../../../icon/index.js'
2
+ import type { Editor } from '@tiptap/core';
3
+ import ToolbarButton from './ToolbarButton.svelte';
4
+ import { iconPhoto } from '../../../icon/index.js';
5
5
 
6
- interface Props {
7
- editor: Editor
8
- onImageUpload?: (file: File) => Promise<string | null>
9
- }
6
+ interface Props {
7
+ editor: Editor;
8
+ onImageUpload?: (file: File) => Promise<string | null>;
9
+ }
10
10
 
11
- let { editor, onImageUpload }: Props = $props()
11
+ let { editor, onImageUpload }: Props = $props();
12
12
 
13
- let fileInputElement: HTMLInputElement | undefined = $state()
13
+ let fileInputElement: HTMLInputElement | undefined = $state();
14
14
 
15
- const handleFileSelect = async (event: Event) => {
16
- const target = event.target as HTMLInputElement
17
- const file = target.files?.[0]
15
+ const handleFileSelect = async (event: Event) => {
16
+ const target = event.target as HTMLInputElement;
17
+ const file = target.files?.[0];
18
18
 
19
- if (!file || !onImageUpload) return
19
+ if (!file || !onImageUpload) return;
20
20
 
21
- try {
22
- const imageUrl = await onImageUpload(file)
21
+ try {
22
+ const imageUrl = await onImageUpload(file);
23
23
 
24
- if (imageUrl) {
25
- editor.chain().focus().setImage({ src: imageUrl }).run()
26
- }
27
- } catch (error) {
28
- console.error('Failed to upload image:', error)
29
- }
24
+ if (imageUrl) {
25
+ editor.chain().focus().setImage({ src: imageUrl }).run();
26
+ }
27
+ } catch (error) {
28
+ console.error('Failed to upload image:', error);
29
+ }
30
30
 
31
- // Reset the input
32
- if (fileInputElement) {
33
- fileInputElement.value = ''
34
- }
35
- }
31
+ // Reset the input
32
+ if (fileInputElement) {
33
+ fileInputElement.value = '';
34
+ }
35
+ };
36
36
 
37
- const openFilePicker = () => {
38
- fileInputElement?.click()
39
- }
37
+ const openFilePicker = () => {
38
+ fileInputElement?.click();
39
+ };
40
40
  </script>
41
41
 
42
42
  <input
43
- type="file"
44
- accept="image/*"
45
- bind:this={fileInputElement}
46
- onchange={handleFileSelect}
47
- style="display: none;"
43
+ type="file"
44
+ accept="image/*"
45
+ bind:this={fileInputElement}
46
+ onchange={handleFileSelect}
47
+ style="display: none;"
48
48
  />
49
49
 
50
- <ToolbarButton
51
- icon={iconPhoto}
52
- title="Add Image"
53
- onclick={openFilePicker}
54
- />
50
+ <ToolbarButton icon={iconPhoto} title="Add Image" onclick={openFilePicker} />
@@ -1,18 +1,18 @@
1
1
  <script lang="ts">
2
- import type { Editor } from '@tiptap/core'
3
- import ToolbarButton from './ToolbarButton.svelte'
4
- import { iconItalic } from '../../../icon/index.js'
2
+ import type { Editor } from '@tiptap/core';
3
+ import ToolbarButton from './ToolbarButton.svelte';
4
+ import { iconItalic } from '../../../icon/index.js';
5
5
 
6
- interface Props {
7
- editor: Editor
8
- }
6
+ interface Props {
7
+ editor: Editor;
8
+ }
9
9
 
10
- let { editor }: Props = $props()
10
+ let { editor }: Props = $props();
11
11
  </script>
12
12
 
13
13
  <ToolbarButton
14
- icon={iconItalic}
15
- title="Italic"
16
- active={editor.isActive('italic')}
17
- onclick={() => editor.chain().focus().toggleItalic().run()}
14
+ icon={iconItalic}
15
+ title="Italic"
16
+ active={editor.isActive('italic')}
17
+ onclick={() => editor.chain().focus().toggleItalic().run()}
18
18
  />