@bitrise/bitkit-v2 0.3.246 → 0.3.247

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.
@@ -1,5 +1,13 @@
1
1
  import { createToaster } from "@chakra-ui/react/toast";
2
2
  //#region lib/components/BitkitToast/BitkitToast.tsx
3
+ var TOAST_PRIORITIES = {
4
+ critical: [1, 2],
5
+ warning: [3, 6],
6
+ progress: [4, 5],
7
+ success: [5, 7],
8
+ ai: [6, 8],
9
+ info: [6, 8]
10
+ };
3
11
  var toaster = createToaster({
4
12
  max: 5,
5
13
  placement: "top-end",
@@ -7,6 +15,7 @@ var toaster = createToaster({
7
15
  });
8
16
  var createBitkitToast = (props) => {
9
17
  const { action, dismissible = true, messageText, timestamp, titleText, variant } = props;
18
+ const [actionable, nonActionable] = TOAST_PRIORITIES[variant];
10
19
  return toaster.create({
11
20
  closable: dismissible,
12
21
  description: messageText,
@@ -14,6 +23,7 @@ var createBitkitToast = (props) => {
14
23
  action,
15
24
  timestamp
16
25
  },
26
+ priority: action ? actionable : nonActionable,
17
27
  title: titleText,
18
28
  type: variant
19
29
  });
@@ -1 +1 @@
1
- {"version":3,"file":"BitkitToast.js","names":[],"sources":["../../../lib/components/BitkitToast/BitkitToast.tsx"],"sourcesContent":["import { createToaster } from '@chakra-ui/react/toast';\nimport { type ReactNode } from 'react';\n\nimport { type NotificationVariant } from '../../theme/common/AlertAndToast.common';\nimport { type NotificationAction } from '../common/notificationMaps';\n\nexport type BitkitToastVariant = NotificationVariant;\n\nexport type BitkitToastProps = {\n action?: NotificationAction;\n dismissible?: boolean;\n messageText: ReactNode;\n timestamp?: string;\n titleText?: ReactNode;\n variant: BitkitToastVariant;\n};\n\nexport const toaster = createToaster({\n max: 5,\n placement: 'top-end',\n pauseOnPageIdle: true,\n});\n\nconst createBitkitToast = (props: BitkitToastProps) => {\n const { action, dismissible = true, messageText, timestamp, titleText, variant } = props;\n\n return toaster.create({\n closable: dismissible,\n description: messageText,\n meta: {\n action,\n timestamp,\n },\n title: titleText,\n type: variant,\n });\n};\n\nexport default createBitkitToast;\n"],"mappings":";;AAiBA,IAAa,UAAU,cAAc;CACnC,KAAK;CACL,WAAW;CACX,iBAAiB;AACnB,CAAC;AAED,IAAM,qBAAqB,UAA4B;CACrD,MAAM,EAAE,QAAQ,cAAc,MAAM,aAAa,WAAW,WAAW,YAAY;CAEnF,OAAO,QAAQ,OAAO;EACpB,UAAU;EACV,aAAa;EACb,MAAM;GACJ;GACA;EACF;EACA,OAAO;EACP,MAAM;CACR,CAAC;AACH"}
1
+ {"version":3,"file":"BitkitToast.js","names":[],"sources":["../../../lib/components/BitkitToast/BitkitToast.tsx"],"sourcesContent":["import { createToaster } from '@chakra-ui/react/toast';\nimport { type ReactNode } from 'react';\n\nimport { type NotificationVariant } from '../../theme/common/AlertAndToast.common';\nimport { type NotificationAction } from '../common/notificationMaps';\n\nexport type BitkitToastVariant = NotificationVariant;\n\nexport type BitkitToastProps = {\n action?: NotificationAction;\n dismissible?: boolean;\n messageText: ReactNode;\n timestamp?: string;\n titleText?: ReactNode;\n variant: BitkitToastVariant;\n};\n\n// Zag's internal priority table only knows its 5 built-in types and crashes\n// on our custom variants (ai/critical/progress). We replicate Zag's algorithm\n// with our full variant set and compute priority ourselves, so the broken\n// lookup is never reached. Each tuple is [actionable, nonActionable] — mirrors\n// Zag, which ranks actionable toasts higher. Lower number = higher in the stack.\nconst TOAST_PRIORITIES = {\n critical: [1, 2], // ~ Zag \"error\" — most urgent\n warning: [3, 6], // = Zag \"warning\"\n progress: [4, 5], // ~ Zag \"loading\"\n success: [5, 7], // = Zag \"success\"\n ai: [6, 8], // ~ Zag \"info\"\n info: [6, 8], // = Zag \"info\" — least urgent\n} as const satisfies Record<BitkitToastVariant, readonly [number, number]>;\n\nexport const toaster = createToaster({\n max: 5,\n placement: 'top-end',\n pauseOnPageIdle: true,\n});\n\nconst createBitkitToast = (props: BitkitToastProps) => {\n const { action, dismissible = true, messageText, timestamp, titleText, variant } = props;\n\n const [actionable, nonActionable] = TOAST_PRIORITIES[variant];\n\n return toaster.create({\n closable: dismissible,\n description: messageText,\n meta: { action, timestamp },\n priority: action ? actionable : nonActionable,\n title: titleText,\n type: variant,\n });\n};\n\nexport default createBitkitToast;\n"],"mappings":";;AAsBA,IAAM,mBAAmB;CACvB,UAAU,CAAC,GAAG,CAAC;CACf,SAAS,CAAC,GAAG,CAAC;CACd,UAAU,CAAC,GAAG,CAAC;CACf,SAAS,CAAC,GAAG,CAAC;CACd,IAAI,CAAC,GAAG,CAAC;CACT,MAAM,CAAC,GAAG,CAAC;AACb;AAEA,IAAa,UAAU,cAAc;CACnC,KAAK;CACL,WAAW;CACX,iBAAiB;AACnB,CAAC;AAED,IAAM,qBAAqB,UAA4B;CACrD,MAAM,EAAE,QAAQ,cAAc,MAAM,aAAa,WAAW,WAAW,YAAY;CAEnF,MAAM,CAAC,YAAY,iBAAiB,iBAAiB;CAErD,OAAO,QAAQ,OAAO;EACpB,UAAU;EACV,aAAa;EACb,MAAM;GAAE;GAAQ;EAAU;EAC1B,UAAU,SAAS,aAAa;EAChC,OAAO;EACP,MAAM;CACR,CAAC;AACH"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bitrise/bitkit-v2",
3
3
  "private": false,
4
- "version": "0.3.246",
4
+ "version": "0.3.247",
5
5
  "description": "Bitrise Design System Components built with Chakra UI V3",
6
6
  "keywords": [
7
7
  "react",