@design-system-rte/core 1.3.2 → 1.4.0

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.
@@ -6,7 +6,7 @@ export declare class DropdownManager {
6
6
  static closeAll(): void;
7
7
  static getOpenedDropdowns(): string[];
8
8
  static getParentDropdownId(id: string): string | null;
9
- static closeSubMenus(parentId: string): void;
9
+ static closeSubMenus(parentId: string, excludeId?: string): void;
10
10
  static subscribe(id: string, callback: () => void): () => void;
11
11
  private static notifyListeners;
12
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownManager.d.ts","sourceRoot":"","sources":["../../../components/dropdown/DropdownManager.ts"],"names":[],"mappings":"AAGA,qBAAa,eAAe;IAC1B,MAAM,CAAC,UAAU;IAIjB,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM;IAIxB,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM;IAKtB,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,MAAM;IAKvB,MAAM,CAAC,QAAQ;IAOf,MAAM,CAAC,kBAAkB;IAIzB,MAAM,CAAC,mBAAmB,CAAC,EAAE,EAAE,MAAM;IAOrC,MAAM,CAAC,aAAa,CAAC,QAAQ,EAAE,MAAM;IAMrC,MAAM,CAAC,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI;IASjD,OAAO,CAAC,MAAM,CAAC,eAAe;CAG/B"}
1
+ {"version":3,"file":"DropdownManager.d.ts","sourceRoot":"","sources":["../../../components/dropdown/DropdownManager.ts"],"names":[],"mappings":"AAGA,qBAAa,eAAe;IAC1B,MAAM,CAAC,UAAU;IAIjB,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM;IAIxB,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM;IAKtB,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,MAAM;IAKvB,MAAM,CAAC,QAAQ;IAOf,MAAM,CAAC,kBAAkB;IAIzB,MAAM,CAAC,mBAAmB,CAAC,EAAE,EAAE,MAAM;IAOrC,MAAM,CAAC,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;IAQzD,MAAM,CAAC,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI;IASjD,OAAO,CAAC,MAAM,CAAC,eAAe;CAG/B"}
@@ -26,14 +26,14 @@ export class DropdownManager {
26
26
  }
27
27
  static getParentDropdownId(id) {
28
28
  const parts = id.split("-");
29
- if (parts.length <= 2)
29
+ if (parts.length < 2)
30
30
  return null;
31
31
  parts.pop();
32
32
  return parts.join("-");
33
33
  }
34
- static closeSubMenus(parentId) {
34
+ static closeSubMenus(parentId, excludeId) {
35
35
  const dropdownsCurrentlyOpened = Object.keys(globalDropdownState);
36
- const dropdownsToClose = dropdownsCurrentlyOpened.filter((id) => id.startsWith(parentId) && id !== parentId);
36
+ const dropdownsToClose = dropdownsCurrentlyOpened.filter((id) => id.startsWith(parentId) && id !== parentId && id !== excludeId);
37
37
  dropdownsToClose.forEach((dropdown) => DropdownManager.close(dropdown));
38
38
  }
39
39
  static subscribe(id, callback) {
@@ -4,6 +4,8 @@ export interface SegmentedControlProps {
4
4
  options: SegmentOptions[];
5
5
  onChange: (id: string) => void;
6
6
  selectedSegment?: string;
7
+ appearance?: "brand" | "neutral";
8
+ compactSpacing?: boolean;
7
9
  }
8
10
 
9
11
  export interface SegmentOptions extends BadgeHolderProps {
@@ -18,4 +20,6 @@ export interface SegmentProps extends BadgeHolderProps {
18
20
  label?: string;
19
21
  icon?: string;
20
22
  isSelected?: boolean;
23
+ appearance?: "brand" | "neutral";
24
+ isCompact?: boolean;
21
25
  }
@@ -1,6 +1,13 @@
1
1
  import { Alignment, Position } from "../common/common-types";
2
+ export interface DropdownAutoPlacementConfig {
3
+ hostElement: HTMLElement;
4
+ castedElement: Element;
5
+ defaultPosition: Exclude<Position, "auto">;
6
+ offset?: number;
7
+ hasDropdownParent?: boolean;
8
+ }
2
9
  export declare const getAutoPlacement: (hostElement: HTMLElement, castedElement: Element, defaultPosition: Exclude<Position, "auto">, offset?: number, hasParent?: boolean) => Exclude<Position, "auto">;
3
- export declare const getAutoPlacementDropdown: (hostElement: HTMLElement, castedElement: Element, defaultPosition: Exclude<Position, "auto">, offset?: number, hasDropdownParent?: boolean) => Exclude<Position, "auto">;
10
+ export declare const getAutoPlacementDropdown: (config: DropdownAutoPlacementConfig) => Exclude<Position, "auto">;
4
11
  export declare const getAutoAlignment: (hostElement: HTMLElement, castedElement: Element, position: Exclude<Position, "auto">) => "start" | "center" | "end";
5
12
  export declare const getCoordinates: (position: Exclude<Position, "auto">, triggerElement: HTMLElement, castedElement: HTMLElement, offset?: number, alignment?: Alignment) => {
6
13
  top: number;
@@ -1 +1 @@
1
- {"version":3,"file":"auto-placement.d.ts","sourceRoot":"","sources":["../../../components/utils/auto-placement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAE7D,eAAO,MAAM,gBAAgB,GAC3B,aAAa,WAAW,EACxB,eAAe,OAAO,EACtB,iBAAiB,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,EAC1C,SAAQ,MAAU,EAClB,YAAW,OAAe,KACzB,OAAO,CAAC,QAAQ,EAAE,MAAM,CAkC1B,CAAC;AAEF,eAAO,MAAM,wBAAwB,GACnC,aAAa,WAAW,EACxB,eAAe,OAAO,EACtB,iBAAiB,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,EAC1C,SAAQ,MAAU,EAClB,oBAAmB,OAAe,KACjC,OAAO,CAAC,QAAQ,EAAE,MAAM,CAe1B,CAAC;AA0BF,eAAO,MAAM,gBAAgB,GAC3B,aAAa,WAAW,EACxB,eAAe,OAAO,EACtB,UAAU,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,+BAuBpC,CAAC;AAEF,eAAO,MAAM,cAAc,GACzB,UAAU,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,EACnC,gBAAgB,WAAW,EAC3B,eAAe,WAAW,EAC1B,SAAQ,MAAU,EAClB,YAAW,SAAoB;;;CAchC,CAAC"}
1
+ {"version":3,"file":"auto-placement.d.ts","sourceRoot":"","sources":["../../../components/utils/auto-placement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAE7D,MAAM,WAAW,2BAA2B;IAC1C,WAAW,EAAE,WAAW,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC;IACvB,eAAe,EAAE,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,eAAO,MAAM,gBAAgB,GAC3B,aAAa,WAAW,EACxB,eAAe,OAAO,EACtB,iBAAiB,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,EAC1C,SAAQ,MAAU,EAClB,YAAW,OAAe,KACzB,OAAO,CAAC,QAAQ,EAAE,MAAM,CAkC1B,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,QAAQ,2BAA2B,KAAG,OAAO,CAAC,QAAQ,EAAE,MAAM,CAiBtG,CAAC;AA0BF,eAAO,MAAM,gBAAgB,GAC3B,aAAa,WAAW,EACxB,eAAe,OAAO,EACtB,UAAU,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,+BAuBpC,CAAC;AAEF,eAAO,MAAM,cAAc,GACzB,UAAU,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,EACnC,gBAAgB,WAAW,EAC3B,eAAe,WAAW,EAC1B,SAAQ,MAAU,EAClB,YAAW,SAAoB;;;CAchC,CAAC"}
@@ -35,7 +35,8 @@ export const getAutoPlacement = (hostElement, castedElement, defaultPosition, of
35
35
  return "right";
36
36
  return defaultPosition;
37
37
  };
38
- export const getAutoPlacementDropdown = (hostElement, castedElement, defaultPosition, offset = 0, hasDropdownParent = false) => {
38
+ export const getAutoPlacementDropdown = (config) => {
39
+ const { hostElement, castedElement, defaultPosition, offset = 0, hasDropdownParent = false } = config;
39
40
  const triggerRect = hostElement.getBoundingClientRect();
40
41
  const elementRect = castedElement.getBoundingClientRect();
41
42
  const sides = {
package/index.d.ts CHANGED
@@ -40,4 +40,5 @@ export * from "./components/toast";
40
40
  export * from "./components/tooltip";
41
41
  export * from "./components/utils";
42
42
  export * from "./components/stepper";
43
+ export * from "./utils";
43
44
  //# sourceMappingURL=index.d.ts.map
package/index.js CHANGED
@@ -40,3 +40,4 @@ export * from "./components/toast";
40
40
  export * from "./components/tooltip";
41
41
  export * from "./components/utils";
42
42
  export * from "./components/stepper";
43
+ export * from "./utils";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@design-system-rte/core",
3
- "version": "1.3.2",
3
+ "version": "1.4.0",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "files": [
@@ -36,5 +36,6 @@
36
36
  },
37
37
  "peerDependencies": {
38
38
  "sass": "^1.85.1"
39
- }
39
+ },
40
+ "private": false
40
41
  }