@weni/unnnic-system 3.12.3-alpha.1 → 3.12.3-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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weni/unnnic-system",
3
- "version": "3.12.3-alpha.1",
3
+ "version": "3.12.3-alpha.2",
4
4
  "type": "commonjs",
5
5
  "files": [
6
6
  "dist",
@@ -6,7 +6,9 @@ defineOptions({
6
6
  name: 'UnnnicDialogClose',
7
7
  });
8
8
 
9
- const props = defineProps<DialogCloseProps>();
9
+ const props = withDefaults(defineProps<DialogCloseProps>(), {
10
+ asChild: true,
11
+ });
10
12
  </script>
11
13
 
12
14
  <template>
@@ -19,8 +21,6 @@ const props = defineProps<DialogCloseProps>();
19
21
  </template>
20
22
 
21
23
  <style lang="scss" scoped>
22
- @use '@/assets/scss/unnnic' as *;
23
-
24
24
  .unnnic-dialog-close {
25
25
  > * {
26
26
  width: 100%;
@@ -6,7 +6,9 @@ defineOptions({
6
6
  name: 'UnnnicDrawerClose',
7
7
  });
8
8
 
9
- const props = defineProps<DrawerCloseProps>();
9
+ const props = withDefaults(defineProps<DrawerCloseProps>(), {
10
+ asChild: true,
11
+ });
10
12
  </script>
11
13
 
12
14
  <template>
@@ -22,14 +24,6 @@ const props = defineProps<DrawerCloseProps>();
22
24
  @use '@/assets/scss/unnnic' as *;
23
25
 
24
26
  .unnnic-drawer__close {
25
- display: flex;
26
-
27
- border: none;
28
- background: none;
29
- padding: 0;
30
- margin: 0;
31
- cursor: pointer;
32
-
33
27
  > * {
34
28
  width: 100%;
35
29
  }
@@ -14,14 +14,14 @@ export type LayerToken = keyof typeof layerScale;
14
14
 
15
15
  const DEFAULT_STEP = 5;
16
16
 
17
- const counters: Record<LayerToken, number> = {
18
- hide: 0,
19
- base: 0,
20
- drawer: 0,
21
- modal: 0,
22
- popover: 0,
23
- tooltip: 0,
24
- toast: 0,
17
+ const activeValues: Record<LayerToken, number[]> = {
18
+ hide: [],
19
+ base: [],
20
+ drawer: [],
21
+ modal: [],
22
+ popover: [],
23
+ tooltip: [],
24
+ toast: [],
25
25
  };
26
26
 
27
27
  interface Allocation {
@@ -34,10 +34,14 @@ const allocations = new Map<symbol, Allocation>();
34
34
 
35
35
  function acquire(type: LayerToken): Allocation {
36
36
  const id = Symbol('layer');
37
- counters[type] = (counters[type] ?? 0) + 1;
38
- const value = layerScale[type] + counters[type] * DEFAULT_STEP;
37
+ const list = activeValues[type];
38
+ const lastValue = list.length ? list[list.length - 1] : layerScale[type];
39
+ const value = lastValue + DEFAULT_STEP;
39
40
  const allocation: Allocation = { id, type, value };
41
+
42
+ list.push(value);
40
43
  allocations.set(id, allocation);
44
+
41
45
  return allocation;
42
46
  }
43
47
 
@@ -48,8 +52,12 @@ function release(id: symbol) {
48
52
  }
49
53
 
50
54
  allocations.delete(id);
51
- const current = Math.max((counters[allocation.type] ?? 1) - 1, 0);
52
- counters[allocation.type] = current;
55
+ const list = activeValues[allocation.type];
56
+ const index = list.indexOf(allocation.value);
57
+
58
+ if (index !== -1) {
59
+ list.splice(index, 1);
60
+ }
53
61
  }
54
62
 
55
63
  export interface LayerZIndexOptions {