jattac.libs.web.zest-button 1.2.6 → 1.2.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/dist/ZestButtonConfigContext.d.ts +9 -0
- package/dist/ZestButtonConfigProvider.d.ts +8 -0
- package/dist/index.cjs.js +12 -12
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.esm.js +11 -11
- package/dist/index.esm.js.map +1 -1
- package/dist/semanticTypeButtonConfigDefaults.d.ts +4 -0
- package/docs/api.md +1 -1
- package/docs/breaking-changes.md +40 -0
- package/docs/configuration.md +18 -18
- package/docs/examples.md +8 -8
- package/docs/features.md +2 -2
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1389,18 +1389,18 @@ var styles = {"force-light":"ZestButton-module_force-light__zZTIZ","force-dark":
|
|
|
1389
1389
|
styleInject(css_248z);
|
|
1390
1390
|
|
|
1391
1391
|
// Create the Zest Context with a default empty configuration
|
|
1392
|
-
const
|
|
1392
|
+
const ZestButtonConfigContext = require$$0.createContext(undefined);
|
|
1393
1393
|
// Custom hook to use the Zest Context
|
|
1394
|
-
const
|
|
1395
|
-
const context = useContext(
|
|
1394
|
+
const useZestButtonConfig = () => {
|
|
1395
|
+
const context = useContext(ZestButtonConfigContext);
|
|
1396
1396
|
// Optional: Add a check here if context is undefined, meaning provider is not used
|
|
1397
1397
|
// if (context === undefined) {
|
|
1398
|
-
// console.warn("
|
|
1398
|
+
// console.warn("useZestButtonConfig must be used within a ZestButtonConfigProvider. Falling back to default ZestButton props.");
|
|
1399
1399
|
// }
|
|
1400
1400
|
return context;
|
|
1401
1401
|
};
|
|
1402
1402
|
|
|
1403
|
-
const
|
|
1403
|
+
const semanticTypeButtonConfigDefaults = {
|
|
1404
1404
|
// Creation / Add
|
|
1405
1405
|
'add': {
|
|
1406
1406
|
visualOptions: {
|
|
@@ -1571,7 +1571,7 @@ const deepMerge = (target, source) => {
|
|
|
1571
1571
|
return output;
|
|
1572
1572
|
};
|
|
1573
1573
|
const useZestConfig = (localZestProps) => {
|
|
1574
|
-
const globalConfig =
|
|
1574
|
+
const globalConfig = useZestButtonConfig();
|
|
1575
1575
|
const globalDefaultProps = globalConfig?.defaultProps;
|
|
1576
1576
|
const customSemanticDefaults = globalConfig?.semanticTypeDefaults;
|
|
1577
1577
|
// 1. Start with global defaults (lowest precedence)
|
|
@@ -1580,8 +1580,8 @@ const useZestConfig = (localZestProps) => {
|
|
|
1580
1580
|
const semanticType = localZestProps?.semanticType || effectiveZestConfig.semanticType;
|
|
1581
1581
|
if (semanticType) {
|
|
1582
1582
|
// 2. Apply built-in semantic defaults
|
|
1583
|
-
if (
|
|
1584
|
-
effectiveZestConfig = deepMerge(effectiveZestConfig,
|
|
1583
|
+
if (semanticTypeButtonConfigDefaults[semanticType]) {
|
|
1584
|
+
effectiveZestConfig = deepMerge(effectiveZestConfig, semanticTypeButtonConfigDefaults[semanticType]);
|
|
1585
1585
|
}
|
|
1586
1586
|
// 3. Apply custom semantic defaults from provider (overrides built-in ones)
|
|
1587
1587
|
if (customSemanticDefaults && customSemanticDefaults[semanticType]) {
|
|
@@ -1849,9 +1849,9 @@ const ZestButton = ({ className = "", disabled, children, onClick, zest: localZe
|
|
|
1849
1849
|
].join(" "), disabled: isDisabled, "aria-busy": effectiveBusy, onClick: handleConfirmClick, ...props, children: jsxRuntimeExports.jsxs("span", { className: styles.inner, children: [renderLeftIcon(), jsxRuntimeExports.jsxs("span", { className: styles.content, children: [currentChildren, iconRight && jsxRuntimeExports.jsx("span", { className: styles.icon, children: iconRight })] })] }) }));
|
|
1850
1850
|
};
|
|
1851
1851
|
|
|
1852
|
-
const
|
|
1853
|
-
return (jsxRuntimeExports.jsx(
|
|
1852
|
+
const ZestButtonConfigProvider = ({ config, children }) => {
|
|
1853
|
+
return (jsxRuntimeExports.jsx(ZestButtonConfigContext.Provider, { value: config, children: children }));
|
|
1854
1854
|
};
|
|
1855
1855
|
|
|
1856
|
-
export { ZestButton,
|
|
1856
|
+
export { ZestButton, ZestButtonConfigProvider, useZestButtonConfig };
|
|
1857
1857
|
//# sourceMappingURL=index.esm.js.map
|