@ichicraft/widgets-widget-base 1.9.9 → 1.9.10

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
@@ -9,6 +9,15 @@ All notable changes to this project will be documented here.
9
9
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
10
10
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
11
11
 
12
+ ## 1.9.10 - 2024-06-04
13
+
14
+ - Renamed `CustomCommandBarItemProps` interface to `CommandBarItemProps`.
15
+ - Merged `CommandBarIcon`, `CommandBarLink` and `CommandBarItemBase` interfaces into the `CommandBarItemProps` interface, to simplify adding custom command bar items.
16
+ - Added `Overflow` type to `CommandBarItemType` enum, to allow rendering an item inside the overflow menu.
17
+ - Added `highlighted` property to the `CommandBarItemProps` interface, to allow rendering an item as if it is being hovered.
18
+ - Added `cursor` property to the `CommandBarItemProps` interface, to allow a different cursor when hovering over an item.
19
+ - Added `disabled` property to the `CommandBarItemProps` interface, to allow rendering an item in a disabled state.
20
+
12
21
  ## 1.9.9 - 2024-05-14
13
22
 
14
23
  - Changed return type of `createDeepLink` function of the WidgetInstanceContext interface from `void` to `string`.
@@ -286,13 +286,13 @@ export interface WidgetInstanceContext {
286
286
  * an icon button, depending on the presence of the onClick property. To remove the items,
287
287
  * use the [unregisterCommandBarItems] function.
288
288
  */
289
- registerCustomCommandBarItems?: (props: CustomCommandBarItemProps[]) => void;
289
+ registerCustomCommandBarItems?: (props: CommandBarItemProps[]) => void;
290
290
  /**
291
291
  * Allows registration of a custom command bar item which can either result in an icon or
292
292
  * an icon button, depending on the presence of the onClick property. To remove the item,
293
293
  * use the [unregisterCommandBarItem] function.
294
294
  */
295
- registerCustomCommandBarItem?: (props: CustomCommandBarItemProps) => void;
295
+ registerCustomCommandBarItem?: (props: CommandBarItemProps) => void;
296
296
  /**
297
297
  * Removes all registered custom command bar items.
298
298
  */
@@ -573,28 +573,25 @@ export declare enum CustomCommandBarItemSeverity {
573
573
  * Tells how to render the command bar item, e.g. as an icon button or as a link.
574
574
  */
575
575
  export declare enum CommandBarItemType {
576
- /** Normal severity, displays just like all the other command bar items */
576
+ /** Renders the item as an Icon */
577
577
  Icon = "icon",
578
- /** Warning severity, displays the item with a more noticable warning color */
579
- Link = "link"
578
+ /** Renders the item as a clickable link */
579
+ Link = "link",
580
+ /** Renders the item in the overflow menu */
581
+ Overflow = "overflow"
580
582
  }
581
583
  /**
582
- * Properties to pass to the registerCommandBarItems function, resulting in the
583
- * rendering of a command bar item.
584
- */
585
- export type CustomCommandBarItemProps = CommandBarIcon | CommandBarLink;
586
- /**
587
- * Base properties of a custom CommandBarItem.
584
+ * Base properties of a CommandBarItem, rendered in the widget header.
588
585
  */
589
- export interface CommandBarItemBase {
586
+ export interface CommandBarItemProps {
590
587
  /**
591
588
  * Optional identifier for the icon.
592
589
  */
593
590
  id?: string;
594
591
  /**
595
- * Type of item, (e.g. 'icon' or 'link')
592
+ * Optional type of item, (e.g. 'icon' or 'link'). When not specified, the item is rendered as an icon.
596
593
  */
597
- itemType: CommandBarItemType;
594
+ itemType?: CommandBarItemType;
598
595
  /**
599
596
  * Optional content to show as a tooltip above the item.
600
597
  */
@@ -607,17 +604,28 @@ export interface CommandBarItemBase {
607
604
  * Optionally tells the Widget Header that this item should always be visible, even when not hovering.
608
605
  */
609
606
  pinned?: boolean;
610
- }
611
- /**
612
- * Properties to render a custom CommandBarItem either as a single Icon or an Icon Button.
613
- */
614
- export interface CommandBarIcon extends CommandBarItemBase {
615
- itemType: CommandBarItemType.Icon;
616
607
  /**
617
- * Name of the icon, as specified and available in Fluent UI Iconography:
608
+ * Optionally tells the Widget Header that this item should always be rendered as if it is being hovered.
609
+ */
610
+ highlighted?: boolean;
611
+ /**
612
+ * Optionally override the cursor when hovering over the item.
613
+ */
614
+ cursor?: string;
615
+ /**
616
+ * Optionally tells the Widget Header that this item should be rendered in a disabled state.
617
+ */
618
+ disabled?: boolean;
619
+ /**
620
+ * Name of the icon displayed when rendered as an Icon, or in the overflow menu.
621
+ * See the available icon names in Fluent UI Iconography:
618
622
  * https://developer.microsoft.com/en-us/fluentui#/styles/web/icons
619
623
  */
620
624
  iconName: string;
625
+ /**
626
+ * Displayed label when rendered as a link, or in the overflow menu.
627
+ */
628
+ label: string;
621
629
  /**
622
630
  * Optionally display a red notification icon badge in the top-right corner of the button.
623
631
  */
@@ -636,20 +644,6 @@ export interface CommandBarIcon extends CommandBarItemBase {
636
644
  */
637
645
  onClick?: () => void;
638
646
  }
639
- /**
640
- * Properties to render a custom CommandBarItem as a Link Button.
641
- */
642
- export interface CommandBarLink extends CommandBarItemBase {
643
- itemType: CommandBarItemType.Link;
644
- /**
645
- * Required label to display the clickable link.
646
- */
647
- label: string;
648
- /**
649
- * Required onClick event, which is triggered on user click.
650
- */
651
- onClick: () => void;
652
- }
653
647
  /**
654
648
  * Options to pass to the openIFrameDialog function. Use this to configure how the dialog is rendered, and to handle events (e.g. onDismissed)
655
649
  */
@@ -36,8 +36,10 @@ var CustomCommandBarItemSeverity;
36
36
  */
37
37
  var CommandBarItemType;
38
38
  (function (CommandBarItemType) {
39
- /** Normal severity, displays just like all the other command bar items */
39
+ /** Renders the item as an Icon */
40
40
  CommandBarItemType["Icon"] = "icon";
41
- /** Warning severity, displays the item with a more noticable warning color */
41
+ /** Renders the item as a clickable link */
42
42
  CommandBarItemType["Link"] = "link";
43
+ /** Renders the item in the overflow menu */
44
+ CommandBarItemType["Overflow"] = "overflow";
43
45
  })(CommandBarItemType || (exports.CommandBarItemType = CommandBarItemType = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ichicraft/widgets-widget-base",
3
- "version": "1.9.9",
3
+ "version": "1.9.10",
4
4
  "description": "Part of the Widget Development Kit for building widgets for Ichicraft Boards",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",