-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathlock-no-override.tsx
More file actions
80 lines (74 loc) · 2.13 KB
/
Copy pathlock-no-override.tsx
File metadata and controls
80 lines (74 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import { Environment } from '@bento/environment';
import { withSlots } from '@bento/slots';
import { useProps } from '@bento/use-props';
import { Button } from '@bento/button';
import { Container } from '@bento/container';
import { RadioGroup, Radio } from '@bento/radio';
/* v8 ignore next */
import React from 'react';
/**
* Interface for component props.
*
* @interface ComponentProps
* @public
*/
interface ComponentProps {
[key: string]: any;
}
/**
* Composite component with internal slots.
*
* @param {ComponentProps} props - The component props.
* @returns {JSX.Element} The rendered composed component.
* @public
*/
const Composed = withSlots('LockNoOverride.Composed', function ComposedComponent(props: ComponentProps) {
const slots = {
'group.label': { className: 'label' },
'group.description': { className: 'describe' }
};
return (
<Container slot="root">
<Button slot="trigger">Press Me</Button>
<RadioGroup id="fruit-group" slots={slots} label="Favorite fruit" description="Pick your favorite">
<Radio value="apple">Apple</Radio>
<Radio value="banana">Banana</Radio>
<Radio value="orange">Orange</Radio>
</RadioGroup>
</Container>
);
});
/**
* Design system component with lock boundary.
*
* @param {ComponentProps} props - The component props.
* @returns {JSX.Element} The rendered design system component.
* @public
*/
export const DesignSystemVersion = withSlots(
'LockNoOverride.DSVersion',
function DSVersionComponent(props: ComponentProps) {
const { props: p } = useProps(props);
const slots = {
'root.trigger': {
children: 'Click Me'
}
};
return (
<Environment lock={true}>
<Composed slot="composed" slots={slots} {...p} />
</Environment>
);
}
);
/**
* Example demonstrating lock with NO consumer overrides.
* Expected: NO data-override attributes anywhere.
* All slots (trigger, label, description) are internal composition.
*
* @returns {JSX.Element} The rendered example.
* @public
*/
export const LockNoOverride: React.FC = function LockNoOverride() {
return <DesignSystemVersion />;
};