@workday/canvas-kit-labs-react 14.2.0-0055-next.0 → 14.2.0-0058-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.
- package/dist/commonjs/index.d.ts +1 -0
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +1 -0
- package/dist/commonjs/side-panel/index.d.ts +4 -0
- package/dist/commonjs/side-panel/index.d.ts.map +1 -0
- package/dist/commonjs/side-panel/index.js +19 -0
- package/dist/commonjs/side-panel/lib/SidePanel.d.ts +205 -0
- package/dist/commonjs/side-panel/lib/SidePanel.d.ts.map +1 -0
- package/dist/commonjs/side-panel/lib/SidePanel.js +64 -0
- package/dist/commonjs/side-panel/lib/SidePanelToggleButton.d.ts +95 -0
- package/dist/commonjs/side-panel/lib/SidePanelToggleButton.d.ts.map +1 -0
- package/dist/commonjs/side-panel/lib/SidePanelToggleButton.js +65 -0
- package/dist/commonjs/side-panel/lib/useSidePanelModel.d.ts +514 -0
- package/dist/commonjs/side-panel/lib/useSidePanelModel.d.ts.map +1 -0
- package/dist/commonjs/side-panel/lib/useSidePanelModel.js +134 -0
- package/dist/es6/index.d.ts +1 -0
- package/dist/es6/index.d.ts.map +1 -1
- package/dist/es6/index.js +1 -0
- package/dist/es6/side-panel/index.d.ts +4 -0
- package/dist/es6/side-panel/index.d.ts.map +1 -0
- package/dist/es6/side-panel/index.js +3 -0
- package/dist/es6/side-panel/lib/SidePanel.d.ts +205 -0
- package/dist/es6/side-panel/lib/SidePanel.d.ts.map +1 -0
- package/dist/es6/side-panel/lib/SidePanel.js +61 -0
- package/dist/es6/side-panel/lib/SidePanelToggleButton.d.ts +95 -0
- package/dist/es6/side-panel/lib/SidePanelToggleButton.d.ts.map +1 -0
- package/dist/es6/side-panel/lib/SidePanelToggleButton.js +62 -0
- package/dist/es6/side-panel/lib/useSidePanelModel.d.ts +514 -0
- package/dist/es6/side-panel/lib/useSidePanelModel.d.ts.map +1 -0
- package/dist/es6/side-panel/lib/useSidePanelModel.js +108 -0
- package/index.ts +1 -0
- package/package.json +4 -4
- package/side-panel/index.ts +3 -0
- package/side-panel/lib/SidePanel.tsx +131 -0
- package/side-panel/lib/SidePanelToggleButton.tsx +177 -0
- package/side-panel/lib/useSidePanelModel.ts +128 -0
- package/side-panel/package.json +6 -0
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Adds the necessary props to the SidePanel container element.
|
|
4
|
+
* This includes the `id` and `aria-labelledby` attributes for accessibility.
|
|
5
|
+
*/
|
|
6
|
+
export declare const useSidePanelContainer: import("@workday/canvas-kit-react/common").BehaviorHook<{
|
|
7
|
+
state: {
|
|
8
|
+
panelId: string;
|
|
9
|
+
labelId: string;
|
|
10
|
+
transitionState: import("./useSidePanelModel").SidePanelTransitionStates;
|
|
11
|
+
initialTransitionState: import("./useSidePanelModel").SidePanelTransitionStates;
|
|
12
|
+
origin: "end" | "start";
|
|
13
|
+
onStateTransition(state: import("./useSidePanelModel").SidePanelTransitionStates): void;
|
|
14
|
+
};
|
|
15
|
+
events: {
|
|
16
|
+
expand(): void;
|
|
17
|
+
collapse(): void;
|
|
18
|
+
handleAnimationEnd(event: React.TransitionEvent<HTMLDivElement>): React.TransitionEvent<HTMLDivElement>;
|
|
19
|
+
handleAnimationStart(): undefined;
|
|
20
|
+
};
|
|
21
|
+
}, {
|
|
22
|
+
readonly id: string;
|
|
23
|
+
readonly 'aria-labelledby': string;
|
|
24
|
+
readonly onTransitionEnd: (event: React.TransitionEvent<HTMLDivElement>) => React.TransitionEvent<HTMLDivElement>;
|
|
25
|
+
}>;
|
|
26
|
+
export type SidePanelVariant = 'standard' | 'alternate';
|
|
27
|
+
export interface SidePanelProps {
|
|
28
|
+
/**
|
|
29
|
+
* The width of the component (in `px` if it's a `number`) when it is collapsed.
|
|
30
|
+
*
|
|
31
|
+
* @default 64
|
|
32
|
+
*/
|
|
33
|
+
collapsedWidth?: number | string;
|
|
34
|
+
/**
|
|
35
|
+
* The width of the component (in `px` if it's a `number`) when it is expanded.
|
|
36
|
+
*
|
|
37
|
+
* @default 320
|
|
38
|
+
*/
|
|
39
|
+
expandedWidth?: number | string;
|
|
40
|
+
/**
|
|
41
|
+
* The style variant of the side panel. 'standard' uses a lighter gray background (`system.color.bg.alt.softer`), no depth. 'alternate' uses a white background with depth (`system.color.bg.default` and level 5 depth).
|
|
42
|
+
*
|
|
43
|
+
* @default 'standard'
|
|
44
|
+
*/
|
|
45
|
+
variant?: SidePanelVariant;
|
|
46
|
+
children?: React.ReactNode;
|
|
47
|
+
}
|
|
48
|
+
export declare const panelStencil: import("@workday/canvas-kit-styling").Stencil<{
|
|
49
|
+
variant: {
|
|
50
|
+
alternate: {
|
|
51
|
+
backgroundColor: "--cnvs-sys-color-bg-default";
|
|
52
|
+
boxShadow: "--cnvs-sys-depth-5";
|
|
53
|
+
};
|
|
54
|
+
standard: {
|
|
55
|
+
backgroundColor: "--cnvs-sys-color-bg-alt-softer";
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
expanded: {
|
|
59
|
+
expanded: ({ expandedWidth }: {
|
|
60
|
+
expandedWidth: `--${string}`;
|
|
61
|
+
collapsedWidth: `--${string}`;
|
|
62
|
+
} & import("@workday/canvas-kit-styling").StencilVarsParts<{}>) => {
|
|
63
|
+
width: `--${string}`;
|
|
64
|
+
maxWidth: `--${string}`;
|
|
65
|
+
};
|
|
66
|
+
collapsed: ({ collapsedWidth }: {
|
|
67
|
+
expandedWidth: `--${string}`;
|
|
68
|
+
collapsedWidth: `--${string}`;
|
|
69
|
+
} & import("@workday/canvas-kit-styling").StencilVarsParts<{}>) => {
|
|
70
|
+
width: `--${string}`;
|
|
71
|
+
maxWidth: `--${string}`;
|
|
72
|
+
};
|
|
73
|
+
expanding: ({ expandedWidth }: {
|
|
74
|
+
expandedWidth: `--${string}`;
|
|
75
|
+
collapsedWidth: `--${string}`;
|
|
76
|
+
} & import("@workday/canvas-kit-styling").StencilVarsParts<{}>) => {
|
|
77
|
+
width: `--${string}`;
|
|
78
|
+
maxWidth: `--${string}`;
|
|
79
|
+
};
|
|
80
|
+
collapsing: ({ collapsedWidth }: {
|
|
81
|
+
expandedWidth: `--${string}`;
|
|
82
|
+
collapsedWidth: `--${string}`;
|
|
83
|
+
} & import("@workday/canvas-kit-styling").StencilVarsParts<{}>) => {
|
|
84
|
+
width: `--${string}`;
|
|
85
|
+
maxWidth: `--${string}`;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
}, {}, {
|
|
89
|
+
expandedWidth: string;
|
|
90
|
+
collapsedWidth: string;
|
|
91
|
+
}, never, never>;
|
|
92
|
+
export declare const SidePanel: import("@workday/canvas-kit-react/common").ElementComponentM<"section", SidePanelProps & Partial<{
|
|
93
|
+
initialTransitionState: import("./useSidePanelModel").SidePanelTransitionStates;
|
|
94
|
+
origin: "end" | "start";
|
|
95
|
+
panelId: string;
|
|
96
|
+
labelId: string;
|
|
97
|
+
onStateTransition(state: import("./useSidePanelModel").SidePanelTransitionStates): void;
|
|
98
|
+
}> & {
|
|
99
|
+
onExpand?: ((data: undefined, prevState: {
|
|
100
|
+
panelId: string;
|
|
101
|
+
labelId: string;
|
|
102
|
+
transitionState: import("./useSidePanelModel").SidePanelTransitionStates;
|
|
103
|
+
initialTransitionState: import("./useSidePanelModel").SidePanelTransitionStates;
|
|
104
|
+
origin: "end" | "start";
|
|
105
|
+
onStateTransition(state: import("./useSidePanelModel").SidePanelTransitionStates): void;
|
|
106
|
+
}) => void) | undefined;
|
|
107
|
+
onCollapse?: ((data: undefined, prevState: {
|
|
108
|
+
panelId: string;
|
|
109
|
+
labelId: string;
|
|
110
|
+
transitionState: import("./useSidePanelModel").SidePanelTransitionStates;
|
|
111
|
+
initialTransitionState: import("./useSidePanelModel").SidePanelTransitionStates;
|
|
112
|
+
origin: "end" | "start";
|
|
113
|
+
onStateTransition(state: import("./useSidePanelModel").SidePanelTransitionStates): void;
|
|
114
|
+
}) => void) | undefined;
|
|
115
|
+
onHandleAnimationEnd?: ((data: React.TransitionEvent<HTMLDivElement>, prevState: {
|
|
116
|
+
panelId: string;
|
|
117
|
+
labelId: string;
|
|
118
|
+
transitionState: import("./useSidePanelModel").SidePanelTransitionStates;
|
|
119
|
+
initialTransitionState: import("./useSidePanelModel").SidePanelTransitionStates;
|
|
120
|
+
origin: "end" | "start";
|
|
121
|
+
onStateTransition(state: import("./useSidePanelModel").SidePanelTransitionStates): void;
|
|
122
|
+
}) => void) | undefined;
|
|
123
|
+
onHandleAnimationStart?: ((data: undefined, prevState: {
|
|
124
|
+
panelId: string;
|
|
125
|
+
labelId: string;
|
|
126
|
+
transitionState: import("./useSidePanelModel").SidePanelTransitionStates;
|
|
127
|
+
initialTransitionState: import("./useSidePanelModel").SidePanelTransitionStates;
|
|
128
|
+
origin: "end" | "start";
|
|
129
|
+
onStateTransition(state: import("./useSidePanelModel").SidePanelTransitionStates): void;
|
|
130
|
+
}) => void) | undefined;
|
|
131
|
+
} & {
|
|
132
|
+
shouldExpand?: ((data: undefined, state: {
|
|
133
|
+
panelId: string;
|
|
134
|
+
labelId: string;
|
|
135
|
+
transitionState: import("./useSidePanelModel").SidePanelTransitionStates;
|
|
136
|
+
initialTransitionState: import("./useSidePanelModel").SidePanelTransitionStates;
|
|
137
|
+
origin: "end" | "start";
|
|
138
|
+
onStateTransition(state: import("./useSidePanelModel").SidePanelTransitionStates): void;
|
|
139
|
+
}) => boolean) | undefined;
|
|
140
|
+
shouldCollapse?: ((data: undefined, state: {
|
|
141
|
+
panelId: string;
|
|
142
|
+
labelId: string;
|
|
143
|
+
transitionState: import("./useSidePanelModel").SidePanelTransitionStates;
|
|
144
|
+
initialTransitionState: import("./useSidePanelModel").SidePanelTransitionStates;
|
|
145
|
+
origin: "end" | "start";
|
|
146
|
+
onStateTransition(state: import("./useSidePanelModel").SidePanelTransitionStates): void;
|
|
147
|
+
}) => boolean) | undefined;
|
|
148
|
+
shouldHandleAnimationEnd?: ((data: React.TransitionEvent<HTMLDivElement>, state: {
|
|
149
|
+
panelId: string;
|
|
150
|
+
labelId: string;
|
|
151
|
+
transitionState: import("./useSidePanelModel").SidePanelTransitionStates;
|
|
152
|
+
initialTransitionState: import("./useSidePanelModel").SidePanelTransitionStates;
|
|
153
|
+
origin: "end" | "start";
|
|
154
|
+
onStateTransition(state: import("./useSidePanelModel").SidePanelTransitionStates): void;
|
|
155
|
+
}) => boolean) | undefined;
|
|
156
|
+
shouldHandleAnimationStart?: ((data: undefined, state: {
|
|
157
|
+
panelId: string;
|
|
158
|
+
labelId: string;
|
|
159
|
+
transitionState: import("./useSidePanelModel").SidePanelTransitionStates;
|
|
160
|
+
initialTransitionState: import("./useSidePanelModel").SidePanelTransitionStates;
|
|
161
|
+
origin: "end" | "start";
|
|
162
|
+
onStateTransition(state: import("./useSidePanelModel").SidePanelTransitionStates): void;
|
|
163
|
+
}) => boolean) | undefined;
|
|
164
|
+
}, {
|
|
165
|
+
state: {
|
|
166
|
+
panelId: string;
|
|
167
|
+
labelId: string;
|
|
168
|
+
transitionState: import("./useSidePanelModel").SidePanelTransitionStates;
|
|
169
|
+
initialTransitionState: import("./useSidePanelModel").SidePanelTransitionStates;
|
|
170
|
+
origin: "end" | "start";
|
|
171
|
+
onStateTransition(state: import("./useSidePanelModel").SidePanelTransitionStates): void;
|
|
172
|
+
};
|
|
173
|
+
events: {
|
|
174
|
+
expand(): void;
|
|
175
|
+
collapse(): void;
|
|
176
|
+
handleAnimationEnd(event: React.TransitionEvent<HTMLDivElement>): React.TransitionEvent<HTMLDivElement>;
|
|
177
|
+
handleAnimationStart(): undefined;
|
|
178
|
+
};
|
|
179
|
+
}> & {
|
|
180
|
+
/**
|
|
181
|
+
* `SidePanel.ToggleButton` is a control that toggles between expanded and collapsed states.
|
|
182
|
+
* It must be used within the `SidePanel` component as a child. For accessibility purposes,
|
|
183
|
+
* it should be the first focusable element in the panel.
|
|
184
|
+
*
|
|
185
|
+
* The button automatically receives `aria-controls`, `aria-expanded`, and `aria-labelledby`
|
|
186
|
+
* attributes from the model.
|
|
187
|
+
*/
|
|
188
|
+
ToggleButton: import("@workday/canvas-kit-react/common").ElementComponentM<"button", import("./SidePanelToggleButton").SidePanelToggleButtonProps, {
|
|
189
|
+
state: {
|
|
190
|
+
panelId: string;
|
|
191
|
+
labelId: string;
|
|
192
|
+
transitionState: import("./useSidePanelModel").SidePanelTransitionStates;
|
|
193
|
+
initialTransitionState: import("./useSidePanelModel").SidePanelTransitionStates;
|
|
194
|
+
origin: "end" | "start";
|
|
195
|
+
onStateTransition(state: import("./useSidePanelModel").SidePanelTransitionStates): void;
|
|
196
|
+
};
|
|
197
|
+
events: {
|
|
198
|
+
expand(): void;
|
|
199
|
+
collapse(): void;
|
|
200
|
+
handleAnimationEnd(event: React.TransitionEvent<HTMLDivElement>): React.TransitionEvent<HTMLDivElement>;
|
|
201
|
+
handleAnimationStart(): undefined;
|
|
202
|
+
};
|
|
203
|
+
}>;
|
|
204
|
+
};
|
|
205
|
+
//# sourceMappingURL=SidePanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SidePanel.d.ts","sourceRoot":"","sources":["../../../../side-panel/lib/SidePanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B;;;GAGG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;EAMhC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,WAAW,CAAC;AAExD,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC;;;;OAIG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAyCvB,CAAC;AAEH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAKlB;;;;;;;OAOG;;;;;;;;;;;;;;;;;CAgCN,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContainer, createElemPropsHook } from '@workday/canvas-kit-react/common';
|
|
3
|
+
import { createStencil, handleCsProp, px2rem } from '@workday/canvas-kit-styling';
|
|
4
|
+
import { system } from '@workday/canvas-tokens-web';
|
|
5
|
+
import { useSidePanelModel } from './useSidePanelModel';
|
|
6
|
+
import { SidePanelToggleButton } from './SidePanelToggleButton';
|
|
7
|
+
/**
|
|
8
|
+
* Adds the necessary props to the SidePanel container element.
|
|
9
|
+
* This includes the `id` and `aria-labelledby` attributes for accessibility.
|
|
10
|
+
*/
|
|
11
|
+
export const useSidePanelContainer = createElemPropsHook(useSidePanelModel)(({ state, events }) => {
|
|
12
|
+
return {
|
|
13
|
+
id: state.panelId,
|
|
14
|
+
'aria-labelledby': state.labelId,
|
|
15
|
+
onTransitionEnd: events.handleAnimationEnd,
|
|
16
|
+
};
|
|
17
|
+
});
|
|
18
|
+
export const panelStencil = createStencil({
|
|
19
|
+
vars: {
|
|
20
|
+
expandedWidth: '',
|
|
21
|
+
collapsedWidth: '',
|
|
22
|
+
},
|
|
23
|
+
base: { name: "23943w", styles: "box-sizing:border-box;overflow:hidden;position:relative;height:100%;outline:0.0625rem solid transparent;transition:width ease-out 200ms, max-width ease-out 200ms;" },
|
|
24
|
+
modifiers: {
|
|
25
|
+
variant: {
|
|
26
|
+
alternate: { name: "2bjjfl", styles: "background-color:var(--cnvs-sys-color-bg-default);box-shadow:var(--cnvs-sys-depth-5);" },
|
|
27
|
+
standard: { name: "1lsdyl", styles: "background-color:var(--cnvs-sys-color-bg-alt-softer);" }
|
|
28
|
+
},
|
|
29
|
+
expanded: {
|
|
30
|
+
expanded: { name: "i9o5v", styles: "width:var(--expandedWidth-panel-46751f);max-width:var(--expandedWidth-panel-46751f);" },
|
|
31
|
+
collapsed: { name: "3tfzp8", styles: "width:var(--collapsedWidth-panel-46751f);max-width:var(--collapsedWidth-panel-46751f);" },
|
|
32
|
+
expanding: { name: "42gyid", styles: "width:var(--expandedWidth-panel-46751f);max-width:var(--expandedWidth-panel-46751f);" },
|
|
33
|
+
collapsing: { name: "mk8xq", styles: "width:var(--collapsedWidth-panel-46751f);max-width:var(--collapsedWidth-panel-46751f);" }
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}, "panel-46751f");
|
|
37
|
+
export const SidePanel = createContainer('section')({
|
|
38
|
+
displayName: 'SidePanel',
|
|
39
|
+
modelHook: useSidePanelModel,
|
|
40
|
+
elemPropsHook: useSidePanelContainer,
|
|
41
|
+
subComponents: {
|
|
42
|
+
/**
|
|
43
|
+
* `SidePanel.ToggleButton` is a control that toggles between expanded and collapsed states.
|
|
44
|
+
* It must be used within the `SidePanel` component as a child. For accessibility purposes,
|
|
45
|
+
* it should be the first focusable element in the panel.
|
|
46
|
+
*
|
|
47
|
+
* The button automatically receives `aria-controls`, `aria-expanded`, and `aria-labelledby`
|
|
48
|
+
* attributes from the model.
|
|
49
|
+
*/
|
|
50
|
+
ToggleButton: SidePanelToggleButton,
|
|
51
|
+
},
|
|
52
|
+
})(({ collapsedWidth = 64, expandedWidth = 320, variant = 'standard', children, ...elemProps }, Element, model) => {
|
|
53
|
+
return (_jsx(Element, { ...handleCsProp(elemProps, [
|
|
54
|
+
panelStencil({
|
|
55
|
+
expanded: model.state.transitionState,
|
|
56
|
+
variant,
|
|
57
|
+
expandedWidth: typeof expandedWidth === 'number' ? px2rem(expandedWidth) : expandedWidth,
|
|
58
|
+
collapsedWidth: typeof collapsedWidth === 'number' ? px2rem(collapsedWidth) : collapsedWidth,
|
|
59
|
+
}),
|
|
60
|
+
]), children: children }));
|
|
61
|
+
});
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ExtractProps } from '@workday/canvas-kit-react/common';
|
|
3
|
+
import { TertiaryButton } from '@workday/canvas-kit-react/button';
|
|
4
|
+
import { TooltipProps } from '@workday/canvas-kit-react/tooltip';
|
|
5
|
+
export interface SidePanelToggleButtonProps extends ExtractProps<typeof TertiaryButton> {
|
|
6
|
+
/**
|
|
7
|
+
* The tooltip text to expand the side panel
|
|
8
|
+
*/
|
|
9
|
+
tooltipTextExpand?: string;
|
|
10
|
+
/**
|
|
11
|
+
* The tooltip text to collapse the side panel
|
|
12
|
+
*/
|
|
13
|
+
tooltipTextCollapse?: string;
|
|
14
|
+
tooltipProps?: Omit<TooltipProps, 'children'>;
|
|
15
|
+
}
|
|
16
|
+
export declare const sidePanelToggleButtonStencil: import("@workday/canvas-kit-styling").Stencil<{
|
|
17
|
+
state: {
|
|
18
|
+
collapsing: {
|
|
19
|
+
margin: number;
|
|
20
|
+
transform: string;
|
|
21
|
+
':dir(rtl)': {
|
|
22
|
+
transform: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
collapsed: {
|
|
26
|
+
margin: string;
|
|
27
|
+
insetInlineStart: number;
|
|
28
|
+
insetInlineEnd: number;
|
|
29
|
+
transform: string;
|
|
30
|
+
':dir(rtl)': {
|
|
31
|
+
transform: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
expanded: {
|
|
35
|
+
margin: number;
|
|
36
|
+
transform: string;
|
|
37
|
+
':dir(rtl)': {
|
|
38
|
+
transform: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
expanding: {
|
|
42
|
+
margin: number;
|
|
43
|
+
transform: string;
|
|
44
|
+
':dir(rtl)': {
|
|
45
|
+
transform: string;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
origin: {
|
|
50
|
+
start: {};
|
|
51
|
+
end: {
|
|
52
|
+
transform: string;
|
|
53
|
+
':dir(rtl)': {
|
|
54
|
+
transform: string;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
}, {}, {}, never, never>;
|
|
59
|
+
export declare const useSidePanelToggleButtonElemProps: import("@workday/canvas-kit-react/common").BehaviorHook<{
|
|
60
|
+
state: {
|
|
61
|
+
panelId: string;
|
|
62
|
+
labelId: string;
|
|
63
|
+
transitionState: import("./useSidePanelModel").SidePanelTransitionStates;
|
|
64
|
+
initialTransitionState: import("./useSidePanelModel").SidePanelTransitionStates;
|
|
65
|
+
origin: "end" | "start";
|
|
66
|
+
onStateTransition(state: import("./useSidePanelModel").SidePanelTransitionStates): void;
|
|
67
|
+
};
|
|
68
|
+
events: {
|
|
69
|
+
expand(): void;
|
|
70
|
+
collapse(): void;
|
|
71
|
+
handleAnimationEnd(event: React.TransitionEvent<HTMLDivElement>): React.TransitionEvent<HTMLDivElement>;
|
|
72
|
+
handleAnimationStart(): undefined;
|
|
73
|
+
};
|
|
74
|
+
}, {
|
|
75
|
+
readonly 'aria-controls': string;
|
|
76
|
+
readonly 'aria-expanded': boolean;
|
|
77
|
+
readonly 'aria-labelledby': string;
|
|
78
|
+
}>;
|
|
79
|
+
export declare const SidePanelToggleButton: import("@workday/canvas-kit-react/common").ElementComponentM<"button", SidePanelToggleButtonProps, {
|
|
80
|
+
state: {
|
|
81
|
+
panelId: string;
|
|
82
|
+
labelId: string;
|
|
83
|
+
transitionState: import("./useSidePanelModel").SidePanelTransitionStates;
|
|
84
|
+
initialTransitionState: import("./useSidePanelModel").SidePanelTransitionStates;
|
|
85
|
+
origin: "end" | "start";
|
|
86
|
+
onStateTransition(state: import("./useSidePanelModel").SidePanelTransitionStates): void;
|
|
87
|
+
};
|
|
88
|
+
events: {
|
|
89
|
+
expand(): void;
|
|
90
|
+
collapse(): void;
|
|
91
|
+
handleAnimationEnd(event: React.TransitionEvent<HTMLDivElement>): React.TransitionEvent<HTMLDivElement>;
|
|
92
|
+
handleAnimationStart(): undefined;
|
|
93
|
+
};
|
|
94
|
+
}>;
|
|
95
|
+
//# sourceMappingURL=SidePanelToggleButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SidePanelToggleButton.d.ts","sourceRoot":"","sources":["../../../../side-panel/lib/SidePanelToggleButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAGL,YAAY,EACb,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,cAAc,EAAC,MAAM,kCAAkC,CAAC;AAEhE,OAAO,EAAU,YAAY,EAAC,MAAM,mCAAmC,CAAC;AAKxE,MAAM,WAAW,0BAA2B,SAAQ,YAAY,CAAC,OAAO,cAAc,CAAC;IACrF;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,YAAY,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;CAC/C;AAED,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA+FvC,CAAC;AAEH,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;EAQ7C,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;EA4CjC,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createElemPropsHook, createSubcomponent, } from '@workday/canvas-kit-react/common';
|
|
3
|
+
import { TertiaryButton } from '@workday/canvas-kit-react/button';
|
|
4
|
+
import { transformationImportIcon } from '@workday/canvas-system-icons-web';
|
|
5
|
+
import { Tooltip } from '@workday/canvas-kit-react/tooltip';
|
|
6
|
+
import { useSidePanelModel } from './useSidePanelModel';
|
|
7
|
+
import { createStencil, handleCsProp } from '@workday/canvas-kit-styling';
|
|
8
|
+
import { system } from '@workday/canvas-tokens-web';
|
|
9
|
+
export const sidePanelToggleButtonStencil = createStencil({
|
|
10
|
+
base: { name: "1etqp8", styles: "box-sizing:border-box;position:absolute;top:var(--cnvs-sys-space-x6);width:var(--cnvs-sys-space-x8);inset-inline-end:var(--cnvs-sys-space-x4);" },
|
|
11
|
+
modifiers: {
|
|
12
|
+
state: {
|
|
13
|
+
collapsing: { name: "30y959", styles: "margin:0;transform:scaleX(1);:dir(rtl){transform:scaleX(-1);}" },
|
|
14
|
+
collapsed: { name: "xhos1", styles: "margin:auto;inset-inline-start:0;inset-inline-end:0;transform:scaleX(1);:dir(rtl){transform:scaleX(-1);}" },
|
|
15
|
+
expanded: { name: "1ksb21", styles: "margin:0;transform:scaleX(-1);:dir(rtl){transform:scaleX(1);}" },
|
|
16
|
+
expanding: { name: "2ew0xk", styles: "margin:0;transform:scaleX(-1);:dir(rtl){transform:scaleX(1);}" }
|
|
17
|
+
},
|
|
18
|
+
origin: {
|
|
19
|
+
start: { name: "3x19g6", styles: "" },
|
|
20
|
+
end: { name: "1x1y4h", styles: "transform:scaleX(1);:dir(rtl){transform:scaleX(-1);}" }
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
compound: [
|
|
24
|
+
{
|
|
25
|
+
modifiers: { state: 'collapsed', origin: 'end' },
|
|
26
|
+
styles: { name: "2lkeu7", styles: "transform:scaleX(-1);:dir(rtl){transform:scaleX(1);}" }
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
modifiers: { state: 'collapsing', origin: 'end' },
|
|
30
|
+
styles: { name: "42drd4", styles: "transform:scaleX(-1);inset-inline-start:var(--cnvs-sys-space-x4);:dir(rtl){transform:scaleX(1);inset-inline-end:var(--cnvs-sys-space-x4);}" }
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
modifiers: { state: 'expanded', origin: 'end' },
|
|
34
|
+
styles: { name: "16e0u", styles: "transform:scaleX(1);inset-inline-start:var(--cnvs-sys-space-x4);:dir(rtl){transform:scaleX(-1);inset-inline-end:var(--cnvs-sys-space-x4);}" }
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
modifiers: { state: 'expanding', origin: 'end' },
|
|
38
|
+
styles: { name: "1qlm4j", styles: "transform:scaleX(1);inset-inline-start:var(--cnvs-sys-space-x4);:dir(rtl){transform:scaleX(-1);inset-inline-end:var(--cnvs-sys-space-x4);}" }
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
}, "side-panel-toggle-button-2c790f");
|
|
42
|
+
export const useSidePanelToggleButtonElemProps = createElemPropsHook(useSidePanelModel)(({ state }) => {
|
|
43
|
+
return {
|
|
44
|
+
'aria-controls': state.panelId,
|
|
45
|
+
'aria-expanded': state.transitionState === 'expanded',
|
|
46
|
+
'aria-labelledby': state.labelId,
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
export const SidePanelToggleButton = createSubcomponent('button')({
|
|
50
|
+
displayName: 'SidePanel.ToggleButton',
|
|
51
|
+
modelHook: useSidePanelModel,
|
|
52
|
+
elemPropsHook: useSidePanelToggleButtonElemProps,
|
|
53
|
+
})(({ variant = undefined, icon = transformationImportIcon, tooltipTextExpand = 'Expand', tooltipTextCollapse = 'Collapse', tooltipProps, ...elemProps }, Element, model) => {
|
|
54
|
+
return (_jsx(Tooltip, { type: "muted", ...tooltipProps, title: model.state.transitionState === 'collapsed' ? tooltipTextExpand : tooltipTextCollapse, children: _jsx(TertiaryButton, { icon: icon, as: Element, variant: variant, ...handleCsProp(elemProps, sidePanelToggleButtonStencil({
|
|
55
|
+
state: model.state.transitionState,
|
|
56
|
+
origin: model.state.origin,
|
|
57
|
+
})), onClick: (event) => {
|
|
58
|
+
var _a;
|
|
59
|
+
(_a = elemProps.onClick) === null || _a === void 0 ? void 0 : _a.call(elemProps, event);
|
|
60
|
+
model.events.handleAnimationStart();
|
|
61
|
+
} }) }));
|
|
62
|
+
});
|