@bagelink/vue 1.15.80 → 1.15.82

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/vue",
3
3
  "type": "module",
4
- "version": "1.15.80",
4
+ "version": "1.15.82",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Bagel Studio",
@@ -1,6 +1,8 @@
1
1
  <script setup lang="ts">
2
2
  defineOptions({ name: 'BglCard' })
3
+ import type { GradientDirProp, GradientProp } from '@bagelink/vue'
3
4
  import { computed } from 'vue'
5
+ import { useGradientVariant } from '@bagelink/vue'
4
6
 
5
7
  const props = defineProps<{
6
8
  label?: string
@@ -17,6 +19,13 @@ const props = defineProps<{
17
19
  overflowX?: boolean
18
20
  overflowY?: boolean
19
21
  frame?: boolean
22
+ /** Theme tone used as the gradient's first stop (e.g. `color="green"`). */
23
+ color?: string
24
+ /** Paint the card with a gradient. `true` = auto (a darker shade of `color`);
25
+ a tone list like "green" or "blue purple pink" sets explicit stops. */
26
+ gradient?: GradientProp
27
+ /** Gradient direction — a named dir (`to-br`) or an angle in degrees. */
28
+ gradientDir?: GradientDirProp
20
29
  bg?:
21
30
  | 'gray'
22
31
  | 'light'
@@ -31,6 +40,16 @@ const props = defineProps<{
31
40
  | 'transparent'
32
41
  }>()
33
42
 
43
+ const { isGradient, gradientStyle } = useGradientVariant({
44
+ gradient: () => props.gradient,
45
+ gradientDir: () => props.gradientDir,
46
+ color: () => props.color,
47
+ })
48
+
49
+ // A `pair-*` class is required to activate the `.gradient` paint rule. Mirror
50
+ // Btn: default to the auto case (primary) when no color is given.
51
+ const pairClass = computed(() => isGradient.value ? `pair-${props.color || 'primary'}` : undefined)
52
+
34
53
  const bind = computed(() => {
35
54
  const obj: { [key: string]: any } = {}
36
55
  if (props.href !== undefined && props.href !== '') { obj.href = props.href }
@@ -47,7 +66,7 @@ const is = computed(() => {
47
66
 
48
67
  <template>
49
68
  <component
50
- :is="is" v-ripple="!!to" v-bind="bind" class="bgl_card" :class="{
69
+ :is="is" v-ripple="!!to" v-bind="bind" class="bgl_card" :class="[{
51
70
  thin,
52
71
  'border bg-transparent': outline,
53
72
  'h-100': h100,
@@ -55,7 +74,8 @@ const is = computed(() => {
55
74
  'overflow-x': overflowX,
56
75
  'overflow-y': overflowY,
57
76
  'card_frame': frame,
58
- }"
77
+ 'gradient': isGradient,
78
+ }, pairClass]" :style="gradientStyle"
59
79
  >
60
80
  <span v-if="label" class="card_label block label">
61
81
  {{ label }}