@databricks/design-system 1.1.0 → 1.2.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/dist/.pkgr-sources-hash +1 -1
- package/dist/cjs/index.js +71 -21
- package/dist/cjs/index.js.map +1 -1
- package/dist/design-system/Hooks/index.d.ts +1 -0
- package/dist/design-system/Hooks/useThemedStyles.d.ts +28 -0
- package/dist/index-dark.css +294 -294
- package/dist/index.css +294 -294
- package/dist/index.js +70 -22
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/.pkgr-sources-hash
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
ead5d859c202d8833a0eb8bb3fb78300
|
package/dist/cjs/index.js
CHANGED
|
@@ -209,6 +209,7 @@ exports.getPaginationEmotionStyles = getPaginationEmotionStyles;
|
|
|
209
209
|
exports.getTabEmotionStyles = void 0;
|
|
210
210
|
exports.useDesignSystemTheme = useDesignSystemTheme;
|
|
211
211
|
exports.useNotification = useNotification;
|
|
212
|
+
exports.useThemedStyles = void 0;
|
|
212
213
|
|
|
213
214
|
var React = _interopRequireWildcard(require("react"));
|
|
214
215
|
|
|
@@ -52660,15 +52661,15 @@ const antdGeneralVariables = {
|
|
|
52660
52661
|
buttonInnerHeight: heightBase - spacing$1.sm * 2 - borderWidth * 2
|
|
52661
52662
|
};
|
|
52662
52663
|
var generalVariables = antdGeneralVariables;
|
|
52663
|
-
const FONT_SIZE_BASE =
|
|
52664
|
+
const FONT_SIZE_BASE = 13; // Less variables that are used by AntD
|
|
52664
52665
|
|
|
52665
52666
|
const antdTypography = {
|
|
52666
|
-
fontSizeSm:
|
|
52667
|
+
fontSizeSm: FONT_SIZE_BASE - 2,
|
|
52667
52668
|
fontSizeBase: FONT_SIZE_BASE,
|
|
52668
52669
|
fontSizeMd: FONT_SIZE_BASE,
|
|
52669
|
-
fontSizeLg:
|
|
52670
|
-
fontSizeXl:
|
|
52671
|
-
fontSizeXxl:
|
|
52670
|
+
fontSizeLg: FONT_SIZE_BASE + 6,
|
|
52671
|
+
fontSizeXl: FONT_SIZE_BASE + 8,
|
|
52672
|
+
fontSizeXxl: FONT_SIZE_BASE + 18,
|
|
52672
52673
|
lineHeightSm: '16px',
|
|
52673
52674
|
lineHeightBase: '20px',
|
|
52674
52675
|
lineHeightMd: '20px',
|
|
@@ -52741,7 +52742,45 @@ function WithDesignSystemThemeHoc(Component) {
|
|
|
52741
52742
|
});
|
|
52742
52743
|
};
|
|
52743
52744
|
}
|
|
52745
|
+
/**
|
|
52746
|
+
* A helper hook that allows quick creation of theme-dependent styles.
|
|
52747
|
+
* Results in more compact code than using useMemo and
|
|
52748
|
+
* useDesignSystemTheme separately.
|
|
52749
|
+
*
|
|
52750
|
+
* @example
|
|
52751
|
+
* const styles = useThemedStyles((theme) => ({
|
|
52752
|
+
* overlay: {
|
|
52753
|
+
* backgroundColor: theme.colors.backgroundPrimary,
|
|
52754
|
+
* borderRadius: theme.borders.borderRadiusMd,
|
|
52755
|
+
* },
|
|
52756
|
+
* wrapper: {
|
|
52757
|
+
* display: 'flex',
|
|
52758
|
+
* gap: theme.spacing.md,
|
|
52759
|
+
* },
|
|
52760
|
+
* }));
|
|
52761
|
+
|
|
52762
|
+
* <div css={styles.overlay}>...</div>
|
|
52763
|
+
*
|
|
52764
|
+
* @param styleFactory Factory function that accepts theme object as a parameter and returns
|
|
52765
|
+
* the style object. **Note**: factory function body is being memoized internally and is intended
|
|
52766
|
+
* to be used only for simple style objects that depend solely on the theme. If you want to use
|
|
52767
|
+
* styles that change depending on external values (state, props etc.) you should use
|
|
52768
|
+
* `useDesignSystemTheme` directly with your own reaction mechanism.
|
|
52769
|
+
* @returns The constructed style object
|
|
52770
|
+
*/
|
|
52771
|
+
|
|
52744
52772
|
|
|
52773
|
+
const useThemedStyles = styleFactory => {
|
|
52774
|
+
const {
|
|
52775
|
+
theme
|
|
52776
|
+
} = useDesignSystemTheme(); // We can assume that the factory function won't change and we're
|
|
52777
|
+
// observing theme changes only.
|
|
52778
|
+
|
|
52779
|
+
const styleFactoryRef = (0, React.useRef)(styleFactory);
|
|
52780
|
+
return (0, React.useMemo)(() => styleFactoryRef.current(theme), [theme]);
|
|
52781
|
+
};
|
|
52782
|
+
|
|
52783
|
+
exports.useThemedStyles = useThemedStyles;
|
|
52745
52784
|
const DuboisContextDefaults = {
|
|
52746
52785
|
enableAnimation: false,
|
|
52747
52786
|
theme: 'default',
|
|
@@ -53642,6 +53681,12 @@ function getCollapseEmotionStyles(clsPrefix, theme) {
|
|
|
53642
53681
|
[classContentBox]: {
|
|
53643
53682
|
padding: '8px 16px 16px'
|
|
53644
53683
|
},
|
|
53684
|
+
...(theme.options.isCompact && {
|
|
53685
|
+
["& > ".concat(classItem, " > ").concat(classHeader)]: {
|
|
53686
|
+
padding: '6px 44px 6px 0',
|
|
53687
|
+
lineHeight: theme.typography.lineHeightBase
|
|
53688
|
+
}
|
|
53689
|
+
}),
|
|
53645
53690
|
...getAnimationCss(theme.options.enableAnimation)
|
|
53646
53691
|
};
|
|
53647
53692
|
return (
|
|
@@ -54286,7 +54331,7 @@ var DropdownMenu = /*#__PURE__*/Object.freeze({
|
|
|
54286
54331
|
});
|
|
54287
54332
|
exports.DropdownMenu = DropdownMenu;
|
|
54288
54333
|
|
|
54289
|
-
const
|
|
54334
|
+
const getFormItemEmotionStyles = _ref => {
|
|
54290
54335
|
let {
|
|
54291
54336
|
theme,
|
|
54292
54337
|
clsPrefix
|
|
@@ -54304,7 +54349,8 @@ const getFormEmotionStyles = _ref => {
|
|
|
54304
54349
|
lineHeight: theme.typography.lineHeightBase
|
|
54305
54350
|
},
|
|
54306
54351
|
[clsFormItemExplain]: {
|
|
54307
|
-
fontSize: theme.typography.fontSizeSm
|
|
54352
|
+
fontSize: theme.typography.fontSizeSm,
|
|
54353
|
+
margin: 0
|
|
54308
54354
|
},
|
|
54309
54355
|
[clsFormItemInputControl]: {
|
|
54310
54356
|
minHeight: theme.options.isCompact ? theme.general.heightSm : theme.general.heightBase
|
|
@@ -54313,7 +54359,7 @@ const getFormEmotionStyles = _ref => {
|
|
|
54313
54359
|
border: 'none'
|
|
54314
54360
|
},
|
|
54315
54361
|
...getAnimationCss(theme.options.enableAnimation)
|
|
54316
|
-
}, process.env.NODE_ENV === "production" ? "" : ";label:
|
|
54362
|
+
}, process.env.NODE_ENV === "production" ? "" : ";label:getFormItemEmotionStyles;", process.env.NODE_ENV === "production" ? "" : ";label:getFormItemEmotionStyles;")
|
|
54317
54363
|
);
|
|
54318
54364
|
};
|
|
54319
54365
|
|
|
@@ -54322,27 +54368,29 @@ const FormDubois = /*#__PURE__*/(0, React.forwardRef)(function Form(_ref2, ref)
|
|
|
54322
54368
|
dangerouslySetAntdProps,
|
|
54323
54369
|
...props
|
|
54324
54370
|
} = _ref2;
|
|
54325
|
-
const {
|
|
54326
|
-
theme,
|
|
54327
|
-
classNamePrefix
|
|
54328
|
-
} = useDesignSystemTheme();
|
|
54329
54371
|
const mergedProps = { ...props,
|
|
54330
54372
|
layout: props.layout || 'vertical',
|
|
54331
54373
|
requiredMark: props.requiredMark || false
|
|
54332
54374
|
};
|
|
54333
54375
|
return (0, _jsxRuntime.jsx)(AntDForm, { ...mergedProps,
|
|
54334
54376
|
ref: ref,
|
|
54335
|
-
css: getFormEmotionStyles({
|
|
54336
|
-
theme,
|
|
54337
|
-
clsPrefix: classNamePrefix
|
|
54338
|
-
}),
|
|
54339
54377
|
...dangerouslySetAntdProps
|
|
54340
54378
|
});
|
|
54341
54379
|
});
|
|
54342
54380
|
exports.FormDubois = FormDubois;
|
|
54343
54381
|
|
|
54344
|
-
const FormItem = props =>
|
|
54345
|
-
|
|
54382
|
+
const FormItem = props => {
|
|
54383
|
+
const {
|
|
54384
|
+
theme,
|
|
54385
|
+
classNamePrefix
|
|
54386
|
+
} = useDesignSystemTheme();
|
|
54387
|
+
return (0, _jsxRuntime.jsx)(AntDForm.Item, { ...props,
|
|
54388
|
+
css: getFormItemEmotionStyles({
|
|
54389
|
+
theme,
|
|
54390
|
+
clsPrefix: classNamePrefix
|
|
54391
|
+
})
|
|
54392
|
+
});
|
|
54393
|
+
};
|
|
54346
54394
|
|
|
54347
54395
|
const FormNamespace = Object.assign(FormDubois, {
|
|
54348
54396
|
Item: FormItem,
|
|
@@ -54780,7 +54828,6 @@ const getModalEmotionStyles = args => {
|
|
|
54780
54828
|
/*#__PURE__*/
|
|
54781
54829
|
(0, _react2.css)({
|
|
54782
54830
|
[classNameHeader]: {
|
|
54783
|
-
height: headerHeight,
|
|
54784
54831
|
paddingTop: theme.options.isCompact ? theme.spacing.md : MODAL_PADDING$1,
|
|
54785
54832
|
paddingLeft: theme.options.isCompact ? theme.spacing.lg : MODAL_PADDING$1,
|
|
54786
54833
|
paddingRight: theme.options.isCompact ? theme.spacing.md : MODAL_PADDING$1,
|
|
@@ -54835,9 +54882,10 @@ const getModalEmotionStyles = args => {
|
|
|
54835
54882
|
fontSize: theme.typography.fontSizeXl,
|
|
54836
54883
|
lineHeight: theme.typography.lineHeightXl,
|
|
54837
54884
|
fontWeight: theme.typography.typographyBoldFontWeight,
|
|
54885
|
+
paddingRight: MODAL_PADDING$1,
|
|
54838
54886
|
// Don't impact regular size
|
|
54839
54887
|
...(theme.options.isCompact && {
|
|
54840
|
-
|
|
54888
|
+
minHeight: headerHeight / 2,
|
|
54841
54889
|
display: 'flex',
|
|
54842
54890
|
alignItems: 'center'
|
|
54843
54891
|
})
|
|
@@ -54846,7 +54894,9 @@ const getModalEmotionStyles = args => {
|
|
|
54846
54894
|
maxHeight: modalMaxHeight,
|
|
54847
54895
|
height: maxedOutHeight ? modalMaxHeight : '',
|
|
54848
54896
|
overflow: 'hidden',
|
|
54849
|
-
paddingBottom: contentBottomPadding
|
|
54897
|
+
paddingBottom: contentBottomPadding,
|
|
54898
|
+
display: 'flex',
|
|
54899
|
+
flexDirection: 'column'
|
|
54850
54900
|
},
|
|
54851
54901
|
[classNameBody]: {
|
|
54852
54902
|
overflowY: 'auto',
|