vueless 0.0.544 → 0.0.545

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": "vueless",
3
- "version": "0.0.544",
3
+ "version": "0.0.545",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
@@ -85,7 +85,7 @@ const addOptionKeyCombination = computed(() => {
85
85
  });
86
86
 
87
87
  watch(
88
- () => props.options,
88
+ () => [props.options, props.size],
89
89
  () => {
90
90
  nextTick(() => {
91
91
  const options = [
@@ -100,7 +100,20 @@ watch(
100
100
 
101
101
  const maxHeight = options
102
102
  .slice(0, props.visibleOptions)
103
- .map((el) => el.getBoundingClientRect().height)
103
+ .map((el) => {
104
+ const elHeight = el.getBoundingClientRect().height;
105
+
106
+ const styles = window.getComputedStyle(el);
107
+ const marginTop = parseFloat(styles.marginTop || "0");
108
+ const marginBottom = parseFloat(styles.marginBottom || "0");
109
+
110
+ const [childDiv] = el.getElementsByTagName("div");
111
+ const childStyles = childDiv && window.getComputedStyle(childDiv);
112
+ const childMarginTop = parseFloat(childStyles?.marginTop || "0");
113
+ const childMarginBottom = parseFloat(childStyles?.marginBottom || "0");
114
+
115
+ return elHeight + marginTop + marginBottom + childMarginTop + childMarginBottom;
116
+ })
104
117
  .reduce((acc, cur) => acc + cur, 0);
105
118
 
106
119
  wrapperMaxHeight.value = `${maxHeight + 10}px`;
@@ -134,7 +147,7 @@ function isSelectedOption(option: Option) {
134
147
  }
135
148
 
136
149
  function getMarginForSubCategory(level: number = 0) {
137
- const baseMargin = 1;
150
+ const baseMargin = 0.5;
138
151
 
139
152
  if (level > 1) {
140
153
  return `margin-left: ${baseMargin * (level - 1)}rem`;
@@ -28,19 +28,8 @@ export default /*tw*/ {
28
28
  optionContent: "overflow-visible text-ellipsis",
29
29
  optionSelected: "font-bold",
30
30
  optionHighlighted: "bg-brand-50",
31
- group: {
32
- base: `pointer-events-none bg-transparent font-medium !leading-none uppercase text-gray-400 pt-4 pb-1
33
- group-first/item:pt-2`,
34
- variants: {
35
- size: {
36
- sm: "text-2xs",
37
- md: "text-xs",
38
- lg: "text-sm",
39
- },
40
- },
41
- },
42
- subGroup: {
43
- base: "pointer-events-none bg-transparent font-medium !leading-none uppercase text-gray-400 pt-2",
31
+ groupBase: {
32
+ base: "px-2 pb-2.5 font-medium !leading-none text-gray-400 overflow-hidden text-ellipsis",
44
33
  variants: {
45
34
  size: {
46
35
  sm: "text-2xs",
@@ -49,6 +38,12 @@ export default /*tw*/ {
49
38
  },
50
39
  },
51
40
  },
41
+ group: `
42
+ border-t border-gray-100 group-first/item:border-none
43
+ mt-1.5 group-first/item:mt-0
44
+ pt-4 group-first/item:pt-2
45
+ `,
46
+ subGroup: "pt-2",
52
47
  addOptionLabelWrapper: "-mb-[1.375rem] active:bg-brand-100",
53
48
  addOptionLabel: "leading-none font-medium",
54
49
  addOptionLabelHotkey: "text-gray-500",
@@ -91,12 +91,29 @@ VisibleOptions.args = { visibleOptions: 3 };
91
91
  export const WithoutOptions = DefaultTemplate.bind({});
92
92
  WithoutOptions.args = { options: [] };
93
93
 
94
+ export const GroupedOptions = DefaultTemplate.bind({});
95
+ GroupedOptions.args = {
96
+ labelKey: "name",
97
+ valueKey: "name",
98
+ options: [
99
+ { groupLabel: "Javascript" },
100
+ { name: "Vue.js" },
101
+ { name: "Adonis" },
102
+ { groupLabel: "Ruby" },
103
+ { name: "Frameworks", isSubGroup: true, level: 2 },
104
+ { name: "Rails", level: 2 },
105
+ { name: "Sinatra", level: 2 },
106
+ { groupLabel: "Other" },
107
+ { name: "Laravel" },
108
+ { name: "Phoenix" },
109
+ ],
110
+ };
111
+
94
112
  export const OptionSettings = DefaultTemplate.bind({});
95
113
  OptionSettings.args = {
96
114
  options: [
97
115
  { label: "option 1", id: "1" },
98
116
  { label: "option 2", id: "2", isHidden: true },
99
-
100
117
  {
101
118
  label: "option 3",
102
119
  id: "3",
@@ -6,7 +6,7 @@ export type OnClickOption = (option: Omit<Option, "onClick">) => void;
6
6
 
7
7
  export interface BaseOption {
8
8
  isSubGroup?: boolean;
9
- groupLabel?: boolean;
9
+ groupLabel?: string;
10
10
  level?: number;
11
11
  isHidden?: boolean;
12
12
  onClick?: OnClickOption;
@@ -12,7 +12,7 @@ export default function useAttrs(props: UDropdownListProps): UseAttrs<Config> {
12
12
  () => props.config,
13
13
  );
14
14
 
15
- const extendingKeys = ["option"];
15
+ const extendingKeys = ["option", "groupBase"];
16
16
  const extendingKeysClasses = getExtendingKeysClasses(extendingKeys);
17
17
 
18
18
  const keysAttrs = getKeysAttrs({}, [], {
@@ -20,10 +20,10 @@ export default function useAttrs(props: UDropdownListProps): UseAttrs<Config> {
20
20
  base: computed(() => [extendingKeysClasses.option.value]),
21
21
  },
22
22
  group: {
23
- base: computed(() => [extendingKeysClasses.option.value]),
23
+ base: computed(() => [extendingKeysClasses.groupBase.value]),
24
24
  },
25
25
  subGroup: {
26
- base: computed(() => [extendingKeysClasses.option.value]),
26
+ base: computed(() => [extendingKeysClasses.groupBase.value]),
27
27
  },
28
28
  });
29
29
 
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.544",
4
+ "version": "0.0.545",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",