@hyvor/design 2.0.15 → 2.0.17

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.
@@ -12,7 +12,6 @@
12
12
  import IconDiscord from '@hyvor/icons/IconDiscord';
13
13
  import IconInfoCircle from '@hyvor/icons/IconInfoCircle';
14
14
  import IconFileEarmark from '@hyvor/icons/IconFileEarmark';
15
- import IconChatDots from '@hyvor/icons/IconChatDots';
16
15
  import IconBluesky from '@hyvor/icons/IconBluesky';
17
16
  import IconLinkedin from '@hyvor/icons/IconLinkedin';
18
17
  import type { BarConfig } from './bar.js';
@@ -34,14 +33,6 @@
34
33
 
35
34
  const cloudContext = $derived(getCloudContext());
36
35
 
37
- function openLiveChat(e: any) {
38
- e.preventDefault();
39
- if ((window as any).$crisp) {
40
- (window as any).$crisp.push(['do', 'chat:open']);
41
- }
42
- supportDropdown = false;
43
- }
44
-
45
36
  function getName() {
46
37
  if (config.name) {
47
38
  return config.name;
@@ -107,19 +98,6 @@
107
98
  </ActionListItem>
108
99
  </a>
109
100
  {/if}
110
- {#if config.chat}
111
- <a href="/chat" onclick={openLiveChat}>
112
- <ActionListItem>
113
- Live Chat
114
- {#snippet description()}
115
- <div>Chat with our team</div>
116
- {/snippet}
117
- {#snippet start()}
118
- <IconChatDots />
119
- {/snippet}
120
- </ActionListItem>
121
- </a>
122
- {/if}
123
101
 
124
102
  <ActionListGroup title="Social">
125
103
  <a href={SOCIAL_LINKS.discord} target="_blank">
@@ -6,7 +6,7 @@
6
6
  type CloudContextOrganization
7
7
  } from '../CloudContext/cloudContextState.svelte.js';
8
8
  import OrganizationSwitcher from '../OrganizationSwitcher/OrganizationSwitcher.svelte';
9
- import Accordian from './Accordian.svelte';
9
+ import Accordion from '../../components/Accordion/Accordion.svelte';
10
10
  import TextInput from '../../components/TextInput/TextInput.svelte';
11
11
  import SplitControl from '../../components/SplitControl/SplitControl.svelte';
12
12
  import IconInfoCircle from '@hyvor/icons/IconInfoCircle';
@@ -129,7 +129,7 @@
129
129
 
130
130
  <div class="content">
131
131
  {#if deployment === 'cloud'}
132
- <Accordian
132
+ <Accordion
133
133
  title="Organization"
134
134
  belowTitle={organization?.name}
135
135
  show={organizationAccordianOpen}
@@ -184,10 +184,10 @@
184
184
  </div>
185
185
  </div>
186
186
  {/if}
187
- </Accordian>
187
+ </Accordion>
188
188
  {/if}
189
189
 
190
- <Accordian
190
+ <Accordion
191
191
  title={resourceTitle}
192
192
  show={contentAccordianOpen}
193
193
  buttonText={cta}
@@ -208,7 +208,7 @@
208
208
  create: handleResourceCreation
209
209
  })}
210
210
  </div>
211
- </Accordian>
211
+ </Accordion>
212
212
  </div>
213
213
  </div>
214
214
  </div>
@@ -1,143 +1,147 @@
1
1
  <script lang="ts">
2
- import type { Component, Snippet } from 'svelte';
3
- import IconCaretDownFill from '@hyvor/icons/IconCaretDownFill';
2
+ import { Button, Loader } from '../index.js';
3
+ import { type Snippet } from 'svelte';
4
+ import { slide } from 'svelte/transition';
4
5
 
5
- interface Props {
6
+ type Props = {
7
+ show: boolean;
6
8
  title: string;
7
- children?: Snippet;
8
- open?: boolean;
9
- icon?: Component;
10
- headerColor?: string;
11
- textColor?: string;
12
- openedColor?: string;
13
- borderColor?: string;
14
- topBorderColor?: string;
15
- }
9
+ belowTitle?: Snippet | string;
10
+ buttonText: string;
11
+ buttonDisabled?: boolean;
12
+ children: Snippet;
13
+ onButtonClick: () => void;
14
+ onToggle: () => void;
15
+ toggleLocked?: boolean;
16
+ complete?: boolean;
17
+ footer?: boolean;
18
+ loading?: boolean;
19
+ };
16
20
 
17
21
  let {
22
+ show = false,
18
23
  title,
19
24
  children,
20
- open = $bindable(false),
21
- icon,
22
- headerColor,
23
- textColor,
24
- openedColor,
25
- borderColor,
26
- topBorderColor
25
+ buttonText,
26
+ buttonDisabled,
27
+ onButtonClick,
28
+ onToggle,
29
+ toggleLocked = false,
30
+ complete,
31
+ belowTitle,
32
+ footer = true,
33
+ loading = $bindable(false)
27
34
  }: Props = $props();
28
35
 
29
- const Icon = icon;
36
+ let contentEl: HTMLElement;
37
+
38
+ let heightAutoTimeout: ReturnType<typeof setTimeout>;
30
39
 
31
- function handleClick() {
32
- open = !open;
40
+ function setHeight(show: boolean) {
41
+ if (!contentEl) return;
42
+ if (show) {
43
+ contentEl.style.height = contentEl.scrollHeight + 'px';
44
+ } else {
45
+ contentEl.style.height = contentEl.scrollHeight + 'px';
46
+ setTimeout(() => {
47
+ contentEl.style.height = '0px';
48
+ }, 0);
49
+ }
50
+
51
+ clearTimeout(heightAutoTimeout);
52
+ heightAutoTimeout = setTimeout(() => {
53
+ if (show) {
54
+ contentEl.style.height = 'auto';
55
+ }
56
+ }, 300);
33
57
  }
34
- </script>
35
58
 
36
- <div
37
- class="accordion-item"
38
- style:--custom-border={borderColor}
39
- style:--custom-text={textColor}
40
- style:--custom-opened={openedColor}
41
- style:--custom-header={headerColor}
42
- >
43
- <button class="accordion-header" class:open onclick={handleClick}>
44
- {#if icon}
45
- <span class="icon">
46
- <Icon size={20} />
47
- </span>
48
- {/if}
49
- <span class="title">{title}</span>
50
- <span class="chevron" class:rotated={open}>
51
- <IconCaretDownFill />
52
- </span>
53
- </button>
59
+ function toggle() {
60
+ if (toggleLocked) return;
61
+ const showBefore = show;
62
+ onToggle();
63
+ if (showBefore === show) return;
64
+ setHeight(show);
65
+ }
66
+
67
+ $effect(() => {
68
+ setHeight(show);
69
+ });
70
+ </script>
54
71
 
55
- <div class="accordion-content" class:show={open}>
56
- <div
57
- class="content-text"
58
- style:--custom-top-border={topBorderColor}
59
- style:--custom-header={headerColor}
60
- >
61
- {@render children?.()}
72
+ <div class="accordion" class:show class:complete>
73
+ <button class="title-wrap" onclick={toggle}>
74
+ <div class="left">
75
+ <div class="title">
76
+ {title}
77
+ </div>
78
+ {#if belowTitle}
79
+ {#if typeof belowTitle === 'string'}
80
+ {belowTitle}
81
+ {:else}
82
+ {@render belowTitle()}
83
+ {/if}
84
+ {/if}
62
85
  </div>
86
+ <!-- <Dot {complete} /> -->
87
+ </button>
88
+ <div class="content" bind:this={contentEl} transition:slide={{ axis: 'y' }}>
89
+ {@render children()}
90
+
91
+ {#if footer}
92
+ <div class="footer">
93
+ <div class="button-wrap">
94
+ {#if loading}
95
+ <Loader size="small" />
96
+ {/if}
97
+ <Button size="large" onclick={onButtonClick} disabled={loading || buttonDisabled}
98
+ >{buttonText}</Button
99
+ >
100
+ </div>
101
+ </div>
102
+ {/if}
63
103
  </div>
64
104
  </div>
65
105
 
66
106
  <style>
67
- .accordion-item {
68
- overflow: hidden;
107
+ .accordion {
108
+ border: 1px solid #eee;
69
109
  border-radius: 20px;
70
- border: 1px solid var(--custom-border, var(--border));
71
110
  }
72
-
73
- .accordion-header {
74
- width: 100%;
75
- padding: 14px 20px;
76
- background: var(--custom-header, none);
77
- border: none;
111
+ .title-wrap {
78
112
  display: flex;
79
- justify-content: space-between;
113
+ text-align: left;
80
114
  align-items: center;
115
+ padding: 15px 20px;
116
+ border-radius: 20px 20px 0 0;
81
117
  cursor: pointer;
82
- font-size: 16px;
83
- border-radius: 20px;
84
- color: var(--custom-text, var(--text));
118
+ width: 100%;
85
119
  }
86
-
87
- .accordion-header.open {
88
- border-radius: 20px 20px 0 0;
89
- background-color: var(--custom-opened, var(--hover));
120
+ .title-wrap .left {
121
+ flex: 1;
90
122
  }
91
-
92
123
  .title {
93
- font-weight: 500;
94
- text-align: left;
95
- }
96
-
97
- .chevron {
98
- display: flex;
99
- align-items: center;
100
- transition: transform 0.3s ease;
101
- color: var(--custom-text, var(--text));
124
+ font-weight: 600;
102
125
  }
103
-
104
- .chevron.rotated {
105
- transform: rotate(180deg);
126
+ .show .title-wrap {
127
+ background-color: var(--hover);
128
+ border-bottom: 1px solid #eee;
106
129
  }
107
130
 
108
- .accordion-content {
109
- height: 0;
131
+ .content {
110
132
  overflow: hidden;
133
+ height: 0;
134
+ transition: height 0.3s;
111
135
  }
112
-
113
- .accordion-content.show {
114
- height: auto;
115
- overflow: visible;
116
- animation: slideDown 0.3s ease-out;
117
- }
118
-
119
- .content-text {
120
- padding: 20px;
121
- color: var(--custom-text, var(--text));
122
- line-height: 1.6;
123
- border-top: 1px solid var(--custom-top-border, var(--border));
124
- background: var(--custom-header, none);
125
- }
126
-
127
- .icon {
128
- display: inline-block;
129
- margin-right: 10px;
130
- vertical-align: middle;
136
+ .footer {
137
+ padding: 10px 20px;
138
+ border-top: 1px solid #eee;
131
139
  }
132
140
 
133
- @keyframes slideDown {
134
- from {
135
- opacity: 0;
136
- transform: translateY(-10px);
137
- }
138
- to {
139
- opacity: 1;
140
- transform: translateY(0);
141
- }
141
+ .button-wrap {
142
+ display: flex;
143
+ justify-content: flex-end;
144
+ align-items: center;
145
+ gap: 10px;
142
146
  }
143
147
  </style>
@@ -1,15 +1,18 @@
1
- import type { Component, Snippet } from 'svelte';
2
- interface Props {
1
+ import { type Snippet } from 'svelte';
2
+ type Props = {
3
+ show: boolean;
3
4
  title: string;
4
- children?: Snippet;
5
- open?: boolean;
6
- icon?: Component;
7
- headerColor?: string;
8
- textColor?: string;
9
- openedColor?: string;
10
- borderColor?: string;
11
- topBorderColor?: string;
12
- }
13
- declare const Accordion: Component<Props, {}, "open">;
5
+ belowTitle?: Snippet | string;
6
+ buttonText: string;
7
+ buttonDisabled?: boolean;
8
+ children: Snippet;
9
+ onButtonClick: () => void;
10
+ onToggle: () => void;
11
+ toggleLocked?: boolean;
12
+ complete?: boolean;
13
+ footer?: boolean;
14
+ loading?: boolean;
15
+ };
16
+ declare const Accordion: import("svelte").Component<Props, {}, "loading">;
14
17
  type Accordion = ReturnType<typeof Accordion>;
15
18
  export default Accordion;
@@ -4,7 +4,7 @@
4
4
  size?: number;
5
5
  }
6
6
 
7
- let { logo, size = 100 }: Props = $props();
7
+ let { logo, size = 80 }: Props = $props();
8
8
  </script>
9
9
 
10
10
  <div class="loader">
@@ -0,0 +1,70 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import IconCheckCircleFill from '@hyvor/icons/IconCheckCircleFill';
4
+ import IconXCircleFill from '@hyvor/icons/IconXCircleFill';
5
+ import IconDashCircleFill from '@hyvor/icons/IconDashCircleFill';
6
+
7
+ interface Props {
8
+ status: 'positive' | 'negative' | 'neutral';
9
+ text?: string;
10
+ iconSize?: number;
11
+ fontSize?: string;
12
+ color?: string;
13
+ icon?: Snippet | false;
14
+ }
15
+
16
+ let {
17
+ status,
18
+ text = undefined,
19
+ iconSize = 20,
20
+ fontSize = undefined,
21
+ color = undefined,
22
+ icon = undefined
23
+ }: Props = $props();
24
+
25
+ let resolvedText = $derived(
26
+ text ?? (status === 'positive' ? 'Yes' : status === 'negative' ? 'No' : '')
27
+ );
28
+
29
+ let resolvedColor = $derived(
30
+ color ??
31
+ (status === 'positive'
32
+ ? 'var(--green)'
33
+ : status === 'negative'
34
+ ? 'var(--red)'
35
+ : 'var(--text-light)')
36
+ );
37
+ </script>
38
+
39
+ <span class="ternary-status" style:color={resolvedColor} style:font-size={fontSize}>
40
+ {#if icon !== false}
41
+ <span class="icon">
42
+ {#if icon}
43
+ {@render icon()}
44
+ {:else if status === 'positive'}
45
+ <IconCheckCircleFill size={iconSize} />
46
+ {:else if status === 'negative'}
47
+ <IconXCircleFill size={iconSize} />
48
+ {:else}
49
+ <IconDashCircleFill size={iconSize} />
50
+ {/if}
51
+ </span>
52
+ {/if}
53
+ {#if resolvedText}
54
+ <span class="text">{resolvedText}</span>
55
+ {/if}
56
+ </span>
57
+
58
+ <style>
59
+ .ternary-status {
60
+ display: inline-flex;
61
+ align-items: center;
62
+ gap: 8px;
63
+ }
64
+
65
+ .icon {
66
+ display: inline-flex;
67
+ align-items: center;
68
+ flex-shrink: 0;
69
+ }
70
+ </style>
@@ -0,0 +1,12 @@
1
+ import type { Snippet } from 'svelte';
2
+ interface Props {
3
+ status: 'positive' | 'negative' | 'neutral';
4
+ text?: string;
5
+ iconSize?: number;
6
+ fontSize?: string;
7
+ color?: string;
8
+ icon?: Snippet | false;
9
+ }
10
+ declare const TernaryStatus: import("svelte").Component<Props, {}, "">;
11
+ type TernaryStatus = ReturnType<typeof TernaryStatus>;
12
+ export default TernaryStatus;
@@ -49,6 +49,7 @@ export { default as TableCell } from './Table/TableCell.svelte';
49
49
  export { default as TabNav } from './TabNav/TabNav.svelte';
50
50
  export { default as TabNavItem } from './TabNav/TabNavItem.svelte';
51
51
  export { default as Tag } from './Tag/Tag.svelte';
52
+ export { default as TernaryStatus } from './TernaryStatus/TernaryStatus.svelte';
52
53
  export { default as Textarea } from './Textarea/Textarea.svelte';
53
54
  export { default as Text } from './Text/Text.svelte';
54
55
  export { default as TextInput } from './TextInput/TextInput.svelte';
@@ -49,6 +49,7 @@ export { default as TableCell } from './Table/TableCell.svelte';
49
49
  export { default as TabNav } from './TabNav/TabNav.svelte';
50
50
  export { default as TabNavItem } from './TabNav/TabNavItem.svelte';
51
51
  export { default as Tag } from './Tag/Tag.svelte';
52
+ export { default as TernaryStatus } from './TernaryStatus/TernaryStatus.svelte';
52
53
  export { default as Textarea } from './Textarea/Textarea.svelte';
53
54
  export { default as Text } from './Text/Text.svelte';
54
55
  export { default as TextInput } from './TextInput/TextInput.svelte';
@@ -0,0 +1,143 @@
1
+ <script lang="ts">
2
+ import type { Component, Snippet } from 'svelte';
3
+ import IconCaretDownFill from '@hyvor/icons/IconCaretDownFill';
4
+
5
+ interface Props {
6
+ title: string;
7
+ children?: Snippet;
8
+ open?: boolean;
9
+ icon?: Component;
10
+ headerColor?: string;
11
+ textColor?: string;
12
+ openedColor?: string;
13
+ borderColor?: string;
14
+ topBorderColor?: string;
15
+ }
16
+
17
+ let {
18
+ title,
19
+ children,
20
+ open = $bindable(false),
21
+ icon,
22
+ headerColor,
23
+ textColor,
24
+ openedColor,
25
+ borderColor,
26
+ topBorderColor
27
+ }: Props = $props();
28
+
29
+ const Icon = icon;
30
+
31
+ function handleClick() {
32
+ open = !open;
33
+ }
34
+ </script>
35
+
36
+ <div
37
+ class="accordion-item"
38
+ style:--custom-border={borderColor}
39
+ style:--custom-text={textColor}
40
+ style:--custom-opened={openedColor}
41
+ style:--custom-header={headerColor}
42
+ >
43
+ <button class="accordion-header" class:open onclick={handleClick}>
44
+ {#if icon}
45
+ <span class="icon">
46
+ <Icon size={20} />
47
+ </span>
48
+ {/if}
49
+ <span class="title">{title}</span>
50
+ <span class="chevron" class:rotated={open}>
51
+ <IconCaretDownFill />
52
+ </span>
53
+ </button>
54
+
55
+ <div class="accordion-content" class:show={open}>
56
+ <div
57
+ class="content-text"
58
+ style:--custom-top-border={topBorderColor}
59
+ style:--custom-header={headerColor}
60
+ >
61
+ {@render children?.()}
62
+ </div>
63
+ </div>
64
+ </div>
65
+
66
+ <style>
67
+ .accordion-item {
68
+ overflow: hidden;
69
+ border-radius: 20px;
70
+ border: 1px solid var(--custom-border, var(--border));
71
+ }
72
+
73
+ .accordion-header {
74
+ width: 100%;
75
+ padding: 14px 20px;
76
+ background: var(--custom-header, none);
77
+ border: none;
78
+ display: flex;
79
+ justify-content: space-between;
80
+ align-items: center;
81
+ cursor: pointer;
82
+ font-size: 16px;
83
+ border-radius: 20px;
84
+ color: var(--custom-text, var(--text));
85
+ }
86
+
87
+ .accordion-header.open {
88
+ border-radius: 20px 20px 0 0;
89
+ background-color: var(--custom-opened, var(--hover));
90
+ }
91
+
92
+ .title {
93
+ font-weight: 500;
94
+ text-align: left;
95
+ }
96
+
97
+ .chevron {
98
+ display: flex;
99
+ align-items: center;
100
+ transition: transform 0.3s ease;
101
+ color: var(--custom-text, var(--text));
102
+ }
103
+
104
+ .chevron.rotated {
105
+ transform: rotate(180deg);
106
+ }
107
+
108
+ .accordion-content {
109
+ height: 0;
110
+ overflow: hidden;
111
+ }
112
+
113
+ .accordion-content.show {
114
+ height: auto;
115
+ overflow: visible;
116
+ animation: slideDown 0.3s ease-out;
117
+ }
118
+
119
+ .content-text {
120
+ padding: 20px;
121
+ color: var(--custom-text, var(--text));
122
+ line-height: 1.6;
123
+ border-top: 1px solid var(--custom-top-border, var(--border));
124
+ background: var(--custom-header, none);
125
+ }
126
+
127
+ .icon {
128
+ display: inline-block;
129
+ margin-right: 10px;
130
+ vertical-align: middle;
131
+ }
132
+
133
+ @keyframes slideDown {
134
+ from {
135
+ opacity: 0;
136
+ transform: translateY(-10px);
137
+ }
138
+ to {
139
+ opacity: 1;
140
+ transform: translateY(0);
141
+ }
142
+ }
143
+ </style>
@@ -0,0 +1,15 @@
1
+ import type { Component, Snippet } from 'svelte';
2
+ interface Props {
3
+ title: string;
4
+ children?: Snippet;
5
+ open?: boolean;
6
+ icon?: Component;
7
+ headerColor?: string;
8
+ textColor?: string;
9
+ openedColor?: string;
10
+ borderColor?: string;
11
+ topBorderColor?: string;
12
+ }
13
+ declare const DetailsAccordion: Component<Props, {}, "open">;
14
+ type DetailsAccordion = ReturnType<typeof DetailsAccordion>;
15
+ export default DetailsAccordion;
@@ -1,3 +1,4 @@
1
+ export { default as Accordion } from './DetailsAccordion/DetailsAccordion.svelte';
1
2
  export { default as Header } from './Header/Header.svelte';
2
3
  export { default as Container } from './Container/Container.svelte';
3
4
  export { default as Docs } from './Docs/Docs.svelte';
@@ -1,3 +1,4 @@
1
+ export { default as Accordion } from './DetailsAccordion/DetailsAccordion.svelte';
1
2
  export { default as Header } from './Header/Header.svelte';
2
3
  export { default as Container } from './Container/Container.svelte';
3
4
  export { default as Docs } from './Docs/Docs.svelte';
@@ -22,11 +22,11 @@
22
22
  * In most cases, no need to extend these colors
23
23
  */
24
24
  --green-light: #cadfca;
25
- --green: #5d995d;
25
+ --green: #4b874b;
26
26
  --green-dark: #335c33;
27
27
 
28
28
  --red-dark: #ab2525;
29
- --red: #db7474;
29
+ --red: #c05959;
30
30
  --red-light: #ffdfdf;
31
31
 
32
32
  --blue-dark: #334b81;
@@ -34,7 +34,7 @@
34
34
  --blue-light: #dae5ff;
35
35
 
36
36
  --orange-dark: #8b5b04;
37
- --orange: #e2b500;
37
+ --orange: #a98526;
38
38
  --orange-light: #efe3b4;
39
39
 
40
40
  --gray-light: #ddd;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyvor/design",
3
- "version": "2.0.15",
3
+ "version": "2.0.17",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "repository": {
@@ -1,147 +0,0 @@
1
- <script lang="ts">
2
- import { Button, Loader } from '../../components/index.js';
3
- import { type Snippet } from 'svelte';
4
- import { slide } from 'svelte/transition';
5
-
6
- type Props = {
7
- show: boolean;
8
- title: string;
9
- belowTitle?: Snippet | string;
10
- buttonText: string;
11
- buttonDisabled?: boolean;
12
- children: Snippet;
13
- onButtonClick: () => void;
14
- onToggle: () => void;
15
- toggleLocked?: boolean;
16
- complete?: boolean;
17
- footer?: boolean;
18
- loading?: boolean;
19
- };
20
-
21
- let {
22
- show = false,
23
- title,
24
- children,
25
- buttonText,
26
- buttonDisabled,
27
- onButtonClick,
28
- onToggle,
29
- toggleLocked = false,
30
- complete,
31
- belowTitle,
32
- footer = true,
33
- loading = $bindable(false)
34
- }: Props = $props();
35
-
36
- let contentEl: HTMLElement;
37
-
38
- let heightAutoTimeout: ReturnType<typeof setTimeout>;
39
-
40
- function setHeight(show: boolean) {
41
- if (!contentEl) return;
42
- if (show) {
43
- contentEl.style.height = contentEl.scrollHeight + 'px';
44
- } else {
45
- contentEl.style.height = contentEl.scrollHeight + 'px';
46
- setTimeout(() => {
47
- contentEl.style.height = '0px';
48
- }, 0);
49
- }
50
-
51
- clearTimeout(heightAutoTimeout);
52
- heightAutoTimeout = setTimeout(() => {
53
- if (show) {
54
- contentEl.style.height = 'auto';
55
- }
56
- }, 300);
57
- }
58
-
59
- function toggle() {
60
- if (toggleLocked) return;
61
- const showBefore = show;
62
- onToggle();
63
- if (showBefore === show) return;
64
- setHeight(show);
65
- }
66
-
67
- $effect(() => {
68
- setHeight(show);
69
- });
70
- </script>
71
-
72
- <div class="accordian" class:show class:complete>
73
- <button class="title-wrap" onclick={toggle}>
74
- <div class="left">
75
- <div class="title">
76
- {title}
77
- </div>
78
- {#if belowTitle}
79
- {#if typeof belowTitle === 'string'}
80
- {belowTitle}
81
- {:else}
82
- {@render belowTitle()}
83
- {/if}
84
- {/if}
85
- </div>
86
- <!-- <Dot {complete} /> -->
87
- </button>
88
- <div class="content" bind:this={contentEl} transition:slide={{ axis: 'y' }}>
89
- {@render children()}
90
-
91
- {#if footer}
92
- <div class="footer">
93
- <div class="button-wrap">
94
- {#if loading}
95
- <Loader size="small" />
96
- {/if}
97
- <Button size="large" onclick={onButtonClick} disabled={loading || buttonDisabled}
98
- >{buttonText}</Button
99
- >
100
- </div>
101
- </div>
102
- {/if}
103
- </div>
104
- </div>
105
-
106
- <style>
107
- .accordian {
108
- border: 1px solid #eee;
109
- border-radius: 20px;
110
- }
111
- .title-wrap {
112
- display: flex;
113
- text-align: left;
114
- align-items: center;
115
- padding: 15px 20px;
116
- border-radius: 20px 20px 0 0;
117
- cursor: pointer;
118
- width: 100%;
119
- }
120
- .title-wrap .left {
121
- flex: 1;
122
- }
123
- .title {
124
- font-weight: 600;
125
- }
126
- .show .title-wrap {
127
- background-color: var(--hover);
128
- border-bottom: 1px solid #eee;
129
- }
130
-
131
- .content {
132
- overflow: hidden;
133
- height: 0;
134
- transition: height 0.3s;
135
- }
136
- .footer {
137
- padding: 10px 20px;
138
- border-top: 1px solid #eee;
139
- }
140
-
141
- .button-wrap {
142
- display: flex;
143
- justify-content: flex-end;
144
- align-items: center;
145
- gap: 10px;
146
- }
147
- </style>
@@ -1,18 +0,0 @@
1
- import { type Snippet } from 'svelte';
2
- type Props = {
3
- show: boolean;
4
- title: string;
5
- belowTitle?: Snippet | string;
6
- buttonText: string;
7
- buttonDisabled?: boolean;
8
- children: Snippet;
9
- onButtonClick: () => void;
10
- onToggle: () => void;
11
- toggleLocked?: boolean;
12
- complete?: boolean;
13
- footer?: boolean;
14
- loading?: boolean;
15
- };
16
- declare const Accordian: import("svelte").Component<Props, {}, "loading">;
17
- type Accordian = ReturnType<typeof Accordian>;
18
- export default Accordian;