New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@launcher/component

Package Overview
Dependencies
Maintainers
2
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@launcher/component - npm Package Compare versions

Comparing version 2.0.5 to 2.0.6

197

build/esm/index.js

@@ -1,4 +0,4 @@

import React__default, { useContext, createElement, useState, useEffect, Fragment, createContext } from 'react';
import { Button, Title, Alert, AlertVariant, FormGroup, TextInput, Grid, GridItem, Tooltip, Stack, StackItem, Toolbar, ToolbarGroup, AlertActionCloseButton, Text, TextVariants, EmptyState, EmptyStateBody } from '@patternfly/react-core';
import { InProgressIcon, ExternalLinkSquareAltIcon, CaretSquareLeftIcon, CaretSquareUpIcon, CaretSquareRightIcon, CaretSquareDownIcon, PlusIcon, TimesIcon, EditIcon, CheckCircleIcon, WindowCloseIcon, EditAltIcon } from '@patternfly/react-icons';
import React__default, { useContext, createElement, useState, useEffect, createContext, Fragment } from 'react';
import { Button, Title, Alert, AlertVariant, Toolbar, ToolbarGroup, GridItem, AlertActionCloseButton, Text, TextVariants, Grid, EmptyState, EmptyStateBody, TextInput, FormGroup } from '@patternfly/react-core';
import { InProgressIcon, ExternalLinkSquareAltIcon, EditIcon, CheckCircleIcon, WindowCloseIcon, EditAltIcon, CaretSquareLeftIcon, CaretSquareUpIcon, CaretSquareRightIcon, CaretSquareDownIcon } from '@patternfly/react-icons';
import { useSessionStorageWithObject } from 'react-use-sessionstorage';

@@ -250,127 +250,2 @@

function LaunchTextInput(props) {
var _a = useState(false), isDirty = _a[0], setIsDirty = _a[1];
var onChange = props.onChange, isValid = props.isValid, helperTextInvalid = props.helperTextInvalid, label = props.label, rest = __rest(props, ["onChange", "isValid", "helperTextInvalid", "label"]);
var analytics = useAnalytics();
return (React__default.createElement(FormGroup, { fieldId: props.id, label: label, isValid: isValid || !isDirty, helperTextInvalid: helperTextInvalid },
React__default.createElement(TextInput, __assign({ onChange: function (value, event) {
if (!isDirty) {
analytics.event('Input', 'Customized-Value', props.id);
}
setIsDirty(true);
if (onChange) {
onChange(value, event);
}
}, isValid: isValid || !isDirty }, rest))));
}
var css$1 = ".toggle-panel {\n overflow: hidden; }\n .toggle-panel.vertical {\n max-height: 0;\n transition: max-height 0.25s ease-in-out; }\n .toggle-panel.vertical.open {\n max-height: 1000px; }\n .toggle-panel.horizontal {\n visibility: hidden; }\n .toggle-panel.horizontal.open {\n visibility: visible; }\n .toggle-panel button {\n text-transform: uppercase; }\n";
styleInject(css$1);
function TogglePanel(props) {
var _a = useSessionStorageWithObject(props.id, false), open = _a[0], setOpen = _a[1];
var mode = props.mode || 'vertical';
var CloseIcon = mode === 'horizontal' ? React__default.createElement(CaretSquareLeftIcon, null) : React__default.createElement(CaretSquareUpIcon, null);
var OpenIcon = mode === 'horizontal' ? React__default.createElement(CaretSquareRightIcon, null) : React__default.createElement(CaretSquareDownIcon, null);
return (React__default.createElement(Fragment, null,
React__default.createElement("div", { className: "toggle-panel " + mode + " " + (open ? 'open' : '') }, props.children),
React__default.createElement("div", { className: "toggle-button" },
React__default.createElement(Button
// @ts-ignore
, {
// @ts-ignore
component: "a", variant: "link", "aria-label": "Toggle panel", onClick: function () { return setOpen(!open); } }, open ? (React__default.createElement("span", null,
CloseIcon,
" ",
props.closeLabel || 'Close')) : (React__default.createElement("span", null,
OpenIcon,
" ",
props.openLabel || 'Open'))))));
}
var css$2 = ".gav-picker.horizontal {\n display: flex; }\n .gav-picker.horizontal .base-settings {\n order: 1;\n flex-grow: 1;\n padding: 0 10px;\n align-self: flex-start; }\n .gav-picker.horizontal .toggle-panel {\n align-self: flex-start;\n order: 4;\n flex-grow: 1;\n padding: 0 10px; }\n .gav-picker.horizontal .toggle-panel.open {\n order: 2; }\n .gav-picker.horizontal .toggle-button {\n flex-shrink: 1;\n order: 3;\n align-self: flex-end;\n padding: 0 10px; }\n";
styleInject(css$2);
var VALUE_REGEXP = /^[a-z][a-z0-9-.]{3,63}$/;
var GAVPicker = {
checkCompletion: function (value) { return !!value.groupId && VALUE_REGEXP.test(value.groupId)
&& !!value.artifactId && VALUE_REGEXP.test(value.artifactId) && !!value.version; },
Element: function (props) {
var isValid = function (value) { return !!value && VALUE_REGEXP.test(value || ''); };
var visibleFields = props.visibleFields ? new Set(props.visibleFields)
: new Set(['groupId', 'artifactId', 'version', 'description', 'packageName']);
var mode = props.mode || 'vertical';
return (React__default.createElement("div", { className: "gav-picker " + mode },
React__default.createElement("div", { className: "base-settings pf-c-form" },
visibleFields.has('groupId') && React__default.createElement(LaunchTextInput, { label: "Group", isRequired: true, helperTextInvalid: "Please provide a valid groupId", type: "text", id: "groupId", name: "groupId", "aria-label": "Edit groupId", value: props.value.groupId || '', onChange: function (value) { return props.onChange(__assign({}, props.value, { groupId: value })); }, pattern: VALUE_REGEXP.source, isValid: isValid(props.value.groupId) }),
visibleFields.has('artifactId') && React__default.createElement(LaunchTextInput, { label: "Artifact", isRequired: true, helperTextInvalid: "Please provide a valid artifactId", type: "text", id: "artifactId", name: "artifactId", "aria-label": "Edit artifactId", value: props.value.artifactId || '', onChange: function (value) { return props.onChange(__assign({}, props.value, { artifactId: value })); }, pattern: VALUE_REGEXP.source, isValid: isValid(props.value.artifactId) })),
optionalBool(props.showMoreOptions, true) && (React__default.createElement(TogglePanel, { id: "gav-extended", mode: mode, openLabel: "Configure more options" },
React__default.createElement("div", { className: "extended-settings pf-c-form" },
visibleFields.has('version') && React__default.createElement(LaunchTextInput, { label: "Version", helperTextInvalid: "Please provide a version number", isRequired: true, type: "text", id: "version", name: "version", "aria-label": "Edit version", value: props.value.version || '', onChange: function (value) { return props.onChange(__assign({}, props.value, { version: value })); }, isValid: !!props.value.version }),
visibleFields.has('description') && React__default.createElement(LaunchTextInput, { label: "Description", helperTextInvalid: "Please provide a description", isRequired: true, type: "text", id: "description", name: "description", "aria-label": "Edit description", value: props.value.description || '', onChange: function (value) { return props.onChange(__assign({}, props.value, { description: value })); }, isValid: true }),
visibleFields.has('packageName') && React__default.createElement(LaunchTextInput, { label: "Package Name", helperTextInvalid: "Please provide a package name", isRequired: true, type: "text", id: "packageName", name: "packageName", "aria-label": "Edit package name", value: props.value.packageName || '', onChange: function (value) { return props.onChange(__assign({}, props.value, { packageName: value })); }, isValid: true }))))));
}
};
var css$3 = ".dependencies-module_dependencyList__wjKCR .dependencies-module_item__1F7Xw {\n border: 2px solid #f7f7f7;\n line-height: 24px;\n padding: 8px 40px 8px 16px;\n margin: 8px 0;\n border-radius: 4px;\n cursor: pointer; }\n .dependencies-module_dependencyList__wjKCR .dependencies-module_item__1F7Xw h1 {\n display: inline-block;\n font-weight: 600; }\n .dependencies-module_dependencyList__wjKCR .dependencies-module_item__1F7Xw .dependencies-module_icon__2K-Rx {\n position: absolute;\n top: 0;\n bottom: 0;\n right: 0;\n left: 0;\n margin: auto 100%; }\n\n.dependencies-module_dependencyList__wjKCR .dependencies-module_active__qO8_m {\n background-color: #bee1f4; }\n\n.dependencies-module_dependencyList__wjKCR .dependencies-module_category__3cP26 {\n color: #06c;\n padding-left: 10px; }\n";
var style$1 = {"dependencyList":"dependencies-module_dependencyList__wjKCR","item":"dependencies-module_item__1F7Xw","icon":"dependencies-module_icon__2K-Rx","active":"dependencies-module_active__qO8_m","category":"dependencies-module_category__3cP26"};
styleInject(css$3);
var OperationType;
(function (OperationType) {
OperationType[OperationType["Add"] = 1] = "Add";
OperationType[OperationType["Remove"] = 2] = "Remove";
})(OperationType || (OperationType = {}));
function DependencyItemComponent(props) {
var _a = useState(false), active = _a[0], setActive = _a[1];
var onClick = function () {
props.onClick(props.id);
};
return (React__default.createElement("div", { className: style$1.item + " " + (active ? style$1.active : '') + " dependency-item", onMouseEnter: function () { return setActive(true); }, onMouseLeave: function () { return setActive(false); }, onClick: onClick },
React__default.createElement(Stack, { style: { position: 'relative' } },
React__default.createElement(StackItem, { isFilled: true },
React__default.createElement(Title, { size: "sm", "aria-label": "Pick " + props.id + " dependency" }, props.name),
React__default.createElement("span", { className: style$1.category }, props.metadata.category),
active && (props.operation === OperationType.Add ?
React__default.createElement(PlusIcon, { className: style$1.icon }) : React__default.createElement(TimesIcon, { className: style$1.icon }))),
React__default.createElement(StackItem, { isFilled: false }, props.description))));
}
var DependenciesPicker = {
checkCompletion: function (value) { return !!value.dependencies && value.dependencies.length > 0; },
Element: function (props) {
var _a = useState(''), filter = _a[0], setFilter = _a[1];
var analytics = useAnalytics();
var dependencies = props.value.dependencies || [];
var dependenciesSet = new Set(dependencies);
var dependencyItemById = new Map(props.items.map(function (item) { return [item.id, item]; }));
var addDep = function (id) {
dependenciesSet.add(id);
props.onChange({ dependencies: Array.from(dependenciesSet) });
analytics.event('Picker', 'Add-Dependency', id);
};
var removeDep = function (id) {
dependenciesSet.delete(id);
props.onChange({ dependencies: Array.from(dependenciesSet) });
analytics.event('Picker', 'Remove-Dependency', id);
};
var filterFunction = function (d) {
return filter !== '' && (d.description.toLowerCase().includes(filter.toLowerCase())
|| d.name.toLowerCase().includes(filter.toLowerCase())
|| d.metadata.category.toLowerCase().includes(filter.toLowerCase()));
};
var result = props.items.filter(filterFunction);
var categories = new Set(props.items.map(function (i) { return i.metadata.category; }));
return (React__default.createElement(Grid, { gutter: "md", className: "dependencies-picker" },
React__default.createElement(GridItem, { sm: 12, md: 6 },
React__default.createElement(Tooltip, { position: "right", content: "" + Array.from(categories).join(', ') },
React__default.createElement(TextInput, { "aria-label": "Search dependencies", placeholder: props.placeholder, className: "search-depencencies-input", value: filter, onChange: function (value) { return setFilter(value); } })),
React__default.createElement("div", { "aria-label": "Select dependencies", className: style$1.dependencyList + " available-dependencies" },
result.map(function (dep, i) { return (React__default.createElement(DependencyItemComponent, __assign({ operation: OperationType.Add }, dep, { key: i, onClick: addDep }))); }),
filter && !result.length && React__default.createElement(Title, { size: "xs", style: { paddingTop: '10px' } }, "No result."))),
dependencies.length > 0 && (React__default.createElement(GridItem, { sm: 12, md: 6 },
React__default.createElement(Title, { size: "md" }, "Selected:"),
React__default.createElement("div", { className: style$1.dependencyList + " selected-dependencies" }, dependencies.map(function (selected, i) { return (React__default.createElement(DependencyItemComponent, __assign({ operation: OperationType.Remove }, dependencyItemById.get(selected), { key: i, onClick: removeDep }))); }))))));
}
};
function FormPanel(props) {

@@ -400,5 +275,5 @@ var _a = useState(props.initialValue), value = _a[0], onChange = _a[1];

var css$4 = ".hub-n-spoke-module_hubNSpoke__2WnXr {\n padding: 10px; }\n .hub-n-spoke-module_hubNSpoke__2WnXr h1.hub-and-spoke-title {\n font-size: 200%;\n margin-bottom: 30px; }\n .hub-n-spoke-module_hubNSpoke__2WnXr .hub-and-spoke-item {\n border: 1px solid #dcdcdc;\n border-radius: 3px;\n background: white; }\n .hub-n-spoke-module_hubNSpoke__2WnXr .hub-and-spoke-item .hub-and-spoke-header {\n border-bottom: 1px solid #f1f1f1;\n margin: 0 0 0 10px;\n display: flex;\n height: 36px; }\n .hub-n-spoke-module_hubNSpoke__2WnXr .hub-and-spoke-item .hub-and-spoke-header h1 {\n font-weight: bold;\n flex-grow: 1;\n line-height: 36px; }\n .hub-n-spoke-module_hubNSpoke__2WnXr .hub-and-spoke-item .hub-and-spoke-header .hub-and-spoke-nav {\n float: right;\n display: inline-block; }\n .hub-n-spoke-module_hubNSpoke__2WnXr .hub-and-spoke-item .hub-and-spoke-header .hub-and-spoke-nav .button svg {\n vertical-align: middle; }\n .hub-n-spoke-module_hubNSpoke__2WnXr .hub-and-spoke-item .hub-and-spoke-body {\n padding: 10px; }\n .hub-n-spoke-module_hubNSpoke__2WnXr .hub-and-spoke-item .hub-and-spoke-body > * {\n margin: 0 auto; }\n .hub-n-spoke-module_hubNSpoke__2WnXr .hub-and-spoke-item-form {\n height: auto; }\n\n.hub-n-spoke-module_checkComplete__32-PE {\n color: #80D228;\n margin-right: 10px; }\n\n.hub-n-spoke-module_overviewComplete__1yp4e {\n padding: 10px;\n text-align: center; }\n\n.hub-n-spoke-module_overviewCompleteTitle__31Ml3 {\n margin-bottom: 20px; }\n\n.hub-n-spoke-module_overviewCompleteBody__ZUS5x {\n color: #72767b; }\n";
var style$2 = {"hubNSpoke":"hub-n-spoke-module_hubNSpoke__2WnXr","checkComplete":"hub-n-spoke-module_checkComplete__32-PE","overviewComplete":"hub-n-spoke-module_overviewComplete__1yp4e","overviewCompleteTitle":"hub-n-spoke-module_overviewCompleteTitle__31Ml3","overviewCompleteBody":"hub-n-spoke-module_overviewCompleteBody__ZUS5x"};
styleInject(css$4);
var css$1 = ".hub-n-spoke-module_hubNSpoke__2WnXr {\n padding: 10px; }\n .hub-n-spoke-module_hubNSpoke__2WnXr h1.hub-and-spoke-title {\n font-size: 200%;\n margin-bottom: 30px; }\n .hub-n-spoke-module_hubNSpoke__2WnXr .hub-and-spoke-item {\n border: 1px solid #dcdcdc;\n border-radius: 3px;\n background: white; }\n .hub-n-spoke-module_hubNSpoke__2WnXr .hub-and-spoke-item .hub-and-spoke-header {\n border-bottom: 1px solid #f1f1f1;\n margin: 0 0 0 10px;\n display: flex;\n height: 36px; }\n .hub-n-spoke-module_hubNSpoke__2WnXr .hub-and-spoke-item .hub-and-spoke-header h1 {\n font-weight: bold;\n flex-grow: 1;\n line-height: 36px; }\n .hub-n-spoke-module_hubNSpoke__2WnXr .hub-and-spoke-item .hub-and-spoke-header .hub-and-spoke-nav {\n float: right;\n display: inline-block; }\n .hub-n-spoke-module_hubNSpoke__2WnXr .hub-and-spoke-item .hub-and-spoke-header .hub-and-spoke-nav .button svg {\n vertical-align: middle; }\n .hub-n-spoke-module_hubNSpoke__2WnXr .hub-and-spoke-item .hub-and-spoke-body {\n padding: 10px; }\n .hub-n-spoke-module_hubNSpoke__2WnXr .hub-and-spoke-item .hub-and-spoke-body > * {\n margin: 0 auto; }\n .hub-n-spoke-module_hubNSpoke__2WnXr .hub-and-spoke-item-form {\n height: auto; }\n\n.hub-n-spoke-module_checkComplete__32-PE {\n color: #80D228;\n margin-right: 10px; }\n\n.hub-n-spoke-module_overviewComplete__1yp4e {\n padding: 10px;\n text-align: center; }\n\n.hub-n-spoke-module_overviewCompleteTitle__31Ml3 {\n margin-bottom: 20px; }\n\n.hub-n-spoke-module_overviewCompleteBody__ZUS5x {\n color: #72767b; }\n";
var style$1 = {"hubNSpoke":"hub-n-spoke-module_hubNSpoke__2WnXr","checkComplete":"hub-n-spoke-module_checkComplete__32-PE","overviewComplete":"hub-n-spoke-module_overviewComplete__1yp4e","overviewCompleteTitle":"hub-n-spoke-module_overviewCompleteTitle__31Ml3","overviewCompleteBody":"hub-n-spoke-module_overviewCompleteBody__ZUS5x"};
styleInject(css$1);

@@ -463,3 +338,3 @@ var width = {

};
return (createElement("div", { className: style$2.hubNSpoke },
return (createElement("div", { className: style$1.hubNSpoke },
createElement(HubContext.Provider, { value: hub },

@@ -476,7 +351,7 @@ typeof props.title === 'string' &&

function OverviewComplete(props) {
return (createElement("div", { className: style$2.overviewComplete, "aria-label": props.id + " is configured" },
createElement(Title, { size: "lg", className: style$2.overviewCompleteTitle },
createElement(CheckCircleIcon, { className: style$2.checkComplete }),
return (createElement("div", { className: style$1.overviewComplete, "aria-label": props.id + " is configured" },
createElement(Title, { size: "lg", className: style$1.overviewCompleteTitle },
createElement(CheckCircleIcon, { className: style$1.checkComplete }),
props.title),
props.children && (createElement("div", { className: style$2.overviewCompleteBody }, props.children))));
props.children && (createElement("div", { className: style$1.overviewCompleteBody }, props.children))));
}

@@ -490,9 +365,9 @@ function OverviewEmpty(props) {

var css$5 = ".inline-text-input-module_title__1S4-d h1 {\n font-size: 1.6em;\n display: inline; }\n\n.inline-text-input-module_title__1S4-d input {\n width: 200px;\n border: 0;\n border-bottom: 1px solid;\n background: transparent; }\n .inline-text-input-module_title__1S4-d input:hover, .inline-text-input-module_title__1S4-d input:active, .inline-text-input-module_title__1S4-d input:focus {\n outline: none;\n border-bottom-color: #39a5dc; }\n";
var style$3 = {"title":"inline-text-input-module_title__1S4-d"};
styleInject(css$5);
var css$2 = ".inline-text-input-module_title__1S4-d h1 {\n font-size: 1.6em;\n display: inline; }\n\n.inline-text-input-module_title__1S4-d input {\n width: 200px;\n border: 0;\n border-bottom: 1px solid;\n background: transparent; }\n .inline-text-input-module_title__1S4-d input:hover, .inline-text-input-module_title__1S4-d input:active, .inline-text-input-module_title__1S4-d input:focus {\n outline: none;\n border-bottom-color: #39a5dc; }\n";
var style$2 = {"title":"inline-text-input-module_title__1S4-d"};
styleInject(css$2);
function InlineTextInput(props) {
var _a = useState(false), hint = _a[0], setHint = _a[1];
return (React__default.createElement("div", { className: style$3.title },
return (React__default.createElement("div", { className: style$2.title },
React__default.createElement(Text, { component: TextVariants.h1 }, props.prefix),

@@ -504,2 +379,42 @@ React__default.createElement(TextInput, __assign({}, props, { type: "text", onMouseEnter: function () { return setHint(!hint); }, onMouseLeave: function () { return setHint(!hint); } })),

export { AlertError, AnalyticsContext, ButtonLink, DataLoader, DependenciesPicker, DescriptiveHeader, ExternalLink, FormPanel, GAVPicker, GoogleAnalytics, Hint, HubContext, HubNSpoke, HubOverviewCard, InlineTextInput, LaunchTextInput, Loader, OverviewComplete, OverviewEmpty, Separator, SpecialValue, Spin, TogglePanel, effectSafety, optionalBool, useAnalytics };
function ExtendedTextInput(props) {
var _a = useState(false), isDirty = _a[0], setIsDirty = _a[1];
var onChange = props.onChange, isValid = props.isValid, helperTextInvalid = props.helperTextInvalid, label = props.label, rest = __rest(props, ["onChange", "isValid", "helperTextInvalid", "label"]);
var analytics = useAnalytics();
return (React__default.createElement(FormGroup, { fieldId: props.id, label: label, isValid: isValid || !isDirty, helperTextInvalid: helperTextInvalid },
React__default.createElement(TextInput, __assign({ onChange: function (value, event) {
if (!isDirty) {
analytics.event('Input', 'Customized-Value', props.id);
}
setIsDirty(true);
if (onChange) {
onChange(value, event);
}
}, isValid: isValid || !isDirty }, rest))));
}
var css$3 = ".toggle-panel {\n overflow: hidden; }\n .toggle-panel.vertical {\n max-height: 0;\n transition: max-height 0.25s ease-in-out; }\n .toggle-panel.vertical.open {\n max-height: 1000px; }\n .toggle-panel.horizontal {\n visibility: hidden; }\n .toggle-panel.horizontal.open {\n visibility: visible; }\n .toggle-panel button {\n text-transform: uppercase; }\n";
styleInject(css$3);
function TogglePanel(props) {
var _a = useSessionStorageWithObject(props.id, false), open = _a[0], setOpen = _a[1];
var mode = props.mode || 'vertical';
var CloseIcon = mode === 'horizontal' ? React__default.createElement(CaretSquareLeftIcon, null) : React__default.createElement(CaretSquareUpIcon, null);
var OpenIcon = mode === 'horizontal' ? React__default.createElement(CaretSquareRightIcon, null) : React__default.createElement(CaretSquareDownIcon, null);
return (React__default.createElement(Fragment, null,
React__default.createElement("div", { className: "toggle-panel " + mode + " " + (open ? 'open' : '') }, props.children),
React__default.createElement("div", { className: "toggle-button" },
React__default.createElement(Button
// @ts-ignore
, {
// @ts-ignore
component: "a", variant: "link", "aria-label": "Toggle panel", onClick: function () { return setOpen(!open); } }, open ? (React__default.createElement("span", null,
CloseIcon,
" ",
props.closeLabel || 'Close')) : (React__default.createElement("span", null,
OpenIcon,
" ",
props.openLabel || 'Open'))))));
}
export { AlertError, AnalyticsContext, ButtonLink, DataLoader, DescriptiveHeader, ExtendedTextInput, ExternalLink, FormPanel, GoogleAnalytics, Hint, HubContext, HubNSpoke, HubOverviewCard, InlineTextInput, Loader, OverviewComplete, OverviewEmpty, Separator, SpecialValue, Spin, TogglePanel, effectSafety, optionalBool, useAnalytics };

@@ -257,127 +257,2 @@ 'use strict';

function LaunchTextInput(props) {
var _a = React.useState(false), isDirty = _a[0], setIsDirty = _a[1];
var onChange = props.onChange, isValid = props.isValid, helperTextInvalid = props.helperTextInvalid, label = props.label, rest = __rest(props, ["onChange", "isValid", "helperTextInvalid", "label"]);
var analytics = useAnalytics();
return (React__default.createElement(reactCore.FormGroup, { fieldId: props.id, label: label, isValid: isValid || !isDirty, helperTextInvalid: helperTextInvalid },
React__default.createElement(reactCore.TextInput, __assign({ onChange: function (value, event) {
if (!isDirty) {
analytics.event('Input', 'Customized-Value', props.id);
}
setIsDirty(true);
if (onChange) {
onChange(value, event);
}
}, isValid: isValid || !isDirty }, rest))));
}
var css$1 = ".toggle-panel {\n overflow: hidden; }\n .toggle-panel.vertical {\n max-height: 0;\n transition: max-height 0.25s ease-in-out; }\n .toggle-panel.vertical.open {\n max-height: 1000px; }\n .toggle-panel.horizontal {\n visibility: hidden; }\n .toggle-panel.horizontal.open {\n visibility: visible; }\n .toggle-panel button {\n text-transform: uppercase; }\n";
styleInject(css$1);
function TogglePanel(props) {
var _a = reactUseSessionstorage.useSessionStorageWithObject(props.id, false), open = _a[0], setOpen = _a[1];
var mode = props.mode || 'vertical';
var CloseIcon = mode === 'horizontal' ? React__default.createElement(reactIcons.CaretSquareLeftIcon, null) : React__default.createElement(reactIcons.CaretSquareUpIcon, null);
var OpenIcon = mode === 'horizontal' ? React__default.createElement(reactIcons.CaretSquareRightIcon, null) : React__default.createElement(reactIcons.CaretSquareDownIcon, null);
return (React__default.createElement(React.Fragment, null,
React__default.createElement("div", { className: "toggle-panel " + mode + " " + (open ? 'open' : '') }, props.children),
React__default.createElement("div", { className: "toggle-button" },
React__default.createElement(reactCore.Button
// @ts-ignore
, {
// @ts-ignore
component: "a", variant: "link", "aria-label": "Toggle panel", onClick: function () { return setOpen(!open); } }, open ? (React__default.createElement("span", null,
CloseIcon,
" ",
props.closeLabel || 'Close')) : (React__default.createElement("span", null,
OpenIcon,
" ",
props.openLabel || 'Open'))))));
}
var css$2 = ".gav-picker.horizontal {\n display: flex; }\n .gav-picker.horizontal .base-settings {\n order: 1;\n flex-grow: 1;\n padding: 0 10px;\n align-self: flex-start; }\n .gav-picker.horizontal .toggle-panel {\n align-self: flex-start;\n order: 4;\n flex-grow: 1;\n padding: 0 10px; }\n .gav-picker.horizontal .toggle-panel.open {\n order: 2; }\n .gav-picker.horizontal .toggle-button {\n flex-shrink: 1;\n order: 3;\n align-self: flex-end;\n padding: 0 10px; }\n";
styleInject(css$2);
var VALUE_REGEXP = /^[a-z][a-z0-9-.]{3,63}$/;
var GAVPicker = {
checkCompletion: function (value) { return !!value.groupId && VALUE_REGEXP.test(value.groupId)
&& !!value.artifactId && VALUE_REGEXP.test(value.artifactId) && !!value.version; },
Element: function (props) {
var isValid = function (value) { return !!value && VALUE_REGEXP.test(value || ''); };
var visibleFields = props.visibleFields ? new Set(props.visibleFields)
: new Set(['groupId', 'artifactId', 'version', 'description', 'packageName']);
var mode = props.mode || 'vertical';
return (React__default.createElement("div", { className: "gav-picker " + mode },
React__default.createElement("div", { className: "base-settings pf-c-form" },
visibleFields.has('groupId') && React__default.createElement(LaunchTextInput, { label: "Group", isRequired: true, helperTextInvalid: "Please provide a valid groupId", type: "text", id: "groupId", name: "groupId", "aria-label": "Edit groupId", value: props.value.groupId || '', onChange: function (value) { return props.onChange(__assign({}, props.value, { groupId: value })); }, pattern: VALUE_REGEXP.source, isValid: isValid(props.value.groupId) }),
visibleFields.has('artifactId') && React__default.createElement(LaunchTextInput, { label: "Artifact", isRequired: true, helperTextInvalid: "Please provide a valid artifactId", type: "text", id: "artifactId", name: "artifactId", "aria-label": "Edit artifactId", value: props.value.artifactId || '', onChange: function (value) { return props.onChange(__assign({}, props.value, { artifactId: value })); }, pattern: VALUE_REGEXP.source, isValid: isValid(props.value.artifactId) })),
optionalBool(props.showMoreOptions, true) && (React__default.createElement(TogglePanel, { id: "gav-extended", mode: mode, openLabel: "Configure more options" },
React__default.createElement("div", { className: "extended-settings pf-c-form" },
visibleFields.has('version') && React__default.createElement(LaunchTextInput, { label: "Version", helperTextInvalid: "Please provide a version number", isRequired: true, type: "text", id: "version", name: "version", "aria-label": "Edit version", value: props.value.version || '', onChange: function (value) { return props.onChange(__assign({}, props.value, { version: value })); }, isValid: !!props.value.version }),
visibleFields.has('description') && React__default.createElement(LaunchTextInput, { label: "Description", helperTextInvalid: "Please provide a description", isRequired: true, type: "text", id: "description", name: "description", "aria-label": "Edit description", value: props.value.description || '', onChange: function (value) { return props.onChange(__assign({}, props.value, { description: value })); }, isValid: true }),
visibleFields.has('packageName') && React__default.createElement(LaunchTextInput, { label: "Package Name", helperTextInvalid: "Please provide a package name", isRequired: true, type: "text", id: "packageName", name: "packageName", "aria-label": "Edit package name", value: props.value.packageName || '', onChange: function (value) { return props.onChange(__assign({}, props.value, { packageName: value })); }, isValid: true }))))));
}
};
var css$3 = ".dependencies-module_dependencyList__wjKCR .dependencies-module_item__1F7Xw {\n border: 2px solid #f7f7f7;\n line-height: 24px;\n padding: 8px 40px 8px 16px;\n margin: 8px 0;\n border-radius: 4px;\n cursor: pointer; }\n .dependencies-module_dependencyList__wjKCR .dependencies-module_item__1F7Xw h1 {\n display: inline-block;\n font-weight: 600; }\n .dependencies-module_dependencyList__wjKCR .dependencies-module_item__1F7Xw .dependencies-module_icon__2K-Rx {\n position: absolute;\n top: 0;\n bottom: 0;\n right: 0;\n left: 0;\n margin: auto 100%; }\n\n.dependencies-module_dependencyList__wjKCR .dependencies-module_active__qO8_m {\n background-color: #bee1f4; }\n\n.dependencies-module_dependencyList__wjKCR .dependencies-module_category__3cP26 {\n color: #06c;\n padding-left: 10px; }\n";
var style$1 = {"dependencyList":"dependencies-module_dependencyList__wjKCR","item":"dependencies-module_item__1F7Xw","icon":"dependencies-module_icon__2K-Rx","active":"dependencies-module_active__qO8_m","category":"dependencies-module_category__3cP26"};
styleInject(css$3);
var OperationType;
(function (OperationType) {
OperationType[OperationType["Add"] = 1] = "Add";
OperationType[OperationType["Remove"] = 2] = "Remove";
})(OperationType || (OperationType = {}));
function DependencyItemComponent(props) {
var _a = React.useState(false), active = _a[0], setActive = _a[1];
var onClick = function () {
props.onClick(props.id);
};
return (React__default.createElement("div", { className: style$1.item + " " + (active ? style$1.active : '') + " dependency-item", onMouseEnter: function () { return setActive(true); }, onMouseLeave: function () { return setActive(false); }, onClick: onClick },
React__default.createElement(reactCore.Stack, { style: { position: 'relative' } },
React__default.createElement(reactCore.StackItem, { isFilled: true },
React__default.createElement(reactCore.Title, { size: "sm", "aria-label": "Pick " + props.id + " dependency" }, props.name),
React__default.createElement("span", { className: style$1.category }, props.metadata.category),
active && (props.operation === OperationType.Add ?
React__default.createElement(reactIcons.PlusIcon, { className: style$1.icon }) : React__default.createElement(reactIcons.TimesIcon, { className: style$1.icon }))),
React__default.createElement(reactCore.StackItem, { isFilled: false }, props.description))));
}
var DependenciesPicker = {
checkCompletion: function (value) { return !!value.dependencies && value.dependencies.length > 0; },
Element: function (props) {
var _a = React.useState(''), filter = _a[0], setFilter = _a[1];
var analytics = useAnalytics();
var dependencies = props.value.dependencies || [];
var dependenciesSet = new Set(dependencies);
var dependencyItemById = new Map(props.items.map(function (item) { return [item.id, item]; }));
var addDep = function (id) {
dependenciesSet.add(id);
props.onChange({ dependencies: Array.from(dependenciesSet) });
analytics.event('Picker', 'Add-Dependency', id);
};
var removeDep = function (id) {
dependenciesSet.delete(id);
props.onChange({ dependencies: Array.from(dependenciesSet) });
analytics.event('Picker', 'Remove-Dependency', id);
};
var filterFunction = function (d) {
return filter !== '' && (d.description.toLowerCase().includes(filter.toLowerCase())
|| d.name.toLowerCase().includes(filter.toLowerCase())
|| d.metadata.category.toLowerCase().includes(filter.toLowerCase()));
};
var result = props.items.filter(filterFunction);
var categories = new Set(props.items.map(function (i) { return i.metadata.category; }));
return (React__default.createElement(reactCore.Grid, { gutter: "md", className: "dependencies-picker" },
React__default.createElement(reactCore.GridItem, { sm: 12, md: 6 },
React__default.createElement(reactCore.Tooltip, { position: "right", content: "" + Array.from(categories).join(', ') },
React__default.createElement(reactCore.TextInput, { "aria-label": "Search dependencies", placeholder: props.placeholder, className: "search-depencencies-input", value: filter, onChange: function (value) { return setFilter(value); } })),
React__default.createElement("div", { "aria-label": "Select dependencies", className: style$1.dependencyList + " available-dependencies" },
result.map(function (dep, i) { return (React__default.createElement(DependencyItemComponent, __assign({ operation: OperationType.Add }, dep, { key: i, onClick: addDep }))); }),
filter && !result.length && React__default.createElement(reactCore.Title, { size: "xs", style: { paddingTop: '10px' } }, "No result."))),
dependencies.length > 0 && (React__default.createElement(reactCore.GridItem, { sm: 12, md: 6 },
React__default.createElement(reactCore.Title, { size: "md" }, "Selected:"),
React__default.createElement("div", { className: style$1.dependencyList + " selected-dependencies" }, dependencies.map(function (selected, i) { return (React__default.createElement(DependencyItemComponent, __assign({ operation: OperationType.Remove }, dependencyItemById.get(selected), { key: i, onClick: removeDep }))); }))))));
}
};
function FormPanel(props) {

@@ -407,5 +282,5 @@ var _a = React.useState(props.initialValue), value = _a[0], onChange = _a[1];

var css$4 = ".hub-n-spoke-module_hubNSpoke__2WnXr {\n padding: 10px; }\n .hub-n-spoke-module_hubNSpoke__2WnXr h1.hub-and-spoke-title {\n font-size: 200%;\n margin-bottom: 30px; }\n .hub-n-spoke-module_hubNSpoke__2WnXr .hub-and-spoke-item {\n border: 1px solid #dcdcdc;\n border-radius: 3px;\n background: white; }\n .hub-n-spoke-module_hubNSpoke__2WnXr .hub-and-spoke-item .hub-and-spoke-header {\n border-bottom: 1px solid #f1f1f1;\n margin: 0 0 0 10px;\n display: flex;\n height: 36px; }\n .hub-n-spoke-module_hubNSpoke__2WnXr .hub-and-spoke-item .hub-and-spoke-header h1 {\n font-weight: bold;\n flex-grow: 1;\n line-height: 36px; }\n .hub-n-spoke-module_hubNSpoke__2WnXr .hub-and-spoke-item .hub-and-spoke-header .hub-and-spoke-nav {\n float: right;\n display: inline-block; }\n .hub-n-spoke-module_hubNSpoke__2WnXr .hub-and-spoke-item .hub-and-spoke-header .hub-and-spoke-nav .button svg {\n vertical-align: middle; }\n .hub-n-spoke-module_hubNSpoke__2WnXr .hub-and-spoke-item .hub-and-spoke-body {\n padding: 10px; }\n .hub-n-spoke-module_hubNSpoke__2WnXr .hub-and-spoke-item .hub-and-spoke-body > * {\n margin: 0 auto; }\n .hub-n-spoke-module_hubNSpoke__2WnXr .hub-and-spoke-item-form {\n height: auto; }\n\n.hub-n-spoke-module_checkComplete__32-PE {\n color: #80D228;\n margin-right: 10px; }\n\n.hub-n-spoke-module_overviewComplete__1yp4e {\n padding: 10px;\n text-align: center; }\n\n.hub-n-spoke-module_overviewCompleteTitle__31Ml3 {\n margin-bottom: 20px; }\n\n.hub-n-spoke-module_overviewCompleteBody__ZUS5x {\n color: #72767b; }\n";
var style$2 = {"hubNSpoke":"hub-n-spoke-module_hubNSpoke__2WnXr","checkComplete":"hub-n-spoke-module_checkComplete__32-PE","overviewComplete":"hub-n-spoke-module_overviewComplete__1yp4e","overviewCompleteTitle":"hub-n-spoke-module_overviewCompleteTitle__31Ml3","overviewCompleteBody":"hub-n-spoke-module_overviewCompleteBody__ZUS5x"};
styleInject(css$4);
var css$1 = ".hub-n-spoke-module_hubNSpoke__2WnXr {\n padding: 10px; }\n .hub-n-spoke-module_hubNSpoke__2WnXr h1.hub-and-spoke-title {\n font-size: 200%;\n margin-bottom: 30px; }\n .hub-n-spoke-module_hubNSpoke__2WnXr .hub-and-spoke-item {\n border: 1px solid #dcdcdc;\n border-radius: 3px;\n background: white; }\n .hub-n-spoke-module_hubNSpoke__2WnXr .hub-and-spoke-item .hub-and-spoke-header {\n border-bottom: 1px solid #f1f1f1;\n margin: 0 0 0 10px;\n display: flex;\n height: 36px; }\n .hub-n-spoke-module_hubNSpoke__2WnXr .hub-and-spoke-item .hub-and-spoke-header h1 {\n font-weight: bold;\n flex-grow: 1;\n line-height: 36px; }\n .hub-n-spoke-module_hubNSpoke__2WnXr .hub-and-spoke-item .hub-and-spoke-header .hub-and-spoke-nav {\n float: right;\n display: inline-block; }\n .hub-n-spoke-module_hubNSpoke__2WnXr .hub-and-spoke-item .hub-and-spoke-header .hub-and-spoke-nav .button svg {\n vertical-align: middle; }\n .hub-n-spoke-module_hubNSpoke__2WnXr .hub-and-spoke-item .hub-and-spoke-body {\n padding: 10px; }\n .hub-n-spoke-module_hubNSpoke__2WnXr .hub-and-spoke-item .hub-and-spoke-body > * {\n margin: 0 auto; }\n .hub-n-spoke-module_hubNSpoke__2WnXr .hub-and-spoke-item-form {\n height: auto; }\n\n.hub-n-spoke-module_checkComplete__32-PE {\n color: #80D228;\n margin-right: 10px; }\n\n.hub-n-spoke-module_overviewComplete__1yp4e {\n padding: 10px;\n text-align: center; }\n\n.hub-n-spoke-module_overviewCompleteTitle__31Ml3 {\n margin-bottom: 20px; }\n\n.hub-n-spoke-module_overviewCompleteBody__ZUS5x {\n color: #72767b; }\n";
var style$1 = {"hubNSpoke":"hub-n-spoke-module_hubNSpoke__2WnXr","checkComplete":"hub-n-spoke-module_checkComplete__32-PE","overviewComplete":"hub-n-spoke-module_overviewComplete__1yp4e","overviewCompleteTitle":"hub-n-spoke-module_overviewCompleteTitle__31Ml3","overviewCompleteBody":"hub-n-spoke-module_overviewCompleteBody__ZUS5x"};
styleInject(css$1);

@@ -470,3 +345,3 @@ var width = {

};
return (React.createElement("div", { className: style$2.hubNSpoke },
return (React.createElement("div", { className: style$1.hubNSpoke },
React.createElement(HubContext.Provider, { value: hub },

@@ -483,7 +358,7 @@ typeof props.title === 'string' &&

function OverviewComplete(props) {
return (React.createElement("div", { className: style$2.overviewComplete, "aria-label": props.id + " is configured" },
React.createElement(reactCore.Title, { size: "lg", className: style$2.overviewCompleteTitle },
React.createElement(reactIcons.CheckCircleIcon, { className: style$2.checkComplete }),
return (React.createElement("div", { className: style$1.overviewComplete, "aria-label": props.id + " is configured" },
React.createElement(reactCore.Title, { size: "lg", className: style$1.overviewCompleteTitle },
React.createElement(reactIcons.CheckCircleIcon, { className: style$1.checkComplete }),
props.title),
props.children && (React.createElement("div", { className: style$2.overviewCompleteBody }, props.children))));
props.children && (React.createElement("div", { className: style$1.overviewCompleteBody }, props.children))));
}

@@ -497,9 +372,9 @@ function OverviewEmpty(props) {

var css$5 = ".inline-text-input-module_title__1S4-d h1 {\n font-size: 1.6em;\n display: inline; }\n\n.inline-text-input-module_title__1S4-d input {\n width: 200px;\n border: 0;\n border-bottom: 1px solid;\n background: transparent; }\n .inline-text-input-module_title__1S4-d input:hover, .inline-text-input-module_title__1S4-d input:active, .inline-text-input-module_title__1S4-d input:focus {\n outline: none;\n border-bottom-color: #39a5dc; }\n";
var style$3 = {"title":"inline-text-input-module_title__1S4-d"};
styleInject(css$5);
var css$2 = ".inline-text-input-module_title__1S4-d h1 {\n font-size: 1.6em;\n display: inline; }\n\n.inline-text-input-module_title__1S4-d input {\n width: 200px;\n border: 0;\n border-bottom: 1px solid;\n background: transparent; }\n .inline-text-input-module_title__1S4-d input:hover, .inline-text-input-module_title__1S4-d input:active, .inline-text-input-module_title__1S4-d input:focus {\n outline: none;\n border-bottom-color: #39a5dc; }\n";
var style$2 = {"title":"inline-text-input-module_title__1S4-d"};
styleInject(css$2);
function InlineTextInput(props) {
var _a = React.useState(false), hint = _a[0], setHint = _a[1];
return (React__default.createElement("div", { className: style$3.title },
return (React__default.createElement("div", { className: style$2.title },
React__default.createElement(reactCore.Text, { component: reactCore.TextVariants.h1 }, props.prefix),

@@ -511,2 +386,42 @@ React__default.createElement(reactCore.TextInput, __assign({}, props, { type: "text", onMouseEnter: function () { return setHint(!hint); }, onMouseLeave: function () { return setHint(!hint); } })),

function ExtendedTextInput(props) {
var _a = React.useState(false), isDirty = _a[0], setIsDirty = _a[1];
var onChange = props.onChange, isValid = props.isValid, helperTextInvalid = props.helperTextInvalid, label = props.label, rest = __rest(props, ["onChange", "isValid", "helperTextInvalid", "label"]);
var analytics = useAnalytics();
return (React__default.createElement(reactCore.FormGroup, { fieldId: props.id, label: label, isValid: isValid || !isDirty, helperTextInvalid: helperTextInvalid },
React__default.createElement(reactCore.TextInput, __assign({ onChange: function (value, event) {
if (!isDirty) {
analytics.event('Input', 'Customized-Value', props.id);
}
setIsDirty(true);
if (onChange) {
onChange(value, event);
}
}, isValid: isValid || !isDirty }, rest))));
}
var css$3 = ".toggle-panel {\n overflow: hidden; }\n .toggle-panel.vertical {\n max-height: 0;\n transition: max-height 0.25s ease-in-out; }\n .toggle-panel.vertical.open {\n max-height: 1000px; }\n .toggle-panel.horizontal {\n visibility: hidden; }\n .toggle-panel.horizontal.open {\n visibility: visible; }\n .toggle-panel button {\n text-transform: uppercase; }\n";
styleInject(css$3);
function TogglePanel(props) {
var _a = reactUseSessionstorage.useSessionStorageWithObject(props.id, false), open = _a[0], setOpen = _a[1];
var mode = props.mode || 'vertical';
var CloseIcon = mode === 'horizontal' ? React__default.createElement(reactIcons.CaretSquareLeftIcon, null) : React__default.createElement(reactIcons.CaretSquareUpIcon, null);
var OpenIcon = mode === 'horizontal' ? React__default.createElement(reactIcons.CaretSquareRightIcon, null) : React__default.createElement(reactIcons.CaretSquareDownIcon, null);
return (React__default.createElement(React.Fragment, null,
React__default.createElement("div", { className: "toggle-panel " + mode + " " + (open ? 'open' : '') }, props.children),
React__default.createElement("div", { className: "toggle-button" },
React__default.createElement(reactCore.Button
// @ts-ignore
, {
// @ts-ignore
component: "a", variant: "link", "aria-label": "Toggle panel", onClick: function () { return setOpen(!open); } }, open ? (React__default.createElement("span", null,
CloseIcon,
" ",
props.closeLabel || 'Close')) : (React__default.createElement("span", null,
OpenIcon,
" ",
props.openLabel || 'Open'))))));
}
exports.AlertError = AlertError;

@@ -516,7 +431,6 @@ exports.AnalyticsContext = AnalyticsContext;

exports.DataLoader = DataLoader;
exports.DependenciesPicker = DependenciesPicker;
exports.DescriptiveHeader = DescriptiveHeader;
exports.ExtendedTextInput = ExtendedTextInput;
exports.ExternalLink = ExternalLink;
exports.FormPanel = FormPanel;
exports.GAVPicker = GAVPicker;
exports.GoogleAnalytics = GoogleAnalytics;

@@ -528,3 +442,2 @@ exports.Hint = Hint;

exports.InlineTextInput = InlineTextInput;
exports.LaunchTextInput = LaunchTextInput;
exports.Loader = Loader;

@@ -531,0 +444,0 @@ exports.OverviewComplete = OverviewComplete;

/// <reference types="react" />
import { TextInputProps } from '@patternfly/react-core';
interface LaunchTextInputProps extends TextInputProps {
interface ExtendedTextInputProps extends TextInputProps {
id: string;
helperTextInvalid: string;
}
export declare function LaunchTextInput(props: LaunchTextInputProps): JSX.Element;
export declare function ExtendedTextInput(props: ExtendedTextInputProps): JSX.Element;
export {};
export * from './analytics';
export * from './core/data-loader/data-loader';
export * from './pickers/gav-picker';
export * from './pickers/dependencies-picker';
export * from './core/stuff';

@@ -6,0 +4,0 @@ export * from './core/types';

{
"name": "@launcher/component",
"version": "2.0.5",
"version": "2.0.6",
"license": "Apache-2.0",

@@ -50,3 +50,3 @@ "main": "build/index.js",

},
"gitHead": "795cd966325c53823de33ed3f97f4f865c16e3f3"
"gitHead": "2a0a9c06330403ac97f1d4314d5e431cc7d8c53e"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc