agroptima-design-system 1.2.0-beta.4 → 1.2.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agroptima-design-system",
3
- "version": "1.2.0-beta.4",
3
+ "version": "1.2.0",
4
4
  "scripts": {
5
5
  "dev": "npm run storybook",
6
6
  "storybook": "storybook dev -p 6006 --ci",
@@ -7,6 +7,16 @@
7
7
  $header-height: 50px;
8
8
 
9
9
  .notification-center-container {
10
+ .notification-button-container {
11
+ position: relative;
12
+
13
+ .new-notifications-dot {
14
+ position: absolute;
15
+ right: 0;
16
+ top: -2px;
17
+ }
18
+ }
19
+
10
20
  .notification-center {
11
21
  display: flex;
12
22
  flex-direction: column;
@@ -2,6 +2,7 @@
2
2
  import './NotificationCenter.scss'
3
3
  import React from 'react'
4
4
  import { classNames } from '../../utils/classNames'
5
+ import { Badge } from '../Badge'
5
6
  import { IconButton } from '../Button'
6
7
  import type { Variant } from '../Button/IconButton'
7
8
  import { Popover, type Position } from '../Popover'
@@ -11,6 +12,7 @@ export interface NotificationCenterProps {
11
12
  className?: string
12
13
  variant?: Variant
13
14
  accessibilityLabel?: string
15
+ hasNewNotifications?: boolean
14
16
  children: React.ReactNode
15
17
  }
16
18
 
@@ -18,6 +20,7 @@ function NotificationCenter({
18
20
  position = 'right',
19
21
  className,
20
22
  variant = 'secondary',
23
+ hasNewNotifications = false,
21
24
  accessibilityLabel = 'Open notifications center',
22
25
  children,
23
26
  }: NotificationCenterProps) {
@@ -26,12 +29,21 @@ function NotificationCenter({
26
29
  position={position}
27
30
  className={classNames('notification-center-container', className)}
28
31
  renderButton={({ toggle }) => (
29
- <IconButton
30
- icon="Notification"
31
- variant={variant}
32
- accessibilityLabel={accessibilityLabel}
33
- onClick={toggle}
34
- />
32
+ <div className="notification-button-container">
33
+ {hasNewNotifications && (
34
+ <Badge
35
+ className="new-notifications-dot"
36
+ variant="notification"
37
+ isDot
38
+ />
39
+ )}
40
+ <IconButton
41
+ icon="Notification"
42
+ variant={variant}
43
+ accessibilityLabel={accessibilityLabel}
44
+ onClick={toggle}
45
+ />
46
+ </div>
35
47
  )}
36
48
  closeOnClick={false}
37
49
  >
@@ -39,7 +39,7 @@ export interface InfiniteSelectProps<T> extends Omit<
39
39
  query: (payload: Payload) => Promise<{ items: T[]; totalPages: number }>
40
40
  errors?: string[]
41
41
  fullWidth?: boolean
42
- onChange?: (value: T) => void
42
+ onChange?: (value: T | null) => void
43
43
  }
44
44
 
45
45
  export function InfiniteSelect<T extends { uid: string }>({
@@ -90,6 +90,7 @@ export function InfiniteSelect<T extends { uid: string }>({
90
90
 
91
91
  const handleClear = () => {
92
92
  setSelectedItem(null)
93
+ onChange(null)
93
94
  }
94
95
  const handleSelectOption = (item: T) => {
95
96
  // TODO: MultiSelect case
@@ -8,6 +8,11 @@ import { Meta } from "@storybook/addon-docs/blocks";
8
8
 
9
9
  * Add NotificationCenter components
10
10
 
11
+
12
+ ## 1.1.2
13
+
14
+ * Fix selection clearing in InfiniteSelect selector
15
+
11
16
  ## 1.1.1
12
17
 
13
18
  * Update to Storybook 10
@@ -140,6 +140,9 @@ export const Primary: Story = {
140
140
  return item.name || ''
141
141
  },
142
142
  query: fakeQuery,
143
+ onChange: (value) => {
144
+ console.log('selected', value)
145
+ },
143
146
  },
144
147
  parameters: figmaPrimaryDesign,
145
148
  }
@@ -47,7 +47,7 @@ export const NotificationCenterWithNotifications: Story = {
47
47
  <h1>Header Title</h1>
48
48
 
49
49
  <div style={{ display: 'flex', gap: '10px', marginRight: '30px' }}>
50
- <NotificationCenter>
50
+ <NotificationCenter hasNewNotifications={true}>
51
51
  <NotificationHeader title="Notifications">
52
52
  <CheckableTagGroup>
53
53
  <CheckableTag
@@ -1,26 +0,0 @@
1
- [08:27:33.154] [INFO] storybook v10.1.11
2
- [08:27:33.766] [DEBUG] Getting package.json info for /Users/verochan/wineries/design-system/package.json...
3
- [08:27:34.402] [DEBUG] Serving static files from public at /
4
- [08:27:34.407] [INFO] Starting...
5
- [08:27:34.825] [DEBUG] Starting preview..
6
- [08:27:34.844] [INFO] Addon-docs: using MDX3
7
- [08:27:34.865] [INFO] Using implicit CSS loaders
8
- [08:27:35.233] [INFO] Using SWC as compiler
9
- [08:27:35.245] [INFO] Using default Webpack5 setup
10
- [08:27:35.616] [DEBUG] Using tsconfig paths for react-docgen
11
- [08:27:45.882] [ERROR] Failed to build the preview
12
- [08:27:45.887] [WARN] Force closed preview build
13
- [08:27:45.888] [ERROR] SB_BUILDER-WEBPACK5_0003 (WebpackCompilationError): There were problems when compiling your code with Webpack.
14
- Run Storybook with --debug-webpack for more information.
15
- at starter (file://./node_modules/@storybook/builder-webpack5/dist/index.js:799:11)
16
- at starter.next (<anonymous>)
17
- at Module.start (file://./node_modules/@storybook/builder-webpack5/dist/index.js:857:34)
18
- at process.processTicksAndRejections (node:internal/process/task_queues:103:5)
19
- at async storybookDevServer (file://./node_modules/storybook/dist/core-server/index.js:6806:82)
20
- at async buildOrThrow (file://./node_modules/storybook/dist/core-server/index.js:5555:12)
21
- at async buildDevStandalone (file://./node_modules/storybook/dist/core-server/index.js:7208:66)
22
- at async withTelemetry (file://./node_modules/storybook/dist/_node-chunks/chunk-2372JZ52.js:209:12)
23
- at async dev (file://./node_modules/storybook/dist/bin/core.js:2734:3)
24
- at async _Command.<anonymous> (file://./node_modules/storybook/dist/bin/core.js:2801:92)
25
- [08:27:45.889] [WARN] Broken build, fix the error above.
26
- You may need to refresh the browser.