@royaloperahouse/harmonic 1.0.5-d → 1.0.5-e

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.
@@ -3095,7 +3095,7 @@ var getPressedColor = function getPressedColor(_ref4) {
3095
3095
  };
3096
3096
 
3097
3097
  var _templateObject$6, _templateObject2$3;
3098
- var PrimaryButtonWrapper = /*#__PURE__*/styled(Button)(_templateObject$6 || (_templateObject$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: ", ";\n background-color: ", ";\n border-color: ", ";\n pointer-events: ", ";\n\n path {\n fill: ", ";\n }\n\n :hover:not(:active) {\n background-color: ", ";\n border-color: ", ";\n\n path {\n fill: ", ";\n }\n }\n\n :active {\n background-color: ", ";\n border-color: ", ";\n\n path {\n fill: ", ";\n }\n }\n"])), getTextColor$1, getBackgroundColor$1, getBackgroundColor$1, getPointerEvents, getTextColor$1, getHoveredColor, getHoveredColor, getTextColor$1, getPressedColor, getPressedColor, getTextColor$1);
3098
+ var PrimaryButtonWrapper = /*#__PURE__*/styled(Button)(_templateObject$6 || (_templateObject$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: ", ";\n background-color: ", ";\n border-color: ", ";\n pointer-events: ", ";\n\n path {\n fill: ", ";\n }\n\n @media (hover: hover) and (pointer: fine) {\n :hover:not(:active) {\n background-color: ", ";\n border-color: ", ";\n\n path {\n fill: ", ";\n }\n }\n }\n\n :active {\n background-color: ", ";\n border-color: ", ";\n\n path {\n fill: ", ";\n }\n }\n"])), getTextColor$1, getBackgroundColor$1, getBackgroundColor$1, getPointerEvents, getTextColor$1, getHoveredColor, getHoveredColor, getTextColor$1, getPressedColor, getPressedColor, getTextColor$1);
3099
3099
  var AriaDescription = /*#__PURE__*/styled.span(_templateObject2$3 || (_templateObject2$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: absolute;\n left: -9999px;\n width: 1px;\n height: 1px;\n overflow: hidden;\n"])));
3100
3100
 
3101
3101
  var _excluded$4 = ["children", "disabled", "className"];
@@ -7411,7 +7411,10 @@ var _excluded$j = ["text", "id", "isSelected"];
7411
7411
  * Optional CSS class name applied to the root scroll container.
7412
7412
  *
7413
7413
  * @param {<T>(item: TCustomStrategyTabsFilterProps['items'][number]) => T} onClick
7414
- * Generic callback invoked when a tab is clicked.
7414
+ * Called when a tab is clicked. Receives the full clicked item (including
7415
+ * `allowedSelectedWith`). The parent is responsible for computing the next
7416
+ * `items` array and passing it back down with updated `isSelected` values.
7417
+ * as long as no return statement `type` is inferred automatically as void
7415
7418
  *
7416
7419
  * @param [customViewConfig]
7417
7420
  * Optional visual configuration used to customize:
@@ -7427,42 +7430,32 @@ var _excluded$j = ["text", "id", "isSelected"];
7427
7430
  *
7428
7431
  * @example
7429
7432
  * ```tsx
7430
- * <CustomStrategyTabsFilter
7431
- * items={[
7432
- * {
7433
- * id: 'all',
7434
- * text: 'All',
7435
- * isSelected: true,
7436
- * allowedSelectedWith: [],
7437
- * },
7438
- * {
7439
- * id: 'open',
7440
- * text: 'Open',
7441
- * isSelected: false,
7442
- * },
7443
- * ]}
7444
- * onClick={(item) => console.log(item)}
7445
- * />
7446
- * ```
7447
- *
7448
- * @example
7449
- * ```tsx
7450
- * <CustomStrategyTabsFilter
7451
- * items={items}
7452
- * onClick={handleFilterClick}
7453
- * customViewConfig={{
7454
- * selectIcon: 'Check',
7455
- * backgroundColor: {
7456
- * select: 'primary',
7457
- * unselect: 'base-white',
7458
- * },
7459
- * textColor: {
7460
- * select: 'base-white',
7461
- * unselect: 'base-black',
7462
- * },
7463
- * }}
7464
- * />
7465
- * ```
7433
+ * * @example Controlled selection with custom rules
7434
+ * * The component does not manage selection itself. The parent owns `items` (including
7435
+ * * `isSelected`) and updates that state in `onClick`. Use `allowedSelectedWith` on each
7436
+ * * item to describe which other tab IDs may stay selected when that tab is chosen.
7437
+ * *
7438
+ * * ```tsx
7439
+ * * const [items, setItems] = useState<TCustomStrategyTabsFilterItem[]>([
7440
+ * * { id: 'all', text: 'All events', isSelected: true, allowedSelectedWith: [] },
7441
+ * * { id: 'opera', text: 'Opera', isSelected: false, allowedSelectedWith: ['ballet'] },
7442
+ * * { id: 'ballet', text: 'Ballet', isSelected: false, allowedSelectedWith: ['opera'] },
7443
+ * * ]);
7444
+ * *
7445
+ * * const handleClick = (clickedItem: TCustomStrategyTabsFilterItem) => {
7446
+ * * setItems((current) =>
7447
+ * * current.map((item) => {
7448
+ * * if (item.id === clickedItem.id) {
7449
+ * * return { ...item, isSelected: !item.isSelected };
7450
+ * * }
7451
+ * *
7452
+ * * const mayStaySelected = clickedItem.allowedSelectedWith?.includes(item.id);
7453
+ * * return { ...item, isSelected: mayStaySelected ? !item.isSelected : false };
7454
+ * * })
7455
+ * * );
7456
+ * * };
7457
+ * *
7458
+ * * return <CustomStrategyTabsFilter items={items} onClick={handleClick} />;
7466
7459
  */
7467
7460
  var CustomStrategyTabsFilter = function CustomStrategyTabsFilter(_ref) {
7468
7461
  var _customViewConfig$bac, _customViewConfig$bac2, _customViewConfig$tex, _customViewConfig$tex2;