orcs-design-system 2.0.68 → 2.0.69

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.
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- import React from "react";
3
+ import React, { useRef } from "react";
4
4
  import PropTypes from "prop-types";
5
5
  import styled, { keyframes, ThemeProvider } from "styled-components";
6
6
  import { space, layout } from "styled-system";
@@ -31,13 +31,13 @@ var Control = styled.input.attrs({
31
31
  }).withConfig({
32
32
  displayName: "Checkbox__Control",
33
33
  componentId: "p4d19b-2"
34
- })(["opacity:0;position:absolute;margin:0;z-index:-1;width:0;height:0;overflow:hidden;pointer-events:none;&:focus{+ div{border-radius:2px;box-shadow:", ";}}+ div{transition:", ";&:before{background-color:", ";}> div{color:", ";}}:not(:checked) + div:before{animation:", " 700ms forwards ease-out;}:checked + div:before{animation:", " 700ms forwards ease-out;}:focus + div div:after{opacity:0.2;}:checked{+ div div:before{box-shadow:0 0 0 10px,10px -10px 0 10px,32px 0px 0 20px,0px 32px 0 20px,-5px 5px 0 10px,20px -12px 0 11px;animation:", " 300ms forwards ease-out;}+ div div:after{animation:", " 700ms forwards ease-out;}}:not(:checked) + div div:after{animation:", " 700ms forwards ease-out;}+ div div:before{animation:", " 300ms forwards ease-out;}"], function (props) {
35
- return props.colour ? themeGet("shadows.thinOutline")(props) + " " + themeGet("colors." + props.colour + "30")(props) : themeGet("shadows.thinOutline")(props) + " " + themeGet("colors.black30");
34
+ })(["opacity:0;position:absolute;margin:0;z-index:-1;width:0;height:0;overflow:hidden;pointer-events:none;&:focus{+ div{border-radius:2px;box-shadow:", ";}}+ div{transition:", ";&:before{background-color:", ";}> div{color:", ";}}:focus + div div:after{opacity:0.2;}:checked{+ div div:before{box-shadow:0 0 0 10px,10px -10px 0 10px,32px 0px 0 20px,0px 32px 0 20px,-5px 5px 0 10px,20px -12px 0 11px;.animate&{animation:", " 300ms forwards ease-out;}}}&:not(:checked) + div div:before{.animate&{animation:", " 300ms forwards ease-out;}}"], function (props) {
35
+ return props.colour ? themeGet("shadows.thinOutline")(props) + " " + themeGet("colors." + props.colour + "30")(props) : themeGet("shadows.thinOutline")(props) + " " + themeGet("colors.black20")(props);
36
36
  }, themeGet("transition.transitionDefault"), function (props) {
37
37
  return props.colour ? themeGet("colors." + props.colour) : themeGet("colors.greyDarker");
38
38
  }, function (props) {
39
39
  return props.colour ? themeGet("colors." + props.colour) : themeGet("colors.greyDarker");
40
- }, rippleOff, rippleOn, checkboxOn, rippleOn, rippleOff, checkboxOff);
40
+ }, checkboxOn, checkboxOff);
41
41
  var Box = styled.div.withConfig({
42
42
  displayName: "Checkbox__Box",
43
43
  componentId: "p4d19b-3"
@@ -65,18 +65,40 @@ export default function Checkbox(_ref) {
65
65
  theme = _ref.theme,
66
66
  props = _objectWithoutProperties(_ref, ["name", "label", "colour", "disabled", "checked", "onClick", "onChange", "theme"]);
67
67
 
68
+ var inputRef = useRef(null);
69
+
70
+ var handleClick = function handleClick() {
71
+ if (!inputRef.current || disabled) {
72
+ return;
73
+ }
74
+
75
+ inputRef.current.classList.add("animate");
76
+ };
77
+
78
+ var handleAnimationEnd = function handleAnimationEnd() {
79
+ if (!inputRef.current || disabled) {
80
+ return;
81
+ }
82
+
83
+ inputRef.current.classList.remove("animate");
84
+ };
85
+
68
86
  return /*#__PURE__*/React.createElement(ThemeProvider, {
69
87
  theme: theme
70
88
  }, /*#__PURE__*/React.createElement(Item, _extends({
71
89
  colour: colour
72
- }, props), /*#__PURE__*/React.createElement(Label, {
90
+ }, props, {
91
+ onClick: handleClick,
92
+ onAnimationEnd: handleAnimationEnd
93
+ }), /*#__PURE__*/React.createElement(Label, {
73
94
  disabled: disabled
74
95
  }, /*#__PURE__*/React.createElement(Control, {
75
96
  name: name,
76
97
  colour: colour,
77
98
  disabled: disabled,
78
99
  checked: checked,
79
- onChange: onChange
100
+ onChange: onChange,
101
+ ref: inputRef
80
102
  }), /*#__PURE__*/React.createElement(Box, {
81
103
  colour: colour,
82
104
  onClick: onClick
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orcs-design-system",
3
- "version": "2.0.68",
3
+ "version": "2.0.69",
4
4
  "description": "Orchestrated's Design System, aka: ORCS",
5
5
  "keywords": [
6
6
  "design",