@marianmeres/stuic 3.149.0 → 3.150.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/dist/components/AlertConfirmPrompt/AlertConfirmPrompt.svelte +2 -0
- package/dist/components/AlertConfirmPrompt/AlertConfirmPrompt.svelte.d.ts +2 -0
- package/dist/components/AlertConfirmPrompt/Current.svelte +10 -2
- package/dist/components/AlertConfirmPrompt/Current.svelte.d.ts +2 -0
- package/dist/components/AlertConfirmPrompt/README.md +27 -24
- package/package.json +1 -1
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
classButtonPrimary?: string;
|
|
25
25
|
intentButtonCancel?: IntentColorKey;
|
|
26
26
|
intentButtonCustom?: IntentColorKey;
|
|
27
|
+
/** Intent of the primary (OK) button. Defaults to `"primary"`, except for the
|
|
28
|
+
* `"warn"` variant, which defaults to `"destructive"`. */
|
|
27
29
|
intentButtonPrimary?: IntentColorKey;
|
|
28
30
|
classSpinnerBox?: string;
|
|
29
31
|
defaultIcons?: Partial<
|
|
@@ -22,6 +22,8 @@ export interface Props {
|
|
|
22
22
|
classButtonPrimary?: string;
|
|
23
23
|
intentButtonCancel?: IntentColorKey;
|
|
24
24
|
intentButtonCustom?: IntentColorKey;
|
|
25
|
+
/** Intent of the primary (OK) button. Defaults to `"primary"`, except for the
|
|
26
|
+
* `"warn"` variant, which defaults to `"destructive"`. */
|
|
25
27
|
intentButtonPrimary?: IntentColorKey;
|
|
26
28
|
classSpinnerBox?: string;
|
|
27
29
|
defaultIcons?: Partial<Record<"info" | "success" | "warn" | "error" | "spinner", () => string | undefined>>;
|
|
@@ -39,6 +39,8 @@
|
|
|
39
39
|
classButtonPrimary?: string;
|
|
40
40
|
intentButtonCancel?: IntentColorKey;
|
|
41
41
|
intentButtonCustom?: IntentColorKey;
|
|
42
|
+
/** Intent of the primary (OK) button. Defaults to `"primary"`, except for the
|
|
43
|
+
* `"warn"` variant, which defaults to `"destructive"`. */
|
|
42
44
|
intentButtonPrimary?: IntentColorKey;
|
|
43
45
|
classSpinnerBox?: string;
|
|
44
46
|
defaultIcons?: Partial<
|
|
@@ -68,13 +70,19 @@
|
|
|
68
70
|
classButtonPrimary,
|
|
69
71
|
intentButtonCancel,
|
|
70
72
|
intentButtonCustom,
|
|
71
|
-
intentButtonPrimary
|
|
73
|
+
intentButtonPrimary,
|
|
72
74
|
classSpinnerBox,
|
|
73
75
|
defaultIcons = acpDefaultIcons,
|
|
74
76
|
}: Props = $props();
|
|
75
77
|
|
|
76
78
|
let current = $derived(acp?.current!);
|
|
77
79
|
|
|
80
|
+
// the "warn" variant hints a destructive action, so unless explicitly configured
|
|
81
|
+
// otherwise, render the primary button accordingly
|
|
82
|
+
let _intentButtonPrimary = $derived(
|
|
83
|
+
intentButtonPrimary ?? (current?.variant === "warn" ? "destructive" : "primary")
|
|
84
|
+
);
|
|
85
|
+
|
|
78
86
|
let iconHtml = $derived.by(() => {
|
|
79
87
|
let fn = current.iconFn as any;
|
|
80
88
|
if (current.iconFn === true) {
|
|
@@ -235,7 +243,7 @@
|
|
|
235
243
|
<li class={twMerge(_classMenuLi, classMenuLi, hasCustom && classMenuLiCustom)}>
|
|
236
244
|
<CmpButtonOk
|
|
237
245
|
class={twMerge("ok", _classButton, classButton, classButtonPrimary)}
|
|
238
|
-
intent={
|
|
246
|
+
intent={_intentButtonPrimary}
|
|
239
247
|
disabled={isPending}
|
|
240
248
|
onclick={createOnClick("ok", current.onOk)}
|
|
241
249
|
bind:el={okButtonEl}
|
|
@@ -22,6 +22,8 @@ interface Props {
|
|
|
22
22
|
classButtonPrimary?: string;
|
|
23
23
|
intentButtonCancel?: IntentColorKey;
|
|
24
24
|
intentButtonCustom?: IntentColorKey;
|
|
25
|
+
/** Intent of the primary (OK) button. Defaults to `"primary"`, except for the
|
|
26
|
+
* `"warn"` variant, which defaults to `"destructive"`. */
|
|
25
27
|
intentButtonPrimary?: IntentColorKey;
|
|
26
28
|
classSpinnerBox?: string;
|
|
27
29
|
defaultIcons?: Partial<Record<"info" | "success" | "warn" | "error" | "spinner", () => string | undefined>>;
|
|
@@ -4,20 +4,23 @@ A modern, customizable replacement for native browser `alert()`, `confirm()`, an
|
|
|
4
4
|
|
|
5
5
|
## Props
|
|
6
6
|
|
|
7
|
-
| Prop
|
|
8
|
-
|
|
|
9
|
-
| `acp`
|
|
10
|
-
| `forceAsHtml`
|
|
11
|
-
| `class`
|
|
12
|
-
| `classWrap`
|
|
13
|
-
| `classIconBox`
|
|
14
|
-
| `classTitle`
|
|
15
|
-
| `classContent`
|
|
16
|
-
| `classInput`
|
|
17
|
-
| `classButton`
|
|
18
|
-
| `classButtonPrimary`
|
|
19
|
-
| `classButtonCancel`
|
|
20
|
-
| `
|
|
7
|
+
| Prop | Type | Default | Description |
|
|
8
|
+
| --------------------- | ------------------------------- | ------- | --------------------------------------------------------------------------------------------- |
|
|
9
|
+
| `acp` | `AlertConfirmPromptStack` | - | Stack instance managing the dialog queue |
|
|
10
|
+
| `forceAsHtml` | `boolean` | `false` | Render all content as HTML |
|
|
11
|
+
| `class` | `string` | - | CSS classes for the modal dialog |
|
|
12
|
+
| `classWrap` | `string` | - | CSS for outer wrapper |
|
|
13
|
+
| `classIconBox` | `string` | - | CSS for icon container |
|
|
14
|
+
| `classTitle` | `string` | - | CSS for title text |
|
|
15
|
+
| `classContent` | `string` | - | CSS for content area |
|
|
16
|
+
| `classInput` | `string` | - | CSS for prompt input field |
|
|
17
|
+
| `classButton` | `string` | - | CSS for all buttons |
|
|
18
|
+
| `classButtonPrimary` | `string` | - | CSS for OK button |
|
|
19
|
+
| `classButtonCancel` | `string` | - | CSS for Cancel button |
|
|
20
|
+
| `intentButtonPrimary` | `IntentColorKey` | - | Intent of the OK button; defaults to `"primary"`, or `"destructive"` for the `"warn"` variant |
|
|
21
|
+
| `intentButtonCancel` | `IntentColorKey` | - | Intent of the Cancel button |
|
|
22
|
+
| `intentButtonCustom` | `IntentColorKey` | - | Intent of the custom button |
|
|
23
|
+
| `defaultIcons` | `Record<variant, () => string>` | - | Custom icon functions per variant |
|
|
21
24
|
|
|
22
25
|
## AlertConfirmPromptStack API
|
|
23
26
|
|
|
@@ -39,16 +42,16 @@ A modern, customizable replacement for native browser `alert()`, `confirm()`, an
|
|
|
39
42
|
|
|
40
43
|
### Dialog Options
|
|
41
44
|
|
|
42
|
-
| Option | Type | Description
|
|
43
|
-
| ------------- | ------------------------------------------ |
|
|
44
|
-
| `title` | `THC` | Dialog title
|
|
45
|
-
| `content` | `THC` | Dialog message/content
|
|
46
|
-
| `variant` | `"info" \| "success" \| "warn" \| "error"` | Visual style
|
|
47
|
-
| `value` | `any` | Initial value for prompt
|
|
48
|
-
| `labelOk` | `THC` | Custom OK button label
|
|
49
|
-
| `labelCancel` | `THC` | Custom Cancel button label
|
|
50
|
-
| `labelCustom` | `THC` | Optional third button label
|
|
51
|
-
| `onCustom` | `(value) => void` | Custom button callback
|
|
45
|
+
| Option | Type | Description |
|
|
46
|
+
| ------------- | ------------------------------------------ | ------------------------------------------------------------------- |
|
|
47
|
+
| `title` | `THC` | Dialog title |
|
|
48
|
+
| `content` | `THC` | Dialog message/content |
|
|
49
|
+
| `variant` | `"info" \| "success" \| "warn" \| "error"` | Visual style (`"warn"` also renders the OK button as `destructive`) |
|
|
50
|
+
| `value` | `any` | Initial value for prompt |
|
|
51
|
+
| `labelOk` | `THC` | Custom OK button label |
|
|
52
|
+
| `labelCancel` | `THC` | Custom Cancel button label |
|
|
53
|
+
| `labelCustom` | `THC` | Optional third button label |
|
|
54
|
+
| `onCustom` | `(value) => void` | Custom button callback |
|
|
52
55
|
|
|
53
56
|
## Usage
|
|
54
57
|
|