@indico-data/design-system 2.0.3 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/.commitlintrc.ts +13 -0
  2. package/.harness/pipeline.yaml +1 -1
  3. package/.releaserc.json +16 -1
  4. package/README.md +47 -26
  5. package/lib/index.css +84 -67
  6. package/lib/index.d.ts +49 -156
  7. package/lib/index.esm.css +84 -67
  8. package/lib/index.esm.js +1 -287
  9. package/lib/index.esm.js.map +1 -1
  10. package/lib/index.js +0 -291
  11. package/lib/index.js.map +1 -1
  12. package/lib/legacy/components/index.d.ts +0 -2
  13. package/package.json +4 -3
  14. package/src/components/button/{Button.scss → styles/Button.scss} +5 -69
  15. package/src/components/button/styles/_variables.scss +89 -0
  16. package/src/index.ts +0 -5
  17. package/src/legacy/components/index.ts +0 -2
  18. package/src/styles/index.scss +1 -1
  19. package/src/styles/variables/themes/dark.scss +70 -74
  20. package/src/stylesAndAnimations/colors/constants.ts +60 -60
  21. package/lib/legacy/components/Wizard/Wizard.d.ts +0 -48
  22. package/lib/legacy/components/Wizard/Wizard.stories.d.ts +0 -29
  23. package/lib/legacy/components/Wizard/Wizard.styles.d.ts +0 -4
  24. package/lib/legacy/components/Wizard/index.d.ts +0 -2
  25. package/lib/legacy/components/WizardWithSidebar/WizardWithSidebar.d.ts +0 -58
  26. package/lib/legacy/components/WizardWithSidebar/WizardWithSidebar.stories.d.ts +0 -46
  27. package/lib/legacy/components/WizardWithSidebar/WizardWithSidebar.styles.d.ts +0 -9
  28. package/lib/legacy/components/WizardWithSidebar/index.d.ts +0 -2
  29. package/src/legacy/components/Wizard/Wizard.stories.tsx +0 -180
  30. package/src/legacy/components/Wizard/Wizard.styles.ts +0 -72
  31. package/src/legacy/components/Wizard/Wizard.tsx +0 -211
  32. package/src/legacy/components/Wizard/index.ts +0 -2
  33. package/src/legacy/components/WizardWithSidebar/WizardWithSidebar.stories.tsx +0 -143
  34. package/src/legacy/components/WizardWithSidebar/WizardWithSidebar.styles.ts +0 -107
  35. package/src/legacy/components/WizardWithSidebar/WizardWithSidebar.tsx +0 -278
  36. package/src/legacy/components/WizardWithSidebar/index.ts +0 -2
package/lib/index.esm.js CHANGED
@@ -24102,292 +24102,6 @@ function LoadingAwareContainer(props) {
24102
24102
  return (jsxs(StyledLoadingAwareContainer, { className: y({ loading: isLoading }, className), style: style, children: [jsx(StyledStatusContainer, { role: "status", children: isLoading && 'Loading' }), isLoading ? jsx(LoadingIndicator, {}) : jsx(Fragment, { children: children })] }));
24103
24103
  }
24104
24104
 
24105
- const StyledWizard = styled.div `
24106
- nav {
24107
- display: flex;
24108
- align-items: center;
24109
- justify-content: space-between;
24110
-
24111
- margin-bottom: 24px;
24112
-
24113
- // override for some styling in AppChrome IPA component
24114
- padding-left: 0 !important;
24115
- padding-right: 0 !important;
24116
- }
24117
-
24118
- h1 {
24119
- margin-bottom: 0;
24120
- }
24121
-
24122
- .wizard-buttons {
24123
- display: flex;
24124
- align-items: center;
24125
-
24126
- font-size: ${typography.fontSize.subheadLarge};
24127
-
24128
- button.link-style {
24129
- font-size: inherit;
24130
- margin-right: 1em;
24131
- }
24132
- }
24133
- `;
24134
- const commonPadding = '20px';
24135
- // todo: permafrost: move into css fragment at top level
24136
- const WizardCard = styled.div `
24137
- width: 100%;
24138
- padding: 14px ${commonPadding};
24139
-
24140
- background-color: ${allColors.clay};
24141
- border: 1px solid ${allColors.oxfordBlue};
24142
- border-radius: 4px;
24143
- box-shadow: 1px 1px 1px 0 ${allColors.ebony};
24144
- `;
24145
- const WizardSection = styled.div `
24146
- .section-heading {
24147
- margin-bottom: 0;
24148
- // todo: store value elsewhere
24149
- font-size: 22px;
24150
- color: ${allColors.lightFontColor};
24151
-
24152
- .supporting-text {
24153
- font-size: ${typography.fontSize.subheadLarge};
24154
- color: ${allColors.defaultFontColor};
24155
- }
24156
- }
24157
-
24158
- .section-content {
24159
- padding: ${commonPadding};
24160
- }
24161
-
24162
- :not(:last-of-type) {
24163
- margin-bottom: ${commonPadding};
24164
-
24165
- .section-content {
24166
- border-bottom: 1px solid ${allColors.ebony};
24167
- }
24168
- }
24169
- `;
24170
-
24171
- const commonButtonProps = {
24172
- size: 'large',
24173
- };
24174
- function Wizard(props) {
24175
- const { children, className, confirmCancel, disableNextStep, disablePrevStep, disableSubmit, id, isLastStep, onCancel, onNextPress, onStepChange, onSubmit, startingStep, steps, submitButtonLabel, submitProcessing = '', wizardTitle, nextButtonProps, } = props;
24176
- const [currentStep, setCurrentStep] = useState(startingStep || steps[0]);
24177
- const [openCancelConfirm, setOpenCancelConfirm] = useState(false);
24178
- const onLastStep = useMemo(() => {
24179
- if (isLastStep !== undefined) {
24180
- return isLastStep;
24181
- }
24182
- return steps.indexOf(currentStep) === steps.length - 1;
24183
- }, [isLastStep, steps, currentStep]);
24184
- const isBusy = !!(submitProcessing && submitProcessing.length > 0);
24185
- const nextStep = () => {
24186
- if (!onLastStep) {
24187
- const currentIndex = steps.indexOf(currentStep);
24188
- setCurrentStep(steps[currentIndex + 1]);
24189
- }
24190
- };
24191
- const prevStep = () => {
24192
- const currentIndex = steps.indexOf(currentStep);
24193
- if (currentIndex !== 0) {
24194
- setCurrentStep(steps[currentIndex - 1]);
24195
- }
24196
- };
24197
- // handles the user's selection in the cancel confirmation modal
24198
- const handleCancelRequest = (confirmCancel) => {
24199
- if (confirmCancel && onCancel) {
24200
- onCancel();
24201
- }
24202
- setOpenCancelConfirm(false);
24203
- };
24204
- const handleNextPress = () => {
24205
- const allowNext = onNextPress ? onNextPress() : true;
24206
- if (!allowNext) {
24207
- return;
24208
- }
24209
- if (onLastStep) {
24210
- handleSubmit();
24211
- }
24212
- else {
24213
- nextStep();
24214
- }
24215
- };
24216
- const handleSubmit = () => {
24217
- onSubmit();
24218
- };
24219
- // report current step to the consuming component
24220
- useEffect(() => {
24221
- onStepChange(currentStep);
24222
- }, [currentStep]);
24223
- // ensures `currentStep` is reset on unmount, just in case
24224
- useEffect(() => {
24225
- return () => setCurrentStep(steps[0] || '');
24226
- }, []);
24227
- return (jsxs(StyledWizard, { className: className, "data-cy": props['data-cy'], id: id, children: [jsxs("nav", { children: [jsxs("h1", { children: [wizardTitle, ": ", currentStep] }), jsxs("div", { className: "wizard-buttons", children: [jsx(Button$2, { onClick: () => setOpenCancelConfirm(true), variant: "link-style", children: "Cancel" }), steps.indexOf(currentStep) !== 0 && (jsx(IconButton, Object.assign({}, commonButtonProps, { iconName: "fa-arrow-left", label: "Previous Step", onPress: prevStep, isDisabled: disablePrevStep }))), onLastStep ? (jsx(IconButton, Object.assign({}, commonButtonProps, { variant: "primary", iconName: "check", busy: isBusy, label: isBusy ? submitProcessing : submitButtonLabel, onPress: handleNextPress, isDisabled: disableSubmit }))) : (jsx(IconButton, Object.assign({}, commonButtonProps, { variant: "primary", iconSide: "end", iconName: "fa-arrow-right", label: "Next Step", onPress: handleNextPress, isDisabled: disableNextStep }, nextButtonProps)))] })] }), jsx(Fragment, { children: children }), jsx(ConfirmModal, { title: confirmCancel.title, message: confirmCancel.message, confirmText: confirmCancel.confirmText, rejectText: confirmCancel.rejectText, open: openCancelConfirm, clickOutsideHandler: () => setOpenCancelConfirm(false), responseHandler: handleCancelRequest })] }));
24228
- }
24229
-
24230
- const StyledWizardWithSidebar = styled.div `
24231
- height: 750px;
24232
- display: flex;
24233
- /* display: flex;
24234
- /* min-height: 455px; */
24235
- background-color: ${(props) => (props.backgroundcolor ? props.backgroundcolor : 'currentColor')};
24236
- color: ${(props) => (props.color ? props.color : 'inherit')};
24237
- border-radius: 4px;
24238
- h2 {
24239
- font-size: ${typography.fontSize.subheadLarge};
24240
- margin-bottom: ${spacings.md};
24241
- color: ${(props) => (props.color ? props.color : 'inherit')};
24242
- font-weight: bold;
24243
- }
24244
-
24245
- .wizard-sidebar {
24246
- width: 245px;
24247
- padding: 30px;
24248
- border-right: 1px solid ${allColors.silverChalice};
24249
-
24250
- .sidebar-step {
24251
- margin-bottom: ${spacings.sm};
24252
- display: flex;
24253
- align-items: center;
24254
- color: ${allColors.silverChalice};
24255
- &.current-step,
24256
- &.prior-step {
24257
- color: ${allColors.black};
24258
- }
24259
-
24260
- &:last-child {
24261
- margin-bottom: 0;
24262
- }
24263
-
24264
- .sidebar-step__check-icon {
24265
- fill: ${allColors.green};
24266
- margin-right: ${spacings.sm};
24267
- width: 24px;
24268
- height: 24px;
24269
- }
24270
-
24271
- .sidebar-step__number-icon {
24272
- margin-right: ${spacings.sm};
24273
- width: 24px;
24274
- height: 24px;
24275
- border-radius: 50%;
24276
- border: 1px solid currentColor;
24277
- display: flex;
24278
- align-items: center;
24279
- justify-content: center;
24280
- font-size: ${typography.fontSize.caption};
24281
- }
24282
- }
24283
- }
24284
-
24285
- .wizard-content__wrapper {
24286
- display: flex;
24287
- justify-content: space-between;
24288
- flex-wrap: wrap;
24289
- flex-direction: column;
24290
- height: 100%;
24291
- }
24292
- .wizard-content {
24293
- width: 100%;
24294
- padding: 30px;
24295
-
24296
- .wizard-content__header {
24297
- flex: 0 0 100%;
24298
- }
24299
- .wizard-content__body {
24300
- flex: 0 0 100%;
24301
- }
24302
- }
24303
-
24304
- .wizard-actions {
24305
- width: 100%;
24306
- display: flex;
24307
- align-items: center;
24308
- justify-content: end;
24309
- }
24310
-
24311
- nav {
24312
- display: flex;
24313
- align-items: center;
24314
- justify-content: end;
24315
- // override for some styling in AppChrome IPA component
24316
- padding-left: 0 !important;
24317
- padding-right: 0 !important;
24318
- margin-top: ${spacings.md};
24319
- }
24320
- .wizard-buttons {
24321
- display: flex;
24322
- align-items: center;
24323
- font-size: ${typography.fontSize.subheadSmall};
24324
- }
24325
- `;
24326
-
24327
- function WizardWithSidebar(props) {
24328
- const { children, className, confirmCancel, disableNextStep, disablePrevStep, disableSubmit, id, isLastStep, onCancel, onNextPress, onStepChange, onSubmit, startingStep, stepSchema, submitButtonLabel, submitProcessing = '', wizardTitle, nextButtonProps, validationErrors, backgroundColor, color, buttonColor, } = props;
24329
- const steps = Object.keys(stepSchema);
24330
- const [currentStep, setCurrentStep] = useState(startingStep || steps[0]);
24331
- const [openCancelConfirm, setOpenCancelConfirm] = useState(false);
24332
- const onLastStep = useMemo(() => {
24333
- if (isLastStep !== undefined) {
24334
- return isLastStep;
24335
- }
24336
- return steps.indexOf(currentStep) === steps.length - 1;
24337
- }, [isLastStep, steps, currentStep]);
24338
- const isBusy = !!(submitProcessing && submitProcessing.length > 0);
24339
- const nextStep = () => {
24340
- if (!onLastStep) {
24341
- const currentIndex = steps.indexOf(currentStep);
24342
- setCurrentStep(steps[currentIndex + 1]);
24343
- }
24344
- };
24345
- const prevStep = () => {
24346
- const currentIndex = steps.indexOf(currentStep);
24347
- if (currentIndex !== 0) {
24348
- setCurrentStep(steps[currentIndex - 1]);
24349
- }
24350
- };
24351
- // handles the user's selection in the cancel confirmation modal
24352
- const handleCancelRequest = (confirmCancel) => {
24353
- if (confirmCancel && onCancel) {
24354
- onCancel();
24355
- }
24356
- setOpenCancelConfirm(false);
24357
- };
24358
- const handleNextPress = () => {
24359
- const allowNext = onNextPress ? onNextPress() : true;
24360
- if (!allowNext) {
24361
- return;
24362
- }
24363
- if (onLastStep) {
24364
- handleSubmit();
24365
- }
24366
- else {
24367
- nextStep();
24368
- }
24369
- };
24370
- const handleSubmit = () => {
24371
- onSubmit();
24372
- };
24373
- // report current step to the consuming component
24374
- useEffect(() => {
24375
- onStepChange(currentStep);
24376
- }, [currentStep]);
24377
- // ensures `currentStep` is reset on unmount, just in case
24378
- useEffect(() => {
24379
- return () => setCurrentStep(steps[0] || '');
24380
- }, []);
24381
- return (jsxs(StyledWizardWithSidebar, { className: className, "data-cy": props['data-cy'], id: id, backgroundcolor: backgroundColor, color: color, buttoncolor: buttonColor, children: [jsxs("div", { className: "wizard-sidebar", children: [jsxs("h2", { children: [" ", wizardTitle] }), steps.map((step, index) => {
24382
- return (jsxs("div", { className: y('sidebar-step', {
24383
- ['current-step']: index === steps.indexOf(currentStep),
24384
- ['prior-step']: index < steps.indexOf(currentStep),
24385
- }), children: [(Object.keys(validationErrors ? validationErrors : []).some((error) => stepSchema[step].inputsRequiringValidation.includes(error)) ||
24386
- index > steps.indexOf(currentStep)) && (jsx("div", { className: "sidebar-step__number-icon", children: index + 1 })), !Object.keys(validationErrors ? validationErrors : []).some((error) => stepSchema[step].inputsRequiringValidation.includes(error)) &&
24387
- index <= steps.indexOf(currentStep) && (jsx(Icon, { name: "fa-check-circle", className: "sidebar-step__check-icon" })), step] }, step));
24388
- })] }), jsx("div", { className: "wizard-content", children: jsxs("div", { className: "wizard-content__wrapper", children: [jsxs("div", { className: "wizard-content__items", children: [jsx("div", { className: "wizard-content__header", children: jsx("h2", { children: currentStep }) }), jsx("div", { className: "wizard-content__body", children: children })] }), jsx("nav", { className: "wizard-actions", children: jsxs("div", { className: "wizard-buttons", children: [jsx(Button, { ariaLabel: "cancel", variant: "text", color: "secondary", onClick: () => setOpenCancelConfirm(true), children: "Cancel" }), steps.indexOf(currentStep) !== 0 && (jsx(Button, { variant: "outline", color: "secondary", iconName: "fa-arrow-left", ariaLabel: "previous step", onClick: prevStep, isDisabled: disablePrevStep, className: "mr-1", children: "Previous Step" })), onLastStep ? (jsx(Button, { ariaLabel: "submit", iconName: "check", color: "secondary", isLoading: isBusy, onClick: handleNextPress, isDisabled: disableSubmit, children: isBusy ? submitProcessing : submitButtonLabel })) : (jsx(Button, Object.assign({ ariaLabel: "next step", iconPosition: "right", color: "secondary", iconName: "fa-arrow-right", onClick: handleNextPress, isDisabled: disableNextStep }, nextButtonProps, { children: "Next Step" })))] }) })] }) }), jsx(ConfirmModal, { title: confirmCancel.title, message: confirmCancel.message, confirmText: confirmCancel.confirmText, rejectText: confirmCancel.rejectText, open: openCancelConfirm, clickOutsideHandler: () => setOpenCancelConfirm(false), responseHandler: handleCancelRequest, width: 430 })] }));
24389
- }
24390
-
24391
24105
  const StyledDrawerLinkList = styled.div `
24392
24106
  .drawer__list {
24393
24107
  white-space: nowrap;
@@ -27234,5 +26948,5 @@ const Col = (_a) => {
27234
26948
  return jsx(build.Col, Object.assign({}, rest));
27235
26949
  };
27236
26950
 
27237
- export { animation as ANIMATION, Radio$1 as AbstractRadio, RadioGroup$1 as AbstractRadioGroup, Accordion, breakpoints as BREAKPOINT, BarSpinner, BorderSelect, Button, allColors as COLORS, CirclePulse, CircleSpinner, Col, ConfirmModal, Container, DatePicker, Drawer, EditableInput, GlobalStyles, Icon, IconButton, Button$2 as LegacyButton, ListTable, LoadingAwareContainer, LoadingList, margin as MARGINS, MATH, mediaQueries as MEDIA_QUERIES, ModalBase, MultiCombobox, NoInputDatePicker, NumberInput, padding as PADDINGS, Pagination, PercentageRing, Radio, RadioGroup, RandomLoadingMessage, Row, spacings as SPACING, SearchInput, Section, SectionBlock, SectionBody, SectionHeader, SectionTable, Select, Shrug, SingleCombobox, StyledWizard, typography as TYPOGRAPHY, TextInput, TextTruncate, Toggle, Tooltip, Wizard, WizardCard, WizardSection, WizardWithSidebar, color as colorUtils, faIcons, indicons, number as numberUtils, string as stringUtils };
26951
+ export { animation as ANIMATION, Radio$1 as AbstractRadio, RadioGroup$1 as AbstractRadioGroup, Accordion, breakpoints as BREAKPOINT, BarSpinner, BorderSelect, Button, allColors as COLORS, CirclePulse, CircleSpinner, Col, ConfirmModal, Container, DatePicker, Drawer, EditableInput, GlobalStyles, Icon, IconButton, Button$2 as LegacyButton, ListTable, LoadingAwareContainer, LoadingList, margin as MARGINS, MATH, mediaQueries as MEDIA_QUERIES, ModalBase, MultiCombobox, NoInputDatePicker, NumberInput, padding as PADDINGS, Pagination, PercentageRing, Radio, RadioGroup, RandomLoadingMessage, Row, spacings as SPACING, SearchInput, Section, SectionBlock, SectionBody, SectionHeader, SectionTable, Select, Shrug, SingleCombobox, typography as TYPOGRAPHY, TextInput, TextTruncate, Toggle, Tooltip, color as colorUtils, faIcons, indicons, number as numberUtils, string as stringUtils };
27238
26952
  //# sourceMappingURL=index.esm.js.map