@pingux/astro 2.32.0-alpha.14 → 2.32.0-alpha.15
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/lib/cjs/hooks/useStatusClasses/index.d.ts +1 -0
- package/lib/cjs/hooks/useStatusClasses/useStatusClasses.d.ts +18 -0
- package/lib/cjs/hooks/useStatusClasses/useStatusClasses.js +0 -9
- package/lib/cjs/hooks/useStatusClasses/useStatusClasses.test.d.ts +1 -0
- package/lib/hooks/useStatusClasses/useStatusClasses.js +0 -10
- package/package.json +1 -1
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './useStatusClasses';
|
@@ -0,0 +1,18 @@
|
|
1
|
+
interface UseStatusClasses {
|
2
|
+
/**
|
3
|
+
* Converts status information into classes which can be supplied to the rendered component's
|
4
|
+
* `className` prop.
|
5
|
+
* @param {string} [defaultClass] An optional default class that will be added
|
6
|
+
* @param {{}} [statuses] A mapping of conditional statuses and the current value of each one
|
7
|
+
* @returns {{classNames: string}} A string of classes based on the input. Status keys will be
|
8
|
+
* converted to kebab-case.
|
9
|
+
* e.g. useStatusClasses('thing', { isDisabled: true }) => "thing is-disabled"
|
10
|
+
*/
|
11
|
+
(defaultClass?: string | undefined | null, statuses?: {
|
12
|
+
[key: string]: string | boolean | undefined | null;
|
13
|
+
}): {
|
14
|
+
classNames: string;
|
15
|
+
};
|
16
|
+
}
|
17
|
+
declare const useStatusClasses: UseStatusClasses;
|
18
|
+
export default useStatusClasses;
|
@@ -9,15 +9,6 @@ exports["default"] = void 0;
|
|
9
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
10
10
|
var _kebabCase = _interopRequireDefault(require("lodash/kebabCase"));
|
11
11
|
var _mapKeys = _interopRequireDefault(require("lodash/mapKeys"));
|
12
|
-
/**
|
13
|
-
* Converts status information into classes which can be supplied to the rendered component's
|
14
|
-
* `className` prop.
|
15
|
-
* @param {string} [defaultClass] An optional default class that will be added
|
16
|
-
* @param {{}} [statuses] A mapping of conditional statuses and the current value of each one
|
17
|
-
* @returns {{classNames: string}} A string of classes based on the input. Status keys will be
|
18
|
-
* converted to kebab-case.
|
19
|
-
* e.g. useStatusClasses('thing', { isDisabled: true }) => "thing is-disabled"
|
20
|
-
*/
|
21
12
|
var useStatusClasses = function useStatusClasses(defaultClass) {
|
22
13
|
var statuses = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
23
14
|
var kebabStatuses = (0, _mapKeys["default"])(statuses, function (_v, k) {
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -1,16 +1,6 @@
|
|
1
1
|
import classnames from 'classnames';
|
2
2
|
import kebabCase from 'lodash/kebabCase';
|
3
3
|
import mapKeys from 'lodash/mapKeys';
|
4
|
-
|
5
|
-
/**
|
6
|
-
* Converts status information into classes which can be supplied to the rendered component's
|
7
|
-
* `className` prop.
|
8
|
-
* @param {string} [defaultClass] An optional default class that will be added
|
9
|
-
* @param {{}} [statuses] A mapping of conditional statuses and the current value of each one
|
10
|
-
* @returns {{classNames: string}} A string of classes based on the input. Status keys will be
|
11
|
-
* converted to kebab-case.
|
12
|
-
* e.g. useStatusClasses('thing', { isDisabled: true }) => "thing is-disabled"
|
13
|
-
*/
|
14
4
|
var useStatusClasses = function useStatusClasses(defaultClass) {
|
15
5
|
var statuses = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
16
6
|
var kebabStatuses = mapKeys(statuses, function (_v, k) {
|