@marianmeres/stuic 1.52.0 → 1.53.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.
@@ -22,7 +22,7 @@ export const validate = (el, options) => {
22
22
  if (typeof customValidator === 'function') {
23
23
  el.setCustomValidity(customValidator(el.value, context, el) || '');
24
24
  }
25
- // toto trigerne bubble
25
+ // this triggers the bubble
26
26
  // el.reportValidity();
27
27
  const validityState = el.validity;
28
28
  // prettier-ignore
@@ -25,7 +25,7 @@ export class AlertConfirmPromptConfig {
25
25
  transition-all
26
26
  shadow-xl
27
27
  focus-within:outline-0 focus-within:ring-0
28
- `.trim(),
28
+ `,
29
29
  icon: `
30
30
  size-12 sm:size-10
31
31
  mt-1 mb-4 sm:my-0 sm:mr-5
@@ -33,41 +33,31 @@ export class AlertConfirmPromptConfig {
33
33
  flex flex-shrink-0 items-center justify-center
34
34
  rounded-full
35
35
  bg-neutral-100 text-black/50
36
- `.trim(),
37
- contentBlock: `
38
- mt-3 sm:mt-0 sm:flex-1
39
- `.trim(),
36
+ `,
37
+ contentBlock: `mt-3 sm:mt-0 sm:flex-1`,
40
38
  title: `
41
39
  text-center sm:text-left
42
40
  text-base font-semibold leading-6 text-black/90
43
- `.trim(),
41
+ `,
44
42
  content: `
45
43
  mt-2 mx-3 sm:mx-0
46
44
  text-center sm:text-left
47
45
  text-sm text-black/75
48
- `.trim(),
49
- inputBox: `
50
- mt-3
51
- `.trim(),
52
- inputField: `
53
- m-0
54
- `.trim(),
46
+ `,
47
+ inputBox: `mt-3`,
48
+ inputField: `m-0`,
55
49
  menu: `
56
50
  mt-6
57
51
  sm:flex sm:space-x-4 justify-end
58
52
  space-y-3 sm:space-y-0
59
- `.trim(),
60
- menuLi: `
61
- flex-1 sm:flex-none w-full sm:w-auto sm:inline-block
62
- `.trim(),
63
- button: `
64
- w-full min-w-24 text-center inline-block
65
- `.trim(),
53
+ `,
54
+ menuLi: `flex-1 sm:flex-none w-full sm:w-auto sm:inline-block`,
55
+ button: `w-full min-w-24 text-center inline-block`,
66
56
  spinnerBox: `
67
57
  absolute inset-0 flex justify-center items-center
68
58
  rounded-lg
69
59
  bg-white/75
70
- `.trim()
60
+ `
71
61
  };
72
62
  // prettier-ignore
73
63
  static presetByVariant = {
@@ -1,7 +1,6 @@
1
1
  <script context="module">import { slide } from "svelte/transition";
2
2
  import { twMerge } from "tailwind-merge";
3
3
  import { Thc, X, isTHCNotEmpty } from "../../index.js";
4
- import { tick } from "svelte";
5
4
  const themes = {
6
5
  primary: "bg-stuic-primary/10 text-stuic-primary dark:bg-stuic-primary dark:text-white/90",
7
6
  secondary: "bg-stuic-secondary/10 text-stuic-secondary dark:bg-stuic-secondary dark:text-white/90",
@@ -28,30 +27,31 @@ const themes = {
28
27
  pink: "bg-pink-100 text-pink-800 dark:bg-pink-800 dark:text-pink-100",
29
28
  rose: "bg-rose-100 text-rose-800 dark:bg-rose-800 dark:text-rose-100"
30
29
  };
30
+ const _PRESET = {
31
+ box: `mb-4 rounded flex text-sm`,
32
+ content: `flex-1 px-4 py-3`,
33
+ dismiss: `
34
+ hover:bg-black/5 dark:hover:bg-black/20
35
+ focus-visible:bg-black/5 focus-visible:hover:bg-black/20 focus-visible:ring-0
36
+ rounded rounded-l-none
37
+ px-3
38
+ flex items-center justify-center
39
+ group
40
+ `,
41
+ x: `opacity-75 group-hover:opacity-100`
42
+ };
31
43
  export class DismissibleMessageConfig {
32
- static preset = {
33
- box: `mb-4 rounded flex text-sm`,
34
- content: `flex-1 px-4 py-3`,
35
- dismiss: `
36
- hover:bg-black/5 dark:hover:bg-black/20
37
- rounded rounded-l-none
38
- px-3
39
- flex items-center justify-center
40
- group
41
- `
42
- };
43
44
  static class = {
44
45
  box: ``,
45
46
  content: ``,
46
- dismiss: ``
47
+ dismiss: ``,
48
+ x: ``
47
49
  };
48
50
  }
49
51
  </script>
50
52
 
51
- <script>let _class = "";
53
+ <script>let _class = {};
52
54
  export { _class as class };
53
- export let classContent = "";
54
- export let classDismiss = "";
55
55
  export let duration = 150;
56
56
  export let message;
57
57
  export let onDismiss = () => message = "";
@@ -64,39 +64,27 @@ $:
64
64
  } else {
65
65
  show = false;
66
66
  }
67
+ const _collectClasses = (k, extra = "") => [
68
+ _PRESET?.[k],
69
+ DismissibleMessageConfig?.class?.[k],
70
+ extra,
71
+ _class?.[k]
72
+ ];
67
73
  </script>
68
74
 
69
75
  <!-- {#if isNotEmpty(message)} -->
70
76
  {#if show}
71
77
  <div
72
- class={twMerge(
73
- DismissibleMessageConfig.preset.box,
74
- DismissibleMessageConfig.class.box,
75
- themes[theme] ?? themes.primary,
76
- _class
77
- )}
78
+ class={twMerge(_collectClasses('box', themes[theme] ?? themes.primary))}
78
79
  transition:slide={{ duration }}
79
80
  >
80
- <div
81
- class={twMerge(
82
- DismissibleMessageConfig.preset.content,
83
- DismissibleMessageConfig.class.content,
84
- classContent
85
- )}
86
- >
81
+ <div class={twMerge(_collectClasses('content'))}>
87
82
  <Thc thc={message} {forceAsHtml} />
88
83
  </div>
89
84
 
90
85
  {#if typeof onDismiss === 'function'}
91
- <button
92
- class={twMerge(
93
- DismissibleMessageConfig.preset.dismiss,
94
- DismissibleMessageConfig.class.dismiss,
95
- classDismiss
96
- )}
97
- on:click={() => onDismiss()}
98
- >
99
- <X class="opacity-75 group-hover:opacity-100" strokeWidth={1.5} />
86
+ <button class={twMerge(_collectClasses('dismiss'))} on:click={() => onDismiss()}>
87
+ <X class={twMerge(_collectClasses('x'))} strokeWidth={1.5} />
100
88
  </button>
101
89
  {/if}
102
90
  </div>
@@ -1,22 +1,21 @@
1
1
  import { SvelteComponent } from "svelte";
2
2
  import { type THC, type TW_COLORS } from '../../index.js';
3
3
  export declare class DismissibleMessageConfig {
4
- static preset: {
5
- box: string;
6
- content: string;
7
- dismiss: string;
8
- };
9
4
  static class: {
10
5
  box: string;
11
6
  content: string;
12
7
  dismiss: string;
8
+ x: string;
13
9
  };
14
10
  }
15
11
  declare const __propDef: {
16
12
  props: {
17
- class?: string | undefined;
18
- classContent?: string | undefined;
19
- classDismiss?: string | undefined;
13
+ class?: {
14
+ box?: "" | undefined;
15
+ content?: "" | undefined;
16
+ dismiss?: "" | undefined;
17
+ x?: "" | undefined;
18
+ } | undefined;
20
19
  duration?: number | undefined;
21
20
  message: THC;
22
21
  onDismiss?: false | (() => void) | null | undefined;
@@ -1,30 +1,64 @@
1
- <script>import { createEventDispatcher } from "svelte";
1
+ <script context="module">import { createClog } from "@marianmeres/clog";
2
+ import { createEventDispatcher } from "svelte";
2
3
  import { slide } from "svelte/transition";
3
4
  import { twMerge } from "tailwind-merge";
4
5
  import {
5
6
  autogrow,
6
7
  getId,
7
8
  trim,
8
- validate as validateAction
9
+ validate as validateAction,
10
+ Thc
9
11
  } from "../../index.js";
10
- const dispatch = createEventDispatcher();
11
- const setType = (el, t) => el.type = t;
12
- const inputSizePreset = {
13
- sm: "text-sm placeholder:text-sm",
14
- md: "text-base placeholder:text-base",
15
- lg: "text-lg placeholder:text-lg"
12
+ const _PRESET = {
13
+ box: "mb-4",
14
+ wrap: `
15
+ rounded-md border border-gray-300
16
+ bg-gray-100
17
+ focus-within:border-stuic-primary
18
+ focus-within:ring-4
19
+ focus-within:ring-stuic-primary
20
+ focus-within:ring-opacity-20
21
+ `,
22
+ label: `block flex-1`,
23
+ input: `
24
+ rounded-md border-0 w-full flex-1
25
+ bg-transparent
26
+ tracking-tight
27
+ focus:outline-0 focus-visible:ring-0
28
+ placeholder:text-black/35 placeholder:tracking-tight
29
+ `,
30
+ invalid: `border-stuic-primary`,
31
+ validationMessage: `mt-1 text-xs text-stuic-primary px-2 tracking-tight`,
32
+ description: `mx-2 mt-1 text-sm opacity-50`,
33
+ below: `mx-2 mt-1`,
34
+ asterix: `after:content-['*'] after:opacity-30 after:pl-1`
16
35
  };
17
- const labelSizePreset = {
18
- sm: "text-sm",
19
- md: "text-base",
20
- lg: "text-base font-bold"
36
+ const _PRESET_BY_SIZE = {
37
+ sm: {
38
+ label: "text-sm",
39
+ input: "text-sm placeholder:text-sm"
40
+ },
41
+ md: {
42
+ label: "text-base",
43
+ input: "text-base placeholder:text-base"
44
+ },
45
+ lg: {
46
+ label: "text-base font-bold",
47
+ input: "text-lg placeholder:text-lg"
48
+ }
21
49
  };
22
- let _class = "";
50
+ export class FieldConfig {
51
+ static class = {};
52
+ static classBySize = {};
53
+ }
54
+ </script>
55
+
56
+ <script>const clog = createClog("Field");
57
+ const dispatch = createEventDispatcher();
58
+ const setType = (el, t) => el.type = t;
59
+ let _class = {};
23
60
  export { _class as class };
24
- export let labelClass = "";
25
- export let wrapClass = "";
26
- export let inputClass = "";
27
- export let invalidClass = "border-stuic-primary";
61
+ export let classBySize = {};
28
62
  export let size = "md";
29
63
  export let id = getId();
30
64
  export let value;
@@ -33,7 +67,6 @@ export let type = "text";
33
67
  export let name = "";
34
68
  export let tabindex = 0;
35
69
  export let description = "";
36
- export let descriptionClass = "";
37
70
  export let autofocus = void 0;
38
71
  export let disabled = false;
39
72
  export let readonly = false;
@@ -48,62 +81,66 @@ export let pattern = void 0;
48
81
  export let step = void 0;
49
82
  export let useTrim = true;
50
83
  export let textareaAutoEnlarge = true;
51
- export let validationMessageClass = "";
52
84
  export let validate = void 0;
85
+ export let showAsterixOnRequired = true;
53
86
  let validation;
54
87
  const setValidationResult = (res) => validation = res;
55
88
  let _inputEl;
56
89
  $:
57
90
  if (_inputEl)
58
91
  dispatch("input_mounted", _inputEl);
92
+ const _collectClasses = (k, extra = "") => [
93
+ _PRESET?.[k] || "",
94
+ _PRESET_BY_SIZE?.[size]?.[k] || "",
95
+ FieldConfig?.class?.[k] || "",
96
+ FieldConfig?.classBySize?.[size]?.[k] || "",
97
+ extra || "",
98
+ _class?.[k] || "",
99
+ classBySize?.[size]?.[k] || ""
100
+ ];
101
+ $:
102
+ _boxClass = twMerge(_collectClasses("box"));
59
103
  $:
60
- _inputClass = twMerge(`
61
- form-input
62
- rounded-md border-0 w-full flex-1
63
- bg-transparent
64
- tracking-tight
65
- focus:outline-0 focus-visible:ring-0
66
- placeholder:text-black/35 placeholder:tracking-tight
67
- ${inputSizePreset[size]}
68
- `);
104
+ _labelClass = twMerge(
105
+ _collectClasses(
106
+ "label",
107
+ showAsterixOnRequired && required ? _collectClasses("asterix").join(" ") : ""
108
+ )
109
+ );
110
+ $:
111
+ _wrapClass = twMerge(
112
+ _collectClasses(
113
+ "wrap",
114
+ validation && !validation.valid ? _collectClasses("invalid").join(" ") : ""
115
+ )
116
+ );
117
+ $:
118
+ _inputClass = twMerge(
119
+ "form-input",
120
+ _collectClasses("input", type === "textarea" ? "min-h-16" : "")
121
+ );
122
+ $:
123
+ _validationMessageClass = twMerge(_collectClasses("validationMessage"));
124
+ $:
125
+ _descriptionClass = twMerge(_collectClasses("description"));
126
+ $:
127
+ _belowClass = twMerge(_collectClasses("below"));
69
128
  </script>
70
129
 
71
- <div class={twMerge(`mb-4 ${_class}`)}>
130
+ <div class={_boxClass}>
72
131
  <div class="flex items-end px-2 mb-1">
73
132
  {#if label || $$slots.label}
74
- <label
75
- for={id}
76
- class={twMerge(
77
- 'block flex-1',
78
- required ? "after:content-['*'] after:opacity-30 after:pl-1" : '',
79
- labelSizePreset[size],
80
- labelClass
81
- )}
82
- class:required
83
- >
133
+ <label for={id} class={_labelClass} class:required>
84
134
  {#if $$slots.label}
85
135
  <slot name="label" />
86
136
  {:else}
87
- {@html label}
137
+ <Thc thc={label} forceAsHtml />
88
138
  {/if}
89
139
  </label>
90
140
  {/if}
91
141
  <slot name="right_of_label" />
92
142
  </div>
93
- <div
94
- class={twMerge(
95
- `rounded-md border border-gray-300
96
- bg-gray-100
97
- focus-within:border-stuic-primary
98
- focus-within:ring-4
99
- focus-within:ring-stuic-primary
100
- focus-within:ring-opacity-20`,
101
- wrapClass,
102
- validation && !validation.valid ? invalidClass : ''
103
- )}
104
- class:cursor-not-allowed={disabled}
105
- class:opacity-50={disabled}
106
- >
143
+ <div class={_wrapClass} class:cursor-not-allowed={disabled} class:opacity-50={disabled}>
107
144
  <div class="flex items-center">
108
145
  <slot name="input_before" {id} />
109
146
  {#if type === 'textarea'}
@@ -111,7 +148,7 @@ $:
111
148
  bind:value
112
149
  bind:this={_inputEl}
113
150
  {id}
114
- class={twMerge(`${_inputClass} min-h-16 ${inputClass}`)}
151
+ class={_inputClass}
115
152
  class:cursor-not-allowed={disabled}
116
153
  {name}
117
154
  {disabled}
@@ -125,14 +162,14 @@ $:
125
162
  : undefined}
126
163
  use:autogrow={{ allowed: textareaAutoEnlarge }}
127
164
  {...$$restProps}
128
- ></textarea>
165
+ />
129
166
  {:else}
130
167
  <input
131
168
  bind:value
132
169
  bind:this={_inputEl}
133
170
  use:setType={type}
134
171
  {id}
135
- class={twMerge(`${_inputClass} ${inputClass}`)}
172
+ class={_inputClass}
136
173
  class:cursor-not-allowed={disabled}
137
174
  {name}
138
175
  {placeholder}
@@ -160,23 +197,16 @@ $:
160
197
  <slot name="input_below" {id} />
161
198
  </div>
162
199
  {#if validation && !validation?.valid}
163
- <div
164
- transition:slide={{ duration: 150 }}
165
- class={twMerge(
166
- `mt-1 text-xs text-stuic-primary px-2 tracking-tight ${validationMessageClass}`
167
- )}
168
- >
200
+ <div transition:slide={{ duration: 150 }} class={_validationMessageClass}>
169
201
  {@html validation.message}
170
202
  </div>
171
203
  {/if}
172
204
  {#if description}
173
- <div class={twMerge(`mx-2 mt-1 text-sm opacity-50 ${descriptionClass}`)}>
174
- {@html description}
205
+ <div class={_descriptionClass}>
206
+ <Thc thc={description} forceAsHtml />
175
207
  </div>
176
208
  {/if}
177
209
  {#if $$slots.below}
178
- <div class="mx-2 mt-1">
179
- <slot name="below" {id} />
180
- </div>
210
+ <div class={_belowClass}><slot name="below" {id} /></div>
181
211
  {/if}
182
212
  </div>
@@ -1,22 +1,38 @@
1
1
  import { SvelteComponent } from "svelte";
2
- import { type ValidateOptions } from '../../index.js';
2
+ import { type ValidateOptions, type THC } from '../../index.js';
3
+ export interface FieldConfigClasses {
4
+ box?: string;
5
+ wrap?: string;
6
+ label?: string;
7
+ input?: string;
8
+ invalid?: string;
9
+ validationMessage?: string;
10
+ description?: string;
11
+ below?: string;
12
+ asterix?: string;
13
+ }
14
+ export interface FieldConfigClassesBySize {
15
+ sm?: FieldConfigClasses;
16
+ md?: FieldConfigClasses;
17
+ lg?: FieldConfigClasses;
18
+ }
19
+ export declare class FieldConfig {
20
+ static class: FieldConfigClasses;
21
+ static classBySize: FieldConfigClassesBySize;
22
+ }
3
23
  declare const __propDef: {
4
24
  props: {
5
25
  [x: string]: any;
6
- class?: string | undefined;
7
- labelClass?: string | undefined;
8
- wrapClass?: string | undefined;
9
- inputClass?: string | undefined;
10
- invalidClass?: string | undefined;
26
+ class?: FieldConfigClasses | undefined;
27
+ classBySize?: FieldConfigClassesBySize | undefined;
11
28
  size?: "sm" | "md" | "lg" | undefined;
12
29
  id?: string | undefined;
13
30
  value: string;
14
- label?: string | undefined;
31
+ label?: THC | undefined;
15
32
  type?: string | undefined;
16
33
  name?: string | undefined;
17
34
  tabindex?: number | undefined;
18
- description?: string | undefined;
19
- descriptionClass?: string | undefined;
35
+ description?: THC | undefined;
20
36
  autofocus?: true | undefined;
21
37
  disabled?: boolean | undefined;
22
38
  readonly?: boolean | undefined;
@@ -31,12 +47,10 @@ declare const __propDef: {
31
47
  step?: number | undefined;
32
48
  useTrim?: boolean | undefined;
33
49
  textareaAutoEnlarge?: boolean | undefined;
34
- validationMessageClass?: string | undefined;
35
50
  validate?: ValidateOptions | true | undefined;
51
+ showAsterixOnRequired?: boolean | undefined;
36
52
  };
37
53
  events: {
38
- input_mounted: CustomEvent<any>;
39
- } & {
40
54
  [evt: string]: CustomEvent<any>;
41
55
  };
42
56
  slots: {
@@ -1,14 +1,44 @@
1
- <script>import { twMerge } from "tailwind-merge";
1
+ <script context="module">import { slide } from "svelte/transition";
2
+ import { twMerge } from "tailwind-merge";
2
3
  import {
4
+ getId,
5
+ Thc,
3
6
  validate as validateAction
4
7
  } from "../../index.js";
5
- import { slide } from "svelte/transition";
6
- import { getId } from "../../index.js";
7
- let _class = "";
8
+ const _PRESET = {
9
+ box: "flex items-start mb-4",
10
+ label: "block w-full",
11
+ input: `
12
+ size-4 rounded
13
+ bg-gray-100
14
+ border-gray-300
15
+ shadow-sm
16
+ text-stuic-primary
17
+ cursor-pointer
18
+ focus:border-stuic-primary
19
+ focus:ring-4
20
+ focus:ring-offset-0
21
+ focus:ring-stuic-primary
22
+ focus:ring-opacity-20
23
+ disabled:cursor-not-allowed
24
+ `,
25
+ validationMessage: "text-xs text-stuic-primary tracking-tight",
26
+ description: "text-sm opacity-50"
27
+ };
28
+ const _PRESET_BY_SIZE = {
29
+ sm: { label: "text-sm" },
30
+ md: { label: "text-base" },
31
+ lg: { label: "text-base font-bold" }
32
+ };
33
+ export class FieldCheckboxConfig {
34
+ static class;
35
+ static classBySize;
36
+ }
37
+ </script>
38
+
39
+ <script>let _class = {};
8
40
  export { _class as class };
9
- export let invalidClass = "border-stuic-primary";
10
- export let labelClass = "";
11
- export let descriptionClass = "";
41
+ export let classBySize = {};
12
42
  export let size = "md";
13
43
  export let id = getId();
14
44
  export let checked = false;
@@ -19,19 +49,37 @@ export let tabindex = 0;
19
49
  export let disabled = void 0;
20
50
  export let readonly = void 0;
21
51
  export let required = void 0;
22
- const labelSizePreset = {
23
- sm: "text-sm",
24
- md: "text-base",
25
- lg: "text-base font-bold"
26
- };
27
- export let validationMessageClass = "";
28
52
  export let validate = void 0;
29
53
  let validation;
30
54
  const setValidationResult = (res) => validation = res;
31
55
  let idDesc = getId();
56
+ const _collectClasses = (k, extra = "") => [
57
+ _PRESET?.[k] || "",
58
+ _PRESET_BY_SIZE?.[size]?.[k] || "",
59
+ FieldCheckboxConfig?.class?.[k] || "",
60
+ FieldCheckboxConfig?.classBySize?.[size]?.[k] || "",
61
+ extra || "",
62
+ _class?.[k] || "",
63
+ classBySize?.[size]?.[k] || ""
64
+ ];
65
+ $:
66
+ _boxClass = twMerge(_collectClasses("box"));
67
+ $:
68
+ _inputClass = twMerge(
69
+ _collectClasses(
70
+ "input",
71
+ validation && !validation.valid ? _collectClasses("invalid").join(" ") : ""
72
+ )
73
+ );
74
+ $:
75
+ _labelClass = twMerge(_collectClasses("label"));
76
+ $:
77
+ _validationMessageClass = twMerge(_collectClasses("validationMessage"));
78
+ $:
79
+ _descriptionClass = twMerge(_collectClasses("description"));
32
80
  </script>
33
81
 
34
- <div class={twMerge(`flex items-start mb-4 ${_class}`)}>
82
+ <div class={_boxClass}>
35
83
  <div class="flex h-6 items-center ml-1">
36
84
  <input
37
85
  {id}
@@ -40,21 +88,7 @@ let idDesc = getId();
40
88
  aria-checked={checked}
41
89
  aria-describedby={description ? idDesc : undefined}
42
90
  {name}
43
- class={twMerge(`
44
- size-4 rounded
45
- bg-gray-100
46
- border-gray-300
47
- shadow-sm
48
- text-stuic-primary
49
- cursor-pointer
50
- focus:border-stuic-primary
51
- focus:ring-4
52
- focus:ring-offset-0
53
- focus:ring-stuic-primary
54
- focus:ring-opacity-20
55
- disabled:cursor-not-allowed
56
- ${validation && !validation.valid ? invalidClass : ''}
57
- `)}
91
+ class={_inputClass}
58
92
  {disabled}
59
93
  {readonly}
60
94
  {required}
@@ -68,27 +102,22 @@ let idDesc = getId();
68
102
  {#if label}
69
103
  <label
70
104
  for={id}
71
- class={twMerge(`block w-full ${labelSizePreset[size]} ${labelClass}`)}
105
+ class={_labelClass}
72
106
  class:cursor-pointer={!disabled}
73
107
  class:cursor-not-allowed={disabled}
74
108
  >
75
- {@html label}
109
+ <Thc thc={label} forceAsHtml />
76
110
  </label>
77
111
  {/if}
78
112
  {#if validation && !validation?.valid}
79
- <div
80
- transition:slide={{ duration: 150 }}
81
- class={twMerge(
82
- `text-xs text-stuic-primary tracking-tight ${validationMessageClass}`
83
- )}
84
- >
113
+ <div transition:slide={{ duration: 150 }} class={_validationMessageClass}>
85
114
  {@html validation.message}
86
115
  </div>
87
116
  {/if}
88
117
  {#if description || $$slots.description}
89
118
  <!-- svelte-ignore a11y-click-events-have-key-events a11y-no-static-element-interactions -->
90
119
  <div
91
- class={twMerge(`text-sm opacity-50 ${descriptionClass}`)}
120
+ class={_descriptionClass}
92
121
  class:cursor-pointer={!disabled}
93
122
  class:cursor-not-allowed={disabled}
94
123
  on:click={() => !disabled && (checked = !checked)}
@@ -96,7 +125,7 @@ let idDesc = getId();
96
125
  {#if $$slots.description}
97
126
  <slot name="description" />
98
127
  {:else}
99
- {@html description}
128
+ <Thc thc={description} forceAsHtml />
100
129
  {/if}
101
130
  </div>
102
131
  {/if}