@fiscozen/card 1.0.0-beta.1 → 1.0.0-beta.3

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.
Files changed (2) hide show
  1. package/package.json +7 -4
  2. package/src/FzCard.vue +43 -42
package/package.json CHANGED
@@ -1,14 +1,17 @@
1
1
  {
2
2
  "name": "@fiscozen/card",
3
- "version": "1.0.0-beta.1",
3
+ "version": "1.0.0-beta.3",
4
4
  "description": "Design System Card component",
5
5
  "main": "src/index.ts",
6
6
  "type": "module",
7
7
  "keywords": [],
8
8
  "author": "Cristian Barraco",
9
9
  "dependencies": {
10
- "@fiscozen/button": "^1.0.0",
11
- "@fiscozen/icons": "^0.1.35"
10
+ "@fiscozen/container": "^0.3.1",
11
+ "@fiscozen/button": "^1.0.1-next.0",
12
+ "@fiscozen/composables": "^0.1.37",
13
+ "@fiscozen/icons": "^0.1.35",
14
+ "@fiscozen/style": "^0.1.7"
12
15
  },
13
16
  "peerDependencies": {
14
17
  "tailwindcss": "^3.4.1",
@@ -33,8 +36,8 @@
33
36
  "@awesome.me/kit-8137893ad3": "^1.0.65",
34
37
  "@fortawesome/fontawesome-svg-core": "^6.5.1",
35
38
  "@fortawesome/vue-fontawesome": "^3.0.6",
36
- "@fiscozen/tsconfig": "^0.1.0",
37
39
  "@fiscozen/prettier-config": "^0.1.0",
40
+ "@fiscozen/tsconfig": "^0.1.0",
38
41
  "@fiscozen/eslint-config": "^0.1.0"
39
42
  },
40
43
  "license": "MIT",
package/src/FzCard.vue CHANGED
@@ -27,6 +27,11 @@
27
27
  import { computed, onMounted, ref, watch } from "vue";
28
28
  import { FzCardEvents, FzCardProps, FzCardSlots } from "./types";
29
29
  import { FzButton, FzIconButton } from "@fiscozen/button";
30
+ import { FzContainer } from "@fiscozen/container";
31
+ import { useMediaQuery } from "@fiscozen/composables";
32
+ import { breakpoints } from "@fiscozen/style";
33
+
34
+ const smOrSmaller = useMediaQuery(`(max-width: ${breakpoints.sm})`);
30
35
 
31
36
  const props = withDefaults(defineProps<FzCardProps>(), {
32
37
  environment: 'frontoffice'
@@ -72,11 +77,11 @@ const normalizedColor = computed(() => {
72
77
  });
73
78
 
74
79
  const sectionStaticClass =
75
- "border-1 border-solid border-grey-100 rounded flex flex-col";
80
+ "border-1 border-solid rounded flex flex-col";
76
81
  const headerStaticClass =
77
82
  "border-solid pt-16 px-16 flex flex-row justify-between";
78
83
  const footerStaticClass =
79
- "border-solid pt-0 px-16 pb-16 flex justify-end gap-12 items-center";
84
+ "border-solid pt-0 px-16 pb-16 flex gap-12 items-center";
80
85
 
81
86
  const showContent = computed(() => isOpen.value || !props.collapsible);
82
87
  const isAlive = computed(() => props.alwaysAlive || showContent.value);
@@ -87,6 +92,10 @@ const headerContainerComputedClass = computed(() => [
87
92
  props.collapsible ? "cursor-pointer" : "",
88
93
  ]);
89
94
 
95
+ const headerTitleClass = computed(() => {
96
+ return props.environment === 'backoffice' ? 'py-2' : 'py-8';
97
+ });
98
+
90
99
  const backgroundColor = computed(() => {
91
100
  switch (normalizedColor.value) {
92
101
  case "blue":
@@ -114,28 +123,16 @@ const borderColor = computed(() => {
114
123
  case "blue":
115
124
  return "border-background-alice-blue";
116
125
  case "orange":
117
- return "border-orange-200";
126
+ return "border-background-seashell";
118
127
  case "purple":
119
- return "border-purple-200";
128
+ return "border-background-pale-purple";
120
129
  case "grey":
121
- return "border-grey-200";
130
+ return "border-background-white-smoke";
122
131
  default:
123
132
  return "border-grey-100";
124
133
  }
125
134
  });
126
135
 
127
- const borderWidth = computed(() => {
128
- switch (normalizedColor.value) {
129
- case "blue":
130
- case "orange":
131
- case "purple":
132
- case "grey":
133
- return "border-0";
134
- default:
135
- return "border-1";
136
- }
137
- });
138
-
139
136
  const atLeastOneButton = computed(
140
137
  () =>
141
138
  props.primaryAction !== undefined ||
@@ -174,17 +171,17 @@ defineExpose({
174
171
  @click="toggleOpen"
175
172
  >
176
173
  <div :class="headerStaticClass">
177
- <div class="flex flex-row gap-12 items-center">
174
+ <div :class="['flex flex-row gap-12 items-start', headerTitleClass]">
178
175
  <h2
179
176
  v-if="title"
180
- class="text-core-black font-medium text-xl m-0 p-0 break-words"
177
+ class="text-core-black font-medium text-xl m-0 p-0 break-words overflow-wrap-anywhere min-w-0 flex-shrink"
181
178
  :title="title"
182
179
  >
183
180
  {{ title }}
184
181
  </h2>
185
182
  <slot name="header"></slot>
186
183
  </div>
187
- <div class="flex flex-row gap-8 items-center">
184
+ <div class="flex flex-row gap-8 items-start">
188
185
  <FzIconButton
189
186
  v-if="hasInfoIcon"
190
187
  iconName="circle-question"
@@ -211,31 +208,35 @@ defineExpose({
211
208
  </article>
212
209
  <footer
213
210
  v-if="(slots.footer || atLeastOneButton) && isAlive"
214
- :class="[footerStaticClass]"
211
+ :class="[footerStaticClass, {'justify-end': !smOrSmaller}]"
215
212
  v-show="showContent"
216
213
  >
217
214
  <slot name="footer">
218
- <FzIconButton
219
- v-if="tertiaryAction"
220
- @click="emit('fztertiary:click')"
221
- :iconName="tertiaryAction.icon"
222
- variant="invisible"
223
- :environment="environment"
224
- />
225
- <FzButton
226
- v-if="secondaryAction"
227
- @click="emit('fzsecondary:click')"
228
- :label="secondaryAction.label"
229
- variant="secondary"
230
- :environment="environment"
231
- />
232
- <FzButton
233
- v-if="primaryAction"
234
- @click="emit('fzprimary:click')"
235
- :label="primaryAction.label"
236
- variant="primary"
237
- :environment="environment"
238
- />
215
+ <FzContainer horizontal gap="sm" :class="{'w-full': smOrSmaller}">
216
+ <FzIconButton
217
+ v-if="tertiaryAction"
218
+ @click="emit('fztertiary:click')"
219
+ :iconName="tertiaryAction.icon"
220
+ variant="invisible"
221
+ :environment="environment"
222
+ />
223
+ <FzButton
224
+ v-if="secondaryAction"
225
+ :class="{'flex-grow': smOrSmaller}"
226
+ @click="emit('fzsecondary:click')"
227
+ :label="secondaryAction.label"
228
+ variant="secondary"
229
+ :environment="environment"
230
+ />
231
+ <FzButton
232
+ v-if="primaryAction"
233
+ :class="{'flex-grow': smOrSmaller}"
234
+ @click="emit('fzprimary:click')"
235
+ :label="primaryAction.label"
236
+ variant="primary"
237
+ :environment="environment"
238
+ />
239
+ </FzContainer>
239
240
  </slot>
240
241
  </footer>
241
242
  </section>