gather-content-ui
Version:
GatherContent UI Library
46 lines (45 loc) • 1.64 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.PillInput = PillInput;
exports["default"] = void 0;
var _react = _interopRequireDefault(require("react"));
var _PillInput = require("../PillInput/PillInput");
var _StoryItem = _interopRequireDefault(require("../../../stories/styleguide/StoryItem"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _default = exports["default"] = {
title: "Legacy/Form/Inputs/Pill Input",
component: _PillInput.PillInput
};
var emailRegex = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
function PillInput() {
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_StoryItem["default"], {
title: "PillInputComponent",
description: "Text input that creates pills"
}, /*#__PURE__*/_react["default"].createElement(_PillInput.PillInput, {
placeholder: "Enter an email",
checker: {
warning: "This is not a valid email address!",
regex: emailRegex
}
// eslint-disable-next-line no-console
,
onPillsChange: function onPillsChange(pills) {
return console.log(pills);
},
initialPills: [{
id: "b414a7bc-ddb5-4a2d-92a3-332a1f89ebcc",
name: "valid@example.com"
}, {
id: "cfb0b362-1c34-4b9b-b489-93a68df6045d",
name: "invalid@example"
}]
})));
}
PillInput.parameters = {
controls: {
hideNoControlsWarning: true
}
};
//# sourceMappingURL=PillInput.stories.js.map