init component

This commit is contained in:
Robin COuret
2026-02-16 17:28:37 +01:00
parent 460c7a25e0
commit e0e50af706
4557 changed files with 666911 additions and 8 deletions

View File

@@ -0,0 +1,215 @@
import '../../../sass/helpers/animations.sass';
import '../sass/notices.sass';
import { FunctionN } from 'fp-ts/lib/function';
import { IO } from 'fp-ts/lib/IO';
import { VNode, PropType, ExtractPropTypes, ComponentOptions, FunctionalComponent } from 'vue';
export declare const BNotificationPropsDefinition: {
isNotice: {
type: PropType<boolean>;
default: boolean;
};
icon: {
type: PropType<FunctionalComponent<{}, {}> | ComponentOptions<{}, any, any, any, any, any, any, any>>;
};
transition: {
type: PropType<import("../../..").Transition>;
required: boolean;
};
position: {
type: PropType<import("../../..").PositionVariant>;
default: "is-bottom";
};
duration: {
type: PropType<number>;
default: number;
};
message: {
type: PropType<string>;
};
shouldQueue: {
type: PropType<boolean>;
default: boolean;
};
variant: {
type: PropType<import("../../..").ColorVariant>;
default: "";
};
isIndefinite: {
type: PropType<boolean>;
default: boolean;
};
title: {
type: PropType<string>;
};
isClosable: {
type: BooleanConstructor;
default: boolean;
};
size: {
type: PropType<import("../../..").SizeVariant>;
default: "";
};
iconSize: {
type: PropType<import("../../..").SizeVariant>;
default: "";
};
useAutoClose: {
type: PropType<boolean>;
default: boolean;
};
useIcon: {
type: PropType<boolean>;
default: boolean;
};
icons: {
type: PropType<Partial<import("../../../composables/message").MessageIcons>>;
default: import("fp-ts/lib/function").Lazy<Partial<import("../../../composables/message").MessageIcons>>;
};
onToggle: {
type: PropType<FunctionN<[boolean], void>>;
required: false;
};
onSetOn: {
type: PropType<IO<void>>;
required: false;
};
onSetOff: {
type: PropType<IO<void>>;
required: false;
};
isActive: {
type: PropType<boolean>;
default: boolean;
};
hasPopup: {
type: PropType<boolean>;
default: boolean;
};
};
export declare type BNotificationProps = ExtractPropTypes<typeof BNotificationPropsDefinition>;
declare const _default: import("vue").DefineComponent<{
isNotice: {
type: PropType<boolean>;
default: boolean;
};
icon: {
type: PropType<FunctionalComponent<{}, {}> | ComponentOptions<{}, any, any, any, any, any, any, any>>;
};
transition: {
type: PropType<import("../../..").Transition>;
required: boolean;
};
position: {
type: PropType<import("../../..").PositionVariant>;
default: "is-bottom";
};
duration: {
type: PropType<number>;
default: number;
};
message: {
type: PropType<string>;
};
shouldQueue: {
type: PropType<boolean>;
default: boolean;
};
variant: {
type: PropType<import("../../..").ColorVariant>;
default: "";
};
isIndefinite: {
type: PropType<boolean>;
default: boolean;
};
title: {
type: PropType<string>;
};
isClosable: {
type: BooleanConstructor;
default: boolean;
};
size: {
type: PropType<import("../../..").SizeVariant>;
default: "";
};
iconSize: {
type: PropType<import("../../..").SizeVariant>;
default: "";
};
useAutoClose: {
type: PropType<boolean>;
default: boolean;
};
useIcon: {
type: PropType<boolean>;
default: boolean;
};
icons: {
type: PropType<Partial<import("../../../composables/message").MessageIcons>>;
default: import("fp-ts/lib/function").Lazy<Partial<import("../../../composables/message").MessageIcons>>;
};
onToggle: {
type: PropType<FunctionN<[boolean], void>>;
required: false;
};
onSetOn: {
type: PropType<IO<void>>;
required: false;
};
onSetOff: {
type: PropType<IO<void>>;
required: false;
};
isActive: {
type: PropType<boolean>;
default: boolean;
};
hasPopup: {
type: PropType<boolean>;
default: boolean;
};
}, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
[key: string]: any;
}> | VNode<import("vue").RendererNode, import("vue").RendererElement, {
[key: string]: any;
}>[] | undefined, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
hasPopup: boolean;
variant: import("../../..").ColorVariant;
size: import("../../..").SizeVariant;
icons: Partial<import("../../../composables/message").MessageIcons>;
duration: number;
position: import("../../..").PositionVariant;
shouldQueue: boolean;
isIndefinite: boolean;
isActive: boolean;
isClosable: boolean;
iconSize: import("../../..").SizeVariant;
useAutoClose: boolean;
useIcon: boolean;
isNotice: boolean;
} & {
onToggle?: FunctionN<[boolean], void> | undefined;
onSetOn?: IO<void> | undefined;
onSetOff?: IO<void> | undefined;
transition?: string | import("../../..").TransitionClasses | undefined;
icon?: FunctionalComponent<{}, {}> | ComponentOptions<{}, any, any, any, any, any, any, any> | undefined;
title?: string | undefined;
message?: string | undefined;
}>, {
hasPopup: boolean;
variant: import("../../..").ColorVariant;
size: import("../../..").SizeVariant;
icons: Partial<import("../../../composables/message").MessageIcons>;
duration: number;
position: import("../../..").PositionVariant;
shouldQueue: boolean;
isIndefinite: boolean;
isActive: boolean;
isClosable: boolean;
iconSize: import("../../..").SizeVariant;
useAutoClose: boolean;
useIcon: boolean;
isNotice: boolean;
}>;
export default _default;

View File

@@ -0,0 +1,73 @@
import "../../../../src/sass/helpers/animations.sass";
import "../../../../src/components/notices/sass/notices.sass";
import { constant } from 'fp-ts/lib/function';
import { useMessage, UseMessagePropsDefinition } from '../../../composables/message';
import { useNoticeController, UseNoticePropsDefinition } from '../../../composables/noticeController';
import { formatTransition } from '../../../composables/transition';
import { Transition, h, defineComponent, shallowRef, withDirectives, vShow } from 'vue';
import { constEmptyArray } from '../../../utils/helpers';
export const BNotificationPropsDefinition = { ...UseMessagePropsDefinition,
...UseNoticePropsDefinition,
isNotice: {
type: Boolean,
default: false
},
icon: {
type: [Object, Function]
}
};
function generateCloseButton(props, messageController, noticeController) {
return h('button', {
class: 'delete',
onClick: props.isNotice ? noticeController.close : messageController.setOff
});
}
function generateIcon(messageController) {
const icon = messageController.icon.value;
return icon ? h('div', {
class: 'media-left'
}, [h(icon, {
size: messageController.iconSize.value
})]) : undefined;
}
function generateNoticeContent(context, message) {
return h('div', {
class: 'media-content'
}, context.slots.default && context.slots.default() || h('p', message));
}
function generateNoticeBody(props, context, messageController, noticeController, message) {
return h('div', {
class: 'media'
}, props.useIcon && messageController.icon.value ? [generateIcon(messageController), generateNoticeContent(context, message)] : [generateNoticeContent(context, message)]);
}
function getGenerateNotice(props, context, messageController, noticeController) {
return options => () => {
const notice = h('article', {
class: ['notification', options.variant ?? props.variant, options.position ?? props.position]
}, props.isClosable ? [generateCloseButton(props, messageController, noticeController), generateNoticeBody(props, context, messageController, noticeController, options.message ?? props.message)] : [generateNoticeBody(props, context, messageController, noticeController, options.message ?? props.message)]);
return props.isNotice ? [notice] : [withDirectives(notice, [[vShow, messageController.isOn.value]])];
};
}
export default defineComponent({
name: 'b-notification',
props: BNotificationPropsDefinition,
setup(props, context) {
const renderNotification = shallowRef(constant(constEmptyArray));
const noticeController = useNoticeController(props, renderNotification);
const messageController = useMessage(props);
renderNotification.value = getGenerateNotice(props, context, messageController, noticeController);
return () => props.isNotice ? context.slots.trigger && context.slots.trigger({
open: noticeController.open,
close: noticeController.close
}) : h(Transition, props.transition ? formatTransition(props.transition) : {}, renderNotification.value({}));
}
});
//# sourceMappingURL=BNotification.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,3 @@
import BNotification from './BNotification';
export { BNotification };
export default BNotification;

View File

@@ -0,0 +1,4 @@
import BNotification from './BNotification';
export { BNotification };
export default BNotification;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/components/notices/notification/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAP,MAA0B,iBAA1B;AAEA,SAAS,aAAT;AAEA,eAAe,aAAf","sourcesContent":["import BNotification from './BNotification';\n\nexport { BNotification };\n\nexport default BNotification;\n"],"sourceRoot":"","file":"index.js"}