drab 2.4.0 → 2.4.1
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/dist/components/Accordion.svelte +15 -17
- package/dist/components/Accordion.svelte.d.ts +14 -16
- package/dist/components/Chord.svelte +4 -1
- package/dist/components/Chord.svelte.d.ts +4 -1
- package/dist/components/ContextMenu.svelte +7 -7
- package/dist/components/ContextMenu.svelte.d.ts +7 -7
- package/dist/components/CopyButton.svelte +3 -1
- package/dist/components/CopyButton.svelte.d.ts +4 -2
- package/dist/components/DataTable.svelte +72 -54
- package/dist/components/DataTable.svelte.d.ts +15 -0
- package/dist/components/Editor.svelte +6 -1
- package/dist/components/Editor.svelte.d.ts +6 -1
- package/dist/components/FullscreenButton.svelte +10 -5
- package/dist/components/FullscreenButton.svelte.d.ts +10 -5
- package/dist/components/Popover.svelte +20 -6
- package/dist/components/Popover.svelte.d.ts +20 -6
- package/dist/components/ShareButton.svelte +8 -5
- package/dist/components/ShareButton.svelte.d.ts +6 -3
- package/dist/components/Tabs.svelte +17 -6
- package/dist/components/Tabs.svelte.d.ts +16 -5
- package/dist/components/YouTube.svelte +5 -1
- package/dist/components/YouTube.svelte.d.ts +5 -1
- package/package.json +2 -2
@@ -31,10 +31,16 @@ Displays a list of `details` elements.
|
|
31
31
|
|
32
32
|
```svelte
|
33
33
|
<script>
|
34
|
-
import
|
34
|
+
import Accordion from "./Accordion.svelte";
|
35
|
+
import FullscreenButton from "./FullscreenButton.svelte";
|
36
|
+
import Chevron from "../../site/svg/Chevron.svelte";
|
35
37
|
</script>
|
36
38
|
|
37
|
-
<Accordion
|
39
|
+
<Accordion
|
40
|
+
icon={Chevron}
|
41
|
+
classDetails="border-b"
|
42
|
+
classHeader="flex gap-8 cursor-pointer items-center justify-between py-4 font-bold hover:underline"
|
43
|
+
classContent="pb-4"
|
38
44
|
items={[
|
39
45
|
{ summary: "Is it accessible?", content: "Yes." },
|
40
46
|
{
|
@@ -46,28 +52,20 @@ Displays a list of `details` elements.
|
|
46
52
|
content: "Yes, with the transition prop.",
|
47
53
|
},
|
48
54
|
{ summary: "Does it work without Javascript?", content: "Yes." },
|
49
|
-
]}
|
50
|
-
>
|
51
|
-
<div slot="content" let:item let:index>
|
52
|
-
<span>{index + 1}.</span>
|
53
|
-
<span>{item.content}</span>
|
54
|
-
</div>
|
55
|
-
</Accordion>
|
56
|
-
|
57
|
-
<Accordion
|
58
|
-
items={[
|
59
55
|
{
|
60
|
-
summary: "
|
56
|
+
summary: "Component",
|
61
57
|
content: "Rendered only on this item.",
|
62
58
|
data: { component: FullscreenButton },
|
63
59
|
},
|
64
|
-
{ summary: "Summary", content: "Some other content" },
|
65
60
|
]}
|
66
61
|
>
|
67
|
-
<svelte:fragment slot="content" let:item>
|
68
|
-
|
62
|
+
<svelte:fragment slot="content" let:item let:index>
|
63
|
+
<div class="mb-4">
|
64
|
+
<span>{index + 1}.</span>
|
65
|
+
<span>{item.content}</span>
|
66
|
+
</div>
|
69
67
|
{#if item.data?.component}
|
70
|
-
<svelte:component this={item.data.component} />
|
68
|
+
<svelte:component class="btn" this={item.data.component} />
|
71
69
|
{/if}
|
72
70
|
</svelte:fragment>
|
73
71
|
</Accordion>
|
@@ -77,10 +77,16 @@ export type AccordionSlots = typeof __propDef.slots;
|
|
77
77
|
*
|
78
78
|
* ```svelte
|
79
79
|
* <script>
|
80
|
-
* import
|
80
|
+
* import Accordion from "./Accordion.svelte";
|
81
|
+
* import FullscreenButton from "./FullscreenButton.svelte";
|
82
|
+
* import Chevron from "../../site/svg/Chevron.svelte";
|
81
83
|
* </script>
|
82
84
|
*
|
83
85
|
* <Accordion
|
86
|
+
* icon={Chevron}
|
87
|
+
* classDetails="border-b"
|
88
|
+
* classHeader="flex gap-8 cursor-pointer items-center justify-between py-4 font-bold hover:underline"
|
89
|
+
* classContent="pb-4"
|
84
90
|
* items={[
|
85
91
|
* { summary: "Is it accessible?", content: "Yes." },
|
86
92
|
* {
|
@@ -92,28 +98,20 @@ export type AccordionSlots = typeof __propDef.slots;
|
|
92
98
|
* content: "Yes, with the transition prop.",
|
93
99
|
* },
|
94
100
|
* { summary: "Does it work without Javascript?", content: "Yes." },
|
95
|
-
* ]}
|
96
|
-
* >
|
97
|
-
* <div slot="content" let:item let:index>
|
98
|
-
* <span>{index + 1}.</span>
|
99
|
-
* <span>{item.content}</span>
|
100
|
-
* </div>
|
101
|
-
* </Accordion>
|
102
|
-
*
|
103
|
-
* <Accordion
|
104
|
-
* items={[
|
105
101
|
* {
|
106
|
-
* summary: "
|
102
|
+
* summary: "Component",
|
107
103
|
* content: "Rendered only on this item.",
|
108
104
|
* data: { component: FullscreenButton },
|
109
105
|
* },
|
110
|
-
* { summary: "Summary", content: "Some other content" },
|
111
106
|
* ]}
|
112
107
|
* >
|
113
|
-
* <svelte:fragment slot="content" let:item>
|
114
|
-
*
|
108
|
+
* <svelte:fragment slot="content" let:item let:index>
|
109
|
+
* <div class="mb-4">
|
110
|
+
* <span>{index + 1}.</span>
|
111
|
+
* <span>{item.content}</span>
|
112
|
+
* </div>
|
115
113
|
* {#if item.data?.component}
|
116
|
-
* <svelte:component this={item.data.component} />
|
114
|
+
* <svelte:component class="btn" this={item.data.component} />
|
117
115
|
* {/if}
|
118
116
|
* </svelte:fragment>
|
119
117
|
* </Accordion>
|
@@ -25,14 +25,14 @@ Displays when the parent element is right clicked.
|
|
25
25
|
import { ContextMenu } from "drab";
|
26
26
|
</script>
|
27
27
|
|
28
|
-
<div>
|
28
|
+
<div class="flex justify-center rounded border border-dashed p-12">
|
29
29
|
<div>Right click here</div>
|
30
|
-
<ContextMenu>
|
31
|
-
<div>
|
32
|
-
<div>Context Menu</div>
|
33
|
-
<button>Button</button>
|
34
|
-
<button>Button</button>
|
35
|
-
<button>Button</button>
|
30
|
+
<ContextMenu class="transition">
|
31
|
+
<div class="card flex w-48 flex-col gap-2">
|
32
|
+
<div class="font-bold">Context Menu</div>
|
33
|
+
<button class="btn">Button</button>
|
34
|
+
<button class="btn">Button</button>
|
35
|
+
<button class="btn">Button</button>
|
36
36
|
</div>
|
37
37
|
</ContextMenu>
|
38
38
|
</div>
|
@@ -41,14 +41,14 @@ export type ContextMenuSlots = typeof __propDef.slots;
|
|
41
41
|
* import { ContextMenu } from "drab";
|
42
42
|
* </script>
|
43
43
|
*
|
44
|
-
* <div>
|
44
|
+
* <div class="flex justify-center rounded border border-dashed p-12">
|
45
45
|
* <div>Right click here</div>
|
46
|
-
* <ContextMenu>
|
47
|
-
* <div>
|
48
|
-
* <div>Context Menu</div>
|
49
|
-
* <button>Button</button>
|
50
|
-
* <button>Button</button>
|
51
|
-
* <button>Button</button>
|
46
|
+
* <ContextMenu class="transition">
|
47
|
+
* <div class="card flex w-48 flex-col gap-2">
|
48
|
+
* <div class="font-bold">Context Menu</div>
|
49
|
+
* <button class="btn">Button</button>
|
50
|
+
* <button class="btn">Button</button>
|
51
|
+
* <button class="btn">Button</button>
|
52
52
|
* </div>
|
53
53
|
* </ContextMenu>
|
54
54
|
* </div>
|
@@ -42,10 +42,12 @@ export type CopyButtonSlots = typeof __propDef.slots;
|
|
42
42
|
*
|
43
43
|
* ```svelte
|
44
44
|
* <script>
|
45
|
-
*
|
45
|
+
* import { CopyButton } from "drab";
|
46
46
|
* </script>
|
47
47
|
*
|
48
|
-
* <
|
48
|
+
* <div>
|
49
|
+
* <CopyButton class="btn" text="Text to copy" />
|
50
|
+
* </div>
|
49
51
|
* ```
|
50
52
|
*/
|
51
53
|
export default class CopyButton extends SvelteComponent<CopyButtonProps, CopyButtonEvents, CopyButtonSlots> {
|
@@ -22,10 +22,12 @@ Data table to display an array of JS objects. Click a column header to sort.
|
|
22
22
|
- `classTh` - `th` class
|
23
23
|
- `classTheadTr` - `thead tr` class
|
24
24
|
- `classThead` - `thead` class
|
25
|
+
- `class`
|
25
26
|
- `columns` - table columns, in order
|
26
27
|
- `currentPage` - current page, defaults to `1`
|
27
28
|
- `data` - a list of objects to render in the table
|
28
29
|
- `idTable` - `table` id
|
30
|
+
- `id`
|
29
31
|
- `paginate` - number of rows to show on each page, defaults to `0` - no pagination
|
30
32
|
- `sortBy` - column to sort by--defaults to first column
|
31
33
|
|
@@ -43,15 +45,26 @@ Data table to display an array of JS objects. Click a column header to sort.
|
|
43
45
|
import { DataTable } from "drab";
|
44
46
|
</script>
|
45
47
|
|
46
|
-
<DataTable
|
48
|
+
<DataTable
|
47
49
|
data={[
|
48
50
|
{ make: "Honda", model: "CR-V", year: 2011, awd: true },
|
49
51
|
{ make: "Volvo", model: "XC-40", year: 2024, awd: true },
|
50
52
|
{ make: "Ferrari", model: "458 Italia", year: 2015, awd: false },
|
51
53
|
{ make: "Chevrolet", model: "Silverado", year: 2022, awd: true },
|
52
54
|
{ make: "Ford", model: "Model A", year: 1931, awd: false },
|
55
|
+
{ make: "Subaru", model: "Outback", year: 2021, awd: true },
|
56
|
+
{ make: "Ford", model: "Bronco", year: 1970, awd: true },
|
57
|
+
{ make: "GMC", model: "Acadia", year: 2008, awd: true },
|
58
|
+
{ make: "BMW", model: "X3", year: 2023, awd: true },
|
53
59
|
]}
|
54
60
|
sortBy="make"
|
61
|
+
paginate={4}
|
62
|
+
class="tabular-nums"
|
63
|
+
classTh="cursor-pointer uppercase"
|
64
|
+
classThSorted="underline"
|
65
|
+
classTbodyTr="transition hover:bg-gray-50"
|
66
|
+
classFooter="flex justify-between items-center"
|
67
|
+
classButton="btn"
|
55
68
|
/>
|
56
69
|
```
|
57
70
|
-->
|
@@ -60,6 +73,9 @@ Data table to display an array of JS objects. Click a column header to sort.
|
|
60
73
|
|
61
74
|
<script>import { messageNoScript } from "../util/messages";
|
62
75
|
import { onMount } from "svelte";
|
76
|
+
let className = "";
|
77
|
+
export { className as class };
|
78
|
+
export let id = "";
|
63
79
|
export let data;
|
64
80
|
export let columns = [];
|
65
81
|
if (!columns.length && data[0]) {
|
@@ -125,60 +141,62 @@ sort(sortBy, false);
|
|
125
141
|
onMount(() => clientJs = true);
|
126
142
|
</script>
|
127
143
|
|
128
|
-
<
|
129
|
-
<
|
130
|
-
<
|
131
|
-
{
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
144
|
+
<div class={className} {id}>
|
145
|
+
<table class={classTable} id={idTable}>
|
146
|
+
<thead class={classThead}>
|
147
|
+
<tr class={classTheadTr}>
|
148
|
+
{#each columns as column}
|
149
|
+
<th
|
150
|
+
class="{classTh} {sortBy === column ? classThSorted : ''}"
|
151
|
+
on:click={() => sort(column)}
|
152
|
+
>
|
153
|
+
{column}
|
154
|
+
</th>
|
155
|
+
{/each}
|
156
|
+
</tr>
|
157
|
+
</thead>
|
158
|
+
<tbody class={classTbody}>
|
159
|
+
{#each data as row, i}
|
160
|
+
{@const showRow =
|
161
|
+
i < paginate * currentPage && i >= paginate * (currentPage - 1)}
|
162
|
+
{#if paginate ? showRow : true}
|
163
|
+
<tr class={classTbodyTr}>
|
164
|
+
{#each columns as column}
|
165
|
+
<td class="{classTd} {sortBy === column ? classTdSorted : ''}">
|
166
|
+
{row[column]}
|
167
|
+
</td>
|
168
|
+
{/each}
|
169
|
+
</tr>
|
170
|
+
{/if}
|
138
171
|
{/each}
|
139
|
-
</
|
140
|
-
</
|
141
|
-
<tbody class={classTbody}>
|
142
|
-
{#each data as row, i}
|
143
|
-
{@const showRow =
|
144
|
-
i < paginate * currentPage && i >= paginate * (currentPage - 1)}
|
145
|
-
{#if paginate ? showRow : true}
|
146
|
-
<tr class={classTbodyTr}>
|
147
|
-
{#each columns as column}
|
148
|
-
<td class="{classTd} {sortBy === column ? classTdSorted : ''}">
|
149
|
-
{row[column]}
|
150
|
-
</td>
|
151
|
-
{/each}
|
152
|
-
</tr>
|
153
|
-
{/if}
|
154
|
-
{/each}
|
155
|
-
</tbody>
|
156
|
-
</table>
|
172
|
+
</tbody>
|
173
|
+
</table>
|
157
174
|
|
158
|
-
{#if paginate}
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
175
|
+
{#if paginate}
|
176
|
+
<div class={classFooter}>
|
177
|
+
<div class={classPageNumber}>{currentPage} / {numberOfPages}</div>
|
178
|
+
<div class={classPageControls}>
|
179
|
+
<button
|
180
|
+
class={classButton}
|
181
|
+
disabled={!clientJs || currentPage < 2}
|
182
|
+
on:click={() => currentPage--}
|
183
|
+
>
|
184
|
+
<slot name="previous">Previous</slot>
|
185
|
+
</button>
|
186
|
+
<button
|
187
|
+
class={classButton}
|
188
|
+
disabled={!clientJs || currentPage >= numberOfPages}
|
189
|
+
on:click={() => currentPage++}
|
190
|
+
>
|
191
|
+
<slot name="next">Next</slot>
|
192
|
+
</button>
|
193
|
+
</div>
|
176
194
|
</div>
|
177
|
-
</div>
|
178
195
|
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
{/if}
|
196
|
+
<noscript>
|
197
|
+
<div class={classNoscript}>
|
198
|
+
{messageNoScript}
|
199
|
+
</div>
|
200
|
+
</noscript>
|
201
|
+
{/if}
|
202
|
+
</div>
|
@@ -4,6 +4,8 @@ export type DataTableRow<T> = {
|
|
4
4
|
};
|
5
5
|
declare const __propDef: {
|
6
6
|
props: {
|
7
|
+
class?: string | undefined;
|
8
|
+
id?: string | undefined;
|
7
9
|
/** a list of objects to render in the table */ data: DataTableRow<any>[];
|
8
10
|
/** table columns, in order */ columns?: string[] | undefined;
|
9
11
|
/** column to sort by--defaults to first column */ sortBy?: string | undefined;
|
@@ -59,10 +61,12 @@ export type DataTableSlots = typeof __propDef.slots;
|
|
59
61
|
* - `classTh` - `th` class
|
60
62
|
* - `classTheadTr` - `thead tr` class
|
61
63
|
* - `classThead` - `thead` class
|
64
|
+
* - `class`
|
62
65
|
* - `columns` - table columns, in order
|
63
66
|
* - `currentPage` - current page, defaults to `1`
|
64
67
|
* - `data` - a list of objects to render in the table
|
65
68
|
* - `idTable` - `table` id
|
69
|
+
* - `id`
|
66
70
|
* - `paginate` - number of rows to show on each page, defaults to `0` - no pagination
|
67
71
|
* - `sortBy` - column to sort by--defaults to first column
|
68
72
|
*
|
@@ -87,8 +91,19 @@ export type DataTableSlots = typeof __propDef.slots;
|
|
87
91
|
* { make: "Ferrari", model: "458 Italia", year: 2015, awd: false },
|
88
92
|
* { make: "Chevrolet", model: "Silverado", year: 2022, awd: true },
|
89
93
|
* { make: "Ford", model: "Model A", year: 1931, awd: false },
|
94
|
+
* { make: "Subaru", model: "Outback", year: 2021, awd: true },
|
95
|
+
* { make: "Ford", model: "Bronco", year: 1970, awd: true },
|
96
|
+
* { make: "GMC", model: "Acadia", year: 2008, awd: true },
|
97
|
+
* { make: "BMW", model: "X3", year: 2023, awd: true },
|
90
98
|
* ]}
|
91
99
|
* sortBy="make"
|
100
|
+
* paginate={4}
|
101
|
+
* class="tabular-nums"
|
102
|
+
* classTh="cursor-pointer uppercase"
|
103
|
+
* classThSorted="underline"
|
104
|
+
* classTbodyTr="transition hover:bg-gray-50"
|
105
|
+
* classFooter="flex justify-between items-center"
|
106
|
+
* classButton="btn"
|
92
107
|
* />
|
93
108
|
* ```
|
94
109
|
*/
|
@@ -27,7 +27,12 @@ Text editor with controls to add elements and keyboard shortcuts.
|
|
27
27
|
import { Editor } from "drab";
|
28
28
|
</script>
|
29
29
|
|
30
|
-
<Editor
|
30
|
+
<Editor
|
31
|
+
classButton="btn"
|
32
|
+
classControls="flex gap-2"
|
33
|
+
classTextarea="border w-full h-36 p-2 rounded"
|
34
|
+
placeholderTextarea="asterisk: ctrl+i, anchor: ctrl+["
|
35
|
+
contentElements={[
|
31
36
|
{
|
32
37
|
name: "Bullet",
|
33
38
|
text: "- ",
|
@@ -73,7 +73,12 @@ export type EditorSlots = typeof __propDef.slots;
|
|
73
73
|
* import { Editor } from "drab";
|
74
74
|
* </script>
|
75
75
|
*
|
76
|
-
* <Editor
|
76
|
+
* <Editor
|
77
|
+
* classButton="btn"
|
78
|
+
* classControls="flex gap-2"
|
79
|
+
* classTextarea="border w-full h-36 p-2 rounded"
|
80
|
+
* placeholderTextarea="asterisk: ctrl+i, anchor: ctrl+["
|
81
|
+
* contentElements={[
|
77
82
|
* {
|
78
83
|
* name: "Bullet",
|
79
84
|
* text: "- ",
|
@@ -30,13 +30,18 @@ Make the document or a specific element fullscreen.
|
|
30
30
|
let fullscreenDiv;
|
31
31
|
</script>
|
32
32
|
|
33
|
-
<
|
33
|
+
<div>
|
34
|
+
<FullscreenButton class="btn" />
|
35
|
+
</div>
|
34
36
|
|
35
|
-
<div
|
36
|
-
|
37
|
-
|
37
|
+
<div
|
38
|
+
bind:this={fullscreenDiv}
|
39
|
+
class="mt-4 rounded bg-gray-800 p-4 text-gray-50"
|
40
|
+
>
|
41
|
+
<div class="mb-2">Target element fullscreen</div>
|
42
|
+
<FullscreenButton targetElement={fullscreenDiv} class="btn">
|
43
|
+
<span>Enable Element Fullscreen</span>
|
38
44
|
<span slot="enabled">Exit Element Fullscreen</span>
|
39
|
-
<span slot="disabled">Enable Element Fullscreen</span>
|
40
45
|
</FullscreenButton>
|
41
46
|
</div>
|
42
47
|
```
|
@@ -49,13 +49,18 @@ export type FullscreenButtonSlots = typeof __propDef.slots;
|
|
49
49
|
* let fullscreenDiv;
|
50
50
|
* </script>
|
51
51
|
*
|
52
|
-
* <
|
52
|
+
* <div>
|
53
|
+
* <FullscreenButton class="btn" />
|
54
|
+
* </div>
|
53
55
|
*
|
54
|
-
* <div
|
55
|
-
*
|
56
|
-
*
|
56
|
+
* <div
|
57
|
+
* bind:this={fullscreenDiv}
|
58
|
+
* class="mt-4 rounded bg-gray-800 p-4 text-gray-50"
|
59
|
+
* >
|
60
|
+
* <div class="mb-2">Target element fullscreen</div>
|
61
|
+
* <FullscreenButton targetElement={fullscreenDiv} class="btn">
|
62
|
+
* <span>Enable Element Fullscreen</span>
|
57
63
|
* <span slot="enabled">Exit Element Fullscreen</span>
|
58
|
-
* <span slot="disabled">Enable Element Fullscreen</span>
|
59
64
|
* </FullscreenButton>
|
60
65
|
* </div>
|
61
66
|
* ```
|
@@ -31,13 +31,27 @@ Displays a popover relatively positioned to the button.
|
|
31
31
|
import { Popover } from "drab";
|
32
32
|
</script>
|
33
33
|
|
34
|
-
<Popover>
|
34
|
+
<Popover classButton="btn" classPopover="p-2 transition">
|
35
35
|
<span slot="button">Hover</span>
|
36
|
-
<div>
|
37
|
-
<div>
|
38
|
-
<button>Button</button>
|
39
|
-
<button>Button</button>
|
40
|
-
<button>Button</button>
|
36
|
+
<div class="card flex w-48 flex-col gap-2">
|
37
|
+
<div class="font-bold">Bottom</div>
|
38
|
+
<button class="btn">Button</button>
|
39
|
+
<button class="btn">Button</button>
|
40
|
+
<button class="btn">Button</button>
|
41
|
+
</div>
|
42
|
+
</Popover>
|
43
|
+
<Popover
|
44
|
+
classButton="btn"
|
45
|
+
classPopover="p-2 transition"
|
46
|
+
eventType="click"
|
47
|
+
position="right"
|
48
|
+
>
|
49
|
+
<span slot="button">Click</span>
|
50
|
+
<div class="card flex w-48 flex-col gap-2">
|
51
|
+
<div class="font-bold">Right</div>
|
52
|
+
<button class="btn">Button</button>
|
53
|
+
<button class="btn">Button</button>
|
54
|
+
<button class="btn">Button</button>
|
41
55
|
</div>
|
42
56
|
</Popover>
|
43
57
|
```
|
@@ -53,13 +53,27 @@ export type PopoverSlots = typeof __propDef.slots;
|
|
53
53
|
* import { Popover } from "drab";
|
54
54
|
* </script>
|
55
55
|
*
|
56
|
-
* <Popover>
|
56
|
+
* <Popover classButton="btn" classPopover="p-2 transition">
|
57
57
|
* <span slot="button">Hover</span>
|
58
|
-
* <div>
|
59
|
-
* <div>
|
60
|
-
* <button>Button</button>
|
61
|
-
* <button>Button</button>
|
62
|
-
* <button>Button</button>
|
58
|
+
* <div class="card flex w-48 flex-col gap-2">
|
59
|
+
* <div class="font-bold">Bottom</div>
|
60
|
+
* <button class="btn">Button</button>
|
61
|
+
* <button class="btn">Button</button>
|
62
|
+
* <button class="btn">Button</button>
|
63
|
+
* </div>
|
64
|
+
* </Popover>
|
65
|
+
* <Popover
|
66
|
+
* classButton="btn"
|
67
|
+
* classPopover="p-2 transition"
|
68
|
+
* eventType="click"
|
69
|
+
* position="right"
|
70
|
+
* >
|
71
|
+
* <span slot="button">Click</span>
|
72
|
+
* <div class="card flex w-48 flex-col gap-2">
|
73
|
+
* <div class="font-bold">Right</div>
|
74
|
+
* <button class="btn">Button</button>
|
75
|
+
* <button class="btn">Button</button>
|
76
|
+
* <button class="btn">Button</button>
|
63
77
|
* </div>
|
64
78
|
* </Popover>
|
65
79
|
* ```
|
@@ -28,11 +28,14 @@ Uses the navigator api to share or copy a url link depending on browser support.
|
|
28
28
|
import { ShareButton } from "drab";
|
29
29
|
</script>
|
30
30
|
|
31
|
-
<
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
<div>
|
32
|
+
<ShareButton
|
33
|
+
class="btn"
|
34
|
+
text="Check out this page: "
|
35
|
+
title="drab"
|
36
|
+
url="https://drab.robino.dev"
|
37
|
+
/>
|
38
|
+
</div>
|
36
39
|
```
|
37
40
|
-->
|
38
41
|
|
@@ -47,11 +47,14 @@ export type ShareButtonSlots = typeof __propDef.slots;
|
|
47
47
|
* import { ShareButton } from "drab";
|
48
48
|
* </script>
|
49
49
|
*
|
50
|
+
* <div>
|
50
51
|
* <ShareButton
|
51
|
-
*
|
52
|
-
*
|
53
|
-
*
|
52
|
+
* class="btn"
|
53
|
+
* text="Check out this page: "
|
54
|
+
* title="drab"
|
55
|
+
* url="https://drab.robino.dev"
|
54
56
|
* />
|
57
|
+
* </div>
|
55
58
|
* ```
|
56
59
|
*/
|
57
60
|
export default class ShareButton extends SvelteComponent<ShareButtonProps, ShareButtonEvents, ShareButtonSlots> {
|
@@ -30,18 +30,29 @@ Displays tabs and the active tab's content.
|
|
30
30
|
```svelte
|
31
31
|
<script>
|
32
32
|
import { Tabs } from "drab";
|
33
|
+
import FullscreenButton from "./FullscreenButton.svelte";
|
33
34
|
</script>
|
34
35
|
|
35
|
-
<Tabs
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
<Tabs
|
37
|
+
classHeader="grid grid-flow-col grid-rows-1 gap-1 rounded bg-gray-200 p-1"
|
38
|
+
classTitle="btn rounded-sm p-0.5"
|
39
|
+
classTitleActive="bg-white text-gray-950"
|
40
|
+
classTitleInactive="bg-gray-200 text-gray-500"
|
41
|
+
classContent="py-2"
|
42
|
+
tabs={[
|
43
|
+
{ title: "Tab 1", content: "Content 1" },
|
44
|
+
{ title: "Tab 2", content: "Content 2" },
|
39
45
|
]}
|
40
46
|
/>
|
41
47
|
|
42
48
|
<Tabs
|
49
|
+
classHeader="grid grid-flow-col grid-rows-1 gap-1 rounded bg-gray-200 p-1"
|
50
|
+
classTitle="btn rounded-sm p-0.5"
|
51
|
+
classTitleActive="bg-white text-gray-950"
|
52
|
+
classTitleInactive="bg-gray-200 text-gray-500"
|
53
|
+
classContent="py-2"
|
43
54
|
tabs={[
|
44
|
-
{ title: "Tab", content: "
|
55
|
+
{ title: "Tab", content: "Generated indexes" },
|
45
56
|
{
|
46
57
|
title: "Tab",
|
47
58
|
content: "A tab with a component",
|
@@ -56,7 +67,7 @@ Displays tabs and the active tab's content.
|
|
56
67
|
</svelte:fragment>
|
57
68
|
<div>{activeTab.content}</div>
|
58
69
|
{#if activeTab.data?.component}
|
59
|
-
<svelte:component this={activeTab.data.component} />
|
70
|
+
<svelte:component class="btn" this={activeTab.data.component} />
|
60
71
|
{/if}
|
61
72
|
</Tabs>
|
62
73
|
```
|
@@ -66,18 +66,29 @@ export type TabsSlots = typeof __propDef.slots;
|
|
66
66
|
* ```svelte
|
67
67
|
* <script>
|
68
68
|
* import { Tabs } from "drab";
|
69
|
+
* import FullscreenButton from "./FullscreenButton.svelte";
|
69
70
|
* </script>
|
70
71
|
*
|
71
72
|
* <Tabs
|
72
|
-
*
|
73
|
-
*
|
74
|
-
*
|
73
|
+
* classHeader="grid grid-flow-col grid-rows-1 gap-1 rounded bg-gray-200 p-1"
|
74
|
+
* classTitle="btn rounded-sm p-0.5"
|
75
|
+
* classTitleActive="bg-white text-gray-950"
|
76
|
+
* classTitleInactive="bg-gray-200 text-gray-500"
|
77
|
+
* classContent="py-2"
|
78
|
+
* tabs={[
|
79
|
+
* { title: "Tab 1", content: "Content 1" },
|
80
|
+
* { title: "Tab 2", content: "Content 2" },
|
75
81
|
* ]}
|
76
82
|
* />
|
77
83
|
*
|
78
84
|
* <Tabs
|
85
|
+
* classHeader="grid grid-flow-col grid-rows-1 gap-1 rounded bg-gray-200 p-1"
|
86
|
+
* classTitle="btn rounded-sm p-0.5"
|
87
|
+
* classTitleActive="bg-white text-gray-950"
|
88
|
+
* classTitleInactive="bg-gray-200 text-gray-500"
|
89
|
+
* classContent="py-2"
|
79
90
|
* tabs={[
|
80
|
-
* { title: "Tab", content: "
|
91
|
+
* { title: "Tab", content: "Generated indexes" },
|
81
92
|
* {
|
82
93
|
* title: "Tab",
|
83
94
|
* content: "A tab with a component",
|
@@ -92,7 +103,7 @@ export type TabsSlots = typeof __propDef.slots;
|
|
92
103
|
* </svelte:fragment>
|
93
104
|
* <div>{activeTab.content}</div>
|
94
105
|
* {#if activeTab.data?.component}
|
95
|
-
* <svelte:component this={activeTab.data.component} />
|
106
|
+
* <svelte:component class="btn" this={activeTab.data.component} />
|
96
107
|
* {/if}
|
97
108
|
* </Tabs>
|
98
109
|
* ```
|
@@ -21,7 +21,11 @@ Embeds a YouTube video into a website with the video `uid`, using [www.youtube-n
|
|
21
21
|
import { YouTube } from "drab";
|
22
22
|
</script>
|
23
23
|
|
24
|
-
<YouTube
|
24
|
+
<YouTube
|
25
|
+
class="aspect-video w-full rounded"
|
26
|
+
title="Renegade - Kevin Olusola"
|
27
|
+
uid="gouiY85kD2o"
|
28
|
+
/>
|
25
29
|
```
|
26
30
|
-->
|
27
31
|
|
@@ -37,7 +37,11 @@ export type YouTubeSlots = typeof __propDef.slots;
|
|
37
37
|
* import { YouTube } from "drab";
|
38
38
|
* </script>
|
39
39
|
*
|
40
|
-
* <YouTube
|
40
|
+
* <YouTube
|
41
|
+
* class="aspect-video w-full rounded"
|
42
|
+
* title="Renegade - Kevin Olusola"
|
43
|
+
* uid="gouiY85kD2o"
|
44
|
+
* />
|
41
45
|
* ```
|
42
46
|
*/
|
43
47
|
export default class YouTube extends SvelteComponent<YouTubeProps, YouTubeEvents, YouTubeSlots> {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "drab",
|
3
|
-
"version": "2.4.
|
3
|
+
"version": "2.4.1",
|
4
4
|
"description": "An unstyled Svelte component library",
|
5
5
|
"keywords": [
|
6
6
|
"components",
|
@@ -36,7 +36,7 @@
|
|
36
36
|
"lint": "prettier --check . && eslint .",
|
37
37
|
"format": "prettier --write . --plugin=prettier-plugin-svelte --plugin=prettier-plugin-tailwindcss",
|
38
38
|
"pub": "npm publish --access public",
|
39
|
-
"doc": "node scripts/buildDocs.js"
|
39
|
+
"doc": "node src/scripts/buildDocs.js"
|
40
40
|
},
|
41
41
|
"exports": {
|
42
42
|
".": {
|