@teselagen/ui 0.8.3 → 0.8.5

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/index.cjs.js CHANGED
@@ -2951,7 +2951,18 @@ let clearMe;
2951
2951
  document.querySelectorAll(`.${id}`).forEach((elem) => {
2952
2952
  elem.classList.remove(id);
2953
2953
  });
2954
- el2.classList.add(id);
2954
+ let targetEl = el2;
2955
+ if (targetEl.disabled || targetEl.getAttribute("disabled") !== null) {
2956
+ const parent2 = targetEl.parentElement;
2957
+ if (parent2) {
2958
+ parent2.classList.add(id);
2959
+ targetEl = parent2;
2960
+ } else {
2961
+ el2.classList.add(id);
2962
+ }
2963
+ } else {
2964
+ el2.classList.add(id);
2965
+ }
2955
2966
  const inst = tippy(`.${id}`, __spreadValues(__spreadProps(__spreadValues({
2956
2967
  theme: "teselagen",
2957
2968
  plugins: [followCursor],
package/index.es.js CHANGED
@@ -2933,7 +2933,18 @@ let clearMe;
2933
2933
  document.querySelectorAll(`.${id}`).forEach((elem) => {
2934
2934
  elem.classList.remove(id);
2935
2935
  });
2936
- el2.classList.add(id);
2936
+ let targetEl = el2;
2937
+ if (targetEl.disabled || targetEl.getAttribute("disabled") !== null) {
2938
+ const parent2 = targetEl.parentElement;
2939
+ if (parent2) {
2940
+ parent2.classList.add(id);
2941
+ targetEl = parent2;
2942
+ } else {
2943
+ el2.classList.add(id);
2944
+ }
2945
+ } else {
2946
+ el2.classList.add(id);
2947
+ }
2937
2948
  const inst = tippy(`.${id}`, __spreadValues(__spreadProps(__spreadValues({
2938
2949
  theme: "teselagen",
2939
2950
  plugins: [followCursor],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teselagen/ui",
3
- "version": "0.8.3",
3
+ "version": "0.8.5",
4
4
  "main": "./src/index.js",
5
5
  "type": "module",
6
6
  "exports": {
@@ -52,7 +52,23 @@ let clearMe;
52
52
  elem.classList.remove(id);
53
53
  });
54
54
 
55
- el.classList.add(id);
55
+ // Check if element is disabled, if so use parent instead
56
+ let targetEl = el;
57
+ if (targetEl.disabled || targetEl.getAttribute("disabled") !== null) {
58
+ const parent = targetEl.parentElement;
59
+ if (parent) {
60
+ // Use the parent as the tooltip target
61
+ parent.classList.add(id);
62
+ targetEl = parent; // Change the tooltip target to parent
63
+ } else {
64
+ // No parent, keep using the original element
65
+ el.classList.add(id);
66
+ }
67
+ } else {
68
+ // Element not disabled, use it directly
69
+ el.classList.add(id);
70
+ }
71
+
56
72
  const inst = tippy(`.${id}`, {
57
73
  theme: "teselagen",
58
74
  plugins: [followCursor],
@@ -84,19 +100,12 @@ let clearMe;
84
100
  requires: ["computeStyles"],
85
101
  requiresIfExists: ["offset"],
86
102
  fn({ state }) {
87
- // console.log(`state:`, state);
88
- // state.styles.popper.bottom = 20 + "px";
89
103
  const customBoundary =
90
104
  document.querySelector(dataAvoid) ||
91
105
  document.querySelector(dataAvoidBackup);
92
106
 
93
107
  if (!customBoundary) return;
94
108
  const a = customBoundary.getBoundingClientRect();
95
- // console.log(
96
- // `state.rects.reference.y:`,
97
- // state.rects.reference.y
98
- // );
99
- // console.log(`a.top:`, a.top);
100
109
 
101
110
  if (a.top < state.rects.reference.y) {
102
111
  const b = Math.abs(
@@ -104,16 +113,6 @@ let clearMe;
104
113
  );
105
114
  state.styles.popper.bottom = b + "px";
106
115
  }
107
-
108
- // const overflow = detectOverflow(state, {
109
- // boundary: customBoundary,
110
- // altBoundary: true
111
- // });
112
- // console.log(`overflow:`, overflow);
113
- // if (overflow.bottom > 0) {
114
- // const a = Math.abs(overflow.bottom);
115
- // state.styles.popper.bottom = a + "px";
116
- // }
117
116
  }
118
117
  }
119
118
  ]
@@ -199,3 +198,6 @@ function parentIncludesNoChildDataTip(el, count) {
199
198
  if (el.getAttribute("data-no-child-data-tip")) return true;
200
199
  return parentIncludesNoChildDataTip(el.parentElement, count + 1);
201
200
  }
201
+
202
+ // Export the function to clear parent tooltips so it can be used elsewhere
203
+ // export { clearParentTooltips };
@@ -1,7 +0,0 @@
1
- export function EditableCell({ cancelEdit, dataTest, finishEdit, isNumeric, initialValue }: {
2
- cancelEdit: any;
3
- dataTest: any;
4
- finishEdit: any;
5
- isNumeric: any;
6
- initialValue: any;
7
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,43 +0,0 @@
1
- import { noop } from 'lodash-es';
2
- declare namespace _default {
3
- export { noop as addFilters };
4
- export let className: string;
5
- export { noop as clearFilters };
6
- export { noop as contextMenu };
7
- export let disabled: boolean;
8
- export let entities: never[];
9
- export let extraClasses: string;
10
- export let filters: never[];
11
- export let isCopyable: boolean;
12
- export { noop as isEntityDisabled };
13
- export let isLoading: boolean;
14
- export let isSimple: boolean;
15
- export let isSingleSelect: boolean;
16
- export let maxHeight: number;
17
- export let noHeader: boolean;
18
- export let noSelect: boolean;
19
- export let noUserSelect: boolean;
20
- export { noop as onDeselect };
21
- export { noop as onMultiRowSelect };
22
- export { noop as onRowClick };
23
- export { noop as onRowSelect };
24
- export { noop as onSingleRowSelect };
25
- export let page: number;
26
- export let pageSize: number;
27
- export let reduxFormExpandedEntityIdMap: {};
28
- export let reduxFormSearchInput: string;
29
- export let reduxFormSelectedEntityIdMap: {};
30
- export { noop as removeSingleFilter };
31
- export let resized: never[];
32
- export { noop as resizePersist };
33
- export { noop as setFilter };
34
- export { noop as setOrder };
35
- export { noop as setPage };
36
- export { noop as setPageSize };
37
- export { noop as setSearchTerm };
38
- export let showCount: boolean;
39
- export let style: {};
40
- export let withCheckboxes: boolean;
41
- export let withSort: boolean;
42
- }
43
- export default _default;
@@ -1 +0,0 @@
1
- export default function computePresets(props?: {}): import('lodash').Dictionary<any>;
@@ -1 +0,0 @@
1
- export function useDeepEqualMemo(value: any): undefined;
@@ -1,49 +0,0 @@
1
- /**
2
- * Note all these options can be passed at Design Time or at Runtime (like reduxForm())
3
- *
4
- * @export
5
- *
6
- * @param {compOrOpts} compOrOpts
7
- * @typedef {object} compOrOpts
8
- * @property {*string} formName - required unique identifier for the table
9
- * @property {Object | Function} schema - The data table schema or a function returning it. The function wll be called with props as the argument.
10
- * @property {boolean} urlConnected - whether the table should connect to/update the URL
11
- * @property {boolean} withSelectedEntities - whether or not to pass the selected entities
12
- * @property {boolean} isCodeModel - whether the model is keyed by code instead of id in the db
13
- * @property {object} defaults - tableParam defaults such as pageSize, filter, etc
14
- * @property {boolean} noOrderError - won't console an error if an order is not found on schema
15
- */
16
- export default function useTableParams(props: any): any;
17
- /**
18
- * Note all these options can be passed at Design Time or at Runtime (like reduxForm())
19
- */
20
- export type compOrOpts = {
21
- /**
22
- * } formName - required unique identifier for the table
23
- */
24
- string: any;
25
- /**
26
- * - The data table schema or a function returning it. The function wll be called with props as the argument.
27
- */
28
- schema: Object | Function;
29
- /**
30
- * - whether the table should connect to/update the URL
31
- */
32
- urlConnected: boolean;
33
- /**
34
- * - whether or not to pass the selected entities
35
- */
36
- withSelectedEntities: boolean;
37
- /**
38
- * - whether the model is keyed by code instead of id in the db
39
- */
40
- isCodeModel: boolean;
41
- /**
42
- * - tableParam defaults such as pageSize, filter, etc
43
- */
44
- defaults: object;
45
- /**
46
- * - won't console an error if an order is not found on schema
47
- */
48
- noOrderError: boolean;
49
- };