diff --git a/components/lib/accordion/BaseAccordion.vue b/components/lib/accordion/BaseAccordion.vue index 7880a763a..3d1d18657 100644 --- a/components/lib/accordion/BaseAccordion.vue +++ b/components/lib/accordion/BaseAccordion.vue @@ -45,7 +45,7 @@ const classes = { } }; -const { load: loadStyle, unload: unloadStyle } = useStyle(styles, { id: 'primevue_accordion_style', manual: true }); +const { load: loadStyle } = useStyle(styles, { id: 'primevue_accordion_style', manual: true }); export default { name: 'BaseAccordion', @@ -81,15 +81,13 @@ export default { } }, css: { - classes + classes, + loadStyle }, - watch: { - isUnstyled: { - immediate: true, - handler(newValue) { - !newValue && loadStyle(); - } - } + provide() { + return { + $parentInstance: this + }; } }; diff --git a/components/lib/accordiontab/BaseAccordionTab.vue b/components/lib/accordiontab/BaseAccordionTab.vue index 298d02d7b..4426ba212 100644 --- a/components/lib/accordiontab/BaseAccordionTab.vue +++ b/components/lib/accordiontab/BaseAccordionTab.vue @@ -14,6 +14,11 @@ export default { contentClass: null, contentProps: null, disabled: Boolean + }, + provide() { + return { + $parentInstance: this + }; } }; diff --git a/components/lib/autocomplete/AutoComplete.vue b/components/lib/autocomplete/AutoComplete.vue index 6c33e8073..3ebb8b52c 100755 --- a/components/lib/autocomplete/AutoComplete.vue +++ b/components/lib/autocomplete/AutoComplete.vue @@ -146,7 +146,7 @@ @click="onOptionSelect($event, option)" @mousemove="onOptionMouseMove($event, getOptionIndex(i, getItemOptions))" :data-p-highlight="isSelected(option)" - :data-p-focus="focusedOptionIndex === getOptionIndex(index, getItemOptions)" + :data-p-focus="focusedOptionIndex === getOptionIndex(i, getItemOptions)" :data-p-disabled="isOptionDisabled(option)" v-bind="getPTOptions(option, getItemOptions, i, 'item')" > diff --git a/components/lib/autocomplete/BaseAutoComplete.vue b/components/lib/autocomplete/BaseAutoComplete.vue index 90bc9a05a..706a545ba 100644 --- a/components/lib/autocomplete/BaseAutoComplete.vue +++ b/components/lib/autocomplete/BaseAutoComplete.vue @@ -148,7 +148,7 @@ const classes = { hiddenSelectedMessage: 'p-hidden-accessible' }; -const { load: loadStyle, unload: unloadStyle } = useStyle(styles, { id: 'primevue_autocomplete_style', manual: true }); +const { load: loadStyle } = useStyle(styles, { id: 'primevue_autocomplete_style', manual: true }); export default { name: 'BaseAutoComplete', @@ -312,15 +312,13 @@ export default { }, css: { classes, - inlineStyles + inlineStyles, + loadStyle }, - watch: { - isUnstyled: { - immediate: true, - handler(newValue) { - !newValue && loadStyle(); - } - } + provide() { + return { + $parentInstance: this + }; } }; diff --git a/components/lib/avatar/BaseAvatar.vue b/components/lib/avatar/BaseAvatar.vue index 17b5ca12e..1851bf6bb 100644 --- a/components/lib/avatar/BaseAvatar.vue +++ b/components/lib/avatar/BaseAvatar.vue @@ -84,15 +84,13 @@ export default { } }, css: { - classes + classes, + loadStyle }, - watch: { - isUnstyled: { - immediate: true, - handler(newValue) { - !newValue && loadStyle(); - } - } + provide() { + return { + $parentInstance: this + }; } }; diff --git a/components/lib/badge/BaseBadge.vue b/components/lib/badge/BaseBadge.vue index 297a8bb6a..07cc4ce6b 100644 --- a/components/lib/badge/BaseBadge.vue +++ b/components/lib/badge/BaseBadge.vue @@ -39,11 +39,11 @@ const styles = ` `; const classes = { - root: ({ props }) => [ + root: ({ props, instance }) => [ 'p-badge p-component', { 'p-badge-no-gutter': ObjectUtils.isNotEmpty(props.value) && String(props.value).length === 1, - 'p-badge-dot': ObjectUtils.isEmpty(props.value) && !props.$slots.default, + 'p-badge-dot': ObjectUtils.isEmpty(props.value) && !instance.$slots.default, 'p-badge-lg': props.size === 'large', 'p-badge-xl': props.size === 'xlarge', 'p-badge-info': props.severity === 'info', @@ -74,15 +74,13 @@ export default { } }, css: { - classes + classes, + loadStyle }, - watch: { - isUnstyled: { - immediate: true, - handler(newValue) { - !newValue && loadStyle(); - } - } + provide() { + return { + $parentInstance: this + }; } }; diff --git a/components/lib/blockui/BaseBlockUI.vue b/components/lib/blockui/BaseBlockUI.vue index f4aba47a3..a4d6e6b64 100644 --- a/components/lib/blockui/BaseBlockUI.vue +++ b/components/lib/blockui/BaseBlockUI.vue @@ -52,15 +52,13 @@ export default { } }, css: { - classes + classes, + loadStyle }, - watch: { - isUnstyled: { - immediate: true, - handler(newValue) { - !newValue && loadStyle(); - } - } + provide() { + return { + $parentInstance: this + }; } }; diff --git a/components/lib/breadcrumb/BaseBreadcrumb.vue b/components/lib/breadcrumb/BaseBreadcrumb.vue index c9d72908f..07d013d8f 100644 --- a/components/lib/breadcrumb/BaseBreadcrumb.vue +++ b/components/lib/breadcrumb/BaseBreadcrumb.vue @@ -42,11 +42,11 @@ const classes = { home: 'p-breadcrumb-home', separator: 'p-menuitem-separator', menuitem: ({ instance }) => ['p-menuitem', { 'p-disabled': instance.disabled() }], - action: ({ instance, isActive, isExactActive }) => [ + action: ({ props, isActive, isExactActive }) => [ 'p-menuitem-link', { 'router-link-active': isActive, - 'router-link-active-exact': instance.exact && isExactActive + 'router-link-active-exact': props.exact && isExactActive } ], icon: 'p-menuitem-icon', diff --git a/components/lib/button/BaseButton.vue b/components/lib/button/BaseButton.vue new file mode 100644 index 000000000..755de0fd5 --- /dev/null +++ b/components/lib/button/BaseButton.vue @@ -0,0 +1,196 @@ + diff --git a/components/lib/button/Button.d.ts b/components/lib/button/Button.d.ts index f6955bb85..36795965b 100755 --- a/components/lib/button/Button.d.ts +++ b/components/lib/button/Button.d.ts @@ -142,6 +142,11 @@ export interface ButtonProps extends ButtonHTMLAttributes { * @type {ButtonPassThroughOptions} */ pt?: ButtonPassThroughOptions; + /** + * When enabled, it removes component related styles in the core. + * @defaultValue false + */ + unstyled?: boolean; } /** diff --git a/components/lib/button/Button.vue b/components/lib/button/Button.vue index 7c58b28b2..780ab6087 100755 --- a/components/lib/button/Button.vue +++ b/components/lib/button/Button.vue @@ -1,139 +1,28 @@ - diff --git a/components/lib/checkbox/BaseCheckbox.vue b/components/lib/checkbox/BaseCheckbox.vue index 35c96539e..b4f287e72 100644 --- a/components/lib/checkbox/BaseCheckbox.vue +++ b/components/lib/checkbox/BaseCheckbox.vue @@ -43,7 +43,7 @@ const classes = { icon: 'p-checkbox-icon' }; -const { load: loadStyle, unload: unloadStyle } = useStyle(styles, { id: 'primevue_checkbox_style', manual: true }); +const { load: loadStyle } = useStyle(styles, { id: 'primevue_checkbox_style', manual: true }); export default { name: 'BaseCheckbox', @@ -106,15 +106,13 @@ export default { } }, css: { - classes + classes, + loadStyle }, - watch: { - isUnstyled: { - immediate: true, - handler(newValue) { - !newValue && loadStyle(); - } - } + provide() { + return { + $parentInstance: this + }; } }; diff --git a/components/lib/chip/BaseChip.vue b/components/lib/chip/BaseChip.vue index 5099c634f..453a4d216 100644 --- a/components/lib/chip/BaseChip.vue +++ b/components/lib/chip/BaseChip.vue @@ -66,15 +66,13 @@ export default { } }, css: { - classes + classes, + loadStyle }, - watch: { - isUnstyled: { - immediate: true, - handler(newValue) { - !newValue && loadStyle(); - } - } + provide() { + return { + $parentInstance: this + }; } }; diff --git a/components/lib/chips/BaseChips.vue b/components/lib/chips/BaseChips.vue index dc217a0d5..b9307501d 100644 --- a/components/lib/chips/BaseChips.vue +++ b/components/lib/chips/BaseChips.vue @@ -67,7 +67,7 @@ const classes = { inputToken: 'p-chips-input-token' }; -const { load: loadStyle, unload: unloadStyle } = useStyle(styles, { id: 'primevue_chips_style', manual: true }); +const { load: loadStyle } = useStyle(styles, { id: 'primevue_chips_style', manual: true }); export default { name: 'BaseChips', @@ -131,15 +131,13 @@ export default { } }, css: { - classes + classes, + loadStyle }, - watch: { - isUnstyled: { - immediate: true, - handler(newValue) { - !newValue && loadStyle(); - } - } + provide() { + return { + $parentInstance: this + }; } }; diff --git a/components/lib/colorpicker/BaseColorPicker.vue b/components/lib/colorpicker/BaseColorPicker.vue index a5b12c034..dcff42087 100644 --- a/components/lib/colorpicker/BaseColorPicker.vue +++ b/components/lib/colorpicker/BaseColorPicker.vue @@ -32,7 +32,7 @@ const classes = { hueHandle: 'p-colorpicker-hue-handle' }; -const { load: loadStyle, unload: unloadStyle } = useStyle(styles, { id: 'primevue_colorpicker_style', manual: true }); +const { load: loadStyle } = useStyle(styles, { id: 'primevue_colorpicker_style', manual: true }); export default { name: 'BaseColorPicker', @@ -77,15 +77,13 @@ export default { panelClass: null }, css: { - classes + classes, + loadStyle }, - watch: { - isUnstyled: { - immediate: true, - handler(newValue) { - !newValue && loadStyle(); - } - } + provide() { + return { + $parentInstance: this + }; } }; diff --git a/components/lib/confirmdialog/BaseConfirmDialog.vue b/components/lib/confirmdialog/BaseConfirmDialog.vue index 0a4915133..72524ec9e 100644 --- a/components/lib/confirmdialog/BaseConfirmDialog.vue +++ b/components/lib/confirmdialog/BaseConfirmDialog.vue @@ -27,6 +27,11 @@ export default { }, css: { classes + }, + provide() { + return { + $parentInstance: this + }; } }; diff --git a/components/lib/confirmpopup/BaseConfirmPopup.vue b/components/lib/confirmpopup/BaseConfirmPopup.vue index c540387b4..191a418d4 100644 --- a/components/lib/confirmpopup/BaseConfirmPopup.vue +++ b/components/lib/confirmpopup/BaseConfirmPopup.vue @@ -101,15 +101,13 @@ export default { group: String }, css: { - classes + classes, + loadStyle }, - watch: { - isUnstyled: { - immediate: true, - handler(newValue) { - !newValue && loadStyle(); - } - } + provide() { + return { + $parentInstance: this + }; } }; diff --git a/components/lib/contextmenu/BaseContextMenu.vue b/components/lib/contextmenu/BaseContextMenu.vue index e62cfe3ce..8eff1ed46 100644 --- a/components/lib/contextmenu/BaseContextMenu.vue +++ b/components/lib/contextmenu/BaseContextMenu.vue @@ -54,20 +54,20 @@ const classes = { } ], menu: 'p-contextmenu-root-list', - menuitem: ({ context, processedItem }) => [ + menuitem: ({ instance, processedItem }) => [ 'p-menuitem', { - 'p-menuitem-active p-highlight': context.isItemActive(processedItem), - 'p-focus': context.isItemFocused(processedItem), - 'p-disabled': context.isItemDisabled(processedItem) + 'p-menuitem-active p-highlight': instance.isItemActive(processedItem), + 'p-focus': instance.isItemFocused(processedItem), + 'p-disabled': instance.isItemDisabled(processedItem) } ], content: 'p-menuitem-content', - action: ({ context, isActive, isExactActive }) => [ + action: ({ props, isActive, isExactActive }) => [ 'p-menuitem-link', { 'router-link-active': isActive, - 'router-link-active-exact': context.exact && isExactActive + 'router-link-active-exact': props.exact && isExactActive } ], icon: 'p-menuitem-icon', @@ -77,7 +77,7 @@ const classes = { separator: 'p-menuitem-separator' }; -const { load: loadStyle, unload: unloadStyle } = useStyle(styles, { id: 'primevue_contextmenu_style', manual: true }); +const { load: loadStyle } = useStyle(styles, { id: 'primevue_contextmenu_style', manual: true }); export default { name: 'BaseContextMenu', @@ -121,15 +121,13 @@ export default { } }, css: { - classes + classes, + loadStyle }, - watch: { - isUnstyled: { - immediate: true, - handler(newValue) { - !newValue && loadStyle(); - } - } + provide() { + return { + $parentInstance: this + }; } }; diff --git a/components/lib/contextmenu/ContextMenuSub.vue b/components/lib/contextmenu/ContextMenuSub.vue index 5d3d41fa5..58f1600b3 100755 --- a/components/lib/contextmenu/ContextMenuSub.vue +++ b/components/lib/contextmenu/ContextMenuSub.vue @@ -6,7 +6,7 @@ v-if="isItemVisible(processedItem) && !getItemProp(processedItem, 'separator')" :id="getItemId(processedItem)" :style="getItemProp(processedItem, 'style')" - :class="[getCXOptions('menuitem', { processedItem }), getItemProp(processedItem, 'class')]" + :class="[cx('menuitem', { processedItem }), getItemProp(processedItem, 'class')]" role="menuitem" :aria-label="getItemLabel(processedItem)" :aria-disabled="isItemDisabled(processedItem) || undefined" @@ -20,22 +20,22 @@ :data-p-focused="isItemFocused(processedItem)" :data-p-disabled="isItemDisabled(processedItem)" > -