@ansible/ansible-ui-framework 2.4.162 → 2.4.165

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.
@@ -67,6 +67,7 @@ export interface IPageActionSwitch extends IPageActionNoneCommon {
67
67
  isSwitchOn: () => boolean;
68
68
  showPinnedLabel?: boolean;
69
69
  labelOff?: string;
70
+ ariaLabel: (isEnabled: boolean) => string;
70
71
  }
71
72
  export interface IPageActionSwitchSingle<T extends object> extends IPageActionSingleCommon<T> {
72
73
  type: PageActionType.Switch;
@@ -74,6 +75,7 @@ export interface IPageActionSwitchSingle<T extends object> extends IPageActionSi
74
75
  isSwitchOn: (item: T) => boolean;
75
76
  showPinnedLabel?: boolean;
76
77
  labelOff?: string;
78
+ ariaLabel: (isEnabled: boolean) => string;
77
79
  }
78
80
  export interface IPageActionDropdown<T extends object> extends IPageActionNoneCommon {
79
81
  type: PageActionType.Dropdown;
package/index.js CHANGED
@@ -2179,9 +2179,11 @@ function U$(n) {
2179
2179
  i$,
2180
2180
  {
2181
2181
  id: c,
2182
+ "aria-label": e.ariaLabel(h),
2182
2183
  label: u,
2183
2184
  labelOff: d,
2184
2185
  isChecked: h,
2186
+ isDisabled: !!o,
2185
2187
  onChange: () => {
2186
2188
  switch (e.selection) {
2187
2189
  case ei.None:
package/index.umd.cjs CHANGED
@@ -97,7 +97,7 @@ Example:
97
97
  Perhaps you're looking to import 'styled-components/native'?
98
98
  Read more about this at https://www.styled-components.com/docs/basics#react-native`),process.env.NODE_ENV!=="production"&&process.env.NODE_ENV!=="test"&&typeof window<"u"&&(window["__styled-components-init__"]=window["__styled-components-init__"]||0,window["__styled-components-init__"]===1&&console.warn(`It looks like there are several instances of 'styled-components' initialized in this application. This may cause dynamic styles to not render properly, errors during the rehydration process, a missing theme prop, and makes your application bigger without good reason.
99
99
 
100
- See https://s-c.sh/2BAXzed for more info.`),window["__styled-components-init__"]+=1);const Mn=Xx,I7={by:"by",cancelText:"Cancel",canceledText:"Canceled",cardView:"Card view",clearAllFilters:"Clear all filters",clickToRefresh:"Click to refresh",closeText:"Close",confirmText:"Confirm",countMore:"{count} more",documentation:"Documentation",errorText:"Error",filter:"Filter",listView:"List view",manageColumns:"Manage columns",moreInformation:"More information",noItemsFound:"No items found",noResultsFound:"No results found",noResultsMatchCriteria:"No results match this filter criteria. Clear all filters and try again.",noSelection:"No selection",noSelections:"No selections",ofText:"of",pendingText:"Pending",pleaseFixValidationErrors:"Please fix validation errors.",processingText:"Processing",selectNone:"Select none",selectedText:"Selected",showLess:"Show less",sort:"Sort",submitText:"Submit",submittingText:"Submitting",successText:"Success",tableView:"Table view",unknownError:"Unknown error",validating:"Validating..."},O7=E.createContext([I7,()=>alert("Use FrameworkTranslationsProvider")]);function N7(n){const e=E.useState(I7);return x.jsx(O7.Provider,{value:e,children:n.children})}function ti(){return E.useContext(O7)}function M7(n,e){if("selection"in n)switch(n.selection){case Un.None:if(n.isHidden)return n.isHidden();break;case Un.Single:if(n.isHidden)return e?n.isHidden(e):!0;break}return!1}function jm(){const[n]=ti();return E.useCallback((e,t,i)=>{if("selection"in e)switch(e.selection){case Un.None:if(typeof e.isDisabled=="string")return e.isDisabled;if(e.isDisabled)return e.isDisabled();break;case Un.Single:if(typeof e.isDisabled=="string")return e.isDisabled;if(e.isDisabled)return t?e.isDisabled(t):n.noSelection;break;case Un.Multiple:if(typeof e.isDisabled=="string")return e.isDisabled;if(e.isDisabled)return i?e.isDisabled(i):n.noSelections;break}},[n.noSelection,n.noSelections])}function P7(n){const{action:e,wrapper:t,selectedItem:i,iconOnly:r}=n,o=jm()(e,i),a=t??E.Fragment,l=o||(e.tooltip?e.tooltip:void 0),c=E.useId();let u=e.label;r&&e.showPinnedLabel!==!0&&(u=void 0);let d=e.labelOff;r&&e.showPinnedLabel!==!0&&(d=void 0);const h=i?e.isSwitchOn(i):!1;return x.jsx(a,{children:x.jsx("div",{style:{marginLeft:r?16:void 0,marginRight:r?16:void 0},children:x.jsx(N.Tooltip,{content:l,trigger:l?void 0:"manual",children:x.jsx(N.Switch,{id:c,label:u,labelOff:d,isChecked:h,onChange:()=>{switch(e.selection){case Un.None:e.onToggle(!h);break;case Un.Single:i&&e.onToggle(i,!h);break}},isReversed:r})})})})}const TJ=Mn.span`
100
+ See https://s-c.sh/2BAXzed for more info.`),window["__styled-components-init__"]+=1);const Mn=Xx,I7={by:"by",cancelText:"Cancel",canceledText:"Canceled",cardView:"Card view",clearAllFilters:"Clear all filters",clickToRefresh:"Click to refresh",closeText:"Close",confirmText:"Confirm",countMore:"{count} more",documentation:"Documentation",errorText:"Error",filter:"Filter",listView:"List view",manageColumns:"Manage columns",moreInformation:"More information",noItemsFound:"No items found",noResultsFound:"No results found",noResultsMatchCriteria:"No results match this filter criteria. Clear all filters and try again.",noSelection:"No selection",noSelections:"No selections",ofText:"of",pendingText:"Pending",pleaseFixValidationErrors:"Please fix validation errors.",processingText:"Processing",selectNone:"Select none",selectedText:"Selected",showLess:"Show less",sort:"Sort",submitText:"Submit",submittingText:"Submitting",successText:"Success",tableView:"Table view",unknownError:"Unknown error",validating:"Validating..."},O7=E.createContext([I7,()=>alert("Use FrameworkTranslationsProvider")]);function N7(n){const e=E.useState(I7);return x.jsx(O7.Provider,{value:e,children:n.children})}function ti(){return E.useContext(O7)}function M7(n,e){if("selection"in n)switch(n.selection){case Un.None:if(n.isHidden)return n.isHidden();break;case Un.Single:if(n.isHidden)return e?n.isHidden(e):!0;break}return!1}function jm(){const[n]=ti();return E.useCallback((e,t,i)=>{if("selection"in e)switch(e.selection){case Un.None:if(typeof e.isDisabled=="string")return e.isDisabled;if(e.isDisabled)return e.isDisabled();break;case Un.Single:if(typeof e.isDisabled=="string")return e.isDisabled;if(e.isDisabled)return t?e.isDisabled(t):n.noSelection;break;case Un.Multiple:if(typeof e.isDisabled=="string")return e.isDisabled;if(e.isDisabled)return i?e.isDisabled(i):n.noSelections;break}},[n.noSelection,n.noSelections])}function P7(n){const{action:e,wrapper:t,selectedItem:i,iconOnly:r}=n,o=jm()(e,i),a=t??E.Fragment,l=o||(e.tooltip?e.tooltip:void 0),c=E.useId();let u=e.label;r&&e.showPinnedLabel!==!0&&(u=void 0);let d=e.labelOff;r&&e.showPinnedLabel!==!0&&(d=void 0);const h=i?e.isSwitchOn(i):!1;return x.jsx(a,{children:x.jsx("div",{style:{marginLeft:r?16:void 0,marginRight:r?16:void 0},children:x.jsx(N.Tooltip,{content:l,trigger:l?void 0:"manual",children:x.jsx(N.Switch,{id:c,"aria-label":e.ariaLabel(h),label:u,labelOff:d,isChecked:h,isDisabled:!!o,onChange:()=>{switch(e.selection){case Un.None:e.onToggle(!h);break;case Un.Single:i&&e.onToggle(i,!h);break}},isReversed:r})})})})}const TJ=Mn.span`
101
101
  padding-right: 4px;
102
102
  `,AJ=Mn.div`
103
103
  --pf-c-dropdown__menu-item-icon--Width: ${({hasSwitches:n})=>n?"40px":void 0};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ansible/ansible-ui-framework",
3
3
  "description": "A framework for building applications using PatternFly.",
4
- "version": "2.4.162",
4
+ "version": "2.4.165",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",