tinywidgets 1.3.5 → 1.3.7
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/package.json
CHANGED
|
@@ -33,11 +33,26 @@ const supportsAnchors = CSS.supports('anchor-name', '--');
|
|
|
33
33
|
* <p>We hope you enjoy TinyWidgets</p>
|
|
34
34
|
* </Flyout>
|
|
35
35
|
* ```
|
|
36
|
-
* This example shows a simple
|
|
36
|
+
* This example shows a flyout from a simple button.
|
|
37
|
+
* @example
|
|
38
|
+
* ```tsx
|
|
39
|
+
* <Flyout
|
|
40
|
+
* title="Toggle"
|
|
41
|
+
* icon={Lucide.LucidePanelTopOpen}
|
|
42
|
+
* openIcon={Lucide.LucidePanelTopClose}
|
|
43
|
+
* startOpen={true}
|
|
44
|
+
* >
|
|
45
|
+
* <p>We hope you enjoy TinyWidgets</p>
|
|
46
|
+
* </Flyout>
|
|
47
|
+
* ```
|
|
48
|
+
* This example shows a flyout, starting off open, with a title on the button,
|
|
49
|
+
* and with a different icon for open and closed states.
|
|
37
50
|
* @icon Lucide.LucideArrowDownSquare
|
|
38
51
|
*/
|
|
39
52
|
export const Flyout = ({
|
|
40
53
|
icon,
|
|
54
|
+
openIcon,
|
|
55
|
+
title,
|
|
41
56
|
variant,
|
|
42
57
|
startOpen,
|
|
43
58
|
id = '',
|
|
@@ -49,6 +64,16 @@ export const Flyout = ({
|
|
|
49
64
|
* className prop.
|
|
50
65
|
*/
|
|
51
66
|
readonly icon: ComponentType<{className?: string}>;
|
|
67
|
+
/**
|
|
68
|
+
* An optional icon to show when the flyout is open, and which must accept a
|
|
69
|
+
* className prop.
|
|
70
|
+
*/
|
|
71
|
+
readonly openIcon?: ComponentType<{className?: string}>;
|
|
72
|
+
/**
|
|
73
|
+
* An optional component, element, or string which renders the title of
|
|
74
|
+
* the button.
|
|
75
|
+
*/
|
|
76
|
+
readonly title?: ComponentType | ReactNode;
|
|
52
77
|
/**
|
|
53
78
|
* A variant of the button used for the flyout, one of:
|
|
54
79
|
* - `default`
|
|
@@ -91,8 +116,9 @@ export const Flyout = ({
|
|
|
91
116
|
const portal = usePortal();
|
|
92
117
|
|
|
93
118
|
const buttonProps = {
|
|
94
|
-
icon: icon,
|
|
95
|
-
|
|
119
|
+
icon: isOpen ? (openIcon ?? icon) : icon,
|
|
120
|
+
title,
|
|
121
|
+
variant,
|
|
96
122
|
onClick: handleClick,
|
|
97
123
|
};
|
|
98
124
|
return supportsAnchors ? (
|
package/src/css/colors.css.ts
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
* - `accentLight`
|
|
17
17
|
* - `accentHover`
|
|
18
18
|
* - `accentContrast`
|
|
19
|
+
* - `accentBright`
|
|
19
20
|
* - `background`
|
|
20
21
|
* - `background2`
|
|
21
22
|
* - `backgroundHaze`
|
|
@@ -71,6 +72,7 @@ export const colors = createThemeContract({
|
|
|
71
72
|
accentLight: null,
|
|
72
73
|
accentHover: null,
|
|
73
74
|
accentContrast: null,
|
|
75
|
+
accentBright: null,
|
|
74
76
|
background: null,
|
|
75
77
|
background2: null,
|
|
76
78
|
backgroundHaze: null,
|
|
@@ -95,6 +97,7 @@ const common = {
|
|
|
95
97
|
accent: `oklch(50% .11 ${colors.accentHue})`,
|
|
96
98
|
accentLight: `oklch(71% .16 ${colors.accentHue})`,
|
|
97
99
|
accentHover: `oklch(45% .1 ${colors.accentHue})`,
|
|
100
|
+
accentBright: `oklch(57.37% 0.2178 ${colors.accentHue})`,
|
|
98
101
|
accentContrast: '#fff',
|
|
99
102
|
};
|
|
100
103
|
|