@mongodb-js/compass-components 1.4.0 → 1.6.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/lib/components/accordion.d.ts +1 -2
- package/lib/components/accordion.d.ts.map +1 -1
- package/lib/components/accordion.js +3 -3
- package/lib/components/accordion.js.map +1 -1
- package/lib/components/bson-value.d.ts.map +1 -1
- package/lib/components/bson-value.js +3 -3
- package/lib/components/bson-value.js.map +1 -1
- package/lib/components/cancel-loader.d.ts.map +1 -1
- package/lib/components/cancel-loader.js +6 -1
- package/lib/components/cancel-loader.js.map +1 -1
- package/lib/components/collapsible-field-set.d.ts +3 -2
- package/lib/components/collapsible-field-set.d.ts.map +1 -1
- package/lib/components/collapsible-field-set.js +6 -5
- package/lib/components/collapsible-field-set.js.map +1 -1
- package/lib/components/combobox/Chip.d.ts +4 -0
- package/lib/components/combobox/Chip.d.ts.map +1 -0
- package/lib/components/combobox/Chip.js +229 -0
- package/lib/components/combobox/Chip.js.map +1 -0
- package/lib/components/combobox/Combobox.d.ts +39 -0
- package/lib/components/combobox/Combobox.d.ts.map +1 -0
- package/lib/components/combobox/Combobox.js +817 -0
- package/lib/components/combobox/Combobox.js.map +1 -0
- package/lib/components/combobox/Combobox.styles.d.ts +38 -0
- package/lib/components/combobox/Combobox.styles.d.ts.map +1 -0
- package/lib/components/combobox/Combobox.styles.js +278 -0
- package/lib/components/combobox/Combobox.styles.js.map +1 -0
- package/lib/components/combobox/Combobox.types.d.ts +121 -0
- package/lib/components/combobox/Combobox.types.d.ts.map +1 -0
- package/lib/components/combobox/Combobox.types.js +46 -0
- package/lib/components/combobox/Combobox.types.js.map +1 -0
- package/lib/components/combobox/ComboboxContext.d.ts +21 -0
- package/lib/components/combobox/ComboboxContext.d.ts.map +1 -0
- package/lib/components/combobox/ComboboxContext.js +19 -0
- package/lib/components/combobox/ComboboxContext.js.map +1 -0
- package/lib/components/combobox/ComboboxGroup.d.ts +15 -0
- package/lib/components/combobox/ComboboxGroup.d.ts.map +1 -0
- package/lib/components/combobox/ComboboxGroup.js +84 -0
- package/lib/components/combobox/ComboboxGroup.js.map +1 -0
- package/lib/components/combobox/ComboboxMenu/ComboboxMenu.d.ts +9 -0
- package/lib/components/combobox/ComboboxMenu/ComboboxMenu.d.ts.map +1 -0
- package/lib/components/combobox/ComboboxMenu/ComboboxMenu.js +86 -0
- package/lib/components/combobox/ComboboxMenu/ComboboxMenu.js.map +1 -0
- package/lib/components/combobox/ComboboxMenu/Menu.styles.d.ts +22 -0
- package/lib/components/combobox/ComboboxMenu/Menu.styles.d.ts.map +1 -0
- package/lib/components/combobox/ComboboxMenu/Menu.styles.js +115 -0
- package/lib/components/combobox/ComboboxMenu/Menu.styles.js.map +1 -0
- package/lib/components/combobox/ComboboxOption.d.ts +17 -0
- package/lib/components/combobox/ComboboxOption.d.ts.map +1 -0
- package/lib/components/combobox/ComboboxOption.js +258 -0
- package/lib/components/combobox/ComboboxOption.js.map +1 -0
- package/lib/components/combobox/Menu.styles.d.ts +18 -0
- package/lib/components/combobox/Menu.styles.d.ts.map +1 -0
- package/lib/components/combobox/Menu.styles.js +98 -0
- package/lib/components/combobox/Menu.styles.js.map +1 -0
- package/lib/components/combobox/index.d.ts +4 -0
- package/lib/components/combobox/index.d.ts.map +1 -0
- package/lib/components/combobox/index.js +13 -0
- package/lib/components/combobox/index.js.map +1 -0
- package/lib/components/combobox/utils/OptionObjectUtils.d.ts +5 -0
- package/lib/components/combobox/utils/OptionObjectUtils.d.ts.map +1 -0
- package/lib/components/combobox/utils/OptionObjectUtils.js +23 -0
- package/lib/components/combobox/utils/OptionObjectUtils.js.map +1 -0
- package/lib/components/combobox/utils/flattenChildren.d.ts +4 -0
- package/lib/components/combobox/utils/flattenChildren.d.ts.map +1 -0
- package/lib/components/combobox/utils/flattenChildren.js +35 -0
- package/lib/components/combobox/utils/flattenChildren.js.map +1 -0
- package/lib/components/combobox/utils/getNameAndValue.d.ts +6 -0
- package/lib/components/combobox/utils/getNameAndValue.d.ts.map +1 -0
- package/lib/components/combobox/utils/getNameAndValue.js +16 -0
- package/lib/components/combobox/utils/getNameAndValue.js.map +1 -0
- package/lib/components/combobox/utils/index.d.ts +5 -0
- package/lib/components/combobox/utils/index.d.ts.map +1 -0
- package/lib/components/combobox/utils/index.js +14 -0
- package/lib/components/combobox/utils/index.js.map +1 -0
- package/lib/components/combobox/utils/wrapJSX.d.ts +3 -0
- package/lib/components/combobox/utils/wrapJSX.d.ts.map +1 -0
- package/lib/components/combobox/utils/wrapJSX.js +33 -0
- package/lib/components/combobox/utils/wrapJSX.js.map +1 -0
- package/lib/components/empty-content.d.ts +1 -2
- package/lib/components/empty-content.d.ts.map +1 -1
- package/lib/components/empty-content.js +9 -2
- package/lib/components/empty-content.js.map +1 -1
- package/lib/components/file-input.d.ts +18 -19
- package/lib/components/file-input.d.ts.map +1 -1
- package/lib/components/file-input.js +3 -3
- package/lib/components/file-input.js.map +1 -1
- package/lib/components/horizontal-rule.d.ts +4 -0
- package/lib/components/horizontal-rule.d.ts.map +1 -0
- package/lib/components/horizontal-rule.js +49 -0
- package/lib/components/horizontal-rule.js.map +1 -0
- package/lib/components/icons/document-icon.d.ts +1 -4
- package/lib/components/icons/document-icon.d.ts.map +1 -1
- package/lib/components/icons/document-icon.js +2 -2
- package/lib/components/icons/document-icon.js.map +1 -1
- package/lib/components/icons/favorite-icon.d.ts +6 -7
- package/lib/components/icons/favorite-icon.d.ts.map +1 -1
- package/lib/components/icons/favorite-icon.js +2 -2
- package/lib/components/icons/favorite-icon.js.map +1 -1
- package/lib/components/icons/no-saved-items-icon.d.ts +0 -1
- package/lib/components/icons/no-saved-items-icon.d.ts.map +1 -1
- package/lib/components/icons/no-saved-items-icon.js +2 -2
- package/lib/components/icons/no-saved-items-icon.js.map +1 -1
- package/lib/components/index-keys-badge.d.ts +11 -0
- package/lib/components/index-keys-badge.d.ts.map +1 -0
- package/lib/components/index-keys-badge.js +26 -0
- package/lib/components/index-keys-badge.js.map +1 -0
- package/lib/components/interactive-popover.js +3 -3
- package/lib/components/interactive-popover.js.map +1 -1
- package/lib/components/keyline-card.d.ts +1 -4
- package/lib/components/keyline-card.d.ts.map +1 -1
- package/lib/components/keyline-card.js +3 -3
- package/lib/components/keyline-card.js.map +1 -1
- package/lib/components/leafygreen.d.ts +26 -74
- package/lib/components/leafygreen.d.ts.map +1 -1
- package/lib/components/leafygreen.js +38 -70
- package/lib/components/leafygreen.js.map +1 -1
- package/lib/components/list-editor.d.ts +2 -1
- package/lib/components/list-editor.d.ts.map +1 -1
- package/lib/components/list-editor.js +2 -4
- package/lib/components/list-editor.js.map +1 -1
- package/lib/components/modals/confirmation-modal.d.ts +1 -3
- package/lib/components/modals/confirmation-modal.d.ts.map +1 -1
- package/lib/components/modals/confirmation-modal.js +6 -32
- package/lib/components/modals/confirmation-modal.js.map +1 -1
- package/lib/components/modals/modal-body.d.ts.map +1 -1
- package/lib/components/modals/modal-body.js +6 -3
- package/lib/components/modals/modal-body.js.map +1 -1
- package/lib/components/modals/modal-footer-button.d.ts +2 -2
- package/lib/components/modals/modal-footer-button.d.ts.map +1 -1
- package/lib/components/modals/modal-footer-button.js +3 -4
- package/lib/components/modals/modal-footer-button.js.map +1 -1
- package/lib/components/modals/modal-header.d.ts +2 -3
- package/lib/components/modals/modal-header.d.ts.map +1 -1
- package/lib/components/modals/modal-header.js +7 -5
- package/lib/components/modals/modal-header.js.map +1 -1
- package/lib/components/modals/modal.d.ts +1 -3
- package/lib/components/modals/modal.d.ts.map +1 -1
- package/lib/components/modals/modal.js +8 -32
- package/lib/components/modals/modal.js.map +1 -1
- package/lib/components/placeholder.d.ts +3 -4
- package/lib/components/placeholder.d.ts.map +1 -1
- package/lib/components/placeholder.js +3 -3
- package/lib/components/placeholder.js.map +1 -1
- package/lib/components/resizeable-sidebar.d.ts.map +1 -1
- package/lib/components/resizeable-sidebar.js +4 -4
- package/lib/components/resizeable-sidebar.js.map +1 -1
- package/lib/components/spin-loader.d.ts +2 -1
- package/lib/components/spin-loader.d.ts.map +1 -1
- package/lib/components/spin-loader.js +10 -3
- package/lib/components/spin-loader.js.map +1 -1
- package/lib/components/store-connector.d.ts +17 -0
- package/lib/components/store-connector.d.ts.map +1 -0
- package/lib/components/store-connector.js +25 -0
- package/lib/components/store-connector.js.map +1 -0
- package/lib/components/tab-nav-bar.d.ts +2 -3
- package/lib/components/tab-nav-bar.d.ts.map +1 -1
- package/lib/components/tab-nav-bar.js +3 -3
- package/lib/components/tab-nav-bar.js.map +1 -1
- package/lib/components/tooltip.d.ts.map +1 -1
- package/lib/components/tooltip.js +2 -8
- package/lib/components/tooltip.js.map +1 -1
- package/lib/components/virtual-grid.d.ts +1 -1
- package/lib/components/workspace-container.d.ts +1 -2
- package/lib/components/workspace-container.d.ts.map +1 -1
- package/lib/components/workspace-container.js +4 -4
- package/lib/components/workspace-container.js.map +1 -1
- package/lib/components/workspace-tabs/tab.d.ts +3 -3
- package/lib/components/workspace-tabs/tab.d.ts.map +1 -1
- package/lib/components/workspace-tabs/tab.js +19 -5
- package/lib/components/workspace-tabs/tab.js.map +1 -1
- package/lib/components/workspace-tabs/workspace-tabs.d.ts +1 -2
- package/lib/components/workspace-tabs/workspace-tabs.d.ts.map +1 -1
- package/lib/components/workspace-tabs/workspace-tabs.js +49 -24
- package/lib/components/workspace-tabs/workspace-tabs.js.map +1 -1
- package/lib/hooks/use-effect-on-change.d.ts +3 -0
- package/lib/hooks/use-effect-on-change.d.ts.map +1 -0
- package/lib/hooks/use-effect-on-change.js +19 -0
- package/lib/hooks/use-effect-on-change.js.map +1 -0
- package/lib/hooks/use-focus-ring.d.ts.map +1 -1
- package/lib/hooks/use-focus-ring.js +8 -6
- package/lib/hooks/use-focus-ring.js.map +1 -1
- package/lib/hooks/use-scrollbars.d.ts +11 -0
- package/lib/hooks/use-scrollbars.d.ts.map +1 -0
- package/lib/hooks/use-scrollbars.js +117 -0
- package/lib/hooks/use-scrollbars.js.map +1 -0
- package/lib/hooks/use-theme.d.ts +11 -13
- package/lib/hooks/use-theme.d.ts.map +1 -1
- package/lib/hooks/use-theme.js +17 -21
- package/lib/hooks/use-theme.js.map +1 -1
- package/lib/index.d.ts +10 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +24 -8
- package/lib/index.js.map +1 -1
- package/package.json +54 -45
- package/lib/components/checkbox.d.ts +0 -5
- package/lib/components/checkbox.d.ts.map +0 -1
- package/lib/components/checkbox.js +0 -15
- package/lib/components/checkbox.js.map +0 -1
- package/lib/components/toggle.d.ts +0 -5
- package/lib/components/toggle.d.ts.map +0 -1
- package/lib/components/toggle.js +0 -15
- package/lib/components/toggle.js.map +0 -1
|
@@ -28,8 +28,9 @@ const react_1 = __importStar(require("react"));
|
|
|
28
28
|
const emotion_1 = require("@leafygreen-ui/emotion");
|
|
29
29
|
const palette_1 = require("@leafygreen-ui/palette");
|
|
30
30
|
const tokens_1 = require("@leafygreen-ui/tokens");
|
|
31
|
-
const react_sortable_hoc_1 = require("react-sortable-hoc");
|
|
32
31
|
const polished_1 = require("polished");
|
|
32
|
+
const core_1 = require("@dnd-kit/core");
|
|
33
|
+
const sortable_1 = require("@dnd-kit/sortable");
|
|
33
34
|
const use_theme_1 = require("../../hooks/use-theme");
|
|
34
35
|
const use_focus_hover_1 = require("../../hooks/use-focus-hover");
|
|
35
36
|
const leafygreen_1 = require("../leafygreen");
|
|
@@ -59,7 +60,7 @@ const tabsContainerLightStyles = (0, emotion_1.css)({
|
|
|
59
60
|
},
|
|
60
61
|
});
|
|
61
62
|
const tabsContainerDarkStyles = (0, emotion_1.css)({
|
|
62
|
-
backgroundColor: palette_1.palette.
|
|
63
|
+
backgroundColor: palette_1.palette.black,
|
|
63
64
|
borderBottomColor: palette_1.palette.gray.dark2,
|
|
64
65
|
'::-webkit-scrollbar-thumb': {
|
|
65
66
|
backgroundColor: exports.scrollbarThumbDarkTheme,
|
|
@@ -87,11 +88,6 @@ const createNewTabButtonStyles = (0, emotion_1.css)({
|
|
|
87
88
|
const sortableItemContainerStyles = (0, emotion_1.css)({
|
|
88
89
|
display: 'inline-flex',
|
|
89
90
|
});
|
|
90
|
-
const workspaceTabsSortableCloneStyles = (0, emotion_1.css)({
|
|
91
|
-
pointerEvents: 'auto !important',
|
|
92
|
-
cursor: 'grabbing !important',
|
|
93
|
-
zIndex: 50,
|
|
94
|
-
});
|
|
95
91
|
function useTabListKeyboardNavigation({ tabsCount, onSelectTab, selectedTabIndex, }) {
|
|
96
92
|
const onKeyDown = (0, react_1.useCallback)((evt) => {
|
|
97
93
|
let nextTabbable = -1;
|
|
@@ -122,17 +118,6 @@ function useTabListKeyboardNavigation({ tabsCount, onSelectTab, selectedTabIndex
|
|
|
122
118
|
}, [selectedTabIndex, tabsCount, onSelectTab]);
|
|
123
119
|
return [{ onKeyDown }];
|
|
124
120
|
}
|
|
125
|
-
const SortableItem = (0, react_sortable_hoc_1.SortableElement)(({ tab: { tabContentId, iconGlyph, subtitle, title }, tabIndex, selectedTabIndex, onSelect, onClose, }) => {
|
|
126
|
-
const onTabSelected = (0, react_1.useCallback)(() => {
|
|
127
|
-
onSelect(tabIndex);
|
|
128
|
-
}, [onSelect, tabIndex]);
|
|
129
|
-
const onTabClosed = (0, react_1.useCallback)(() => {
|
|
130
|
-
onClose(tabIndex);
|
|
131
|
-
}, [onClose, tabIndex]);
|
|
132
|
-
const isSelected = (0, react_1.useMemo)(() => selectedTabIndex === tabIndex, [selectedTabIndex, tabIndex]);
|
|
133
|
-
return (react_1.default.createElement(tab_1.Tab, { title: title, isSelected: isSelected, iconGlyph: iconGlyph, tabContentId: tabContentId, subtitle: subtitle, onSelect: onTabSelected, onClose: onTabClosed }));
|
|
134
|
-
});
|
|
135
|
-
const SortableList = (0, react_sortable_hoc_1.SortableContainer)(({ tabs, onSelect, onClose, selectedTabIndex }) => (react_1.default.createElement("div", { className: sortableItemContainerStyles }, tabs.map((tab, index) => (react_1.default.createElement(SortableItem, { key: `tab-${index}-${tab.subtitle}`, index: index, tabIndex: index, tab: tab, onSelect: onSelect, onClose: onClose, selectedTabIndex: selectedTabIndex }))))));
|
|
136
121
|
function useRovingTabIndex({ currentTabbable, }) {
|
|
137
122
|
const rootNode = (0, react_1.useRef)(null);
|
|
138
123
|
const [focusProps, focusState] = (0, use_focus_hover_1.useFocusState)();
|
|
@@ -154,7 +139,51 @@ function useRovingTabIndex({ currentTabbable, }) {
|
|
|
154
139
|
return { ref: rootNode, ...focusProps };
|
|
155
140
|
}
|
|
156
141
|
exports.useRovingTabIndex = useRovingTabIndex;
|
|
157
|
-
|
|
142
|
+
const SortableList = ({ tabs, onMove, onSelect, selectedTabIndex, onClose, }) => {
|
|
143
|
+
const items = tabs.map((tab) => tab.tabContentId);
|
|
144
|
+
const [activeId, setActiveId] = (0, react_1.useState)(null);
|
|
145
|
+
const sensors = (0, core_1.useSensors)((0, core_1.useSensor)(core_1.MouseSensor, {
|
|
146
|
+
activationConstraint: {
|
|
147
|
+
distance: 10,
|
|
148
|
+
},
|
|
149
|
+
}), (0, core_1.useSensor)(core_1.TouchSensor, {
|
|
150
|
+
activationConstraint: {
|
|
151
|
+
delay: 250,
|
|
152
|
+
tolerance: 5,
|
|
153
|
+
},
|
|
154
|
+
}));
|
|
155
|
+
const onSortEnd = (0, react_1.useCallback)(({ oldIndex, newIndex }) => {
|
|
156
|
+
const from = tabs.findIndex((tab) => tab.tabContentId === oldIndex);
|
|
157
|
+
const to = tabs.findIndex((tab) => tab.tabContentId === newIndex);
|
|
158
|
+
onMove(from, to);
|
|
159
|
+
}, [onMove, tabs]);
|
|
160
|
+
return (react_1.default.createElement(core_1.DndContext, { sensors: sensors, autoScroll: false, onDragStart: ({ active }) => {
|
|
161
|
+
if (!active) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
setActiveId(active.id);
|
|
165
|
+
}, onDragEnd: ({ active, over }) => {
|
|
166
|
+
setActiveId(null);
|
|
167
|
+
if (over && active.id !== over.id) {
|
|
168
|
+
onSortEnd({ oldIndex: active.id, newIndex: over.id });
|
|
169
|
+
}
|
|
170
|
+
}, onDragCancel: () => setActiveId(null) },
|
|
171
|
+
react_1.default.createElement(sortable_1.SortableContext, { items: items, strategy: sortable_1.horizontalListSortingStrategy },
|
|
172
|
+
react_1.default.createElement("div", { className: sortableItemContainerStyles }, tabs.map((tab, index) => (react_1.default.createElement(SortableItem, { key: `tab-${tab.tabContentId}-${tab.subtitle}`, index: index, tab: tab, activeId: activeId, onSelect: onSelect, onClose: onClose, selectedTabIndex: selectedTabIndex })))))));
|
|
173
|
+
};
|
|
174
|
+
const SortableItem = ({ tab: { tabContentId, iconGlyph, subtitle, title }, index, selectedTabIndex, activeId, onSelect, onClose, }) => {
|
|
175
|
+
const onTabSelected = (0, react_1.useCallback)(() => {
|
|
176
|
+
onSelect(index);
|
|
177
|
+
}, [onSelect, index]);
|
|
178
|
+
const onTabClosed = (0, react_1.useCallback)(() => {
|
|
179
|
+
onClose(index);
|
|
180
|
+
}, [onClose, index]);
|
|
181
|
+
const isSelected = (0, react_1.useMemo)(() => selectedTabIndex === index, [selectedTabIndex, index]);
|
|
182
|
+
const isDragging = (0, react_1.useMemo)(() => tabContentId === activeId, [tabContentId, activeId]);
|
|
183
|
+
return (react_1.default.createElement(tab_1.Tab, { title: title, isSelected: isSelected, isDragging: isDragging, iconGlyph: iconGlyph, tabContentId: tabContentId, subtitle: subtitle, onSelect: onTabSelected, onClose: onTabClosed }));
|
|
184
|
+
};
|
|
185
|
+
function WorkspaceTabs({ ['aria-label']: ariaLabel, onCreateNewTab, onCloseTab, onMoveTab, onSelectTab, tabs, selectedTabIndex, }) {
|
|
186
|
+
const darkMode = (0, use_theme_1.useDarkMode)();
|
|
158
187
|
const rovingFocusProps = useRovingTabIndex({
|
|
159
188
|
currentTabbable: selectedTabIndex,
|
|
160
189
|
});
|
|
@@ -164,17 +193,13 @@ function UnthemedWorkspaceTabs({ ['aria-label']: ariaLabel, darkMode, onCreateNe
|
|
|
164
193
|
tabsCount: tabs.length,
|
|
165
194
|
});
|
|
166
195
|
const tabContainerProps = (0, merge_props_1.mergeProps)(rovingFocusProps, navigationProps);
|
|
167
|
-
const onSortEnd = (0, react_1.useCallback)(({ oldIndex, newIndex }) => {
|
|
168
|
-
onMoveTab(oldIndex, newIndex);
|
|
169
|
-
}, [onMoveTab]);
|
|
170
196
|
return (react_1.default.createElement("div", { className: (0, emotion_1.cx)(tabsContainerStyles, darkMode ? tabsContainerDarkStyles : tabsContainerLightStyles) },
|
|
171
197
|
react_1.default.createElement("div", { className: tabsListContainerStyles },
|
|
172
198
|
react_1.default.createElement("div", { className: tabsListStyles, role: "tablist", "aria-label": ariaLabel, "aria-orientation": "horizontal", ...tabContainerProps },
|
|
173
|
-
react_1.default.createElement(SortableList, {
|
|
199
|
+
react_1.default.createElement(SortableList, { tabs: tabs, onMove: onMoveTab, onSelect: onSelectTab, onClose: onCloseTab, selectedTabIndex: selectedTabIndex })),
|
|
174
200
|
react_1.default.createElement("div", { className: newTabContainerStyles },
|
|
175
201
|
react_1.default.createElement(leafygreen_1.IconButton, { className: createNewTabButtonStyles, "aria-label": "Create new tab", onClick: onCreateNewTab },
|
|
176
202
|
react_1.default.createElement(leafygreen_1.Icon, { role: "presentation", glyph: "Plus" }))))));
|
|
177
203
|
}
|
|
178
|
-
const WorkspaceTabs = (0, use_theme_1.withTheme)(UnthemedWorkspaceTabs);
|
|
179
204
|
exports.WorkspaceTabs = WorkspaceTabs;
|
|
180
205
|
//# sourceMappingURL=workspace-tabs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-tabs.js","sourceRoot":"","sources":["../../../src/components/workspace-tabs/workspace-tabs.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+
|
|
1
|
+
{"version":3,"file":"workspace-tabs.js","sourceRoot":"","sources":["../../../src/components/workspace-tabs/workspace-tabs.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAMe;AACf,oD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AS,EAAE,uBAAuB;YACrC,uCACE,SAAS,EAAE,cAAc,EACzB,IAAI,EAAC,SAAS,gBACF,SAAS,sBACJ,YAAY,KACzB,iBAAiB;gBAErB,8BAAC,YAAY,IACX,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,WAAW,EACrB,OAAO,EAAE,UAAU,EACnB,gBAAgB,EAAE,gBAAgB,GAClC,CACE;YACN,uCAAK,SAAS,EAAE,qBAAqB;gBACnC,8BAAC,uBAAU,IACT,SAAS,EAAE,wBAAwB,gBACxB,gBAAgB,EAC3B,OAAO,EAAE,cAAc;oBAEvB,8BAAC,iBAAI,IAAC,IAAI,EAAC,cAAc,EAAC,KAAK,EAAC,MAAM,GAAG,CAC9B,CACT,CACF,CACF,CACP,CAAC;AACJ,CAAC;AAEQ,sCAAa"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-effect-on-change.d.ts","sourceRoot":"","sources":["../../src/hooks/use-effect-on-change.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAWvC,wBAAgB,iBAAiB,CAAC,CAAC,EACjC,EAAE,EAAE,KAAK,CAAC,cAAc,EACxB,GAAG,EAAE,CAAC,GACL,SAAS,CAAC,CAAC,CAAC,CAkBd"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useEffectOnChange = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const kValueChanged = Symbol('Value changed');
|
|
6
|
+
function useEffectOnChange(fn, val) {
|
|
7
|
+
const initial = (0, react_1.useRef)(val);
|
|
8
|
+
const effect = (0, react_1.useRef)(fn);
|
|
9
|
+
effect.current = fn;
|
|
10
|
+
(0, react_1.useEffect)(() => {
|
|
11
|
+
if (val !== initial.current) {
|
|
12
|
+
initial.current = kValueChanged;
|
|
13
|
+
return effect.current();
|
|
14
|
+
}
|
|
15
|
+
}, [val]);
|
|
16
|
+
return (0, react_1.useRef)(val);
|
|
17
|
+
}
|
|
18
|
+
exports.useEffectOnChange = useEffectOnChange;
|
|
19
|
+
//# sourceMappingURL=use-effect-on-change.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-effect-on-change.js","sourceRoot":"","sources":["../../src/hooks/use-effect-on-change.ts"],"names":[],"mappings":";;;AACA,iCAA0C;AAE1C,MAAM,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;AAQ9C,SAAgB,iBAAiB,CAC/B,EAAwB,EACxB,GAAM;IAIN,MAAM,OAAO,GAAG,IAAA,cAAM,EAAa,GAAG,CAAC,CAAC;IACxC,MAAM,MAAM,GAAG,IAAA,cAAM,EAAC,EAAE,CAAC,CAAC;IAC1B,MAAM,CAAC,OAAO,GAAG,EAAE,CAAC;IACpB,IAAA,iBAAS,EAAC,GAAG,EAAE;QAGb,IAAI,GAAG,KAAK,OAAO,CAAC,OAAO,EAAE;YAG3B,OAAO,CAAC,OAAO,GAAG,aAAa,CAAC;YAChC,OAAO,MAAM,CAAC,OAAO,EAAE,CAAC;SACzB;IACH,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAEV,OAAO,IAAA,cAAM,EAAC,GAAG,CAAC,CAAC;AACrB,CAAC;AArBD,8CAqBC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-focus-ring.d.ts","sourceRoot":"","sources":["../../src/hooks/use-focus-ring.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-focus-ring.d.ts","sourceRoot":"","sources":["../../src/hooks/use-focus-ring.ts"],"names":[],"mappings":"AA6CA,eAAO,MAAM,SAAS,QAQpB,CAAC;AA+BH,wBAAgB,YAAY,CAAC,EAC3B,KAAa,EACb,WAAmB,EACnB,KAAa,EACb,MAAM,GACP,GAAE;IAED,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,MAAM,CAAC,EAAE,MAAM,CAAC;CACZ;;EAkCL"}
|
|
@@ -5,6 +5,7 @@ const tokens_1 = require("@leafygreen-ui/tokens");
|
|
|
5
5
|
const emotion_1 = require("@leafygreen-ui/emotion");
|
|
6
6
|
const palette_1 = require("@leafygreen-ui/palette");
|
|
7
7
|
const react_1 = require("react");
|
|
8
|
+
const use_theme_1 = require("./use-theme");
|
|
8
9
|
const focusRingStyles = (0, emotion_1.css)({
|
|
9
10
|
position: 'relative',
|
|
10
11
|
outline: 'none',
|
|
@@ -28,9 +29,9 @@ const focusRingVisibleStyles = (0, emotion_1.css)({
|
|
|
28
29
|
transitionTimingFunction: 'ease-out',
|
|
29
30
|
},
|
|
30
31
|
});
|
|
31
|
-
const focusRingHoverVisibleStyles = (0, emotion_1.css)({
|
|
32
|
+
const focusRingHoverVisibleStyles = (darkMode) => (0, emotion_1.css)({
|
|
32
33
|
'&::after': {
|
|
33
|
-
boxShadow: `0 0 0 3px ${palette_1.palette.gray.light2}`,
|
|
34
|
+
boxShadow: `0 0 0 3px ${darkMode ? palette_1.palette.gray.dark2 : palette_1.palette.gray.light2}`,
|
|
34
35
|
transitionTimingFunction: 'ease-out',
|
|
35
36
|
},
|
|
36
37
|
});
|
|
@@ -48,10 +49,11 @@ const focusRingOuter = (0, emotion_1.css)({
|
|
|
48
49
|
const focusRingWithin = (0, emotion_1.css)({
|
|
49
50
|
'&:focus-within': focusRingVisibleStyles,
|
|
50
51
|
});
|
|
51
|
-
const focusRingHover = (0, emotion_1.css)({
|
|
52
|
-
'&:hover': focusRingHoverVisibleStyles,
|
|
52
|
+
const focusRingHover = (darkMode) => (0, emotion_1.css)({
|
|
53
|
+
'&:hover': focusRingHoverVisibleStyles(darkMode),
|
|
53
54
|
});
|
|
54
55
|
function useFocusRing({ outer = false, focusWithin = false, hover = false, radius, } = {}) {
|
|
56
|
+
const darkMode = (0, use_theme_1.useDarkMode)();
|
|
55
57
|
const outerClass = (0, react_1.useMemo)(() => {
|
|
56
58
|
return outer && focusRingOuter;
|
|
57
59
|
}, [outer]);
|
|
@@ -67,8 +69,8 @@ function useFocusRing({ outer = false, focusWithin = false, hover = false, radiu
|
|
|
67
69
|
return focusWithin && focusRingWithin;
|
|
68
70
|
}, [focusWithin]);
|
|
69
71
|
const hoverClass = (0, react_1.useMemo)(() => {
|
|
70
|
-
return hover && focusRingHover;
|
|
71
|
-
}, [hover]);
|
|
72
|
+
return hover && focusRingHover(!!darkMode);
|
|
73
|
+
}, [hover, darkMode]);
|
|
72
74
|
return {
|
|
73
75
|
className: (0, emotion_1.cx)(exports.focusRing, outerClass, radiusClass, focusWithinClass, hoverClass),
|
|
74
76
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-focus-ring.js","sourceRoot":"","sources":["../../src/hooks/use-focus-ring.ts"],"names":[],"mappings":";;;AAAA,kDAAgD;AAChD,oDAAiD;AACjD,oDAAiD;AACjD,iCAAgC;
|
|
1
|
+
{"version":3,"file":"use-focus-ring.js","sourceRoot":"","sources":["../../src/hooks/use-focus-ring.ts"],"names":[],"mappings":";;;AAAA,kDAAgD;AAChD,oDAAiD;AACjD,oDAAiD;AACjD,iCAAgC;AAChC,2CAA0C;AAE1C,MAAM,eAAe,GAAG,IAAA,aAAG,EAAC;IAC1B,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,MAAM;IACf,UAAU,EAAE;QACV,QAAQ,EAAE,UAAU;QACpB,OAAO,EAAE,IAAI;QACb,aAAa,EAAE,MAAM;QACrB,GAAG,EAAE,CAAC;QACN,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;QACT,IAAI,EAAE,CAAC;QACP,YAAY,EAAE,gBAAO,CAAC,CAAC,CAAC;QACxB,SAAS,EAAE,qBAAqB;QAChC,UAAU,EAAE,yBAAyB;QACrC,MAAM,EAAE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I,cAAc,CAAC;IACjC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,MAAM,WAAW,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QAC/B,OAAO,CACL,OAAO,MAAM,KAAK,QAAQ;YAC1B,IAAA,aAAG,EAAC;gBACF,UAAU,EAAE;oBACV,YAAY,EAAE,MAAM;iBACrB;aACF,CAAC,CACH,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,MAAM,gBAAgB,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QACpC,OAAO,WAAW,IAAI,eAAe,CAAC;IACxC,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,MAAM,UAAU,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QAC9B,OAAO,KAAK,IAAI,cAAc,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEtB,OAAO;QACL,SAAS,EAAE,IAAA,YAAE,EACX,iBAAS,EACT,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,UAAU,CACX;KACF,CAAC;AACJ,CAAC;AAhDD,oCAgDC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare function getScrollbarStyles(darkMode: boolean): string;
|
|
3
|
+
export declare function useScrollbars(): {
|
|
4
|
+
className: string | undefined;
|
|
5
|
+
};
|
|
6
|
+
interface WithPortalClassName {
|
|
7
|
+
portalClassName?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const withPortalScrollbars: <ComponentProps extends WithPortalClassName>(WrappedComponent: React.ComponentType<ComponentProps & WithPortalClassName>) => (props: ComponentProps) => JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=use-scrollbars.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-scrollbars.d.ts","sourceRoot":"","sources":["../../src/hooks/use-scrollbars.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAkB,MAAM,OAAO,CAAC;AA+EvC,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,OAAO,UAEnD;AASD,wBAAgB,aAAa;;EAgB5B;AAED,UAAU,mBAAmB;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAID,eAAO,MAAM,oBAAoB,qKAqBhC,CAAC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.withPortalScrollbars = exports.useScrollbars = exports.getScrollbarStyles = void 0;
|
|
30
|
+
const polished_1 = require("polished");
|
|
31
|
+
const palette_1 = require("@leafygreen-ui/palette");
|
|
32
|
+
const emotion_1 = require("@leafygreen-ui/emotion");
|
|
33
|
+
const react_1 = __importStar(require("react"));
|
|
34
|
+
const is_electron_renderer_1 = __importDefault(require("is-electron-renderer"));
|
|
35
|
+
const use_theme_1 = require("./use-theme");
|
|
36
|
+
const scrollbarSize = 10;
|
|
37
|
+
const scrollbarStyles = (0, emotion_1.css)({
|
|
38
|
+
'*::-webkit-scrollbar-thumb': {
|
|
39
|
+
backgroundColor: 'transparent',
|
|
40
|
+
borderRadius: `${scrollbarSize}px`,
|
|
41
|
+
},
|
|
42
|
+
'*::-webkit-scrollbar-track': {
|
|
43
|
+
backgroundColor: 'transparent',
|
|
44
|
+
},
|
|
45
|
+
'*::-webkit-scrollbar': {
|
|
46
|
+
width: `${scrollbarSize}px`,
|
|
47
|
+
'&:horizontal': {
|
|
48
|
+
height: `${scrollbarSize}px`,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
'*::-webkit-scrollbar-corner': {
|
|
52
|
+
background: 'transparent',
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
const scrollbarLightModeStyles = (0, emotion_1.css)({
|
|
56
|
+
'*:active::-webkit-scrollbar-thumb, *:focus::-webkit-scrollbar-thumb, *:hover::-webkit-scrollbar-thumb': {
|
|
57
|
+
backgroundColor: (0, polished_1.rgba)(palette_1.palette.black, 0.12),
|
|
58
|
+
'&:hover': {
|
|
59
|
+
backgroundColor: (0, polished_1.rgba)(palette_1.palette.black, 0.2),
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
'*::-webkit-scrollbar-thumb': {
|
|
63
|
+
'&:horizontal': {
|
|
64
|
+
backgroundColor: (0, polished_1.rgba)(palette_1.palette.black, 0.12),
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
'*::-webkit-scrollbar-track': {
|
|
68
|
+
'&:hover': {
|
|
69
|
+
backgroundColor: (0, polished_1.rgba)(palette_1.palette.black, 0.04),
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
}, scrollbarStyles);
|
|
73
|
+
const scrollbarDarkModeStyles = (0, emotion_1.css)({
|
|
74
|
+
'*:active::-webkit-scrollbar-thumb, *:focus::-webkit-scrollbar-thumb, *:hover::-webkit-scrollbar-thumb': {
|
|
75
|
+
backgroundColor: (0, polished_1.rgba)(palette_1.palette.white, 0.2),
|
|
76
|
+
'&:hover': {
|
|
77
|
+
backgroundColor: (0, polished_1.rgba)(palette_1.palette.white, 0.25),
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
'*::-webkit-scrollbar-thumb': {
|
|
81
|
+
'&:horizontal': {
|
|
82
|
+
backgroundColor: (0, polished_1.rgba)(palette_1.palette.white, 0.2),
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
'*::-webkit-scrollbar-track': {
|
|
86
|
+
'&:hover': {
|
|
87
|
+
backgroundColor: (0, polished_1.rgba)(palette_1.palette.white, 0.1),
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
}, scrollbarStyles);
|
|
91
|
+
function getScrollbarStyles(darkMode) {
|
|
92
|
+
return darkMode ? scrollbarDarkModeStyles : scrollbarLightModeStyles;
|
|
93
|
+
}
|
|
94
|
+
exports.getScrollbarStyles = getScrollbarStyles;
|
|
95
|
+
function useScrollbars() {
|
|
96
|
+
const darkMode = (0, use_theme_1.useDarkMode)();
|
|
97
|
+
const scrollbarStylesClass = (0, react_1.useMemo)(() => {
|
|
98
|
+
if (!is_electron_renderer_1.default) {
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
return getScrollbarStyles(!!darkMode);
|
|
102
|
+
}, [darkMode]);
|
|
103
|
+
return {
|
|
104
|
+
className: scrollbarStylesClass,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
exports.useScrollbars = useScrollbars;
|
|
108
|
+
const withPortalScrollbars = (WrappedComponent) => {
|
|
109
|
+
const ComponentWithScrollbars = (props) => {
|
|
110
|
+
const { className } = useScrollbars();
|
|
111
|
+
const appliedClassName = is_electron_renderer_1.default ? className : undefined;
|
|
112
|
+
return (react_1.default.createElement(WrappedComponent, { ...props, portalClassName: (0, emotion_1.cx)(appliedClassName, props.portalClassName) }));
|
|
113
|
+
};
|
|
114
|
+
return ComponentWithScrollbars;
|
|
115
|
+
};
|
|
116
|
+
exports.withPortalScrollbars = withPortalScrollbars;
|
|
117
|
+
//# sourceMappingURL=use-scrollbars.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-scrollbars.js","sourceRoot":"","sources":["../../src/hooks/use-scrollbars.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAgC;AAChC,oDAAiD;AACjD,oDAAiD;AACjD,+CAAuC;AACvC,gFAAsD;AAEtD,2CAA0C;AAE1C,MAAM,aAAa,GAAG,EAAE,CAAC;AAEzB,MAAM,eAAe,GAAG,IAAA,aAAG,EAAC;IAC1B,4BAA4B,EAAE;QAG5B,eAAe,EAAE,aAAa;QAC9B,YAAY,EAAE,GAAG,aAAa,IAAI;KACnC;IACD,4BAA4B,EAAE;QAC5B,eAAe,EAAE,aAAa;KAC/B;IAED,sBAAsB,EAAE;QACtB,KAAK,EAAE,GAAG,aAAa,IAAI;QAC3B,cAAc,EAAE;YACd,MAAM,EAAE,GAAG,aAAa,IAAI;SAC7B;KACF;IACD,6BAA6B,EAAE;QAC7B,UAAU,EAAE,aAAa;KAC1B;CACF,CAAC,CAAC;AAEH,MAAM,wBAAwB,GAAG,IAAA,aAAG,EAClC;IACE,uGAAuG,EACrG;QACE,eAAe,EAAE,IAAA,eAAI,EAAC,iBAAO,CAAC,KAAK,EAAE,IAAI,CAAC;QAC1C,SA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AC,CAAC,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO;QACL,SAAS,EAAE,oBAAoB;KAChC,CAAC;AACJ,CAAC;AAhBD,sCAgBC;AAQM,MAAM,oBAAoB,GAAG,CAGlC,gBAA2E,EAC3E,EAAE;IACF,MAAM,uBAAuB,GAAG,CAAC,KAAqB,EAAE,EAAE;QACxD,MAAM,EAAE,SAAS,EAAE,GAAG,aAAa,EAAE,CAAC;QAItC,MAAM,gBAAgB,GAAG,8BAAkB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;QAEpE,OAAO,CACL,8BAAC,gBAAgB,OACX,KAAK,EACT,eAAe,EAAE,IAAA,YAAE,EAAC,gBAAgB,EAAE,KAAK,CAAC,eAAe,CAAC,GAC5D,CACH,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,uBAAuB,CAAC;AACjC,CAAC,CAAC;AArBW,QAAA,oBAAoB,wBAqB/B"}
|
package/lib/hooks/use-theme.d.ts
CHANGED
|
@@ -3,19 +3,17 @@ declare enum Theme {
|
|
|
3
3
|
Light = "Light",
|
|
4
4
|
Dark = "Dark"
|
|
5
5
|
}
|
|
6
|
-
declare
|
|
7
|
-
|
|
8
|
-
enabled: boolean;
|
|
9
|
-
};
|
|
10
|
-
declare const ThemeProvider: ({ children, theme, }: {
|
|
11
|
-
children: React.ReactNode;
|
|
12
|
-
theme: ThemeState;
|
|
13
|
-
}) => React.ReactElement;
|
|
14
|
-
declare function useTheme(): ThemeState;
|
|
15
|
-
export declare function useDarkMode(): boolean | undefined;
|
|
16
|
-
interface WithThemeProps {
|
|
6
|
+
export declare function useDarkMode(localDarkMode?: boolean): boolean | undefined;
|
|
7
|
+
interface WithDarkModeProps {
|
|
17
8
|
darkMode?: boolean;
|
|
18
9
|
}
|
|
19
|
-
declare const
|
|
20
|
-
|
|
10
|
+
export declare const ThemeProvider: ({ children, theme, }: {
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
theme: {
|
|
13
|
+
theme: Theme;
|
|
14
|
+
enabled: boolean;
|
|
15
|
+
};
|
|
16
|
+
}) => React.ReactElement;
|
|
17
|
+
declare const withDarkMode: <ComponentProps extends WithDarkModeProps = WithDarkModeProps>(WrappedComponent: React.ComponentType<ComponentProps & WithDarkModeProps>) => React.ComponentType<ComponentProps>;
|
|
18
|
+
export { Theme, withDarkMode };
|
|
21
19
|
//# sourceMappingURL=use-theme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-theme.d.ts","sourceRoot":"","sources":["../../src/hooks/use-theme.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"use-theme.d.ts","sourceRoot":"","sources":["../../src/hooks/use-theme.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,aAAK,KAAK;IACR,KAAK,UAAU;IACf,IAAI,SAAS;CACd;AAED,wBAAgB,WAAW,CAAC,aAAa,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,CAGxE;AAED,UAAU,iBAAiB;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAGD,eAAO,MAAM,aAAa;cAId,MAAM,SAAS;;eAEhB,KAAK;iBACH,OAAO;;MAEhB,MAAM,YAQT,CAAC;AAIF,QAAA,MAAM,YAAY,kLA4BjB,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC"}
|
package/lib/hooks/use-theme.js
CHANGED
|
@@ -22,40 +22,36 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
25
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
27
|
-
const react_1 =
|
|
29
|
+
exports.withDarkMode = exports.Theme = exports.ThemeProvider = exports.useDarkMode = void 0;
|
|
30
|
+
const react_1 = __importDefault(require("react"));
|
|
31
|
+
const leafygreen_provider_1 = __importStar(require("@leafygreen-ui/leafygreen-provider"));
|
|
28
32
|
var Theme;
|
|
29
33
|
(function (Theme) {
|
|
30
34
|
Theme["Light"] = "Light";
|
|
31
35
|
Theme["Dark"] = "Dark";
|
|
32
36
|
})(Theme || (Theme = {}));
|
|
33
37
|
exports.Theme = Theme;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
+
function useDarkMode(localDarkMode) {
|
|
39
|
+
const darkMode = (0, leafygreen_provider_1.useDarkMode)(localDarkMode);
|
|
40
|
+
return darkMode.darkMode;
|
|
41
|
+
}
|
|
42
|
+
exports.useDarkMode = useDarkMode;
|
|
38
43
|
const ThemeProvider = ({ children, theme, }) => {
|
|
39
|
-
return (react_1.default.createElement(
|
|
44
|
+
return theme.enabled ? (react_1.default.createElement(leafygreen_provider_1.default, { darkMode: theme.theme === Theme.Dark }, children)) : (react_1.default.createElement(react_1.default.Fragment, null, children));
|
|
40
45
|
};
|
|
41
46
|
exports.ThemeProvider = ThemeProvider;
|
|
42
|
-
function
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
exports.useTheme = useTheme;
|
|
46
|
-
function useDarkMode() {
|
|
47
|
-
const theme = useTheme();
|
|
48
|
-
return theme.enabled === true ? (theme === null || theme === void 0 ? void 0 : theme.theme) === Theme.Dark : undefined;
|
|
49
|
-
}
|
|
50
|
-
exports.useDarkMode = useDarkMode;
|
|
51
|
-
const withTheme = function (WrappedComponent) {
|
|
52
|
-
const ComponentWithTheme = (props, ref) => {
|
|
47
|
+
const withDarkMode = function (WrappedComponent) {
|
|
48
|
+
const ComponentWithDarkMode = (props, ref) => {
|
|
53
49
|
const darkMode = useDarkMode();
|
|
54
50
|
return (react_1.default.createElement(WrappedComponent, { darkMode: darkMode, ref: ref, ...props }));
|
|
55
51
|
};
|
|
56
52
|
const displayName = WrappedComponent.displayName || WrappedComponent.name || 'Component';
|
|
57
|
-
|
|
58
|
-
return react_1.default.forwardRef(
|
|
53
|
+
ComponentWithDarkMode.displayName = `WithDarkMode(${displayName})`;
|
|
54
|
+
return react_1.default.forwardRef(ComponentWithDarkMode);
|
|
59
55
|
};
|
|
60
|
-
exports.
|
|
56
|
+
exports.withDarkMode = withDarkMode;
|
|
61
57
|
//# sourceMappingURL=use-theme.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-theme.js","sourceRoot":"","sources":["../../src/hooks/use-theme.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-theme.js","sourceRoot":"","sources":["../../src/hooks/use-theme.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,0FAE4C;AAE5C,IAAK,KAGJ;AAHD,WAAK,KAAK;IACR,wBAAe,CAAA;IACf,sBAAa,CAAA;AACf,CAAC,EAHI,KAAK,KAAL,KAAK,QAGT;AA+DQ,sBAAK;AA7Dd,SAAgB,WAAW,CAAC,aAAuB;IACjD,MAAM,QAAQ,GAAG,IAAA,iCAAqB,EAAC,aAAa,CAAC,CAAC;IACtD,OAAO,QAAQ,CAAC,QAAQ,CAAC;AAC3B,CAAC;AAHD,kCAGC;AAOM,MAAM,aAAa,GAAG,CAAC,EAC5B,QAAQ,EACR,KAAK,GAON,EAAsB,EAAE;IACvB,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CACrB,8BAAC,6BAAkB,IAAC,QAAQ,EAAE,KAAK,CAAC,KAAK,KAAK,KAAK,CAAC,IAAI,IACrD,QAAQ,CACU,CACtB,CAAC,CAAC,CAAC,CACF,8DAAG,QAAQ,CAAI,CAChB,CAAC;AACJ,CAAC,CAAC;AAjBW,QAAA,aAAa,iBAiBxB;AAIF,MAAM,YAAY,GAAG,UAGnB,gBAAyE;IAEzE,MAAM,qBAAqB,GAAG,CAC5B,KAAqB,EACrB,GAEC,EACD,EAAE;QACF,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;QAC/B,OAAO,CACL,8BAAC,gBAAgB,IAGf,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,GAAG,KACJ,KAAK,GACT,CACH,CAAC;IACJ,CAAC,CAAC;IAEF,MAAM,WAAW,GACf,gBAAgB,CAAC,WAAW,IAAI,gBAAgB,CAAC,IAAI,IAAI,WAAW,CAAC;IACvE,qBAAqB,CAAC,WAAW,GAAG,gBAAgB,WAAW,GAAG,CAAC;IAEnE,OAAO,eAAK,CAAC,UAAU,CAAC,qBAAqB,CAA4B,CAAC;AAC5E,CAAC,CAAC;AAEc,oCAAY"}
|
package/lib/index.d.ts
CHANGED
|
@@ -19,17 +19,16 @@ export { NoSavedItemsIcon } from './components/icons/no-saved-items-icon';
|
|
|
19
19
|
export { Variant as BadgeVariant } from '@leafygreen-ui/badge';
|
|
20
20
|
export { Variant as BannerVariant } from '@leafygreen-ui/banner';
|
|
21
21
|
export { Size as ButtonSize, Variant as ButtonVariant, } from '@leafygreen-ui/button';
|
|
22
|
-
export { Checkbox } from './components/checkbox';
|
|
23
22
|
export { default as LeafyGreenProvider } from '@leafygreen-ui/leafygreen-provider';
|
|
24
23
|
export { palette } from '@leafygreen-ui/palette';
|
|
25
|
-
export { rgba } from 'polished';
|
|
24
|
+
export { rgba, lighten } from 'polished';
|
|
26
25
|
export { default as Portal } from '@leafygreen-ui/portal';
|
|
27
26
|
export { Size as RadioBoxSize } from '@leafygreen-ui/radio-box-group';
|
|
28
27
|
export { Size as SelectSize } from '@leafygreen-ui/select';
|
|
29
28
|
export { useId } from '@react-aria/utils';
|
|
30
29
|
export { VisuallyHidden } from '@react-aria/visually-hidden';
|
|
30
|
+
export { GuideCue } from '@leafygreen-ui/guide-cue';
|
|
31
31
|
export { useToast, openToast, closeToast, ToastArea, ToastVariant, } from './hooks/use-toast';
|
|
32
|
-
export { Toggle } from './components/toggle';
|
|
33
32
|
export { breakpoints, spacing } from '@leafygreen-ui/tokens';
|
|
34
33
|
export { Tooltip } from './components/tooltip';
|
|
35
34
|
import IndexIcon from './components/index-icon';
|
|
@@ -41,13 +40,15 @@ export { FormModal } from './components/modals/form-modal';
|
|
|
41
40
|
export { InfoModal } from './components/modals/info-modal';
|
|
42
41
|
export { Accordion, CollapsibleFieldSet, CancelLoader, ConfirmationModal, ErrorSummary, FileInput, FileInputBackend, IndexIcon, MoreOptionsToggle, RadioBoxGroup, SpinLoader, ResizeHandle, ResizeDirection, ResizableSidebar, WarningSummary, WorkspaceTabs, ItemAction, MenuAction, ItemActionControls, ItemActionGroup, ItemActionMenu, DropdownMenuButton, defaultSidebarWidth, ElectronFileDialogOptions, ElectronShowFileDialogProvider, createElectronFileInputBackend, };
|
|
43
42
|
export { useFocusState, useHoverState, FocusState, } from './hooks/use-focus-hover';
|
|
44
|
-
export {
|
|
43
|
+
export { getScrollbarStyles, useScrollbars } from './hooks/use-scrollbars';
|
|
44
|
+
export { withDarkMode, useDarkMode, Theme, ThemeProvider, } from './hooks/use-theme';
|
|
45
45
|
export { ContentWithFallback, FadeInPlaceholder, } from './components/content-with-fallback';
|
|
46
46
|
export { InlineDefinition } from './components/inline-definition';
|
|
47
47
|
import type { glyphs } from '@leafygreen-ui/icon';
|
|
48
48
|
export declare type IconGlyph = Extract<keyof typeof glyphs, string>;
|
|
49
49
|
export { EmptyContent } from './components/empty-content';
|
|
50
50
|
export { ErrorBoundary } from './components/error-boundary';
|
|
51
|
+
export { StoreConnector } from './components/store-connector';
|
|
51
52
|
export { TabNavBar } from './components/tab-nav-bar';
|
|
52
53
|
export { WorkspaceContainer } from './components/workspace-container';
|
|
53
54
|
export { InlineInfoLink } from './components/inline-info-link';
|
|
@@ -65,4 +66,9 @@ export { fontFamilies } from '@leafygreen-ui/tokens';
|
|
|
65
66
|
export { default as BSONValue } from './components/bson-value';
|
|
66
67
|
export * as DocumentList from './components/document-list';
|
|
67
68
|
export { KeylineCard } from './components/keyline-card';
|
|
69
|
+
export { variantColors as codePalette } from '@leafygreen-ui/code';
|
|
70
|
+
export { useEffectOnChange } from './hooks/use-effect-on-change';
|
|
71
|
+
export { HorizontalRule } from './components/horizontal-rule';
|
|
72
|
+
export { IndexKeysBadge } from './components/index-keys-badge';
|
|
73
|
+
export { Combobox, ComboboxOption, ComboboxGroup } from './components/combobox';
|
|
68
74
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AAExC,OAAO,EACL,OAAO,IAAI,OAAO,EAClB,KAAK,EACL,OAAO,EACP,EAAE,EACF,KAAK,EACL,mBAAmB,EACnB,YAAY,EACZ,SAAS,EACT,GAAG,EACH,KAAK,EACL,KAAK,GACN,MAAM,wBAAwB,CAAC;AAChC,OAAO,YAAY,MAAM,4BAA4B,CAAC;AACtD,OAAO,iBAAiB,MAAM,wCAAwC,CAAC;AACvE,OAAO,SAAS,EAAE,EAChB,yBAAyB,EACzB,8BAA8B,EAC9B,8BAA8B,EAC9B,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EACL,YAAY,EACZ,cAAc,EACf,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAC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