@ansiversa/components 0.0.93 → 0.0.95

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": "@ansiversa/components",
3
- "version": "0.0.93",
3
+ "version": "0.0.95",
4
4
  "description": "Shared UI components and layouts for the Ansiversa ecosystem",
5
5
  "type": "module",
6
6
  "exports": {
package/src/AvTable.astro CHANGED
@@ -21,7 +21,6 @@ const {
21
21
  } = Astro.props as Props & Record<string, unknown>;
22
22
 
23
23
  const normalizedSortDir = sortDir === "asc" || sortDir === "desc" ? sortDir : undefined;
24
- const tableId = `av-table-${Math.random().toString(36).slice(2, 10)}`;
25
24
  const dataSortKey = "data-sort-key" in attrs ? undefined : sortKey;
26
25
  const dataSortDir = "data-sort-dir" in attrs ? undefined : normalizedSortDir;
27
26
  ---
@@ -30,18 +29,16 @@ const dataSortDir = "data-sort-dir" in attrs ? undefined : normalizedSortDir;
30
29
  class={`av-table ${scroll ? "av-table--scroll" : ""} ${dense ? "av-table--dense" : ""} ${stickyHeader ? "av-table--sticky" : ""} ${className}`}
31
30
  data-sort-key={dataSortKey}
32
31
  data-sort-dir={dataSortDir}
33
- data-av-table-id={tableId}
34
32
  {...attrs}
35
33
  >
36
34
  <table class="av-table__table">
37
35
  {caption ? <caption class="av-table__caption">{caption}</caption> : null}
38
36
  <slot />
39
37
  </table>
40
- </div>
41
-
42
- <script define:vars={{ initialSortKey: sortKey ?? "", initialSortDir: normalizedSortDir ?? "", tableId }}>
38
+ <script define:vars={{ initialSortKey: sortKey ?? "", initialSortDir: normalizedSortDir ?? "" }}>
43
39
  (() => {
44
- const root = document.querySelector(`.av-table[data-av-table-id="${tableId}"]`);
40
+ const script = document.currentScript;
41
+ const root = script?.closest?.(".av-table");
45
42
  if (!root) return;
46
43
 
47
44
  const controls = Array.from(root.querySelectorAll("[data-av-sort]"));
@@ -100,10 +97,11 @@ const dataSortDir = "data-sort-dir" in attrs ? undefined : normalizedSortDir;
100
97
  updateUI(key, nextDir);
101
98
  root.dispatchEvent(new CustomEvent("av-sort", { bubbles: true, detail: { key, dir: nextDir } }));
102
99
 
103
- if (control.tagName === "BUTTON") {
100
+ if (control.tagName === "BUTTON" || control.tagName === "A" || control.closest("a")) {
104
101
  event.preventDefault();
105
102
  }
106
103
  });
107
104
  });
108
105
  })();
109
106
  </script>
107
+ </div>
@@ -1148,18 +1148,16 @@
1148
1148
  }
1149
1149
 
1150
1150
  .av-table__sort--active::after {
1151
- color: transparent;
1152
- background: linear-gradient(to bottom, var(--ans-text) 0 50%, var(--ans-muted) 50% 100%);
1153
- -webkit-background-clip: text;
1154
- background-clip: text;
1151
+ color: var(--ans-text);
1152
+ content: "▲";
1155
1153
  }
1156
1154
 
1157
1155
  .av-table__sort--asc::after {
1158
- background: linear-gradient(to bottom, var(--ans-text) 0 50%, var(--ans-muted) 50% 100%);
1156
+ content: "▲";
1159
1157
  }
1160
1158
 
1161
1159
  .av-table__sort--desc::after {
1162
- background: linear-gradient(to bottom, var(--ans-muted) 0 50%, var(--ans-text) 50% 100%);
1160
+ content: "▼";
1163
1161
  }
1164
1162
 
1165
1163
  .av-table--sticky thead th {