@fluid-topics/ft-wc-utils 1.3.14 → 1.3.16

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.
@@ -1,5 +1,9 @@
1
1
  import { PropertyDeclaration } from "@lit/reactive-element";
2
2
  export declare const customElement: (tagName: string) => (clazz: CustomElementConstructor) => void;
3
3
  export declare function jsonProperty(defaultValue: any, options?: PropertyDeclaration): PropertyDecorator;
4
+ /**
5
+ * @deprecated use numberProperty instead
6
+ */
4
7
  export declare function optionalNumberProperty(options?: PropertyDeclaration): PropertyDecorator;
8
+ export declare function numberProperty(options?: PropertyDeclaration): PropertyDecorator;
5
9
  export declare function isNumber(value: any): boolean;
@@ -23,17 +23,24 @@ export function jsonProperty(defaultValue, options) {
23
23
  },
24
24
  toAttribute: (value) => {
25
25
  return JSON.stringify(value);
26
- }
26
+ },
27
27
  },
28
28
  hasChanged,
29
- ...(options !== null && options !== void 0 ? options : {})
29
+ ...(options !== null && options !== void 0 ? options : {}),
30
30
  });
31
31
  }
32
+ /**
33
+ * @deprecated use numberProperty instead
34
+ */
32
35
  export function optionalNumberProperty(options) {
36
+ return numberProperty(options);
37
+ }
38
+ export function numberProperty(options) {
33
39
  return property({
34
40
  type: Object,
35
41
  converter: {
36
42
  fromAttribute: (value) => {
43
+ console.log("from attribute", value, options);
37
44
  if (value == null) {
38
45
  return undefined;
39
46
  }
@@ -41,9 +48,10 @@ export function optionalNumberProperty(options) {
41
48
  },
42
49
  toAttribute: (value) => {
43
50
  return value == null ? undefined : "" + value;
44
- }
51
+ },
45
52
  },
46
- ...(options !== null && options !== void 0 ? options : {})
53
+ useDefault: true,
54
+ ...(options !== null && options !== void 0 ? options : {}),
47
55
  });
48
56
  }
49
57
  export function isNumber(value) {
@@ -54,10 +54,10 @@ export const designSystemVariables = {
54
54
  elevation12: FtCssVariableFactory.create("--ft-elevation-12", "", "UNKNOWN", "0px 22px 40px 0px rgba(0, 0, 0, 0.06), 0px 12px 23px 0px rgba(0, 0, 0, 0.14), 0px 10px 11px 0px rgba(0, 0, 0, 0.06)"),
55
55
  elevation16: FtCssVariableFactory.create("--ft-elevation-16", "", "UNKNOWN", "0px 28px 52px 0px rgba(0, 0, 0, 0.06), 0px 16px 29px 0px rgba(0, 0, 0, 0.14), 0px 14px 15px 0px rgba(0, 0, 0, 0.06)"),
56
56
  elevation24: FtCssVariableFactory.create("--ft-elevation-24", "", "UNKNOWN", "0px 40px 76px 0px rgba(0, 0, 0, 0.06), 0px 24px 41px 0px rgba(0, 0, 0, 0.14), 0px 22px 23px 0px rgba(0, 0, 0, 0.06)"),
57
- borderRadiusS: FtCssVariableFactory.create("--ft-border-radius-S", "", "SIZE", "4px"),
58
- borderRadiusM: FtCssVariableFactory.create("--ft-border-radius-M", "", "SIZE", "8px"),
59
- borderRadiusL: FtCssVariableFactory.create("--ft-border-radius-L", "", "SIZE", "12px"),
60
- borderRadiusXL: FtCssVariableFactory.create("--ft-border-radius-XL", "", "SIZE", "16px"),
57
+ borderRadiusS: FtCssVariableFactory.create("--ft-border-radius-s", "", "SIZE", "4px"),
58
+ borderRadiusM: FtCssVariableFactory.create("--ft-border-radius-m", "", "SIZE", "8px"),
59
+ borderRadiusL: FtCssVariableFactory.create("--ft-border-radius-l", "", "SIZE", "12px"),
60
+ borderRadiusXL: FtCssVariableFactory.create("--ft-border-radius-xl", "", "SIZE", "16px"),
61
61
  titleFont: FtCssVariableFactory.create("--ft-title-font", "", "UNKNOWN", "Ubuntu, system-ui, sans-serif"),
62
62
  contentFont: FtCssVariableFactory.create("--ft-content-font", "", "UNKNOWN", "'Open Sans', system-ui, sans-serif"),
63
63
  transitionDuration: FtCssVariableFactory.create("--ft-transition-duration", "", "UNKNOWN", "250ms"),
@@ -1,3 +1,4 @@
1
1
  import { ComputePositionReturn, Placement, Strategy } from "@floating-ui/dom";
2
+ import { FtCssVariable } from "@fluid-topics/design-system-variables";
2
3
  export declare function computeOffsetPosition(reference: HTMLElement, element: HTMLElement, placement: Placement): Promise<ComputePositionReturn>;
3
- export declare function computeOffsetAutoPosition(reference: HTMLElement, element: HTMLElement, placement?: Placement, allowedPlacements?: Placement[], strategy?: Strategy, maxHeightCssVariable?: string, offsetValue?: number): Promise<ComputePositionReturn>;
4
+ export declare function computeOffsetAutoPosition(reference: HTMLElement, element: HTMLElement, placement?: Placement, allowedPlacements?: Placement[], strategy?: Strategy, maxHeightCssVariable?: string | FtCssVariable, offsetValue?: number): Promise<ComputePositionReturn>;
package/build/floating.js CHANGED
@@ -29,8 +29,11 @@ export async function computeOffsetAutoPosition(reference, element, placement, a
29
29
  autoPlacement({ allowedPlacements: allowedPlacements }),
30
30
  size({
31
31
  apply({ availableHeight, elements }) {
32
+ if (typeof maxHeightCssVariable === "string") {
33
+ maxHeightCssVariable = `var(${maxHeightCssVariable})`;
34
+ }
32
35
  if (maxHeightCssVariable) {
33
- elements.floating.style.maxHeight = `min(${Math.max(0, availableHeight)}px, var(${maxHeightCssVariable}))`;
36
+ elements.floating.style.maxHeight = `min(${Math.max(0, availableHeight)}px, ${maxHeightCssVariable})`;
34
37
  }
35
38
  else {
36
39
  elements.floating.style.maxHeight = `${Math.max(0, availableHeight)}px`;