@fpkit/acss 6.1.0 → 6.3.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/libs/chunk-25KCUE3R.cjs +17 -0
- package/libs/chunk-25KCUE3R.cjs.map +1 -0
- package/libs/chunk-34NWHFHP.js +10 -0
- package/libs/chunk-34NWHFHP.js.map +1 -0
- package/libs/{chunk-SQ44OCJ2.js → chunk-6NMLU5FA.js} +2 -2
- package/libs/{chunk-GVVCXXKI.cjs → chunk-6YVR4TDM.cjs} +3 -3
- package/libs/chunk-DSQ2TUCR.js +7 -0
- package/libs/chunk-DSQ2TUCR.js.map +1 -0
- package/libs/{chunk-H6A2CUWA.js → chunk-VQTCTLFN.js} +2 -2
- package/libs/chunk-ZJ4RUKI2.cjs +14 -0
- package/libs/chunk-ZJ4RUKI2.cjs.map +1 -0
- package/libs/{chunk-H4JRUNKU.cjs → chunk-ZOPHCNFD.cjs} +3 -3
- package/libs/components/button.cjs +3 -3
- package/libs/components/button.d.cts +34 -1
- package/libs/components/button.d.ts +34 -1
- package/libs/components/button.js +1 -1
- package/libs/components/buttons/button.css +1 -1
- package/libs/components/buttons/button.css.map +1 -1
- package/libs/components/buttons/button.min.css +2 -2
- package/libs/components/buttons/icon-button.css +1 -0
- package/libs/components/buttons/icon-button.css.map +1 -0
- package/libs/components/buttons/icon-button.min.css +3 -0
- package/libs/components/dialog/dialog.cjs +4 -4
- package/libs/components/dialog/dialog.js +2 -2
- package/libs/components/icons/icon.d.cts +1 -1
- package/libs/components/icons/icon.d.ts +1 -1
- package/libs/components/layout/landmarks.css +1 -1
- package/libs/components/layout/landmarks.css.map +1 -1
- package/libs/components/layout/landmarks.min.css +2 -2
- package/libs/components/link/link.css +1 -1
- package/libs/components/link/link.min.css +1 -1
- package/libs/components/modal.cjs +3 -3
- package/libs/components/modal.js +2 -2
- package/libs/components/popover/popover.cjs +3 -8
- package/libs/components/popover/popover.css +1 -0
- package/libs/components/popover/popover.css.map +1 -0
- package/libs/components/popover/popover.d.cts +54 -26
- package/libs/components/popover/popover.d.ts +54 -26
- package/libs/components/popover/popover.js +1 -2
- package/libs/components/popover/popover.min.css +3 -0
- package/libs/hooks.cjs +3 -6
- package/libs/hooks.cjs.map +1 -1
- package/libs/hooks.d.cts +30 -10
- package/libs/hooks.d.ts +30 -10
- package/libs/hooks.js +5 -1
- package/libs/hooks.js.map +1 -1
- package/libs/{icons-48788561.d.ts → icons-2c09535c.d.ts} +32 -32
- package/libs/icons.d.cts +1 -1
- package/libs/icons.d.ts +1 -1
- package/libs/index.cjs +41 -40
- package/libs/index.cjs.map +1 -1
- package/libs/index.css +1 -1
- package/libs/index.css.map +1 -1
- package/libs/index.d.cts +101 -5
- package/libs/index.d.ts +101 -5
- package/libs/index.js +14 -15
- package/libs/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/buttons/README.mdx +107 -11
- package/src/components/buttons/STYLES.mdx +182 -47
- package/src/components/buttons/button.scss +93 -16
- package/src/components/buttons/button.stories.tsx +149 -0
- package/src/components/buttons/button.test.tsx +12 -0
- package/src/components/buttons/button.tsx +50 -6
- package/src/components/buttons/icon-button.scss +45 -0
- package/src/components/buttons/icon-button.stories.tsx +200 -0
- package/src/components/buttons/icon-button.test.tsx +132 -0
- package/src/components/buttons/icon-button.tsx +72 -0
- package/src/components/form/select.tsx +55 -51
- package/src/components/layout/README.mdx +1117 -0
- package/src/components/layout/STYLES.mdx +159 -4
- package/src/components/layout/fieldset.stories.tsx +387 -0
- package/src/components/layout/landmarks.scss +115 -2
- package/src/components/layout/landmarks.stories.tsx +2 -6
- package/src/components/layout/landmarks.tsx +96 -27
- package/src/components/link/link.scss +2 -2
- package/src/components/popover/README.mdx +478 -0
- package/src/components/popover/STYLES.mdx +389 -0
- package/src/components/popover/index.ts +3 -0
- package/src/components/popover/popover.scss +249 -0
- package/src/components/popover/popover.stories.tsx +315 -15
- package/src/components/popover/popover.test.tsx +249 -37
- package/src/components/popover/popover.tsx +165 -62
- package/src/hooks/popover/popover.tsx +26 -10
- package/src/hooks/popover/use-popover.tsx +30 -10
- package/src/hooks.ts +5 -0
- package/src/index.scss +1 -0
- package/src/index.ts +1 -0
- package/src/styles/buttons/button.css +78 -16
- package/src/styles/buttons/button.css.map +1 -1
- package/src/styles/buttons/icon-button.css +32 -0
- package/src/styles/buttons/icon-button.css.map +1 -0
- package/src/styles/index.css +350 -18
- package/src/styles/index.css.map +1 -1
- package/src/styles/layout/landmarks.css +83 -0
- package/src/styles/layout/landmarks.css.map +1 -1
- package/src/styles/link/link.css +2 -2
- package/src/styles/popover/popover.css +190 -0
- package/src/styles/popover/popover.css.map +1 -0
- package/src/types/popover.d.ts +64 -0
- package/libs/chunk-4I5MF54P.js +0 -8
- package/libs/chunk-4I5MF54P.js.map +0 -1
- package/libs/chunk-GCGKYLDG.js +0 -7
- package/libs/chunk-GCGKYLDG.js.map +0 -1
- package/libs/chunk-NZVSXRTB.cjs +0 -16
- package/libs/chunk-NZVSXRTB.cjs.map +0 -1
- package/libs/chunk-PDD4N5P5.cjs +0 -10
- package/libs/chunk-PDD4N5P5.cjs.map +0 -1
- package/libs/chunk-S7NIA6PI.cjs +0 -17
- package/libs/chunk-S7NIA6PI.cjs.map +0 -1
- package/libs/chunk-X2RDXWH5.js +0 -10
- package/libs/chunk-X2RDXWH5.js.map +0 -1
- /package/libs/{chunk-SQ44OCJ2.js.map → chunk-6NMLU5FA.js.map} +0 -0
- /package/libs/{chunk-GVVCXXKI.cjs.map → chunk-6YVR4TDM.cjs.map} +0 -0
- /package/libs/{chunk-H6A2CUWA.js.map → chunk-VQTCTLFN.js.map} +0 -0
- /package/libs/{chunk-H4JRUNKU.cjs.map → chunk-ZOPHCNFD.cjs.map} +0 -0
|
@@ -1,85 +1,188 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import
|
|
1
|
+
import React, { useEffect, useId, useRef } from 'react';
|
|
2
|
+
import type {} from '../../types/popover';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* @property {ReactNode} children - The content to show in the popover
|
|
8
|
-
* @property {ReactNode} [content] - Optional alternative content for popover
|
|
5
|
+
* Props for the Popover component using native HTML popover API
|
|
9
6
|
*/
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
export interface PopoverProps {
|
|
8
|
+
/** Unique ID for popover (required for popovertarget attribute) */
|
|
9
|
+
id?: string;
|
|
10
|
+
/** Content to display inside the popover */
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
/** Custom trigger element (default: button with triggerLabel) */
|
|
13
|
+
trigger?: React.ReactNode;
|
|
14
|
+
/** Aria-label for default trigger button */
|
|
15
|
+
triggerLabel?: string;
|
|
16
|
+
/** Popover mode: "auto" (light dismiss) or "manual" (explicit close) */
|
|
17
|
+
mode?: 'auto' | 'manual';
|
|
18
|
+
/** Preferred placement position relative to trigger */
|
|
19
|
+
placement?: 'top' | 'bottom' | 'left' | 'right';
|
|
20
|
+
/** Controlled open state (optional) */
|
|
21
|
+
isOpen?: boolean;
|
|
22
|
+
/** Callback when popover toggles open/closed */
|
|
23
|
+
onToggle?: (open: boolean) => void;
|
|
24
|
+
/** Show close button (default: true for manual mode, false for auto) */
|
|
25
|
+
showCloseButton?: boolean;
|
|
26
|
+
/** Aria-label for close button */
|
|
27
|
+
closeButtonLabel?: string;
|
|
28
|
+
/** Show positioning arrow */
|
|
29
|
+
showArrow?: boolean;
|
|
30
|
+
/** Custom CSS class for popover element */
|
|
31
|
+
className?: string;
|
|
32
|
+
/** Inline CSS variables for theming */
|
|
33
|
+
styles?: React.CSSProperties;
|
|
14
34
|
}
|
|
15
35
|
|
|
16
|
-
export const defaultStyles = {
|
|
17
|
-
display: 'block',
|
|
18
|
-
position: 'absolute',
|
|
19
|
-
background: '#000',
|
|
20
|
-
border: '1px solid #010101',
|
|
21
|
-
padding: '10px',
|
|
22
|
-
color: '#fff',
|
|
23
|
-
transition: 'opacity .5s ease-in-out',
|
|
24
|
-
} as React.CSSProperties
|
|
25
|
-
|
|
26
36
|
/**
|
|
27
|
-
* Popover component
|
|
28
|
-
*
|
|
29
|
-
* @param props - The props for the component
|
|
30
|
-
* @param props.children - The content to show in the popover
|
|
31
|
-
* @param props.popoverTrigger - The element that triggers the popover on hover
|
|
37
|
+
* Popover component using native HTML popover API
|
|
32
38
|
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
39
|
+
* Provides automatic top-layer rendering, light dismiss behavior,
|
|
40
|
+
* and accessibility features built into the platform.
|
|
35
41
|
*
|
|
36
|
-
*
|
|
42
|
+
* **Browser Requirements:**
|
|
43
|
+
* - Chrome 125+, Edge 125+, Safari 17.4+
|
|
44
|
+
* - Requires CSS anchor positioning support for optimal placement
|
|
37
45
|
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```tsx
|
|
48
|
+
* <Popover id="my-popover" triggerLabel="Open Menu">
|
|
49
|
+
* <p>Popover content here</p>
|
|
50
|
+
* </Popover>
|
|
51
|
+
* ```
|
|
40
52
|
*
|
|
41
|
-
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```tsx
|
|
55
|
+
* <Popover
|
|
56
|
+
* id="custom-popover"
|
|
57
|
+
* mode="manual"
|
|
58
|
+
* placement="top"
|
|
59
|
+
* trigger={<button>Custom Trigger</button>}
|
|
60
|
+
* >
|
|
61
|
+
* <h3>Popover Title</h3>
|
|
62
|
+
* <p>This requires explicit close action.</p>
|
|
63
|
+
* </Popover>
|
|
64
|
+
* ```
|
|
42
65
|
*
|
|
43
|
-
*
|
|
66
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/popover
|
|
44
67
|
*/
|
|
45
|
-
|
|
46
|
-
|
|
68
|
+
export const Popover: React.FC<PopoverProps> = ({
|
|
69
|
+
id,
|
|
47
70
|
children,
|
|
48
|
-
|
|
71
|
+
trigger,
|
|
72
|
+
triggerLabel = 'Open',
|
|
73
|
+
mode = 'auto',
|
|
74
|
+
placement = 'bottom',
|
|
75
|
+
isOpen,
|
|
76
|
+
onToggle,
|
|
77
|
+
showCloseButton,
|
|
78
|
+
showArrow = true,
|
|
79
|
+
closeButtonLabel = 'Close',
|
|
80
|
+
className = '',
|
|
49
81
|
styles,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
82
|
+
}) => {
|
|
83
|
+
const generatedId = useId();
|
|
84
|
+
const popoverId = id || generatedId;
|
|
85
|
+
const popoverRef = useRef<HTMLDivElement>(null);
|
|
86
|
+
|
|
87
|
+
// Default showCloseButton based on mode
|
|
88
|
+
const shouldShowCloseButton =
|
|
89
|
+
showCloseButton !== undefined ? showCloseButton : mode === 'manual';
|
|
90
|
+
|
|
91
|
+
// Handle controlled state
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
const popover = popoverRef.current;
|
|
94
|
+
if (!popover) return;
|
|
95
|
+
|
|
96
|
+
if (isOpen !== undefined) {
|
|
97
|
+
try {
|
|
98
|
+
// Try to check if popover is open using :popover-open pseudo-class
|
|
99
|
+
// Fall back to checking data attribute for testing environments
|
|
100
|
+
const isCurrentlyOpen =
|
|
101
|
+
popover.matches(':popover-open') || popover.hasAttribute('data-popover-open');
|
|
102
|
+
|
|
103
|
+
if (isOpen && !isCurrentlyOpen) {
|
|
104
|
+
popover.showPopover();
|
|
105
|
+
} else if (!isOpen && isCurrentlyOpen) {
|
|
106
|
+
popover.hidePopover();
|
|
107
|
+
}
|
|
108
|
+
} catch {
|
|
109
|
+
// In environments without popover support, check data attribute
|
|
110
|
+
const isCurrentlyOpen = popover.hasAttribute('data-popover-open');
|
|
111
|
+
if (isOpen && !isCurrentlyOpen) {
|
|
112
|
+
popover.showPopover();
|
|
113
|
+
} else if (!isOpen && isCurrentlyOpen) {
|
|
114
|
+
popover.hidePopover();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}, [isOpen]);
|
|
119
|
+
|
|
120
|
+
// Listen to toggle events
|
|
121
|
+
useEffect(() => {
|
|
122
|
+
const popover = popoverRef.current;
|
|
123
|
+
if (!popover || !onToggle) return;
|
|
124
|
+
|
|
125
|
+
const handleToggle = (event: Event) => {
|
|
126
|
+
const toggleEvent = event as ToggleEvent;
|
|
127
|
+
onToggle(toggleEvent.newState === 'open');
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
popover.addEventListener('toggle', handleToggle);
|
|
131
|
+
return () => popover.removeEventListener('toggle', handleToggle);
|
|
132
|
+
}, [onToggle]);
|
|
133
|
+
|
|
134
|
+
// Custom trigger with popovertarget attribute
|
|
135
|
+
const renderTrigger = () => {
|
|
136
|
+
if (trigger) {
|
|
137
|
+
return React.cloneElement(trigger as React.ReactElement, {
|
|
138
|
+
popovertarget: popoverId,
|
|
139
|
+
popovertargetaction: 'toggle',
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return (
|
|
144
|
+
<button
|
|
145
|
+
type="button"
|
|
146
|
+
popovertarget={popoverId}
|
|
147
|
+
popovertargetaction="toggle"
|
|
148
|
+
aria-label={triggerLabel}
|
|
149
|
+
className="fpkit-popover-trigger"
|
|
150
|
+
>
|
|
151
|
+
{triggerLabel}
|
|
152
|
+
</button>
|
|
153
|
+
);
|
|
154
|
+
};
|
|
63
155
|
|
|
64
156
|
return (
|
|
65
157
|
<>
|
|
158
|
+
{renderTrigger()}
|
|
66
159
|
<div
|
|
67
|
-
ref={
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
{
|
|
160
|
+
ref={popoverRef}
|
|
161
|
+
id={popoverId}
|
|
162
|
+
popover={mode}
|
|
163
|
+
className={`fpkit-popover ${className}`.trim()}
|
|
164
|
+
data-placement={placement}
|
|
165
|
+
style={styles}
|
|
71
166
|
>
|
|
72
|
-
{
|
|
73
|
-
|
|
74
|
-
{isVisible && (
|
|
75
|
-
<div ref={popOverRef} style={{ ...popoverStyles, ...styles }}>
|
|
167
|
+
{showArrow && <div className="fpkit-popover-arrow" data-placement={placement} />}
|
|
168
|
+
<div className="fpkit-popover-content">
|
|
76
169
|
{children}
|
|
170
|
+
{shouldShowCloseButton && (
|
|
171
|
+
<button
|
|
172
|
+
type="button"
|
|
173
|
+
popovertarget={popoverId}
|
|
174
|
+
popovertargetaction="hide"
|
|
175
|
+
aria-label={closeButtonLabel}
|
|
176
|
+
className="fpkit-popover-close"
|
|
177
|
+
>
|
|
178
|
+
✕
|
|
179
|
+
</button>
|
|
180
|
+
)}
|
|
77
181
|
</div>
|
|
78
|
-
|
|
182
|
+
</div>
|
|
79
183
|
</>
|
|
80
|
-
)
|
|
81
|
-
}
|
|
184
|
+
);
|
|
185
|
+
};
|
|
82
186
|
|
|
83
|
-
export default Popover
|
|
84
|
-
Popover.displayName = 'Popover'
|
|
85
|
-
Popover.styles = defaultStyles
|
|
187
|
+
export default Popover;
|
|
188
|
+
Popover.displayName = 'Popover';
|
|
@@ -2,7 +2,12 @@ import React from 'react'
|
|
|
2
2
|
import usePopover from './use-popover'
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* @deprecated This component is deprecated and will be removed in v3.0.0.
|
|
6
|
+
* Use the new native Popover component from `@fpkit/acss` instead.
|
|
7
|
+
*
|
|
8
|
+
* @see {@link ../components/popover/popover.tsx} New Popover Component
|
|
9
|
+
*
|
|
10
|
+
* Interface for props accepted by the legacy Popover component
|
|
6
11
|
*
|
|
7
12
|
* @property {ReactNode} children - The content to show in the popover
|
|
8
13
|
* @property {ReactNode} [content] - Optional alternative content for popover
|
|
@@ -13,20 +18,31 @@ export type PopoverProps = {
|
|
|
13
18
|
}
|
|
14
19
|
|
|
15
20
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* @returns {JSX.Element} - The JSX element for the Popover component.
|
|
21
|
+
* @deprecated This component is deprecated and will be removed in v3.0.0.
|
|
22
|
+
* Use the new Popover component which provides native HTML Popover API support,
|
|
23
|
+
* better accessibility, automatic layer management, and platform-native behavior.
|
|
20
24
|
*
|
|
21
|
-
*
|
|
25
|
+
* **Migration Guide:**
|
|
26
|
+
* ```tsx
|
|
27
|
+
* // ❌ Old (deprecated)
|
|
28
|
+
* import { Popover } from '@fpkit/acss/hooks';
|
|
29
|
+
* <Popover>{children}</Popover>
|
|
22
30
|
*
|
|
23
|
-
*
|
|
31
|
+
* // ✅ New (recommended)
|
|
32
|
+
* import { Popover } from '@fpkit/acss';
|
|
33
|
+
* <Popover id="my-popover" triggerLabel="Open">{children}</Popover>
|
|
34
|
+
* ```
|
|
24
35
|
*
|
|
25
|
-
*
|
|
36
|
+
* @see {@link ../components/popover/popover.tsx} New Popover Component
|
|
37
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/popover} HTML Popover API
|
|
26
38
|
*
|
|
27
|
-
*
|
|
39
|
+
* Legacy popover component using custom positioning logic.
|
|
40
|
+
* Uses the usePopover hook to handle visibility and positioning.
|
|
41
|
+
* Shows popover on hover using pointer events.
|
|
42
|
+
* Renders absolutely positioned content when visible.
|
|
28
43
|
*
|
|
29
|
-
*
|
|
44
|
+
* @param {Object} props - The props for the component
|
|
45
|
+
* @returns {JSX.Element} The JSX element for the legacy Popover component
|
|
30
46
|
*/
|
|
31
47
|
export const Popover = ({ children }: PopoverProps) => {
|
|
32
48
|
const hoverRef = React.useRef(null)
|
|
@@ -14,16 +14,36 @@ type Position = {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* @
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* @
|
|
22
|
-
* @
|
|
23
|
-
*
|
|
24
|
-
* @
|
|
25
|
-
*
|
|
26
|
-
*
|
|
17
|
+
* @deprecated This hook is deprecated and will be removed in v3.0.0.
|
|
18
|
+
* Use the native Popover component instead, which provides better accessibility,
|
|
19
|
+
* automatic layer management, and platform-native behavior.
|
|
20
|
+
*
|
|
21
|
+
* @see {@link ../components/popover/popover.tsx} New Popover Component
|
|
22
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/popover} HTML Popover API
|
|
23
|
+
*
|
|
24
|
+
* @description Legacy hook for custom popover positioning with pointer events.
|
|
25
|
+
* Manually calculates popover position and handles show/hide logic.
|
|
26
|
+
*
|
|
27
|
+
* @param elementRef - Ref of the trigger element
|
|
28
|
+
* @param hoverRef - Ref of the popover element
|
|
29
|
+
* @param spacing - Spacing between trigger and popover (in pixels)
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* // ❌ Old approach (deprecated)
|
|
34
|
+
* const { isVisible, popoverPosition, handlePointerEvent, handlePointerLeave } =
|
|
35
|
+
* usePopover(hoverRef, popOverRef, 1);
|
|
36
|
+
*
|
|
37
|
+
* // ✅ New approach (recommended)
|
|
38
|
+
* import { Popover } from '@fpkit/acss';
|
|
39
|
+
* <Popover id="my-popover" triggerLabel="Open">Content</Popover>
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @returns Hook state and handlers
|
|
43
|
+
* @returns isVisible - Boolean indicating popover visibility
|
|
44
|
+
* @returns popoverPosition - Position object with top/left coordinates
|
|
45
|
+
* @returns handlePointerEvent - Function to show popover on pointer enter
|
|
46
|
+
* @returns handlePointerLeave - Function to hide popover on pointer leave
|
|
27
47
|
*/
|
|
28
48
|
export const usePopover = (
|
|
29
49
|
elementRef: React.RefObject<HTMLElement | HTMLDivElement>,
|
package/src/hooks.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated usePopover hook is deprecated and will be removed in v3.0.0.
|
|
3
|
+
* Use the native Popover component from '@fpkit/acss' instead.
|
|
4
|
+
* @see {@link ./components/popover/popover} Popover Component
|
|
5
|
+
*/
|
|
1
6
|
export { usePopover } from './hooks/popover/use-popover'
|
|
2
7
|
export { useBreadcrumbSegments } from './components/breadcrumbs/breadcrumb'
|
|
3
8
|
export { useDisabledState } from './hooks/use-disabled-state'
|
package/src/index.scss
CHANGED
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
@use "./components/cluster/cluster.scss";
|
|
33
33
|
@use "./components/grid/grid.scss";
|
|
34
34
|
@use "./components/dialog/dialog.scss";
|
|
35
|
+
@use "./components/popover/popover.scss";
|
|
35
36
|
@use "./sass/_grid.scss" as grid-legacy;
|
|
36
37
|
@use "./sass/_columns.scss";
|
|
37
38
|
@use "./components/badge/badge.scss";
|
package/src/index.ts
CHANGED
|
@@ -3,10 +3,13 @@ button {
|
|
|
3
3
|
--btn-size-sm: 0.8125rem;
|
|
4
4
|
--btn-size-md: 0.9375rem;
|
|
5
5
|
--btn-size-lg: 1.125rem;
|
|
6
|
-
--btn-
|
|
6
|
+
--btn-size-xl: 1.375rem;
|
|
7
|
+
--btn-size-2xl: 1.75rem;
|
|
8
|
+
--btn-pill: 100vw;
|
|
7
9
|
--btn-fs: var(--btn-size-md);
|
|
8
|
-
--btn-height: calc(var(--btn-fs) * 2.
|
|
9
|
-
--btn-bg: var(--color-
|
|
10
|
+
--btn-height: calc(var(--btn-fs) * 2.75);
|
|
11
|
+
--btn-bg: var(--color-primary);
|
|
12
|
+
--btn-color: var(--color-text-inverse);
|
|
10
13
|
--btn-width: max-content;
|
|
11
14
|
font-size: var(--btn-fs);
|
|
12
15
|
font-weight: var(--btn-fw, 500);
|
|
@@ -31,7 +34,7 @@ button {
|
|
|
31
34
|
line-height: 0cap;
|
|
32
35
|
}
|
|
33
36
|
button[type] {
|
|
34
|
-
background-color: var(--btn-bg, var(--color-
|
|
37
|
+
background-color: var(--btn-bg, var(--color-primary));
|
|
35
38
|
--btn-border: solid var(--btn-sg);
|
|
36
39
|
}
|
|
37
40
|
button[type=submit], button[style*=submit] {
|
|
@@ -69,8 +72,65 @@ button[type=submit] {
|
|
|
69
72
|
--btn-color: var(--color-text-inverse);
|
|
70
73
|
--btn-border: none;
|
|
71
74
|
}
|
|
72
|
-
button[data-fp-btn~=pill], button[data-btn~=pill], button[data-style~=pill] {
|
|
73
|
-
border-radius: var(--btn-pill,
|
|
75
|
+
button[data-fp-btn~=pill], button[data-btn~=pill], button[data-style~=pill], button.btn-pill {
|
|
76
|
+
border-radius: var(--btn-pill, 100vw);
|
|
77
|
+
}
|
|
78
|
+
button[data-color=primary] {
|
|
79
|
+
--btn-bg: var(--color-primary);
|
|
80
|
+
--btn-color: var(--color-text-inverse);
|
|
81
|
+
}
|
|
82
|
+
button[data-color=secondary] {
|
|
83
|
+
--btn-bg: var(--color-secondary);
|
|
84
|
+
--btn-color: var(--color-text-inverse);
|
|
85
|
+
}
|
|
86
|
+
button[data-color=danger] {
|
|
87
|
+
--btn-bg: var(--color-error);
|
|
88
|
+
--btn-color: var(--color-text-inverse);
|
|
89
|
+
}
|
|
90
|
+
button[data-color=success] {
|
|
91
|
+
--btn-bg: var(--color-success);
|
|
92
|
+
--btn-color: var(--color-text-inverse);
|
|
93
|
+
}
|
|
94
|
+
button[data-color=warning] {
|
|
95
|
+
--btn-bg: var(--color-warning);
|
|
96
|
+
--btn-color: var(--color-text-inverse);
|
|
97
|
+
}
|
|
98
|
+
button[data-style~=outline] {
|
|
99
|
+
--btn-bg: transparent;
|
|
100
|
+
--btn-color: currentColor;
|
|
101
|
+
--btn-border: 0.125rem solid currentColor;
|
|
102
|
+
}
|
|
103
|
+
button[data-style~=outline]:is(:hover, :focus) {
|
|
104
|
+
background-color: color-mix(in srgb, currentColor 10%, transparent);
|
|
105
|
+
filter: none;
|
|
106
|
+
outline: 0.025rem solid currentColor;
|
|
107
|
+
outline-offset: 0;
|
|
108
|
+
}
|
|
109
|
+
button[data-style~=text] {
|
|
110
|
+
--btn-bg: transparent;
|
|
111
|
+
--btn-color: currentColor;
|
|
112
|
+
--btn-border: none;
|
|
113
|
+
--btn-height: unset;
|
|
114
|
+
--btn-width: unset;
|
|
115
|
+
--btn-padding-block: 0.75rem;
|
|
116
|
+
--btn-padding-inline: 0.75rem;
|
|
117
|
+
}
|
|
118
|
+
button[data-style~=text]:is(:hover, :focus) {
|
|
119
|
+
background-color: color-mix(in srgb, var(--btn-color) 10%, transparent);
|
|
120
|
+
outline: 0.025rem solid var(--btn-color);
|
|
121
|
+
outline-offset: 0;
|
|
122
|
+
filter: none;
|
|
123
|
+
}
|
|
124
|
+
button[data-style~=icon] {
|
|
125
|
+
padding: unset;
|
|
126
|
+
height: unset;
|
|
127
|
+
--btn-bg: transparent;
|
|
128
|
+
min-width: 1.5rem;
|
|
129
|
+
min-height: 1.5rem;
|
|
130
|
+
text-align: center;
|
|
131
|
+
display: inline-flex;
|
|
132
|
+
align-items: center;
|
|
133
|
+
justify-content: center;
|
|
74
134
|
}
|
|
75
135
|
button[data-btn~=xs],
|
|
76
136
|
button .btn-xs {
|
|
@@ -89,16 +149,18 @@ button[data-btn~=lg],
|
|
|
89
149
|
button .btn-lg {
|
|
90
150
|
--btn-fs: var(--btn-size-lg);
|
|
91
151
|
}
|
|
92
|
-
button[data-btn~=
|
|
93
|
-
button .btn-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
152
|
+
button[data-btn~=xl],
|
|
153
|
+
button .btn-xl {
|
|
154
|
+
--btn-fs: var(--btn-size-xl);
|
|
155
|
+
}
|
|
156
|
+
button[data-btn~="2xl"],
|
|
157
|
+
button .btn-2xl {
|
|
158
|
+
--btn-fs: var(--btn-size-2xl);
|
|
159
|
+
}
|
|
160
|
+
button[data-btn~=block],
|
|
161
|
+
button .btn-block {
|
|
162
|
+
--btn-width: 100%;
|
|
163
|
+
display: flex;
|
|
102
164
|
justify-content: center;
|
|
103
165
|
}
|
|
104
166
|
button[data-btn~=text],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sourceRoot":"","sources":["../../components/buttons/button.scss"],"names":[],"mappings":"AAAA;EAEE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAIA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;;AAGF;EAEE;EACA;;AAGF;EAEE;;AAGA;EACE;;AAOJ;EAEE;EACA;EACA;EACA;;AAGA;EACE;EACA;EACA;;AAIJ;EACE;EACA;;AAGF;EACE;EACA;EACA;;AAGF;EACE;EACA;EACA;;AAGF;
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["../../components/buttons/button.scss"],"names":[],"mappings":"AAAA;EAEE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAIA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;;AAGF;EAEE;EACA;;AAGF;EAEE;;AAGA;EACE;;AAOJ;EAEE;EACA;EACA;EACA;;AAGA;EACE;EACA;EACA;;AAIJ;EACE;EACA;;AAGF;EACE;EACA;EACA;;AAGF;EACE;EACA;EACA;;AAGF;EAIE;;AAIF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAIF;EACE;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;EACA;EACA;EACA;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;AAAA;EAEE;EACA;;AAGF;AAAA;EAEE;;AAGF;AAAA;EAEE;;AAGF;AAAA;EAEE;;AAGF;AAAA;EAEE;;AAGF;AAAA;EAEE;;AAGF;AAAA;EAEE;EACA;EACA;;AAGF;AAAA;EAEE;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;AAAA;EACE;EACA;EACA;EACA","file":"button.css"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
button[data-icon-btn],
|
|
2
|
+
.icon-btn {
|
|
3
|
+
--btn-color: currentColor;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
button[data-icon-btn~=has-label],
|
|
7
|
+
.icon-btn[data-icon-btn~=has-label] {
|
|
8
|
+
gap: 0.375rem;
|
|
9
|
+
padding-inline: 0.75rem;
|
|
10
|
+
}
|
|
11
|
+
button[data-icon-btn~=has-label] [data-icon-label],
|
|
12
|
+
.icon-btn[data-icon-btn~=has-label] [data-icon-label] {
|
|
13
|
+
font-size: var(--btn-fs, 0.875rem);
|
|
14
|
+
line-height: 1;
|
|
15
|
+
white-space: nowrap;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@media (max-width: 48rem) {
|
|
19
|
+
[data-icon-label] {
|
|
20
|
+
position: absolute;
|
|
21
|
+
width: 1px;
|
|
22
|
+
height: 1px;
|
|
23
|
+
padding: 0;
|
|
24
|
+
margin: -1px;
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
clip: rect(0, 0, 0, 0);
|
|
27
|
+
white-space: nowrap;
|
|
28
|
+
border: 0;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/*# sourceMappingURL=icon-button.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["../../components/buttons/icon-button.scss"],"names":[],"mappings":"AASA;AAAA;EAEE;;;AAMF;AAAA;EAEE;EACA;;AAEA;AAAA;EACE;EACA;EACA;;;AAOJ;EACE;IACE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA","file":"icon-button.css"}
|