@mackin.com/styleguide 11.0.10 → 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 +36 -51
  2. package/index.js +36 -51
  3. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -1223,7 +1223,9 @@ const Autocomplete = (p) => {
1223
1223
  }), p.listClassName) },
1224
1224
  displayOptions.map((v, listItemIndex) => {
1225
1225
  const selected = selectedResultIndex === listItemIndex;
1226
- return (React.createElement(ListItem, { key: v, variant: "full", className: cx(listItemStyles, selected ? listItemFocusStyles : undefined, p.listItemClassName), role: "option", id: getOptionId(p.id, listItemIndex), "aria-selected": selected },
1226
+ return (React.createElement(ListItem, { key: v, variant: "full", className: cx(listItemStyles, selected ? listItemFocusStyles : undefined, p.listItemClassName), role: "option", id: getOptionId(p.id, listItemIndex), "aria-selected": selected, onClick: () => {
1227
+ onPickValue(v, true);
1228
+ } },
1227
1229
  React.createElement(Text, { tag: "div", ellipsis: true, align: "left", className: listItemTextStyles }, v)));
1228
1230
  }),
1229
1231
  !p.allowScroll && displayOptions.length < p.options.length && (React.createElement(ListItem, { className: p.listItemClassName },
@@ -1612,55 +1614,37 @@ const Checkbox = (props) => {
1612
1614
  finalCheckedColor = checkedColor;
1613
1615
  }
1614
1616
  }
1615
- const checkboxStyles = css `
1616
- display: inline-block;
1617
- ${!props.disabled && !readOnly && `
1618
- &:hover {
1619
- filter: ${theme.controls.hoverBrightness};
1620
- }
1621
- `}
1622
- `;
1623
- const labelStyles = css `
1624
- cursor: pointer;
1625
- user-select: none;
1626
- display: flex;
1627
- align-items: center;
1628
- ${props.disabled && `
1629
- cursor: not-allowed;
1630
- `}
1631
- ${readOnly && `
1632
- cursor: default;
1633
- `}
1634
- `;
1635
- // had to reference a marker class ('checkboxIcon') here for the sibling selector to work.
1636
- // opacity: 0 required for firefox. ignores the width of 0.
1637
- const nativeCheckboxStyles = css `
1638
- margin: 0;
1639
- padding: 0;
1640
- width: 0;
1641
- opacity: 0;
1642
-
1643
- ${!readOnly && `
1644
- &:focus + .checkboxIcon {
1645
- box-shadow: ${theme.controls.focusOutlineShadow};
1646
- }
1647
- `}
1648
- `;
1649
- const iconStyles = css `
1650
- ${!!label && !hideLabel && `
1651
- margin-right: 0.5rem;
1652
- `}
1653
- ${props.disabled && `
1654
- background-color: ${theme.colors.disabled};
1655
- cursor: not-allowed;
1656
- `}
1657
- ${readOnly && `
1658
- cursor: default;
1659
- `}
1660
- ${props.checked && `
1661
- color: ${finalCheckedColor}
1662
- `}
1663
- `;
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
+ });
1664
1648
  return (React.createElement("span", { className: cx('checkbox', checkboxStyles, props.className) },
1665
1649
  React.createElement("label", { className: labelStyles },
1666
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 => {
@@ -4158,6 +4142,7 @@ const Slider = (p) => {
4158
4142
  width: '100%'
4159
4143
  }, p.innerTrackClassName && rest.key === 'track-1' && Array.isArray(p.value) ? p.innerTrackClassName : undefined) })));
4160
4144
  }, renderThumb: (props, state) => {
4145
+ var _a;
4161
4146
  const { className } = props, rest = __rest(props, ["className"]);
4162
4147
  let specificThumbStyles;
4163
4148
  if (p.handle1ClassName && props.key === 'thumb-0') {
@@ -4187,7 +4172,7 @@ const Slider = (p) => {
4187
4172
  }), specificThumbStyles, p.handleClassName, css({
4188
4173
  width: sliderHandleSize,
4189
4174
  height: sliderHandleSize,
4190
- })) }, 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 }))));
4191
4176
  } })));
4192
4177
  };
4193
4178
  const rectsCollideX = (r1, r2) => {
package/index.js CHANGED
@@ -1241,7 +1241,9 @@ const Autocomplete = (p) => {
1241
1241
  }), p.listClassName) },
1242
1242
  displayOptions.map((v, listItemIndex) => {
1243
1243
  const selected = selectedResultIndex === listItemIndex;
1244
- return (React__namespace.createElement(ListItem, { key: v, variant: "full", className: css.cx(listItemStyles, selected ? listItemFocusStyles : undefined, p.listItemClassName), role: "option", id: getOptionId(p.id, listItemIndex), "aria-selected": selected },
1244
+ return (React__namespace.createElement(ListItem, { key: v, variant: "full", className: css.cx(listItemStyles, selected ? listItemFocusStyles : undefined, p.listItemClassName), role: "option", id: getOptionId(p.id, listItemIndex), "aria-selected": selected, onClick: () => {
1245
+ onPickValue(v, true);
1246
+ } },
1245
1247
  React__namespace.createElement(Text, { tag: "div", ellipsis: true, align: "left", className: listItemTextStyles }, v)));
1246
1248
  }),
1247
1249
  !p.allowScroll && displayOptions.length < p.options.length && (React__namespace.createElement(ListItem, { className: p.listItemClassName },
@@ -1630,55 +1632,37 @@ const Checkbox = (props) => {
1630
1632
  finalCheckedColor = checkedColor;
1631
1633
  }
1632
1634
  }
1633
- const checkboxStyles = css.css `
1634
- display: inline-block;
1635
- ${!props.disabled && !readOnly && `
1636
- &:hover {
1637
- filter: ${theme.controls.hoverBrightness};
1638
- }
1639
- `}
1640
- `;
1641
- const labelStyles = css.css `
1642
- cursor: pointer;
1643
- user-select: none;
1644
- display: flex;
1645
- align-items: center;
1646
- ${props.disabled && `
1647
- cursor: not-allowed;
1648
- `}
1649
- ${readOnly && `
1650
- cursor: default;
1651
- `}
1652
- `;
1653
- // had to reference a marker class ('checkboxIcon') here for the sibling selector to work.
1654
- // opacity: 0 required for firefox. ignores the width of 0.
1655
- const nativeCheckboxStyles = css.css `
1656
- margin: 0;
1657
- padding: 0;
1658
- width: 0;
1659
- opacity: 0;
1660
-
1661
- ${!readOnly && `
1662
- &:focus + .checkboxIcon {
1663
- box-shadow: ${theme.controls.focusOutlineShadow};
1664
- }
1665
- `}
1666
- `;
1667
- const iconStyles = css.css `
1668
- ${!!label && !hideLabel && `
1669
- margin-right: 0.5rem;
1670
- `}
1671
- ${props.disabled && `
1672
- background-color: ${theme.colors.disabled};
1673
- cursor: not-allowed;
1674
- `}
1675
- ${readOnly && `
1676
- cursor: default;
1677
- `}
1678
- ${props.checked && `
1679
- color: ${finalCheckedColor}
1680
- `}
1681
- `;
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
+ });
1682
1666
  return (React__namespace.createElement("span", { className: css.cx('checkbox', checkboxStyles, props.className) },
1683
1667
  React__namespace.createElement("label", { className: labelStyles },
1684
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 => {
@@ -4176,6 +4160,7 @@ const Slider = (p) => {
4176
4160
  width: '100%'
4177
4161
  }, p.innerTrackClassName && rest.key === 'track-1' && Array.isArray(p.value) ? p.innerTrackClassName : undefined) })));
4178
4162
  }, renderThumb: (props, state) => {
4163
+ var _a;
4179
4164
  const { className } = props, rest = __rest(props, ["className"]);
4180
4165
  let specificThumbStyles;
4181
4166
  if (p.handle1ClassName && props.key === 'thumb-0') {
@@ -4205,7 +4190,7 @@ const Slider = (p) => {
4205
4190
  }), specificThumbStyles, p.handleClassName, css.css({
4206
4191
  width: sliderHandleSize,
4207
4192
  height: sliderHandleSize,
4208
- })) }, 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 }))));
4209
4194
  } })));
4210
4195
  };
4211
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.10",
3
+ "version": "11.0.12",
4
4
  "description": "",
5
5
  "main": "./index.js",
6
6
  "module": "./index.esm.js",