@mackin.com/styleguide 8.9.3 → 8.10.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.
Files changed (3) hide show
  1. package/index.d.ts +8 -4
  2. package/index.js +26 -18
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -882,18 +882,22 @@ interface SliderProps<T extends SliderValue> {
882
882
  renderValue?: (value: number) => string;
883
883
  /** Used with renderValue for the custom element width. Defaults to theme.controls.height * 2. */
884
884
  renderValueWidth?: string;
885
+ /** The with and height of the handles. Defaults to theme.controls.height. Do not use css to change the handle sizes. */
886
+ sliderHandleSize?: string;
885
887
  /** Styles of the overall slider. */
886
888
  className?: string;
887
- /** Styles for the slider handles. */
889
+ /** Styles for the slider handles. Do not use css to change the handle sizes. Use 'sliderHandleSize'. */
888
890
  handleClassName?: string;
889
- /** Styles for the first handle. */
891
+ /** Styles for the first handle. Do not use css to change the handle sizes. Use 'sliderHandleSize'. */
890
892
  handle1ClassName?: string;
891
- /** Styles for the second handle. Ignored if the value is not an array. */
893
+ /** Styles for the second handle. Ignored if the value is not an array. Do not use css to change the handle sizes. Use 'sliderHandleSize'. */
892
894
  handle2ClassName?: string;
893
895
  /** Styles of the track. */
894
896
  trackClassName?: string;
895
897
  /** Styles applied to the track between two handlers. Ignored if the value is not an array. */
896
898
  innerTrackClassName?: string;
899
+ /** Styles applied to the floating handle text with using 'showValue'. */
900
+ sliderTextClassName?: string;
897
901
  }
898
902
  declare const Slider: <T extends SliderValue>(p: SliderProps<T>) => JSX.Element;
899
903
 
@@ -1140,4 +1144,4 @@ interface TabContainerProps {
1140
1144
  }
1141
1145
  declare const TabContainer: (p: TabContainerProps) => JSX.Element;
1142
1146
 
1143
- export { Accordian, AccordianProps, Alignment, Autocomplete, AutocompleteProps, AutocompleteValue, Backdrop$1 as Backdrop, Backdrop as Backdrop2, BoundMemoryPager, BoundStaticPager, Button, ButtonProps, Calendar, CalendarProps, Checkbox, CheckboxProps, ConfirmModal, ConfirmModalProps, CopyButton, DateInput, DateInputProps, Divider, ErrorModal, FileUploader, Form, FormColumnRow, FormFlexRow, FormProps, GlobalStyles, Header, Highlight, ICONS, Icon, Image, ImageProps, InfoPanel, InfoTip, InfoTipProps, Input, InputProps, ItemPager, Label, LabelProps, Link, LinkProps, List, ListItem, ListItemProps, ListProps, MackinTheme, Modal, ModalProps, Nav, NormalizeCss, NumberInput, NumberInputProps, OmniLink, OmniLinkProps, PagedResult, Pager, PagerProps, Picker, PickerOption, PickerProps, PickerValue, Popover, ProgressBar, ProgressBarProps, SearchBox, SearchBoxProps, Slider, TabContainer, TabContainerProps, TabHeader, TabHeaderProps, TabLocker, Table, Td, TdCurrency, TdNumber, Text, TextArea, TextAreaProps, TextInput, TextInputProps, TextProps, Th, ThSort, ThemeProvider, ThemeRenderer, ToggleButton, ToggleButtonGroup, ToggleButtonGroupProps, ToggleButtonProps, TogglePasswordInput, Tr, WaitingIndicator, calcDynamicThemeProps, defaultTheme, enumToEntities, getCurrencyDisplay, getFileSizeDisplay, modalScrollFixClassName, useAccordianState, useBooleanChanged, useIgnoreMount, useMediaQuery, useScrollbarSize, useThemeSafely, useWaiting };
1147
+ export { Accordian, AccordianProps, Alignment, Autocomplete, AutocompleteProps, AutocompleteValue, Backdrop$1 as Backdrop, Backdrop as Backdrop2, BoundMemoryPager, BoundStaticPager, Button, ButtonProps, Calendar, CalendarProps, Checkbox, CheckboxProps, ConfirmModal, ConfirmModalProps, CopyButton, DateInput, DateInputProps, Divider, ErrorModal, FileUploader, Form, FormColumnRow, FormFlexRow, FormProps, GlobalStyles, Header, Highlight, ICONS, Icon, Image, ImageProps, InfoPanel, InfoTip, InfoTipProps, Input, InputProps, ItemPager, Label, LabelProps, Link, LinkProps, List, ListItem, ListItemProps, ListProps, MackinTheme, Modal, ModalProps, Nav, NormalizeCss, NumberInput, NumberInputProps, OmniLink, OmniLinkProps, PagedResult, Pager, PagerProps, Picker, PickerOption, PickerProps, PickerValue, Popover, ProgressBar, ProgressBarProps, SearchBox, SearchBoxProps, Slider, SliderProps, SliderValue, TabContainer, TabContainerProps, TabHeader, TabHeaderProps, TabLocker, Table, Td, TdCurrency, TdNumber, Text, TextArea, TextAreaProps, TextInput, TextInputProps, TextProps, Th, ThSort, ThemeProvider, ThemeRenderer, ToggleButton, ToggleButtonGroup, ToggleButtonGroupProps, ToggleButtonProps, TogglePasswordInput, Tr, WaitingIndicator, calcDynamicThemeProps, defaultTheme, enumToEntities, getCurrencyDisplay, getFileSizeDisplay, modalScrollFixClassName, useAccordianState, useBooleanChanged, useIgnoreMount, useMediaQuery, useScrollbarSize, useThemeSafely, useWaiting };
package/index.js CHANGED
@@ -3215,8 +3215,6 @@ const OmniLink = (props) => {
3215
3215
  };
3216
3216
 
3217
3217
  const roundPxPadding = '4px';
3218
- //TB: needs to be 2rem padding for right caret
3219
- //TB: the generated border is bad (border: 1pxsolidrgba(0, 0, 0, 0.125);)
3220
3218
  const Picker = (props) => {
3221
3219
  const selectProps = __rest(props
3222
3220
  // if we put numbers in, we expect them out
@@ -3316,6 +3314,13 @@ const Picker = (props) => {
3316
3314
  }
3317
3315
  return React__namespace.createElement("option", { key: val, value: val }, label);
3318
3316
  })));
3317
+ let iconHeight;
3318
+ if (props.controlAlign) {
3319
+ iconHeight = `calc(100% - ${theme.controls.inputErrorMinHeight})`;
3320
+ }
3321
+ else {
3322
+ iconHeight = '100%';
3323
+ }
3319
3324
  return (React__namespace.createElement("span", { className: css.cx(css.css({
3320
3325
  label: 'PickerWrapper',
3321
3326
  position: 'relative',
@@ -3327,7 +3332,7 @@ const Picker = (props) => {
3327
3332
  !props.readOnly && (React__namespace.createElement(Icon, { id: "sortDesc", className: css.cx(css.css({
3328
3333
  position: 'absolute',
3329
3334
  right: `calc(${theme.controls.padding} + ${props.round ? roundPxPadding : '0px'})`,
3330
- height: '100%',
3335
+ height: iconHeight,
3331
3336
  pointerEvents: 'none',
3332
3337
  color: theme.colors.font
3333
3338
  }), props.iconClassName) }))));
@@ -3876,10 +3881,12 @@ const GlobalStyles = (p) => {
3876
3881
  };
3877
3882
 
3878
3883
  const Slider = (p) => {
3884
+ var _a;
3879
3885
  const theme = useThemeSafely();
3880
3886
  const currentValue = React.useRef(p.value);
3881
3887
  const sliderContainer = React.useRef(null);
3882
- const height = p.showValue ? `calc(${theme.controls.height} + 1.5rem)` : theme.controls.height;
3888
+ const sliderHandleSize = (_a = p.sliderHandleSize) !== null && _a !== void 0 ? _a : theme.controls.height;
3889
+ const height = p.showValue ? `calc(${sliderHandleSize} + 1.5rem)` : sliderHandleSize;
3883
3890
  return (React__default['default'].createElement("div", { ref: sliderContainer, className: css.cx(css.css({
3884
3891
  label: 'Slider',
3885
3892
  width: '100%',
@@ -3893,17 +3900,17 @@ const Slider = (p) => {
3893
3900
  (_a = p.onUpdate) === null || _a === void 0 ? void 0 : _a.call(p, value);
3894
3901
  } : undefined, renderTrack: (props, state) => {
3895
3902
  const { className } = props, rest = __rest(props, ["className"]);
3896
- return React__default['default'].createElement("div", Object.assign({ className: css.cx(className, css.css({
3903
+ return (React__default['default'].createElement("div", Object.assign({ className: css.cx(className, p.trackClassName, css.css({
3897
3904
  display: 'flex',
3898
3905
  alignItems: 'center',
3899
- height: theme.controls.height
3900
- }), p.trackClassName) }, rest),
3906
+ height: sliderHandleSize
3907
+ })) }, rest),
3901
3908
  React__default['default'].createElement("div", { className: css.css({
3902
3909
  backgroundColor: theme.colors.secondary,
3903
- height: `calc(${theme.controls.height} / 4)`,
3910
+ height: `calc(${sliderHandleSize} / 4)`,
3904
3911
  borderRadius: theme.controls.roundRadius,
3905
3912
  width: '100%'
3906
- }, p.innerTrackClassName && rest.key === 'track-1' && Array.isArray(p.value) ? p.innerTrackClassName : undefined) }));
3913
+ }, p.innerTrackClassName && rest.key === 'track-1' && Array.isArray(p.value) ? p.innerTrackClassName : undefined) })));
3907
3914
  }, renderThumb: (props, state) => {
3908
3915
  const { className } = props, rest = __rest(props, ["className"]);
3909
3916
  let specificThumbStyles;
@@ -3914,8 +3921,6 @@ const Slider = (p) => {
3914
3921
  specificThumbStyles = p.handle2ClassName;
3915
3922
  }
3916
3923
  return (React__default['default'].createElement("div", Object.assign({ className: css.cx(className, css.css({
3917
- width: theme.controls.height,
3918
- height: theme.controls.height,
3919
3924
  borderRadius: theme.controls.roundRadius,
3920
3925
  backgroundColor: 'white',
3921
3926
  border: theme.controls.border,
@@ -3933,7 +3938,10 @@ const Slider = (p) => {
3933
3938
  '&:hover': {
3934
3939
  filter: theme.controls.hoverBrightness
3935
3940
  }
3936
- }), specificThumbStyles, p.handleClassName) }, rest), p.showValue && (React__default['default'].createElement(HandleText, { index: state.index, parentElement: sliderContainer.current, value: Array.isArray(currentValue.current) ? currentValue.current[state.index] : currentValue.current, renderValue: p.renderValue, renderValueWidth: p.renderValueWidth }))));
3941
+ }), specificThumbStyles, p.handleClassName, css.css({
3942
+ width: sliderHandleSize,
3943
+ height: sliderHandleSize,
3944
+ })) }, rest), p.showValue && (React__default['default'].createElement(HandleText, { sliderHandleSize: sliderHandleSize, className: p.sliderTextClassName, index: state.index, parentElement: sliderContainer.current, value: Array.isArray(currentValue.current) ? currentValue.current[state.index] : currentValue.current, renderValue: p.renderValue, renderValueWidth: p.renderValueWidth }))));
3937
3945
  } })));
3938
3946
  };
3939
3947
  const rectsCollideX = (r1, r2) => {
@@ -3947,13 +3955,13 @@ const rectsCollideX = (r1, r2) => {
3947
3955
  };
3948
3956
  const HandleText = (p) => {
3949
3957
  var _a, _b, _c;
3950
- const theme = useThemeSafely();
3951
3958
  const displayValue = (_b = (_a = p.renderValue) === null || _a === void 0 ? void 0 : _a.call(p, p.value)) !== null && _b !== void 0 ? _b : p.value;
3952
- const renderValueWidth = (_c = p.renderValueWidth) !== null && _c !== void 0 ? _c : theme.controls.height;
3959
+ const renderValueWidth = (_c = p.renderValueWidth) !== null && _c !== void 0 ? _c : p.sliderHandleSize;
3953
3960
  const renderValueLeft = React.useMemo(() => {
3954
- return `calc(${renderValueWidth} * 0.5 * -1 + (${theme.controls.height} * 0.5))`;
3961
+ return `calc(${renderValueWidth} * 0.5 * -1 + (${p.sliderHandleSize} * 0.5))`;
3955
3962
  }, [p.renderValueWidth]);
3956
3963
  const [flipText, setFlipText] = React.useState(false);
3964
+ const offset = '2px';
3957
3965
  React.useEffect(() => {
3958
3966
  // this needs to fire on every render due to the other handle also moving.
3959
3967
  var _a, _b;
@@ -3968,11 +3976,11 @@ const HandleText = (p) => {
3968
3976
  return (React__default['default'].createElement(Text, { ellipsis: true, className: css.cx('slider-handle', css.css({
3969
3977
  width: renderValueWidth,
3970
3978
  left: renderValueLeft,
3971
- top: flipText ? undefined : theme.controls.height,
3972
- bottom: flipText ? theme.controls.height : undefined,
3979
+ top: flipText ? undefined : `calc(${p.sliderHandleSize} + ${offset})`,
3980
+ bottom: flipText ? `calc(${p.sliderHandleSize} + ${offset})` : undefined,
3973
3981
  position: 'absolute',
3974
3982
  overflow: 'hidden',
3975
- })), tag: "div", align: "center" }, displayValue));
3983
+ }), p.className), tag: "div", align: "center" }, displayValue));
3976
3984
  };
3977
3985
 
3978
3986
  const TabHeader = (p) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mackin.com/styleguide",
3
- "version": "8.9.3",
3
+ "version": "8.10.0",
4
4
  "description": "",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",