first commit

This commit is contained in:
DanielRamirezGe
2020-01-14 20:43:08 -06:00
parent 3557894f7f
commit 5eecfbf6cd
26326 changed files with 2434803 additions and 0 deletions
+71
View File
@@ -0,0 +1,71 @@
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
import Vue from '../../utils/vue';
import { mergeData } from 'vue-functional-data-merge';
import { getComponentConfig } from '../../utils/config';
import { isEvent } from '../../utils/inspect';
import { hasNormalizedSlot, normalizeSlot } from '../../utils/normalize-slot';
var NAME = 'BButtonClose';
var props = {
disabled: {
type: Boolean,
default: false
},
ariaLabel: {
type: String,
default: function _default() {
return getComponentConfig(NAME, 'ariaLabel');
}
},
textVariant: {
type: String,
default: function _default() {
return getComponentConfig(NAME, 'textVariant');
}
}
}; // @vue/component
export var BButtonClose =
/*#__PURE__*/
Vue.extend({
name: NAME,
functional: true,
props: props,
render: function render(h, _ref) {
var props = _ref.props,
data = _ref.data,
listeners = _ref.listeners,
slots = _ref.slots,
scopedSlots = _ref.scopedSlots;
var $slots = slots();
var $scopedSlots = scopedSlots || {};
var componentData = {
staticClass: 'close',
class: _defineProperty({}, "text-".concat(props.textVariant), props.textVariant),
attrs: {
type: 'button',
disabled: props.disabled,
'aria-label': props.ariaLabel ? String(props.ariaLabel) : null
},
on: {
click: function click(evt) {
// Ensure click on button HTML content is also disabled
/* istanbul ignore if: bug in JSDOM still emits click on inner element */
if (props.disabled && isEvent(evt)) {
evt.stopPropagation();
evt.preventDefault();
}
}
}
}; // Careful not to override the default slot with innerHTML
if (!hasNormalizedSlot('default', $scopedSlots, $slots)) {
componentData.domProps = {
innerHTML: '×'
};
}
return h('button', mergeData(data, componentData), normalizeSlot('default', {}, $scopedSlots, $slots));
}
});
+199
View File
@@ -0,0 +1,199 @@
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
import Vue from '../../utils/vue';
import { mergeData } from 'vue-functional-data-merge';
import pluckProps from '../../utils/pluck-props';
import { concat } from '../../utils/array';
import { getComponentConfig } from '../../utils/config';
import { addClass, removeClass } from '../../utils/dom';
import { isBoolean, isEvent, isFunction } from '../../utils/inspect';
import { keys } from '../../utils/object';
import { BLink, propsFactory as linkPropsFactory } from '../link/link'; // --- Constants --
var NAME = 'BButton';
var btnProps = {
block: {
type: Boolean,
default: false
},
disabled: {
type: Boolean,
default: false
},
size: {
type: String,
default: function _default() {
return getComponentConfig(NAME, 'size');
}
},
variant: {
type: String,
default: function _default() {
return getComponentConfig(NAME, 'variant');
}
},
type: {
type: String,
default: 'button'
},
tag: {
type: String,
default: 'button'
},
pill: {
type: Boolean,
default: false
},
squared: {
type: Boolean,
default: false
},
pressed: {
// tri-state prop: true, false or null
// => on, off, not a toggle
type: Boolean,
default: null
}
};
var linkProps = linkPropsFactory();
delete linkProps.href.default;
delete linkProps.to.default;
var linkPropKeys = keys(linkProps);
export var props = _objectSpread({}, linkProps, {}, btnProps); // --- Helper methods ---
// Focus handler for toggle buttons. Needs class of 'focus' when focused.
var handleFocus = function handleFocus(evt) {
if (evt.type === 'focusin') {
addClass(evt.target, 'focus');
} else if (evt.type === 'focusout') {
removeClass(evt.target, 'focus');
}
}; // Is the requested button a link?
var isLink = function isLink(props) {
// If tag prop is set to `a`, we use a b-link to get proper disabled handling
return Boolean(props.href || props.to || props.tag && String(props.tag).toLowerCase() === 'a');
}; // Is the button to be a toggle button?
var isToggle = function isToggle(props) {
return isBoolean(props.pressed);
}; // Is the button "really" a button?
var isButton = function isButton(props) {
if (isLink(props)) {
return false;
} else if (props.tag && String(props.tag).toLowerCase() !== 'button') {
return false;
}
return true;
}; // Is the requested tag not a button or link?
var isNonStandardTag = function isNonStandardTag(props) {
return !isLink(props) && !isButton(props);
}; // Compute required classes (non static classes)
var computeClass = function computeClass(props) {
var _ref;
return ["btn-".concat(props.variant || getComponentConfig(NAME, 'variant')), (_ref = {}, _defineProperty(_ref, "btn-".concat(props.size), Boolean(props.size)), _defineProperty(_ref, 'btn-block', props.block), _defineProperty(_ref, 'rounded-pill', props.pill), _defineProperty(_ref, 'rounded-0', props.squared && !props.pill), _defineProperty(_ref, "disabled", props.disabled), _defineProperty(_ref, "active", props.pressed), _ref)];
}; // Compute the link props to pass to b-link (if required)
var computeLinkProps = function computeLinkProps(props) {
return isLink(props) ? pluckProps(linkPropKeys, props) : null;
}; // Compute the attributes for a button
var computeAttrs = function computeAttrs(props, data) {
var button = isButton(props);
var link = isLink(props);
var toggle = isToggle(props);
var nonStdTag = isNonStandardTag(props);
var role = data.attrs && data.attrs.role ? data.attrs.role : null;
var tabindex = data.attrs ? data.attrs.tabindex : null;
if (nonStdTag) {
tabindex = '0';
}
return {
// Type only used for "real" buttons
type: button && !link ? props.type : null,
// Disabled only set on "real" buttons
disabled: button ? props.disabled : null,
// We add a role of button when the tag is not a link or button for ARIA.
// Don't bork any role provided in data.attrs when isLink or isButton
role: nonStdTag ? 'button' : role,
// We set the aria-disabled state for non-standard tags
'aria-disabled': nonStdTag ? String(props.disabled) : null,
// For toggles, we need to set the pressed state for ARIA
'aria-pressed': toggle ? String(props.pressed) : null,
// autocomplete off is needed in toggle mode to prevent some browsers from
// remembering the previous setting when using the back button.
autocomplete: toggle ? 'off' : null,
// Tab index is used when the component is not a button.
// Links are tabbable, but don't allow disabled, while non buttons or links
// are not tabbable, so we mimic that functionality by disabling tabbing
// when disabled, and adding a tabindex of '0' to non buttons or non links.
tabindex: props.disabled && !button ? '-1' : tabindex
};
}; // @vue/component
export var BButton =
/*#__PURE__*/
Vue.extend({
name: NAME,
functional: true,
props: props,
render: function render(h, _ref2) {
var props = _ref2.props,
data = _ref2.data,
listeners = _ref2.listeners,
children = _ref2.children;
var toggle = isToggle(props);
var link = isLink(props);
var on = {
click: function click(evt) {
/* istanbul ignore if: blink/button disabled should handle this */
if (props.disabled && isEvent(evt)) {
evt.stopPropagation();
evt.preventDefault();
} else if (toggle && listeners && listeners['update:pressed']) {
// Send .sync updates to any "pressed" prop (if .sync listeners)
// Concat will normalize the value to an array
// without double wrapping an array value in an array.
concat(listeners['update:pressed']).forEach(function (fn) {
if (isFunction(fn)) {
fn(!props.pressed);
}
});
}
}
};
if (toggle) {
on.focusin = handleFocus;
on.focusout = handleFocus;
}
var componentData = {
staticClass: 'btn',
class: computeClass(props),
props: computeLinkProps(props),
attrs: computeAttrs(props, data),
on: on
};
return h(link ? BLink : props.tag, mergeData(data, componentData), children);
}
});
+14
View File
@@ -0,0 +1,14 @@
//
// Buttons
//
import Vue from 'vue'
import { BvPlugin, BvComponent } from '../../'
// Plugin
export declare const ButtonPlugin: BvPlugin
// Component: b-button
export declare class BButton extends BvComponent {}
// Component: b-button-close
export declare class BButtonClose extends BvComponent {}
+14
View File
@@ -0,0 +1,14 @@
import { BButton } from './button';
import { BButtonClose } from './button-close';
import { pluginFactory } from '../../utils/plugins';
var ButtonPlugin =
/*#__PURE__*/
pluginFactory({
components: {
BButton: BButton,
BBtn: BButton,
BButtonClose: BButtonClose,
BBtnClose: BButtonClose
}
});
export { ButtonPlugin, BButton, BButtonClose };