@khanacademy/wonder-blocks-clickable 2.1.3 → 2.2.3
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/CHANGELOG.md +13 -0
- package/dist/es/index.js +27 -25
- package/dist/index.js +455 -160
- package/package.json +9 -10
- package/src/components/__tests__/clickable-behavior.test.js +47 -2
- package/src/components/__tests__/clickable.test.js +19 -12
- package/src/components/clickable-behavior.js +9 -9
- package/src/components/clickable.js +16 -13
- package/src/components/clickable.md +7 -0
- package/src/components/clickable.stories.js +8 -10
- package/src/util/get-clickable-behavior.js +2 -2
- package/LICENSE +0 -21
package/dist/index.js
CHANGED
|
@@ -82,7 +82,7 @@ module.exports =
|
|
|
82
82
|
/******/
|
|
83
83
|
/******/
|
|
84
84
|
/******/ // Load entry module and return exports
|
|
85
|
-
/******/ return __webpack_require__(__webpack_require__.s =
|
|
85
|
+
/******/ return __webpack_require__(__webpack_require__.s = 10);
|
|
86
86
|
/******/ })
|
|
87
87
|
/************************************************************************/
|
|
88
88
|
/******/ ([
|
|
@@ -166,7 +166,9 @@ const disabledHandlers = {
|
|
|
166
166
|
onKeyUp: () => void 0,
|
|
167
167
|
onFocus: () => void 0,
|
|
168
168
|
onBlur: () => void 0,
|
|
169
|
-
|
|
169
|
+
// Clickable components should still be tabbable so they can
|
|
170
|
+
// be used as anchors.
|
|
171
|
+
tabIndex: 0
|
|
170
172
|
};
|
|
171
173
|
const keyCodes = {
|
|
172
174
|
enter: 13,
|
|
@@ -252,8 +254,8 @@ const startState = {
|
|
|
252
254
|
* The react-router aware version is returned if `router` is a react-router-dom
|
|
253
255
|
* router, `skipClientNav` is not `true`, and `href` is an internal URL.
|
|
254
256
|
*
|
|
255
|
-
* The `router` can be accessed via
|
|
256
|
-
* rendered as a descendant of a BrowserRouter.
|
|
257
|
+
* The `router` can be accessed via __RouterContext (imported from 'react-router')
|
|
258
|
+
* from a component rendered as a descendant of a BrowserRouter.
|
|
257
259
|
* See https://reacttraining.com/react-router/web/guides/basic-components.
|
|
258
260
|
*/
|
|
259
261
|
|
|
@@ -628,8 +630,8 @@ ClickableBehavior.defaultProps = {
|
|
|
628
630
|
* The react-router aware version is returned if `router` is a react-router-dom
|
|
629
631
|
* router, `skipClientNav` is not `true`, and `href` is an internal URL.
|
|
630
632
|
*
|
|
631
|
-
* The `router` can be accessed via
|
|
632
|
-
* as a descendant of a BrowserRouter.
|
|
633
|
+
* The `router` can be accessed via __RouterContext (imported from 'react-router')
|
|
634
|
+
* from a component rendered as a descendant of a BrowserRouter.
|
|
633
635
|
* See https://reacttraining.com/react-router/web/guides/basic-components.
|
|
634
636
|
*/
|
|
635
637
|
|
|
@@ -675,141 +677,458 @@ module.exports = require("@khanacademy/wonder-blocks-core");
|
|
|
675
677
|
|
|
676
678
|
/***/ }),
|
|
677
679
|
/* 6 */
|
|
678
|
-
/***/ (function(module,
|
|
680
|
+
/***/ (function(module, exports) {
|
|
679
681
|
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
/* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(10);
|
|
685
|
-
/* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__);
|
|
682
|
+
module.exports =
|
|
683
|
+
/******/
|
|
684
|
+
function (modules) {
|
|
685
|
+
// webpackBootstrap
|
|
686
686
|
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
* mixing colors together.
|
|
690
|
-
*/
|
|
687
|
+
/******/
|
|
688
|
+
// The module cache
|
|
691
689
|
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
// with r,g,b,a keys.
|
|
690
|
+
/******/
|
|
691
|
+
var installedModules = {};
|
|
692
|
+
/******/
|
|
696
693
|
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
throw new Error(`Failed to parse color: ${color}`);
|
|
700
|
-
}
|
|
694
|
+
/******/
|
|
695
|
+
// The require function
|
|
701
696
|
|
|
702
|
-
|
|
697
|
+
/******/
|
|
703
698
|
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
r: parseInt(`${color3Match[1]}${color3Match[1]}`, 16),
|
|
707
|
-
g: parseInt(`${color3Match[2]}${color3Match[2]}`, 16),
|
|
708
|
-
b: parseInt(`${color3Match[3]}${color3Match[3]}`, 16),
|
|
709
|
-
a: 1
|
|
710
|
-
};
|
|
711
|
-
}
|
|
699
|
+
function __webpack_require__(moduleId) {
|
|
700
|
+
/******/
|
|
712
701
|
|
|
713
|
-
|
|
702
|
+
/******/
|
|
703
|
+
// Check if module is in cache
|
|
704
|
+
|
|
705
|
+
/******/
|
|
706
|
+
if (installedModules[moduleId]) {
|
|
707
|
+
/******/
|
|
708
|
+
return installedModules[moduleId].exports;
|
|
709
|
+
/******/
|
|
710
|
+
}
|
|
711
|
+
/******/
|
|
712
|
+
// Create a new module (and put it into the cache)
|
|
713
|
+
|
|
714
|
+
/******/
|
|
714
715
|
|
|
715
|
-
if (color6Match) {
|
|
716
|
-
return {
|
|
717
|
-
r: parseInt(color6Match[1], 16),
|
|
718
|
-
g: parseInt(color6Match[2], 16),
|
|
719
|
-
b: parseInt(color6Match[3], 16),
|
|
720
|
-
a: 1
|
|
721
|
-
};
|
|
722
|
-
}
|
|
723
716
|
|
|
724
|
-
|
|
717
|
+
var module = installedModules[moduleId] = {
|
|
718
|
+
/******/
|
|
719
|
+
i: moduleId,
|
|
720
|
+
|
|
721
|
+
/******/
|
|
722
|
+
l: false,
|
|
723
|
+
|
|
724
|
+
/******/
|
|
725
|
+
exports: {}
|
|
726
|
+
/******/
|
|
725
727
|
|
|
726
|
-
if (rgbaMatch) {
|
|
727
|
-
return {
|
|
728
|
-
r: parseFloat(rgbaMatch[1]),
|
|
729
|
-
g: parseFloat(rgbaMatch[2]),
|
|
730
|
-
b: parseFloat(rgbaMatch[3]),
|
|
731
|
-
a: rgbaMatch[4] ? parseFloat(rgbaMatch[4]) : 1
|
|
732
728
|
};
|
|
729
|
+
/******/
|
|
730
|
+
|
|
731
|
+
/******/
|
|
732
|
+
// Execute the module function
|
|
733
|
+
|
|
734
|
+
/******/
|
|
735
|
+
|
|
736
|
+
modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
737
|
+
/******/
|
|
738
|
+
|
|
739
|
+
/******/
|
|
740
|
+
// Flag the module as loaded
|
|
741
|
+
|
|
742
|
+
/******/
|
|
743
|
+
|
|
744
|
+
module.l = true;
|
|
745
|
+
/******/
|
|
746
|
+
|
|
747
|
+
/******/
|
|
748
|
+
// Return the exports of the module
|
|
749
|
+
|
|
750
|
+
/******/
|
|
751
|
+
|
|
752
|
+
return module.exports;
|
|
753
|
+
/******/
|
|
733
754
|
}
|
|
755
|
+
/******/
|
|
756
|
+
|
|
757
|
+
/******/
|
|
758
|
+
|
|
759
|
+
/******/
|
|
760
|
+
// expose the modules object (__webpack_modules__)
|
|
761
|
+
|
|
762
|
+
/******/
|
|
763
|
+
|
|
764
|
+
|
|
765
|
+
__webpack_require__.m = modules;
|
|
766
|
+
/******/
|
|
767
|
+
|
|
768
|
+
/******/
|
|
769
|
+
// expose the module cache
|
|
770
|
+
|
|
771
|
+
/******/
|
|
772
|
+
|
|
773
|
+
__webpack_require__.c = installedModules;
|
|
774
|
+
/******/
|
|
775
|
+
|
|
776
|
+
/******/
|
|
777
|
+
// define getter function for harmony exports
|
|
778
|
+
|
|
779
|
+
/******/
|
|
780
|
+
|
|
781
|
+
__webpack_require__.d = function (exports, name, getter) {
|
|
782
|
+
/******/
|
|
783
|
+
if (!__webpack_require__.o(exports, name)) {
|
|
784
|
+
/******/
|
|
785
|
+
Object.defineProperty(exports, name, {
|
|
786
|
+
enumerable: true,
|
|
787
|
+
get: getter
|
|
788
|
+
});
|
|
789
|
+
/******/
|
|
790
|
+
}
|
|
791
|
+
/******/
|
|
792
|
+
|
|
793
|
+
};
|
|
794
|
+
/******/
|
|
734
795
|
|
|
735
|
-
|
|
736
|
-
|
|
796
|
+
/******/
|
|
797
|
+
// define __esModule on exports
|
|
737
798
|
|
|
799
|
+
/******/
|
|
738
800
|
|
|
739
|
-
const format = color => {
|
|
740
|
-
const r = Math.round(color.r);
|
|
741
|
-
const g = Math.round(color.g);
|
|
742
|
-
const b = Math.round(color.b);
|
|
743
801
|
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
802
|
+
__webpack_require__.r = function (exports) {
|
|
803
|
+
/******/
|
|
804
|
+
if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
805
|
+
/******/
|
|
806
|
+
Object.defineProperty(exports, Symbol.toStringTag, {
|
|
807
|
+
value: 'Module'
|
|
808
|
+
});
|
|
809
|
+
/******/
|
|
810
|
+
}
|
|
811
|
+
/******/
|
|
812
|
+
|
|
813
|
+
|
|
814
|
+
Object.defineProperty(exports, '__esModule', {
|
|
815
|
+
value: true
|
|
816
|
+
});
|
|
817
|
+
/******/
|
|
818
|
+
};
|
|
819
|
+
/******/
|
|
820
|
+
|
|
821
|
+
/******/
|
|
822
|
+
// create a fake namespace object
|
|
823
|
+
|
|
824
|
+
/******/
|
|
825
|
+
// mode & 1: value is a module id, require it
|
|
826
|
+
|
|
827
|
+
/******/
|
|
828
|
+
// mode & 2: merge all properties of value into the ns
|
|
829
|
+
|
|
830
|
+
/******/
|
|
831
|
+
// mode & 4: return value when already ns object
|
|
832
|
+
|
|
833
|
+
/******/
|
|
834
|
+
// mode & 8|1: behave like require
|
|
835
|
+
|
|
836
|
+
/******/
|
|
837
|
+
|
|
838
|
+
|
|
839
|
+
__webpack_require__.t = function (value, mode) {
|
|
840
|
+
/******/
|
|
841
|
+
if (mode & 1) value = __webpack_require__(value);
|
|
842
|
+
/******/
|
|
843
|
+
|
|
844
|
+
if (mode & 8) return value;
|
|
845
|
+
/******/
|
|
846
|
+
|
|
847
|
+
if (mode & 4 && typeof value === 'object' && value && value.__esModule) return value;
|
|
848
|
+
/******/
|
|
849
|
+
|
|
850
|
+
var ns = Object.create(null);
|
|
851
|
+
/******/
|
|
852
|
+
|
|
853
|
+
__webpack_require__.r(ns);
|
|
854
|
+
/******/
|
|
855
|
+
|
|
856
|
+
|
|
857
|
+
Object.defineProperty(ns, 'default', {
|
|
858
|
+
enumerable: true,
|
|
859
|
+
value: value
|
|
860
|
+
});
|
|
861
|
+
/******/
|
|
862
|
+
|
|
863
|
+
if (mode & 2 && typeof value != 'string') for (var key in value) __webpack_require__.d(ns, key, function (key) {
|
|
864
|
+
return value[key];
|
|
865
|
+
}.bind(null, key));
|
|
866
|
+
/******/
|
|
867
|
+
|
|
868
|
+
return ns;
|
|
869
|
+
/******/
|
|
870
|
+
};
|
|
871
|
+
/******/
|
|
872
|
+
|
|
873
|
+
/******/
|
|
874
|
+
// getDefaultExport function for compatibility with non-harmony modules
|
|
875
|
+
|
|
876
|
+
/******/
|
|
877
|
+
|
|
878
|
+
|
|
879
|
+
__webpack_require__.n = function (module) {
|
|
880
|
+
/******/
|
|
881
|
+
var getter = module && module.__esModule ?
|
|
882
|
+
/******/
|
|
883
|
+
function getDefault() {
|
|
884
|
+
return module['default'];
|
|
885
|
+
} :
|
|
886
|
+
/******/
|
|
887
|
+
function getModuleExports() {
|
|
888
|
+
return module;
|
|
748
889
|
};
|
|
890
|
+
/******/
|
|
749
891
|
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
return `rgba(${r},${g},${b},${color.a.toFixed(2)})`;
|
|
753
|
-
}
|
|
754
|
-
}; // Adjust the alpha value of a color.
|
|
892
|
+
__webpack_require__.d(getter, 'a', getter);
|
|
893
|
+
/******/
|
|
755
894
|
|
|
756
895
|
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
896
|
+
return getter;
|
|
897
|
+
/******/
|
|
898
|
+
};
|
|
899
|
+
/******/
|
|
900
|
+
|
|
901
|
+
/******/
|
|
902
|
+
// Object.prototype.hasOwnProperty.call
|
|
903
|
+
|
|
904
|
+
/******/
|
|
905
|
+
|
|
906
|
+
|
|
907
|
+
__webpack_require__.o = function (object, property) {
|
|
908
|
+
return Object.prototype.hasOwnProperty.call(object, property);
|
|
909
|
+
};
|
|
910
|
+
/******/
|
|
911
|
+
|
|
912
|
+
/******/
|
|
913
|
+
// __webpack_public_path__
|
|
914
|
+
|
|
915
|
+
/******/
|
|
916
|
+
|
|
917
|
+
|
|
918
|
+
__webpack_require__.p = "";
|
|
919
|
+
/******/
|
|
920
|
+
|
|
921
|
+
/******/
|
|
922
|
+
|
|
923
|
+
/******/
|
|
924
|
+
// Load entry module and return exports
|
|
925
|
+
|
|
926
|
+
/******/
|
|
927
|
+
|
|
928
|
+
return __webpack_require__(__webpack_require__.s = 1);
|
|
929
|
+
/******/
|
|
930
|
+
}
|
|
931
|
+
/************************************************************************/
|
|
932
|
+
|
|
933
|
+
/******/
|
|
934
|
+
([
|
|
935
|
+
/* 0 */
|
|
936
|
+
|
|
937
|
+
/***/
|
|
938
|
+
function (module, __webpack_exports__, __webpack_require__) {
|
|
939
|
+
"use strict";
|
|
940
|
+
/* harmony export (binding) */
|
|
761
941
|
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
a: components.a * percentage
|
|
765
|
-
}));
|
|
766
|
-
}; // Mix a color into a background color, using the alpha channel of the base
|
|
767
|
-
// color to determine the linear blend.
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
const mix = (color, background) => {
|
|
771
|
-
const colorObj = parse(color);
|
|
772
|
-
const bgObj = parse(background);
|
|
773
|
-
return format({
|
|
774
|
-
r: colorObj.r * colorObj.a + bgObj.r * (1 - colorObj.a),
|
|
775
|
-
g: colorObj.g * colorObj.a + bgObj.g * (1 - colorObj.a),
|
|
776
|
-
b: colorObj.b * colorObj.a + bgObj.b * (1 - colorObj.a),
|
|
777
|
-
a: bgObj.a
|
|
942
|
+
__webpack_require__.d(__webpack_exports__, "a", function () {
|
|
943
|
+
return fade;
|
|
778
944
|
});
|
|
779
|
-
|
|
945
|
+
/* harmony export (binding) */
|
|
780
946
|
|
|
781
|
-
const offBlack = "#21242c";
|
|
782
|
-
const white = "#ffffff";
|
|
783
|
-
const Color = {
|
|
784
|
-
// Product
|
|
785
|
-
blue: "#1865f2",
|
|
786
|
-
purple: "#9059ff",
|
|
787
|
-
green: "#00a60e",
|
|
788
|
-
gold: "#ffb100",
|
|
789
|
-
red: "#d92916",
|
|
790
|
-
// Neutral
|
|
791
|
-
offBlack,
|
|
792
|
-
offBlack64: fade(offBlack, 0.64),
|
|
793
|
-
offBlack50: fade(offBlack, 0.5),
|
|
794
|
-
offBlack32: fade(offBlack, 0.32),
|
|
795
|
-
offBlack16: fade(offBlack, 0.16),
|
|
796
|
-
offBlack8: fade(offBlack, 0.08),
|
|
797
|
-
offWhite: "#f7f8fa",
|
|
798
|
-
white,
|
|
799
|
-
white64: fade(white, 0.64),
|
|
800
|
-
white50: fade(white, 0.5),
|
|
801
|
-
// Brand
|
|
802
|
-
darkBlue: "#0a2a66",
|
|
803
|
-
teal: "#14bf96",
|
|
804
|
-
lightBlue: "#37c5fd",
|
|
805
|
-
pink: "#fa50ae"
|
|
806
|
-
};
|
|
807
|
-
const SemanticColor = {
|
|
808
|
-
controlDefault: Color.blue,
|
|
809
|
-
controlDestructive: Color.red
|
|
810
|
-
};
|
|
811
|
-
/* harmony default export */ __webpack_exports__["a"] = (Color);
|
|
812
947
|
|
|
948
|
+
__webpack_require__.d(__webpack_exports__, "b", function () {
|
|
949
|
+
return mix;
|
|
950
|
+
});
|
|
951
|
+
/**
|
|
952
|
+
* A color manipulation library useful for dynamically
|
|
953
|
+
* mixing colors together.
|
|
954
|
+
*/
|
|
955
|
+
|
|
956
|
+
|
|
957
|
+
const color6Regexp = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i;
|
|
958
|
+
const color3Regexp = /^#([0-9a-f])([0-9a-f])([0-9a-f])$/i;
|
|
959
|
+
const rgbaRegexp = /^rgba?\(\s*(\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\s*\)$/i; // Parse a color in #abcdef, rgb(...), or rgba(...) form into an object
|
|
960
|
+
// with r,g,b,a keys.
|
|
961
|
+
|
|
962
|
+
const parse = color => {
|
|
963
|
+
if (typeof color !== "string") {
|
|
964
|
+
throw new Error(`Failed to parse color: ${color}`);
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
const color3Match = color.match(color3Regexp);
|
|
968
|
+
|
|
969
|
+
if (color3Match) {
|
|
970
|
+
return {
|
|
971
|
+
r: parseInt(`${color3Match[1]}${color3Match[1]}`, 16),
|
|
972
|
+
g: parseInt(`${color3Match[2]}${color3Match[2]}`, 16),
|
|
973
|
+
b: parseInt(`${color3Match[3]}${color3Match[3]}`, 16),
|
|
974
|
+
a: 1
|
|
975
|
+
};
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
const color6Match = color.match(color6Regexp);
|
|
979
|
+
|
|
980
|
+
if (color6Match) {
|
|
981
|
+
return {
|
|
982
|
+
r: parseInt(color6Match[1], 16),
|
|
983
|
+
g: parseInt(color6Match[2], 16),
|
|
984
|
+
b: parseInt(color6Match[3], 16),
|
|
985
|
+
a: 1
|
|
986
|
+
};
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
const rgbaMatch = color.match(rgbaRegexp);
|
|
990
|
+
|
|
991
|
+
if (rgbaMatch) {
|
|
992
|
+
return {
|
|
993
|
+
r: parseFloat(rgbaMatch[1]),
|
|
994
|
+
g: parseFloat(rgbaMatch[2]),
|
|
995
|
+
b: parseFloat(rgbaMatch[3]),
|
|
996
|
+
a: rgbaMatch[4] ? parseFloat(rgbaMatch[4]) : 1
|
|
997
|
+
};
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
throw new Error(`Failed to parse color: ${color}`);
|
|
1001
|
+
}; // Stringify the color in an `rgba()` or `#abcdef` format.
|
|
1002
|
+
|
|
1003
|
+
|
|
1004
|
+
const format = color => {
|
|
1005
|
+
const r = Math.round(color.r);
|
|
1006
|
+
const g = Math.round(color.g);
|
|
1007
|
+
const b = Math.round(color.b);
|
|
1008
|
+
|
|
1009
|
+
if (color.a === 1) {
|
|
1010
|
+
const _s = c => {
|
|
1011
|
+
const asString = c.toString(16);
|
|
1012
|
+
return asString.length === 1 ? asString + asString : asString;
|
|
1013
|
+
};
|
|
1014
|
+
|
|
1015
|
+
return `#${_s(r)}${_s(g)}${_s(b)}`;
|
|
1016
|
+
} else {
|
|
1017
|
+
return `rgba(${r},${g},${b},${color.a.toFixed(2)})`;
|
|
1018
|
+
}
|
|
1019
|
+
}; // Adjust the alpha value of a color.
|
|
1020
|
+
|
|
1021
|
+
|
|
1022
|
+
const fade = (color, percentage) => {
|
|
1023
|
+
if (percentage < 0 || percentage > 1) {
|
|
1024
|
+
throw new Error("Percentage must be between 0 and 1");
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
const components = parse(color);
|
|
1028
|
+
return format({ ...components,
|
|
1029
|
+
a: components.a * percentage
|
|
1030
|
+
});
|
|
1031
|
+
}; // Mix a color into a background color, using the alpha channel of the base
|
|
1032
|
+
// color to determine the linear blend.
|
|
1033
|
+
|
|
1034
|
+
|
|
1035
|
+
const mix = (color, background) => {
|
|
1036
|
+
const colorObj = parse(color);
|
|
1037
|
+
const bgObj = parse(background);
|
|
1038
|
+
return format({
|
|
1039
|
+
r: colorObj.r * colorObj.a + bgObj.r * (1 - colorObj.a),
|
|
1040
|
+
g: colorObj.g * colorObj.a + bgObj.g * (1 - colorObj.a),
|
|
1041
|
+
b: colorObj.b * colorObj.a + bgObj.b * (1 - colorObj.a),
|
|
1042
|
+
a: bgObj.a
|
|
1043
|
+
});
|
|
1044
|
+
};
|
|
1045
|
+
/***/
|
|
1046
|
+
|
|
1047
|
+
},
|
|
1048
|
+
/* 1 */
|
|
1049
|
+
|
|
1050
|
+
/***/
|
|
1051
|
+
function (module, __webpack_exports__, __webpack_require__) {
|
|
1052
|
+
"use strict";
|
|
1053
|
+
|
|
1054
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1055
|
+
/* harmony export (binding) */
|
|
1056
|
+
|
|
1057
|
+
|
|
1058
|
+
__webpack_require__.d(__webpack_exports__, "default", function () {
|
|
1059
|
+
return Color;
|
|
1060
|
+
});
|
|
1061
|
+
/* harmony export (binding) */
|
|
1062
|
+
|
|
1063
|
+
|
|
1064
|
+
__webpack_require__.d(__webpack_exports__, "SemanticColor", function () {
|
|
1065
|
+
return SemanticColor;
|
|
1066
|
+
});
|
|
1067
|
+
/* harmony import */
|
|
1068
|
+
|
|
1069
|
+
|
|
1070
|
+
var _util_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
|
1071
|
+
/* harmony reexport (safe) */
|
|
1072
|
+
|
|
1073
|
+
|
|
1074
|
+
__webpack_require__.d(__webpack_exports__, "mix", function () {
|
|
1075
|
+
return _util_utils_js__WEBPACK_IMPORTED_MODULE_0__["b"];
|
|
1076
|
+
});
|
|
1077
|
+
/* harmony reexport (safe) */
|
|
1078
|
+
|
|
1079
|
+
|
|
1080
|
+
__webpack_require__.d(__webpack_exports__, "fade", function () {
|
|
1081
|
+
return _util_utils_js__WEBPACK_IMPORTED_MODULE_0__["a"];
|
|
1082
|
+
});
|
|
1083
|
+
|
|
1084
|
+
const offBlack = "#21242c";
|
|
1085
|
+
const white = "#ffffff";
|
|
1086
|
+
const Color = {
|
|
1087
|
+
// Product
|
|
1088
|
+
blue: "#1865f2",
|
|
1089
|
+
purple: "#9059ff",
|
|
1090
|
+
green: "#00a60e",
|
|
1091
|
+
gold: "#ffb100",
|
|
1092
|
+
red: "#d92916",
|
|
1093
|
+
// Neutral
|
|
1094
|
+
offBlack,
|
|
1095
|
+
offBlack64: Object(_util_utils_js__WEBPACK_IMPORTED_MODULE_0__[
|
|
1096
|
+
/* fade */
|
|
1097
|
+
"a"])(offBlack, 0.64),
|
|
1098
|
+
offBlack50: Object(_util_utils_js__WEBPACK_IMPORTED_MODULE_0__[
|
|
1099
|
+
/* fade */
|
|
1100
|
+
"a"])(offBlack, 0.5),
|
|
1101
|
+
offBlack32: Object(_util_utils_js__WEBPACK_IMPORTED_MODULE_0__[
|
|
1102
|
+
/* fade */
|
|
1103
|
+
"a"])(offBlack, 0.32),
|
|
1104
|
+
offBlack16: Object(_util_utils_js__WEBPACK_IMPORTED_MODULE_0__[
|
|
1105
|
+
/* fade */
|
|
1106
|
+
"a"])(offBlack, 0.16),
|
|
1107
|
+
offBlack8: Object(_util_utils_js__WEBPACK_IMPORTED_MODULE_0__[
|
|
1108
|
+
/* fade */
|
|
1109
|
+
"a"])(offBlack, 0.08),
|
|
1110
|
+
offWhite: "#f7f8fa",
|
|
1111
|
+
white,
|
|
1112
|
+
white64: Object(_util_utils_js__WEBPACK_IMPORTED_MODULE_0__[
|
|
1113
|
+
/* fade */
|
|
1114
|
+
"a"])(white, 0.64),
|
|
1115
|
+
white50: Object(_util_utils_js__WEBPACK_IMPORTED_MODULE_0__[
|
|
1116
|
+
/* fade */
|
|
1117
|
+
"a"])(white, 0.5),
|
|
1118
|
+
// Brand
|
|
1119
|
+
darkBlue: "#0a2a66",
|
|
1120
|
+
teal: "#14bf96",
|
|
1121
|
+
lightBlue: "#37c5fd",
|
|
1122
|
+
pink: "#fa50ae"
|
|
1123
|
+
};
|
|
1124
|
+
const SemanticColor = {
|
|
1125
|
+
controlDefault: Color.blue,
|
|
1126
|
+
controlDestructive: Color.red
|
|
1127
|
+
};
|
|
1128
|
+
/***/
|
|
1129
|
+
}
|
|
1130
|
+
/******/
|
|
1131
|
+
]);
|
|
813
1132
|
|
|
814
1133
|
/***/ }),
|
|
815
1134
|
/* 7 */
|
|
@@ -821,13 +1140,14 @@ const SemanticColor = {
|
|
|
821
1140
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
822
1141
|
/* harmony import */ var aphrodite__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8);
|
|
823
1142
|
/* harmony import */ var aphrodite__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(aphrodite__WEBPACK_IMPORTED_MODULE_1__);
|
|
824
|
-
/* harmony import */ var
|
|
825
|
-
/* harmony import */ var
|
|
826
|
-
/* harmony import */ var
|
|
827
|
-
/* harmony import */ var
|
|
1143
|
+
/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4);
|
|
1144
|
+
/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_router_dom__WEBPACK_IMPORTED_MODULE_2__);
|
|
1145
|
+
/* harmony import */ var react_router__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9);
|
|
1146
|
+
/* harmony import */ var react_router__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react_router__WEBPACK_IMPORTED_MODULE_3__);
|
|
828
1147
|
/* harmony import */ var _khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(5);
|
|
829
1148
|
/* harmony import */ var _khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_4__);
|
|
830
1149
|
/* harmony import */ var _khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6);
|
|
1150
|
+
/* harmony import */ var _khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_5__);
|
|
831
1151
|
/* harmony import */ var _util_get_clickable_behavior_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(3);
|
|
832
1152
|
/* harmony import */ var _util_is_client_side_url_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(1);
|
|
833
1153
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
@@ -842,7 +1162,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
842
1162
|
|
|
843
1163
|
const StyledAnchor = Object(_khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_4__["addStyle"])("a");
|
|
844
1164
|
const StyledButton = Object(_khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_4__["addStyle"])("button");
|
|
845
|
-
const StyledLink = Object(_khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_4__["addStyle"])(
|
|
1165
|
+
const StyledLink = Object(_khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_4__["addStyle"])(react_router_dom__WEBPACK_IMPORTED_MODULE_2__["Link"]);
|
|
846
1166
|
/**
|
|
847
1167
|
* A component to turn any custom component into a clickable one.
|
|
848
1168
|
*
|
|
@@ -872,9 +1192,9 @@ class Clickable extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
|
|
|
872
1192
|
constructor(...args) {
|
|
873
1193
|
super(...args);
|
|
874
1194
|
|
|
875
|
-
this.getCorrectTag = (clickableState, commonProps) => {
|
|
1195
|
+
this.getCorrectTag = (clickableState, router, commonProps) => {
|
|
876
1196
|
const activeHref = this.props.href && !this.props.disabled;
|
|
877
|
-
const useClient =
|
|
1197
|
+
const useClient = router && !this.props.skipClientNav && Object(_util_is_client_side_url_js__WEBPACK_IMPORTED_MODULE_7__[/* isClientSideUrl */ "a"])(this.props.href || ""); // NOTE: checking this.props.href here is redundant, but flow
|
|
878
1198
|
// needs it to refine this.props.href to a string.
|
|
879
1199
|
|
|
880
1200
|
if (activeHref && useClient && this.props.href) {
|
|
@@ -900,7 +1220,7 @@ class Clickable extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
|
|
|
900
1220
|
};
|
|
901
1221
|
}
|
|
902
1222
|
|
|
903
|
-
|
|
1223
|
+
renderClickableBehavior(router) {
|
|
904
1224
|
const {
|
|
905
1225
|
href,
|
|
906
1226
|
onClick,
|
|
@@ -917,7 +1237,7 @@ class Clickable extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
|
|
|
917
1237
|
disabled,
|
|
918
1238
|
...restProps
|
|
919
1239
|
} = this.props;
|
|
920
|
-
const ClickableBehavior = Object(_util_get_clickable_behavior_js__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(href, skipClientNav,
|
|
1240
|
+
const ClickableBehavior = Object(_util_get_clickable_behavior_js__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(href, skipClientNav, router);
|
|
921
1241
|
|
|
922
1242
|
const getStyle = state => [styles.reset, styles.link, !hideDefaultFocusRing && state.focused && (light ? styles.focusedLight : styles.focused), style];
|
|
923
1243
|
|
|
@@ -930,7 +1250,7 @@ class Clickable extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
|
|
|
930
1250
|
onKeyDown: onKeyDown,
|
|
931
1251
|
onKeyUp: onKeyUp,
|
|
932
1252
|
disabled: disabled
|
|
933
|
-
}, (state, childrenProps) => this.getCorrectTag(state, { ...restProps,
|
|
1253
|
+
}, (state, childrenProps) => this.getCorrectTag(state, router, { ...restProps,
|
|
934
1254
|
"data-test-id": testId,
|
|
935
1255
|
style: getStyle(state),
|
|
936
1256
|
...childrenProps
|
|
@@ -944,7 +1264,7 @@ class Clickable extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
|
|
|
944
1264
|
onKeyUp: onKeyUp,
|
|
945
1265
|
target: target,
|
|
946
1266
|
disabled: disabled
|
|
947
|
-
}, (state, childrenProps) => this.getCorrectTag(state, { ...restProps,
|
|
1267
|
+
}, (state, childrenProps) => this.getCorrectTag(state, router, { ...restProps,
|
|
948
1268
|
"data-test-id": testId,
|
|
949
1269
|
style: getStyle(state),
|
|
950
1270
|
...childrenProps
|
|
@@ -952,11 +1272,12 @@ class Clickable extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
|
|
|
952
1272
|
}
|
|
953
1273
|
}
|
|
954
1274
|
|
|
1275
|
+
render() {
|
|
1276
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](react_router__WEBPACK_IMPORTED_MODULE_3__["__RouterContext"].Consumer, null, router => this.renderClickableBehavior(router));
|
|
1277
|
+
}
|
|
1278
|
+
|
|
955
1279
|
} // Source: https://gist.github.com/MoOx/9137295
|
|
956
1280
|
|
|
957
|
-
Clickable.contextTypes = {
|
|
958
|
-
router: prop_types__WEBPACK_IMPORTED_MODULE_2__["any"]
|
|
959
|
-
};
|
|
960
1281
|
Clickable.defaultProps = {
|
|
961
1282
|
light: false,
|
|
962
1283
|
disabled: false,
|
|
@@ -995,10 +1316,10 @@ const styles = aphrodite__WEBPACK_IMPORTED_MODULE_1__["StyleSheet"].create({
|
|
|
995
1316
|
cursor: "pointer"
|
|
996
1317
|
},
|
|
997
1318
|
focused: {
|
|
998
|
-
outline: `solid 2px ${
|
|
1319
|
+
outline: `solid 2px ${_khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_5___default.a.blue}`
|
|
999
1320
|
},
|
|
1000
1321
|
focusedLight: {
|
|
1001
|
-
outline: `solid 2px ${
|
|
1322
|
+
outline: `solid 2px ${_khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_5___default.a.white}`
|
|
1002
1323
|
}
|
|
1003
1324
|
});
|
|
1004
1325
|
|
|
@@ -1012,36 +1333,10 @@ module.exports = require("aphrodite");
|
|
|
1012
1333
|
/* 9 */
|
|
1013
1334
|
/***/ (function(module, exports) {
|
|
1014
1335
|
|
|
1015
|
-
module.exports = require("
|
|
1336
|
+
module.exports = require("react-router");
|
|
1016
1337
|
|
|
1017
1338
|
/***/ }),
|
|
1018
1339
|
/* 10 */
|
|
1019
|
-
/***/ (function(module, exports) {
|
|
1020
|
-
|
|
1021
|
-
function _extends() {
|
|
1022
|
-
module.exports = _extends = Object.assign || function (target) {
|
|
1023
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
1024
|
-
var source = arguments[i];
|
|
1025
|
-
|
|
1026
|
-
for (var key in source) {
|
|
1027
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1028
|
-
target[key] = source[key];
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
|
-
}
|
|
1032
|
-
|
|
1033
|
-
return target;
|
|
1034
|
-
};
|
|
1035
|
-
|
|
1036
|
-
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
1037
|
-
return _extends.apply(this, arguments);
|
|
1038
|
-
}
|
|
1039
|
-
|
|
1040
|
-
module.exports = _extends;
|
|
1041
|
-
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
1042
|
-
|
|
1043
|
-
/***/ }),
|
|
1044
|
-
/* 11 */
|
|
1045
1340
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1046
1341
|
|
|
1047
1342
|
"use strict";
|