milk-lib 0.0.35 → 0.0.36

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.
@@ -7,9 +7,17 @@
7
7
  legend = 'Choose options',
8
8
  options = [] as CheckboxGroupItem[],
9
9
  selectedValues = $bindable([] as string[]),
10
- name
10
+ name,
11
+ maxHeight
11
12
  }: CheckboxGroupProps = $props();
12
13
 
14
+ const maxHeightValue = $derived.by(() => {
15
+ if (maxHeight === undefined || maxHeight === null || maxHeight === '') {
16
+ return undefined;
17
+ }
18
+ return typeof maxHeight === 'number' ? `${maxHeight}px` : maxHeight;
19
+ });
20
+
13
21
  function handleOptionToggle(value: string) {
14
22
  toggleOption(value);
15
23
  }
@@ -28,7 +36,12 @@
28
36
  <legend>{legend}</legend>
29
37
  {/if}
30
38
 
31
- <ul class="checkbox-list">
39
+ <ul
40
+ class="checkbox-list"
41
+ class:scrollable={Boolean(maxHeightValue)}
42
+ style={`max-height: ${maxHeightValue || 'auto'};`}
43
+
44
+ >
32
45
  {#if options.length === 0}
33
46
  <li class="checkbox-placeholder">No option for choice</li>
34
47
  {:else}
@@ -63,14 +76,14 @@
63
76
  {/if}
64
77
  </ul>
65
78
 
66
- <div class="checkbox-selected">
79
+ <!-- <div class="checkbox-selected">
67
80
  <strong>Selected:</strong>
68
81
  {#if selectedValues.length === 0}
69
82
  <span>nothing</span>
70
83
  {:else}
71
84
  <span>{selectedValues.join(', ')}</span>
72
85
  {/if}
73
- </div>
86
+ </div> -->
74
87
  </fieldset>
75
88
 
76
89
  <style>.checkbox-group {
@@ -98,6 +111,11 @@ legend {
98
111
  gap: 8px;
99
112
  }
100
113
 
114
+ .checkbox-list.scrollable {
115
+ overflow-y: auto;
116
+ min-height: 0;
117
+ }
118
+
101
119
  .checkbox-placeholder {
102
120
  color: var(--text-base-placeholder, #7c7c7c);
103
121
  font-size: 14px;
@@ -137,16 +155,4 @@ legend {
137
155
  display: block;
138
156
  color: var(--text-base-placeholder, #7c7c7c);
139
157
  font-size: 12px;
140
- }
141
-
142
- .checkbox-selected {
143
- font-size: 13px;
144
- color: var(--text-base-placeholder, #7c7c7c);
145
- display: flex;
146
- gap: 6px;
147
- flex-wrap: wrap;
148
- }
149
-
150
- .checkbox-selected strong {
151
- color: var(--text-base-main, #222);
152
158
  }</style>
@@ -19,4 +19,5 @@ export type CheckboxGroupProps = {
19
19
  options: CheckboxGroupItem[];
20
20
  selectedValues: string[];
21
21
  name: string;
22
+ maxHeight?: number | string;
22
23
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "milk-lib",
3
3
  "license": "MIT",
4
- "version": "0.0.35",
4
+ "version": "0.0.36",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
7
7
  "build": "vite build && npm run prepack",