@meistrari/tela-build 1.49.0 → 1.49.1

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.
@@ -217,9 +217,9 @@ function onFiles(event: Event) {
217
217
  | `TelaHomeContent` | The `<main>` content column. Centered, `max-width 1600px`, `px-48px py-32px`, vertical stack with `gap-24px` (separates the title from the body). Grows with content and scrolls with the page. |
218
218
  | `TelaHomeTitle` | Page heading. Always `heading-h4-semibold text-primary` — the welcome / page line. |
219
219
  | `TelaHomeBody` | Stacks the page's major sections below the title — metrics row, then one or more `TelaHomeSection`s — with the larger between-sections gap (`gap-46px`). |
220
- | `TelaHomeMetrics` | Responsive grid wrapper for the metric row (`gap-12px`). `columns` prop sets the column count (default `3`). Exposes an `#actions` slot, rendered right-aligned **outside** the grid — reserved for `TelaCreateCard`. |
220
+ | `TelaHomeMetrics` | Responsive grid wrapper for the metric row. Cards are divided by hairlines (`bg-border` container + `gap-0.5px`, each card paints its own `bg`) inside a rounded `border-0.5px` outline. The `columns` prop is the **max** column count (default `3`); the grid auto-shrinks to the number of visible cards so a partial row leaves no empty cell. Exposes an `#actions` slot, rendered right-aligned **outside** the grid — reserved for `TelaCreateCard`. |
221
221
  | `TelaHomeMetricsGroup` | Stacks two or more cards vertically inside a single `TelaHomeMetrics` cell (`flex-col gap-12px h-full`). Use when one column should hold more than one card. |
222
- | `TelaHomeMetricsCard` | A metric card built on `TelaCard`. A `label` (or `#label` slot), an **optional** big `value` (`value` prop — omit it for a title-only card), and a default slot for the body (breakdown, list, progress, sparkline). With a value it's a hero metric; without one it's a titled content card. |
222
+ | `TelaHomeMetricsCard` | A metric card built on `TelaCard`. A `label` (or `#label` slot), an **optional** big `value` (`value` prop — omit it for a title-only card), and a default slot for the body (breakdown, list, progress, sparkline). With a value it's a hero metric; without one it's a titled content card. A `class` prop is merged (via `cn`) onto the inner body wrapper for per-card layout tweaks. |
223
223
  | `TelaHomeMetricsStat` | A small stat unit — a `label`, a `value` (`h4`), and an optional `delta` (e.g. a percentage) inline with the value. Use it for the breakdown rows inside a metric card's body. |
224
224
  | `TelaHomeToolbar` | Filter/search bar above the table. Default slot is the left group (`TelaFilter` + `TelaInput`); the `#actions` slot is the right side. Enforces the fixed order and spacing — see composition rule 5. |
225
225
  | `TelaHomeSection` | Vertical group (`gap-24px`) for a block of related content — e.g. a `TelaHomeToolbar` and the `TelaTable` it controls. Renders as a `<section>`. |
@@ -244,7 +244,7 @@ function onFiles(event: Event) {
244
244
 
245
245
  ```typescript
246
246
  type HomeMetricsProps = {
247
- columns?: number // grid column count — default 3
247
+ columns?: number // max grid columns — default 3; auto-shrinks to the visible card count
248
248
  }
249
249
  ```
250
250
 
@@ -252,8 +252,9 @@ type HomeMetricsProps = {
252
252
 
253
253
  ```typescript
254
254
  type HomeMetricsCardProps = {
255
- label?: string // metric label (or use the #label slot)
256
- value?: string | number // optional hero value — omit for a title-only card
255
+ label?: string // metric label (or use the #label slot)
256
+ value?: string | number // optional hero value — omit for a title-only card
257
+ class?: HTMLAttributes['class'] // extra classes merged onto the card's inner body wrapper
257
258
  }
258
259
  // default slot — body content (breakdown, list, progress, sparkline)
259
260
  ```
@@ -1,12 +1,14 @@
1
1
  <script setup lang="ts">
2
- const props = defineProps<{ label?: string, value?: string | number }>()
2
+ import type { HTMLAttributes } from 'vue'
3
+
4
+ const props = defineProps<{ label?: string, value?: string | number, class?: HTMLAttributes['class'] }>()
3
5
 
4
6
  const hasValue = computed(() => props.value !== undefined)
5
7
  </script>
6
8
 
7
9
  <template>
8
- <TelaCard size="xs">
9
- <div flex="~ col" h-full :class="hasValue ? 'gap-36px' : 'gap-20px'">
10
+ <TelaCard size="xs" class="rounded-0 border-none">
11
+ <div flex="~ col" h-full :class="cn(props.class, hasValue ? 'gap-[36px]' : 'gap-[20px]')">
10
12
  <div flex="~ col" gap-4px>
11
13
  <span body-12-regular text-secondary>
12
14
  <slot name="label">
@@ -1,16 +1,41 @@
1
1
  <script setup lang="ts">
2
+ import type { VNode, VNodeChild } from 'vue'
3
+
2
4
  const props = withDefaults(defineProps<{ columns?: number }>(), {
3
5
  columns: 3,
4
6
  })
5
7
 
8
+ const slots = useSlots()
9
+
10
+ function isVisibleCard(node: VNodeChild): node is VNode {
11
+ if (typeof node !== 'object' || node === null || Array.isArray(node))
12
+ return false
13
+
14
+ return typeof node.type !== 'symbol'
15
+ }
16
+
17
+ const slotCount = computed(() => {
18
+ const nodes = slots.default?.() ?? []
19
+
20
+ return nodes
21
+ .flatMap(node => (Array.isArray(node.children) ? node.children : node))
22
+ .filter(isVisibleCard)
23
+ .length
24
+ })
25
+
26
+ const resolvedColumns = computed(() => Math.min(props.columns, Math.max(slotCount.value, 1)))
27
+
6
28
  const gridStyle = computed(() => ({
7
- gridTemplateColumns: `repeat(${props.columns}, minmax(0, 1fr))`,
29
+ gridTemplateColumns: `repeat(${resolvedColumns.value}, minmax(0, 1fr))`,
8
30
  }))
9
31
  </script>
10
32
 
11
33
  <template>
12
34
  <div flex justify-between>
13
- <div grid gap-12px :style="gridStyle">
35
+ <div
36
+ grid gap-0.5px bg-border border-0.5px border rounded-12px overflow-hidden
37
+ :style="gridStyle"
38
+ >
14
39
  <slot />
15
40
  </div>
16
41
  <slot name="actions" />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meistrari/tela-build",
3
- "version": "1.49.0",
3
+ "version": "1.49.1",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "app.config.ts",