@workday/canvas-kit-labs-react 15.0.0-alpha.0056-next.0 → 15.0.0-alpha.0060-next.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 (43) hide show
  1. package/dist/commonjs/ai-ingress-button/lib/AIIngressButton.js +5 -5
  2. package/dist/commonjs/index.d.ts +1 -0
  3. package/dist/commonjs/index.d.ts.map +1 -1
  4. package/dist/commonjs/index.js +1 -0
  5. package/dist/commonjs/search-form/lib/SearchForm.js +14 -14
  6. package/dist/commonjs/side-panel/index.d.ts +4 -0
  7. package/dist/commonjs/side-panel/index.d.ts.map +1 -0
  8. package/dist/commonjs/side-panel/index.js +19 -0
  9. package/dist/commonjs/side-panel/lib/SidePanel.d.ts +205 -0
  10. package/dist/commonjs/side-panel/lib/SidePanel.d.ts.map +1 -0
  11. package/dist/commonjs/side-panel/lib/SidePanel.js +64 -0
  12. package/dist/commonjs/side-panel/lib/SidePanelToggleButton.d.ts +95 -0
  13. package/dist/commonjs/side-panel/lib/SidePanelToggleButton.d.ts.map +1 -0
  14. package/dist/commonjs/side-panel/lib/SidePanelToggleButton.js +65 -0
  15. package/dist/commonjs/side-panel/lib/useSidePanelModel.d.ts +514 -0
  16. package/dist/commonjs/side-panel/lib/useSidePanelModel.d.ts.map +1 -0
  17. package/dist/commonjs/side-panel/lib/useSidePanelModel.js +134 -0
  18. package/dist/commonjs/version/lib/version.js +1 -1
  19. package/dist/es6/ai-ingress-button/lib/AIIngressButton.js +5 -5
  20. package/dist/es6/index.d.ts +1 -0
  21. package/dist/es6/index.d.ts.map +1 -1
  22. package/dist/es6/index.js +1 -0
  23. package/dist/es6/search-form/lib/SearchForm.js +14 -14
  24. package/dist/es6/side-panel/index.d.ts +4 -0
  25. package/dist/es6/side-panel/index.d.ts.map +1 -0
  26. package/dist/es6/side-panel/index.js +3 -0
  27. package/dist/es6/side-panel/lib/SidePanel.d.ts +205 -0
  28. package/dist/es6/side-panel/lib/SidePanel.d.ts.map +1 -0
  29. package/dist/es6/side-panel/lib/SidePanel.js +61 -0
  30. package/dist/es6/side-panel/lib/SidePanelToggleButton.d.ts +95 -0
  31. package/dist/es6/side-panel/lib/SidePanelToggleButton.d.ts.map +1 -0
  32. package/dist/es6/side-panel/lib/SidePanelToggleButton.js +62 -0
  33. package/dist/es6/side-panel/lib/useSidePanelModel.d.ts +514 -0
  34. package/dist/es6/side-panel/lib/useSidePanelModel.d.ts.map +1 -0
  35. package/dist/es6/side-panel/lib/useSidePanelModel.js +108 -0
  36. package/dist/es6/version/lib/version.js +1 -1
  37. package/index.ts +1 -0
  38. package/package.json +4 -4
  39. package/side-panel/index.ts +3 -0
  40. package/side-panel/lib/SidePanel.tsx +131 -0
  41. package/side-panel/lib/SidePanelToggleButton.tsx +177 -0
  42. package/side-panel/lib/useSidePanelModel.ts +128 -0
  43. package/side-panel/package.json +6 -0
@@ -0,0 +1,514 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * The transition states of the SidePanel during expand/collapse animations.
4
+ * - `expanded`: Panel is fully expanded
5
+ * - `expanding`: Panel is animating from collapsed to expanded
6
+ * - `collapsed`: Panel is fully collapsed
7
+ * - `collapsing`: Panel is animating from expanded to collapsed
8
+ */
9
+ export type SidePanelTransitionStates = 'collapsed' | 'collapsing' | 'expanded' | 'expanding';
10
+ export declare const useSidePanelModel: (<TT_Special_Generic>(config?: (Partial<{
11
+ /**
12
+ * The initial transition state of the SidePanel.
13
+ * @default 'expanded'
14
+ */
15
+ initialTransitionState: SidePanelTransitionStates;
16
+ /**
17
+ * Which side the SidePanel originates from. Uses logical properties for RTL support.
18
+ * - `start`: Left side in LTR, right side in RTL
19
+ * - `end`: Right side in LTR, left side in RTL
20
+ * @default 'start'
21
+ */
22
+ origin: "end" | "start";
23
+ /**
24
+ * The unique ID for the panel element. If not provided, a unique ID will be generated.
25
+ * This ID is used for the `aria-controls` attribute on the toggle button.
26
+ */
27
+ panelId: string;
28
+ /**
29
+ * The unique ID for the panel's label element. If not provided, a unique ID will be generated.
30
+ * This ID is used for the `aria-labelledby` attribute on both the panel and toggle button.
31
+ */
32
+ labelId: string;
33
+ /**
34
+ * Callback fired when the SidePanel's transition state changes.
35
+ * Use this to react to state changes including animation states.
36
+ * @param state The new transition state
37
+ */
38
+ onStateTransition(state: SidePanelTransitionStates): void;
39
+ }> & {
40
+ onExpand?: ((data: undefined, prevState: {
41
+ /**
42
+ * The unique ID for the panel element. Used for `aria-controls` on the toggle button.
43
+ */
44
+ panelId: string;
45
+ /**
46
+ * The unique ID for the panel's label element. Used for `aria-labelledby` on the panel
47
+ * and toggle button to provide an accessible name.
48
+ */
49
+ labelId: string;
50
+ /**
51
+ * The current transition state of the SidePanel. This tracks both the expanded/collapsed
52
+ * state and the animation states (expanding/collapsing).
53
+ */
54
+ transitionState: SidePanelTransitionStates;
55
+ /**
56
+ * The initial transition state of the SidePanel.
57
+ * @default 'expanded'
58
+ */
59
+ initialTransitionState: SidePanelTransitionStates;
60
+ /**
61
+ * Which side the SidePanel originates from. Uses logical properties for RTL support.
62
+ * - `start`: Left side in LTR, right side in RTL
63
+ * - `end`: Right side in LTR, left side in RTL
64
+ * @default 'start'
65
+ */
66
+ origin: "end" | "start";
67
+ /**
68
+ * Callback fired when the SidePanel's transition state changes.
69
+ * Use this to react to state changes including animation states.
70
+ * @param state The new transition state
71
+ */
72
+ onStateTransition(state: SidePanelTransitionStates): void;
73
+ }) => void) | undefined;
74
+ onCollapse?: ((data: undefined, prevState: {
75
+ /**
76
+ * The unique ID for the panel element. Used for `aria-controls` on the toggle button.
77
+ */
78
+ panelId: string;
79
+ /**
80
+ * The unique ID for the panel's label element. Used for `aria-labelledby` on the panel
81
+ * and toggle button to provide an accessible name.
82
+ */
83
+ labelId: string;
84
+ /**
85
+ * The current transition state of the SidePanel. This tracks both the expanded/collapsed
86
+ * state and the animation states (expanding/collapsing).
87
+ */
88
+ transitionState: SidePanelTransitionStates;
89
+ /**
90
+ * The initial transition state of the SidePanel.
91
+ * @default 'expanded'
92
+ */
93
+ initialTransitionState: SidePanelTransitionStates;
94
+ /**
95
+ * Which side the SidePanel originates from. Uses logical properties for RTL support.
96
+ * - `start`: Left side in LTR, right side in RTL
97
+ * - `end`: Right side in LTR, left side in RTL
98
+ * @default 'start'
99
+ */
100
+ origin: "end" | "start";
101
+ /**
102
+ * Callback fired when the SidePanel's transition state changes.
103
+ * Use this to react to state changes including animation states.
104
+ * @param state The new transition state
105
+ */
106
+ onStateTransition(state: SidePanelTransitionStates): void;
107
+ }) => void) | undefined;
108
+ onHandleAnimationEnd?: ((data: React.TransitionEvent<HTMLDivElement>, prevState: {
109
+ /**
110
+ * The unique ID for the panel element. Used for `aria-controls` on the toggle button.
111
+ */
112
+ panelId: string;
113
+ /**
114
+ * The unique ID for the panel's label element. Used for `aria-labelledby` on the panel
115
+ * and toggle button to provide an accessible name.
116
+ */
117
+ labelId: string;
118
+ /**
119
+ * The current transition state of the SidePanel. This tracks both the expanded/collapsed
120
+ * state and the animation states (expanding/collapsing).
121
+ */
122
+ transitionState: SidePanelTransitionStates;
123
+ /**
124
+ * The initial transition state of the SidePanel.
125
+ * @default 'expanded'
126
+ */
127
+ initialTransitionState: SidePanelTransitionStates;
128
+ /**
129
+ * Which side the SidePanel originates from. Uses logical properties for RTL support.
130
+ * - `start`: Left side in LTR, right side in RTL
131
+ * - `end`: Right side in LTR, left side in RTL
132
+ * @default 'start'
133
+ */
134
+ origin: "end" | "start";
135
+ /**
136
+ * Callback fired when the SidePanel's transition state changes.
137
+ * Use this to react to state changes including animation states.
138
+ * @param state The new transition state
139
+ */
140
+ onStateTransition(state: SidePanelTransitionStates): void;
141
+ }) => void) | undefined;
142
+ onHandleAnimationStart?: ((data: undefined, prevState: {
143
+ /**
144
+ * The unique ID for the panel element. Used for `aria-controls` on the toggle button.
145
+ */
146
+ panelId: string;
147
+ /**
148
+ * The unique ID for the panel's label element. Used for `aria-labelledby` on the panel
149
+ * and toggle button to provide an accessible name.
150
+ */
151
+ labelId: string;
152
+ /**
153
+ * The current transition state of the SidePanel. This tracks both the expanded/collapsed
154
+ * state and the animation states (expanding/collapsing).
155
+ */
156
+ transitionState: SidePanelTransitionStates;
157
+ /**
158
+ * The initial transition state of the SidePanel.
159
+ * @default 'expanded'
160
+ */
161
+ initialTransitionState: SidePanelTransitionStates;
162
+ /**
163
+ * Which side the SidePanel originates from. Uses logical properties for RTL support.
164
+ * - `start`: Left side in LTR, right side in RTL
165
+ * - `end`: Right side in LTR, left side in RTL
166
+ * @default 'start'
167
+ */
168
+ origin: "end" | "start";
169
+ /**
170
+ * Callback fired when the SidePanel's transition state changes.
171
+ * Use this to react to state changes including animation states.
172
+ * @param state The new transition state
173
+ */
174
+ onStateTransition(state: SidePanelTransitionStates): void;
175
+ }) => void) | undefined;
176
+ } & {
177
+ shouldExpand?: ((data: undefined, state: {
178
+ /**
179
+ * The unique ID for the panel element. Used for `aria-controls` on the toggle button.
180
+ */
181
+ panelId: string;
182
+ /**
183
+ * The unique ID for the panel's label element. Used for `aria-labelledby` on the panel
184
+ * and toggle button to provide an accessible name.
185
+ */
186
+ labelId: string;
187
+ /**
188
+ * The current transition state of the SidePanel. This tracks both the expanded/collapsed
189
+ * state and the animation states (expanding/collapsing).
190
+ */
191
+ transitionState: SidePanelTransitionStates;
192
+ /**
193
+ * The initial transition state of the SidePanel.
194
+ * @default 'expanded'
195
+ */
196
+ initialTransitionState: SidePanelTransitionStates;
197
+ /**
198
+ * Which side the SidePanel originates from. Uses logical properties for RTL support.
199
+ * - `start`: Left side in LTR, right side in RTL
200
+ * - `end`: Right side in LTR, left side in RTL
201
+ * @default 'start'
202
+ */
203
+ origin: "end" | "start";
204
+ /**
205
+ * Callback fired when the SidePanel's transition state changes.
206
+ * Use this to react to state changes including animation states.
207
+ * @param state The new transition state
208
+ */
209
+ onStateTransition(state: SidePanelTransitionStates): void;
210
+ }) => boolean) | undefined;
211
+ shouldCollapse?: ((data: undefined, state: {
212
+ /**
213
+ * The unique ID for the panel element. Used for `aria-controls` on the toggle button.
214
+ */
215
+ panelId: string;
216
+ /**
217
+ * The unique ID for the panel's label element. Used for `aria-labelledby` on the panel
218
+ * and toggle button to provide an accessible name.
219
+ */
220
+ labelId: string;
221
+ /**
222
+ * The current transition state of the SidePanel. This tracks both the expanded/collapsed
223
+ * state and the animation states (expanding/collapsing).
224
+ */
225
+ transitionState: SidePanelTransitionStates;
226
+ /**
227
+ * The initial transition state of the SidePanel.
228
+ * @default 'expanded'
229
+ */
230
+ initialTransitionState: SidePanelTransitionStates;
231
+ /**
232
+ * Which side the SidePanel originates from. Uses logical properties for RTL support.
233
+ * - `start`: Left side in LTR, right side in RTL
234
+ * - `end`: Right side in LTR, left side in RTL
235
+ * @default 'start'
236
+ */
237
+ origin: "end" | "start";
238
+ /**
239
+ * Callback fired when the SidePanel's transition state changes.
240
+ * Use this to react to state changes including animation states.
241
+ * @param state The new transition state
242
+ */
243
+ onStateTransition(state: SidePanelTransitionStates): void;
244
+ }) => boolean) | undefined;
245
+ shouldHandleAnimationEnd?: ((data: React.TransitionEvent<HTMLDivElement>, state: {
246
+ /**
247
+ * The unique ID for the panel element. Used for `aria-controls` on the toggle button.
248
+ */
249
+ panelId: string;
250
+ /**
251
+ * The unique ID for the panel's label element. Used for `aria-labelledby` on the panel
252
+ * and toggle button to provide an accessible name.
253
+ */
254
+ labelId: string;
255
+ /**
256
+ * The current transition state of the SidePanel. This tracks both the expanded/collapsed
257
+ * state and the animation states (expanding/collapsing).
258
+ */
259
+ transitionState: SidePanelTransitionStates;
260
+ /**
261
+ * The initial transition state of the SidePanel.
262
+ * @default 'expanded'
263
+ */
264
+ initialTransitionState: SidePanelTransitionStates;
265
+ /**
266
+ * Which side the SidePanel originates from. Uses logical properties for RTL support.
267
+ * - `start`: Left side in LTR, right side in RTL
268
+ * - `end`: Right side in LTR, left side in RTL
269
+ * @default 'start'
270
+ */
271
+ origin: "end" | "start";
272
+ /**
273
+ * Callback fired when the SidePanel's transition state changes.
274
+ * Use this to react to state changes including animation states.
275
+ * @param state The new transition state
276
+ */
277
+ onStateTransition(state: SidePanelTransitionStates): void;
278
+ }) => boolean) | undefined;
279
+ shouldHandleAnimationStart?: ((data: undefined, state: {
280
+ /**
281
+ * The unique ID for the panel element. Used for `aria-controls` on the toggle button.
282
+ */
283
+ panelId: string;
284
+ /**
285
+ * The unique ID for the panel's label element. Used for `aria-labelledby` on the panel
286
+ * and toggle button to provide an accessible name.
287
+ */
288
+ labelId: string;
289
+ /**
290
+ * The current transition state of the SidePanel. This tracks both the expanded/collapsed
291
+ * state and the animation states (expanding/collapsing).
292
+ */
293
+ transitionState: SidePanelTransitionStates;
294
+ /**
295
+ * The initial transition state of the SidePanel.
296
+ * @default 'expanded'
297
+ */
298
+ initialTransitionState: SidePanelTransitionStates;
299
+ /**
300
+ * Which side the SidePanel originates from. Uses logical properties for RTL support.
301
+ * - `start`: Left side in LTR, right side in RTL
302
+ * - `end`: Right side in LTR, left side in RTL
303
+ * @default 'start'
304
+ */
305
+ origin: "end" | "start";
306
+ /**
307
+ * Callback fired when the SidePanel's transition state changes.
308
+ * Use this to react to state changes including animation states.
309
+ * @param state The new transition state
310
+ */
311
+ onStateTransition(state: SidePanelTransitionStates): void;
312
+ }) => boolean) | undefined;
313
+ }) | undefined) => {
314
+ state: {
315
+ /**
316
+ * The unique ID for the panel element. Used for `aria-controls` on the toggle button.
317
+ */
318
+ panelId: string;
319
+ /**
320
+ * The unique ID for the panel's label element. Used for `aria-labelledby` on the panel
321
+ * and toggle button to provide an accessible name.
322
+ */
323
+ labelId: string;
324
+ /**
325
+ * The current transition state of the SidePanel. This tracks both the expanded/collapsed
326
+ * state and the animation states (expanding/collapsing).
327
+ */
328
+ transitionState: SidePanelTransitionStates;
329
+ /**
330
+ * The initial transition state of the SidePanel.
331
+ * @default 'expanded'
332
+ */
333
+ initialTransitionState: SidePanelTransitionStates;
334
+ /**
335
+ * Which side the SidePanel originates from. Uses logical properties for RTL support.
336
+ * - `start`: Left side in LTR, right side in RTL
337
+ * - `end`: Right side in LTR, left side in RTL
338
+ * @default 'start'
339
+ */
340
+ origin: "end" | "start";
341
+ /**
342
+ * Callback fired when the SidePanel's transition state changes.
343
+ * Use this to react to state changes including animation states.
344
+ * @param state The new transition state
345
+ */
346
+ onStateTransition(state: SidePanelTransitionStates): void;
347
+ };
348
+ events: {
349
+ /**
350
+ * Expand the SidePanel. This sets the state directly to `expanded` without animation.
351
+ * For animated expansion, use the toggle button which triggers `setExpandingState`.
352
+ */
353
+ expand(): void;
354
+ /**
355
+ * Collapse the SidePanel. This sets the state directly to `collapsed` without animation.
356
+ * For animated collapse, use the toggle button which triggers `setCollapsingState`.
357
+ */
358
+ collapse(): void;
359
+ /**
360
+ * Handler for the CSS transition end event. This should be called when the width
361
+ * transition completes to finalize the state from `expanding` to `expanded` or
362
+ * from `collapsing` to `collapsed`.
363
+ */
364
+ handleAnimationEnd(event: React.TransitionEvent<HTMLDivElement>): React.TransitionEvent<HTMLDivElement>;
365
+ /**
366
+ * Triggers the start of a transition animation. This toggles between expanding
367
+ * and collapsing states based on the current state.
368
+ */
369
+ handleAnimationStart(): undefined;
370
+ };
371
+ }) & import("@workday/canvas-kit-react/common").ModelExtras<{
372
+ /**
373
+ * The initial transition state of the SidePanel.
374
+ * @default 'expanded'
375
+ */
376
+ initialTransitionState: SidePanelTransitionStates;
377
+ /**
378
+ * Which side the SidePanel originates from. Uses logical properties for RTL support.
379
+ * - `start`: Left side in LTR, right side in RTL
380
+ * - `end`: Right side in LTR, left side in RTL
381
+ * @default 'start'
382
+ */
383
+ origin: "end" | "start";
384
+ /**
385
+ * The unique ID for the panel element. If not provided, a unique ID will be generated.
386
+ * This ID is used for the `aria-controls` attribute on the toggle button.
387
+ */
388
+ panelId: string;
389
+ /**
390
+ * The unique ID for the panel's label element. If not provided, a unique ID will be generated.
391
+ * This ID is used for the `aria-labelledby` attribute on both the panel and toggle button.
392
+ */
393
+ labelId: string;
394
+ /**
395
+ * Callback fired when the SidePanel's transition state changes.
396
+ * Use this to react to state changes including animation states.
397
+ * @param state The new transition state
398
+ */
399
+ onStateTransition(state: SidePanelTransitionStates): void;
400
+ }, {}, {
401
+ /**
402
+ * The unique ID for the panel element. Used for `aria-controls` on the toggle button.
403
+ */
404
+ panelId: string;
405
+ /**
406
+ * The unique ID for the panel's label element. Used for `aria-labelledby` on the panel
407
+ * and toggle button to provide an accessible name.
408
+ */
409
+ labelId: string;
410
+ /**
411
+ * The current transition state of the SidePanel. This tracks both the expanded/collapsed
412
+ * state and the animation states (expanding/collapsing).
413
+ */
414
+ transitionState: SidePanelTransitionStates;
415
+ /**
416
+ * The initial transition state of the SidePanel.
417
+ * @default 'expanded'
418
+ */
419
+ initialTransitionState: SidePanelTransitionStates;
420
+ /**
421
+ * Which side the SidePanel originates from. Uses logical properties for RTL support.
422
+ * - `start`: Left side in LTR, right side in RTL
423
+ * - `end`: Right side in LTR, left side in RTL
424
+ * @default 'start'
425
+ */
426
+ origin: "end" | "start";
427
+ /**
428
+ * Callback fired when the SidePanel's transition state changes.
429
+ * Use this to react to state changes including animation states.
430
+ * @param state The new transition state
431
+ */
432
+ onStateTransition(state: SidePanelTransitionStates): void;
433
+ }, {
434
+ /**
435
+ * Expand the SidePanel. This sets the state directly to `expanded` without animation.
436
+ * For animated expansion, use the toggle button which triggers `setExpandingState`.
437
+ */
438
+ expand(): void;
439
+ /**
440
+ * Collapse the SidePanel. This sets the state directly to `collapsed` without animation.
441
+ * For animated collapse, use the toggle button which triggers `setCollapsingState`.
442
+ */
443
+ collapse(): void;
444
+ /**
445
+ * Handler for the CSS transition end event. This should be called when the width
446
+ * transition completes to finalize the state from `expanding` to `expanded` or
447
+ * from `collapsing` to `collapsed`.
448
+ */
449
+ handleAnimationEnd(event: React.TransitionEvent<HTMLDivElement>): React.TransitionEvent<HTMLDivElement>;
450
+ /**
451
+ * Triggers the start of a transition animation. This toggles between expanding
452
+ * and collapsing states based on the current state.
453
+ */
454
+ handleAnimationStart(): undefined;
455
+ }, {
456
+ state: {
457
+ /**
458
+ * The unique ID for the panel element. Used for `aria-controls` on the toggle button.
459
+ */
460
+ panelId: string;
461
+ /**
462
+ * The unique ID for the panel's label element. Used for `aria-labelledby` on the panel
463
+ * and toggle button to provide an accessible name.
464
+ */
465
+ labelId: string;
466
+ /**
467
+ * The current transition state of the SidePanel. This tracks both the expanded/collapsed
468
+ * state and the animation states (expanding/collapsing).
469
+ */
470
+ transitionState: SidePanelTransitionStates;
471
+ /**
472
+ * The initial transition state of the SidePanel.
473
+ * @default 'expanded'
474
+ */
475
+ initialTransitionState: SidePanelTransitionStates;
476
+ /**
477
+ * Which side the SidePanel originates from. Uses logical properties for RTL support.
478
+ * - `start`: Left side in LTR, right side in RTL
479
+ * - `end`: Right side in LTR, left side in RTL
480
+ * @default 'start'
481
+ */
482
+ origin: "end" | "start";
483
+ /**
484
+ * Callback fired when the SidePanel's transition state changes.
485
+ * Use this to react to state changes including animation states.
486
+ * @param state The new transition state
487
+ */
488
+ onStateTransition(state: SidePanelTransitionStates): void;
489
+ };
490
+ events: {
491
+ /**
492
+ * Expand the SidePanel. This sets the state directly to `expanded` without animation.
493
+ * For animated expansion, use the toggle button which triggers `setExpandingState`.
494
+ */
495
+ expand(): void;
496
+ /**
497
+ * Collapse the SidePanel. This sets the state directly to `collapsed` without animation.
498
+ * For animated collapse, use the toggle button which triggers `setCollapsingState`.
499
+ */
500
+ collapse(): void;
501
+ /**
502
+ * Handler for the CSS transition end event. This should be called when the width
503
+ * transition completes to finalize the state from `expanding` to `expanded` or
504
+ * from `collapsing` to `collapsed`.
505
+ */
506
+ handleAnimationEnd(event: React.TransitionEvent<HTMLDivElement>): React.TransitionEvent<HTMLDivElement>;
507
+ /**
508
+ * Triggers the start of a transition animation. This toggles between expanding
509
+ * and collapsing states based on the current state.
510
+ */
511
+ handleAnimationStart(): undefined;
512
+ };
513
+ }>;
514
+ //# sourceMappingURL=useSidePanelModel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSidePanelModel.d.ts","sourceRoot":"","sources":["../../../../side-panel/lib/useSidePanelModel.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;;;;;GAMG;AACH,MAAM,MAAM,yBAAyB,GAAG,WAAW,GAAG,YAAY,GAAG,UAAU,GAAG,WAAW,CAAC;AAE9F,eAAO,MAAM,iBAAiB;IAE1B;;;OAGG;;IAEH;;;;;OAKG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;;;OAIG;6BACsB,yBAAyB;;;QAsBlD;;WAEG;;QAEH;;;WAGG;;QAEH;;;WAGG;;QA7DH;;;WAGG;;QAEH;;;;;WAKG;;QAYH;;;;WAIG;iCACsB,yBAAyB;;;QAsBlD;;WAEG;;QAEH;;;WAGG;;QAEH;;;WAGG;;QA7DH;;;WAGG;;QAEH;;;;;WAKG;;QAYH;;;;WAIG;iCACsB,yBAAyB;;;QAsBlD;;WAEG;;QAEH;;;WAGG;;QAEH;;;WAGG;;QA7DH;;;WAGG;;QAEH;;;;;WAKG;;QAYH;;;;WAIG;iCACsB,yBAAyB;;;QAsBlD;;WAEG;;QAEH;;;WAGG;;QAEH;;;WAGG;;QA7DH;;;WAGG;;QAEH;;;;;WAKG;;QAYH;;;;WAIG;iCACsB,yBAAyB;;;;QAsBlD;;WAEG;;QAEH;;;WAGG;;QAEH;;;WAGG;;QA7DH;;;WAGG;;QAEH;;;;;WAKG;;QAYH;;;;WAIG;iCACsB,yBAAyB;;;QAsBlD;;WAEG;;QAEH;;;WAGG;;QAEH;;;WAGG;;QA7DH;;;WAGG;;QAEH;;;;;WAKG;;QAYH;;;;WAIG;iCACsB,yBAAyB;;;QAsBlD;;WAEG;;QAEH;;;WAGG;;QAEH;;;WAGG;;QA7DH;;;WAGG;;QAEH;;;;;WAKG;;QAYH;;;;WAIG;iCACsB,yBAAyB;;;QAsBlD;;WAEG;;QAEH;;;WAGG;;QAEH;;;WAGG;;QA7DH;;;WAGG;;QAEH;;;;;WAKG;;QAYH;;;;WAIG;iCACsB,yBAAyB;;;;QAsBlD;;WAEG;;QAEH;;;WAGG;;QAEH;;;WAGG;;QA7DH;;;WAGG;;QAEH;;;;;WAKG;;QAYH;;;;WAIG;iCACsB,yBAAyB;;;QAuClD;;;WAGG;;QAKH;;;WAGG;;QAKH;;;;WAIG;kCACuB,qBAAqB,CAAC,cAAc,CAAC;QAW/D;;;WAGG;;;;IArGH;;;OAGG;;IAEH;;;;;OAKG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;;;OAIG;6BACsB,yBAAyB;;IAsBlD;;OAEG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IA7DH;;;OAGG;;IAEH;;;;;OAKG;;IAYH;;;;OAIG;6BACsB,yBAAyB;;IAuClD;;;OAGG;;IAKH;;;OAGG;;IAKH;;;;OAIG;8BACuB,qBAAqB,CAAC,cAAc,CAAC;IAW/D;;;OAGG;;;;QApDH;;WAEG;;QAEH;;;WAGG;;QAEH;;;WAGG;;QA7DH;;;WAGG;;QAEH;;;;;WAKG;;QAYH;;;;WAIG;iCACsB,yBAAyB;;;QAuClD;;;WAGG;;QAKH;;;WAGG;;QAKH;;;;WAIG;kCACuB,qBAAqB,CAAC,cAAc,CAAC;QAW/D;;;WAGG;;;EAYL,CAAC"}
@@ -0,0 +1,108 @@
1
+ import { createModelHook, useUniqueId } from '@workday/canvas-kit-react/common';
2
+ import * as React from 'react';
3
+ export const useSidePanelModel = createModelHook({
4
+ defaultConfig: {
5
+ /**
6
+ * The initial transition state of the SidePanel.
7
+ * @default 'expanded'
8
+ */
9
+ initialTransitionState: 'expanded',
10
+ /**
11
+ * Which side the SidePanel originates from. Uses logical properties for RTL support.
12
+ * - `start`: Left side in LTR, right side in RTL
13
+ * - `end`: Right side in LTR, left side in RTL
14
+ * @default 'start'
15
+ */
16
+ origin: 'start',
17
+ /**
18
+ * The unique ID for the panel element. If not provided, a unique ID will be generated.
19
+ * This ID is used for the `aria-controls` attribute on the toggle button.
20
+ */
21
+ panelId: '',
22
+ /**
23
+ * The unique ID for the panel's label element. If not provided, a unique ID will be generated.
24
+ * This ID is used for the `aria-labelledby` attribute on both the panel and toggle button.
25
+ */
26
+ labelId: '',
27
+ /**
28
+ * Callback fired when the SidePanel's transition state changes.
29
+ * Use this to react to state changes including animation states.
30
+ * @param state The new transition state
31
+ */
32
+ onStateTransition(state) {
33
+ // no-op by default
34
+ },
35
+ },
36
+ })(config => {
37
+ const panelId = useUniqueId(config.panelId);
38
+ const labelId = useUniqueId(config.labelId);
39
+ const [transitionState, setTransitionStateInternal] = React.useState(config.initialTransitionState);
40
+ // Wrap setTransitionState to call the onStateTransition callback
41
+ const setTransitionState = React.useCallback((newState) => {
42
+ setTransitionStateInternal(newState);
43
+ config.onStateTransition(newState);
44
+ }, [config]);
45
+ const state = {
46
+ ...config,
47
+ /**
48
+ * The unique ID for the panel element. Used for `aria-controls` on the toggle button.
49
+ */
50
+ panelId,
51
+ /**
52
+ * The unique ID for the panel's label element. Used for `aria-labelledby` on the panel
53
+ * and toggle button to provide an accessible name.
54
+ */
55
+ labelId,
56
+ /**
57
+ * The current transition state of the SidePanel. This tracks both the expanded/collapsed
58
+ * state and the animation states (expanding/collapsing).
59
+ */
60
+ transitionState,
61
+ };
62
+ const events = {
63
+ /**
64
+ * Expand the SidePanel. This sets the state directly to `expanded` without animation.
65
+ * For animated expansion, use the toggle button which triggers `setExpandingState`.
66
+ */
67
+ expand() {
68
+ setTransitionState('expanded');
69
+ },
70
+ /**
71
+ * Collapse the SidePanel. This sets the state directly to `collapsed` without animation.
72
+ * For animated collapse, use the toggle button which triggers `setCollapsingState`.
73
+ */
74
+ collapse() {
75
+ setTransitionState('collapsed');
76
+ },
77
+ /**
78
+ * Handler for the CSS transition end event. This should be called when the width
79
+ * transition completes to finalize the state from `expanding` to `expanded` or
80
+ * from `collapsing` to `collapsed`.
81
+ */
82
+ handleAnimationEnd(event) {
83
+ if (event.propertyName === 'width') {
84
+ if (transitionState === 'expanding') {
85
+ setTransitionState('expanded');
86
+ }
87
+ else if (transitionState === 'collapsing') {
88
+ setTransitionState('collapsed');
89
+ }
90
+ }
91
+ return event;
92
+ },
93
+ /**
94
+ * Triggers the start of a transition animation. This toggles between expanding
95
+ * and collapsing states based on the current state.
96
+ */
97
+ handleAnimationStart() {
98
+ if (transitionState === 'collapsed' || transitionState === 'collapsing') {
99
+ setTransitionState('expanding');
100
+ }
101
+ else if (transitionState === 'expanded' || transitionState === 'expanding') {
102
+ setTransitionState('collapsing');
103
+ }
104
+ return undefined;
105
+ },
106
+ };
107
+ return { state, events };
108
+ });
@@ -1 +1 @@
1
- export const version = '14.1.27';
1
+ export const version = '14.1.28';
package/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './ai-ingress-button';
2
2
  export * from './combobox';
3
3
  export * from './search-form';
4
+ export * from './side-panel';
4
5
  export * from './version';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workday/canvas-kit-labs-react",
3
- "version": "15.0.0-alpha.0056-next.0",
3
+ "version": "15.0.0-alpha.0060-next.0",
4
4
  "description": "Canvas Kit Labs is an incubator for new and experimental components. Since we have a rather rigorous process for getting components in at a production level, it can be valuable to make them available earlier while we continuously iterate on the API/functionality. The Labs modules allow us to do that as needed.",
5
5
  "author": "Workday, Inc. (https://www.workday.com)",
6
6
  "license": "Apache-2.0",
@@ -48,8 +48,8 @@
48
48
  "dependencies": {
49
49
  "@emotion/react": "^11.7.1",
50
50
  "@emotion/styled": "^11.6.0",
51
- "@workday/canvas-kit-react": "^15.0.0-alpha.0056-next.0",
52
- "@workday/canvas-kit-styling": "^15.0.0-alpha.0056-next.0",
51
+ "@workday/canvas-kit-react": "^15.0.0-alpha.0060-next.0",
52
+ "@workday/canvas-kit-styling": "^15.0.0-alpha.0060-next.0",
53
53
  "@workday/canvas-system-icons-web": "^3.0.36",
54
54
  "@workday/canvas-tokens-web": "4.0.0-alpha.3",
55
55
  "@workday/design-assets-types": "^0.2.10",
@@ -60,5 +60,5 @@
60
60
  "devDependencies": {
61
61
  "@types/lodash.flatten": "^4.4.6"
62
62
  },
63
- "gitHead": "7ea41be00e30b2df431c3b8a49d5d2c24f3a9b8c"
63
+ "gitHead": "34d5076dcc1f6b3d605fc3bf5b36ce5f97917686"
64
64
  }
@@ -0,0 +1,3 @@
1
+ export * from './lib/SidePanel';
2
+ export * from './lib/SidePanelToggleButton';
3
+ export * from './lib/useSidePanelModel';