@atlaskit/ds-lib
Advanced tools
Comparing version 2.0.1 to 2.1.0
# @atlaskit/ds-lib | ||
## 2.1.0 | ||
### Minor Changes | ||
- [`620c24e72b4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/620c24e72b4) - Introduces `propDeprecationWarning` function. | ||
### Patch Changes | ||
- [`cd1a2f64027`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cd1a2f64027) - Internal code change turning on new linting rules. | ||
## 2.0.1 | ||
@@ -4,0 +14,0 @@ |
@@ -19,5 +19,5 @@ "use strict"; | ||
* const [uncontrolledState, setUncontrolledState] = useControlled( | ||
controlledValue, | ||
() => defaultValue, | ||
); | ||
* controlledValue, | ||
* () => defaultValue, | ||
* ); | ||
* ``` | ||
@@ -24,0 +24,0 @@ * |
@@ -14,2 +14,7 @@ "use strict"; | ||
/** | ||
* Provides a boolean value for whether an element is focused. | ||
* The `bindFocus` function returned provides two event handlers: | ||
* - `onFocus` and `onBlur` which when triggered set `isFocused` accordingly. | ||
*/ | ||
function useFocus() { | ||
@@ -16,0 +21,0 @@ var _useState = (0, _react.useState)(false), |
@@ -9,2 +9,3 @@ "use strict"; | ||
exports.default = deprecationWarning; | ||
exports.propDeprecationWarning = propDeprecationWarning; | ||
@@ -28,2 +29,17 @@ var _warnOnce = _interopRequireDefault(require("./warn-once")); | ||
(0, _warnOnce.default)("[".concat(packageName, "]: The ").concat(api, " is deprecated.").concat(additionalMessage && " ".concat(additionalMessage))); | ||
} | ||
/** | ||
* Logs a prop deprecation warning to console once during a session. | ||
* | ||
* @param packageName Use `process.env._PACKAGE_NAME_` instead of a static string. | ||
* @param propName Prop that is deprecated. | ||
* @param predicate If true the deprecation warning will be logged to console. | ||
* @param deprecationAnnouncementOnDAC Link to the public announcement on DAC. | ||
*/ | ||
function propDeprecationWarning(packageName, propName, predicate, deprecationAnnouncementOnDAC) { | ||
if (process.env.NODE_ENV === 'development' && predicate) { | ||
(0, _warnOnce.default)("[".concat(packageName, "]: The ").concat(propName, " prop is deprecated and will be removed, please migrate away.\nPublic announcement: ").concat(deprecationAnnouncementOnDAC)); | ||
} | ||
} |
@@ -11,2 +11,3 @@ "use strict"; | ||
*/ | ||
// eslint-disable-next-line @repo/internal/react/use-noop | ||
function noop() {} |
{ | ||
"name": "@atlaskit/ds-lib", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"sideEffects": false | ||
} |
@@ -7,5 +7,5 @@ import { useCallback, useEffect, useRef, useState } from 'react'; | ||
* const [uncontrolledState, setUncontrolledState] = useControlled( | ||
controlledValue, | ||
() => defaultValue, | ||
); | ||
* controlledValue, | ||
* () => defaultValue, | ||
* ); | ||
* ``` | ||
@@ -12,0 +12,0 @@ * |
import { useEffect, useRef, useState } from 'react'; | ||
/** | ||
* Provides a boolean value for whether an element is focused. | ||
* The `bindFocus` function returned provides two event handlers: | ||
* - `onFocus` and `onBlur` which when triggered set `isFocused` accordingly. | ||
*/ | ||
export default function useFocus() { | ||
@@ -3,0 +9,0 @@ const [isFocused, setIsFocused] = useState(false); // ensure bindFocus has a stable ref |
@@ -18,2 +18,17 @@ import warnOnce from './warn-once'; | ||
warnOnce(`[${packageName}]: The ${api} is deprecated.${additionalMessage && ` ${additionalMessage}`}`); | ||
} | ||
/** | ||
* Logs a prop deprecation warning to console once during a session. | ||
* | ||
* @param packageName Use `process.env._PACKAGE_NAME_` instead of a static string. | ||
* @param propName Prop that is deprecated. | ||
* @param predicate If true the deprecation warning will be logged to console. | ||
* @param deprecationAnnouncementOnDAC Link to the public announcement on DAC. | ||
*/ | ||
export function propDeprecationWarning(packageName, propName, predicate, deprecationAnnouncementOnDAC) { | ||
if (process.env.NODE_ENV === 'development' && predicate) { | ||
warnOnce(`[${packageName}]: The ${propName} prop is deprecated and will be removed, please migrate away. | ||
Public announcement: ${deprecationAnnouncementOnDAC}`); | ||
} | ||
} |
/** | ||
* An empty function which does nothing. | ||
*/ | ||
// eslint-disable-next-line @repo/internal/react/use-noop | ||
export default function noop() {} |
{ | ||
"name": "@atlaskit/ds-lib", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"sideEffects": false | ||
} |
@@ -8,5 +8,5 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; | ||
* const [uncontrolledState, setUncontrolledState] = useControlled( | ||
controlledValue, | ||
() => defaultValue, | ||
); | ||
* controlledValue, | ||
* () => defaultValue, | ||
* ); | ||
* ``` | ||
@@ -13,0 +13,0 @@ * |
import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; | ||
import { useEffect, useRef, useState } from 'react'; | ||
/** | ||
* Provides a boolean value for whether an element is focused. | ||
* The `bindFocus` function returned provides two event handlers: | ||
* - `onFocus` and `onBlur` which when triggered set `isFocused` accordingly. | ||
*/ | ||
export default function useFocus() { | ||
@@ -4,0 +10,0 @@ var _useState = useState(false), |
@@ -18,2 +18,16 @@ import warnOnce from './warn-once'; | ||
warnOnce("[".concat(packageName, "]: The ").concat(api, " is deprecated.").concat(additionalMessage && " ".concat(additionalMessage))); | ||
} | ||
/** | ||
* Logs a prop deprecation warning to console once during a session. | ||
* | ||
* @param packageName Use `process.env._PACKAGE_NAME_` instead of a static string. | ||
* @param propName Prop that is deprecated. | ||
* @param predicate If true the deprecation warning will be logged to console. | ||
* @param deprecationAnnouncementOnDAC Link to the public announcement on DAC. | ||
*/ | ||
export function propDeprecationWarning(packageName, propName, predicate, deprecationAnnouncementOnDAC) { | ||
if (process.env.NODE_ENV === 'development' && predicate) { | ||
warnOnce("[".concat(packageName, "]: The ").concat(propName, " prop is deprecated and will be removed, please migrate away.\nPublic announcement: ").concat(deprecationAnnouncementOnDAC)); | ||
} | ||
} |
/** | ||
* An empty function which does nothing. | ||
*/ | ||
// eslint-disable-next-line @repo/internal/react/use-noop | ||
export default function noop() {} |
{ | ||
"name": "@atlaskit/ds-lib", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"sideEffects": false | ||
} |
@@ -6,5 +6,5 @@ /** | ||
* const [uncontrolledState, setUncontrolledState] = useControlled( | ||
controlledValue, | ||
() => defaultValue, | ||
); | ||
* controlledValue, | ||
* () => defaultValue, | ||
* ); | ||
* ``` | ||
@@ -11,0 +11,0 @@ * |
@@ -0,1 +1,6 @@ | ||
/** | ||
* Provides a boolean value for whether an element is focused. | ||
* The `bindFocus` function returned provides two event handlers: | ||
* - `onFocus` and `onBlur` which when triggered set `isFocused` accordingly. | ||
*/ | ||
export default function useFocus(): { | ||
@@ -2,0 +7,0 @@ isFocused: boolean; |
@@ -15,1 +15,10 @@ /** | ||
export default function deprecationWarning(packageName: string, api: string, additionalMessage?: string): void; | ||
/** | ||
* Logs a prop deprecation warning to console once during a session. | ||
* | ||
* @param packageName Use `process.env._PACKAGE_NAME_` instead of a static string. | ||
* @param propName Prop that is deprecated. | ||
* @param predicate If true the deprecation warning will be logged to console. | ||
* @param deprecationAnnouncementOnDAC Link to the public announcement on DAC. | ||
*/ | ||
export declare function propDeprecationWarning(packageName: string, propName: string, predicate: boolean, deprecationAnnouncementOnDAC: string): void; |
{ | ||
"name": "@atlaskit/ds-lib", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "Reusable utilities and hooks specific to design system.", | ||
@@ -16,3 +16,3 @@ "publishConfig": { | ||
"sideEffects": false, | ||
"atlaskit:src": "src/index.ts", | ||
"atlaskit:src": "src/index.tsx", | ||
"atlassian": { | ||
@@ -29,15 +29,15 @@ "team": "Design System Team", | ||
"./keycodes": "./src/utils/keycodes.tsx", | ||
"./noop": "./src/utils/noop.ts", | ||
"./deprecation-warning": "./src/utils/deprecation-warning.ts", | ||
"./warn-once": "./src/utils/warn-once.ts", | ||
"./merge-refs": "./src/utils/merge-refs.ts", | ||
"./use-controlled": "./src/hooks/use-controlled.ts", | ||
"./use-lazy-ref": "./src/hooks/use-lazy-ref.ts", | ||
"./use-lazy-callback": "./src/hooks/use-lazy-callback.ts", | ||
"./use-state-ref": "./src/hooks/use-state-ref.ts", | ||
"./noop": "./src/utils/noop.tsx", | ||
"./deprecation-warning": "./src/utils/deprecation-warning.tsx", | ||
"./warn-once": "./src/utils/warn-once.tsx", | ||
"./merge-refs": "./src/utils/merge-refs.tsx", | ||
"./use-controlled": "./src/hooks/use-controlled.tsx", | ||
"./use-lazy-ref": "./src/hooks/use-lazy-ref.tsx", | ||
"./use-lazy-callback": "./src/hooks/use-lazy-callback.tsx", | ||
"./use-state-ref": "./src/hooks/use-state-ref.tsx", | ||
"./use-focus-event": "./src/hooks/use-focus-event.tsx", | ||
"./use-scrollbar-width": "./src/hooks/use-scrollbar-width.ts", | ||
"./use-previous-value": "./src/hooks/use-previous-value.ts", | ||
"./use-close-on-escape-press": "./src/hooks/use-close-on-escape-press.ts", | ||
"./use-auto-focus": "./src/hooks/use-auto-focus.ts" | ||
"./use-scrollbar-width": "./src/hooks/use-scrollbar-width.tsx", | ||
"./use-previous-value": "./src/hooks/use-previous-value.tsx", | ||
"./use-close-on-escape-press": "./src/hooks/use-close-on-escape-press.tsx", | ||
"./use-auto-focus": "./src/hooks/use-auto-focus.tsx" | ||
}, | ||
@@ -70,2 +70,3 @@ "dependencies": { | ||
"dom-events": "use-bind-event-listener", | ||
"design-system": "v1", | ||
"ui-components": [ | ||
@@ -72,0 +73,0 @@ "lite-mode" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51600
1193
4