@khanacademy/wonder-blocks-search-field 1.0.6 → 1.0.7
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 +6 -0
- package/dist/index.js +180 -6
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -776,7 +776,7 @@ if (false) { var secondaryBuildName, initialBuildName, buildNames, key, global;
|
|
|
776
776
|
"use strict";
|
|
777
777
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; });
|
|
778
778
|
function _extends() {
|
|
779
|
-
_extends = Object.assign
|
|
779
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
780
780
|
for (var i = 1; i < arguments.length; i++) {
|
|
781
781
|
var source = arguments[i];
|
|
782
782
|
|
|
@@ -789,7 +789,6 @@ function _extends() {
|
|
|
789
789
|
|
|
790
790
|
return target;
|
|
791
791
|
};
|
|
792
|
-
|
|
793
792
|
return _extends.apply(this, arguments);
|
|
794
793
|
}
|
|
795
794
|
|
|
@@ -3233,6 +3232,24 @@ function (module, __webpack_exports__, __webpack_require__) {
|
|
|
3233
3232
|
boxShadow: `0px 0px 0px 1px ${_khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_2___default.a.red}, 0px 0px 0px 2px ${_khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_2___default.a.white}`
|
|
3234
3233
|
}
|
|
3235
3234
|
});
|
|
3235
|
+
/**
|
|
3236
|
+
* A TextField is an element used to accept a single line of text from the user.
|
|
3237
|
+
*
|
|
3238
|
+
* ### Usage
|
|
3239
|
+
*
|
|
3240
|
+
* ```jsx
|
|
3241
|
+
* import {TextField} from "@khanacademy/wonder-blocks-form";
|
|
3242
|
+
*
|
|
3243
|
+
* const [value, setValue] = React.useState("");
|
|
3244
|
+
*
|
|
3245
|
+
* <TextField
|
|
3246
|
+
* id="some-unique-text-field-id"
|
|
3247
|
+
* value={value}
|
|
3248
|
+
* onChange={setValue}
|
|
3249
|
+
* />
|
|
3250
|
+
* ```
|
|
3251
|
+
*/
|
|
3252
|
+
|
|
3236
3253
|
const TextField = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["forwardRef"]((props, ref) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](TextFieldInternal, _extends({}, props, {
|
|
3237
3254
|
forwardedRef: ref
|
|
3238
3255
|
})));
|
|
@@ -3521,6 +3538,63 @@ function (module, __webpack_exports__, __webpack_require__) {
|
|
|
3521
3538
|
*
|
|
3522
3539
|
* If you wish to use just a single field, use Checkbox or Radio with the
|
|
3523
3540
|
* optional label and description props.
|
|
3541
|
+
*
|
|
3542
|
+
* ### Checkbox Usage
|
|
3543
|
+
*
|
|
3544
|
+
* ```jsx
|
|
3545
|
+
* import {Choice, CheckboxGroup} from "@khanacademy/wonder-blocks-form";
|
|
3546
|
+
*
|
|
3547
|
+
* const [selectedValues, setSelectedValues] = React.useState([]);
|
|
3548
|
+
*
|
|
3549
|
+
* // Checkbox usage
|
|
3550
|
+
* <CheckboxGroup
|
|
3551
|
+
* label="some-label"
|
|
3552
|
+
* description="some-description"
|
|
3553
|
+
* groupName="some-group-name"
|
|
3554
|
+
* onChange={setSelectedValues}
|
|
3555
|
+
* selectedValues={selectedValues}
|
|
3556
|
+
* />
|
|
3557
|
+
* // Add as many choices as necessary
|
|
3558
|
+
* <Choice
|
|
3559
|
+
* label="Choice 1"
|
|
3560
|
+
* value="some-choice-value"
|
|
3561
|
+
* description="Some choice description."
|
|
3562
|
+
* />
|
|
3563
|
+
* <Choice
|
|
3564
|
+
* label="Choice 2"
|
|
3565
|
+
* value="some-choice-value-2"
|
|
3566
|
+
* description="Some choice description."
|
|
3567
|
+
* />
|
|
3568
|
+
* </CheckboxGroup>
|
|
3569
|
+
* ```
|
|
3570
|
+
*
|
|
3571
|
+
* ### Radio Usage
|
|
3572
|
+
*
|
|
3573
|
+
* ```jsx
|
|
3574
|
+
* import {Choice, RadioGroup} from "@khanacademy/wonder-blocks-form";
|
|
3575
|
+
*
|
|
3576
|
+
* const [selectedValue, setSelectedValue] = React.useState("");
|
|
3577
|
+
*
|
|
3578
|
+
* <RadioGroup
|
|
3579
|
+
* label="some-label"
|
|
3580
|
+
* description="some-description"
|
|
3581
|
+
* groupName="some-group-name"
|
|
3582
|
+
* onChange={setSelectedValue}>
|
|
3583
|
+
* selectedValues={selectedValue}
|
|
3584
|
+
* />
|
|
3585
|
+
* // Add as many choices as necessary
|
|
3586
|
+
* <Choice
|
|
3587
|
+
* label="Choice 1"
|
|
3588
|
+
* value="some-choice-value"
|
|
3589
|
+
* description="Some choice description."
|
|
3590
|
+
* />
|
|
3591
|
+
* <Choice
|
|
3592
|
+
* label="Choice 2"
|
|
3593
|
+
* value="some-choice-value-2"
|
|
3594
|
+
* description="Some choice description."
|
|
3595
|
+
* />
|
|
3596
|
+
* </RadioGroup>
|
|
3597
|
+
* ```
|
|
3524
3598
|
*/
|
|
3525
3599
|
|
|
3526
3600
|
|
|
@@ -3620,6 +3694,33 @@ function (module, __webpack_exports__, __webpack_require__) {
|
|
|
3620
3694
|
* many props for its children Choice components. The Choice component is
|
|
3621
3695
|
* exposed for the user to apply custom styles or to indicate which choices are
|
|
3622
3696
|
* disabled.
|
|
3697
|
+
*
|
|
3698
|
+
* ### Usage
|
|
3699
|
+
*
|
|
3700
|
+
* ```jsx
|
|
3701
|
+
* import {Choice, CheckboxGroup} from "@khanacademy/wonder-blocks-form";
|
|
3702
|
+
*
|
|
3703
|
+
* const [selectedValues, setSelectedValues] = React.useState([]);
|
|
3704
|
+
*
|
|
3705
|
+
* <CheckboxGroup
|
|
3706
|
+
* label="some-label"
|
|
3707
|
+
* description="some-description"
|
|
3708
|
+
* groupName="some-group-name"
|
|
3709
|
+
* onChange={setSelectedValues}
|
|
3710
|
+
* selectedValues={selectedValues}
|
|
3711
|
+
* />
|
|
3712
|
+
* // Add as many choices as necessary
|
|
3713
|
+
* <Choice
|
|
3714
|
+
* label="Choice 1"
|
|
3715
|
+
* value="some-choice-value"
|
|
3716
|
+
* />
|
|
3717
|
+
* <Choice
|
|
3718
|
+
* label="Choice 2"
|
|
3719
|
+
* value="some-choice-value-2"
|
|
3720
|
+
* description="Some choice description."
|
|
3721
|
+
* />
|
|
3722
|
+
* </CheckboxGroup>
|
|
3723
|
+
* ```
|
|
3623
3724
|
*/
|
|
3624
3725
|
|
|
3625
3726
|
class CheckboxGroup extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
|
|
@@ -3759,6 +3860,33 @@ function (module, __webpack_exports__, __webpack_require__) {
|
|
|
3759
3860
|
* indicate which choices are disabled. The use of the groupName prop is
|
|
3760
3861
|
* important to maintain expected keyboard navigation behavior for
|
|
3761
3862
|
* accessibility.
|
|
3863
|
+
*
|
|
3864
|
+
* ### Usage
|
|
3865
|
+
*
|
|
3866
|
+
* ```jsx
|
|
3867
|
+
* import {Choice, RadioGroup} from "@khanacademy/wonder-blocks-form";
|
|
3868
|
+
*
|
|
3869
|
+
* const [selectedValue, setSelectedValue] = React.useState([]);
|
|
3870
|
+
*
|
|
3871
|
+
* <RadioGroup
|
|
3872
|
+
* label="some-label"
|
|
3873
|
+
* description="some-description"
|
|
3874
|
+
* groupName="some-group-name"
|
|
3875
|
+
* onChange={setSelectedValue}
|
|
3876
|
+
* selectedValue={selectedValue}
|
|
3877
|
+
* />
|
|
3878
|
+
* // Add as many choices as necessary
|
|
3879
|
+
* <Choice
|
|
3880
|
+
* label="Choice 1"
|
|
3881
|
+
* value="some-choice-value"
|
|
3882
|
+
* />
|
|
3883
|
+
* <Choice
|
|
3884
|
+
* label="Choice 2"
|
|
3885
|
+
* value="some-choice-value-2"
|
|
3886
|
+
* description="Some choice description."
|
|
3887
|
+
* />
|
|
3888
|
+
* </RadioGroup>
|
|
3889
|
+
* ```
|
|
3762
3890
|
*/
|
|
3763
3891
|
|
|
3764
3892
|
class RadioGroup extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
|
|
@@ -3993,6 +4121,27 @@ function (module, __webpack_exports__, __webpack_require__) {
|
|
|
3993
4121
|
disabled: false,
|
|
3994
4122
|
light: false
|
|
3995
4123
|
};
|
|
4124
|
+
/**
|
|
4125
|
+
* A LabeledTextField is an element used to accept a single line of text
|
|
4126
|
+
* from the user paired with a label, description, and error field elements.
|
|
4127
|
+
*
|
|
4128
|
+
* ### Usage
|
|
4129
|
+
*
|
|
4130
|
+
* ```jsx
|
|
4131
|
+
* import {LabeledTextField} from "@khanacademy/wonder-blocks-form";
|
|
4132
|
+
*
|
|
4133
|
+
* const [value, setValue] = React.useState("");
|
|
4134
|
+
*
|
|
4135
|
+
* <LabeledTextField
|
|
4136
|
+
* label="Label"
|
|
4137
|
+
* description="Hello, this is the description for this field"
|
|
4138
|
+
* placeholder="Placeholder"
|
|
4139
|
+
* value={value}
|
|
4140
|
+
* onChange={setValue}
|
|
4141
|
+
* />
|
|
4142
|
+
* ```
|
|
4143
|
+
*/
|
|
4144
|
+
|
|
3996
4145
|
const LabeledTextField = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["forwardRef"]((props, ref) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](LabeledTextFieldInternal, _extends({}, props, {
|
|
3997
4146
|
forwardedRef: ref
|
|
3998
4147
|
})));
|
|
@@ -4736,11 +4885,10 @@ function (module, __webpack_exports__, __webpack_require__) {
|
|
|
4736
4885
|
"use strict";
|
|
4737
4886
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _setPrototypeOf; });
|
|
4738
4887
|
function _setPrototypeOf(o, p) {
|
|
4739
|
-
_setPrototypeOf = Object.setPrototypeOf
|
|
4888
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
4740
4889
|
o.__proto__ = p;
|
|
4741
4890
|
return o;
|
|
4742
4891
|
};
|
|
4743
|
-
|
|
4744
4892
|
return _setPrototypeOf(o, p);
|
|
4745
4893
|
}
|
|
4746
4894
|
|
|
@@ -5634,7 +5782,7 @@ function (module, __webpack_exports__, __webpack_require__) {
|
|
|
5634
5782
|
"b"]).map(spec => spec.query), Object.values(_util_specs_js__WEBPACK_IMPORTED_MODULE_2__[
|
|
5635
5783
|
/* MEDIA_MODAL_SPEC */
|
|
5636
5784
|
"c"]).map(spec => spec.query));
|
|
5637
|
-
const mediaQueryLists = {}; // eslint-disable-next-line
|
|
5785
|
+
const mediaQueryLists = {}; // eslint-disable-next-line ft-flow/require-exact-type
|
|
5638
5786
|
// If for some reason we're not able to resolve the current media size we
|
|
5639
5787
|
// fall back to this state.
|
|
5640
5788
|
|
|
@@ -5788,6 +5936,32 @@ function (module, __webpack_exports__, __webpack_require__) {
|
|
|
5788
5936
|
|
|
5789
5937
|
} // gen-snapshot-tests.js only understands `export default class ...`
|
|
5790
5938
|
|
|
5939
|
+
/**
|
|
5940
|
+
* ***NOTE: The MediaLayout component is being deprecated. Do not use this!!***
|
|
5941
|
+
*
|
|
5942
|
+
* MediaLayout is a container component that accepts a `styleSheets` object,
|
|
5943
|
+
* whose keys are media sizes. It listens for changes to the current media
|
|
5944
|
+
* size and passes the current `mediaSize`, `mediaSpec`, and `styles` to
|
|
5945
|
+
* `children`, which is a render function taking those three values as an
|
|
5946
|
+
* object.
|
|
5947
|
+
*
|
|
5948
|
+
* Valid keys for the `styleSheets` object are (in order of precedence):
|
|
5949
|
+
* - `small`, `medium`, `large`
|
|
5950
|
+
* - `mdOrSmaller`, `mdOrLarger`
|
|
5951
|
+
* - `all`
|
|
5952
|
+
*
|
|
5953
|
+
* `MediaLayout` will merge style rules from multiple styles that match the
|
|
5954
|
+
* current media query, e.g. `"(min-width: 1024px)"`.
|
|
5955
|
+
*
|
|
5956
|
+
* The `mediaSpec` is an object with one or more of the following keys:
|
|
5957
|
+
* `small`, `medium`, or `large`. Each value contains the following data:
|
|
5958
|
+
* - `query: string` e.g. "(min-width: 1024px)"
|
|
5959
|
+
* - `totalColumns: number`
|
|
5960
|
+
* - `gutterWidth: number`
|
|
5961
|
+
* - `marginWidth: number`
|
|
5962
|
+
* - `maxWidth: number`
|
|
5963
|
+
*/
|
|
5964
|
+
|
|
5791
5965
|
|
|
5792
5966
|
class MediaLayout extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
|
|
5793
5967
|
render() {
|
|
@@ -6404,7 +6578,6 @@ function (module, __webpack_exports__, __webpack_require__) {
|
|
|
6404
6578
|
case "checkbox":
|
|
6405
6579
|
case "radio":
|
|
6406
6580
|
case "listbox":
|
|
6407
|
-
case "option":
|
|
6408
6581
|
return {
|
|
6409
6582
|
triggerOnEnter: false,
|
|
6410
6583
|
triggerOnSpace: true
|
|
@@ -6414,6 +6587,7 @@ function (module, __webpack_exports__, __webpack_require__) {
|
|
|
6414
6587
|
case "button":
|
|
6415
6588
|
case "menuitem":
|
|
6416
6589
|
case "menu":
|
|
6590
|
+
case "option":
|
|
6417
6591
|
default:
|
|
6418
6592
|
return {
|
|
6419
6593
|
triggerOnEnter: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-search-field",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"design": "v1",
|
|
5
5
|
"description": "Search Field components for Wonder Blocks.",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
"access": "public"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@babel/runtime": "^7.
|
|
18
|
+
"@babel/runtime": "^7.18.6",
|
|
19
19
|
"@khanacademy/wonder-blocks-color": "^1.1.20",
|
|
20
20
|
"@khanacademy/wonder-blocks-core": "^4.3.2",
|
|
21
21
|
"@khanacademy/wonder-blocks-icon": "^1.2.29",
|
|
22
|
-
"@khanacademy/wonder-blocks-icon-button": "^3.4.
|
|
22
|
+
"@khanacademy/wonder-blocks-icon-button": "^3.4.9",
|
|
23
23
|
"@khanacademy/wonder-blocks-spacing": "^3.0.5",
|
|
24
24
|
"@khanacademy/wonder-blocks-typography": "^1.1.32"
|
|
25
25
|
},
|