frontile 0.18.0-beta.0 → 0.18.0-beta.2
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/declarations/-private/deprecated-args.d.ts +18 -0
- package/declarations/-private/notification.d.ts +4 -4
- package/declarations/-private/types.d.ts +10 -8
- package/declarations/components/buttons/button-group.d.ts +3 -1
- package/declarations/components/buttons/button.d.ts +12 -3
- package/declarations/components/buttons/chip.d.ts +15 -8
- package/declarations/components/buttons/close-button.d.ts +5 -2
- package/declarations/components/buttons/segmented-control/segmented-control.d.ts +9 -9
- package/declarations/components/buttons/toggle-button.d.ts +9 -1
- package/declarations/components/collections/calendar/calendar.d.ts +49 -49
- package/declarations/components/collections/calendar/utils.d.ts +1 -0
- package/declarations/components/collections/dropdown/dropdown.d.ts +13 -2
- package/declarations/components/collections/dropdown/menu-context.d.ts +3 -3
- package/declarations/components/collections/listbox/group.d.ts +7 -2
- package/declarations/components/collections/listbox/item.d.ts +27 -6
- package/declarations/components/collections/listbox/listbox.d.ts +31 -4
- package/declarations/components/collections/simple-table/body.d.ts +72 -72
- package/declarations/components/collections/simple-table/cell.d.ts +72 -72
- package/declarations/components/collections/simple-table/column.d.ts +72 -72
- package/declarations/components/collections/simple-table/footer.d.ts +72 -72
- package/declarations/components/collections/simple-table/header.d.ts +72 -72
- package/declarations/components/collections/simple-table/index.d.ts +84 -72
- package/declarations/components/collections/simple-table/row.d.ts +72 -72
- package/declarations/components/collections/table/column-visibility.d.ts +72 -72
- package/declarations/components/collections/table/sort-button.d.ts +72 -72
- package/declarations/components/collections/table/table.d.ts +73 -72
- package/declarations/components/disclosure/accordion/accordion.d.ts +23 -23
- package/declarations/components/forms/autocomplete.d.ts +24 -12
- package/declarations/components/forms/date-picker/date-picker.d.ts +268 -0
- package/declarations/components/forms/date-picker/end-content.d.ts +29 -0
- package/declarations/components/forms/date-picker/trigger.d.ts +40 -0
- package/declarations/components/forms/date-picker/types.d.ts +149 -0
- package/declarations/components/forms/date-picker/value.d.ts +43 -0
- package/declarations/components/forms/date-picker.d.ts +3 -0
- package/declarations/components/forms/field.d.ts +5 -0
- package/declarations/components/forms/form-control.d.ts +1 -1
- package/declarations/components/forms/form-feedback.d.ts +17 -2
- package/declarations/components/forms/icons.d.ts +4 -1
- package/declarations/components/forms/index.d.ts +2 -0
- package/declarations/components/forms/input.d.ts +10 -10
- package/declarations/components/forms/native-select.d.ts +7 -7
- package/declarations/components/forms/select/select.d.ts +30 -17
- package/declarations/components/forms/select/trigger.d.ts +5 -3
- package/declarations/components/forms/select/types.d.ts +42 -12
- package/declarations/components/forms/switch.d.ts +22 -18
- package/declarations/components/forms/textarea.d.ts +6 -6
- package/declarations/components/navigation/pagination/pagination.d.ts +21 -20
- package/declarations/components/navigation/tab-nav/tab-nav.d.ts +12 -12
- package/declarations/components/navigation/tabs/tabs.d.ts +12 -12
- package/declarations/components/notifications/index.d.ts +2 -2
- package/declarations/components/notifications/notification-card.d.ts +5 -5
- package/declarations/components/notifications/notifications-container.d.ts +2 -2
- package/declarations/components/overlays/drawer.d.ts +32 -32
- package/declarations/components/overlays/popover.d.ts +1 -1
- package/declarations/components/overlays/tooltip.d.ts +2 -2
- package/declarations/components/status/alert.d.ts +10 -10
- package/declarations/components/status/progress-bar.d.ts +5 -1
- package/declarations/components/utilities/kbd.d.ts +4 -4
- package/declarations/components/utilities/spinner.d.ts +14 -7
- package/declarations/index.d.ts +1 -1
- package/declarations/template-registry.d.ts +2 -1
- package/declarations/test-support.d.ts +22 -0
- package/declarations/utils/selection-indicator.d.ts +4 -0
- package/dist/components/buttons/button-group.js +26 -1
- package/dist/components/buttons/button-group.js.map +1 -1
- package/dist/components/buttons/button.js +23 -4
- package/dist/components/buttons/button.js.map +1 -1
- package/dist/components/buttons/chip.js +20 -3
- package/dist/components/buttons/chip.js.map +1 -1
- package/dist/components/buttons/close-button.js +18 -2
- package/dist/components/buttons/close-button.js.map +1 -1
- package/dist/components/buttons/segmented-control/item.js +1 -1
- package/dist/components/buttons/segmented-control/item.js.map +1 -1
- package/dist/components/buttons/segmented-control/segmented-control.js +2 -2
- package/dist/components/buttons/segmented-control/segmented-control.js.map +1 -1
- package/dist/components/buttons/toggle-button.js +37 -3
- package/dist/components/buttons/toggle-button.js.map +1 -1
- package/dist/components/collections/calendar/calendar.js +43 -6
- package/dist/components/collections/calendar/calendar.js.map +1 -1
- package/dist/components/collections/calendar/day-cell.js +1 -1
- package/dist/components/collections/calendar/day-cell.js.map +1 -1
- package/dist/components/collections/calendar/header.js +1 -1
- package/dist/components/collections/calendar/header.js.map +1 -1
- package/dist/components/collections/calendar/month-grid.js +1 -1
- package/dist/components/collections/calendar/month-grid.js.map +1 -1
- package/dist/components/collections/calendar/utils.js +1 -1
- package/dist/components/collections/calendar/utils.js.map +1 -1
- package/dist/components/collections/calendar/year-grid.js +15 -3
- package/dist/components/collections/calendar/year-grid.js.map +1 -1
- package/dist/components/collections/command/command.js +1 -1
- package/dist/components/collections/command/command.js.map +1 -1
- package/dist/components/collections/command/dialog.js +1 -1
- package/dist/components/collections/command/dialog.js.map +1 -1
- package/dist/components/collections/command/footer.js +3 -3
- package/dist/components/collections/command/footer.js.map +1 -1
- package/dist/components/collections/command/input.js +1 -1
- package/dist/components/collections/command/input.js.map +1 -1
- package/dist/components/collections/command/list.js +1 -1
- package/dist/components/collections/command/list.js.map +1 -1
- package/dist/components/collections/dropdown/dropdown.js +45 -7
- package/dist/components/collections/dropdown/dropdown.js.map +1 -1
- package/dist/components/collections/dropdown/menu-context.js.map +1 -1
- package/dist/components/collections/listbox/group.js +1 -1
- package/dist/components/collections/listbox/group.js.map +1 -1
- package/dist/components/collections/listbox/item.js +47 -8
- package/dist/components/collections/listbox/item.js.map +1 -1
- package/dist/components/collections/listbox/listbox.js +53 -2
- package/dist/components/collections/listbox/listbox.js.map +1 -1
- package/dist/components/collections/simple-table/body.js +1 -1
- package/dist/components/collections/simple-table/body.js.map +1 -1
- package/dist/components/collections/simple-table/cell.js +1 -1
- package/dist/components/collections/simple-table/cell.js.map +1 -1
- package/dist/components/collections/simple-table/column.js +1 -1
- package/dist/components/collections/simple-table/column.js.map +1 -1
- package/dist/components/collections/simple-table/footer.js +1 -1
- package/dist/components/collections/simple-table/footer.js.map +1 -1
- package/dist/components/collections/simple-table/header.js +1 -1
- package/dist/components/collections/simple-table/header.js.map +1 -1
- package/dist/components/collections/simple-table/index.js +5 -3
- package/dist/components/collections/simple-table/index.js.map +1 -1
- package/dist/components/collections/simple-table/row.js +1 -1
- package/dist/components/collections/simple-table/row.js.map +1 -1
- package/dist/components/collections/table/checkbox.js +1 -1
- package/dist/components/collections/table/checkbox.js.map +1 -1
- package/dist/components/collections/table/column-visibility.js +1 -1
- package/dist/components/collections/table/column-visibility.js.map +1 -1
- package/dist/components/collections/table/sort-button.js +1 -1
- package/dist/components/collections/table/sort-button.js.map +1 -1
- package/dist/components/collections/table/table.js +7 -3
- package/dist/components/collections/table/table.js.map +1 -1
- package/dist/components/disclosure/accordion/accordion.js +3 -2
- package/dist/components/disclosure/accordion/accordion.js.map +1 -1
- package/dist/components/disclosure/accordion/item.js +1 -1
- package/dist/components/disclosure/accordion/item.js.map +1 -1
- package/dist/components/forms/autocomplete.js +47 -2
- package/dist/components/forms/autocomplete.js.map +1 -1
- package/dist/components/forms/checkbox-group.js +1 -1
- package/dist/components/forms/checkbox-group.js.map +1 -1
- package/dist/components/forms/checkbox.js +1 -1
- package/dist/components/forms/checkbox.js.map +1 -1
- package/dist/components/forms/date-picker/date-picker.js +301 -0
- package/dist/components/forms/date-picker/date-picker.js.map +1 -0
- package/dist/components/forms/date-picker/end-content.js +21 -0
- package/dist/components/forms/date-picker/end-content.js.map +1 -0
- package/dist/components/forms/date-picker/trigger.js +14 -0
- package/dist/components/forms/date-picker/trigger.js.map +1 -0
- package/dist/components/forms/date-picker/types.js +2 -0
- package/dist/components/forms/date-picker/types.js.map +1 -0
- package/dist/components/forms/date-picker/value.js +97 -0
- package/dist/components/forms/date-picker/value.js.map +1 -0
- package/dist/components/forms/date-picker.js +2 -0
- package/dist/components/forms/date-picker.js.map +1 -0
- package/dist/components/forms/field.js +3 -1
- package/dist/components/forms/field.js.map +1 -1
- package/dist/components/forms/form-control.js +1 -1
- package/dist/components/forms/form-control.js.map +1 -1
- package/dist/components/forms/form-description.js +1 -1
- package/dist/components/forms/form-description.js.map +1 -1
- package/dist/components/forms/form-feedback.js +26 -3
- package/dist/components/forms/form-feedback.js.map +1 -1
- package/dist/components/forms/icons.js +4 -1
- package/dist/components/forms/icons.js.map +1 -1
- package/dist/components/forms/index.js +2 -0
- package/dist/components/forms/index.js.map +1 -1
- package/dist/components/forms/input-otp.js +1 -1
- package/dist/components/forms/input-otp.js.map +1 -1
- package/dist/components/forms/input.js +1 -1
- package/dist/components/forms/input.js.map +1 -1
- package/dist/components/forms/label.js +1 -1
- package/dist/components/forms/label.js.map +1 -1
- package/dist/components/forms/native-select.js +2 -2
- package/dist/components/forms/native-select.js.map +1 -1
- package/dist/components/forms/radio-group.js +1 -1
- package/dist/components/forms/radio-group.js.map +1 -1
- package/dist/components/forms/radio.js +1 -1
- package/dist/components/forms/radio.js.map +1 -1
- package/dist/components/forms/select/end-content.js +1 -1
- package/dist/components/forms/select/end-content.js.map +1 -1
- package/dist/components/forms/select/select.js +61 -7
- package/dist/components/forms/select/select.js.map +1 -1
- package/dist/components/forms/select/selected-items.js +1 -1
- package/dist/components/forms/select/selected-items.js.map +1 -1
- package/dist/components/forms/select/trigger.js +6 -4
- package/dist/components/forms/select/trigger.js.map +1 -1
- package/dist/components/forms/switch.js +10 -2
- package/dist/components/forms/switch.js.map +1 -1
- package/dist/components/forms/textarea.js +1 -1
- package/dist/components/forms/textarea.js.map +1 -1
- package/dist/components/navigation/external-link.js +2 -2
- package/dist/components/navigation/external-link.js.map +1 -1
- package/dist/components/navigation/pagination/pagination.js +2 -2
- package/dist/components/navigation/pagination/pagination.js.map +1 -1
- package/dist/components/navigation/tab-nav/item.js +1 -1
- package/dist/components/navigation/tab-nav/item.js.map +1 -1
- package/dist/components/navigation/tab-nav/tab-nav.js +2 -2
- package/dist/components/navigation/tab-nav/tab-nav.js.map +1 -1
- package/dist/components/navigation/tabs/panel.js +1 -1
- package/dist/components/navigation/tabs/panel.js.map +1 -1
- package/dist/components/navigation/tabs/tab.js +1 -1
- package/dist/components/navigation/tabs/tab.js.map +1 -1
- package/dist/components/navigation/tabs/tabs.js +3 -3
- package/dist/components/navigation/tabs/tabs.js.map +1 -1
- package/dist/components/notifications/index.js +2 -2
- package/dist/components/notifications/notification-card.js +1 -1
- package/dist/components/notifications/notifications-container.js +2 -2
- package/dist/components/notifications/notifications-container.js.map +1 -1
- package/dist/components/overlays/drawer/body.js +1 -1
- package/dist/components/overlays/drawer/body.js.map +1 -1
- package/dist/components/overlays/drawer/drag-handle.js +1 -1
- package/dist/components/overlays/drawer/drag-handle.js.map +1 -1
- package/dist/components/overlays/drawer/footer.js +1 -1
- package/dist/components/overlays/drawer/footer.js.map +1 -1
- package/dist/components/overlays/drawer/header.js +4 -4
- package/dist/components/overlays/drawer/header.js.map +1 -1
- package/dist/components/overlays/drawer.js +4 -4
- package/dist/components/overlays/drawer.js.map +1 -1
- package/dist/components/overlays/modal/body.js +1 -1
- package/dist/components/overlays/modal/body.js.map +1 -1
- package/dist/components/overlays/modal/footer.js +1 -1
- package/dist/components/overlays/modal/footer.js.map +1 -1
- package/dist/components/overlays/modal/header.js +1 -1
- package/dist/components/overlays/modal/header.js.map +1 -1
- package/dist/components/overlays/modal.js +1 -1
- package/dist/components/overlays/modal.js.map +1 -1
- package/dist/components/overlays/overlay.js +1 -1
- package/dist/components/overlays/overlay.js.map +1 -1
- package/dist/components/overlays/popover.js.map +1 -1
- package/dist/components/overlays/tooltip.js +14 -2
- package/dist/components/overlays/tooltip.js.map +1 -1
- package/dist/components/status/alert.js +19 -15
- package/dist/components/status/alert.js.map +1 -1
- package/dist/components/status/progress-bar.js +10 -2
- package/dist/components/status/progress-bar.js.map +1 -1
- package/dist/components/utilities/avatar.js +1 -1
- package/dist/components/utilities/avatar.js.map +1 -1
- package/dist/components/utilities/divider.js +1 -1
- package/dist/components/utilities/divider.js.map +1 -1
- package/dist/components/utilities/kbd.js +3 -3
- package/dist/components/utilities/kbd.js.map +1 -1
- package/dist/components/utilities/skeleton.js +1 -1
- package/dist/components/utilities/skeleton.js.map +1 -1
- package/dist/components/utilities/spinner.js +26 -7
- package/dist/components/utilities/spinner.js.map +1 -1
- package/dist/deprecated-args-BIUjLA8y.js +32 -0
- package/dist/deprecated-args-BIUjLA8y.js.map +1 -0
- package/dist/forms.js +2 -0
- package/dist/forms.js.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/{manager-CDIZzrQ9.js → manager-B-PnYqDs.js} +28 -22
- package/dist/manager-B-PnYqDs.js.map +1 -0
- package/dist/{notification-card-D5fd-Sxa.js → notification-card-CYmWQ35W.js} +25 -22
- package/dist/notification-card-CYmWQ35W.js.map +1 -0
- package/dist/notifications.js +2 -2
- package/dist/services/notifications.js +1 -1
- package/dist/test-support.js +40 -2
- package/dist/test-support.js.map +1 -1
- package/dist/utils/selection-indicator.js +30 -2
- package/dist/utils/selection-indicator.js.map +1 -1
- package/package.json +3 -3
- package/dist/manager-CDIZzrQ9.js.map +0 -1
- package/dist/notification-card-D5fd-Sxa.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skeleton.js","sources":["../../../src/components/utilities/skeleton.gts"],"sourcesContent":["import type { TOC } from '@ember/component/template-only';\nimport { useStyles, type SkeletonVariants } from '@frontile/theme';\n\nconst Skeleton: TOC<{\n Args: {\n class?: string;\n /**\n * Shape preset. `text` fills its container at text height; `circle` and\n * `square` are equal-sided and match Avatar's radii; `rounded` and `rect`\n * fill their container for image and card placeholders.\n *\n * @defaultValue 'text'\n */\n shape?: SkeletonVariants['shape'];\n /**\n * Size preset. For `circle` and `square` this sets both dimensions from\n * Avatar's scale; for the other shapes it sets the height.\n *\n * @defaultValue 'md'\n */\n size?: SkeletonVariants['size'];\n /**\n * Animation style for the placeholder.\n *\n * @defaultValue 'shimmer'\n */\n animation?: SkeletonVariants['animation'];\n };\n Element: HTMLDivElement;\n}> = <template>\n {{#let (useStyles) as |styles|}}\n <div\n class={{styles.skeleton\n class=@class\n shape=@shape\n size=@size\n animation=@animation\n }}\n aria-hidden=\"true\"\n data-component=\"skeleton\"\n ...attributes\n ></div>\n {{/let}}\n</template>;\n\nexport { Skeleton };\nexport default Skeleton;\n"],"names":["Skeleton","setComponentTemplate","precompileTemplate","strictMode","scope","useStyles","templateOnly"],"mappings":";;;;;AAGA,MAAMA,QA0BD,GAAAC,oBAAA,CAAAC,kBAAA,CAAA,
|
|
1
|
+
{"version":3,"file":"skeleton.js","sources":["../../../src/components/utilities/skeleton.gts"],"sourcesContent":["import type { TOC } from '@ember/component/template-only';\nimport { useStyles, type SkeletonVariants } from '@frontile/theme';\n\nconst Skeleton: TOC<{\n Args: {\n class?: string;\n /**\n * Shape preset. `text` fills its container at text height; `circle` and\n * `square` are equal-sided and match Avatar's radii; `rounded` and `rect`\n * fill their container for image and card placeholders.\n *\n * @defaultValue 'text'\n */\n shape?: SkeletonVariants['shape'];\n /**\n * Size preset. For `circle` and `square` this sets both dimensions from\n * Avatar's scale; for the other shapes it sets the height.\n *\n * @defaultValue 'md'\n */\n size?: SkeletonVariants['size'];\n /**\n * Animation style for the placeholder.\n *\n * @defaultValue 'shimmer'\n */\n animation?: SkeletonVariants['animation'];\n };\n Element: HTMLDivElement;\n}> = <template>\n {{#let (useStyles) as |styles|}}\n <div\n class={{styles.skeleton\n class=@class\n shape=@shape\n size=@size\n animation=@animation\n }}\n aria-hidden=\"true\"\n data-component=\"skeleton\"\n data-part=\"base\"\n ...attributes\n ></div>\n {{/let}}\n</template>;\n\nexport { Skeleton };\nexport default Skeleton;\n"],"names":["Skeleton","setComponentTemplate","precompileTemplate","strictMode","scope","useStyles","templateOnly"],"mappings":";;;;;AAGA,MAAMA,QA0BD,GAAAC,oBAAA,CAAAC,kBAAA,CAAA,iOAAA,EAeL;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;AAAAC,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAC,YAAA,EAAA;;;;"}
|
|
@@ -1,14 +1,33 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
1
2
|
import { useStyles } from '@frontile/theme';
|
|
3
|
+
import { r as renamedArgValue } from '../../deprecated-args-BIUjLA8y.js';
|
|
2
4
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
3
5
|
import { setComponentTemplate } from '@ember/component';
|
|
4
|
-
import templateOnly from '@ember/component/template-only';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
class Spinner extends Component {
|
|
8
|
+
get classNames() {
|
|
9
|
+
const {
|
|
10
|
+
spinner
|
|
11
|
+
} = useStyles();
|
|
12
|
+
return spinner({
|
|
13
|
+
class: this.args.class,
|
|
14
|
+
size: this.args.size,
|
|
15
|
+
color: renamedArgValue(this.args.color, this.args.intent, {
|
|
16
|
+
default: 'neutral'
|
|
17
|
+
}, {
|
|
18
|
+
component: 'Spinner',
|
|
19
|
+
from: 'intent',
|
|
20
|
+
to: 'color',
|
|
21
|
+
id: 'frontile.spinner.intent'
|
|
22
|
+
}) || 'neutral'
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
static {
|
|
26
|
+
setComponentTemplate(precompileTemplate("{{!-- A spinner is decorative: the loading state belongs on the region that\nis loading, not on the graphic. Hidden by default so it is not announced as\nan unnamed image; attributes are applied last, so a caller that really wants\nit announced can pass its own aria-hidden and label. --}}\n<svg viewBox=\"0 0 16 16\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\" data-component=\"spinner\" data-part=\"base\" class={{this.classNames}} ...attributes>\n <path d=\"M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM0 8a8 8 0 1116 0A8 8 0 010 8z\" fill=\"currentColor\" fill-rule=\"evenodd\" clip-rule=\"evenodd\" />\n\n <path d=\"M7.25.75A.75.75 0 018 0a8 8 0 018 8 .75.75 0 01-1.5 0A6.5 6.5 0 008 1.5a.75.75 0 01-.75-.75z\" fill=\"currentFill\" fill-rule=\"evenodd\" clip-rule=\"evenodd\" />\n</svg>", {
|
|
27
|
+
strictMode: true
|
|
28
|
+
}), this);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
12
31
|
|
|
13
32
|
export { Spinner, Spinner as default };
|
|
14
33
|
//# sourceMappingURL=spinner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spinner.js","sources":["../../../src/components/utilities/spinner.gts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"spinner.js","sources":["../../../src/components/utilities/spinner.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { useStyles, type SpinnerVariants } from '@frontile/theme';\nimport { renamedArgValue } from '../../-private/deprecated-args';\n\ninterface SpinnerSignature {\n Args: {\n /**\n * Custom class name, it will override the default ones using Tailwind Merge\n * library. Use `fill-*` for the highlighted arc and `text-*` for the track.\n */\n class?: string;\n\n /**\n * The size of the spinner.\n *\n * @defaultValue 'md'\n */\n size?: SpinnerVariants['size'];\n\n /**\n * The color of the spinner.\n *\n * @defaultValue 'neutral'\n */\n color?: SpinnerVariants['color'];\n\n /**\n * @deprecated Use `color`. `default` is now `neutral`.\n */\n intent?:\n | 'default'\n | 'primary'\n | 'secondary'\n | 'tertiary'\n | 'success'\n | 'warning'\n | 'danger';\n };\n Element: SVGElement;\n}\n\nclass Spinner extends Component<SpinnerSignature> {\n get classNames() {\n const { spinner } = useStyles();\n\n return spinner({\n class: this.args.class,\n size: this.args.size,\n color:\n renamedArgValue(\n this.args.color,\n this.args.intent,\n { default: 'neutral' } as const,\n {\n component: 'Spinner',\n from: 'intent',\n to: 'color',\n id: 'frontile.spinner.intent'\n }\n ) || 'neutral'\n });\n }\n\n <template>\n {{! A spinner is decorative: the loading state belongs on the region that\n is loading, not on the graphic. Hidden by default so it is not announced as\n an unnamed image; attributes are applied last, so a caller that really wants\n it announced can pass its own aria-hidden and label. }}\n <svg\n viewBox=\"0 0 16 16\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden=\"true\"\n data-component=\"spinner\"\n data-part=\"base\"\n class={{this.classNames}}\n ...attributes\n >\n <path\n d=\"M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM0 8a8 8 0 1116 0A8 8 0 010 8z\"\n fill=\"currentColor\"\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n />\n\n <path\n d=\"M7.25.75A.75.75 0 018 0a8 8 0 018 8 .75.75 0 01-1.5 0A6.5 6.5 0 008 1.5a.75.75 0 01-.75-.75z\"\n fill=\"currentFill\"\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n />\n </svg>\n </template>\n}\n\nexport { Spinner, type SpinnerSignature };\nexport default Spinner;\n"],"names":["Spinner","Component","classNames","spinner","useStyles","class","args","size","color","renamedArgValue","intent","default","component","from","to","id","setComponentTemplate","precompileTemplate","strictMode"],"mappings":";;;;;;AAyCA,MAAMA,gBAAgBC,SAAA,CAAU;EAC9B,IAAIC,UAAAA,GAAa;IACf,MAAM;AAAEC,MAAAA;KAAS,GAAGC,SAAA,EAAA;AAEpB,IAAA,OAAOD,OAAA,CAAQ;AACbE,MAAAA,KAAA,EAAO,IAAI,CAACC,IAAI,CAACD,KAAK;AACtBE,MAAAA,IAAA,EAAM,IAAI,CAACD,IAAI,CAACC,IAAI;AACpBC,MAAAA,KAAA,EACEC,eAAA,CACE,IAAI,CAACH,IAAI,CAACE,KAAK,EACf,IAAI,CAACF,IAAI,CAACI,MAAM,EAChB;AAAEC,QAAAA,OAAA,EAAS;AAAU,OAAA,EACrB;AACEC,QAAAA,SAAA,EAAW,SAAA;AACXC,QAAAA,IAAA,EAAM,QAAA;AACNC,QAAAA,EAAA,EAAI,OAAA;AACJC,QAAAA,EAAA,EAAI;AACN,OAAA,CAAA,IACG;AACT,KAAA,CAAA;AACF,EAAA;AAEA,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,syBAAA,EA4BA;MAAAC,UAAA,EAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { deprecate } from '@ember/debug';
|
|
2
|
+
|
|
3
|
+
function warn(options, detail = '') {
|
|
4
|
+
deprecate(`${options.component}: \`@${options.from}\` is deprecated. Use \`@${options.to}\` instead.${detail}`, false, {
|
|
5
|
+
id: options.id,
|
|
6
|
+
until: '0.19.0',
|
|
7
|
+
for: 'frontile',
|
|
8
|
+
since: {
|
|
9
|
+
available: '0.18.0',
|
|
10
|
+
enabled: '0.18.0'
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Resolve an argument whose name *and* values moved.
|
|
17
|
+
*
|
|
18
|
+
* `values` maps old spellings to new ones. A legacy value absent from the map
|
|
19
|
+
* kept its name (e.g. Button's `custom`) and passes through untouched — so the
|
|
20
|
+
* map only lists what actually changed.
|
|
21
|
+
*/
|
|
22
|
+
function renamedArgValue(next, legacy, values, options) {
|
|
23
|
+
if (typeof legacy === 'undefined') {
|
|
24
|
+
return next;
|
|
25
|
+
}
|
|
26
|
+
const mapped = values[legacy] ?? legacy;
|
|
27
|
+
warn(options, values[legacy] ? ` \`${legacy}\` is now \`${values[legacy]}\`.` : '');
|
|
28
|
+
return typeof next === 'undefined' ? mapped : next;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { renamedArgValue as r };
|
|
32
|
+
//# sourceMappingURL=deprecated-args-BIUjLA8y.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deprecated-args-BIUjLA8y.js","sources":["../src/-private/deprecated-args.ts"],"sourcesContent":["import { deprecate } from '@ember/debug';\n\nexport interface RenamedArgOptions {\n /** Component name as it appears to a consumer, e.g. `'Button'`. */\n component: string;\n /** The old argument name, without the `@`. */\n from: string;\n /** The new argument name, without the `@`. */\n to: string;\n /** Deprecation id, e.g. `'frontile.button.appearance'`. */\n id: string;\n}\n\nfunction warn(options: RenamedArgOptions, detail = ''): void {\n deprecate(\n `${options.component}: \\`@${options.from}\\` is deprecated. Use \\`@${options.to}\\` instead.${detail}`,\n false,\n {\n id: options.id,\n until: '0.19.0',\n for: 'frontile',\n since: { available: '0.18.0', enabled: '0.18.0' }\n }\n );\n}\n\n/**\n * Resolve an argument whose name *and* values moved.\n *\n * `values` maps old spellings to new ones. A legacy value absent from the map\n * kept its name (e.g. Button's `custom`) and passes through untouched — so the\n * map only lists what actually changed.\n */\nexport function renamedArgValue<Old extends string, New extends string>(\n next: New | undefined,\n legacy: Old | undefined,\n values: Partial<Record<Old, New>>,\n options: RenamedArgOptions\n): New | undefined {\n if (typeof legacy === 'undefined') {\n return next;\n }\n\n const mapped = values[legacy] ?? (legacy as unknown as New);\n\n warn(\n options,\n values[legacy] ? ` \\`${legacy}\\` is now \\`${values[legacy]}\\`.` : ''\n );\n\n return typeof next === 'undefined' ? mapped : next;\n}\n"],"names":["warn","options","detail","deprecate","component","from","to","id","until","for","since","available","enabled","renamedArgValue","next","legacy","values","mapped"],"mappings":";;AAaA,SAASA,IAAIA,CAACC,OAA0B,EAAEC,MAAM,GAAG,EAAE,EAAQ;AAC3DC,EAAAA,SAAS,CACP,CAAA,EAAGF,OAAO,CAACG,SAAS,CAAA,KAAA,EAAQH,OAAO,CAACI,IAAI,CAAA,yBAAA,EAA4BJ,OAAO,CAACK,EAAE,CAAA,WAAA,EAAcJ,MAAM,CAAA,CAAE,EACpG,KAAK,EACL;IACEK,EAAE,EAAEN,OAAO,CAACM,EAAE;AACdC,IAAAA,KAAK,EAAE,QAAQ;AACfC,IAAAA,GAAG,EAAE,UAAU;AACfC,IAAAA,KAAK,EAAE;AAAEC,MAAAA,SAAS,EAAE,QAAQ;AAAEC,MAAAA,OAAO,EAAE;AAAS;AAClD,GACF,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,eAAeA,CAC7BC,IAAqB,EACrBC,MAAuB,EACvBC,MAAiC,EACjCf,OAA0B,EACT;AACjB,EAAA,IAAI,OAAOc,MAAM,KAAK,WAAW,EAAE;AACjC,IAAA,OAAOD,IAAI;AACb,EAAA;AAEA,EAAA,MAAMG,MAAM,GAAGD,MAAM,CAACD,MAAM,CAAC,IAAKA,MAAyB;AAE3Df,EAAAA,IAAI,CACFC,OAAO,EACPe,MAAM,CAACD,MAAM,CAAC,GAAG,CAAA,GAAA,EAAMA,MAAM,CAAA,YAAA,EAAeC,MAAM,CAACD,MAAM,CAAC,CAAA,GAAA,CAAK,GAAG,EACpE,CAAC;AAED,EAAA,OAAO,OAAOD,IAAI,KAAK,WAAW,GAAGG,MAAM,GAAGH,IAAI;AACpD;;;;"}
|
package/dist/forms.js
CHANGED
|
@@ -15,6 +15,8 @@ export { Radio } from './components/forms/radio.js';
|
|
|
15
15
|
export { RadioGroup } from './components/forms/radio-group.js';
|
|
16
16
|
export { FormControl } from './components/forms/form-control.js';
|
|
17
17
|
export { Switch } from './components/forms/switch.js';
|
|
18
|
+
export { DatePicker } from './components/forms/date-picker/date-picker.js';
|
|
19
|
+
export { formatValue, isEmptyValue, parseDate, parseRange, toWire } from './components/forms/date-picker/value.js';
|
|
18
20
|
export { StandardValidator } from './utils/standard-validator.js';
|
|
19
21
|
export { deepEqual, flattenData, hasNestedData, unflattenData } from './utils/nested-data.js';
|
|
20
22
|
//# sourceMappingURL=forms.js.map
|
package/dist/forms.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forms.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"forms.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -32,6 +32,8 @@ export { Radio } from './components/forms/radio.js';
|
|
|
32
32
|
export { RadioGroup } from './components/forms/radio-group.js';
|
|
33
33
|
export { FormControl } from './components/forms/form-control.js';
|
|
34
34
|
export { Switch } from './components/forms/switch.js';
|
|
35
|
+
export { DatePicker } from './components/forms/date-picker/date-picker.js';
|
|
36
|
+
export { formatValue, isEmptyValue, parseDate, parseRange, toWire } from './components/forms/date-picker/value.js';
|
|
35
37
|
export { StandardValidator } from './utils/standard-validator.js';
|
|
36
38
|
export { deepEqual, flattenData, hasNestedData, unflattenData } from './utils/nested-data.js';
|
|
37
39
|
export { Overlay } from './components/overlays/overlay.js';
|
|
@@ -75,9 +77,9 @@ export { Pagination } from './components/navigation/pagination/pagination.js';
|
|
|
75
77
|
export { paginationRange } from './components/navigation/pagination/range.js';
|
|
76
78
|
export { Accordion } from './components/disclosure/accordion/accordion.js';
|
|
77
79
|
export { AccordionItem } from './components/disclosure/accordion/item.js';
|
|
78
|
-
import './manager-
|
|
80
|
+
import './manager-B-PnYqDs.js';
|
|
79
81
|
import '@ember/service';
|
|
80
|
-
export { N as NotificationCard } from './notification-card-
|
|
82
|
+
export { N as NotificationCard } from './notification-card-CYmWQ35W.js';
|
|
81
83
|
export { NotificationsContainer } from './components/notifications/notifications-container.js';
|
|
82
84
|
export { ListboxGroup } from './components/collections/listbox/group.js';
|
|
83
85
|
export { ListboxItem } from './components/collections/listbox/item.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -88,10 +88,10 @@ function toContent(content) {
|
|
|
88
88
|
/**
|
|
89
89
|
* Emit the shared deprecation notice and remap `error` onto `danger`. Used
|
|
90
90
|
* for both the option-level and config-level `appearance` fallbacks in
|
|
91
|
-
* `
|
|
91
|
+
* `resolveStatus`, which must apply the same remap.
|
|
92
92
|
*/
|
|
93
93
|
function mapAppearance(appearance) {
|
|
94
|
-
deprecate('The `appearance` option for notifications is deprecated. Use `
|
|
94
|
+
deprecate('The `appearance` option for notifications is deprecated. Use `status` instead, and `danger` in place of `error`.', false, {
|
|
95
95
|
id: 'frontile.notification-appearance',
|
|
96
96
|
until: '0.19.0',
|
|
97
97
|
for: 'frontile',
|
|
@@ -100,30 +100,33 @@ function mapAppearance(appearance) {
|
|
|
100
100
|
enabled: '0.18.0'
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
|
-
|
|
103
|
+
if (appearance === 'error') return 'danger';
|
|
104
|
+
// `info` folded into `primary` when the axis became `status`.
|
|
105
|
+
if (appearance === 'info') return 'primary';
|
|
106
|
+
return appearance;
|
|
104
107
|
}
|
|
105
108
|
|
|
106
109
|
/**
|
|
107
|
-
* Resolve the notification
|
|
110
|
+
* Resolve the notification status from the current option, the deprecated
|
|
108
111
|
* `appearance` option, and the app config, in that order.
|
|
109
112
|
*/
|
|
110
|
-
function
|
|
111
|
-
if (options.
|
|
112
|
-
return options.
|
|
113
|
+
function resolveStatus(config, options) {
|
|
114
|
+
if (options.status) {
|
|
115
|
+
return options.status;
|
|
113
116
|
}
|
|
114
117
|
if (options.appearance) {
|
|
115
118
|
return mapAppearance(options.appearance);
|
|
116
119
|
}
|
|
117
|
-
if (config.
|
|
118
|
-
return config.
|
|
120
|
+
if (config.status) {
|
|
121
|
+
return config.status;
|
|
119
122
|
}
|
|
120
123
|
if (config.appearance) {
|
|
121
124
|
return mapAppearance(config.appearance);
|
|
122
125
|
}
|
|
123
126
|
|
|
124
|
-
// `config.
|
|
127
|
+
// `config.status`/`config.appearance` were already read directly above, so
|
|
125
128
|
// there is no distinct config lookup left to fall back to.
|
|
126
|
-
return '
|
|
129
|
+
return 'neutral';
|
|
127
130
|
}
|
|
128
131
|
class Notification {
|
|
129
132
|
static {
|
|
@@ -139,9 +142,9 @@ class Notification {
|
|
|
139
142
|
}
|
|
140
143
|
#description = (initializeDeferredDecorator(this, "description"), void 0);
|
|
141
144
|
static {
|
|
142
|
-
decorateFieldV2(this.prototype, "
|
|
145
|
+
decorateFieldV2(this.prototype, "status", [tracked]);
|
|
143
146
|
}
|
|
144
|
-
#
|
|
147
|
+
#status = (initializeDeferredDecorator(this, "status"), void 0);
|
|
145
148
|
static {
|
|
146
149
|
decorateFieldV2(this.prototype, "allowClosing", [tracked]);
|
|
147
150
|
}
|
|
@@ -177,7 +180,7 @@ class Notification {
|
|
|
177
180
|
// An object content form owns the description outright; the option is only
|
|
178
181
|
// a convenience for the string form.
|
|
179
182
|
this.description = typeof content === 'string' ? options.description : description;
|
|
180
|
-
this.
|
|
183
|
+
this.status = resolveStatus(config, options);
|
|
181
184
|
this.isLoading = options.isLoading === true;
|
|
182
185
|
this.hideIcon = options.hideIcon === true;
|
|
183
186
|
this.customActions = options.customActions;
|
|
@@ -193,16 +196,19 @@ class Notification {
|
|
|
193
196
|
}
|
|
194
197
|
|
|
195
198
|
/**
|
|
196
|
-
* @deprecated Read `
|
|
199
|
+
* @deprecated Read `status` instead.
|
|
197
200
|
*
|
|
198
201
|
* The return type is widened to include `'default'` because `default` is
|
|
199
202
|
* new vocabulary introduced alongside this getter's deprecation — it has
|
|
200
203
|
* no equivalent in the old `NotificationAppearance` names, so mapping it
|
|
201
|
-
* onto `'info'` here would silently lie about the notification's
|
|
204
|
+
* onto `'info'` here would silently lie about the notification's status.
|
|
202
205
|
* Everything else keeps the old four-value shape.
|
|
203
206
|
*/
|
|
204
207
|
get appearance() {
|
|
205
|
-
|
|
208
|
+
if (this.status === 'danger') return 'error';
|
|
209
|
+
if (this.status === 'neutral') return 'default';
|
|
210
|
+
if (this.status === 'primary') return 'info';
|
|
211
|
+
return this.status;
|
|
206
212
|
}
|
|
207
213
|
|
|
208
214
|
/**
|
|
@@ -217,8 +223,8 @@ class Notification {
|
|
|
217
223
|
if (typeof changes.description !== 'undefined') {
|
|
218
224
|
this.description = changes.description;
|
|
219
225
|
}
|
|
220
|
-
if (typeof changes.
|
|
221
|
-
this.
|
|
226
|
+
if (typeof changes.status !== 'undefined') {
|
|
227
|
+
this.status = changes.status;
|
|
222
228
|
}
|
|
223
229
|
if (typeof changes.allowClosing !== 'undefined') {
|
|
224
230
|
this.allowClosing = changes.allowClosing;
|
|
@@ -310,7 +316,7 @@ class NotificationsManager {
|
|
|
310
316
|
allowClosing: false,
|
|
311
317
|
isLoading: true
|
|
312
318
|
});
|
|
313
|
-
const settle = (content,
|
|
319
|
+
const settle = (content, status) => {
|
|
314
320
|
// The user may have dismissed the toast before the promise settled; in
|
|
315
321
|
// that case there is nothing left to update.
|
|
316
322
|
if (notification.isRemoving) {
|
|
@@ -325,7 +331,7 @@ class NotificationsManager {
|
|
|
325
331
|
// `description` key at all) would leave the loading phase's stale
|
|
326
332
|
// description on screen instead of clearing it.
|
|
327
333
|
description: content.description ?? '',
|
|
328
|
-
|
|
334
|
+
status,
|
|
329
335
|
allowClosing: true,
|
|
330
336
|
isLoading: false
|
|
331
337
|
});
|
|
@@ -385,4 +391,4 @@ class NotificationsManager {
|
|
|
385
391
|
}
|
|
386
392
|
|
|
387
393
|
export { Notification as N, Timer as T, NotificationsManager as a };
|
|
388
|
-
//# sourceMappingURL=manager-
|
|
394
|
+
//# sourceMappingURL=manager-B-PnYqDs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager-B-PnYqDs.js","sources":["../src/-private/timer.ts","../src/-private/get-config.ts","../src/-private/notification.ts","../src/-private/manager.ts"],"sourcesContent":["/* eslint-disable ember/no-runloop */\nimport { tracked } from '@glimmer/tracking';\nimport { later, cancel } from '@ember/runloop';\nimport type { Timer as EmberTimer } from '@ember/runloop';\nimport { action } from '@ember/object';\n\nexport default class Timer {\n @tracked remaining: number;\n @tracked isRunning = true;\n\n readonly onFinish: () => void;\n private timer?: EmberTimer;\n private start!: number;\n\n constructor(duration: number, onFinish: () => void) {\n this.remaining = duration;\n this.onFinish = onFinish;\n this.setup();\n }\n\n @action clear(): void {\n this.isRunning = false;\n\n if (this.timer) {\n cancel(this.timer);\n }\n }\n\n @action pause(): void {\n // Pausing an already paused timer would subtract the elapsed time twice,\n // eventually driving `remaining` to zero or below.\n if (!this.isRunning) {\n return;\n }\n\n this.clear();\n this.remaining = Math.max(0, this.remaining - (Date.now() - this.start));\n }\n\n @action resume(): void {\n // Already counting down; resuming again would restart the remaining time.\n if (this.isRunning) {\n return;\n }\n\n this.clear();\n this.setup();\n }\n\n private setup(): void {\n this.start = Date.now();\n this.isRunning = true;\n\n this.timer = later(\n this,\n () => {\n this.onFinish();\n this.isRunning = false;\n },\n this.remaining\n );\n }\n}\n","import { get } from '@ember/object';\nimport type { DefaultConfig } from './types';\n\nexport function getConfigOption<T extends keyof DefaultConfig>(\n config: DefaultConfig,\n key: T,\n defaultValue: NonNullable<DefaultConfig[T]>\n): NonNullable<DefaultConfig[T]> {\n const value = get(config, key);\n\n if (value === undefined) {\n return defaultValue;\n }\n\n return value;\n}\n","import { tracked } from '@glimmer/tracking';\nimport { deprecate } from '@ember/debug';\nimport Timer from './timer';\nimport { getConfigOption } from './get-config';\nimport type {\n NotificationOptions,\n NotificationContent,\n NotificationStatus,\n NotificationAppearance,\n NotificationUpdate,\n CustomAction,\n DefaultConfig\n} from './types';\n\n/**\n * Normalise the two content forms into `{ title, description }`.\n */\nfunction toContent(content: string | NotificationContent): NotificationContent {\n return typeof content === 'string' ? { title: content } : content;\n}\n\n/**\n * Emit the shared deprecation notice and remap `error` onto `danger`. Used\n * for both the option-level and config-level `appearance` fallbacks in\n * `resolveStatus`, which must apply the same remap.\n */\nfunction mapAppearance(appearance: NotificationAppearance): NotificationStatus {\n deprecate(\n 'The `appearance` option for notifications is deprecated. Use `status` instead, and `danger` in place of `error`.',\n false,\n {\n id: 'frontile.notification-appearance',\n until: '0.19.0',\n for: 'frontile',\n since: { available: '0.18.0', enabled: '0.18.0' }\n }\n );\n\n if (appearance === 'error') return 'danger';\n // `info` folded into `primary` when the axis became `status`.\n if (appearance === 'info') return 'primary';\n\n return appearance;\n}\n\n/**\n * Resolve the notification status from the current option, the deprecated\n * `appearance` option, and the app config, in that order.\n */\nfunction resolveStatus(\n config: DefaultConfig,\n options: NotificationOptions\n): NotificationStatus {\n if (options.status) {\n return options.status;\n }\n\n if (options.appearance) {\n return mapAppearance(options.appearance);\n }\n\n if (config.status) {\n return config.status;\n }\n\n if (config.appearance) {\n return mapAppearance(config.appearance);\n }\n\n // `config.status`/`config.appearance` were already read directly above, so\n // there is no distinct config lookup left to fall back to.\n return 'neutral';\n}\n\nexport default class Notification<\n TMetadata extends Record<string, unknown> = Record<string, unknown>\n> {\n /**\n * The title of the notification. Named `message` for backwards\n * compatibility with the original single-string API.\n */\n @tracked message: string;\n @tracked description?: string;\n @tracked status: NotificationStatus;\n @tracked allowClosing: boolean;\n @tracked isLoading: boolean;\n @tracked customActions?: CustomAction[];\n @tracked timer?: Timer;\n @tracked isRemoving = false;\n\n readonly transitionDuration: number;\n readonly duration: number;\n readonly hideIcon: boolean;\n readonly metadata?: TMetadata;\n\n constructor(\n config: DefaultConfig,\n content: string | NotificationContent,\n options: NotificationOptions<TMetadata> = {}\n ) {\n const { title, description } = toContent(content);\n\n this.message = title;\n // An object content form owns the description outright; the option is only\n // a convenience for the string form.\n this.description =\n typeof content === 'string' ? options.description : description;\n this.status = resolveStatus(config, options);\n this.isLoading = options.isLoading === true;\n this.hideIcon = options.hideIcon === true;\n this.customActions = options.customActions;\n this.duration =\n options.duration || getConfigOption(config, 'duration', 5000);\n this.transitionDuration =\n typeof options.transitionDuration !== 'undefined'\n ? options.transitionDuration\n : getConfigOption(config, 'transitionDuration', 200);\n this.metadata = options.metadata;\n this.allowClosing = options.allowClosing !== false;\n }\n\n /** Read-only alias of `message` — do not add a setter. */\n get title(): string {\n return this.message;\n }\n\n /**\n * @deprecated Read `status` instead.\n *\n * The return type is widened to include `'default'` because `default` is\n * new vocabulary introduced alongside this getter's deprecation — it has\n * no equivalent in the old `NotificationAppearance` names, so mapping it\n * onto `'info'` here would silently lie about the notification's status.\n * Everything else keeps the old four-value shape.\n */\n get appearance(): 'default' | 'info' | 'success' | 'warning' | 'error' {\n if (this.status === 'danger') return 'error';\n if (this.status === 'neutral') return 'default';\n if (this.status === 'primary') return 'info';\n\n return this.status;\n }\n\n /**\n * Mutate the notification in place. Used by `promise()` so a settling\n * promise swaps the content of the toast already on screen rather than\n * replacing it with a new one.\n */\n update(changes: NotificationUpdate): void {\n if (typeof changes.title !== 'undefined') {\n this.message = changes.title;\n }\n\n if (typeof changes.description !== 'undefined') {\n this.description = changes.description;\n }\n\n if (typeof changes.status !== 'undefined') {\n this.status = changes.status;\n }\n\n if (typeof changes.allowClosing !== 'undefined') {\n this.allowClosing = changes.allowClosing;\n }\n\n if (typeof changes.isLoading !== 'undefined') {\n this.isLoading = changes.isLoading;\n }\n }\n\n remove(): void {\n this.isRemoving = true;\n\n if (this.timer) {\n this.timer.clear();\n }\n }\n}\n","/* eslint-disable ember/no-runloop */\nimport Notification from './notification';\nimport Timer from './timer';\nimport { tracked } from '@glimmer/tracking';\nimport { assert } from '@ember/debug';\nimport { getConfigOption } from './get-config';\nimport { getOwner } from '@ember/owner';\nimport { isDestroyed } from '@ember/destroyable';\nimport { later } from '@ember/runloop';\nimport type Owner from '@ember/owner';\nimport type {\n DefaultConfig,\n NotificationOptions,\n NotificationContent,\n NotificationStatus,\n PromiseMessage,\n PromiseNotificationOptions\n} from './types';\n\nfunction resolveMessage<T>(\n message: PromiseMessage<T>,\n value: T\n): NotificationContent {\n const resolved = typeof message === 'function' ? message(value) : message;\n return typeof resolved === 'string' ? { title: resolved } : resolved;\n}\n\n/**\n * Whether a notification should get an auto-removal timer, given its own\n * `preserve` option and the manager's config. An explicit `preserve` wins;\n * otherwise the config's `preserve` default applies. Either way, a\n * config-level `skipTimer: true` forces preservation — there's no timer to\n * skip if the notification is never auto-removed in the first place.\n *\n * Shared by `add()` and `promise()`'s settle path, which must apply this\n * decision identically.\n */\nfunction shouldAutoRemove(\n config: DefaultConfig,\n preserveOption: boolean | undefined\n): boolean {\n const preserve =\n typeof preserveOption === 'undefined'\n ? getConfigOption(config, 'preserve', false)\n : preserveOption;\n\n if (getConfigOption(config, 'skipTimer', false) === true) {\n return false;\n }\n\n return preserve === false;\n}\n\nexport default class NotificationsManager {\n @tracked notifications: Notification<Record<string, unknown>>[] = [];\n\n config: DefaultConfig = {};\n onRemove?: (notification: Notification<Record<string, unknown>>) => void;\n\n constructor(\n context: object,\n onRemove?: (notification: Notification<Record<string, unknown>>) => void\n ) {\n if (isDestroyed(context)) {\n return;\n }\n const owner = getOwner(context) as Owner;\n assert('NotificationsManager context must have an owner', owner);\n const configFactory = owner.factoryFor('config:environment');\n\n if (configFactory && configFactory.class) {\n this.config =\n (configFactory.class as never)['@frontile/notifications'] || {};\n }\n\n this.onRemove = onRemove;\n }\n\n add<TMetadata extends Record<string, unknown> = Record<string, unknown>>(\n content: string | NotificationContent,\n options: NotificationOptions<TMetadata> = {}\n ): Notification<TMetadata> {\n const notification = new Notification<TMetadata>(\n this.config,\n content,\n options\n );\n this.notifications = [...this.notifications, notification];\n\n if (shouldAutoRemove(this.config, options.preserve)) {\n this.setupAutoRemoval(notification, notification.duration);\n }\n return notification;\n }\n\n /**\n * Show a notification driven by a promise: a spinner while pending, then\n * the same notification mutated in place once it settles.\n *\n * Returns the original promise, so callers can still await it — and are\n * still responsible for handling its rejection.\n */\n promise<\n T,\n TMetadata extends Record<string, unknown> = Record<string, unknown>\n >(\n promise: Promise<T>,\n options: PromiseNotificationOptions<T, TMetadata>\n ): Promise<T> {\n const { loading, success, error, ...rest } = options;\n\n const notification = this.add<TMetadata>(loading, {\n ...(rest as NotificationOptions<TMetadata>),\n preserve: true,\n allowClosing: false,\n isLoading: true\n });\n\n const settle = (\n content: NotificationContent,\n status: NotificationStatus\n ) => {\n // The user may have dismissed the toast before the promise settled; in\n // that case there is nothing left to update.\n if (notification.isRemoving) {\n return;\n }\n\n notification.update({\n ...content,\n // `update()` treats an absent key as \"leave this field alone\" (that\n // distinction is load-bearing elsewhere), so a settle message with\n // no description must still pass an explicit empty string here —\n // otherwise `resolveMessage`'s string-form `{ title }` (no\n // `description` key at all) would leave the loading phase's stale\n // description on screen instead of clearing it.\n description: content.description ?? '',\n status,\n allowClosing: true,\n isLoading: false\n });\n\n // `preserve: true` forces the loading phase to skip auto-dismissal\n // (there's nothing useful to time out on a spinner), but the docs\n // promise every option except `isLoading` carries through to the\n // settled notification — so a caller's own `preserve` must still be\n // honored here, not silently overridden by the loading phase's.\n if (shouldAutoRemove(this.config, rest.preserve)) {\n this.setupAutoRemoval(notification, notification.duration);\n }\n };\n\n promise.then(\n (value) => settle(resolveMessage(success, value), 'success'),\n (reason) => settle(resolveMessage(error, reason), 'danger')\n );\n\n return promise;\n }\n\n remove(notification?: Notification<Record<string, unknown>>): void {\n // Removal is single-shot: a notification already on its way out must not\n // schedule a second removal, otherwise `onRemove` is called twice for it.\n if (!notification || notification.isRemoving) {\n return;\n }\n\n notification.remove();\n\n // The unmount is timed to `transitionDuration` (default 200ms), which\n // governs the card's exit *opacity* fade. The exit *slide/scale*\n // transform, however, runs at a fixed 400ms (see notificationCard's\n // theme slots) independent of `transitionDuration`. At the defaults this\n // is invisible only because the opacity reaches 0 at the same moment the\n // card unmounts, hiding the fact that the slide is truncated mid-flight.\n // If the opacity duration is ever decoupled from this unmount timer (or\n // `transitionDuration` is changed without also revisiting the transform\n // duration), cards will visibly disappear mid-slide instead of fading\n // out cleanly. Keep the two in sync, or make the unmount wait for the\n // longer of the two durations.\n later(\n this,\n () => {\n this.notifications = this.notifications.filter((n) => {\n return n !== notification;\n });\n\n // Call the onRemove callback after the notification is actually removed\n if (this.onRemove) {\n this.onRemove(notification);\n }\n },\n notification.transitionDuration\n );\n }\n\n removeAll(): void {\n this.notifications.forEach((notification) => {\n this.remove(notification);\n });\n }\n\n private setupAutoRemoval(\n notification: Notification<Record<string, unknown>>,\n duration: number\n ): void {\n notification.timer = new Timer(duration, () => {\n this.remove(notification);\n });\n }\n}\n"],"names":["Timer","g","prototype","tracked","i","onFinish","timer","start","constructor","duration","remaining","setup","clear","isRunning","cancel","n","action","pause","Math","max","Date","now","resume","later","getConfigOption","config","key","defaultValue","value","get","undefined","toContent","content","title","mapAppearance","appearance","deprecate","id","until","for","since","available","enabled","resolveStatus","options","status","Notification","transitionDuration","hideIcon","metadata","description","message","isLoading","customActions","allowClosing","update","changes","remove","isRemoving","resolveMessage","resolved","shouldAutoRemove","preserveOption","preserve","NotificationsManager","onRemove","context","isDestroyed","owner","getOwner","assert","configFactory","factoryFor","class","add","notification","notifications","setupAutoRemoval","promise","loading","success","error","rest","settle","then","reason","filter","removeAll","forEach"],"mappings":";;;;;;;;AAAA;AAMe,MAAMA,KAAK,CAAC;AAAA,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,WAAA,EAAA,CACxBC,OAAO,CAAA,CAAA;AAAA;EAAA,UAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,WAAA,CAAA,EAAA,MAAA;AAAA,EAAA;IAAAH,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,WAAA,EAAA,CACPC,OAAO,CAAA,EAAA,YAAA;AAAA,MAAA,OAAa,IAAI;AAAA,IAAA,CAAA,CAAA;AAAA;EAAA,UAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,WAAA,CAAA,EAAA,MAAA;EAEhBC,QAAQ;EACTC,KAAK;EACLC,KAAK;AAEbC,EAAAA,WAAWA,CAACC,QAAgB,EAAEJ,QAAoB,EAAE;IAClD,IAAI,CAACK,SAAS,GAAGD,QAAQ;IACzB,IAAI,CAACJ,QAAQ,GAAGA,QAAQ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AAE;;AAErB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACAlC,KAAK,CACH,IAAI,EACJ,MAAM;MACJ,IAAI,CAACqD,aAAa,GAAG,IAAI,CAACA,aAAa,CAACU,MAAM,CAAEvE,CAAC,IAAK;QACpD,OAAOA,CAAC,KAAK4D,YAAY;AAC3B,MAAA,CAAC,CAAC;;AAEF;MACA,IAAI,IAAI,CAACV,QAAQ,EAAE;AACjB,QAAA,IAAI,CAACA,QAAQ,CAACU,YAAY,CAAC;AAC7B,MAAA;AACF,IAAA,CAAC,EACDA,YAAY,CAAC5B,kBACf,CAAC;AACH,EAAA;AAEAwC,EAAAA,SAASA,GAAS;AAChB,IAAA,IAAI,CAACX,aAAa,CAACY,OAAO,CAAEb,YAAY,IAAK;AAC3C,MAAA,IAAI,CAAClB,MAAM,CAACkB,YAAY,CAAC;AAC3B,IAAA,CAAC,CAAC;AACJ,EAAA;AAEQE,EAAAA,gBAAgBA,CACtBF,YAAmD,EACnDlE,QAAgB,EACV;IACNkE,YAAY,CAACrE,KAAK,GAAG,IAAIN,KAAK,CAACS,QAAQ,EAAE,MAAM;AAC7C,MAAA,IAAI,CAACgD,MAAM,CAACkB,YAAY,CAAC;AAC3B,IAAA,CAAC,CAAC;AACJ,EAAA;AACF;;;;"}
|
|
@@ -125,36 +125,39 @@ class NotificationStack {
|
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
const
|
|
129
|
-
|
|
128
|
+
const STATUS_CONFIG = {
|
|
129
|
+
neutral: {
|
|
130
130
|
icon: IconInfo,
|
|
131
|
-
// Button
|
|
132
|
-
// loading <Spinner>'s `@
|
|
133
|
-
//
|
|
131
|
+
// Button colour for the primary custom action. Also reused as the
|
|
132
|
+
// loading <Spinner>'s `@color` (its colour union has the same
|
|
133
|
+
// neutral/primary/success/warning/danger shape), so the spinner's arc
|
|
134
134
|
// matches the same accent the card's custom action button would use.
|
|
135
|
-
|
|
135
|
+
actionColor: 'neutral',
|
|
136
136
|
// `alert` interrupts a screen reader, so it is reserved for the
|
|
137
|
-
//
|
|
137
|
+
// statuses that warrant interrupting. This coupling is why the prop is
|
|
138
|
+
// `@status` and not `@color`.
|
|
138
139
|
role: 'status'
|
|
139
140
|
},
|
|
140
|
-
info
|
|
141
|
+
// Formerly `info`, which already painted `primary`'s classes. The info
|
|
142
|
+
// glyph stays attached to `primary`.
|
|
143
|
+
primary: {
|
|
141
144
|
icon: IconInfo,
|
|
142
|
-
|
|
145
|
+
actionColor: 'primary',
|
|
143
146
|
role: 'status'
|
|
144
147
|
},
|
|
145
148
|
success: {
|
|
146
149
|
icon: IconSuccess,
|
|
147
|
-
|
|
150
|
+
actionColor: 'success',
|
|
148
151
|
role: 'status'
|
|
149
152
|
},
|
|
150
153
|
warning: {
|
|
151
154
|
icon: IconWarning,
|
|
152
|
-
|
|
155
|
+
actionColor: 'warning',
|
|
153
156
|
role: 'alert'
|
|
154
157
|
},
|
|
155
158
|
danger: {
|
|
156
159
|
icon: IconDanger,
|
|
157
|
-
|
|
160
|
+
actionColor: 'danger',
|
|
158
161
|
role: 'alert'
|
|
159
162
|
}
|
|
160
163
|
};
|
|
@@ -176,17 +179,17 @@ class NotificationCard extends Component {
|
|
|
176
179
|
get isTopPlacement() {
|
|
177
180
|
return isTopPlacement(this.args.placement || 'bottom-right');
|
|
178
181
|
}
|
|
179
|
-
get
|
|
180
|
-
return this.args.notification.
|
|
182
|
+
get status() {
|
|
183
|
+
return this.args.notification.status;
|
|
181
184
|
}
|
|
182
185
|
get icon() {
|
|
183
|
-
return
|
|
186
|
+
return STATUS_CONFIG[this.status].icon;
|
|
184
187
|
}
|
|
185
|
-
get
|
|
186
|
-
return
|
|
188
|
+
get actionColor() {
|
|
189
|
+
return STATUS_CONFIG[this.status].actionColor;
|
|
187
190
|
}
|
|
188
191
|
get role() {
|
|
189
|
-
return
|
|
192
|
+
return STATUS_CONFIG[this.status].role;
|
|
190
193
|
}
|
|
191
194
|
get style() {
|
|
192
195
|
const {
|
|
@@ -292,8 +295,8 @@ class NotificationCard extends Component {
|
|
|
292
295
|
customActionButton,
|
|
293
296
|
closeButton
|
|
294
297
|
} = notificationCard({
|
|
295
|
-
|
|
296
|
-
variant: this.args.variant || '
|
|
298
|
+
status: this.status,
|
|
299
|
+
variant: this.args.variant || 'surface',
|
|
297
300
|
hasDescription: !!this.args.notification.description,
|
|
298
301
|
// Only pin the card to the placement edge once the container has
|
|
299
302
|
// supplied stack geometry — see the `stackPlacement` variant's
|
|
@@ -314,7 +317,7 @@ class NotificationCard extends Component {
|
|
|
314
317
|
};
|
|
315
318
|
}
|
|
316
319
|
static {
|
|
317
|
-
setComponentTemplate(precompileTemplate("{{!-- template-lint-disable no-inline-styles style-concatenation --}}\n<div class={{this.classes.base}} style={{this.style}} role={{this.role}} data-test-notification-card data-test-
|
|
320
|
+
setComponentTemplate(precompileTemplate("{{!-- template-lint-disable no-inline-styles style-concatenation --}}\n<div data-component=\"notification-card\" data-part=\"base\" class={{this.classes.base}} style={{this.style}} role={{this.role}} data-test-notification-card data-test-status={{this.status}} {{this.enter}} ...attributes>\n {{!-- measure reads offsetHeight off this inner element, not the outer one above, since the outer carries the collapsed-stack height clamp. See notification-stack.ts. --}}\n <div data-part=\"inner\" class={{this.classes.inner}} {{this.measure}}>\n {{#unless @notification.hideIcon}}\n {{#if @notification.isLoading}}\n <Spinner data-part=\"spinner\" @class={{this.classes.spinner}} @color={{this.actionColor}} @size=\"sm\" data-test-icon=\"loading\" />\n {{else}}\n {{#let this.icon as |Icon|}}\n <Icon data-part=\"icon\" class={{this.classes.icon}} />\n {{/let}}\n {{/if}}\n {{/unless}}\n\n <div data-part=\"content\" class={{this.classes.content}}>\n <div data-part=\"title\" class={{this.classes.title}}>{{@notification.title}}</div>\n\n {{#if @notification.description}}\n <div data-part=\"description\" class={{this.classes.description}}>\n {{@notification.description}}\n </div>\n {{/if}}\n </div>\n\n {{#if @notification.customActions}}\n <div data-part=\"custom-actions\" class={{this.classes.customActions}}>\n {{#each @notification.customActions as |customAction index|}}\n <Button data-part=\"custom-action-button\" @size=\"xs\" @color={{if index \"neutral\" this.actionColor}} @variant={{if index \"plain\" \"solid\"}} @class={{this.classes.customActionButton}} @onPress={{fn this.handleClickCustomAction customAction}}>\n {{customAction.label}}\n </Button>\n {{/each}}\n </div>\n {{/if}}\n\n {{#if @notification.allowClosing}}\n <CloseButton data-part=\"close-button\" @onPress={{this.remove}} @size=\"sm\" @class={{this.classes.closeButton}} />\n {{/if}}\n </div>\n</div>", {
|
|
318
321
|
strictMode: true,
|
|
319
322
|
scope: () => ({
|
|
320
323
|
Spinner,
|
|
@@ -327,4 +330,4 @@ class NotificationCard extends Component {
|
|
|
327
330
|
}
|
|
328
331
|
|
|
329
332
|
export { NotificationCard as N, NotificationStack as a };
|
|
330
|
-
//# sourceMappingURL=notification-card-
|
|
333
|
+
//# sourceMappingURL=notification-card-CYmWQ35W.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification-card-CYmWQ35W.js","sources":["../src/-private/notification-stack.ts","../src/components/notifications/notification-card.gts"],"sourcesContent":["import type { containerPlacement } from './types';\n\n/**\n * How much each card behind the front of the stack shrinks, as a fraction.\n */\nconst SCALE_STEP = 0.05;\n\n/**\n * Cards are pinned to the placement edge, so a top placement stacks\n * downwards and a bottom placement stacks upwards. Exported so\n * notification-card.gts's own enter/exit slide direction can share this\n * instead of re-deriving it from the placement string.\n */\nfunction isTopPlacement(placement: containerPlacement): boolean {\n return placement.startsWith('top');\n}\n\ninterface NotificationStackInput {\n /**\n * Measured card heights in px, ordered front-first (index 0 is the newest\n * notification). A card that has not been measured yet contributes 0.\n */\n heights: number[];\n\n isExpanded: boolean;\n\n /**\n * Peek offset between collapsed cards, and the gap between expanded cards.\n */\n gap: number;\n\n /**\n * How many cards stay visible while collapsed.\n */\n visibleToasts: number;\n\n placement: containerPlacement;\n}\n\ninterface CardGeometry {\n transform: string;\n zIndex: number;\n opacity: number;\n\n /**\n * Fixed height in px while collapsed, so a taller card behind the front one\n * cannot stick out past it. `null` means the card sizes to its content.\n */\n height: number | null;\n\n transformOrigin: 'top center' | 'bottom center';\n\n /**\n * `'none'` when the card is fully transparent (collapsed beyond\n * `visibleToasts`), so it cannot swallow clicks meant for the page beneath\n * it; `'auto'` otherwise.\n */\n pointerEvents: 'auto' | 'none';\n}\n\n/**\n * Pure geometry for the notification stack: given measured card heights and\n * the current expansion state, it produces the transform for each card and\n * the height the container should animate to.\n *\n * Deliberately free of Ember and DOM dependencies so the layout maths can be\n * tested on its own.\n */\nclass NotificationStack {\n readonly heights: number[];\n readonly isExpanded: boolean;\n readonly gap: number;\n readonly visibleToasts: number;\n readonly placement: containerPlacement;\n\n constructor(input: NotificationStackInput) {\n this.heights = input.heights;\n this.isExpanded = input.isExpanded;\n this.gap = input.gap;\n this.visibleToasts = input.visibleToasts;\n this.placement = input.placement;\n }\n\n get isTopPlacement(): boolean {\n return isTopPlacement(this.placement);\n }\n\n /**\n * Cards are pinned to the placement edge, so a top placement stacks\n * downwards and a bottom placement stacks upwards.\n */\n get directionSign(): number {\n return this.isTopPlacement ? 1 : -1;\n }\n\n get transformOrigin(): CardGeometry['transformOrigin'] {\n return this.isTopPlacement ? 'top center' : 'bottom center';\n }\n\n get count(): number {\n return this.heights.length;\n }\n\n get frontHeight(): number {\n return this.heights[0] ?? 0;\n }\n\n geometryFor(index: number): CardGeometry {\n const zIndex = this.count - index;\n\n if (this.isExpanded) {\n return {\n transform: `translateY(${this.directionSign * this.offsetBefore(index)}px) scale(1)`,\n zIndex,\n opacity: 1,\n height: null,\n transformOrigin: this.transformOrigin,\n pointerEvents: 'auto'\n };\n }\n\n const offset = index * this.gap;\n const scale = Math.max(0, 1 - index * SCALE_STEP);\n const isVisible = index < this.visibleToasts;\n\n return {\n transform: `translateY(${this.directionSign * offset}px) scale(${scale})`,\n zIndex,\n opacity: isVisible ? 1 : 0,\n // The front card must size to its own content (`null`). Clamping it to\n // `frontHeight` would be self-referential — `frontHeight` *is* the\n // front card's own measurement — and would permanently lock in\n // whatever height was measured first, before content (e.g. a long\n // description) finished laying out. Only cards behind the front one\n // need clamping, so a taller card further back can't poke out past it.\n height: index === 0 ? null : this.frontHeight,\n transformOrigin: this.transformOrigin,\n // A card past `visibleToasts` is fully transparent while collapsed;\n // without this it would still sit in the fixed-position stack and\n // swallow clicks meant for the page beneath it.\n pointerEvents: isVisible ? 'auto' : 'none'\n };\n }\n\n get containerHeight(): number {\n if (this.count === 0) {\n return 0;\n }\n\n if (this.isExpanded) {\n return this.offsetBefore(this.count) - this.gap;\n }\n\n const visible = Math.min(this.count, this.visibleToasts);\n return this.frontHeight + (visible - 1) * this.gap;\n }\n\n /**\n * Distance from the placement edge to the leading edge of `index`, i.e. the\n * summed heights and gaps of every card in front of it.\n */\n private offsetBefore(index: number): number {\n let offset = 0;\n\n for (let i = 0; i < index; i++) {\n offset += (this.heights[i] ?? 0) + this.gap;\n }\n\n return offset;\n }\n}\n\nexport { NotificationStack, isTopPlacement };\nexport type { NotificationStackInput, CardGeometry };\n","import Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { modifier } from 'ember-modifier';\nimport { service } from '@ember/service';\nimport { htmlSafe } from '@ember/template';\nimport { fn } from '@ember/helper';\nimport { CloseButton } from '../buttons/close-button';\nimport { Button } from '../buttons/button';\nimport { Spinner } from '../utilities/spinner';\nimport {\n IconInfo,\n IconSuccess,\n IconWarning,\n IconDanger\n} from '../../-private/intent-icons';\nimport { useStyles } from '@frontile/theme';\n\nimport type NotificationsService from '../../services/notifications';\nimport type Notification from '../../-private/notification';\nimport { isTopPlacement } from '../../-private/notification-stack';\nimport type { CardGeometry } from '../../-private/notification-stack';\nimport type {\n CustomAction,\n containerPlacement,\n NotificationStatus\n} from '../../-private/types';\nimport type { SafeString } from '@ember/template';\n\n/**\n * Everything that varies by `NotificationStatus`, keyed in one place so\n * adding a status means adding one row here instead of remembering to\n * touch an icon map, an action-colour map, and the `role` getter's cascade\n * separately.\n */\nconst STATUS_CONFIG = {\n neutral: {\n icon: IconInfo,\n // Button colour for the primary custom action. Also reused as the\n // loading <Spinner>'s `@color` (its colour union has the same\n // neutral/primary/success/warning/danger shape), so the spinner's arc\n // matches the same accent the card's custom action button would use.\n actionColor: 'neutral',\n // `alert` interrupts a screen reader, so it is reserved for the\n // statuses that warrant interrupting. This coupling is why the prop is\n // `@status` and not `@color`.\n role: 'status'\n },\n // Formerly `info`, which already painted `primary`'s classes. The info\n // glyph stays attached to `primary`.\n primary: {\n icon: IconInfo,\n actionColor: 'primary',\n role: 'status'\n },\n success: {\n icon: IconSuccess,\n actionColor: 'success',\n role: 'status'\n },\n warning: {\n icon: IconWarning,\n actionColor: 'warning',\n role: 'alert'\n },\n danger: {\n icon: IconDanger,\n actionColor: 'danger',\n role: 'alert'\n }\n} as const satisfies Record<\n NotificationStatus,\n {\n icon: unknown;\n actionColor: 'neutral' | 'primary' | 'success' | 'warning' | 'danger';\n role: 'status' | 'alert';\n }\n>;\n\ninterface NotificationCardSignature {\n Args: {\n notification: Notification<Record<string, unknown>>;\n placement: containerPlacement;\n\n /**\n * The visual style of the card.\n *\n * @defaultValue 'surface'\n */\n variant?: 'surface' | 'soft' | 'solid';\n\n /**\n * Position, scale, and stacking supplied by the container. When omitted\n * the card renders in place with no stack transform.\n *\n * Part of the container/card plumbing, not a consumer-facing argument.\n *\n * @internal\n */\n geometry?: CardGeometry;\n\n /**\n * Called with the card's measured height whenever it changes.\n *\n * Part of the container/card plumbing, not a consumer-facing argument.\n *\n * @internal\n */\n onMeasure?: (height: number) => void;\n };\n Element: HTMLDivElement;\n}\n\nclass NotificationCard extends Component<NotificationCardSignature> {\n @service notifications!: NotificationsService;\n\n /**\n * False for the first frame so the card can transition in from the\n * placement edge rather than appearing at its resting position.\n */\n @tracked hasEntered = false;\n\n get isTopPlacement(): boolean {\n return isTopPlacement(this.args.placement || 'bottom-right');\n }\n\n get status(): NotificationStatus {\n return this.args.notification.status;\n }\n\n get icon() {\n return STATUS_CONFIG[this.status].icon;\n }\n\n get actionColor() {\n return STATUS_CONFIG[this.status].actionColor;\n }\n\n get role(): 'status' | 'alert' {\n return STATUS_CONFIG[this.status].role;\n }\n\n get style(): SafeString {\n const { geometry, notification } = this.args;\n // The theme owns the whole `transition-duration` shorthand (and its\n // `motion-reduce:` override) so the per-property duration order can\n // never drift out of sync with `transition-[transform,opacity,height]`\n // across the component boundary — see notification-card.ts. This card\n // only supplies the one value `@transitionDuration` actually governs\n // (the enter/exit fade), as a custom property the theme's `var()` reads.\n const declarations = [\n `--frontile-toast-fade: ${notification.transitionDuration}ms`\n ];\n\n // The static edge-pinning (`position: absolute` + `left/right/top` or\n // `bottom`) lives in the `stackPlacement` theme variant (see\n // `this.classes`) rather than here, since it never varies frame to\n // frame — only the geometry-driven parts below (transform, opacity,\n // height, z-index, transform-origin) need to be inline, because a\n // `style` attribute passed through `...attributes` replaces the\n // element's own `style` outright and would drop them.\n\n if (!this.hasEntered || notification.isRemoving) {\n // Enter from, and exit to, the placement edge.\n const offset = this.isTopPlacement ? '-100%' : '100%';\n declarations.push(\n `opacity: 0`,\n `transform: translateY(${offset}) scale(0.95)`,\n // A card can be transparent-and-collapsed the instant it starts\n // exiting; keep it out of the click path either way.\n `pointer-events: none`\n );\n\n if (geometry) {\n declarations.push(\n `z-index: ${geometry.zIndex}`,\n `transform-origin: ${geometry.transformOrigin}`,\n // Preserve the collapsed height clamp through the exit\n // transition — otherwise a non-front collapsed card snaps from\n // its clamped height to `auto` for the slide-out.\n geometry.height === null\n ? `height: auto`\n : `height: ${geometry.height}px`\n );\n }\n\n return htmlSafe(declarations.join('; '));\n }\n\n if (geometry) {\n declarations.push(\n `transform: ${geometry.transform}`,\n `transform-origin: ${geometry.transformOrigin}`,\n `z-index: ${geometry.zIndex}`,\n `opacity: ${geometry.opacity}`,\n `pointer-events: ${geometry.pointerEvents}`,\n geometry.height === null\n ? `height: auto`\n : `height: ${geometry.height}px`\n );\n }\n\n return htmlSafe(declarations.join('; '));\n }\n\n /**\n * Flip to the resting position on the frame after insertion, so the browser\n * has a start value to transition from.\n */\n enter = modifier(() => {\n const frame = requestAnimationFrame(() => {\n this.hasEntered = true;\n });\n\n return () => cancelAnimationFrame(frame);\n });\n\n /**\n * Report the card's height to the container so the stack can lay itself\n * out. Also fires when promise content swaps change the height.\n *\n * `element` is the inner element (never height-constrained, so its\n * `offsetHeight` is always the content's true natural height). The border\n * lives on the outer element (`element.parentElement`), so it isn't part\n * of that number — we add it back via `outer.offsetHeight -\n * outer.clientHeight`, the outer element's vertical border width. That\n * difference is constant whether or not the outer element's height is\n * currently clamped by the collapsed-stack height, so it's safe to read\n * off the outer element even while it's clamped, and it stays correct if\n * the theme's border width ever changes.\n */\n measure = modifier((element: HTMLElement) => {\n const { onMeasure } = this.args;\n\n if (!onMeasure) {\n return;\n }\n\n const outer = element.parentElement as HTMLElement;\n\n const report = () => {\n const outerBorder = outer.offsetHeight - outer.clientHeight;\n onMeasure(element.offsetHeight + outerBorder);\n };\n\n const observer = new ResizeObserver(report);\n\n report();\n observer.observe(element);\n\n return () => observer.disconnect();\n });\n\n remove = () => {\n this.notifications.remove(this.args.notification);\n };\n\n handleClickCustomAction = (customAction: CustomAction) => {\n customAction.onClick();\n this.notifications.remove(this.args.notification);\n };\n\n get classes() {\n const { notificationCard } = useStyles();\n\n const {\n base,\n inner,\n icon,\n spinner,\n content,\n title,\n description,\n customActions,\n customActionButton,\n closeButton\n } = notificationCard({\n status: this.status,\n variant: this.args.variant || 'surface',\n hasDescription: !!this.args.notification.description,\n // Only pin the card to the placement edge once the container has\n // supplied stack geometry — see the `stackPlacement` variant's\n // comment in the theme.\n stackPlacement: this.args.geometry\n ? this.isTopPlacement\n ? 'top'\n : 'bottom'\n : 'none'\n });\n\n return {\n base: base(),\n inner: inner(),\n icon: icon(),\n spinner: spinner(),\n content: content(),\n title: title(),\n description: description(),\n customActions: customActions(),\n customActionButton: customActionButton(),\n closeButton: closeButton()\n };\n }\n\n <template>\n {{! template-lint-disable no-inline-styles style-concatenation }}\n <div\n data-component=\"notification-card\"\n data-part=\"base\"\n class={{this.classes.base}}\n style={{this.style}}\n role={{this.role}}\n data-test-notification-card\n data-test-status={{this.status}}\n {{this.enter}}\n ...attributes\n >\n {{! measure reads offsetHeight off this inner element, not the outer one above, since the outer carries the collapsed-stack height clamp. See notification-stack.ts. }}\n <div data-part=\"inner\" class={{this.classes.inner}} {{this.measure}}>\n {{#unless @notification.hideIcon}}\n {{#if @notification.isLoading}}\n <Spinner\n data-part=\"spinner\"\n @class={{this.classes.spinner}}\n @color={{this.actionColor}}\n @size=\"sm\"\n data-test-icon=\"loading\"\n />\n {{else}}\n {{#let this.icon as |Icon|}}\n <Icon data-part=\"icon\" class={{this.classes.icon}} />\n {{/let}}\n {{/if}}\n {{/unless}}\n\n <div data-part=\"content\" class={{this.classes.content}}>\n <div\n data-part=\"title\"\n class={{this.classes.title}}\n >{{@notification.title}}</div>\n\n {{#if @notification.description}}\n <div data-part=\"description\" class={{this.classes.description}}>\n {{@notification.description}}\n </div>\n {{/if}}\n </div>\n\n {{#if @notification.customActions}}\n <div data-part=\"custom-actions\" class={{this.classes.customActions}}>\n {{#each @notification.customActions as |customAction index|}}\n <Button\n data-part=\"custom-action-button\"\n @size=\"xs\"\n @color={{if index \"neutral\" this.actionColor}}\n @variant={{if index \"plain\" \"solid\"}}\n @class={{this.classes.customActionButton}}\n @onPress={{fn this.handleClickCustomAction customAction}}\n >\n {{customAction.label}}\n </Button>\n {{/each}}\n </div>\n {{/if}}\n\n {{#if @notification.allowClosing}}\n <CloseButton\n data-part=\"close-button\"\n @onPress={{this.remove}}\n @size=\"sm\"\n @class={{this.classes.closeButton}}\n />\n {{/if}}\n </div>\n </div>\n </template>\n}\n\nexport { NotificationCard, type NotificationCardSignature };\nexport default NotificationCard;\n"],"names":["SCALE_STEP","isTopPlacement","placement","startsWith","NotificationStack","heights","isExpanded","gap","visibleToasts","constructor","input","directionSign","transformOrigin","count","length","frontHeight","geometryFor","index","zIndex","transform","offsetBefore","opacity","height","pointerEvents","offset","scale","Math","max","isVisible","containerHeight","visible","min","i","STATUS_CONFIG","neutral","icon","IconInfo","actionColor","role","primary","success","IconSuccess","warning","IconWarning","danger","IconDanger","NotificationCard","Component","g","prototype","service","tracked","args","status","notification","style","geometry","declarations","transitionDuration","hasEntered","isRemoving","push","htmlSafe","join","enter","modifier","frame","requestAnimationFrame","cancelAnimationFrame","measure","element","onMeasure","outer","parentElement","report","outerBorder","offsetHeight","clientHeight","observer","ResizeObserver","observe","disconnect","remove","notifications","handleClickCustomAction","customAction","onClick","classes","notificationCard","useStyles","base","inner","spinner","content","title","description","customActions","customActionButton","closeButton","variant","hasDescription","stackPlacement","setComponentTemplate","precompileTemplate","strictMode","scope","Spinner","Button","fn","CloseButton"],"mappings":";;;;;;;;;;;;;;;AAEA;AACA;AACA;AACA,MAAMA,UAAU,GAAG,IAAI;;AAEvB;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,cAAcA,CAACC,SAA6B,EAAW;AAC9D,EAAA,OAAOA,SAAS,CAACC,UAAU,CAAC,KAAK,CAAC;AACpC;AA6CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,iBAAiB,CAAC;EACbC,OAAO;EACPC,UAAU;EACVC,GAAG;EACHC,aAAa;EACbN,SAAS;EAElBO,WAAWA,CAACC,KAA6B,EAAE;AACzC,IAAA,IAAI,CAACL,OAAO,GAAGK,KAAK,CAACL,OAAO;AAC5B,IAAA,IAAI,CAACC,UAAU,GAAGI,KAAK,CAACJ,UAAU;AAClC,IAAA,IAAI,CAACC,GAAG,GAAGG,KAAK,CAACH,GAAG;AACpB,IAAA,IAAI,CAACC,aAAa,GAAGE,KAAK,CAACF,aAAa;AACxC,IAAA,IAAI,CAACN,SAAS,GAAGQ,KAAK,CAACR,SAAS;AAClC,EAAA;EAEA,IAAID,cAAcA,GAAY;AAC5B,IAAA,OAAOA,cAAc,CAAC,IA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C,WAAA,EAAaA,WAAA,EAAA;MACbC,aAAA,EAAeA,aAAA,EAAA;MACfC,kBAAA,EAAoBA,kBAAA,EAAA;MACpBC,WAAA,EAAaA,WAAA;KACf;AACF,EAAA;AAEA,EAAA;IAAAI,oBAAA,CAAAC,kBAAA,CAAA,ggEAAA,EAuEA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,OAAA;QAAAC,MAAA;QAAAC,EAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
package/dist/notifications.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { N as Notification, T as Timer } from './manager-
|
|
1
|
+
export { N as Notification, T as Timer } from './manager-B-PnYqDs.js';
|
|
2
2
|
import '@ember/service';
|
|
3
|
-
export { N as NotificationCard, a as NotificationStack } from './notification-card-
|
|
3
|
+
export { N as NotificationCard, a as NotificationStack } from './notification-card-CYmWQ35W.js';
|
|
4
4
|
export { NotificationsContainer } from './components/notifications/notifications-container.js';
|
|
5
5
|
//# sourceMappingURL=notifications.js.map
|
package/dist/test-support.js
CHANGED
|
@@ -1295,7 +1295,13 @@ function changeOption(functionName, selectSelector, key, toggle) {
|
|
|
1295
1295
|
}
|
|
1296
1296
|
let select = container;
|
|
1297
1297
|
if (container.tagName !== 'SELECT') {
|
|
1298
|
-
|
|
1298
|
+
// `data-component="native-select"` lives on FormControl's root element,
|
|
1299
|
+
// not the `<select>` itself (the anatomy contract puts `data-component`
|
|
1300
|
+
// only on a component's outermost element, and the `<select>` is a
|
|
1301
|
+
// *part* of `native-select`, not its root). `data-test-id="native-select"`
|
|
1302
|
+
// stays directly on the `<select>` tag, so it is the stable way to reach
|
|
1303
|
+
// it from an arbitrary ancestor container.
|
|
1304
|
+
select = container.querySelector('[data-test-id="native-select"]');
|
|
1299
1305
|
}
|
|
1300
1306
|
if (!select) {
|
|
1301
1307
|
throw new Error(`You called "${functionName}('${selectSelector}', '${key}')" but no select was found inside container using selector "${selectSelector}"`);
|
|
@@ -1312,5 +1318,37 @@ function changeOption(functionName, selectSelector, key, toggle) {
|
|
|
1312
1318
|
return triggerEvent(select, 'change');
|
|
1313
1319
|
}
|
|
1314
1320
|
|
|
1315
|
-
|
|
1321
|
+
/**
|
|
1322
|
+
* Selects the elements bearing `[data-part="${part}"]` whose *own* anatomy
|
|
1323
|
+
* root is `root` — i.e. `root` is the nearest `[data-component]` ancestor.
|
|
1324
|
+
*
|
|
1325
|
+
* `[data-component="X"] [data-part="Y"]` (plain CSS descendant combinator)
|
|
1326
|
+
* matches "any descendant", which is ambiguous whenever a component with a
|
|
1327
|
+
* part named `Y` renders a nested component that also has an element
|
|
1328
|
+
* carrying `data-part="Y"` (its own part, or a caller-supplied one on the
|
|
1329
|
+
* nested component's root). CSS has no "nearest enclosing" combinator, so
|
|
1330
|
+
* this helper resolves ownership the same way behavioural code would have
|
|
1331
|
+
* to: walk up from the part element and confirm the nearest
|
|
1332
|
+
* `[data-component]` ancestor is `root`.
|
|
1333
|
+
*
|
|
1334
|
+
* The walk starts at `el.parentElement`, not `el` itself, deliberately:
|
|
1335
|
+
* `el` may itself be a nested component's root (e.g. `CloseButton`, which
|
|
1336
|
+
* carries its own `data-component="close-button"` on the very element that
|
|
1337
|
+
* also carries a caller-supplied `data-part="clear-button"` or
|
|
1338
|
+
* `data-part="close-button"`). Starting `closest()`/the walk from `el`
|
|
1339
|
+
* would match `el` itself and never reach `root`, wrongly excluding a part
|
|
1340
|
+
* that legitimately belongs to `root`.
|
|
1341
|
+
*/
|
|
1342
|
+
function ownParts(root, part) {
|
|
1343
|
+
return [...root.querySelectorAll(`[data-part="${part}"]`)].filter(el => {
|
|
1344
|
+
let node = el.parentElement;
|
|
1345
|
+
while (node && node !== root) {
|
|
1346
|
+
if (node.hasAttribute('data-component')) return false;
|
|
1347
|
+
node = node.parentElement;
|
|
1348
|
+
}
|
|
1349
|
+
return node === root;
|
|
1350
|
+
});
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
export { ownParts, selectOptionByKey, toggleOptionByKey };
|
|
1316
1354
|
//# sourceMappingURL=test-support.js.map
|