-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
126 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import {AlwatrSignal, AlwatrTrigger} from '@alwatr/flux'; | ||
|
||
import type {SnackbarOptions} from './type.js'; | ||
|
||
/** | ||
* Signal triggered when the snackbar action button is clicked to close snackbar. | ||
*/ | ||
export const snackbarActionButtonClickedSignal = /* @__PURE__ */ new AlwatrTrigger({ | ||
name: 'snackbar-action-button-clicked', | ||
}); | ||
|
||
/** | ||
* Signal for displaying the snackbar. | ||
* | ||
* @example | ||
* import {snackbarSignal} from '@nexim/snackbar'; | ||
* | ||
* snackbarSignal.notify({ | ||
* content: 'This is a snackbar message', | ||
* action: { | ||
* label: 'Undo', | ||
* handler: () => { | ||
* console.log('Action button clicked'); | ||
* }, | ||
* }, | ||
* duration: '5s', | ||
* addCloseButton: true, | ||
* }); | ||
*/ | ||
export const snackbarSignal = /* @__PURE__ */ new AlwatrSignal<SnackbarOptions>({name: 'snackbar'}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import type {Duration} from '@alwatr/parse-duration'; | ||
|
||
/** | ||
* @property content - Content to be displayed in the snackbar. | ||
* @property [action] - The action button configuration. | ||
* @property action.label - The label for the action button. | ||
* @property action.signalId - The signal ID to be emitted when the action button is clicked. | ||
* @property duration - Duration for which the snackbar is displayed. `infinite` for infinite duration. | ||
* @property addCloseButton - Whether to add a close button to the snackbar. | ||
*/ | ||
export type SnackbarOptions = { | ||
content: string; | ||
action?: { | ||
signalId: string; | ||
label: string; | ||
}; | ||
duration?: Duration | 'infinite'; | ||
addCloseButton?: boolean; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters