@conalog/ds-svelte 0.0.0-stage → 1.0.0-alpha.2

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 (75) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +6 -2
  3. package/SUPPORT.json +387 -0
  4. package/dist/ActionButton.svelte +11 -0
  5. package/dist/Badge.svelte +49 -0
  6. package/dist/Button.svelte +107 -0
  7. package/dist/Card.svelte +76 -0
  8. package/dist/Checkbox.svelte +60 -0
  9. package/dist/Chip.svelte +133 -0
  10. package/dist/CircularSpinner.svelte +30 -0
  11. package/dist/DashboardWidget.svelte +875 -0
  12. package/dist/Divider.svelte +29 -0
  13. package/dist/DsTheme.svelte +14 -0
  14. package/dist/IconButton.svelte +7 -0
  15. package/dist/Menu.svelte +277 -0
  16. package/dist/Modal.svelte +86 -0
  17. package/dist/Navigation.svelte +87 -0
  18. package/dist/PageHeader.svelte +81 -0
  19. package/dist/ScopePicker.svelte +271 -0
  20. package/dist/SearchField.svelte +7 -0
  21. package/dist/SegmentedControl.svelte +154 -0
  22. package/dist/StatusBanner.svelte +48 -0
  23. package/dist/Table.svelte +180 -0
  24. package/dist/Tabs.svelte +121 -0
  25. package/dist/TextField.svelte +122 -0
  26. package/dist/Tooltip.svelte +147 -0
  27. package/dist/button-options.mjs +1 -0
  28. package/dist/button.css +514 -0
  29. package/dist/dashboard-widget-drag.mjs +148 -0
  30. package/dist/display.css +53 -0
  31. package/dist/draft-overlay.mjs +67 -0
  32. package/dist/draft.css +248 -0
  33. package/dist/icon-provenance.json +62 -0
  34. package/dist/icons/check/filled.d.mts +3 -0
  35. package/dist/icons/check/filled.mjs +1 -0
  36. package/dist/icons/check/filled.svelte +10 -0
  37. package/dist/icons/check.d.mts +1 -0
  38. package/dist/icons/check.mjs +1 -0
  39. package/dist/icons/headset/filled.d.mts +3 -0
  40. package/dist/icons/headset/filled.mjs +1 -0
  41. package/dist/icons/headset/filled.svelte +10 -0
  42. package/dist/icons/headset.d.mts +1 -0
  43. package/dist/icons/headset.mjs +1 -0
  44. package/dist/icons/notification-bell/filled.d.mts +3 -0
  45. package/dist/icons/notification-bell/filled.mjs +1 -0
  46. package/dist/icons/notification-bell/filled.svelte +10 -0
  47. package/dist/icons/notification-bell-off/filled.d.mts +3 -0
  48. package/dist/icons/notification-bell-off/filled.mjs +1 -0
  49. package/dist/icons/notification-bell-off/filled.svelte +10 -0
  50. package/dist/icons/notification-bell-off.d.mts +1 -0
  51. package/dist/icons/notification-bell-off.mjs +1 -0
  52. package/dist/icons/notification-bell.d.mts +1 -0
  53. package/dist/icons/notification-bell.mjs +1 -0
  54. package/dist/icons/plant/filled.d.mts +3 -0
  55. package/dist/icons/plant/filled.mjs +1 -0
  56. package/dist/icons/plant/filled.svelte +13 -0
  57. package/dist/icons/plant.d.mts +1 -0
  58. package/dist/icons/plant.mjs +1 -0
  59. package/dist/icons/search/outlined.d.mts +3 -0
  60. package/dist/icons/search/outlined.mjs +1 -0
  61. package/dist/icons/search/outlined.svelte +10 -0
  62. package/dist/icons/search.d.mts +1 -0
  63. package/dist/icons/search.mjs +1 -0
  64. package/dist/icons.d.mts +6 -0
  65. package/dist/icons.mjs +6 -0
  66. package/dist/index.d.ts +288 -0
  67. package/dist/index.mjs +22 -0
  68. package/dist/licenses/check/filled.txt +202 -0
  69. package/dist/licenses/headset/filled.txt +21 -0
  70. package/dist/licenses/notification-bell/filled.txt +21 -0
  71. package/dist/licenses/notification-bell-off/filled.txt +21 -0
  72. package/dist/licenses/plant/filled.txt +24 -0
  73. package/dist/licenses/search/outlined.txt +21 -0
  74. package/package.json +58 -4
  75. package/release-source.json +5 -0
@@ -0,0 +1,29 @@
1
+ <script>
2
+ import './draft.css';
3
+
4
+ let { orientation = 'horizontal', tone = 'neutral', inset = 'none', decorative = false } = $props();
5
+ const insets = { none: '0px', 'spacing.card-edge': 'var(--ds-draft-spacing-card-edge)',
6
+ 'spacing-x.global-gutter': 'var(--ds-draft-spacing-x-global-gutter)' };
7
+ </script>
8
+
9
+ {#if orientation === 'vertical'}
10
+ <div role="separator" aria-orientation="vertical" aria-hidden={decorative || undefined}
11
+ class={['divider vertical', { weak: tone === 'weak' }]} style:--inset={insets[inset]}></div>
12
+ {:else}
13
+ <hr aria-hidden={decorative || undefined} class={['divider horizontal', { weak: tone === 'weak' }]}
14
+ style:--inset={insets[inset]} />
15
+ {/if}
16
+
17
+ <style>
18
+ .divider {
19
+ flex: none;
20
+ align-self: stretch;
21
+ display: block;
22
+ margin: 0;
23
+ border: 0;
24
+ background: var(--ds-draft-stroke-neutral);
25
+ }
26
+ .weak { background: var(--ds-draft-stroke-neutral-weak); }
27
+ .horizontal { block-size: 1px; margin-inline: var(--inset); }
28
+ .vertical { inline-size: 1px; min-block-size: 1px; margin-block: var(--inset); }
29
+ </style>
@@ -0,0 +1,14 @@
1
+ <script>
2
+ import { getTokens } from '@conalog/ds-core';
3
+ import '@conalog/ds-core/tokens.css';
4
+
5
+ let { theme, children } = $props();
6
+ let selectedTheme = $derived.by(() => {
7
+ getTokens(theme);
8
+ return theme;
9
+ });
10
+ </script>
11
+
12
+ <div data-ds-theme={selectedTheme}>
13
+ {@render children?.()}
14
+ </div>
@@ -0,0 +1,7 @@
1
+ <script>
2
+ import Button from './Button.svelte';
3
+
4
+ let { label, icon, color = 'neutral', variant = 'weak', size = 'md', presentation = 'enabled', onclick } = $props();
5
+ </script>
6
+
7
+ <Button kind="icon-button" {label} {icon} {color} {variant} {size} {presentation} {onclick} />
@@ -0,0 +1,277 @@
1
+ <script>
2
+ import { tick } from 'svelte';
3
+ import './draft.css';
4
+ import { attachOverlay } from './draft-overlay.mjs';
5
+
6
+ const id = $props.id();
7
+ let {
8
+ label, triggerLabel, items, size = 'md', width = 'auto', disabled = false,
9
+ open = $bindable(false), onselect, trigger,
10
+ } = $props();
11
+
12
+ let anchor = $state();
13
+ let wrapper = $state();
14
+ let panel = $state();
15
+ let path = $state([]);
16
+ let current = $derived(path.at(-1)?.children ?? items);
17
+ let groups = $derived.by(() => {
18
+ const result = [];
19
+ for (const item of current) {
20
+ if (!result.length || result.at(-1).label !== item.group) {
21
+ result.push({ label: item.group, items: [] });
22
+ }
23
+ result.at(-1).items.push(item);
24
+ }
25
+ return result;
26
+ });
27
+
28
+ function triggerElement() {
29
+ return anchor ?? wrapper?.querySelector('button');
30
+ }
31
+
32
+ function available() {
33
+ return [...(panel?.querySelectorAll('button[data-menu-item]:not(:disabled)') ?? [])];
34
+ }
35
+
36
+ async function focusItem(last = false, itemId) {
37
+ await tick();
38
+ if (!open) return;
39
+ const buttons = available();
40
+ const button = itemId ? buttons.find(candidate => candidate.dataset.menuItem === itemId)
41
+ : last ? buttons.at(-1) : buttons[0];
42
+ (button ?? panel)?.focus({ preventScroll: true });
43
+ button?.scrollIntoView({ block: 'nearest' });
44
+ }
45
+
46
+ function start(event, enter = false, last = false) {
47
+ if (disabled) return;
48
+ if (!open) path = [];
49
+ anchor = event.currentTarget;
50
+ open = true;
51
+ if (enter) void focusItem(last);
52
+ }
53
+
54
+ function finish(restore = true) {
55
+ if (!open) return;
56
+ open = false;
57
+ path = [];
58
+ if (restore) triggerElement()?.focus({ preventScroll: true });
59
+ }
60
+
61
+ function triggerClick(event) {
62
+ if (open) finish();
63
+ else start(event, event.detail === 0);
64
+ }
65
+
66
+ function triggerKeydown(event) {
67
+ if (disabled) return;
68
+ if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {
69
+ event.preventDefault();
70
+ start(event, true, event.key === 'ArrowUp');
71
+ } else if (event.key === 'Escape' && open) {
72
+ event.preventDefault();
73
+ event.stopPropagation();
74
+ finish();
75
+ }
76
+ }
77
+
78
+ function leaveLevel() {
79
+ const previous = path.at(-1);
80
+ path = path.slice(0, -1);
81
+ void focusItem(false, previous.id);
82
+ }
83
+
84
+ function choose(item) {
85
+ if (item.disabled) return;
86
+ if (item.children?.length) {
87
+ path = [...path, item];
88
+ void focusItem();
89
+ return;
90
+ }
91
+ if (item.kind !== 'checkbox') finish();
92
+ onselect?.(item.id, item.kind === 'checkbox' ? !item.checked : item.kind === 'radio' ? true : undefined);
93
+ }
94
+
95
+ function handleKeys(event) {
96
+ const buttons = available();
97
+ let next;
98
+ const index = buttons.indexOf(event.target);
99
+ switch (event.key) {
100
+ case 'Escape':
101
+ finish();
102
+ break;
103
+ case 'ArrowLeft':
104
+ if (!path.length) return;
105
+ leaveLevel();
106
+ break;
107
+ case 'ArrowRight': {
108
+ const item = current.find(candidate => candidate.id === event.target.dataset.menuItem);
109
+ if (!item?.children?.length) return;
110
+ choose(item);
111
+ break;
112
+ }
113
+ case 'Tab':
114
+ setTimeout(() => finish(false), 0);
115
+ return;
116
+ case 'Home': next = buttons[0]; break;
117
+ case 'End': next = buttons.at(-1); break;
118
+ case 'ArrowDown': next = buttons[(index + 1) % buttons.length]; break;
119
+ case 'ArrowUp': next = buttons[(index < 0 ? buttons.length - 1 : (index - 1 + buttons.length) % buttons.length)]; break;
120
+ default: return;
121
+ }
122
+ event.preventDefault();
123
+ event.stopPropagation();
124
+ next?.focus();
125
+ }
126
+
127
+ function handleToggle() {
128
+ if (open && !panel.matches(':popover-open')) finish(false);
129
+ }
130
+
131
+ function dismissOutside(event) {
132
+ if (!open || event.composedPath().includes(wrapper)) return;
133
+ finish(false);
134
+ }
135
+
136
+ </script>
137
+
138
+ <svelte:window onpointerdown={dismissOutside} />
139
+
140
+ <div data-ds-component="menu" class="menu" bind:this={wrapper}>
141
+ {#if trigger}
142
+ {@render trigger({ expanded: open, controls: id, onclick: triggerClick, onkeydown: triggerKeydown })}
143
+ {:else}
144
+ <button class="trigger" type="button" aria-haspopup="menu" aria-expanded={open} aria-controls={id}
145
+ {disabled} onclick={triggerClick} onkeydown={triggerKeydown}>
146
+ {triggerLabel ?? label} <span class="caret" aria-hidden="true"></span>
147
+ </button>
148
+ {/if}
149
+ <div id={id} bind:this={panel}
150
+ {@attach node => attachOverlay(triggerElement(), node, open, {
151
+ emphasizeAnchor: width === 'trigger' ? 'match' : true, onAnchorHidden: () => finish(false),
152
+ })}
153
+ class={['panel', { compact: size === 'sm' }]}
154
+ popover="auto" hidden={!open} role="menu" aria-label={path.at(-1)?.label ?? label} tabindex="-1"
155
+ onkeydown={handleKeys} ontoggle={handleToggle}>
156
+ {#each groups as group, groupIndex (group.items[0].id)}
157
+ {#if groupIndex > 0}<div class="divider" role="separator"></div>{/if}
158
+ <div role="group" aria-labelledby={group.label ? id + '-group-' + groupIndex : undefined}>
159
+ {#if group.label}<div class="group-label" id={id + '-group-' + groupIndex}>{group.label}</div>{/if}
160
+ {#each group.items as item (item.id)}
161
+ <button type="button"
162
+ role={item.kind === 'checkbox' ? 'menuitemcheckbox' : item.kind === 'radio' ? 'menuitemradio' : 'menuitem'}
163
+ aria-checked={item.kind === 'checkbox' || item.kind === 'radio' ? !!item.checked : undefined}
164
+ aria-haspopup={item.children?.length ? 'menu' : undefined}
165
+ aria-expanded={item.children?.length ? false : undefined}
166
+ class={['item', { critical: item.critical, selected: item.kind === 'radio' && item.checked }]}
167
+ disabled={item.disabled} tabindex="-1" data-menu-item={item.id} onclick={() => choose(item)}>
168
+ {#if item.kind === 'checkbox'}
169
+ <span class={['checkbox', { checked: item.checked }]} aria-hidden="true"></span>
170
+ {:else if item.icon}
171
+ <span class="item-icon" aria-hidden="true"><item.icon size={size === 'sm' ? 14 : 16} /></span>
172
+ {/if}
173
+ <span class="item-label">{item.label}</span>
174
+ {#if item.children?.length}<span class="arrow" aria-hidden="true"></span>{/if}
175
+ </button>
176
+ {/each}
177
+ </div>
178
+ {/each}
179
+ </div>
180
+ </div>
181
+
182
+ <style>
183
+ .menu { display: inline-block; max-inline-size: 100%; }
184
+ .trigger, .item {
185
+ font: var(--ds-draft-type-body-font-weight) var(--ds-draft-type-body-font-size) / var(--ds-draft-type-body-line-height) var(--ds-draft-type-body-font-family);
186
+ color: var(--ds-draft-fg-neutral);
187
+ }
188
+ .trigger {
189
+ display: inline-flex;
190
+ align-items: center;
191
+ gap: var(--ds-draft-dimension-x2);
192
+ min-block-size: var(--ds-draft-dimension-x8);
193
+ padding-inline: var(--ds-draft-dimension-x2);
194
+ border: 1px solid var(--ds-draft-stroke-neutral);
195
+ border-radius: var(--ds-draft-radius-r2);
196
+ background: var(--ds-draft-bg-layer-floating);
197
+ cursor: pointer;
198
+ text-align: start;
199
+ }
200
+ .trigger:not(:disabled):is(:hover, [aria-expanded='true']) { background: var(--ds-draft-bg-layer-floating-pressed); }
201
+ :is(.trigger, .item):focus-visible { outline: 2px solid var(--ds-draft-stroke-neutral-focused); outline-offset: -2px; }
202
+ :is(.trigger, .item):disabled { color: var(--ds-draft-fg-disabled); cursor: default; }
203
+ .panel {
204
+ position: fixed;
205
+ z-index: 10;
206
+ inset: auto;
207
+ margin: 0;
208
+ box-sizing: border-box;
209
+ overflow: auto;
210
+ overscroll-behavior: contain;
211
+ inline-size: max-content;
212
+ padding: var(--ds-draft-dimension-x1);
213
+ border: 1px solid var(--ds-draft-stroke-neutral);
214
+ border-radius: var(--ds-draft-radius-r3);
215
+ background: var(--ds-draft-bg-layer-floating);
216
+ box-shadow: var(--ds-draft-shadow-s2);
217
+ }
218
+ .panel[hidden] { display: none; }
219
+ .item {
220
+ display: flex;
221
+ align-items: center;
222
+ gap: var(--ds-draft-dimension-x2);
223
+ inline-size: 100%;
224
+ min-block-size: var(--ds-draft-dimension-x8);
225
+ padding: 0 var(--ds-draft-dimension-x2);
226
+ border: 0;
227
+ border-radius: var(--ds-draft-radius-r2);
228
+ text-align: start;
229
+ background: transparent;
230
+ cursor: pointer;
231
+ }
232
+ .compact .item { min-block-size: var(--ds-draft-dimension-x7); }
233
+ .item:not(:disabled):is(:hover, :active) { background: var(--ds-draft-bg-layer-floating-pressed); }
234
+ .item.critical:not(:disabled) { color: var(--ds-draft-fg-critical-contrast); }
235
+ .item.selected:not(:disabled) { color: var(--ds-draft-primary-500); background: var(--ds-draft-primary-50); }
236
+ .item.selected:not(:disabled):is(:hover, :active) { background: var(--ds-draft-bg-primary-weak); }
237
+ .item-icon { display: flex; color: var(--ds-draft-fg-neutral-muted); }
238
+ .item:is(.critical, .selected, :disabled) .item-icon { color: inherit; }
239
+ .item-label { overflow-wrap: anywhere; }
240
+ .caret, .arrow {
241
+ flex: none;
242
+ inline-size: var(--ds-draft-dimension-x1-5);
243
+ block-size: var(--ds-draft-dimension-x1-5);
244
+ border-block-end: 1.5px solid currentColor;
245
+ border-inline-end: 1.5px solid currentColor;
246
+ transform: rotate(45deg);
247
+ }
248
+ .arrow { transform: rotate(-45deg); margin-inline-start: auto; }
249
+ .arrow:dir(rtl) { transform: rotate(45deg); }
250
+ .checkbox {
251
+ position: relative;
252
+ flex: none;
253
+ box-sizing: border-box;
254
+ inline-size: var(--ds-draft-dimension-x4);
255
+ aspect-ratio: 1;
256
+ border: 1px solid var(--ds-draft-stroke-neutral);
257
+ border-radius: var(--ds-draft-radius-r1);
258
+ background: var(--ds-draft-bg-layer-floating);
259
+ }
260
+ .checkbox.checked { border-color: transparent; background: var(--ds-draft-bg-primary-solid); }
261
+ .checkbox.checked::after {
262
+ content: '';
263
+ position: absolute;
264
+ inset: 21% 27% 28% 33%;
265
+ transform: rotate(45deg);
266
+ border: solid var(--ds-draft-fg-neutral-inverted);
267
+ border-width: 0 1.5px 1.5px 0;
268
+ }
269
+ .item:disabled .checkbox { background: var(--ds-draft-bg-neutral-weak); }
270
+ .item:disabled .checkbox.checked { background: var(--ds-draft-fg-disabled); }
271
+ .divider { height: 1px; margin: var(--ds-draft-dimension-x1) var(--ds-draft-dimension-x2); background: var(--ds-draft-stroke-neutral); }
272
+ .group-label {
273
+ padding: var(--ds-draft-dimension-x2) var(--ds-draft-dimension-x2) var(--ds-draft-dimension-x1);
274
+ color: var(--ds-draft-fg-neutral-subtle);
275
+ font: var(--ds-draft-type-sub-font-weight) var(--ds-draft-type-sub-font-size) / var(--ds-draft-type-sub-line-height) var(--ds-draft-type-sub-font-family);
276
+ }
277
+ </style>
@@ -0,0 +1,86 @@
1
+ <script>
2
+ import './draft.css';
3
+
4
+ const heading = $props.id();
5
+ let { title, open = $bindable(false), closeLabel = '닫기', children, footer, onclose } = $props();
6
+ function syncDialog(dialog, show) {
7
+ if (show && !dialog.open) dialog.showModal();
8
+ if (!show && dialog.open) dialog.close();
9
+ }
10
+
11
+ function handleClose(event) {
12
+ const dialog = event.currentTarget;
13
+ if (dialog.open) return;
14
+ dialog.returnValue = '';
15
+ open = false;
16
+ onclose?.();
17
+ }
18
+ </script>
19
+
20
+ <dialog data-ds-component="modal" aria-labelledby={heading}
21
+ {@attach dialog => syncDialog(dialog, open)} onclose={handleClose}>
22
+ <header>
23
+ <h2 id={heading}>{title}</h2>
24
+ <button type="button" aria-label={closeLabel} onclick={(event) => event.currentTarget.closest('dialog')?.close()}>
25
+ <span aria-hidden="true">×</span>
26
+ </button>
27
+ </header>
28
+ <div class="body">{@render children()}</div>
29
+ {#if footer}<footer>{@render footer()}</footer>{/if}
30
+ </dialog>
31
+
32
+ <style>
33
+ dialog {
34
+ box-sizing: border-box;
35
+ padding: 0;
36
+ inline-size: max-content;
37
+ min-inline-size: min(18rem, calc(100% - var(--ds-draft-dimension-x8)));
38
+ max-inline-size: calc(100% - var(--ds-draft-dimension-x8));
39
+ max-block-size: calc(100% - var(--ds-draft-dimension-x8));
40
+ overflow: hidden;
41
+ border: 0;
42
+ border-radius: var(--ds-draft-radius-r5);
43
+ color: var(--ds-draft-fg-neutral);
44
+ background: var(--ds-draft-bg-layer-floating);
45
+ box-shadow: var(--ds-draft-shadow-s3);
46
+ font-family: var(--ds-draft-type-body-font-family);
47
+ }
48
+ dialog[open] { display: flex; flex-direction: column; }
49
+ dialog:modal { margin: auto; overscroll-behavior: contain; }
50
+ dialog::backdrop {
51
+ background: color-mix(in srgb, var(--ds-draft-gray-900) 40%, transparent);
52
+ overflow: hidden;
53
+ overscroll-behavior: contain;
54
+ }
55
+ header, footer { flex: none; padding: var(--ds-draft-dimension-x4); }
56
+ header {
57
+ display: flex;
58
+ align-items: center;
59
+ justify-content: space-between;
60
+ gap: var(--ds-draft-dimension-x4);
61
+ border-block-end: 1px solid var(--ds-draft-stroke-neutral-weak);
62
+ }
63
+ footer { border-block-start: 1px solid var(--ds-draft-stroke-neutral-weak); }
64
+ h2 {
65
+ margin: 0;
66
+ color: var(--ds-draft-fg-neutral-contrast);
67
+ font-size: var(--ds-draft-type-title-font-size);
68
+ font-weight: var(--ds-draft-type-title-font-weight);
69
+ }
70
+ button {
71
+ display: grid;
72
+ place-items: center;
73
+ inline-size: var(--ds-draft-dimension-x8);
74
+ block-size: var(--ds-draft-dimension-x8);
75
+ border: 0;
76
+ border-radius: var(--ds-draft-radius-r2);
77
+ background: var(--ds-draft-bg-neutral-weak);
78
+ color: var(--ds-draft-fg-neutral);
79
+ cursor: pointer;
80
+ font: inherit;
81
+ font-size: var(--ds-draft-dimension-x5);
82
+ }
83
+ button:hover { background: var(--ds-draft-bg-neutral-weak-pressed); }
84
+ button:focus-visible { outline: 2px solid var(--ds-draft-stroke-neutral-focused); }
85
+ .body { overflow: auto; overscroll-behavior: contain; padding: var(--ds-draft-dimension-x4); }
86
+ </style>
@@ -0,0 +1,87 @@
1
+ <script>
2
+ import './draft.css';
3
+
4
+ let { label, items, current, logo, utilities } = $props();
5
+ </script>
6
+
7
+ <nav data-ds-component="navigation" aria-label={label}>
8
+ {#if logo}<div class="logo">{@render logo()}</div>{/if}
9
+ <ul>
10
+ {#each items as item, index (item.id)}
11
+ <li class={{ separator: index > 0 && item.group !== items[index - 1].group }}>
12
+ <a href={item.href} aria-current={item.id === current ? 'page' : undefined}>
13
+ <span class="icon" aria-hidden="true">
14
+ <item.icon size={item.featured ? 32 : 24} />
15
+ {#if item.dot}<span class="dot"></span>{/if}
16
+ </span>
17
+ <span class="label">{item.label}</span>
18
+ </a>
19
+ </li>
20
+ {/each}
21
+ </ul>
22
+ {#if utilities}<div class="utilities">{@render utilities()}</div>{/if}
23
+ </nav>
24
+
25
+ <style>
26
+ nav {
27
+ box-sizing: border-box;
28
+ inline-size: var(--ds-draft-dimension-x16);
29
+ display: flex;
30
+ flex-direction: column;
31
+ background: var(--ds-draft-bg-layer-basement);
32
+ border-inline-end: 1px solid var(--ds-draft-stroke-neutral);
33
+ }
34
+ .logo { display: grid; place-items: center; block-size: var(--ds-draft-dimension-x12); }
35
+ ul {
36
+ display: flex;
37
+ flex-direction: column;
38
+ gap: var(--ds-draft-dimension-x4);
39
+ padding: var(--ds-draft-dimension-x2) var(--ds-draft-dimension-x1);
40
+ margin: 0;
41
+ list-style: none;
42
+ }
43
+ .separator {
44
+ padding-block-start: var(--ds-draft-dimension-x4);
45
+ border-block-start: 1px solid var(--ds-draft-stroke-neutral);
46
+ }
47
+ a {
48
+ display: flex;
49
+ flex-direction: column;
50
+ align-items: center;
51
+ gap: var(--ds-draft-dimension-x1);
52
+ min-inline-size: 0;
53
+ color: var(--ds-draft-fg-disabled);
54
+ text-decoration: none;
55
+ border-radius: var(--ds-draft-radius-r1-5);
56
+ font: var(--ds-draft-type-sub-font-weight) var(--ds-draft-type-sub-font-size) / var(--ds-draft-type-sub-line-height) var(--ds-draft-type-sub-font-family);
57
+ }
58
+ a:is(:hover, :active, [aria-current='page']) { color: var(--ds-draft-fg-neutral); }
59
+ a:focus-visible { outline: 2px solid var(--ds-draft-stroke-neutral-focused); }
60
+ .icon {
61
+ position: relative;
62
+ display: grid;
63
+ place-items: center;
64
+ inline-size: var(--ds-draft-dimension-x8);
65
+ block-size: var(--ds-draft-dimension-x8);
66
+ border-radius: var(--ds-draft-radius-r1-5);
67
+ }
68
+ a:is(:hover, :active, [aria-current='page']) .icon { background: var(--ds-draft-bg-layer-basement-pressed); }
69
+ .label { max-inline-size: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
70
+ .dot {
71
+ position: absolute;
72
+ inset-block-start: 2px;
73
+ inset-inline-end: 2px;
74
+ inline-size: var(--ds-draft-dimension-x1-5);
75
+ aspect-ratio: 1;
76
+ border-radius: var(--ds-draft-radius-full);
77
+ background: var(--ds-draft-bg-critical-solid);
78
+ }
79
+ .utilities {
80
+ display: grid;
81
+ justify-items: center;
82
+ gap: var(--ds-draft-dimension-x2);
83
+ margin: auto var(--ds-draft-dimension-x1) 0;
84
+ padding: var(--ds-draft-dimension-x2) 0;
85
+ border-block-start: 1px solid var(--ds-draft-stroke-neutral);
86
+ }
87
+ </style>
@@ -0,0 +1,81 @@
1
+ <script>
2
+ import './display.css';
3
+
4
+ let { scope, actions, scopeLabel = '콘텐츠 범위', actionsLabel = '페이지 동작', divider = false } = $props();
5
+
6
+ function allowKeyboardScroll(area) {
7
+ function measure() {
8
+ if (area.scrollWidth > area.clientWidth) area.setAttribute('tabindex', '0');
9
+ else area.removeAttribute('tabindex');
10
+ }
11
+
12
+ function revealFocusedChild(event) {
13
+ if (event.target === area || area.scrollWidth <= area.clientWidth) return;
14
+ const bounds = area.getBoundingClientRect();
15
+ const child = event.target.getBoundingClientRect();
16
+ if (child.left < bounds.left) area.scrollLeft += child.left - bounds.left;
17
+ else if (child.right > bounds.right) area.scrollLeft += child.right - bounds.right;
18
+ }
19
+
20
+ measure();
21
+ const observer = new ResizeObserver(measure);
22
+ observer.observe(area);
23
+ observer.observe(area.firstElementChild);
24
+ area.addEventListener('focusin', revealFocusedChild);
25
+ return () => {
26
+ observer.disconnect();
27
+ area.removeEventListener('focusin', revealFocusedChild);
28
+ };
29
+ }
30
+ </script>
31
+
32
+ <header data-ds-component="page-header" data-ds-display="page-header" class={{ divider }}>
33
+ {#if scope}
34
+ <div class="area" role="group" aria-label={scopeLabel} {@attach allowKeyboardScroll}>
35
+ <div class="row">{@render scope()}</div>
36
+ </div>
37
+ {/if}
38
+ {#if actions}
39
+ <div class="area actions" role="group" aria-label={actionsLabel} {@attach allowKeyboardScroll}>
40
+ <div class="row">{@render actions()}</div>
41
+ </div>
42
+ {/if}
43
+ </header>
44
+
45
+ <style>
46
+ header {
47
+ box-sizing: border-box;
48
+ display: flex;
49
+ direction: ltr;
50
+ flex-wrap: wrap;
51
+ align-items: center;
52
+ gap: var(--ds-display-container-column-gap);
53
+ min-block-size: var(--ds-display-container-min-height);
54
+ padding-block: var(--ds-display-container-padding-block);
55
+ padding-left: var(--ds-display-container-padding-inline);
56
+ padding-right: var(--ds-display-container-padding-inline-end);
57
+ background: var(--ds-display-container-background-color);
58
+ }
59
+ .divider {
60
+ box-shadow: inset 0 calc(-1 * var(--ds-display-container-border-width)) 0 var(--ds-display-container-border-color);
61
+ }
62
+ .area {
63
+ flex: 0 1 max-content;
64
+ min-inline-size: 0;
65
+ max-inline-size: 100%;
66
+ overflow-x: auto;
67
+ scrollbar-width: none;
68
+ }
69
+ .actions {
70
+ margin-left: auto;
71
+ direction: rtl;
72
+ }
73
+ .row {
74
+ display: flex;
75
+ align-items: center;
76
+ inline-size: max-content;
77
+ white-space: nowrap;
78
+ }
79
+ .row { direction: ltr; }
80
+ .row:dir(rtl) { direction: rtl; }
81
+ </style>