@mackin.com/styleguide 6.0.2 → 6.1.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/index.d.ts +2 -0
- package/index.js +9 -7
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -939,6 +939,8 @@ interface SliderProps<T extends SliderValue> {
|
|
|
939
939
|
onUpdate?: (value: T) => void;
|
|
940
940
|
/** Used with showValue. Will be called to render the display string. */
|
|
941
941
|
renderValue?: (value: number) => string;
|
|
942
|
+
/** Used with renderValue for the custom element width. Defaults to theme.controls.height * 2. */
|
|
943
|
+
renderValueWidth?: string;
|
|
942
944
|
}
|
|
943
945
|
declare const Slider: <T extends SliderValue>(p: SliderProps<T>) => jsx.JSX.Element;
|
|
944
946
|
|
package/index.js
CHANGED
|
@@ -1835,6 +1835,7 @@ const FormColumnRow = (props) => {
|
|
|
1835
1835
|
};
|
|
1836
1836
|
|
|
1837
1837
|
/** @jsx jsx */
|
|
1838
|
+
//TB: have a sticky variant
|
|
1838
1839
|
const Header = (props) => {
|
|
1839
1840
|
const theme = useThemeSafely();
|
|
1840
1841
|
const bodyStyles = css.css `
|
|
@@ -3217,21 +3218,22 @@ const Slider = (p) => {
|
|
|
3217
3218
|
'&:hover': {
|
|
3218
3219
|
filter: theme.controls.hoverBrightness
|
|
3219
3220
|
}
|
|
3220
|
-
} }, props), p.showValue && react.jsx(HandleText, { value: currentValue.current, index: state.index, renderValue: p.renderValue })));
|
|
3221
|
+
} }, props), p.showValue && react.jsx(HandleText, { value: currentValue.current, index: state.index, renderValue: p.renderValue, renderValueWidth: p.renderValueWidth })));
|
|
3221
3222
|
} })));
|
|
3222
3223
|
};
|
|
3223
3224
|
const HandleText = (p) => {
|
|
3224
|
-
var _a, _b, _c;
|
|
3225
|
+
var _a, _b, _c, _d;
|
|
3225
3226
|
const theme = useThemeSafely();
|
|
3226
3227
|
const value = Array.isArray(p.value) ? p.value[(_a = p.index) !== null && _a !== void 0 ? _a : 0] : p.value;
|
|
3227
3228
|
const displayValue = (_c = (_b = p.renderValue) === null || _b === void 0 ? void 0 : _b.call(p, value)) !== null && _c !== void 0 ? _c : value;
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3229
|
+
const renderValueWidth = (_d = p.renderValueWidth) !== null && _d !== void 0 ? _d : theme.controls.height;
|
|
3230
|
+
const renderValueLeft = `calc(${renderValueWidth} * 0.5 * -1 + (${theme.controls.height} * 0.5))`;
|
|
3231
|
+
return (react.jsx(Text, { ellipsis: true, css: {
|
|
3232
|
+
width: renderValueWidth,
|
|
3233
|
+
left: renderValueLeft,
|
|
3232
3234
|
bottom: '-1.5rem',
|
|
3233
3235
|
position: 'absolute',
|
|
3234
|
-
overflow: 'hidden'
|
|
3236
|
+
overflow: 'hidden',
|
|
3235
3237
|
}, tag: "div", align: "center" }, displayValue));
|
|
3236
3238
|
};
|
|
3237
3239
|
|