jattac.libs.web.zest-button 1.2.6 → 1.2.8

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/README.md CHANGED
@@ -51,3 +51,7 @@ To get started, check out our **Cookbook** of practical recipes.
51
51
  ### License
52
52
 
53
53
  Licensed under [MIT](./LICENSE).
54
+
55
+ ---
56
+
57
+ [Next: The Cookbook (Examples) ➡️](./docs/examples.md)
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { ZestCustomProps } from './ZestButton';
3
+ export interface ZestGlobalConfig {
4
+ defaultProps?: ZestCustomProps;
5
+ semanticTypeDefaults?: Partial<Record<string, Partial<ZestCustomProps>>>;
6
+ }
7
+ declare const ZestButtonConfigContext: React.Context<ZestGlobalConfig | undefined>;
8
+ export declare const useZestButtonConfig: () => ZestGlobalConfig | undefined;
9
+ export default ZestButtonConfigContext;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { ZestGlobalConfig } from './ZestButtonConfigContext';
3
+ interface ZestButtonConfigProviderProps {
4
+ config: ZestGlobalConfig;
5
+ children: React.ReactNode;
6
+ }
7
+ declare const ZestButtonConfigProvider: React.FC<ZestButtonConfigProviderProps>;
8
+ export default ZestButtonConfigProvider;
package/dist/index.cjs.js CHANGED
@@ -1391,18 +1391,18 @@ var styles = {"force-light":"ZestButton-module_force-light__zZTIZ","force-dark":
1391
1391
  styleInject(css_248z);
1392
1392
 
1393
1393
  // Create the Zest Context with a default empty configuration
1394
- const ZestContext = require$$0.createContext(undefined);
1394
+ const ZestButtonConfigContext = require$$0.createContext(undefined);
1395
1395
  // Custom hook to use the Zest Context
1396
- const useZest = () => {
1397
- const context = require$$0.useContext(ZestContext);
1396
+ const useZestButtonConfig = () => {
1397
+ const context = require$$0.useContext(ZestButtonConfigContext);
1398
1398
  // Optional: Add a check here if context is undefined, meaning provider is not used
1399
1399
  // if (context === undefined) {
1400
- // console.warn("useZest must be used within a ZestProvider. Falling back to default ZestButton props.");
1400
+ // console.warn("useZestButtonConfig must be used within a ZestButtonConfigProvider. Falling back to default ZestButton props.");
1401
1401
  // }
1402
1402
  return context;
1403
1403
  };
1404
1404
 
1405
- const semanticTypeDefaults = {
1405
+ const semanticTypeButtonConfigDefaults = {
1406
1406
  // Creation / Add
1407
1407
  'add': {
1408
1408
  visualOptions: {
@@ -1573,7 +1573,7 @@ const deepMerge = (target, source) => {
1573
1573
  return output;
1574
1574
  };
1575
1575
  const useZestConfig = (localZestProps) => {
1576
- const globalConfig = useZest();
1576
+ const globalConfig = useZestButtonConfig();
1577
1577
  const globalDefaultProps = globalConfig?.defaultProps;
1578
1578
  const customSemanticDefaults = globalConfig?.semanticTypeDefaults;
1579
1579
  // 1. Start with global defaults (lowest precedence)
@@ -1582,8 +1582,8 @@ const useZestConfig = (localZestProps) => {
1582
1582
  const semanticType = localZestProps?.semanticType || effectiveZestConfig.semanticType;
1583
1583
  if (semanticType) {
1584
1584
  // 2. Apply built-in semantic defaults
1585
- if (semanticTypeDefaults[semanticType]) {
1586
- effectiveZestConfig = deepMerge(effectiveZestConfig, semanticTypeDefaults[semanticType]);
1585
+ if (semanticTypeButtonConfigDefaults[semanticType]) {
1586
+ effectiveZestConfig = deepMerge(effectiveZestConfig, semanticTypeButtonConfigDefaults[semanticType]);
1587
1587
  }
1588
1588
  // 3. Apply custom semantic defaults from provider (overrides built-in ones)
1589
1589
  if (customSemanticDefaults && customSemanticDefaults[semanticType]) {
@@ -1851,11 +1851,11 @@ const ZestButton = ({ className = "", disabled, children, onClick, zest: localZe
1851
1851
  ].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 })] })] }) }));
1852
1852
  };
1853
1853
 
1854
- const ZestProvider = ({ config, children }) => {
1855
- return (jsxRuntimeExports.jsx(ZestContext.Provider, { value: config, children: children }));
1854
+ const ZestButtonConfigProvider = ({ config, children }) => {
1855
+ return (jsxRuntimeExports.jsx(ZestButtonConfigContext.Provider, { value: config, children: children }));
1856
1856
  };
1857
1857
 
1858
1858
  exports.ZestButton = ZestButton;
1859
- exports.ZestProvider = ZestProvider;
1860
- exports.useZest = useZest;
1859
+ exports.ZestButtonConfigProvider = ZestButtonConfigProvider;
1860
+ exports.useZestButtonConfig = useZestButtonConfig;
1861
1861
  //# sourceMappingURL=index.cjs.js.map