rsuite 6.0.0-canary-20250620 → 6.0.0-canary-20250622
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/Accordion/styles/index.css +0 -78
- package/AutoComplete/styles/index.css +1 -79
- package/Avatar/styles/index.css +0 -78
- package/AvatarGroup/styles/index.css +0 -78
- package/Badge/styles/index.css +0 -78
- package/Box/styles/index.css +0 -78
- package/Breadcrumb/styles/index.css +0 -78
- package/Button/styles/index.css +0 -78
- package/ButtonGroup/styles/index.css +0 -78
- package/ButtonToolbar/styles/index.css +0 -82
- package/Calendar/styles/index.css +0 -78
- package/Card/styles/index.css +0 -78
- package/CardGroup/styles/index.css +0 -78
- package/Carousel/styles/index.css +0 -78
- package/CascadeTree/styles/index.css +0 -78
- package/Cascader/styles/index.css +1 -79
- package/Center/styles/index.css +0 -78
- package/CheckPicker/styles/index.css +1 -79
- package/CheckTree/styles/index.css +1 -79
- package/CheckTreePicker/styles/index.css +1 -79
- package/Checkbox/styles/index.css +0 -78
- package/CheckboxGroup/styles/index.css +0 -78
- package/Container/styles/index.css +0 -78
- package/Content/styles/index.css +0 -78
- package/DateInput/styles/index.css +0 -78
- package/DatePicker/styles/index.css +1 -79
- package/DateRangeInput/styles/index.css +0 -78
- package/DateRangePicker/styles/index.css +1 -79
- package/Divider/styles/index.css +0 -78
- package/Drawer/styles/index.css +0 -78
- package/Dropdown/styles/index.css +0 -78
- package/FlexboxGrid/styles/index.css +0 -78
- package/Footer/styles/index.css +0 -78
- package/Form/styles/index.css +0 -78
- package/FormControl/styles/index.css +0 -78
- package/FormControlLabel/styles/index.css +0 -78
- package/FormErrorMessage/styles/index.css +0 -78
- package/FormGroup/styles/index.css +0 -78
- package/FormHelpText/styles/index.css +0 -78
- package/FormStack/styles/index.css +0 -78
- package/Grid/styles/index.css +0 -78
- package/Header/styles/index.css +0 -78
- package/Heading/styles/index.css +0 -78
- package/HeadingGroup/styles/index.css +0 -78
- package/Highlight/styles/index.css +0 -78
- package/IconButton/styles/index.css +0 -78
- package/Image/styles/index.css +0 -78
- package/InlineEdit/styles/index.css +0 -78
- package/Input/styles/index.css +0 -78
- package/InputGroup/styles/index.css +1 -79
- package/InputNumber/styles/index.css +1 -79
- package/InputPicker/styles/index.css +1 -79
- package/Kbd/styles/index.css +0 -78
- package/Link/styles/index.css +0 -78
- package/List/styles/index.css +0 -78
- package/Loader/styles/index.css +0 -78
- package/Menu/styles/index.css +0 -78
- package/Message/styles/index.css +0 -78
- package/Modal/styles/index.css +0 -78
- package/MultiCascadeTree/styles/index.css +1 -79
- package/MultiCascader/styles/index.css +1 -79
- package/Nav/styles/index.css +0 -78
- package/Navbar/styles/index.css +0 -78
- package/Notification/styles/index.css +0 -78
- package/NumberInput/styles/index.css +1 -79
- package/Pagination/styles/index.css +1 -79
- package/Panel/styles/index.css +0 -78
- package/PanelGroup/styles/index.css +0 -78
- package/PasswordInput/styles/index.css +1 -79
- package/PasswordStrengthMeter/styles/index.css +0 -78
- package/PinInput/styles/index.css +0 -78
- package/Placeholder/styles/index.css +0 -78
- package/Popover/styles/index.css +0 -78
- package/Progress/styles/index.css +0 -78
- package/ProgressCircle/styles/index.css +0 -78
- package/Radio/styles/index.css +0 -78
- package/RadioGroup/styles/index.css +0 -78
- package/RadioTile/styles/index.css +0 -78
- package/RangeSlider/styles/index.css +0 -78
- package/Rate/styles/index.css +0 -78
- package/SegmentedControl/package.json +7 -0
- package/SegmentedControl/styles/index.css +159 -0
- package/SelectPicker/styles/index.css +1 -79
- package/Sidebar/styles/index.css +0 -78
- package/Sidenav/styles/index.css +0 -78
- package/Slider/styles/index.css +0 -78
- package/Stack/styles/index.css +0 -78
- package/Stat/styles/index.css +0 -78
- package/StatGroup/styles/index.css +0 -78
- package/Steps/styles/index.css +0 -78
- package/Table/styles/index.css +0 -78
- package/Tabs/styles/index.css +0 -78
- package/Tag/styles/index.css +0 -78
- package/TagGroup/styles/index.css +0 -78
- package/TagInput/styles/index.css +1 -79
- package/TagPicker/styles/index.css +1 -79
- package/Text/styles/index.css +0 -78
- package/Textarea/styles/index.css +0 -78
- package/TimePicker/styles/index.css +1 -79
- package/TimeRangePicker/styles/index.css +1 -79
- package/Timeline/styles/index.css +0 -78
- package/Toggle/styles/index.css +0 -78
- package/Tooltip/styles/index.css +0 -78
- package/Tree/styles/index.css +1 -79
- package/TreePicker/styles/index.css +1 -79
- package/Uploader/styles/index.css +0 -78
- package/cjs/ButtonToolbar/ButtonToolbar.js +2 -0
- package/cjs/Grid/utils/styles.d.ts +1 -1
- package/cjs/InputPicker/utils.d.ts +1 -1
- package/cjs/Nav/Nav.d.ts +2 -3
- package/cjs/RadioGroup/RadioGroup.d.ts +4 -1
- package/cjs/SegmentedControl/Indicator.d.ts +10 -0
- package/cjs/SegmentedControl/Indicator.js +22 -0
- package/cjs/SegmentedControl/SegmentedControl.d.ts +27 -0
- package/cjs/SegmentedControl/SegmentedControl.js +87 -0
- package/cjs/SegmentedControl/SegmentedItem.d.ts +16 -0
- package/cjs/SegmentedControl/SegmentedItem.js +44 -0
- package/cjs/SegmentedControl/hooks/useIndicatorPosition.d.ts +17 -0
- package/cjs/SegmentedControl/hooks/useIndicatorPosition.js +55 -0
- package/cjs/SegmentedControl/index.d.ts +4 -0
- package/cjs/SegmentedControl/index.js +11 -0
- package/cjs/Slider/ProgressBar.js +1 -1
- package/cjs/Stack/Stack.js +20 -5
- package/cjs/Stack/utils.d.ts +9 -0
- package/cjs/Stack/utils.js +38 -0
- package/cjs/Tabs/Tabs.d.ts +4 -2
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +6 -0
- package/cjs/internals/Box/Box.d.ts +27 -27
- package/cjs/internals/Box/Box.js +13 -8
- package/cjs/internals/Box/utils.d.ts +4 -1
- package/cjs/internals/Box/utils.js +154 -13
- package/cjs/internals/Provider/types.d.ts +2 -0
- package/cjs/internals/constants/index.js +2 -2
- package/cjs/internals/hooks/useElementResize.d.ts +2 -1
- package/cjs/internals/hooks/useElementResize.js +50 -7
- package/cjs/internals/hooks/useStyled.d.ts +60 -0
- package/cjs/internals/hooks/useStyled.js +257 -0
- package/cjs/internals/utils/colours.js +1 -1
- package/cjs/internals/utils/style-sheet/css.d.ts +1 -1
- package/cjs/internals/utils/style-sheet/css.js +1 -1
- package/cjs/internals/utils/style-sheet/index.d.ts +1 -0
- package/cjs/internals/utils/style-sheet/index.js +6 -0
- package/cjs/internals/utils/style-sheet/style-manager.d.ts +50 -0
- package/cjs/internals/utils/style-sheet/style-manager.js +97 -0
- package/dist/rsuite-no-reset.css +200 -101
- package/dist/rsuite-no-reset.min.css +1 -1
- package/dist/rsuite.css +200 -101
- package/dist/rsuite.js +172 -14
- package/dist/rsuite.js.map +1 -1
- package/dist/rsuite.min.css +1 -1
- package/dist/rsuite.min.js +1 -1
- package/dist/rsuite.min.js.map +1 -1
- package/esm/ButtonToolbar/ButtonToolbar.js +2 -0
- package/esm/Grid/utils/styles.d.ts +1 -1
- package/esm/InputPicker/utils.d.ts +1 -1
- package/esm/Nav/Nav.d.ts +2 -3
- package/esm/RadioGroup/RadioGroup.d.ts +4 -1
- package/esm/SegmentedControl/Indicator.d.ts +10 -0
- package/esm/SegmentedControl/Indicator.js +17 -0
- package/esm/SegmentedControl/SegmentedControl.d.ts +27 -0
- package/esm/SegmentedControl/SegmentedControl.js +81 -0
- package/esm/SegmentedControl/SegmentedItem.d.ts +16 -0
- package/esm/SegmentedControl/SegmentedItem.js +39 -0
- package/esm/SegmentedControl/hooks/useIndicatorPosition.d.ts +17 -0
- package/esm/SegmentedControl/hooks/useIndicatorPosition.js +50 -0
- package/esm/SegmentedControl/index.d.ts +4 -0
- package/esm/SegmentedControl/index.js +8 -0
- package/esm/Slider/ProgressBar.js +1 -1
- package/esm/Stack/Stack.js +21 -6
- package/esm/Stack/utils.d.ts +9 -0
- package/esm/Stack/utils.js +35 -0
- package/esm/Tabs/Tabs.d.ts +4 -2
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/internals/Box/Box.d.ts +27 -27
- package/esm/internals/Box/Box.js +9 -4
- package/esm/internals/Box/utils.d.ts +4 -1
- package/esm/internals/Box/utils.js +153 -13
- package/esm/internals/Provider/types.d.ts +2 -0
- package/esm/internals/constants/index.js +2 -2
- package/esm/internals/hooks/useElementResize.d.ts +2 -1
- package/esm/internals/hooks/useElementResize.js +50 -7
- package/esm/internals/hooks/useStyled.d.ts +60 -0
- package/esm/internals/hooks/useStyled.js +251 -0
- package/esm/internals/utils/colours.js +1 -1
- package/esm/internals/utils/style-sheet/css.d.ts +1 -1
- package/esm/internals/utils/style-sheet/css.js +1 -1
- package/esm/internals/utils/style-sheet/index.d.ts +1 -0
- package/esm/internals/utils/style-sheet/index.js +2 -1
- package/esm/internals/utils/style-sheet/style-manager.d.ts +50 -0
- package/esm/internals/utils/style-sheet/style-manager.js +93 -0
- package/package.json +1 -1
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* StyleManager - A utility for managing CSS styles dynamically
|
|
3
|
+
*
|
|
4
|
+
* This manager creates and maintains a single style element in the document head
|
|
5
|
+
* and provides methods to add, update, and remove CSS rules.
|
|
6
|
+
* Supports CSP nonce for Content Security Policy compliance.
|
|
7
|
+
*/
|
|
8
|
+
export declare const StyleManager: {
|
|
9
|
+
styleElement: HTMLStyleElement | null;
|
|
10
|
+
styleMap: Map<string, string>;
|
|
11
|
+
nonce: string | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Initialize the style element if it doesn't exist
|
|
14
|
+
* @param options - Optional configuration options
|
|
15
|
+
* @param options.nonce - CSP nonce to apply to the style element
|
|
16
|
+
* @returns The style element
|
|
17
|
+
*/
|
|
18
|
+
init(options?: {
|
|
19
|
+
nonce?: string;
|
|
20
|
+
}): HTMLStyleElement | null;
|
|
21
|
+
/**
|
|
22
|
+
* Set the CSP nonce for the style element
|
|
23
|
+
* @param nonce - CSP nonce value
|
|
24
|
+
*/
|
|
25
|
+
setNonce(nonce?: string): void;
|
|
26
|
+
/**
|
|
27
|
+
* Add a CSS rule to the style sheet
|
|
28
|
+
* @param selector - CSS selector
|
|
29
|
+
* @param cssText - CSS properties and values
|
|
30
|
+
* @param options - Optional configuration options
|
|
31
|
+
* @param options.nonce - CSP nonce to apply to the style element
|
|
32
|
+
*/
|
|
33
|
+
addRule(selector: string, cssText: string, options?: {
|
|
34
|
+
nonce?: string;
|
|
35
|
+
}): void;
|
|
36
|
+
/**
|
|
37
|
+
* Remove a CSS rule from the style sheet
|
|
38
|
+
* @param selector - CSS selector to remove
|
|
39
|
+
*/
|
|
40
|
+
removeRule(selector: string): void;
|
|
41
|
+
/**
|
|
42
|
+
* Update the style element with all current rules
|
|
43
|
+
*/
|
|
44
|
+
updateStyles(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Clear all rules from the style sheet
|
|
47
|
+
*/
|
|
48
|
+
clearRules(): void;
|
|
49
|
+
};
|
|
50
|
+
export default StyleManager;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
/**
|
|
3
|
+
* StyleManager - A utility for managing CSS styles dynamically
|
|
4
|
+
*
|
|
5
|
+
* This manager creates and maintains a single style element in the document head
|
|
6
|
+
* and provides methods to add, update, and remove CSS rules.
|
|
7
|
+
* Supports CSP nonce for Content Security Policy compliance.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
// Global style sheet manager
|
|
11
|
+
export const StyleManager = {
|
|
12
|
+
styleElement: null,
|
|
13
|
+
styleMap: new Map(),
|
|
14
|
+
nonce: undefined,
|
|
15
|
+
/**
|
|
16
|
+
* Initialize the style element if it doesn't exist
|
|
17
|
+
* @param options - Optional configuration options
|
|
18
|
+
* @param options.nonce - CSP nonce to apply to the style element
|
|
19
|
+
* @returns The style element
|
|
20
|
+
*/
|
|
21
|
+
init(options) {
|
|
22
|
+
if (!this.styleElement && typeof document !== 'undefined') {
|
|
23
|
+
this.styleElement = document.createElement('style');
|
|
24
|
+
this.styleElement.setAttribute('data-rs-style-manager', '');
|
|
25
|
+
|
|
26
|
+
// Apply CSP nonce if provided
|
|
27
|
+
const nonce = (options === null || options === void 0 ? void 0 : options.nonce) || this.nonce;
|
|
28
|
+
if (nonce) {
|
|
29
|
+
this.styleElement.setAttribute('nonce', nonce);
|
|
30
|
+
this.nonce = nonce; // Store for future use
|
|
31
|
+
}
|
|
32
|
+
document.head.appendChild(this.styleElement);
|
|
33
|
+
}
|
|
34
|
+
return this.styleElement;
|
|
35
|
+
},
|
|
36
|
+
/**
|
|
37
|
+
* Set the CSP nonce for the style element
|
|
38
|
+
* @param nonce - CSP nonce value
|
|
39
|
+
*/
|
|
40
|
+
setNonce(nonce) {
|
|
41
|
+
this.nonce = nonce;
|
|
42
|
+
|
|
43
|
+
// Apply to existing style element if it exists
|
|
44
|
+
if (this.styleElement && nonce) {
|
|
45
|
+
this.styleElement.setAttribute('nonce', nonce);
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
/**
|
|
49
|
+
* Add a CSS rule to the style sheet
|
|
50
|
+
* @param selector - CSS selector
|
|
51
|
+
* @param cssText - CSS properties and values
|
|
52
|
+
* @param options - Optional configuration options
|
|
53
|
+
* @param options.nonce - CSP nonce to apply to the style element
|
|
54
|
+
*/
|
|
55
|
+
addRule(selector, cssText, options) {
|
|
56
|
+
this.init(options);
|
|
57
|
+
if (!this.styleMap.has(selector) || this.styleMap.get(selector) !== cssText) {
|
|
58
|
+
this.styleMap.set(selector, cssText);
|
|
59
|
+
this.updateStyles();
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
/**
|
|
63
|
+
* Remove a CSS rule from the style sheet
|
|
64
|
+
* @param selector - CSS selector to remove
|
|
65
|
+
*/
|
|
66
|
+
removeRule(selector) {
|
|
67
|
+
if (this.styleMap.has(selector)) {
|
|
68
|
+
this.styleMap.delete(selector);
|
|
69
|
+
this.updateStyles();
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
/**
|
|
73
|
+
* Update the style element with all current rules
|
|
74
|
+
*/
|
|
75
|
+
updateStyles() {
|
|
76
|
+
if (!this.styleElement) return;
|
|
77
|
+
let cssText = '';
|
|
78
|
+
this.styleMap.forEach((rules, selector) => {
|
|
79
|
+
cssText += `${selector} { ${rules} }\n`;
|
|
80
|
+
});
|
|
81
|
+
this.styleElement.textContent = cssText;
|
|
82
|
+
},
|
|
83
|
+
/**
|
|
84
|
+
* Clear all rules from the style sheet
|
|
85
|
+
*/
|
|
86
|
+
clearRules() {
|
|
87
|
+
this.styleMap.clear();
|
|
88
|
+
if (this.styleElement) {
|
|
89
|
+
this.styleElement.textContent = '';
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
export default StyleManager;
|