@mackin.com/styleguide 11.0.11 → 11.0.12

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.esm.js +33 -50
  2. package/index.js +33 -50
  3. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -1614,55 +1614,37 @@ const Checkbox = (props) => {
1614
1614
  finalCheckedColor = checkedColor;
1615
1615
  }
1616
1616
  }
1617
- const checkboxStyles = css `
1618
- display: inline-block;
1619
- ${!props.disabled && !readOnly && `
1620
- &:hover {
1621
- filter: ${theme.controls.hoverBrightness};
1622
- }
1623
- `}
1624
- `;
1625
- const labelStyles = css `
1626
- cursor: pointer;
1627
- user-select: none;
1628
- display: flex;
1629
- align-items: center;
1630
- ${props.disabled && `
1631
- cursor: not-allowed;
1632
- `}
1633
- ${readOnly && `
1634
- cursor: default;
1635
- `}
1636
- `;
1637
- // had to reference a marker class ('checkboxIcon') here for the sibling selector to work.
1638
- // opacity: 0 required for firefox. ignores the width of 0.
1639
- const nativeCheckboxStyles = css `
1640
- margin: 0;
1641
- padding: 0;
1642
- width: 0;
1643
- opacity: 0;
1644
-
1645
- ${!readOnly && `
1646
- &:focus + .checkboxIcon {
1647
- box-shadow: ${theme.controls.focusOutlineShadow};
1648
- }
1649
- `}
1650
- `;
1651
- const iconStyles = css `
1652
- ${!!label && !hideLabel && `
1653
- margin-right: 0.5rem;
1654
- `}
1655
- ${props.disabled && `
1656
- background-color: ${theme.colors.disabled};
1657
- cursor: not-allowed;
1658
- `}
1659
- ${readOnly && `
1660
- cursor: default;
1661
- `}
1662
- ${props.checked && `
1663
- color: ${finalCheckedColor}
1664
- `}
1665
- `;
1617
+ const checkboxStyles = css({
1618
+ display: 'inline-block',
1619
+ '&:hover': (!props.disabled && !readOnly) ? {
1620
+ filter: theme.controls.hoverBrightness
1621
+ } : undefined
1622
+ });
1623
+ const cursor = props.disabled ? 'not-allowed' : props.readOnly ? 'default' : 'pointer';
1624
+ const labelStyles = css({
1625
+ cursor,
1626
+ userSelect: 'none',
1627
+ display: 'flex',
1628
+ alignItems: 'center',
1629
+ position: 'relative'
1630
+ });
1631
+ const nativeCheckboxStyles = css({
1632
+ margin: 0,
1633
+ padding: 0,
1634
+ inset: 0,
1635
+ position: 'absolute',
1636
+ opacity: 0,
1637
+ cursor,
1638
+ '&:focus + .checkboxIcon': !readOnly ? {
1639
+ boxShadow: theme.controls.focusOutlineShadow
1640
+ } : undefined
1641
+ });
1642
+ const iconStyles = css({
1643
+ marginRight: (!!label && !hideLabel) ? '0.5rem' : undefined,
1644
+ backgroundColor: props.disabled ? theme.colors.disabled : undefined,
1645
+ cursor,
1646
+ color: props.checked ? finalCheckedColor : uncheckedIcon
1647
+ });
1666
1648
  return (React.createElement("span", { className: cx('checkbox', checkboxStyles, props.className) },
1667
1649
  React.createElement("label", { className: labelStyles },
1668
1650
  React.createElement("input", Object.assign({}, inputProps, { "aria-label": hideLabel ? label : undefined, tabIndex: readOnly ? -1 : (_a = props.tabIndex) !== null && _a !== void 0 ? _a : undefined, className: nativeCheckboxStyles, type: "checkbox", onChange: e => {
@@ -4160,6 +4142,7 @@ const Slider = (p) => {
4160
4142
  width: '100%'
4161
4143
  }, p.innerTrackClassName && rest.key === 'track-1' && Array.isArray(p.value) ? p.innerTrackClassName : undefined) })));
4162
4144
  }, renderThumb: (props, state) => {
4145
+ var _a;
4163
4146
  const { className } = props, rest = __rest(props, ["className"]);
4164
4147
  let specificThumbStyles;
4165
4148
  if (p.handle1ClassName && props.key === 'thumb-0') {
@@ -4189,7 +4172,7 @@ const Slider = (p) => {
4189
4172
  }), specificThumbStyles, p.handleClassName, css({
4190
4173
  width: sliderHandleSize,
4191
4174
  height: sliderHandleSize,
4192
- })) }, rest, { tabIndex: p.tabIndex }), p.showValue && (React__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 }))));
4175
+ })) }, rest, { tabIndex: (_a = p.tabIndex) !== null && _a !== void 0 ? _a : 0 }), p.showValue && (React__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 }))));
4193
4176
  } })));
4194
4177
  };
4195
4178
  const rectsCollideX = (r1, r2) => {
package/index.js CHANGED
@@ -1632,55 +1632,37 @@ const Checkbox = (props) => {
1632
1632
  finalCheckedColor = checkedColor;
1633
1633
  }
1634
1634
  }
1635
- const checkboxStyles = css.css `
1636
- display: inline-block;
1637
- ${!props.disabled && !readOnly && `
1638
- &:hover {
1639
- filter: ${theme.controls.hoverBrightness};
1640
- }
1641
- `}
1642
- `;
1643
- const labelStyles = css.css `
1644
- cursor: pointer;
1645
- user-select: none;
1646
- display: flex;
1647
- align-items: center;
1648
- ${props.disabled && `
1649
- cursor: not-allowed;
1650
- `}
1651
- ${readOnly && `
1652
- cursor: default;
1653
- `}
1654
- `;
1655
- // had to reference a marker class ('checkboxIcon') here for the sibling selector to work.
1656
- // opacity: 0 required for firefox. ignores the width of 0.
1657
- const nativeCheckboxStyles = css.css `
1658
- margin: 0;
1659
- padding: 0;
1660
- width: 0;
1661
- opacity: 0;
1662
-
1663
- ${!readOnly && `
1664
- &:focus + .checkboxIcon {
1665
- box-shadow: ${theme.controls.focusOutlineShadow};
1666
- }
1667
- `}
1668
- `;
1669
- const iconStyles = css.css `
1670
- ${!!label && !hideLabel && `
1671
- margin-right: 0.5rem;
1672
- `}
1673
- ${props.disabled && `
1674
- background-color: ${theme.colors.disabled};
1675
- cursor: not-allowed;
1676
- `}
1677
- ${readOnly && `
1678
- cursor: default;
1679
- `}
1680
- ${props.checked && `
1681
- color: ${finalCheckedColor}
1682
- `}
1683
- `;
1635
+ const checkboxStyles = css.css({
1636
+ display: 'inline-block',
1637
+ '&:hover': (!props.disabled && !readOnly) ? {
1638
+ filter: theme.controls.hoverBrightness
1639
+ } : undefined
1640
+ });
1641
+ const cursor = props.disabled ? 'not-allowed' : props.readOnly ? 'default' : 'pointer';
1642
+ const labelStyles = css.css({
1643
+ cursor,
1644
+ userSelect: 'none',
1645
+ display: 'flex',
1646
+ alignItems: 'center',
1647
+ position: 'relative'
1648
+ });
1649
+ const nativeCheckboxStyles = css.css({
1650
+ margin: 0,
1651
+ padding: 0,
1652
+ inset: 0,
1653
+ position: 'absolute',
1654
+ opacity: 0,
1655
+ cursor,
1656
+ '&:focus + .checkboxIcon': !readOnly ? {
1657
+ boxShadow: theme.controls.focusOutlineShadow
1658
+ } : undefined
1659
+ });
1660
+ const iconStyles = css.css({
1661
+ marginRight: (!!label && !hideLabel) ? '0.5rem' : undefined,
1662
+ backgroundColor: props.disabled ? theme.colors.disabled : undefined,
1663
+ cursor,
1664
+ color: props.checked ? finalCheckedColor : uncheckedIcon
1665
+ });
1684
1666
  return (React__namespace.createElement("span", { className: css.cx('checkbox', checkboxStyles, props.className) },
1685
1667
  React__namespace.createElement("label", { className: labelStyles },
1686
1668
  React__namespace.createElement("input", Object.assign({}, inputProps, { "aria-label": hideLabel ? label : undefined, tabIndex: readOnly ? -1 : (_a = props.tabIndex) !== null && _a !== void 0 ? _a : undefined, className: nativeCheckboxStyles, type: "checkbox", onChange: e => {
@@ -4178,6 +4160,7 @@ const Slider = (p) => {
4178
4160
  width: '100%'
4179
4161
  }, p.innerTrackClassName && rest.key === 'track-1' && Array.isArray(p.value) ? p.innerTrackClassName : undefined) })));
4180
4162
  }, renderThumb: (props, state) => {
4163
+ var _a;
4181
4164
  const { className } = props, rest = __rest(props, ["className"]);
4182
4165
  let specificThumbStyles;
4183
4166
  if (p.handle1ClassName && props.key === 'thumb-0') {
@@ -4207,7 +4190,7 @@ const Slider = (p) => {
4207
4190
  }), specificThumbStyles, p.handleClassName, css.css({
4208
4191
  width: sliderHandleSize,
4209
4192
  height: sliderHandleSize,
4210
- })) }, rest, { tabIndex: p.tabIndex }), p.showValue && (React.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 }))));
4193
+ })) }, rest, { tabIndex: (_a = p.tabIndex) !== null && _a !== void 0 ? _a : 0 }), p.showValue && (React.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 }))));
4211
4194
  } })));
4212
4195
  };
4213
4196
  const rectsCollideX = (r1, r2) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mackin.com/styleguide",
3
- "version": "11.0.11",
3
+ "version": "11.0.12",
4
4
  "description": "",
5
5
  "main": "./index.js",
6
6
  "module": "./index.esm.js",