@fluentui/react-checkbox 9.1.3 → 9.1.5
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/.swcrc +30 -0
- package/CHANGELOG.json +103 -1
- package/CHANGELOG.md +32 -2
- package/lib/Checkbox.js.map +1 -1
- package/lib/CheckboxField.js.map +1 -1
- package/lib/components/Checkbox/Checkbox.js.map +1 -1
- package/lib/components/Checkbox/Checkbox.types.js +1 -1
- package/lib/components/Checkbox/Checkbox.types.js.map +1 -1
- package/lib/components/Checkbox/index.js.map +1 -1
- package/lib/components/Checkbox/renderCheckbox.js +1 -11
- package/lib/components/Checkbox/renderCheckbox.js.map +1 -1
- package/lib/components/Checkbox/useCheckbox.js +1 -2
- package/lib/components/Checkbox/useCheckbox.js.map +1 -1
- package/lib/components/Checkbox/useCheckboxStyles.js.map +1 -1
- package/lib/components/CheckboxField/CheckboxField.js +1 -2
- package/lib/components/CheckboxField/CheckboxField.js.map +1 -1
- package/lib/components/CheckboxField/index.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib-commonjs/Checkbox.js +5 -4
- package/lib-commonjs/Checkbox.js.map +1 -1
- package/lib-commonjs/CheckboxField.js +5 -4
- package/lib-commonjs/CheckboxField.js.map +1 -1
- package/lib-commonjs/components/Checkbox/Checkbox.js +19 -21
- package/lib-commonjs/components/Checkbox/Checkbox.js.map +1 -1
- package/lib-commonjs/components/Checkbox/Checkbox.types.js +5 -2
- package/lib-commonjs/components/Checkbox/Checkbox.types.js.map +1 -1
- package/lib-commonjs/components/Checkbox/index.js +9 -8
- package/lib-commonjs/components/Checkbox/index.js.map +1 -1
- package/lib-commonjs/components/Checkbox/renderCheckbox.js +13 -23
- package/lib-commonjs/components/Checkbox/renderCheckbox.js.map +1 -1
- package/lib-commonjs/components/Checkbox/useCheckbox.js +107 -113
- package/lib-commonjs/components/Checkbox/useCheckbox.js.map +1 -1
- package/lib-commonjs/components/Checkbox/useCheckboxStyles.js +344 -161
- package/lib-commonjs/components/Checkbox/useCheckboxStyles.js.map +1 -1
- package/lib-commonjs/components/CheckboxField/CheckboxField.js +27 -21
- package/lib-commonjs/components/CheckboxField/CheckboxField.js.map +1 -1
- package/lib-commonjs/components/CheckboxField/index.js +5 -4
- package/lib-commonjs/components/CheckboxField/index.js.map +1 -1
- package/lib-commonjs/index.js +21 -49
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +12 -11
- package/lib-amd/Checkbox.js +0 -6
- package/lib-amd/Checkbox.js.map +0 -1
- package/lib-amd/CheckboxField.js +0 -6
- package/lib-amd/CheckboxField.js.map +0 -1
- package/lib-amd/components/Checkbox/Checkbox.js +0 -18
- package/lib-amd/components/Checkbox/Checkbox.js.map +0 -1
- package/lib-amd/components/Checkbox/Checkbox.types.js +0 -5
- package/lib-amd/components/Checkbox/Checkbox.types.js.map +0 -1
- package/lib-amd/components/Checkbox/index.js +0 -10
- package/lib-amd/components/Checkbox/index.js.map +0 -1
- package/lib-amd/components/Checkbox/renderCheckbox.js +0 -15
- package/lib-amd/components/Checkbox/renderCheckbox.js.map +0 -1
- package/lib-amd/components/Checkbox/useCheckbox.js +0 -97
- package/lib-amd/components/Checkbox/useCheckbox.js.map +0 -1
- package/lib-amd/components/Checkbox/useCheckboxStyles.js +0 -163
- package/lib-amd/components/Checkbox/useCheckboxStyles.js.map +0 -1
- package/lib-amd/components/CheckboxField/CheckboxField.js +0 -12
- package/lib-amd/components/CheckboxField/CheckboxField.js.map +0 -1
- package/lib-amd/components/CheckboxField/index.js +0 -6
- package/lib-amd/components/CheckboxField/index.js.map +0 -1
- package/lib-amd/index.js +0 -13
- package/lib-amd/index.js.map +0 -1
|
@@ -1,25 +1,31 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
1
|
+
/* eslint-disable deprecation/deprecation */ "use strict";
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
3
|
+
value: true
|
|
5
4
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
...props,
|
|
16
|
-
label: props.fieldLabel,
|
|
17
|
-
required: undefined,
|
|
18
|
-
control: {
|
|
19
|
-
...props.control,
|
|
20
|
-
required: props.required,
|
|
21
|
-
label: props.label
|
|
22
|
-
}
|
|
23
|
-
})
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
checkboxFieldClassNames: ()=>checkboxFieldClassNames,
|
|
13
|
+
CheckboxField: ()=>CheckboxField
|
|
24
14
|
});
|
|
15
|
+
const _reactField = require("@fluentui/react-field");
|
|
16
|
+
const _checkbox = require("../../Checkbox");
|
|
17
|
+
const checkboxFieldClassNames = /*#__PURE__*/ (0, _reactField.getDeprecatedFieldClassNames)(_checkbox.checkboxClassNames.root);
|
|
18
|
+
const CheckboxField = /*#__PURE__*/ (0, _reactField.makeDeprecatedField)(_checkbox.Checkbox, {
|
|
19
|
+
mapProps: (props)=>({
|
|
20
|
+
...props,
|
|
21
|
+
label: props.fieldLabel,
|
|
22
|
+
required: undefined,
|
|
23
|
+
control: {
|
|
24
|
+
...props.control,
|
|
25
|
+
required: props.required,
|
|
26
|
+
label: props.label
|
|
27
|
+
}
|
|
28
|
+
})
|
|
29
|
+
}); //# sourceMappingURL=CheckboxField.js.map
|
|
30
|
+
|
|
25
31
|
//# sourceMappingURL=CheckboxField.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../lib/components/CheckboxField/CheckboxField.js"],"sourcesContent":["/* eslint-disable deprecation/deprecation */import { getDeprecatedFieldClassNames, makeDeprecatedField } from '@fluentui/react-field';\nimport { Checkbox, checkboxClassNames } from '../../Checkbox';\n/** @deprecated Use Field with a Checkbox inside: `<Field><Checkbox /></Field>` */\nexport const checkboxFieldClassNames = /*#__PURE__*/getDeprecatedFieldClassNames(checkboxClassNames.root);\n/** @deprecated Use Field with a Checkbox inside: `<Field><Checkbox /></Field>` */\nexport const CheckboxField = /*#__PURE__*/makeDeprecatedField(Checkbox, {\n mapProps: props => ({\n ...props,\n label: props.fieldLabel,\n required: undefined,\n control: {\n ...props.control,\n required: props.required,\n label: props.label\n }\n })\n});\n//# sourceMappingURL=CheckboxField.js.map"],"names":["checkboxFieldClassNames","CheckboxField","getDeprecatedFieldClassNames","checkboxClassNames","root","makeDeprecatedField","Checkbox","mapProps","props","label","fieldLabel","required","undefined","control"],"mappings":"AAAA,0CAA0C;;;;;;;;;;;IAG7BA,uBAAuB,MAAvBA;IAEAC,aAAa,MAAbA;;4BALiG;0BACjE;AAEtC,MAAMD,0BAA0B,WAAW,GAAEE,IAAAA,wCAA4B,EAACC,4BAAkB,CAACC,IAAI;AAEjG,MAAMH,gBAAgB,WAAW,GAAEI,IAAAA,+BAAmB,EAACC,kBAAQ,EAAE;IACtEC,UAAUC,CAAAA,QAAU,CAAA;YAClB,GAAGA,KAAK;YACRC,OAAOD,MAAME,UAAU;YACvBC,UAAUC;YACVC,SAAS;gBACP,GAAGL,MAAMK,OAAO;gBAChBF,UAAUH,MAAMG,QAAQ;gBACxBF,OAAOD,MAAMC,KAAK;YACpB;QACF,CAAA;AACF,IACA,yCAAyC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
3
|
+
value: true
|
|
5
4
|
});
|
|
6
|
-
const
|
|
7
|
-
|
|
5
|
+
const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
|
|
6
|
+
_exportStar(require("./CheckboxField"), exports);
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
8
|
+
|
|
8
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../lib/components/CheckboxField/index.js"],"sourcesContent":["export * from './CheckboxField';\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;CACd,iCAAiC"}
|
package/lib-commonjs/index.js
CHANGED
|
@@ -1,52 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
});
|
|
26
|
-
Object.defineProperty(exports, "useCheckboxStyles_unstable", {
|
|
27
|
-
enumerable: true,
|
|
28
|
-
get: function () {
|
|
29
|
-
return Checkbox_1.useCheckboxStyles_unstable;
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
Object.defineProperty(exports, "useCheckbox_unstable", {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function () {
|
|
35
|
-
return Checkbox_1.useCheckbox_unstable;
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
39
|
-
var CheckboxField_1 = /*#__PURE__*/require("./CheckboxField");
|
|
40
|
-
Object.defineProperty(exports, "CheckboxField_unstable", {
|
|
41
|
-
enumerable: true,
|
|
42
|
-
get: function () {
|
|
43
|
-
return CheckboxField_1.CheckboxField;
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
Object.defineProperty(exports, "checkboxFieldClassNames", {
|
|
47
|
-
enumerable: true,
|
|
48
|
-
get: function () {
|
|
49
|
-
return CheckboxField_1.checkboxFieldClassNames;
|
|
50
|
-
}
|
|
51
|
-
});
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
Checkbox: ()=>_checkbox.Checkbox,
|
|
13
|
+
checkboxClassNames: ()=>_checkbox.checkboxClassNames,
|
|
14
|
+
renderCheckbox_unstable: ()=>_checkbox.renderCheckbox_unstable,
|
|
15
|
+
useCheckboxStyles_unstable: ()=>_checkbox.useCheckboxStyles_unstable,
|
|
16
|
+
useCheckbox_unstable: ()=>_checkbox.useCheckbox_unstable,
|
|
17
|
+
CheckboxField_unstable: ()=>_checkboxField.CheckboxField,
|
|
18
|
+
checkboxFieldClassNames: ()=>_checkboxField.checkboxFieldClassNames
|
|
19
|
+
});
|
|
20
|
+
const _checkbox = require("./Checkbox");
|
|
21
|
+
const _checkboxField = require("./CheckboxField");
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
23
|
+
|
|
52
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../lib/index.js"],"sourcesContent":["export { Checkbox, checkboxClassNames, renderCheckbox_unstable, useCheckboxStyles_unstable, useCheckbox_unstable } from './Checkbox';\n// eslint-disable-next-line deprecation/deprecation\nexport { CheckboxField as CheckboxField_unstable, checkboxFieldClassNames } from './CheckboxField';\n//# sourceMappingURL=index.js.map"],"names":["Checkbox","checkboxClassNames","renderCheckbox_unstable","useCheckboxStyles_unstable","useCheckbox_unstable","CheckboxField_unstable","CheckboxField","checkboxFieldClassNames"],"mappings":";;;;;;;;;;;IAASA,QAAQ,MAARA,kBAAQ;IAAEC,kBAAkB,MAAlBA,4BAAkB;IAAEC,uBAAuB,MAAvBA,iCAAuB;IAAEC,0BAA0B,MAA1BA,oCAA0B;IAAEC,oBAAoB,MAApBA,8BAAoB;IAEtFC,sBAAsB,MAAvCC,4BAAa;IAA4BC,uBAAuB,MAAvBA,sCAAuB;;0BAF+C;+BAEvC;CACjF,iCAAiC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-checkbox",
|
|
3
|
-
"version": "9.1.
|
|
3
|
+
"version": "9.1.5",
|
|
4
4
|
"description": "Fluent UI checkbox component",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -22,25 +22,25 @@
|
|
|
22
22
|
"test": "jest --passWithNoTests",
|
|
23
23
|
"storybook": "start-storybook",
|
|
24
24
|
"type-check": "tsc -b tsconfig.json",
|
|
25
|
-
"generate-api": "
|
|
25
|
+
"generate-api": "just-scripts generate-api"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@fluentui/eslint-plugin": "*",
|
|
29
29
|
"@fluentui/react-conformance": "*",
|
|
30
|
-
"@fluentui/react-conformance-griffel": "9.0.0-beta.
|
|
30
|
+
"@fluentui/react-conformance-griffel": "9.0.0-beta.20",
|
|
31
31
|
"@fluentui/scripts-api-extractor": "*",
|
|
32
32
|
"@fluentui/scripts-tasks": "*"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@fluentui/react-field": "9.0.0-alpha.
|
|
36
|
-
"@fluentui/react-icons": "^2.0.
|
|
37
|
-
"@fluentui/react-label": "^9.1.
|
|
38
|
-
"@fluentui/react-shared-contexts": "^9.3.
|
|
39
|
-
"@fluentui/react-tabster": "^9.
|
|
40
|
-
"@fluentui/react-theme": "^9.1.
|
|
41
|
-
"@fluentui/react-utilities": "^9.7.
|
|
35
|
+
"@fluentui/react-field": "9.0.0-alpha.27",
|
|
36
|
+
"@fluentui/react-icons": "^2.0.196",
|
|
37
|
+
"@fluentui/react-label": "^9.1.5",
|
|
38
|
+
"@fluentui/react-shared-contexts": "^9.3.2",
|
|
39
|
+
"@fluentui/react-tabster": "^9.6.1",
|
|
40
|
+
"@fluentui/react-theme": "^9.1.7",
|
|
41
|
+
"@fluentui/react-utilities": "^9.7.2",
|
|
42
42
|
"@griffel/react": "^1.5.2",
|
|
43
|
-
"
|
|
43
|
+
"@swc/helpers": "^0.4.14"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"@types/react": ">=16.8.0 <19.0.0",
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
"exports": {
|
|
58
58
|
".": {
|
|
59
59
|
"types": "./dist/index.d.ts",
|
|
60
|
+
"node": "./lib-commonjs/index.js",
|
|
60
61
|
"import": "./lib/index.js",
|
|
61
62
|
"require": "./lib-commonjs/index.js"
|
|
62
63
|
},
|
package/lib-amd/Checkbox.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
define(["require", "exports", "tslib", "./components/Checkbox/index"], function (require, exports, tslib_1, index_1) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
tslib_1.__exportStar(index_1, exports);
|
|
5
|
-
});
|
|
6
|
-
//# sourceMappingURL=Checkbox.js.map
|
package/lib-amd/Checkbox.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-checkbox/src/Checkbox.ts"],"names":[],"mappings":";;;IAAA,uCAA4C","sourcesContent":["export * from './components/Checkbox/index';\n"]}
|
package/lib-amd/CheckboxField.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
define(["require", "exports", "tslib", "./components/CheckboxField/index"], function (require, exports, tslib_1, index_1) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
tslib_1.__exportStar(index_1, exports);
|
|
5
|
-
});
|
|
6
|
-
//# sourceMappingURL=CheckboxField.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxField.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-checkbox/src/CheckboxField.ts"],"names":[],"mappings":";;;IAAA,uCAAiD","sourcesContent":["export * from './components/CheckboxField/index';\n"]}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
define(["require", "exports", "react", "./useCheckbox", "./renderCheckbox", "./useCheckboxStyles", "@fluentui/react-shared-contexts"], function (require, exports, React, useCheckbox_1, renderCheckbox_1, useCheckboxStyles_1, react_shared_contexts_1) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.Checkbox = void 0;
|
|
5
|
-
/**
|
|
6
|
-
* Checkboxes give people a way to select one or more items from a group,
|
|
7
|
-
* or switch between two mutually exclusive options (checked or unchecked).
|
|
8
|
-
*/
|
|
9
|
-
exports.Checkbox = React.forwardRef(function (props, ref) {
|
|
10
|
-
var state = useCheckbox_1.useCheckbox_unstable(props, ref);
|
|
11
|
-
useCheckboxStyles_1.useCheckboxStyles_unstable(state);
|
|
12
|
-
var useCustomStyles = react_shared_contexts_1.useCustomStyleHooks_unstable().useAccordionHeaderStyles_unstable;
|
|
13
|
-
useCustomStyles(state);
|
|
14
|
-
return renderCheckbox_1.renderCheckbox_unstable(state);
|
|
15
|
-
});
|
|
16
|
-
exports.Checkbox.displayName = 'Checkbox';
|
|
17
|
-
});
|
|
18
|
-
//# sourceMappingURL=Checkbox.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-checkbox/src/components/Checkbox/Checkbox.tsx"],"names":[],"mappings":";;;;IAQA;;;OAGG;IACU,QAAA,QAAQ,GAAuC,KAAK,CAAC,UAAU,CAAC,UAAC,KAAK,EAAE,GAAG;QACtF,IAAM,KAAK,GAAG,kCAAoB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAE/C,8CAA0B,CAAC,KAAK,CAAC,CAAC;QAE1B,IAAmC,eAAe,GAAK,oDAA4B,EAAE,kCAAnC,CAAoC;QAC9F,eAAe,CAAC,KAAK,CAAC,CAAC;QAEvB,OAAO,wCAAuB,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,gBAAQ,CAAC,WAAW,GAAG,UAAU,CAAC","sourcesContent":["import * as React from 'react';\nimport { useCheckbox_unstable } from './useCheckbox';\nimport { renderCheckbox_unstable } from './renderCheckbox';\nimport { useCheckboxStyles_unstable } from './useCheckboxStyles';\nimport type { CheckboxProps } from './Checkbox.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHooks_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * Checkboxes give people a way to select one or more items from a group,\n * or switch between two mutually exclusive options (checked or unchecked).\n */\nexport const Checkbox: ForwardRefComponent<CheckboxProps> = React.forwardRef((props, ref) => {\n const state = useCheckbox_unstable(props, ref);\n\n useCheckboxStyles_unstable(state);\n\n const { useAccordionHeaderStyles_unstable: useCustomStyles } = useCustomStyleHooks_unstable();\n useCustomStyles(state);\n\n return renderCheckbox_unstable(state);\n});\n\nCheckbox.displayName = 'Checkbox';\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.types.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-checkbox/src/components/Checkbox/Checkbox.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport { Label } from '@fluentui/react-label';\nimport { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type CheckboxSlots = {\n /**\n * The root element of the Checkbox.\n *\n * The root slot receives the `className` and `style` specified directly on the `<Checkbox>`.\n * All other native props will be applied to the primary slot: `input`\n */\n root: NonNullable<Slot<'span'>>;\n\n /**\n * The Checkbox's label.\n */\n label?: Slot<typeof Label>;\n\n /**\n * Hidden input that handles the checkbox's functionality.\n *\n * This is the PRIMARY slot: all native properties specified directly on `<Checkbox>` will be applied to this slot,\n * except `className` and `style`, which remain on the root slot.\n */\n input: NonNullable<Slot<'input'>>;\n\n /**\n * The checkbox, with the checkmark icon as its child when checked.\n */\n indicator: Slot<'div'>;\n};\n\n/**\n * Checkbox Props\n */\nexport type CheckboxProps = Omit<\n ComponentProps<Partial<CheckboxSlots>, 'input'>,\n 'checked' | 'defaultChecked' | 'onChange' | 'size'\n> & {\n /**\n * The controlled value for the checkbox.\n *\n * @default false\n */\n checked?: 'mixed' | boolean;\n\n /**\n * Checkboxes don't support children. To add a label, use the `label` prop.\n */\n children?: never;\n\n /**\n * Whether the checkbox should be rendered as checked by default.\n */\n defaultChecked?: 'mixed' | boolean;\n\n /**\n * The position of the label relative to the checkbox indicator.\n *\n * @default after\n */\n labelPosition?: 'before' | 'after';\n\n /**\n * Callback to be called when the checked state value changes.\n */\n onChange?: (ev: React.ChangeEvent<HTMLInputElement>, data: CheckboxOnChangeData) => void;\n\n /**\n * The shape of the checkbox indicator.\n *\n * The `circular` variant is only recommended to be used in a tasks-style UI (checklist),\n * since it otherwise could be confused for a `RadioItem`.\n *\n * @default square\n */\n shape?: 'square' | 'circular';\n\n /**\n * The size of the checkbox indicator.\n *\n * @default medium\n */\n size?: 'medium' | 'large';\n};\n\n/**\n * Data for the onChange event for checkbox.\n */\nexport interface CheckboxOnChangeData {\n checked: 'mixed' | boolean;\n}\n\n/**\n * State used in rendering Checkbox\n */\nexport type CheckboxState = ComponentState<CheckboxSlots> &\n Required<Pick<CheckboxProps, 'checked' | 'disabled' | 'labelPosition' | 'shape' | 'size'>>;\n"]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
define(["require", "exports", "tslib", "./Checkbox", "./Checkbox.types", "./renderCheckbox", "./useCheckbox", "./useCheckboxStyles"], function (require, exports, tslib_1, Checkbox_1, Checkbox_types_1, renderCheckbox_1, useCheckbox_1, useCheckboxStyles_1) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
tslib_1.__exportStar(Checkbox_1, exports);
|
|
5
|
-
tslib_1.__exportStar(Checkbox_types_1, exports);
|
|
6
|
-
tslib_1.__exportStar(renderCheckbox_1, exports);
|
|
7
|
-
tslib_1.__exportStar(useCheckbox_1, exports);
|
|
8
|
-
tslib_1.__exportStar(useCheckboxStyles_1, exports);
|
|
9
|
-
});
|
|
10
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-checkbox/src/components/Checkbox/index.ts"],"names":[],"mappings":";;;IAAA,0CAA2B;IAC3B,gDAAiC;IACjC,gDAAiC;IACjC,6CAA8B;IAC9B,mDAAoC","sourcesContent":["export * from './Checkbox';\nexport * from './Checkbox.types';\nexport * from './renderCheckbox';\nexport * from './useCheckbox';\nexport * from './useCheckboxStyles';\n"]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
define(["require", "exports", "tslib", "react", "@fluentui/react-utilities"], function (require, exports, tslib_1, React, react_utilities_1) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.renderCheckbox_unstable = void 0;
|
|
5
|
-
var renderCheckbox_unstable = function (state) {
|
|
6
|
-
var _a = react_utilities_1.getSlots(state), slots = _a.slots, slotProps = _a.slotProps;
|
|
7
|
-
return (React.createElement(slots.root, tslib_1.__assign({}, slotProps.root),
|
|
8
|
-
React.createElement(slots.input, tslib_1.__assign({}, slotProps.input)),
|
|
9
|
-
state.labelPosition === 'before' && slots.label && React.createElement(slots.label, tslib_1.__assign({}, slotProps.label)),
|
|
10
|
-
React.createElement(slots.indicator, tslib_1.__assign({}, slotProps.indicator)),
|
|
11
|
-
state.labelPosition === 'after' && slots.label && React.createElement(slots.label, tslib_1.__assign({}, slotProps.label))));
|
|
12
|
-
};
|
|
13
|
-
exports.renderCheckbox_unstable = renderCheckbox_unstable;
|
|
14
|
-
});
|
|
15
|
-
//# sourceMappingURL=renderCheckbox.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"renderCheckbox.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-checkbox/src/components/Checkbox/renderCheckbox.tsx"],"names":[],"mappings":";;;;IAIO,IAAM,uBAAuB,GAAG,UAAC,KAAoB;QACpD,IAAA,KAAuB,0BAAQ,CAAgB,KAAK,CAAC,EAAnD,KAAK,WAAA,EAAE,SAAS,eAAmC,CAAC;QAE5D,OAAO,CACL,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI;YAC5B,oBAAC,KAAK,CAAC,KAAK,uBAAK,SAAS,CAAC,KAAK,EAAI;YACnC,KAAK,CAAC,aAAa,KAAK,QAAQ,IAAI,KAAK,CAAC,KAAK,IAAI,oBAAC,KAAK,CAAC,KAAK,uBAAK,SAAS,CAAC,KAAK,EAAI;YACxF,oBAAC,KAAK,CAAC,SAAS,uBAAK,SAAS,CAAC,SAAS,EAAI;YAC3C,KAAK,CAAC,aAAa,KAAK,OAAO,IAAI,KAAK,CAAC,KAAK,IAAI,oBAAC,KAAK,CAAC,KAAK,uBAAK,SAAS,CAAC,KAAK,EAAI,CAC5E,CACd,CAAC;IACJ,CAAC,CAAC;IAXW,QAAA,uBAAuB,2BAWlC","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport { CheckboxState, CheckboxSlots } from './Checkbox.types';\n\nexport const renderCheckbox_unstable = (state: CheckboxState) => {\n const { slots, slotProps } = getSlots<CheckboxSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n <slots.input {...slotProps.input} />\n {state.labelPosition === 'before' && slots.label && <slots.label {...slotProps.label} />}\n <slots.indicator {...slotProps.indicator} />\n {state.labelPosition === 'after' && slots.label && <slots.label {...slotProps.label} />}\n </slots.root>\n );\n};\n"]}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
define(["require", "exports", "tslib", "react", "@fluentui/react-utilities", "@fluentui/react-icons", "@fluentui/react-label", "@fluentui/react-tabster"], function (require, exports, tslib_1, React, react_utilities_1, react_icons_1, react_label_1, react_tabster_1) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.useCheckbox_unstable = void 0;
|
|
5
|
-
/**
|
|
6
|
-
* Create the state required to render Checkbox.
|
|
7
|
-
*
|
|
8
|
-
* The returned state can be modified with hooks such as useCheckboxStyles_unstable,
|
|
9
|
-
* before being passed to renderCheckbox_unstable.
|
|
10
|
-
*
|
|
11
|
-
* @param props - props from this instance of Checkbox
|
|
12
|
-
* @param ref - reference to `<input>` element of Checkbox
|
|
13
|
-
*/
|
|
14
|
-
var useCheckbox_unstable = function (props, ref) {
|
|
15
|
-
var _a = props.disabled, disabled = _a === void 0 ? false : _a, required = props.required, _b = props.shape, shape = _b === void 0 ? 'square' : _b, _c = props.size, size = _c === void 0 ? 'medium' : _c, _d = props.labelPosition, labelPosition = _d === void 0 ? 'after' : _d, onChange = props.onChange;
|
|
16
|
-
var _e = react_utilities_1.useControllableState({
|
|
17
|
-
defaultState: props.defaultChecked,
|
|
18
|
-
state: props.checked,
|
|
19
|
-
initialState: false,
|
|
20
|
-
}), checked = _e[0], setChecked = _e[1];
|
|
21
|
-
var nativeProps = react_utilities_1.getPartitionedNativeProps({
|
|
22
|
-
props: props,
|
|
23
|
-
primarySlotTagName: 'input',
|
|
24
|
-
excludedPropNames: ['checked', 'defaultChecked', 'size', 'onChange'],
|
|
25
|
-
});
|
|
26
|
-
var mixed = checked === 'mixed';
|
|
27
|
-
var id = react_utilities_1.useId('checkbox-', nativeProps.primary.id);
|
|
28
|
-
var checkmarkIcon;
|
|
29
|
-
if (mixed) {
|
|
30
|
-
if (shape === 'circular') {
|
|
31
|
-
checkmarkIcon = React.createElement(react_icons_1.CircleFilled, null);
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
checkmarkIcon = size === 'large' ? React.createElement(react_icons_1.Square16Filled, null) : React.createElement(react_icons_1.Square12Filled, null);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
else if (checked) {
|
|
38
|
-
checkmarkIcon = size === 'large' ? React.createElement(react_icons_1.Checkmark16Filled, null) : React.createElement(react_icons_1.Checkmark12Filled, null);
|
|
39
|
-
}
|
|
40
|
-
var state = {
|
|
41
|
-
shape: shape,
|
|
42
|
-
checked: checked,
|
|
43
|
-
disabled: disabled,
|
|
44
|
-
size: size,
|
|
45
|
-
labelPosition: labelPosition,
|
|
46
|
-
components: {
|
|
47
|
-
root: 'span',
|
|
48
|
-
input: 'input',
|
|
49
|
-
indicator: 'div',
|
|
50
|
-
label: react_label_1.Label,
|
|
51
|
-
},
|
|
52
|
-
root: react_utilities_1.resolveShorthand(props.root, {
|
|
53
|
-
required: true,
|
|
54
|
-
defaultProps: tslib_1.__assign({ ref: react_tabster_1.useFocusWithin() }, nativeProps.root),
|
|
55
|
-
}),
|
|
56
|
-
input: react_utilities_1.resolveShorthand(props.input, {
|
|
57
|
-
required: true,
|
|
58
|
-
defaultProps: tslib_1.__assign({ type: 'checkbox', id: id, ref: ref, checked: checked === true }, nativeProps.primary),
|
|
59
|
-
}),
|
|
60
|
-
label: react_utilities_1.resolveShorthand(props.label, {
|
|
61
|
-
required: false,
|
|
62
|
-
defaultProps: {
|
|
63
|
-
htmlFor: id,
|
|
64
|
-
disabled: disabled,
|
|
65
|
-
required: required,
|
|
66
|
-
size: 'medium', // Even if the checkbox itself is large
|
|
67
|
-
},
|
|
68
|
-
}),
|
|
69
|
-
indicator: react_utilities_1.resolveShorthand(props.indicator, {
|
|
70
|
-
required: true,
|
|
71
|
-
defaultProps: {
|
|
72
|
-
'aria-hidden': true,
|
|
73
|
-
children: checkmarkIcon,
|
|
74
|
-
},
|
|
75
|
-
}),
|
|
76
|
-
};
|
|
77
|
-
state.input.onChange = react_utilities_1.useEventCallback(function (ev) {
|
|
78
|
-
var val = ev.currentTarget.indeterminate ? 'mixed' : ev.currentTarget.checked;
|
|
79
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(ev, { checked: val });
|
|
80
|
-
setChecked(val);
|
|
81
|
-
});
|
|
82
|
-
// Create a ref object for the input element so we can use it to set the indeterminate prop.
|
|
83
|
-
// Use useMergedRefs, since the ref might be undefined or a function-ref (no .current)
|
|
84
|
-
var inputRef = react_utilities_1.useMergedRefs(state.input.ref);
|
|
85
|
-
state.input.ref = inputRef;
|
|
86
|
-
// Set the <input> element's checked and indeterminate properties based on our tri-state property.
|
|
87
|
-
// Since indeterminate can only be set via javascript, it has to be done in a layout effect.
|
|
88
|
-
react_utilities_1.useIsomorphicLayoutEffect(function () {
|
|
89
|
-
if (inputRef.current) {
|
|
90
|
-
inputRef.current.indeterminate = mixed;
|
|
91
|
-
}
|
|
92
|
-
}, [inputRef, mixed]);
|
|
93
|
-
return state;
|
|
94
|
-
};
|
|
95
|
-
exports.useCheckbox_unstable = useCheckbox_unstable;
|
|
96
|
-
});
|
|
97
|
-
//# sourceMappingURL=useCheckbox.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useCheckbox.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-checkbox/src/components/Checkbox/useCheckbox.tsx"],"names":[],"mappings":"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","sourcesContent":["import * as React from 'react';\nimport {\n getPartitionedNativeProps,\n resolveShorthand,\n useControllableState,\n useEventCallback,\n useId,\n useIsomorphicLayoutEffect,\n useMergedRefs,\n} from '@fluentui/react-utilities';\nimport { CheckboxProps, CheckboxState } from './Checkbox.types';\nimport {\n Checkmark12Filled,\n Checkmark16Filled,\n Square12Filled,\n Square16Filled,\n CircleFilled,\n} from '@fluentui/react-icons';\nimport { Label } from '@fluentui/react-label';\nimport { useFocusWithin } from '@fluentui/react-tabster';\n\n/**\n * Create the state required to render Checkbox.\n *\n * The returned state can be modified with hooks such as useCheckboxStyles_unstable,\n * before being passed to renderCheckbox_unstable.\n *\n * @param props - props from this instance of Checkbox\n * @param ref - reference to `<input>` element of Checkbox\n */\nexport const useCheckbox_unstable = (props: CheckboxProps, ref: React.Ref<HTMLInputElement>): CheckboxState => {\n const { disabled = false, required, shape = 'square', size = 'medium', labelPosition = 'after', onChange } = props;\n\n const [checked, setChecked] = useControllableState({\n defaultState: props.defaultChecked,\n state: props.checked,\n initialState: false,\n });\n\n const nativeProps = getPartitionedNativeProps({\n props,\n primarySlotTagName: 'input',\n excludedPropNames: ['checked', 'defaultChecked', 'size', 'onChange'],\n });\n\n const mixed = checked === 'mixed';\n const id = useId('checkbox-', nativeProps.primary.id);\n\n let checkmarkIcon;\n if (mixed) {\n if (shape === 'circular') {\n checkmarkIcon = <CircleFilled />;\n } else {\n checkmarkIcon = size === 'large' ? <Square16Filled /> : <Square12Filled />;\n }\n } else if (checked) {\n checkmarkIcon = size === 'large' ? <Checkmark16Filled /> : <Checkmark12Filled />;\n }\n\n const state: CheckboxState = {\n shape,\n checked,\n disabled,\n size,\n labelPosition,\n components: {\n root: 'span',\n input: 'input',\n indicator: 'div',\n label: Label,\n },\n root: resolveShorthand(props.root, {\n required: true,\n defaultProps: {\n ref: useFocusWithin<HTMLSpanElement>(),\n ...nativeProps.root,\n },\n }),\n input: resolveShorthand(props.input, {\n required: true,\n defaultProps: {\n type: 'checkbox',\n id,\n ref,\n checked: checked === true,\n ...nativeProps.primary,\n },\n }),\n label: resolveShorthand(props.label, {\n required: false,\n defaultProps: {\n htmlFor: id,\n disabled,\n required,\n size: 'medium', // Even if the checkbox itself is large\n },\n }),\n indicator: resolveShorthand(props.indicator, {\n required: true,\n defaultProps: {\n 'aria-hidden': true,\n children: checkmarkIcon,\n },\n }),\n };\n\n state.input.onChange = useEventCallback(ev => {\n const val = ev.currentTarget.indeterminate ? 'mixed' : ev.currentTarget.checked;\n onChange?.(ev, { checked: val });\n setChecked(val);\n });\n\n // Create a ref object for the input element so we can use it to set the indeterminate prop.\n // Use useMergedRefs, since the ref might be undefined or a function-ref (no .current)\n const inputRef = useMergedRefs(state.input.ref);\n state.input.ref = inputRef;\n\n // Set the <input> element's checked and indeterminate properties based on our tri-state property.\n // Since indeterminate can only be set via javascript, it has to be done in a layout effect.\n useIsomorphicLayoutEffect(() => {\n if (inputRef.current) {\n inputRef.current.indeterminate = mixed;\n }\n }, [inputRef, mixed]);\n\n return state;\n};\n"]}
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
define(["require", "exports", "tslib", "@griffel/react", "@fluentui/react-tabster", "@fluentui/react-theme"], function (require, exports, tslib_1, react_1, react_tabster_1, react_theme_1) {
|
|
2
|
-
"use strict";
|
|
3
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.useCheckboxStyles_unstable = exports.checkboxClassNames = void 0;
|
|
6
|
-
exports.checkboxClassNames = {
|
|
7
|
-
root: 'fui-Checkbox',
|
|
8
|
-
label: 'fui-Checkbox__label',
|
|
9
|
-
input: 'fui-Checkbox__input',
|
|
10
|
-
indicator: 'fui-Checkbox__indicator',
|
|
11
|
-
};
|
|
12
|
-
// The indicator size is used by the indicator and label styles
|
|
13
|
-
var indicatorSizeMedium = '16px';
|
|
14
|
-
var indicatorSizeLarge = '20px';
|
|
15
|
-
var useRootBaseClassName = react_1.makeResetStyles(tslib_1.__assign({ position: 'relative', display: 'inline-flex', cursor: 'pointer', color: react_theme_1.tokens.colorNeutralForeground3 }, react_tabster_1.createFocusOutlineStyle({ style: {}, selector: 'focus-within' })));
|
|
16
|
-
var useRootStyles = react_1.makeStyles({
|
|
17
|
-
unchecked: {
|
|
18
|
-
':hover': (_a = {
|
|
19
|
-
color: react_theme_1.tokens.colorNeutralForeground2
|
|
20
|
-
},
|
|
21
|
-
_a["> ." + exports.checkboxClassNames.indicator] = tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStrokeAccessibleHover)),
|
|
22
|
-
_a),
|
|
23
|
-
':active': (_b = {
|
|
24
|
-
color: react_theme_1.tokens.colorNeutralForeground1
|
|
25
|
-
},
|
|
26
|
-
_b["> ." + exports.checkboxClassNames.indicator] = tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStrokeAccessiblePressed)),
|
|
27
|
-
_b),
|
|
28
|
-
},
|
|
29
|
-
checked: (_c = {
|
|
30
|
-
color: react_theme_1.tokens.colorNeutralForeground1
|
|
31
|
-
},
|
|
32
|
-
_c["> ." + exports.checkboxClassNames.indicator] = tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorCompoundBrandBackground, color: react_theme_1.tokens.colorNeutralForegroundInverted }, react_1.shorthands.borderColor(react_theme_1.tokens.colorCompoundBrandBackground)),
|
|
33
|
-
_c[':hover'] = (_d = {},
|
|
34
|
-
_d["> ." + exports.checkboxClassNames.indicator] = tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorCompoundBrandBackgroundHover }, react_1.shorthands.borderColor(react_theme_1.tokens.colorCompoundBrandBackgroundHover)),
|
|
35
|
-
_d),
|
|
36
|
-
_c[':active'] = (_e = {},
|
|
37
|
-
_e["> ." + exports.checkboxClassNames.indicator] = tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorCompoundBrandBackgroundPressed }, react_1.shorthands.borderColor(react_theme_1.tokens.colorCompoundBrandBackgroundPressed)),
|
|
38
|
-
_e),
|
|
39
|
-
_c),
|
|
40
|
-
mixed: (_f = {
|
|
41
|
-
color: react_theme_1.tokens.colorNeutralForeground1
|
|
42
|
-
},
|
|
43
|
-
_f["> ." + exports.checkboxClassNames.indicator] = tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorCompoundBrandStroke)), { color: react_theme_1.tokens.colorCompoundBrandForeground1 }),
|
|
44
|
-
_f[':hover'] = (_g = {},
|
|
45
|
-
_g["> ." + exports.checkboxClassNames.indicator] = tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorCompoundBrandStrokeHover)), { color: react_theme_1.tokens.colorCompoundBrandForeground1Hover }),
|
|
46
|
-
_g),
|
|
47
|
-
_f[':active'] = (_h = {},
|
|
48
|
-
_h["> ." + exports.checkboxClassNames.indicator] = tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorCompoundBrandStrokePressed)), { color: react_theme_1.tokens.colorCompoundBrandForeground1Pressed }),
|
|
49
|
-
_h),
|
|
50
|
-
_f),
|
|
51
|
-
disabled: (_j = {
|
|
52
|
-
cursor: 'default',
|
|
53
|
-
color: react_theme_1.tokens.colorNeutralForegroundDisabled
|
|
54
|
-
},
|
|
55
|
-
_j["> ." + exports.checkboxClassNames.indicator] = tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStrokeDisabled)), { color: react_theme_1.tokens.colorNeutralForegroundDisabled }),
|
|
56
|
-
_j['@media (forced-colors: active)'] = (_k = {
|
|
57
|
-
color: 'GrayText'
|
|
58
|
-
},
|
|
59
|
-
_k["> ." + exports.checkboxClassNames.indicator] = {
|
|
60
|
-
color: 'GrayText',
|
|
61
|
-
},
|
|
62
|
-
_k),
|
|
63
|
-
_j),
|
|
64
|
-
});
|
|
65
|
-
var useInputBaseClassName = react_1.makeResetStyles({
|
|
66
|
-
boxSizing: 'border-box',
|
|
67
|
-
cursor: 'inherit',
|
|
68
|
-
height: '100%',
|
|
69
|
-
margin: 0,
|
|
70
|
-
opacity: 0,
|
|
71
|
-
position: 'absolute',
|
|
72
|
-
top: 0,
|
|
73
|
-
// Calculate the width of the hidden input by taking into account the size of the indicator + the padding around it.
|
|
74
|
-
// This is done so that clicking on that "empty space" still toggles the checkbox.
|
|
75
|
-
width: "calc(" + indicatorSizeMedium + " + 2 * " + react_theme_1.tokens.spacingHorizontalS + ")",
|
|
76
|
-
});
|
|
77
|
-
var useInputStyles = react_1.makeStyles({
|
|
78
|
-
before: {
|
|
79
|
-
right: 0,
|
|
80
|
-
},
|
|
81
|
-
after: {
|
|
82
|
-
left: 0,
|
|
83
|
-
},
|
|
84
|
-
large: {
|
|
85
|
-
width: "calc(" + indicatorSizeLarge + " + 2 * " + react_theme_1.tokens.spacingHorizontalS + ")",
|
|
86
|
-
},
|
|
87
|
-
});
|
|
88
|
-
var useIndicatorBaseClassName = react_1.makeResetStyles({
|
|
89
|
-
alignSelf: 'flex-start',
|
|
90
|
-
boxSizing: 'border-box',
|
|
91
|
-
flexShrink: 0,
|
|
92
|
-
display: 'flex',
|
|
93
|
-
alignItems: 'center',
|
|
94
|
-
justifyContent: 'center',
|
|
95
|
-
overflow: 'hidden',
|
|
96
|
-
border: react_theme_1.tokens.strokeWidthThin + ' solid ' + react_theme_1.tokens.colorNeutralStrokeAccessible,
|
|
97
|
-
borderRadius: react_theme_1.tokens.borderRadiusSmall,
|
|
98
|
-
margin: react_theme_1.tokens.spacingVerticalS + ' ' + react_theme_1.tokens.spacingHorizontalS,
|
|
99
|
-
fill: 'currentColor',
|
|
100
|
-
pointerEvents: 'none',
|
|
101
|
-
fontSize: '12px',
|
|
102
|
-
height: indicatorSizeMedium,
|
|
103
|
-
width: indicatorSizeMedium,
|
|
104
|
-
});
|
|
105
|
-
var useIndicatorStyles = react_1.makeStyles({
|
|
106
|
-
large: {
|
|
107
|
-
fontSize: '16px',
|
|
108
|
-
height: indicatorSizeLarge,
|
|
109
|
-
width: indicatorSizeLarge,
|
|
110
|
-
},
|
|
111
|
-
circular: tslib_1.__assign({}, react_1.shorthands.borderRadius(react_theme_1.tokens.borderRadiusCircular)),
|
|
112
|
-
});
|
|
113
|
-
// Can't use makeResetStyles here because Label is a component that may itself use makeResetStyles.
|
|
114
|
-
var useLabelStyles = react_1.makeStyles({
|
|
115
|
-
base: tslib_1.__assign({ alignSelf: 'center', color: 'inherit', cursor: 'inherit' }, react_1.shorthands.padding(react_theme_1.tokens.spacingVerticalS, react_theme_1.tokens.spacingHorizontalS)),
|
|
116
|
-
before: {
|
|
117
|
-
paddingRight: react_theme_1.tokens.spacingHorizontalXS,
|
|
118
|
-
},
|
|
119
|
-
after: {
|
|
120
|
-
paddingLeft: react_theme_1.tokens.spacingHorizontalXS,
|
|
121
|
-
},
|
|
122
|
-
// Use a (negative) margin to account for the difference between the indicator's height and the label's line height.
|
|
123
|
-
// This prevents the label from expanding the height of the checkbox, but preserves line height if the label wraps.
|
|
124
|
-
medium: {
|
|
125
|
-
marginTop: "calc((" + indicatorSizeMedium + " - " + react_theme_1.tokens.lineHeightBase300 + ") / 2)",
|
|
126
|
-
marginBottom: "calc((" + indicatorSizeMedium + " - " + react_theme_1.tokens.lineHeightBase300 + ") / 2)",
|
|
127
|
-
},
|
|
128
|
-
large: {
|
|
129
|
-
marginTop: "calc((" + indicatorSizeLarge + " - " + react_theme_1.tokens.lineHeightBase300 + ") / 2)",
|
|
130
|
-
marginBottom: "calc((" + indicatorSizeLarge + " - " + react_theme_1.tokens.lineHeightBase300 + ") / 2)",
|
|
131
|
-
},
|
|
132
|
-
});
|
|
133
|
-
/**
|
|
134
|
-
* Apply styling to the Checkbox slots based on the state
|
|
135
|
-
*/
|
|
136
|
-
var useCheckboxStyles_unstable = function (state) {
|
|
137
|
-
var checked = state.checked, disabled = state.disabled, labelPosition = state.labelPosition, shape = state.shape, size = state.size;
|
|
138
|
-
var rootBaseClassName = useRootBaseClassName();
|
|
139
|
-
var rootStyles = useRootStyles();
|
|
140
|
-
state.root.className = react_1.mergeClasses(exports.checkboxClassNames.root, rootBaseClassName, disabled
|
|
141
|
-
? rootStyles.disabled
|
|
142
|
-
: checked === 'mixed'
|
|
143
|
-
? rootStyles.mixed
|
|
144
|
-
: checked
|
|
145
|
-
? rootStyles.checked
|
|
146
|
-
: rootStyles.unchecked, state.root.className);
|
|
147
|
-
var inputBaseClassName = useInputBaseClassName();
|
|
148
|
-
var inputStyles = useInputStyles();
|
|
149
|
-
state.input.className = react_1.mergeClasses(exports.checkboxClassNames.input, inputBaseClassName, size === 'large' && inputStyles.large, inputStyles[labelPosition], state.input.className);
|
|
150
|
-
var indicatorBaseClassName = useIndicatorBaseClassName();
|
|
151
|
-
var indicatorStyles = useIndicatorStyles();
|
|
152
|
-
if (state.indicator) {
|
|
153
|
-
state.indicator.className = react_1.mergeClasses(exports.checkboxClassNames.indicator, indicatorBaseClassName, size === 'large' && indicatorStyles.large, shape === 'circular' && indicatorStyles.circular, state.indicator.className);
|
|
154
|
-
}
|
|
155
|
-
var labelStyles = useLabelStyles();
|
|
156
|
-
if (state.label) {
|
|
157
|
-
state.label.className = react_1.mergeClasses(exports.checkboxClassNames.label, labelStyles.base, labelStyles[size], labelStyles[labelPosition], state.label.className);
|
|
158
|
-
}
|
|
159
|
-
return state;
|
|
160
|
-
};
|
|
161
|
-
exports.useCheckboxStyles_unstable = useCheckboxStyles_unstable;
|
|
162
|
-
});
|
|
163
|
-
//# sourceMappingURL=useCheckboxStyles.js.map
|