@orangelogic/design-system 2.44.0 → 2.45.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.
Files changed (27) hide show
  1. package/library/chunks/{color-swatch-group.DrpRd8Xw.js → color-swatch-group.CMz7zQdk.js} +1 -1
  2. package/library/chunks/{file-on-demand.ZcYwCR_s.js → file-on-demand.CODE3g50.js} +1 -1
  3. package/library/chunks/{list-editor.B_BRQoUp.js → list-editor.BZMql0Tj.js} +1 -1
  4. package/library/chunks/ref.BDmlFGTP.js +99 -0
  5. package/library/chunks/{tab-group.g2uXM2W8.js → tab-group.uF5JbAGa.js} +1 -1
  6. package/library/chunks/{table.Be9berv0.js → table.D6Abk0xC.js} +1 -1
  7. package/library/components/atoms.js +3 -3
  8. package/library/components/color-swatch-group.js +2 -2
  9. package/library/components/file-on-demand.js +2 -2
  10. package/library/components/list-editor.js +2 -2
  11. package/library/components/menu-item.js +678 -13
  12. package/library/components/menu.js +1 -1
  13. package/library/components/molecules.js +1 -1
  14. package/library/components/organisms.js +2 -2
  15. package/library/components/range.js +535 -396
  16. package/library/components/tab-group.js +2 -2
  17. package/library/components/table.js +1 -1
  18. package/library/components/types.js +204 -189
  19. package/library/package.json +1 -1
  20. package/library/packages/atoms/src/components/range/mark-controller.d.ts +34 -0
  21. package/library/packages/atoms/src/components/range/range.d.ts +6 -8
  22. package/library/packages/atoms/src/components/range/range.utils.d.ts +58 -1
  23. package/library/packages/organisms/src/downloader/downloader.d.ts +1 -0
  24. package/library/packages/tools/src/fetch-image/fetch-image.d.ts +6 -1
  25. package/library/react-web-component.d.ts +4 -0
  26. package/package.json +1 -1
  27. package/library/chunks/menu-item.DOFCmq0Z.js +0 -775
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orangelogic/design-system",
3
3
  "type": "module",
4
- "version": "2.44.0",
4
+ "version": "2.45.0",
5
5
  "license": "UNLICENSED",
6
6
  "types": "library/types.d.ts",
7
7
  "scripts": {
@@ -0,0 +1,34 @@
1
+ import { Mark } from '../../../../types/src/range';
2
+ import { ReactiveController, ReactiveControllerHost } from 'lit';
3
+ import { default as CxRange } from './range';
4
+
5
+ /** A reactive controller to manage the rendering of marks for the range component. */
6
+ export declare class MarkController implements ReactiveController {
7
+ private readonly host;
8
+ private readonly localize;
9
+ private readonly marksContainerRef;
10
+ private containerWidth;
11
+ private marksWithLabels;
12
+ constructor(host: ReactiveControllerHost & CxRange);
13
+ hostConnected(): void;
14
+ hostDisconnected(): void;
15
+ hostUpdated(): void;
16
+ /**
17
+ * Gets all mark elements from the datalist slot.
18
+ * @returns NodeList of option elements or null
19
+ */
20
+ getAllMarks(): NodeListOf<HTMLElement> | undefined;
21
+ /**
22
+ * Initializes marks based on the datalist slot or auto-generates them from step.
23
+ * @returns Array of valid mark objects
24
+ */
25
+ initMarks(): Mark[];
26
+ renderMark(mark: Mark): import('lit').TemplateResult<1>;
27
+ /**
28
+ * Calculates which marks should display labels based on available width.
29
+ * Uses a minimum spacing between labels to prevent overcrowding.
30
+ */
31
+ private calculateVisibleLabels;
32
+ handleResize(): void;
33
+ renderMarks(): import('lit').TemplateResult<1>;
34
+ }
@@ -1,12 +1,9 @@
1
+ import { default as CxResizeObserver } from '../resize-observer/resize-observer.ts';
1
2
  import { CortexFormControl, default as CortexElement } from '../../../../base/src/cortex-element.ts';
3
+ import { Mark } from '../../../../types/src/range';
2
4
  import { CSSResultGroup } from 'lit';
3
5
  import { default as CxTooltip } from '../tooltip/tooltip';
4
6
 
5
- type Mark = {
6
- hidden: boolean;
7
- label: string;
8
- value: number;
9
- };
10
7
  /**
11
8
  * @summary Ranges allow the user to select a single value or a range of values using a slider.
12
9
  *
@@ -49,11 +46,13 @@ type Mark = {
49
46
  export default class CxRange extends CortexElement implements CortexFormControl {
50
47
  static readonly styles: CSSResultGroup;
51
48
  static readonly dependencies: {
49
+ 'cx-resize-observer': typeof CxResizeObserver;
52
50
  'cx-tooltip': typeof CxTooltip;
53
51
  };
54
52
  private readonly formControlController;
55
53
  private readonly hasSlotController;
56
54
  private readonly localize;
55
+ private readonly markController;
57
56
  private resizeObserver;
58
57
  input: HTMLInputElement;
59
58
  multiInputMin: HTMLInputElement;
@@ -102,6 +101,8 @@ export default class CxRange extends CortexElement implements CortexFormControl
102
101
  max: number;
103
102
  /** The interval at which the range will increase and decrease. */
104
103
  step: number | undefined;
104
+ /** The minimum spacing between marks labels. */
105
+ markLabelSpacing: number;
105
106
  /** The preferred placement of the range's tooltip. */
106
107
  tooltipPlacement: 'top' | 'top-start' | 'top-end' | 'right' | 'right-start' | 'right-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end';
107
108
  /**
@@ -254,8 +255,6 @@ export default class CxRange extends CortexElement implements CortexFormControl
254
255
  reportValidity(): boolean;
255
256
  /** Sets a custom validation message. Pass an empty string to restore validity. */
256
257
  setCustomValidity(message: string): void;
257
- getAllMarks(): NodeListOf<HTMLElement> | undefined;
258
- renderMarks(): import('lit').TemplateResult<1>[];
259
258
  private handleMultiResize;
260
259
  private multiValueToPercent;
261
260
  private multiPercentToValue;
@@ -284,4 +283,3 @@ declare global {
284
283
  'cx-range': CxRange;
285
284
  }
286
285
  }
287
- export {};
@@ -1,4 +1,5 @@
1
- export type ThumbEdgeMode = 'center' | 'inside';
1
+ import { Mark, ThumbEdgeMode } from '../../../../types/src/range';
2
+
2
3
  export type ThumbConstraints = {
3
4
  /**
4
5
  * Max thumb's maxLeft constraint (can't go outside right edge).
@@ -46,3 +47,59 @@ export declare function getMultiThumbConstraints({ edgeMode, maxOffset, minOffse
46
47
  minOffset: number;
47
48
  percentValue: number;
48
49
  }): ThumbConstraints;
50
+ /**
51
+ * Converts a value to a percentage based on min and max range.
52
+ * @param value - The value to convert
53
+ * @param min - Minimum value of the range
54
+ * @param max - Maximum value of the range
55
+ * @returns Percentage value (0-100)
56
+ */
57
+ export declare function valueToPercentage(value: number, min: number, max: number): number;
58
+ /**
59
+ * Filters out hidden marks from the marks array.
60
+ * @param marks - Array of marks to filter
61
+ * @returns Array of visible marks
62
+ */
63
+ export declare function filterVisibleMarks(marks: Mark[]): Mark[];
64
+ /**
65
+ * Calculates the maximum number of labels that can fit in the available width.
66
+ * @param width - Container width in pixels
67
+ * @param spacing - Minimum spacing between labels in pixels
68
+ * @returns Maximum number of labels that can fit
69
+ */
70
+ export declare function calculateMaxLabels(width: number, spacing: number): number;
71
+ /**
72
+ * Calculates the step size for distributing labels evenly between first and last marks.
73
+ * @param totalMarks - Total number of visible marks
74
+ * @param remainingLabels - Number of labels to distribute (excluding first and last)
75
+ * @returns Step size for label distribution
76
+ */
77
+ export declare function calculateLabelStep(totalMarks: number, remainingLabels: number): number;
78
+ /**
79
+ * Calculates the minimum spacing between labels as a percentage of container width.
80
+ * @param spacing - Minimum spacing in pixels
81
+ * @param width - Container width in pixels
82
+ * @returns Minimum spacing as a percentage (0-100)
83
+ */
84
+ export declare function calculateMinSpacingPercentage(spacing: number, width: number): number;
85
+ /**
86
+ * Checks if a mark position is far enough from both first and last positions.
87
+ * @param markPosition - Position of the mark as a percentage
88
+ * @param firstPosition - Position of the first mark as a percentage
89
+ * @param lastPosition - Position of the last mark as a percentage
90
+ * @param minSpacingPercentage - Minimum spacing required as a percentage
91
+ * @returns True if the mark is far enough from both boundaries
92
+ */
93
+ export declare function isMarkFarEnoughFromBoundaries(markPosition: number, firstPosition: number, lastPosition: number, minSpacingPercentage: number): boolean;
94
+ /**
95
+ * Calculates which marks should display labels based on available width.
96
+ * Uses a minimum spacing between labels to prevent overcrowding.
97
+ *
98
+ * @param marks - Array of all marks
99
+ * @param width - Container width in pixels
100
+ * @param spacing - Minimum spacing between labels in pixels
101
+ * @param min - Minimum value of the range
102
+ * @param max - Maximum value of the range
103
+ * @returns Set of mark values that should display labels
104
+ */
105
+ export declare function calculateVisibleLabelValues(marks: Mark[], width: number, spacing: number, min: number, max: number): Set<number>;
@@ -164,6 +164,7 @@ export default class CxDownloader extends CortexElement {
164
164
  }): void;
165
165
  handleFullscreenChange(): void;
166
166
  handleWindowResize(): void;
167
+ private handleRangePointerStart;
167
168
  handleDrag(event: PointerEvent): void;
168
169
  hide(): void;
169
170
  show(): void;
@@ -4,12 +4,16 @@ import { ReactiveController, ReactiveElement } from 'lit';
4
4
  export type ExtendedGalleryItem = GalleryItem & {
5
5
  [key: string]: string | undefined;
6
6
  };
7
+ type FetchImageControllerOptions = {
8
+ maxEnd?: number;
9
+ };
7
10
  export declare class FetchImageController implements ReactiveController {
8
11
  private readonly host;
9
12
  private data;
10
13
  private folderId;
11
14
  private totalCount;
12
- constructor(host: ReactiveElement);
15
+ private maxEnd;
16
+ constructor(host: ReactiveElement, options?: FetchImageControllerOptions);
13
17
  get totalDataCount(): number;
14
18
  fetchImages({ end, extraFields, start, }: {
15
19
  end: number;
@@ -47,3 +51,4 @@ export declare class FetchImageController implements ReactiveController {
47
51
  hostConnected?(): void;
48
52
  hostDisconnected?(): void;
49
53
  }
54
+ export {};
@@ -3544,6 +3544,10 @@
3544
3544
  * The interval at which the range will increase and decrease.
3545
3545
  */
3546
3546
  step?: number;
3547
+ /**
3548
+ * The minimum spacing between marks labels.
3549
+ */
3550
+ markLabelSpacing?: number;
3547
3551
  /**
3548
3552
  * The preferred placement of the range's tooltip.
3549
3553
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orangelogic/design-system",
3
3
  "type": "module",
4
- "version": "2.44.0",
4
+ "version": "2.45.0",
5
5
  "license": "UNLICENSED",
6
6
  "types": "library/types.d.ts",
7
7
  "scripts": {