vueless 0.0.391 → 0.0.393

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.
@@ -31,7 +31,7 @@ export function useAutoPosition(anchorElement, targetElement, position, preferre
31
31
  return localPosition.value.x === POSITION.left;
32
32
  }
33
33
 
34
- return preferredOpenDirectionX.value === POSITION.right;
34
+ return preferredOpenDirectionX.value === POSITION.left;
35
35
  });
36
36
 
37
37
  const isBottom = computed(() => {
@@ -60,12 +60,12 @@ export function useAutoPosition(anchorElement, targetElement, position, preferre
60
60
  const hasEnoughSpaceAbove =
61
61
  spaceAbove > localTargetElement.value.getBoundingClientRect().height;
62
62
 
63
- if (localPreferredPosition.value.y === POSITION.top) {
63
+ if (localPreferredPosition.value.y === POSITION.bottom) {
64
64
  preferredOpenDirectionY.value =
65
65
  hasEnoughSpaceBelow || spaceBelow > spaceAbove ? POSITION.bottom : POSITION.top;
66
66
  }
67
67
 
68
- if (localPreferredPosition.value.y === POSITION.bottom) {
68
+ if (localPreferredPosition.value.y === POSITION.top) {
69
69
  preferredOpenDirectionY.value =
70
70
  hasEnoughSpaceAbove || spaceAbove > spaceBelow ? POSITION.top : POSITION.bottom;
71
71
  }
@@ -79,12 +79,12 @@ export function useAutoPosition(anchorElement, targetElement, position, preferre
79
79
  const hasEnoughSpaceLeft = spaceLeft > localTargetElement.value.getBoundingClientRect().width;
80
80
  const hasEnoughSpaceRight = spaceRight > localTargetElement.value.getBoundingClientRect().width;
81
81
 
82
- if (localPreferredPosition.value.x === POSITION.left) {
82
+ if (localPreferredPosition.value.x === POSITION.right) {
83
83
  preferredOpenDirectionX.value =
84
84
  hasEnoughSpaceRight || spaceRight > spaceLeft ? POSITION.right : POSITION.left;
85
85
  }
86
86
 
87
- if (localPreferredPosition.value.x === POSITION.right) {
87
+ if (localPreferredPosition.value.x === POSITION.left) {
88
88
  preferredOpenDirectionX.value =
89
89
  hasEnoughSpaceLeft || spaceLeft > spaceRight ? POSITION.left : POSITION.right;
90
90
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.391",
3
+ "version": "0.0.393",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -8,7 +8,7 @@
8
8
  <!-- @slot Use it to customise left side of the header. -->
9
9
  <slot name="header-left">
10
10
  <div v-bind="headerLeftFallbackAttrs">
11
- <UHeader :label="title" size="md" v-bind="titleAttrs" />
11
+ <UHeader :label="title" size="xs" v-bind="titleAttrs" />
12
12
  <div v-if="description" v-bind="descriptionAttrs" v-text="description" />
13
13
  </div>
14
14
  </slot>
@@ -21,12 +21,12 @@
21
21
  <slot name="header-right" />
22
22
  </div>
23
23
 
24
- <!-- @slot Use it to add something inside. -->
25
24
  <div v-bind="contentAttrs">
25
+ <!-- @slot Use it to add something inside. -->
26
26
  <slot />
27
27
  </div>
28
28
 
29
- <UDivider v-if="isShownFooter" no-top-padding no-bottom-padding v-bind="dividerAttrs" />
29
+ <UDivider v-if="isShownFooter" no-padding v-bind="dividerAttrs" />
30
30
 
31
31
  <div v-if="isShownFooter" v-bind="footerAttrs">
32
32
  <!-- @slot Use it to add something to the left side of the footer. -->
@@ -41,14 +41,10 @@
41
41
  <script setup>
42
42
  import { computed, useSlots } from "vue";
43
43
 
44
- import { getDefault } from "../utils/utilUI.js";
45
44
  import UHeader from "../ui.text-header/UHeader.vue";
46
45
  import UDivider from "../ui.container-divider/UDivider.vue";
47
46
 
48
- import { UCard } from "./constants.js";
49
- import defaultConfig from "./config.js";
50
47
  import useAttrs from "./useAttrs.js";
51
- import useBreakpoint from "../composables/useBreakpoint.js";
52
48
 
53
49
  defineOptions({ inheritAttrs: false });
54
50
 
@@ -71,23 +67,6 @@ const props = defineProps({
71
67
  default: "",
72
68
  },
73
69
 
74
- /**
75
- * Card padding.
76
- * @values sm, md, lg
77
- */
78
- padding: {
79
- type: String,
80
- default: getDefault(defaultConfig, UCard).padding,
81
- },
82
-
83
- /**
84
- * Reverse left and right footer blocks (in a mobile version only).
85
- */
86
- mobileFooterReverse: {
87
- type: Boolean,
88
- default: getDefault(defaultConfig, UCard).mobileFooterReverse,
89
- },
90
-
91
70
  /**
92
71
  * Component ui config object.
93
72
  */
@@ -116,8 +95,6 @@ const isShownFooter = computed(() => {
116
95
  return hasSlotContent(slots["footer-left"]) || hasSlotContent(slots["footer-right"]);
117
96
  });
118
97
 
119
- const { isMobileBreakpoint } = useBreakpoint();
120
-
121
98
  const {
122
99
  hasSlotContent,
123
100
  wrapperAttrs,
@@ -129,5 +106,5 @@ const {
129
106
  descriptionAttrs,
130
107
  contentAttrs,
131
108
  footerAttrs,
132
- } = useAttrs(props, { isMobileBreakpoint });
109
+ } = useAttrs(props);
133
110
  </script>
@@ -1,25 +1,14 @@
1
1
  export default /*tw*/ {
2
- wrapper: {
3
- base: "border rounded-dynamic border-gray-200 bg-white space-y-4 md:space-y-6 w-full",
4
- variants: {
5
- padding: {
6
- sm: "p-2 md:p-4",
7
- md: "p-4 md:p-6",
8
- lg: "p-6 md:p-8",
9
- },
10
- },
11
- },
2
+ wrapper: "p-4 md:p-5 border rounded-dynamic border-gray-200 bg-white space-y-4 w-full",
12
3
  header: "flex justify-between",
13
- headerLeft: "flex items-center space-x-4 w-full",
14
- headerLeftFallback: "flex flex-col w-full",
4
+ headerLeft: "flex items-center gap-2 w-fit",
5
+ headerLeftFallback: "flex flex-col w-fit",
15
6
  title: "{UHeader}",
16
- description: "mt-1.5 text-base font-normal text-gray-500",
17
- content: "",
7
+ description: "mt-1 text-sm font-normal text-gray-500",
8
+ content: "text-sm",
18
9
  divider: "{UDivider}",
19
10
  footer: "flex justify-between",
20
- footerMobileReverse: "flex flex-col-reverse space-y-reverse",
21
11
  defaults: {
22
- padding: "md",
23
- mobileFooterReverse: false,
12
+ //
24
13
  },
25
14
  };
@@ -1,7 +1,6 @@
1
1
  import { getArgTypes, getSlotNames, getSlotsFragment } from "../../utils/utilStorybook.js";
2
2
 
3
3
  import UCard from "../../ui.container-card/UCard.vue";
4
- import URow from "../../ui.container-row/URow.vue";
5
4
  import UInput from "../../ui.form-input/UInput.vue";
6
5
  import UButton from "../../ui.button/UButton.vue";
7
6
  import UIcon from "../../ui.image-icon/UIcon.vue";
@@ -49,37 +48,12 @@ const DefaultTemplate = (args) => ({
49
48
  `,
50
49
  });
51
50
 
52
- const EnumVariantTemplate = (args, { argTypes } = {}) => ({
53
- components: { UCard, URow },
54
- setup() {
55
- return {
56
- args,
57
- options: argTypes[args.enum].options,
58
- };
59
- },
60
- template: `
61
- <URow>
62
- <UCard
63
- v-for="(option, index) in options"
64
- :key="index"
65
- v-bind="args"
66
- :[args.enum]="option"
67
- >
68
- ${defaultTemplate}
69
- </UCard>
70
- </URow>
71
- `,
72
- });
73
-
74
51
  export const Default = DefaultTemplate.bind({});
75
52
  Default.args = {};
76
53
 
77
54
  export const Description = DefaultTemplate.bind({});
78
55
  Description.args = { description: "Card description" };
79
56
 
80
- export const Padding = EnumVariantTemplate.bind({});
81
- Padding.args = { enum: "padding" };
82
-
83
57
  export const SlotHeaderLeftBefore = DefaultTemplate.bind({});
84
58
  SlotHeaderLeftBefore.args = {
85
59
  slotTemplate: `
@@ -125,7 +99,7 @@ SlotFooterLeft.args = {
125
99
  slotTemplate: `
126
100
  ${defaultTemplate}
127
101
  <template #footer-left>
128
- <UButton label="Read more" />
102
+ <UButton size="sm" label="Read more" />
129
103
  </template>
130
104
  `,
131
105
  };
@@ -135,7 +109,7 @@ SlotFooterRight.args = {
135
109
  slotTemplate: `
136
110
  ${defaultTemplate}
137
111
  <template #footer-right>
138
- <UButton label="Read more" />
112
+ <UButton size="sm" label="Read more" />
139
113
  </template>
140
114
  `,
141
115
  };
@@ -1,26 +1,11 @@
1
- import { computed } from "vue";
2
1
  import useUI from "../composables/useUI.js";
3
2
 
4
3
  import defaultConfig from "./config.js";
5
4
 
6
- export default function useAttrs(props, { isMobileBreakpoint }) {
7
- const { config, getKeysAttrs, hasSlotContent, getExtendingKeysClasses } = useUI(
8
- defaultConfig,
9
- () => props.config,
10
- );
5
+ export default function useAttrs(props) {
6
+ const { config, getKeysAttrs, hasSlotContent } = useUI(defaultConfig, () => props.config);
11
7
 
12
- const extendingKeys = ["footerMobileReverse"];
13
- const extendingKeysClasses = getExtendingKeysClasses(extendingKeys);
14
-
15
- const keysAttrs = getKeysAttrs({}, extendingKeys, {
16
- footer: {
17
- extend: computed(() => [
18
- props.mobileFooterReverse &&
19
- isMobileBreakpoint.value &&
20
- extendingKeysClasses.footerMobileReverse.value,
21
- ]),
22
- },
23
- });
8
+ const keysAttrs = getKeysAttrs();
24
9
 
25
10
  return {
26
11
  config,
@@ -14,7 +14,7 @@
14
14
  :size="size"
15
15
  :left-icon="leftIcon"
16
16
  :right-icon="rightIcon"
17
- v-bind="inputAttrs"
17
+ v-bind="isShownCalendar ? activeInputAttrs : inputAttrs"
18
18
  @focus="activate"
19
19
  >
20
20
  <template #left>
@@ -317,7 +317,7 @@ const currentLocale = computed(() => merge(defaultConfig.i18n, i18nGlobal, props
317
317
 
318
318
  const elementId = props.id || useId();
319
319
 
320
- const { config, inputAttrs, calendarAttrs, wrapperAttrs } = useAttrs(props, {
320
+ const { config, inputAttrs, activeInputAttrs, calendarAttrs, wrapperAttrs } = useAttrs(props, {
321
321
  isShownCalendar,
322
322
  isTop,
323
323
  isRight,
@@ -1,9 +1,9 @@
1
1
  export default /*tw*/ {
2
2
  wrapper: "relative",
3
3
  input: "{UInput}",
4
- inputFocused: {
4
+ activeInput: {
5
5
  component: "{UInput}",
6
- block: "ring-dynamic ring-offset-dynamic ring-brand-700/15 border-brand-500 hover:border-brand-500",
6
+ block: "ring-dynamic rounded-dynamic ring-offset-dynamic ring-brand-700/15 border-brand-500 hover:border-brand-500",
7
7
  },
8
8
  calendar: {
9
9
  component: "{UCalendar}",
@@ -5,11 +5,8 @@ import useUI from "../composables/useUI.js";
5
5
  import defaultConfig from "./config.js";
6
6
  import { POSITION } from "../composables/useAutoPosition.js";
7
7
 
8
- export default function useAttrs(props, { isShownCalendar, isTop, isRight }) {
9
- const { config, getKeysAttrs, hasSlotContent, getExtendingKeysClasses } = useUI(
10
- defaultConfig,
11
- () => props.config,
12
- );
8
+ export default function useAttrs(props, { isTop, isRight }) {
9
+ const { config, getKeysAttrs, hasSlotContent } = useUI(defaultConfig, () => props.config);
13
10
 
14
11
  const mutatedProps = computed(() => ({
15
12
  openDirectionY: isTop.value ? POSITION.top : POSITION.bottom,
@@ -18,14 +15,7 @@ export default function useAttrs(props, { isShownCalendar, isTop, isRight }) {
18
15
  description: Boolean(props.description),
19
16
  }));
20
17
 
21
- const extendingKeys = ["inputFocused"];
22
- const extendingKeysClasses = getExtendingKeysClasses(extendingKeys, mutatedProps);
23
-
24
- const keysAttrs = getKeysAttrs(mutatedProps, extendingKeys, {
25
- input: {
26
- extend: computed(() => [isShownCalendar.value && extendingKeysClasses.inputFocused.value]),
27
- },
28
- });
18
+ const keysAttrs = getKeysAttrs(mutatedProps);
29
19
 
30
20
  /* Merging DatePicker's i18n translations into Calendar's i18n translations. */
31
21
  watchEffect(() => {
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.391",
4
+ "version": "0.0.393",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",
@@ -1365,24 +1365,6 @@
1365
1365
  },
1366
1366
  "default": "\"\""
1367
1367
  },
1368
- {
1369
- "name": "padding",
1370
- "description": "Card padding.",
1371
- "value": {
1372
- "kind": "expression",
1373
- "type": "'sm' | 'md' | 'lg'"
1374
- },
1375
- "default": "md"
1376
- },
1377
- {
1378
- "name": "mobileFooterReverse",
1379
- "description": "Reverse left and right footer blocks (in a mobile version only).",
1380
- "value": {
1381
- "kind": "expression",
1382
- "type": "boolean"
1383
- },
1384
- "default": "false"
1385
- },
1386
1368
  {
1387
1369
  "name": "config",
1388
1370
  "description": "Component ui config object.",
@@ -1420,7 +1402,8 @@
1420
1402
  "description": "Use it to customise right side of the header."
1421
1403
  },
1422
1404
  {
1423
- "name": "default"
1405
+ "name": "default",
1406
+ "description": "Use it to add something inside."
1424
1407
  },
1425
1408
  {
1426
1409
  "name": "footer-left",