@orangelogic/design-system 3.18.0 → 3.19.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.
- package/library/chunks/{asset-link-format.Bk1qHIQA.js → asset-link-format.ttcRQgDc.js} +5 -5
- package/library/chunks/{button.DCyoZrRj.js → button.D1YIxtv-.js} +1 -1
- package/library/chunks/{color-swatch-group.BtVbKp-v.js → color-swatch-group.Bumfw-G2.js} +4788 -4335
- package/library/chunks/{color-swatch.DxxOpJXT.js → color-swatch.DdsUysbF.js} +1 -1
- package/library/chunks/{confirm-popover.-_1n24v-.js → confirm-popover.CJXyEa5A.js} +3 -3
- package/library/chunks/{dialog.Dl9aHLD4.js → dialog.BbQ4Du0M.js} +2 -2
- package/library/chunks/{document-viewer.B-jtpLuD.js → document-viewer.C9tM2Gc7.js} +6 -6
- package/library/chunks/{dot-pagination.BNoG-qx7.js → dot-pagination.CJRAtM51.js} +1 -1
- package/library/chunks/{folder-select.DWaC4EWa.js → folder-select.BAPsI-gg.js} +4 -4
- package/library/chunks/gradient.CIzq8fOU.js +176 -0
- package/library/chunks/{header.v8maWlzT.js → header.BioJzPlg.js} +1 -1
- package/library/chunks/{i18n.CNnI4-0K.js → i18n.rtxrs1c1.js} +11 -3
- package/library/chunks/{icon-button.5-oAlIkv.js → icon-button.CbUddcgI.js} +1 -1
- package/library/chunks/{iframe.DOwG9Q7o.js → iframe.y7iCAVZP.js} +1 -1
- package/library/chunks/{image.BSh7WAGF.js → image.A2hE1WoV.js} +1 -1
- package/library/chunks/{index.Byin4Jfx.js → index.Coy2OPB4.js} +13 -13
- package/library/chunks/{input.Csf-S2nB.js → input.D1FFprPl.js} +1 -1
- package/library/chunks/{markdown.b03AOvFT.js → markdown.Dd_GFJK8.js} +2 -2
- package/library/chunks/{menu-item.HtTWOcq4.js → menu-item.0TbnDEDp.js} +1 -1
- package/library/chunks/{option.DgxoCq1j.js → option.CyorNG0S.js} +17 -17
- package/library/chunks/{pagination.C9NblxKt.js → pagination.D0BeaEIi.js} +5 -5
- package/library/chunks/{tab-group.B6Aej-jM.js → tab-group.C98CWzEH.js} +4 -4
- package/library/chunks/{tree.pId63hLe.js → tree.B7IKBX3n.js} +1 -1
- package/library/chunks/{types.Fkwo_sYp.js → types.DVZ_cbKn.js} +49 -48
- package/library/components/alert.js +2 -2
- package/library/components/asset-link-format.js +3 -3
- package/library/components/atoms.js +15 -15
- package/library/components/audio.js +2 -2
- package/library/components/border-input-group.js +2 -2
- package/library/components/breadcrumb.js +1 -1
- package/library/components/button.js +2 -2
- package/library/components/color-picker.js +971 -337
- package/library/components/color-swatch-group.js +3 -3
- package/library/components/color-swatch.js +2 -2
- package/library/components/confirm-popover.js +4 -4
- package/library/components/copy-button.js +1 -1
- package/library/components/corner-position-input-group.js +3 -3
- package/library/components/date-calendar.js +1 -1
- package/library/components/details.js +1 -1
- package/library/components/dialog.js +3 -3
- package/library/components/document-viewer.js +3 -3
- package/library/components/dot-pagination.js +2 -2
- package/library/components/drawer.js +2 -2
- package/library/components/dropdown.js +2 -2
- package/library/components/dynamic-select.js +4 -4
- package/library/components/e-chart.js +1 -1
- package/library/components/element-clamp.js +2 -2
- package/library/components/file-on-demand.js +9 -9
- package/library/components/folder-select.js +4 -4
- package/library/components/format-bytes.js +1 -1
- package/library/components/format-date.js +1 -1
- package/library/components/format-number.js +1 -1
- package/library/components/format-time.js +1 -1
- package/library/components/header.js +2 -2
- package/library/components/icon-button.js +2 -2
- package/library/components/iframe.js +2 -2
- package/library/components/image-comparer.js +1 -1
- package/library/components/image.js +2 -2
- package/library/components/input.js +2 -2
- package/library/components/line-clamp.js +1 -1
- package/library/components/markdown.js +3 -3
- package/library/components/masonry.js +2 -2
- package/library/components/menu-item.js +2 -2
- package/library/components/menu.js +2 -2
- package/library/components/molecules.js +3 -3
- package/library/components/option.js +2 -2
- package/library/components/organisms.js +2 -2
- package/library/components/padding-input-group.js +1 -1
- package/library/components/pagination.js +6 -6
- package/library/components/popup.js +1 -1
- package/library/components/position-picker.js +1 -1
- package/library/components/progress-bar.js +1 -1
- package/library/components/progress-ring.js +1 -1
- package/library/components/range.js +1 -1
- package/library/components/rating.js +1 -1
- package/library/components/relative-time.js +1 -1
- package/library/components/select.js +2 -2
- package/library/components/shadow-input-group.js +1 -1
- package/library/components/share-option-list.js +1 -1
- package/library/components/sidebar.js +1 -1
- package/library/components/size-input-group.js +3 -3
- package/library/components/spinner.js +1 -1
- package/library/components/split-panel.js +1 -1
- package/library/components/tab-group.js +5 -5
- package/library/components/tab.js +2 -2
- package/library/components/tag.js +2 -2
- package/library/components/tooltip.js +1 -1
- package/library/components/tree-item.js +2 -2
- package/library/components/tree.js +2 -2
- package/library/components/typeface.js +2 -2
- package/library/components/types.js +171 -161
- package/library/components/video.js +2 -2
- package/library/package.json +1 -1
- package/library/packages/atoms/src/components/color-picker/color-picker.d.ts +160 -2
- package/library/packages/atoms/src/components/color-picker/components/gradient-slider/gradient-slider.d.ts +80 -0
- package/library/packages/atoms/src/components/color-picker/components/gradient-slider/gradient-slider.styles.d.ts +2 -0
- package/library/packages/atoms/src/components/color-picker/components/gradient-stop-list/gradient-stop-list.d.ts +85 -0
- package/library/packages/atoms/src/components/color-picker/components/gradient-stop-list/gradient-stop-list.styles.d.ts +2 -0
- package/library/packages/atoms/src/components/input/input.d.ts +1 -1
- package/library/packages/atoms/src/components/option/option.d.ts +1 -1
- package/library/packages/events/src/cx-gradient-change.d.ts +10 -0
- package/library/packages/events/src/cx-gradient-stop-add.d.ts +9 -0
- package/library/packages/events/src/cx-gradient-stop-change.d.ts +10 -0
- package/library/packages/events/src/cx-gradient-stop-remove.d.ts +8 -0
- package/library/packages/events/src/cx-gradient-stop-select.d.ts +8 -0
- package/library/packages/events/src/cx-keydown.d.ts +4 -1
- package/library/packages/events/src/events.d.ts +5 -0
- package/library/packages/molecules/src/multi-select/components/board/board.d.ts +58 -2
- package/library/packages/molecules/src/multi-select/components/board-list-item/board-list-item.d.ts +14 -0
- package/library/packages/molecules/src/multi-select/controllers/filter-controller.d.ts +68 -0
- package/library/packages/molecules/src/multi-select/multi-select.d.ts +211 -0
- package/library/packages/molecules/src/multi-select/utils/base.d.ts +44 -0
- package/library/packages/molecules/src/multi-select/utils/reconcile.d.ts +57 -0
- package/library/packages/types/src/board.d.ts +25 -0
- package/library/packages/types/src/color-picker.d.ts +35 -2
- package/library/packages/utils/src/custom-element/i18n.d.ts +8 -0
- package/library/packages/utils/src/gradient/gradient.d.ts +65 -0
- package/library/packages/utils/src/gradient/index.d.ts +1 -0
- package/library/packages/utils/src/index.d.ts +1 -0
- package/library/react-web-component.d.ts +494 -470
- package/library/utils.js +143 -133
- package/package.json +1 -1
- package/library/packages/molecules/src/multi-select/multi-select.utils.d.ts +0 -3
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import { CortexFormControl, default as CortexElement } from '../../../../base/src/cortex-element.ts';
|
|
2
|
-
import { ColorFormat } from '../../../../types/src/color-picker';
|
|
2
|
+
import { ColorFormat, ColorPickerMode, GradientType } from '../../../../types/src/color-picker';
|
|
3
3
|
import { CSSResultGroup } from 'lit';
|
|
4
4
|
import { default as CxButton } from '../button/button';
|
|
5
5
|
import { default as CxButtonGroup } from '../button-group/button-group';
|
|
6
6
|
import { default as CxDropdown } from '../dropdown/dropdown';
|
|
7
7
|
import { default as CxIcon } from '../icon/icon';
|
|
8
8
|
import { default as CxInput } from '../input/input';
|
|
9
|
+
import { default as CxOption } from '../option/option';
|
|
10
|
+
import { default as CxSelect } from '../select/select';
|
|
9
11
|
import { default as CxSpinner } from '../spinner/spinner';
|
|
12
|
+
import { default as CxTab } from '../tab/tab';
|
|
13
|
+
import { default as CxTabGroup } from '../tab-group/tab-group';
|
|
14
|
+
import { default as CxTabPanel } from '../tab-panel/tab-panel';
|
|
10
15
|
import { default as CxVisuallyHidden } from '../visually-hidden/visually-hidden';
|
|
16
|
+
import { default as CxGradientSlider } from './components/gradient-slider/gradient-slider';
|
|
17
|
+
import { default as CxGradientStopList } from './components/gradient-stop-list/gradient-stop-list';
|
|
11
18
|
|
|
12
19
|
/**
|
|
13
20
|
* @summary Color pickers allow the user to select a color.
|
|
@@ -52,6 +59,15 @@ import { default as CxVisuallyHidden } from '../visually-hidden/visually-hidden'
|
|
|
52
59
|
* @csspart format-button__label - The format button’s exported `label` part.
|
|
53
60
|
* @csspart format-button__suffix - The format button’s exported `suffix` part.
|
|
54
61
|
* @csspart format-button__caret - The format button’s exported `caret` part.
|
|
62
|
+
* @csspart gradient-slider - The gradient preview bar shown in the Gradient tab.
|
|
63
|
+
* @csspart gradient-track - The gradient slider’s exported `track` part.
|
|
64
|
+
* @csspart gradient-marker - The gradient slider’s exported `marker` part.
|
|
65
|
+
* @csspart gradient-stop-list - The list of editable stop rows.
|
|
66
|
+
* @csspart gradient-stop-row - The stop list’s exported `row` part.
|
|
67
|
+
* @csspart gradient-add-stop-button - The stop list’s exported `add-button` part.
|
|
68
|
+
* @csspart gradient-delete-stop-button - The stop list’s exported `delete-button` part.
|
|
69
|
+
* @csspart gradient-type-select - The gradient type select (Linear / Radial).
|
|
70
|
+
* @csspart gradient-angle-input - The gradient angle input.
|
|
55
71
|
*
|
|
56
72
|
* @cssproperty --grid-width - The width of the color grid.
|
|
57
73
|
* @cssproperty --grid-height - The height of the color grid.
|
|
@@ -73,9 +89,16 @@ export default class CxColorPicker extends CortexElement implements CortexFormCo
|
|
|
73
89
|
'cx-button': typeof CxButton;
|
|
74
90
|
'cx-button-group': typeof CxButtonGroup;
|
|
75
91
|
'cx-dropdown': typeof CxDropdown;
|
|
92
|
+
'cx-gradient-slider': typeof CxGradientSlider;
|
|
93
|
+
'cx-gradient-stop-list': typeof CxGradientStopList;
|
|
76
94
|
'cx-icon': typeof CxIcon;
|
|
77
95
|
'cx-input': typeof CxInput;
|
|
96
|
+
'cx-option': typeof CxOption;
|
|
97
|
+
'cx-select': typeof CxSelect;
|
|
78
98
|
'cx-spinner': typeof CxSpinner;
|
|
99
|
+
'cx-tab': typeof CxTab;
|
|
100
|
+
'cx-tab-group': typeof CxTabGroup;
|
|
101
|
+
'cx-tab-panel': typeof CxTabPanel;
|
|
79
102
|
'cx-visually-hidden': typeof CxVisuallyHidden;
|
|
80
103
|
};
|
|
81
104
|
private readonly formControlController;
|
|
@@ -85,6 +108,7 @@ export default class CxColorPicker extends CortexElement implements CortexFormCo
|
|
|
85
108
|
input: CxInput;
|
|
86
109
|
opacityInput: CxInput;
|
|
87
110
|
dropdown: CxDropdown;
|
|
111
|
+
tabGroup: CxTabGroup;
|
|
88
112
|
previewButton: HTMLButtonElement;
|
|
89
113
|
trigger: HTMLButtonElement;
|
|
90
114
|
private hasFocus;
|
|
@@ -96,6 +120,14 @@ export default class CxColorPicker extends CortexElement implements CortexFormCo
|
|
|
96
120
|
private saturation;
|
|
97
121
|
private brightness;
|
|
98
122
|
private alpha;
|
|
123
|
+
/** The gradient being edited in the Gradient tab. */
|
|
124
|
+
private gradientValue;
|
|
125
|
+
/** The id of the gradient stop that the color controls currently edit. */
|
|
126
|
+
private activeStopId;
|
|
127
|
+
/** `swatches` parsed into a list, derived whenever that property changes. */
|
|
128
|
+
private parsedSwatches;
|
|
129
|
+
/** `customSwatches` parsed into a list, derived whenever that property changes. */
|
|
130
|
+
private parsedCustomSwatches;
|
|
99
131
|
/**
|
|
100
132
|
* The current value of the color picker. The value's format will vary based the `format` attribute. To get the value
|
|
101
133
|
* in a specific format, use the `getFormattedValue()` method. The value is submitted as a name/value pair with form
|
|
@@ -128,6 +160,21 @@ export default class CxColorPicker extends CortexElement implements CortexFormCo
|
|
|
128
160
|
emitFormat: ColorFormat | undefined;
|
|
129
161
|
/** Renders the color picker inline rather than in a dropdown. */
|
|
130
162
|
inline: boolean;
|
|
163
|
+
/**
|
|
164
|
+
* Adds a Gradient tab alongside the Solid tab. When the Gradient tab is active, `value` holds a
|
|
165
|
+
* CSS gradient string (e.g. `linear-gradient(90deg, #f00 0%, #00f 100%)`) instead of a single color.
|
|
166
|
+
*/
|
|
167
|
+
gradient: boolean;
|
|
168
|
+
/**
|
|
169
|
+
* Which editing surface is active. Set automatically when `value` is assigned a gradient string,
|
|
170
|
+
* and when the user switches tabs. Has no effect unless `gradient` is enabled.
|
|
171
|
+
*/
|
|
172
|
+
mode: ColorPickerMode;
|
|
173
|
+
/**
|
|
174
|
+
* The gradient types offered in the Gradient tab.
|
|
175
|
+
* Pass a space-separated string (e.g., "linear radial") or an array of gradient type values.
|
|
176
|
+
*/
|
|
177
|
+
gradientTypes: GradientType[];
|
|
131
178
|
/** Determines the size of the color picker's trigger. This has no effect on inline color pickers. */
|
|
132
179
|
size: 'small' | 'medium' | 'large';
|
|
133
180
|
/** Removes the button that lets users toggle between format. */
|
|
@@ -178,10 +225,21 @@ export default class CxColorPicker extends CortexElement implements CortexFormCo
|
|
|
178
225
|
* Pairing value with emitFormat attribute. This is used to emit the value in a wanted format.
|
|
179
226
|
*/
|
|
180
227
|
emitValue: string;
|
|
181
|
-
/**
|
|
228
|
+
/**
|
|
229
|
+
* Gets the validity state object.
|
|
230
|
+
*
|
|
231
|
+
* The text input lives in the Solid tab's controls, so it is absent while the Gradient tab
|
|
232
|
+
* is showing. `FormControlController` still polls this, so fall back to the host's own
|
|
233
|
+
* validity rather than dereferencing a missing input.
|
|
234
|
+
*/
|
|
182
235
|
get validity(): ValidityState;
|
|
183
236
|
/** Gets the validation message */
|
|
184
237
|
get validationMessage(): string;
|
|
238
|
+
/**
|
|
239
|
+
* Validity for the states this component can judge without the text input: a required
|
|
240
|
+
* control needs a value.
|
|
241
|
+
*/
|
|
242
|
+
private get formValidity();
|
|
185
243
|
constructor();
|
|
186
244
|
runFirstUpdated(): void;
|
|
187
245
|
private handleCopy;
|
|
@@ -208,6 +266,49 @@ export default class CxColorPicker extends CortexElement implements CortexFormCo
|
|
|
208
266
|
private parseColor;
|
|
209
267
|
private setColor;
|
|
210
268
|
private setLetterCase;
|
|
269
|
+
/**
|
|
270
|
+
* Adopts an externally assigned CSS gradient string as the current gradient.
|
|
271
|
+
* @param value - The gradient string, already known to be parseable in shape.
|
|
272
|
+
*/
|
|
273
|
+
private adoptGradientValue;
|
|
274
|
+
/** True when the Gradient tab is enabled and active. */
|
|
275
|
+
private get isGradientMode();
|
|
276
|
+
/** The gradient stop the color controls currently edit, if any. */
|
|
277
|
+
private get activeStop();
|
|
278
|
+
/**
|
|
279
|
+
* Writes the current HSVA state into the active stop and republishes `value` as a CSS
|
|
280
|
+
* gradient string.
|
|
281
|
+
* @param currentColor - The parsed color represented by the current HSVA state.
|
|
282
|
+
*/
|
|
283
|
+
private syncGradientValue;
|
|
284
|
+
/**
|
|
285
|
+
* Formats the active stop's color for the text input, honoring the current format.
|
|
286
|
+
* @param currentColor - The parsed color represented by the current HSVA state.
|
|
287
|
+
* @returns The formatted color string.
|
|
288
|
+
*/
|
|
289
|
+
private getStopInputValue;
|
|
290
|
+
/**
|
|
291
|
+
* Loads a stop's color into the HSVA controls without writing back to `value`.
|
|
292
|
+
* @param stop - The stop to load.
|
|
293
|
+
*/
|
|
294
|
+
private loadStopIntoControls;
|
|
295
|
+
/**
|
|
296
|
+
* Publishes the current gradient as `value` without letting the `value` watcher re-adopt
|
|
297
|
+
* it. Re-adopting would re-parse the string and mint fresh stop ids, which destroys the
|
|
298
|
+
* marker being dragged; `isSafeValue` is the existing guard for "this component wrote
|
|
299
|
+
* `value` itself", and it must always be cleared again once the update settles.
|
|
300
|
+
*/
|
|
301
|
+
private publishGradientValue;
|
|
302
|
+
/**
|
|
303
|
+
* Replaces the gradient's stops, republishes `value`, and keeps the active stop valid.
|
|
304
|
+
* @param stops - The next set of stops.
|
|
305
|
+
*/
|
|
306
|
+
private applyGradientStops;
|
|
307
|
+
/**
|
|
308
|
+
* Seeds a two-stop gradient from the current solid color so switching to the Gradient tab
|
|
309
|
+
* starts from something visible rather than an empty bar.
|
|
310
|
+
*/
|
|
311
|
+
private seedGradientFromCurrentColor;
|
|
211
312
|
private syncValues;
|
|
212
313
|
private handleAfterHide;
|
|
213
314
|
private handleEyeDropper;
|
|
@@ -222,8 +323,39 @@ export default class CxColorPicker extends CortexElement implements CortexFormCo
|
|
|
222
323
|
*/
|
|
223
324
|
private getFormatFromValue;
|
|
224
325
|
private stopNestedEventPropagation;
|
|
326
|
+
private handleTabShow;
|
|
327
|
+
/** Moves editing to the Gradient tab, seeding stops on first use. */
|
|
328
|
+
private switchToGradientMode;
|
|
329
|
+
/** Moves editing back to the Solid tab, keeping the active stop's color. */
|
|
330
|
+
private switchToSolidMode;
|
|
331
|
+
private handleGradientStopSelect;
|
|
332
|
+
private handleGradientStopAdd;
|
|
333
|
+
private handleGradientStopRemove;
|
|
334
|
+
private handleGradientStopChange;
|
|
335
|
+
private handleGradientChange;
|
|
336
|
+
private handleGradientTypeSelect;
|
|
337
|
+
private handleGradientTypeChange;
|
|
338
|
+
private handleGradientAngleInput;
|
|
225
339
|
handleFormatChange(): void;
|
|
226
340
|
handleOpacityChange(): void;
|
|
341
|
+
/**
|
|
342
|
+
* Parses a swatch list once per change rather than on every render. `render()` used to
|
|
343
|
+
* split and filter these strings itself, which repeated the work on every update — and
|
|
344
|
+
* the gradient tab re-renders on every pointer move while a stop is dragged.
|
|
345
|
+
* @param value - The raw property value, either a delimited string or an array.
|
|
346
|
+
* @returns The individual color strings.
|
|
347
|
+
*/
|
|
348
|
+
private parseSwatchList;
|
|
349
|
+
handleSwatchesChange(): void;
|
|
350
|
+
handleCustomSwatchesChange(): void;
|
|
351
|
+
/**
|
|
352
|
+
* Keeps the tab group in step when `mode` is set programmatically (for example by assigning a
|
|
353
|
+
* gradient string to `value`). Without this the panel stays hidden, and a hidden panel has no
|
|
354
|
+
* layout, so the grid and sliders inside it would measure zero.
|
|
355
|
+
*/
|
|
356
|
+
handleModeChange(): Promise<void>;
|
|
357
|
+
/** Selects the tab panel matching the current mode. */
|
|
358
|
+
private syncTabToMode;
|
|
227
359
|
handleValueChange(oldValue: string | undefined, newValue: string): void;
|
|
228
360
|
/** Sets focus on the color picker. */
|
|
229
361
|
focus(options?: FocusOptions): void;
|
|
@@ -240,6 +372,32 @@ export default class CxColorPicker extends CortexElement implements CortexFormCo
|
|
|
240
372
|
/** Sets a custom validation message. Pass an empty string to restore validity. */
|
|
241
373
|
setCustomValidity(message: string): void;
|
|
242
374
|
renderSwatches(swatches: string[]): ("" | import('lit').TemplateResult<1>)[];
|
|
375
|
+
/**
|
|
376
|
+
* Renders one gradient type toggle. The type travels on a data attribute so the click
|
|
377
|
+
* handler can stay a bound method rather than a per-render arrow function.
|
|
378
|
+
* @param type - The gradient type this button selects.
|
|
379
|
+
*/
|
|
380
|
+
/**
|
|
381
|
+
* Returns a gradient type's user-facing name.
|
|
382
|
+
* @param type - The gradient type to label.
|
|
383
|
+
*/
|
|
384
|
+
private getGradientTypeLabel;
|
|
385
|
+
/**
|
|
386
|
+
* Renders the gradient type selector and, for linear gradients, the angle input.
|
|
387
|
+
*/
|
|
388
|
+
private renderGradientOptions;
|
|
389
|
+
/**
|
|
390
|
+
* Renders the shared color controls, wrapped in a Solid / Gradient tab group when the
|
|
391
|
+
* gradient tab is enabled. When it is not, the controls render exactly as they always have,
|
|
392
|
+
* so existing consumers see an unchanged DOM.
|
|
393
|
+
*/
|
|
394
|
+
private renderTabsOrControls;
|
|
395
|
+
/**
|
|
396
|
+
* Renders the color grid, hue/alpha sliders, and the text inputs. These controls are shared
|
|
397
|
+
* by both tabs: in Solid mode they edit `value` directly, and in Gradient mode they edit the
|
|
398
|
+
* active gradient stop.
|
|
399
|
+
*/
|
|
400
|
+
private renderColorControls;
|
|
243
401
|
render(): import('lit').TemplateResult<1>;
|
|
244
402
|
}
|
|
245
403
|
declare global {
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { default as CortexElement } from '../../../../../../base/src/cortex-element.ts';
|
|
2
|
+
import { GradientStop } from '../../../../../../types/src/color-picker';
|
|
3
|
+
import { CSSResultGroup } from 'lit';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @summary Renders a gradient preview bar with draggable stop markers.
|
|
7
|
+
*
|
|
8
|
+
* @description An internal building block for `cx-color-picker`'s gradient tab. The bar is a
|
|
9
|
+
* preview plus a positioning control: markers select and reposition stops, while adding and
|
|
10
|
+
* removing them belongs to the stop list beside it. The component is fully controlled — it
|
|
11
|
+
* renders the `stops` it is given and reports intent through events, and every event carries
|
|
12
|
+
* the complete next set of stops so the owner can assign it straight back to `stops`.
|
|
13
|
+
*
|
|
14
|
+
* @event {{ id: string }} cx-gradient-stop-select - Emitted when a marker becomes the active stop.
|
|
15
|
+
* @event {{ stops: GradientStop[] }} cx-gradient-stop-change - Emitted continuously while a marker is dragged.
|
|
16
|
+
* @event {{ stops: GradientStop[] }} cx-gradient-change - Emitted when a position change is committed.
|
|
17
|
+
* @event {{ id: string }} cx-gradient-stop-remove - Emitted when a stop is removed with the keyboard.
|
|
18
|
+
*
|
|
19
|
+
* @csspart base - The component's base wrapper.
|
|
20
|
+
* @csspart track - The gradient preview bar.
|
|
21
|
+
* @csspart marker - Each individual stop marker.
|
|
22
|
+
*
|
|
23
|
+
* @cssproperty [--gradient-track-height=28px] - The height of the gradient bar.
|
|
24
|
+
* @cssproperty [--gradient-marker-size=20px] - The size of each stop marker.
|
|
25
|
+
* @cssproperty [--gradient-marker-tail=6px] - The size of the marker's pointer tail.
|
|
26
|
+
*/
|
|
27
|
+
export default class CxGradientSlider extends CortexElement {
|
|
28
|
+
static readonly styles: CSSResultGroup;
|
|
29
|
+
private readonly localize;
|
|
30
|
+
/** The gradient's color stops. Rendered in sorted order without mutating the input. */
|
|
31
|
+
stops: GradientStop[];
|
|
32
|
+
/** The id of the stop currently being edited. */
|
|
33
|
+
activeStopId: string;
|
|
34
|
+
/** Disables interaction with the markers. */
|
|
35
|
+
disabled: boolean;
|
|
36
|
+
/** The id of the marker being dragged, used only to drive the grabbing cursor. */
|
|
37
|
+
private draggingStopId;
|
|
38
|
+
/** False once the gradient is down to the minimum number of stops. */
|
|
39
|
+
private get canRemoveStop();
|
|
40
|
+
/**
|
|
41
|
+
* Selects a stop, making it the target of the picker's color controls.
|
|
42
|
+
* @param id - The stop to select.
|
|
43
|
+
*/
|
|
44
|
+
private selectStop;
|
|
45
|
+
/**
|
|
46
|
+
* Moves a stop to a new position and reports the resulting set of stops.
|
|
47
|
+
* @param id - The stop to move.
|
|
48
|
+
* @param position - The new position, clamped to 0-100.
|
|
49
|
+
* @param commit - Whether this is the final position rather than an intermediate drag frame.
|
|
50
|
+
*/
|
|
51
|
+
private moveStop;
|
|
52
|
+
/**
|
|
53
|
+
* Removes a stop, refusing when doing so would leave fewer than the minimum.
|
|
54
|
+
* @param id - The stop to remove.
|
|
55
|
+
*/
|
|
56
|
+
private removeStop;
|
|
57
|
+
/**
|
|
58
|
+
* Converts a pointer offset within the bar into a stop position.
|
|
59
|
+
* @param offsetX - The pointer's horizontal offset from the bar's left edge.
|
|
60
|
+
* @param trackWidth - The bar's rendered width.
|
|
61
|
+
* @returns The equivalent position, 0-100.
|
|
62
|
+
*/
|
|
63
|
+
private getPositionFromOffset;
|
|
64
|
+
private handleMarkerPointerDown;
|
|
65
|
+
private handleMarkerKeyDown;
|
|
66
|
+
/**
|
|
67
|
+
* Builds the CSS gradient shown on the bar. The preview is always left-to-right regardless
|
|
68
|
+
* of the gradient's real type, because the bar represents the gradient line itself rather
|
|
69
|
+
* than its rendered orientation.
|
|
70
|
+
* @param sortedStops - The stops in ascending position order.
|
|
71
|
+
* @returns A CSS gradient string.
|
|
72
|
+
*/
|
|
73
|
+
private getTrackBackground;
|
|
74
|
+
render(): import('lit').TemplateResult<1>;
|
|
75
|
+
}
|
|
76
|
+
declare global {
|
|
77
|
+
interface HTMLElementTagNameMap {
|
|
78
|
+
'cx-gradient-slider': CxGradientSlider;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { default as CortexElement } from '../../../../../../base/src/cortex-element.ts';
|
|
2
|
+
import { GradientStop } from '../../../../../../types/src/color-picker';
|
|
3
|
+
import { CSSResultGroup } from 'lit';
|
|
4
|
+
import { default as CxButton } from '../../../button/button';
|
|
5
|
+
import { default as CxDropdown } from '../../../dropdown/dropdown';
|
|
6
|
+
import { default as CxIcon } from '../../../icon/icon';
|
|
7
|
+
import { default as CxIconButton } from '../../../icon-button/icon-button';
|
|
8
|
+
import { default as CxInput } from '../../../input/input';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @summary Lists a gradient's color stops as editable rows.
|
|
12
|
+
*
|
|
13
|
+
* @description An internal building block for `cx-color-picker`'s gradient tab. Each row edits
|
|
14
|
+
* one stop's hex, opacity, and position, and can delete it. Like `cx-gradient-slider`, the
|
|
15
|
+
* component is fully controlled and every event carries the complete next set of stops.
|
|
16
|
+
*
|
|
17
|
+
* @event {{ id: string }} cx-gradient-stop-select - Emitted when a row becomes the active stop.
|
|
18
|
+
* @event {{ color: string, position: number }} cx-gradient-stop-add - Emitted when a stop is added.
|
|
19
|
+
* @event {{ id: string }} cx-gradient-stop-remove - Emitted when a stop is deleted.
|
|
20
|
+
* @event {{ stops: GradientStop[] }} cx-gradient-change - Emitted when a row's field is committed.
|
|
21
|
+
*
|
|
22
|
+
* @csspart base - The component's base wrapper.
|
|
23
|
+
* @csspart header - The row holding the title and the add button.
|
|
24
|
+
* @csspart add-button - The button that appends a stop.
|
|
25
|
+
* @csspart row - Each stop's row.
|
|
26
|
+
* @csspart hex-input - A row's hex input.
|
|
27
|
+
* @csspart swatch - A row's color chip.
|
|
28
|
+
* @csspart opacity-input - A row's opacity input.
|
|
29
|
+
* @csspart position-input - A row's position input.
|
|
30
|
+
* @csspart delete-button - A row's delete button.
|
|
31
|
+
*
|
|
32
|
+
* @cssproperty [--stop-swatch-size=28px] - The size of each row's color chip.
|
|
33
|
+
* @cssproperty [--stop-list-max-height=168px] - The height at which the rows start scrolling.
|
|
34
|
+
*/
|
|
35
|
+
export default class CxGradientStopList extends CortexElement {
|
|
36
|
+
static readonly styles: CSSResultGroup;
|
|
37
|
+
static readonly dependencies: {
|
|
38
|
+
'cx-button': typeof CxButton;
|
|
39
|
+
'cx-dropdown': typeof CxDropdown;
|
|
40
|
+
'cx-icon': typeof CxIcon;
|
|
41
|
+
'cx-icon-button': typeof CxIconButton;
|
|
42
|
+
'cx-input': typeof CxInput;
|
|
43
|
+
};
|
|
44
|
+
private readonly localize;
|
|
45
|
+
/** The gradient's color stops. Rendered in sorted order without mutating the input. */
|
|
46
|
+
stops: GradientStop[];
|
|
47
|
+
/** The id of the stop currently being edited. */
|
|
48
|
+
activeStopId: string;
|
|
49
|
+
/** Disables every control in the list. */
|
|
50
|
+
disabled: boolean;
|
|
51
|
+
/** False once the gradient is down to the minimum number of stops. */
|
|
52
|
+
private get canRemoveStop();
|
|
53
|
+
/**
|
|
54
|
+
* Reads a row's stop id from the element that raised an event.
|
|
55
|
+
* @param event - The event whose `currentTarget` carries the id.
|
|
56
|
+
* @returns The stop id, or an empty string when the attribute is missing.
|
|
57
|
+
*/
|
|
58
|
+
private getStopId;
|
|
59
|
+
/**
|
|
60
|
+
* Replaces one stop and reports the resulting set.
|
|
61
|
+
* @param id - The stop to change.
|
|
62
|
+
* @param changes - The fields to overwrite.
|
|
63
|
+
*/
|
|
64
|
+
private commitStopChange;
|
|
65
|
+
private handleRowClick;
|
|
66
|
+
private handleAddClick;
|
|
67
|
+
private handleDropdownClick;
|
|
68
|
+
private handlePickerInput;
|
|
69
|
+
private handleDeleteClick;
|
|
70
|
+
private handleHexChange;
|
|
71
|
+
private handleOpacityChange;
|
|
72
|
+
private handlePositionChange;
|
|
73
|
+
/**
|
|
74
|
+
* Renders one stop's row of fields.
|
|
75
|
+
* @param stop - The stop this row edits.
|
|
76
|
+
* @param index - The stop's position in the sorted list, used for labelling.
|
|
77
|
+
*/
|
|
78
|
+
private renderRow;
|
|
79
|
+
render(): import('lit').TemplateResult<1>;
|
|
80
|
+
}
|
|
81
|
+
declare global {
|
|
82
|
+
interface HTMLElementTagNameMap {
|
|
83
|
+
'cx-gradient-stop-list': CxGradientStopList;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -21,7 +21,7 @@ import { default as CxIcon } from '../icon/icon';
|
|
|
21
21
|
* @event cx-focus - Emitted when the control gains focus.
|
|
22
22
|
* @event cx-input - Emitted when the control receives input.
|
|
23
23
|
* @event cx-invalid - Emitted when the form control has been checked for validity and its constraints aren't satisfied.
|
|
24
|
-
* @event cx-keydown - Emitted when a key is pressed down on the control.
|
|
24
|
+
* @event {{ event: KeyboardEvent; value: string }} cx-keydown - Emitted when a key is pressed down on the control.
|
|
25
25
|
*
|
|
26
26
|
* @csspart form-control - The form control that wraps the label, input, and help text.
|
|
27
27
|
* @csspart form-control-label - The label’s wrapper.
|
|
@@ -19,7 +19,7 @@ import { default as CxSpace } from '../space/space';
|
|
|
19
19
|
* @csspart suffix - The container that wraps the suffix.
|
|
20
20
|
*
|
|
21
21
|
* @cssproperty [--option-color=var(--cx-color-neutral-700)] - The option's color.
|
|
22
|
-
* @cssproperty [--option-current-background-color=
|
|
22
|
+
* @cssproperty [--option-current-background-color=var(--cx-menu-item-background-color-hover)] - The background color of the option under the keyboard cursor (`aria-activedescendant`). Only one option is current at a time, and it is not necessarily the selected one.
|
|
23
23
|
* @cssproperty [--option-font-weight=var(--cx-font-weight-regular)] - The option's font weight.
|
|
24
24
|
* @cssproperty [--option-help-text-color=var(--cx-color-neutral-600)] - The option's help text color.
|
|
25
25
|
* @cssproperty [--option-help-text-font-weight=var(--cx-font-weight-regular)] - The option's help text font weight.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { GradientStop } from '../../types/src/color-picker';
|
|
2
|
+
|
|
3
|
+
export type CxGradientChangeEvent = CustomEvent<{
|
|
4
|
+
stops: GradientStop[];
|
|
5
|
+
}>;
|
|
6
|
+
declare global {
|
|
7
|
+
interface GlobalEventHandlersEventMap {
|
|
8
|
+
'cx-gradient-change': CxGradientChangeEvent;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { GradientStop } from '../../types/src/color-picker';
|
|
2
|
+
|
|
3
|
+
export type CxGradientStopChangeEvent = CustomEvent<{
|
|
4
|
+
stops: GradientStop[];
|
|
5
|
+
}>;
|
|
6
|
+
declare global {
|
|
7
|
+
interface GlobalEventHandlersEventMap {
|
|
8
|
+
'cx-gradient-stop-change': CxGradientStopChangeEvent;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -101,6 +101,11 @@ export * from './cx-gallery-item-open-config';
|
|
|
101
101
|
export * from './cx-gallery-item-select';
|
|
102
102
|
export * from './cx-gallery-lightbox-hide';
|
|
103
103
|
export * from './cx-gallery-lightbox-show';
|
|
104
|
+
export * from './cx-gradient-change';
|
|
105
|
+
export * from './cx-gradient-stop-add';
|
|
106
|
+
export * from './cx-gradient-stop-change';
|
|
107
|
+
export * from './cx-gradient-stop-remove';
|
|
108
|
+
export * from './cx-gradient-stop-select';
|
|
104
109
|
export * from './cx-hide';
|
|
105
110
|
export * from './cx-hover';
|
|
106
111
|
export * from './cx-hub-connection-disconnected';
|
|
@@ -1,21 +1,34 @@
|
|
|
1
|
+
import { default as CxDivider } from '../../../../../atoms/src/components/divider/divider.ts';
|
|
1
2
|
import { default as CxIcon } from '../../../../../atoms/src/components/icon/icon.ts';
|
|
2
3
|
import { default as CxIconButton } from '../../../../../atoms/src/components/icon-button/icon-button.ts';
|
|
3
4
|
import { default as CxInput } from '../../../../../atoms/src/components/input/input.ts';
|
|
4
5
|
import { default as CxTooltip } from '../../../../../atoms/src/components/tooltip/tooltip.ts';
|
|
5
6
|
import { default as CortexElement } from '../../../../../base/src/cortex-element.ts';
|
|
6
|
-
import { BoardItem } from '../../../../../types/src/board';
|
|
7
|
+
import { BoardItem, HiddenSelectionState } from '../../../../../types/src/board';
|
|
7
8
|
import { default as Sortable } from 'sortablejs';
|
|
8
9
|
import { default as CxBoardListItem } from '../board-list-item/board-list-item';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* @summary Board is a list of items that can be reordered by dragging and dropping them.
|
|
13
|
+
* @description One column of `cx-multi-select`. Owns its own selection, an optional search input,
|
|
14
|
+
* and a virtualised window over the rows. What it displays is narrowed by its own search term;
|
|
15
|
+
* the host narrows it further by handing it narrowed `data`. On drag and drop the board reports
|
|
16
|
+
* back exactly the rows it holds.
|
|
12
17
|
*
|
|
13
|
-
* @event {{ items: string[] }} cx-
|
|
18
|
+
* @event {{ id: string; isMultiDrag?: boolean; items: string[]; newIndex?: number; type: string }} cx-board-change - Emitted when rows are added, removed, or reordered. `items` is the board's full id list after the change; `type` is SortableJS's `add` / `remove` / `update`.
|
|
19
|
+
* @event {{ id: string; items: string[]; type?: string }} cx-board-selected-change - Emitted when the row selection changes. `items` is the selected ids in the order they were picked.
|
|
20
|
+
*
|
|
21
|
+
* @csspart divider - The rule under the header. Only rendered when `divider-color` is set.
|
|
22
|
+
* @csspart list - The scrolling row container.
|
|
23
|
+
* @csspart search-input - The search input. Only rendered when `allow-search` is set.
|
|
24
|
+
* @csspart search-input-clear - The clear button inside the search input.
|
|
25
|
+
* @csspart select-all - The select-all checkbox in the header. Only rendered when `all` is set.
|
|
14
26
|
*/
|
|
15
27
|
export default class CxBoard extends CortexElement {
|
|
16
28
|
static readonly styles: import('lit').CSSResult[];
|
|
17
29
|
static readonly dependencies: {
|
|
18
30
|
'cx-board-list-item': typeof CxBoardListItem;
|
|
31
|
+
'cx-divider': typeof CxDivider;
|
|
19
32
|
'cx-icon': typeof CxIcon;
|
|
20
33
|
'cx-icon-button': typeof CxIconButton;
|
|
21
34
|
'cx-input': typeof CxInput;
|
|
@@ -36,6 +49,28 @@ export default class CxBoard extends CortexElement {
|
|
|
36
49
|
configurable: boolean;
|
|
37
50
|
all: boolean;
|
|
38
51
|
allowSearch: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Color of the rule under the board header. Empty (the default) draws no rule at all — not a
|
|
54
|
+
* transparent one — so a board that says nothing about it keeps byte-for-byte the header it has
|
|
55
|
+
* always had, rather than every existing consumer silently gaining a 1px line.
|
|
56
|
+
*
|
|
57
|
+
* One property rather than a separate show/hide flag: the color's presence *is* the switch, so
|
|
58
|
+
* there is no "shown but uncolored" or "colored but hidden" state to reconcile.
|
|
59
|
+
*
|
|
60
|
+
* Takes any CSS color, but prefer a design token — `var(--cx-color-primary-500)` — over a raw
|
|
61
|
+
* hex so the rule follows the theme.
|
|
62
|
+
*/
|
|
63
|
+
dividerColor: string;
|
|
64
|
+
/**
|
|
65
|
+
* Display-only: the host's summary of selected rows this board cannot see (the host may be
|
|
66
|
+
* narrowing `data`). Read in exactly four render outputs — the header glyph, its
|
|
67
|
+
* `aria-checked`, the tint, and the footer count — and never acted on: it does not touch
|
|
68
|
+
* `data`, the selection, drag, or any event. Same species of input as `divider-color`, not a
|
|
69
|
+
* control channel.
|
|
70
|
+
*/
|
|
71
|
+
hiddenSelection: HiddenSelectionState;
|
|
72
|
+
/** Display-only: how many selected rows the host is hiding; added to the footer count. */
|
|
73
|
+
hiddenSelectedCount: number;
|
|
39
74
|
/**
|
|
40
75
|
* A boolean property that indicates whether the drag operation should be aborted.
|
|
41
76
|
* When set to `true`, the current drag action will be canceled,
|
|
@@ -66,7 +101,21 @@ export default class CxBoard extends CortexElement {
|
|
|
66
101
|
private previous;
|
|
67
102
|
private lastSelectedItem;
|
|
68
103
|
get selectedCount(): number;
|
|
104
|
+
/**
|
|
105
|
+
* Whether the tick, rather than the dash, is what the header should show.
|
|
106
|
+
*
|
|
107
|
+
* With rows on screen the board answers from what it sees: every visible selectable row
|
|
108
|
+
* selected. With nothing left on screen there is no row to describe, so it defers to
|
|
109
|
+
* `hiddenSelection` — the host's display-only summary of the selection this board cannot
|
|
110
|
+
* see. `All` there means every selectable row of the whole column is selected, which is
|
|
111
|
+
* exactly what the tick claims.
|
|
112
|
+
*/
|
|
69
113
|
get isAllSelected(): boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Something is selected that the tick cannot stand for — including a selection the host is
|
|
116
|
+
* currently hiding, which is then the only thing still telling the user a selection
|
|
117
|
+
* survives the filter.
|
|
118
|
+
*/
|
|
70
119
|
get isPartiallySelected(): boolean;
|
|
71
120
|
/**
|
|
72
121
|
* Rows counted toward "select all" (excludes synthetic group headers, disabled, and
|
|
@@ -118,6 +167,13 @@ export default class CxBoard extends CortexElement {
|
|
|
118
167
|
handleMove(evt: Sortable.MoveEvent): boolean | undefined;
|
|
119
168
|
deselectAll(force?: boolean): void;
|
|
120
169
|
selectAll(): void;
|
|
170
|
+
/**
|
|
171
|
+
* Restores a selection after the host replaced `data` (which resets it), without emitting
|
|
172
|
+
* `cx-board-selected-change` — only the selection's owner calls this, so it already knows.
|
|
173
|
+
* Ids the board does not currently hold are skipped; the order of `ids` becomes the
|
|
174
|
+
* selection order.
|
|
175
|
+
*/
|
|
176
|
+
restoreSelection(ids: string[]): void;
|
|
121
177
|
handleSelectAll(): void;
|
|
122
178
|
private handleSelectAllKeydown;
|
|
123
179
|
/** Index in `this.items` immediately after the last real (non-header) visible row. */
|
package/library/packages/molecules/src/multi-select/components/board-list-item/board-list-item.d.ts
CHANGED
|
@@ -5,6 +5,20 @@ import { default as CxTooltip } from '../../../../../atoms/src/components/toolti
|
|
|
5
5
|
import { default as CortexElement } from '../../../../../base/src/cortex-element.ts';
|
|
6
6
|
import { TemplateResult } from 'lit';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* @summary A single row inside `cx-board`: a selection indicator, the row's label, and an
|
|
10
|
+
* optional configure button.
|
|
11
|
+
* @description The label is clamped to two lines; hovering it opens the row's `tooltip` content,
|
|
12
|
+
* which is rendered as HTML. The configure button appears only when the row is `configurable` and
|
|
13
|
+
* not `readonly`, and stops its own click from reaching the board's row-selection handler.
|
|
14
|
+
*
|
|
15
|
+
* @event {{ id: string }} cx-multi-select-configure - Emitted when the configure button is activated. Carries the row's `data-id`.
|
|
16
|
+
*
|
|
17
|
+
* @csspart config-button - The configure (cog) button.
|
|
18
|
+
* @csspart text - The wrapper around the row's label.
|
|
19
|
+
* @csspart text-content - The clamped label itself.
|
|
20
|
+
* @csspart tooltip - The tooltip holding the row's `tooltip` content.
|
|
21
|
+
*/
|
|
8
22
|
export default class CxBoardListItem extends CortexElement {
|
|
9
23
|
static readonly styles: import('lit').CSSResult[];
|
|
10
24
|
static readonly dependencies: {
|