@carbon/ibm-products 1.2.4 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. package/css/index-full-carbon.css +662 -313
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +2 -2
  4. package/css/index-without-carbon-released-only.css +156 -81
  5. package/css/index-without-carbon-released-only.css.map +1 -1
  6. package/css/index-without-carbon-released-only.min.css +2 -2
  7. package/css/index-without-carbon.css +393 -81
  8. package/css/index-without-carbon.css.map +1 -1
  9. package/css/index-without-carbon.min.css +2 -2
  10. package/css/index.css +615 -81
  11. package/css/index.css.map +1 -1
  12. package/css/index.min.css +2 -2
  13. package/es/components/APIKeyModal/APIKeyModal.js +25 -29
  14. package/es/components/ActionBar/ActionBar.js +4 -1
  15. package/es/components/ActionSet/ActionSet.js +22 -10
  16. package/es/components/ActionSet/actions.js +25 -17
  17. package/es/components/AddSelect/AddSelect.js +157 -0
  18. package/es/components/AddSelect/index.js +7 -0
  19. package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +19 -15
  20. package/es/components/CancelableTextEdit/CancelableTextEdit.js +245 -0
  21. package/es/components/{CreateTearsheet/constants.js → CancelableTextEdit/index.js} +1 -2
  22. package/es/components/CreateFullPage/CreateFullPage.js +102 -258
  23. package/es/components/CreateFullPage/CreateFullPageStep.js +65 -13
  24. package/es/components/CreateFullPage/index.js +1 -2
  25. package/es/components/CreateInfluencer/CreateInfluencer.js +40 -220
  26. package/es/components/CreateTearsheet/CreateTearsheet.js +95 -146
  27. package/es/components/CreateTearsheet/CreateTearsheetStep.js +70 -20
  28. package/es/components/CreateTearsheet/index.js +0 -1
  29. package/es/components/CreateTearsheet/preview-components/MultiStepTearsheet.js +87 -28
  30. package/es/components/CreateTearsheet/preview-components/MultiStepWithIntro.js +8 -6
  31. package/es/components/ExportModal/ExportModal.js +41 -12
  32. package/es/components/ImportModal/ImportModal.js +2 -1
  33. package/es/components/InlineEdit/InlineEdit.js +224 -0
  34. package/es/components/InlineEdit/index.js +7 -0
  35. package/es/components/MultiAddSelect/MultiAddSelect.js +16 -0
  36. package/es/components/MultiAddSelect/index.js +1 -0
  37. package/es/components/OptionsTile/OptionsTile.js +36 -15
  38. package/es/components/PageHeader/PageHeader.js +54 -33
  39. package/es/components/PageHeader/PageHeaderTitle.js +78 -7
  40. package/es/components/PageHeader/PageHeaderUtils.js +21 -2
  41. package/es/components/RemoveModal/RemoveModal.js +4 -2
  42. package/es/components/SidePanel/SidePanel.js +1 -1
  43. package/es/components/SingleAddSelect/SingleAddSelect.js +15 -0
  44. package/es/components/SingleAddSelect/index.js +1 -0
  45. package/es/components/TagSet/TagSet.js +4 -1
  46. package/es/components/Tearsheet/Tearsheet.js +1 -1
  47. package/es/components/Tearsheet/TearsheetNarrow.js +1 -1
  48. package/es/components/Tearsheet/TearsheetShell.js +1 -1
  49. package/es/components/Toolbar/Toolbar.js +69 -8
  50. package/es/components/index.js +5 -1
  51. package/es/global/js/hooks/index.js +1 -0
  52. package/es/global/js/hooks/useCreateComponentFocus.js +15 -19
  53. package/es/global/js/hooks/useCreateComponentStepChange.js +69 -79
  54. package/es/global/js/hooks/useResetCreateComponent.js +7 -4
  55. package/es/global/js/hooks/useRetrieveStepData.js +51 -0
  56. package/es/global/js/hooks/useValidCreateStepCount.js +4 -7
  57. package/es/global/js/package-settings.js +5 -1
  58. package/es/global/js/utils/lastIndexInArray.js +26 -0
  59. package/es/global/js/utils/story-helper.js +1 -1
  60. package/lib/components/APIKeyModal/APIKeyModal.js +25 -29
  61. package/lib/components/ActionBar/ActionBar.js +4 -1
  62. package/lib/components/ActionSet/ActionSet.js +22 -10
  63. package/lib/components/ActionSet/actions.js +25 -17
  64. package/lib/components/AddSelect/AddSelect.js +178 -0
  65. package/lib/components/AddSelect/index.js +13 -0
  66. package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +18 -14
  67. package/lib/components/CancelableTextEdit/CancelableTextEdit.js +265 -0
  68. package/lib/components/CancelableTextEdit/index.js +13 -0
  69. package/lib/components/CreateFullPage/CreateFullPage.js +102 -258
  70. package/lib/components/CreateFullPage/CreateFullPageStep.js +68 -13
  71. package/lib/components/CreateFullPage/index.js +1 -9
  72. package/lib/components/CreateInfluencer/CreateInfluencer.js +38 -231
  73. package/lib/components/CreateTearsheet/CreateTearsheet.js +97 -148
  74. package/lib/components/CreateTearsheet/CreateTearsheetStep.js +72 -19
  75. package/lib/components/CreateTearsheet/index.js +0 -8
  76. package/lib/components/CreateTearsheet/preview-components/MultiStepTearsheet.js +86 -34
  77. package/lib/components/CreateTearsheet/preview-components/MultiStepWithIntro.js +8 -6
  78. package/lib/components/ExportModal/ExportModal.js +38 -11
  79. package/lib/components/ImportModal/ImportModal.js +2 -1
  80. package/lib/components/InlineEdit/InlineEdit.js +242 -0
  81. package/lib/components/InlineEdit/index.js +13 -0
  82. package/lib/components/MultiAddSelect/MultiAddSelect.js +37 -0
  83. package/lib/components/MultiAddSelect/index.js +13 -0
  84. package/lib/components/OptionsTile/OptionsTile.js +36 -15
  85. package/lib/components/PageHeader/PageHeader.js +54 -33
  86. package/lib/components/PageHeader/PageHeaderTitle.js +87 -9
  87. package/lib/components/PageHeader/PageHeaderUtils.js +21 -2
  88. package/lib/components/RemoveModal/RemoveModal.js +4 -2
  89. package/lib/components/SidePanel/SidePanel.js +1 -1
  90. package/lib/components/SingleAddSelect/SingleAddSelect.js +36 -0
  91. package/lib/components/SingleAddSelect/index.js +13 -0
  92. package/lib/components/TagSet/TagSet.js +4 -1
  93. package/lib/components/Tearsheet/Tearsheet.js +1 -1
  94. package/lib/components/Tearsheet/TearsheetNarrow.js +1 -1
  95. package/lib/components/Tearsheet/TearsheetShell.js +1 -1
  96. package/lib/components/Toolbar/Toolbar.js +69 -6
  97. package/lib/components/index.js +33 -1
  98. package/lib/global/js/hooks/index.js +8 -0
  99. package/lib/global/js/hooks/useCreateComponentFocus.js +15 -19
  100. package/lib/global/js/hooks/useCreateComponentStepChange.js +69 -79
  101. package/lib/global/js/hooks/useResetCreateComponent.js +7 -4
  102. package/lib/global/js/hooks/useRetrieveStepData.js +62 -0
  103. package/lib/global/js/hooks/useValidCreateStepCount.js +4 -7
  104. package/lib/global/js/package-settings.js +5 -1
  105. package/lib/global/js/utils/lastIndexInArray.js +35 -0
  106. package/lib/global/js/utils/story-helper.js +1 -1
  107. package/package.json +22 -22
  108. package/scss/components/AddSelect/_add-select.scss +84 -0
  109. package/scss/components/AddSelect/_index.scss +10 -0
  110. package/scss/components/AddSelect/_storybook-styles.scss +6 -0
  111. package/scss/components/BreadcrumbWithOverflow/_breadcrumb-with-overflow.scss +19 -15
  112. package/scss/components/CancelableTextEdit/_cancelable-text-edit.scss +211 -0
  113. package/{es/components/CreateFullPage/constants.js → scss/components/CancelableTextEdit/_index.scss} +2 -2
  114. package/scss/components/CancelableTextEdit/_storybook-styles.scss +15 -0
  115. package/scss/components/CreateFullPage/_create-full-page.scss +4 -11
  116. package/scss/components/CreateTearsheet/_create-tearsheet.scss +4 -8
  117. package/scss/components/InlineEdit/_index.scss +8 -0
  118. package/scss/components/InlineEdit/_inline-edit.scss +44 -0
  119. package/scss/components/InlineEdit/_storybook-styles.scss +15 -0
  120. package/scss/components/MultiAddSelect/_index.scss +1 -0
  121. package/scss/components/MultiAddSelect/_multi-add-select.scss +1 -0
  122. package/scss/components/MultiAddSelect/_storybook-styles.scss +6 -0
  123. package/scss/components/PageHeader/_page-header.scss +14 -4
  124. package/scss/components/SingleAddSelect/_index.scss +1 -0
  125. package/scss/components/SingleAddSelect/_single-add-select.scss +1 -0
  126. package/scss/components/SingleAddSelect/_storybook-styles.scss +6 -0
  127. package/scss/components/StatusIcon/_status-icon.scss +2 -0
  128. package/scss/components/_index.scss +4 -0
  129. package/es/components/CreateFullPage/CreateFullPageSection.js +0 -53
  130. package/es/components/CreateTearsheet/CreateTearsheetSection.js +0 -83
  131. package/es/components/CreateTearsheet/preview-components/MultiStepWithSectionsTearsheet.js +0 -327
  132. package/es/global/js/utils/hasValidType.js +0 -94
  133. package/lib/components/CreateFullPage/CreateFullPageSection.js +0 -74
  134. package/lib/components/CreateFullPage/constants.js +0 -16
  135. package/lib/components/CreateTearsheet/CreateTearsheetSection.js +0 -105
  136. package/lib/components/CreateTearsheet/constants.js +0 -17
  137. package/lib/components/CreateTearsheet/preview-components/MultiStepWithSectionsTearsheet.js +0 -354
  138. package/lib/global/js/utils/hasValidType.js +0 -110
@@ -16,18 +16,15 @@ var _react = require("react");
16
16
 
17
17
  /**
18
18
  * Logs a warning to console if an invalid number of steps are used with the given CreateComponent
19
- * @param {Function} getCreateComponentSteps
19
+ * @param {number} stepCount
20
20
  * @param {string} componentName
21
21
  */
22
- var useValidCreateStepCount = function useValidCreateStepCount(getCreateComponentSteps, componentName) {
22
+ var useValidCreateStepCount = function useValidCreateStepCount(stepCount, componentName) {
23
23
  (0, _react.useEffect)(function () {
24
- var createSteps = getCreateComponentSteps();
25
- var total = createSteps.length;
26
-
27
- if (total === 1) {
24
+ if (stepCount === 1) {
28
25
  console.warn("".concat(componentName, ": ").concat(componentName, "s with one step are not permitted. If you require only one step, please use either the CreateTearsheetNarrow, CreateSidePanel, or CreateModal components."));
29
26
  }
30
- }, [getCreateComponentSteps, componentName]);
27
+ }, [stepCount, componentName]);
31
28
  };
32
29
 
33
30
  exports.useValidCreateStepCount = useValidCreateStepCount;
@@ -56,6 +56,8 @@ var defaults = {
56
56
  UnauthorizedEmptyState: true,
57
57
  UserProfileImage: true,
58
58
  // other public components not yet reviewed and released:
59
+ MultiAddSelect: false,
60
+ SingleAddSelect: false,
59
61
  LoadingBar: false,
60
62
  ModifiedTabs: false,
61
63
  Toolbar: false,
@@ -63,7 +65,9 @@ var defaults = {
63
65
  ToolbarGroup: false,
64
66
  WebTerminal: false,
65
67
  EditSidePanel: false,
66
- OptionsTile: false
68
+ OptionsTile: false,
69
+ CancelableTextEdit: false,
70
+ InlineEdit: false
67
71
  /* new component flags here - comment used by generate CLI */
68
72
 
69
73
  },
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.lastIndexInArray = void 0;
7
+
8
+ /**
9
+ * Copyright IBM Corp. 2022, 2022
10
+ *
11
+ * This source code is licensed under the Apache-2.0 license found in the
12
+ * LICENSE file in the root directory of this source tree.
13
+ */
14
+
15
+ /**
16
+ * This utility will return the index of the last instance of an
17
+ * item in the given array of objects whose key is equal to the value
18
+ * parameter. If there are no matches, -1 is returned as similar to findIndex
19
+ * @param {Array<Object.*>} array
20
+ * @param {string} key
21
+ * @param {string|boolean|number} value
22
+ */
23
+ var lastIndexInArray = function lastIndexInArray(array, key, value) {
24
+ for (var i = array.length - 1; i >= 0; i--) {
25
+ var _array$i;
26
+
27
+ if (((_array$i = array[i]) === null || _array$i === void 0 ? void 0 : _array$i[key]) === value) {
28
+ return i + 1;
29
+ }
30
+ }
31
+
32
+ return -1;
33
+ };
34
+
35
+ exports.lastIndexInArray = lastIndexInArray;
@@ -31,7 +31,7 @@ var _storyStructure = require("../../../../../core/story-structure");
31
31
  */
32
32
  var getStoryTitle = function getStoryTitle(componentName) {
33
33
  var title = // if the component isn't in the master structure, put it in a lost+found section
34
- (0, _storyStructure.getPathForComponent)('c', componentName) || "Cloud & Cognitive/Lost + found/".concat(componentName); // add a canary tag if the component is public but not normally enabled
34
+ (0, _storyStructure.getPathForComponent)('c', componentName) || "Carbon for IBM Products/Lost + found/".concat(componentName); // add a canary tag if the component is public but not normally enabled
35
35
 
36
36
  return !_packageSettings.default.isComponentEnabled(componentName, true) && _packageSettings.default.isComponentPublic(componentName, true) ? "".concat(title, "#canary") : title;
37
37
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/ibm-products",
3
3
  "description": "Carbon for IBM Products",
4
- "version": "1.2.4",
4
+ "version": "1.5.0",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -46,45 +46,45 @@
46
46
  "generate": "cross-env FORCE_COLOR=1 node scripts/generate",
47
47
  "postinstall": "carbon-telemetry collect --install",
48
48
  "test": "jest --colors",
49
- "//upgrade-dependencies": "# don't upgrade carbon (done globally), react/react-dom (explicit range peer dependency)",
50
- "upgrade-dependencies": "npm-check-updates -u --color --reject '/(carbon|^react$|^react-dom$)/'"
49
+ "//upgrade-dependencies": "# don't upgrade carbon (done globally), react/react-dom (explicit range peer dependency) or chalk (until we can load it as ESM)",
50
+ "upgrade-dependencies": "npm-check-updates -u --dep dev,peer,prod --color --reject '/(carbon|^react$|^react-dom$|^chalk$)/'"
51
51
  },
52
52
  "devDependencies": {
53
- "@babel/cli": "^7.16.0",
54
- "@babel/core": "^7.16.5",
55
- "babel-preset-ibm-cloud-cognitive": "^0.14.2",
56
- "chalk": "^5.0.0",
53
+ "@babel/cli": "^7.16.8",
54
+ "@babel/core": "^7.16.12",
55
+ "babel-preset-ibm-cloud-cognitive": "^0.14.5",
56
+ "chalk": "^4.1.2",
57
57
  "change-case": "^4.1.2",
58
58
  "copyfiles": "^2.4.1",
59
59
  "cross-env": "^7.0.3",
60
60
  "fs-extra": "^10.0.0",
61
61
  "glob": "^7.2.0",
62
- "jest": "^27.4.5",
63
- "jest-config-ibm-cloud-cognitive": "^0.23.3",
64
- "npm-check-updates": "^12.0.5",
62
+ "jest": "^27.4.7",
63
+ "jest-config-ibm-cloud-cognitive": "^0.23.6",
64
+ "npm-check-updates": "^12.2.1",
65
65
  "npm-run-all": "^4.1.5",
66
66
  "rimraf": "^3.0.2",
67
- "sass": "^1.45.1",
67
+ "sass": "^1.49.0",
68
68
  "yargs": "^17.3.1"
69
69
  },
70
70
  "dependencies": {
71
- "@babel/runtime": "^7.16.5",
71
+ "@babel/runtime": "^7.16.7",
72
72
  "@carbon/telemetry": "^0.0.0-alpha.6",
73
- "react-resize-detector": "^6.7.7"
73
+ "react-resize-detector": "^7.0.0"
74
74
  },
75
75
  "peerDependencies": {
76
- "@carbon/colors": "^10.34.0",
77
- "@carbon/icons-react": "^10.42.0",
76
+ "@carbon/colors": "^10.35.0",
77
+ "@carbon/icons-react": "^10.45.0",
78
78
  "@carbon/import-once": "^10.5.0",
79
- "@carbon/layout": "^10.34.0",
80
- "@carbon/motion": "^10.26.0",
81
- "@carbon/themes": "^10.46.0",
82
- "@carbon/type": "^10.38.0",
83
- "carbon-components": "^10.47.1",
84
- "carbon-components-react": "^7.47.2",
79
+ "@carbon/layout": "^10.35.0",
80
+ "@carbon/motion": "^10.27.0",
81
+ "@carbon/themes": "^10.49.0",
82
+ "@carbon/type": "^10.40.0",
83
+ "carbon-components": "^10.51.0",
84
+ "carbon-components-react": "^7.51.0",
85
85
  "carbon-icons": "^7.0.7",
86
86
  "react": "^16.8.6 || ^17.0.1",
87
87
  "react-dom": "^16.8.6 || ^17.0.1"
88
88
  },
89
- "gitHead": "6eeed92e16258acf94397ca8616e5f0486e7d000"
89
+ "gitHead": "c87d8a538026632249a4f6e907b008efb1d50250"
90
90
  }
@@ -0,0 +1,84 @@
1
+ //
2
+ // Copyright IBM Corp. 2021
3
+ //
4
+ // This source code is licensed under the Apache-2.0 license found in the
5
+ // LICENSE file in the root directory of this source tree.
6
+ //
7
+
8
+ // Standard imports.
9
+ @import '../../global/styles/project-settings';
10
+
11
+ @import 'carbon-components/scss/components/structured-list/structured-list';
12
+
13
+ @mixin add-select {
14
+ $block-class: #{$pkg-prefix}--add-select;
15
+ $tearsheet-class: #{$pkg-prefix}--tearsheet;
16
+
17
+ .#{$block-class}__header {
18
+ padding: $spacing-05;
19
+ padding-bottom: 0;
20
+ border-top: 1px solid $ui-03;
21
+ }
22
+
23
+ .#{$block-class}__body {
24
+ padding: $spacing-05;
25
+ }
26
+
27
+ .#{$block-class}__items-label {
28
+ margin-right: $spacing-03;
29
+
30
+ &-container {
31
+ display: flex;
32
+ align-items: center;
33
+ margin-top: $spacing-05;
34
+ margin-bottom: $spacing-03;
35
+ }
36
+ }
37
+
38
+ .#{$block-class}__selections {
39
+ border-top: 1px solid $ui-03;
40
+ }
41
+
42
+ // multi select specific
43
+
44
+ .#{$block-class}__influencer-header {
45
+ display: flex;
46
+ padding: $spacing-06 $spacing-05 $spacing-03 $spacing-05;
47
+ border-bottom: 1px solid $ui-03;
48
+
49
+ .#{$block-class}__influencer-title {
50
+ @include carbon--type-style('productive-heading-02');
51
+ }
52
+ }
53
+
54
+ .#{$block-class}__influencer-title {
55
+ margin-right: $spacing-03;
56
+ }
57
+
58
+ .#{$block-class}__influencer-body {
59
+ padding: $spacing-05;
60
+ }
61
+
62
+ // overrides
63
+
64
+ // the influencer sidebar needs to be even with the buttons
65
+ .#{$block-class} .#{$tearsheet-class} .#{$tearsheet-class}__influencer {
66
+ max-width: 29rem;
67
+ flex: 0 0 50%;
68
+ }
69
+
70
+ .#{$block-class} .#{$block-class}__items-label {
71
+ @include carbon--type-style('productive-heading-01');
72
+ }
73
+
74
+ .#{$block-class}
75
+ .#{$carbon-prefix}--modal-container--sm
76
+ .bx--modal-content
77
+ p {
78
+ padding-right: 0;
79
+ }
80
+ }
81
+
82
+ @include exports('add-select') {
83
+ @include add-select;
84
+ }
@@ -0,0 +1,10 @@
1
+ //
2
+ // Copyright IBM Corp. 2021
3
+ //
4
+ // This source code is licensed under the Apache-2.0 license found in the
5
+ // LICENSE file in the root directory of this source tree.
6
+ //
7
+
8
+ // An index file is most useful when you have multiple components
9
+
10
+ @import './add-select';
@@ -0,0 +1,6 @@
1
+ //
2
+ // Copyright IBM Corp. 2021
3
+ //
4
+ // This source code is licensed under the Apache-2.0 license found in the
5
+ // LICENSE file in the root directory of this source tree.
6
+ //
@@ -32,11 +32,8 @@
32
32
  }
33
33
 
34
34
  .#{$block-class}__breadcrumb-container.#{$block-class}__breadcrumb-container-with-items {
35
- display: none;
35
+ display: inline-flex; // needed to register a width
36
36
  width: 100%;
37
- @include carbon--breakpoint(md) {
38
- display: inline-flex; // needed to register a width
39
- }
40
37
  }
41
38
 
42
39
  .#{$block-class}__breadcrumb-container .#{$carbon-prefix}--breadcrumb {
@@ -50,12 +47,28 @@
50
47
  @include measuring-container;
51
48
  }
52
49
 
50
+ .#{$block-class}__breadcrumb-back {
51
+ display: none;
52
+ }
53
+
54
+ @include carbon--breakpoint-down(md) {
55
+ .#{$carbon-prefix}--breadcrumb-item {
56
+ display: none;
57
+ }
58
+
59
+ .#{$block-class}__breadcrumb-back,
60
+ .#{$carbon-prefix}--breadcrumb-item:last-child {
61
+ display: inline-flex;
62
+ vertical-align: middle;
63
+ }
64
+ }
65
+
53
66
  .#{$carbon-prefix}--breadcrumb-item:last-child {
54
- display: inline;
67
+ display: inline-flex; // flex instead of block due to spacing
55
68
  }
56
69
 
57
70
  .#{$block-class}__displayed-breadcrumb:last-child {
58
- display: inline;
71
+ display: inline-flex; // flex instead of block due to spacing
59
72
  overflow: hidden;
60
73
  }
61
74
 
@@ -69,15 +82,6 @@
69
82
  .#{$carbon-prefix}--link {
70
83
  max-height: 18px; // to match breadcrumb - overflow button is 20 by default
71
84
  }
72
-
73
- .#{$block-class}__breadcrumb-back-button.#{$carbon-prefix}--btn.#{$carbon-prefix}--btn--icon-only.#{$carbon-prefix}--tooltip__trigger {
74
- display: inline-flex;
75
- margin-top: calc(-1 * #{$spacing-04});
76
-
77
- @include carbon--breakpoint(md) {
78
- display: none;
79
- }
80
- }
81
85
  }
82
86
  }
83
87
 
@@ -0,0 +1,211 @@
1
+ //
2
+ // Copyright IBM Corp. 2021, 2021
3
+ //
4
+ // This source code is licensed under the Apache-2.0 license found in the
5
+ // LICENSE file in the root directory of this source tree.
6
+ //
7
+
8
+ // Standard imports.
9
+ @import '../../global/styles/project-settings';
10
+ @import '../../global/styles/mixins';
11
+
12
+ // Other Carbon settings.
13
+ // TODO: @import 'carbon-components/scss/globals/grid/grid'; if needed
14
+
15
+ // CancelableTextEdit uses the following Carbon components:
16
+ // TODO: @import(s) of Carbon component styles used by CancelableTextEdit
17
+
18
+ // CancelableTextEdit uses the following Carbon for IBM Products components:
19
+ // TODO: @import(s) of IBM Products component styles used by CancelableTextEdit
20
+
21
+ @mixin button-states($block-class) {
22
+ .#{$block-class}__revert,
23
+ .#{$block-class}__save {
24
+ border: 1px solid transparent;
25
+
26
+ // input does not have focus
27
+ &:hover {
28
+ border-color: $hover-field;
29
+ border-bottom-color: transparent;
30
+ background-clip: content-box;
31
+ box-shadow: initial;
32
+ outline: initial;
33
+ }
34
+
35
+ &:focus:active,
36
+ &:focus {
37
+ // border focus input does NOT have focus
38
+ border-color: $focus;
39
+ box-shadow: inset 0 0 0 1px $focus;
40
+ outline: initial;
41
+ }
42
+
43
+ &:focus:active:hover {
44
+ box-shadow: inset 0 0 0 1px $focus, inset 0 0 0 2px $field-01;
45
+ }
46
+
47
+ &::before {
48
+ background-color: transparent;
49
+ }
50
+
51
+ &[disabled] {
52
+ border-color: transparent;
53
+ }
54
+ }
55
+
56
+ // invalid affects hover state
57
+ &.#{$block-class}--invalid {
58
+ // invalid does not have focus
59
+ .#{$block-class}__save:hover,
60
+ .#{$block-class}__revert:hover {
61
+ border: 1px solid transparent;
62
+ box-shadow: inset 0 1px 0 $support-01, inset 0 -1px 0 $support-01;
63
+ }
64
+
65
+ .#{$block-class}__save:hover {
66
+ // invalid does not have focus
67
+ box-shadow: inset 0 1px 0 $support-01, inset 0 -1px 0 $support-01,
68
+ inset -1px 0 0 $support-01;
69
+ }
70
+ }
71
+
72
+ // after other button states handle focus within input
73
+ .#{$carbon-prefix}--text-input-wrapper:focus-within
74
+ ~ .#{$block-class}__buttons {
75
+ .#{$block-class}__revert,
76
+ .#{$block-class}__save {
77
+ border: 1px solid transparent;
78
+ box-shadow: inset 0 1px 0 $focus, inset 0 -1px 0 $focus;
79
+ // transition-property: initial; // turn off seems to cause a bit of a visual glitch
80
+ }
81
+
82
+ // button hover state
83
+ .#{$block-class}__revert:hover,
84
+ .#{$block-class}__save:hover {
85
+ background-clip: content-box;
86
+ }
87
+
88
+ .#{$block-class}__save {
89
+ // border hover input has focus or is in error
90
+ box-shadow: inset 0 1px 0 $focus, inset 0 -1px 0 $focus,
91
+ inset -1px 0 0 $focus;
92
+ }
93
+ }
94
+ }
95
+
96
+ // Define all component styles in a mixin which is then exported using
97
+ // the Carbon import-once mechanism.
98
+ @mixin cancelable-text-edit {
99
+ // The block part of our conventional BEM class names (blockClass__E--M).
100
+ $block-class: #{$pkg-prefix}--cancelable-text-edit;
101
+
102
+ .#{$block-class} {
103
+ --size: #{$spacing-08};
104
+ --icon-size: #{$spacing-05};
105
+ }
106
+
107
+ .#{$block-class}--sm {
108
+ --size: #{$spacing-07};
109
+ --icon-size: #{$spacing-05};
110
+ }
111
+
112
+ .#{$block-class}--lg {
113
+ --size: #{$spacing-09};
114
+ --icon-size: #{$spacing-05};
115
+ }
116
+
117
+ // high specificity to override some icon button styles to work like the Carbon search clear button
118
+ // but at sizes of text input
119
+ .#{$block-class}.#{$block-class}.#{$block-class} {
120
+ .#{$block-class}__main {
121
+ position: relative;
122
+ display: inline-flex;
123
+ min-height: var(--size);
124
+ vertical-align: top;
125
+ }
126
+
127
+ .#{$block-class}__input {
128
+ height: var(--size);
129
+ // stylelint-disable-next-line carbon/layout-token-use
130
+ padding-right: calc(2 * var(--size));
131
+ }
132
+
133
+ .#{$block-class}__buttons {
134
+ position: absolute;
135
+ top: 0;
136
+ right: 0;
137
+ display: flex;
138
+ flex-direction: column;
139
+ }
140
+
141
+ .#{$block-class}__buttons-inner {
142
+ display: flex;
143
+ }
144
+
145
+ @include button-states($block-class);
146
+
147
+ .#{$block-class}__revert,
148
+ .#{$block-class}__save {
149
+ display: flex;
150
+ width: var(--size);
151
+ height: var(--size);
152
+ min-height: var(--size);
153
+ flex-direction: column;
154
+ align-items: center;
155
+ justify-content: center;
156
+ padding: 0;
157
+
158
+ svg {
159
+ width: var(--icon-size);
160
+ height: var(--icon-size);
161
+ // margin: calc(var(--size) / 4);
162
+ }
163
+ }
164
+
165
+ // > only wish to affect version added for inline
166
+ &.#{$block-class}--invalid .#{$carbon-prefix}--form-requirement,
167
+ &.#{$block-class}--warn .#{$carbon-prefix}--form-requirement {
168
+ display: block;
169
+ max-height: initial;
170
+ }
171
+
172
+ &.#{$block-class}--invalid.#{$block-class}--inline
173
+ .#{$carbon-prefix}--form-requirement,
174
+ &.#{$block-class}--warn.#{$block-class}--inline
175
+ .#{$carbon-prefix}--form-requirement {
176
+ // stylelint-disable-next-line carbon/layout-token-use
177
+ margin-left: calc(20% + 1.25rem); // needs to match inline input layout
178
+ }
179
+
180
+ // > only wish to affect version added for inline
181
+ &.#{$block-class}--invalid .#{$carbon-prefix}--form-requirement {
182
+ display: block;
183
+ overflow: visible;
184
+ // max-height: 12.5rem;
185
+ // font-weight: 400;
186
+ color: $text-error;
187
+ }
188
+
189
+ .#{$carbon-prefix}--text-input {
190
+ // stylelint-disable-next-line carbon/layout-token-use
191
+ padding-right: calc(
192
+ 2 * var(--size)
193
+ ); // to take account of save and revert
194
+ }
195
+
196
+ .#{$carbon-prefix}--text-input--invalid {
197
+ // stylelint-disable-next-line carbon/layout-token-use
198
+ padding-right: calc(
199
+ 3 * var(--size)
200
+ ); // to take account of save and revert
201
+ }
202
+
203
+ .#{$carbon-prefix}--text-input__invalid-icon {
204
+ margin-right: $spacing-11;
205
+ }
206
+ }
207
+ }
208
+
209
+ @include exports('cancelable-text-edit') {
210
+ @include cancelable-text-edit;
211
+ }
@@ -4,5 +4,5 @@
4
4
  // This source code is licensed under the Apache-2.0 license found in the
5
5
  // LICENSE file in the root directory of this source tree.
6
6
  //
7
- export var CREATE_FULL_PAGE_STEP = 'CreateFullPageStep';
8
- export var CREATE_FULL_PAGE_SECTION = 'CreateFullPageSection';
7
+
8
+ @import './cancelable-text-edit';
@@ -0,0 +1,15 @@
1
+ //
2
+ // Copyright IBM Corp. 2021, 2021
3
+ //
4
+ // This source code is licensed under the Apache-2.0 license found in the
5
+ // LICENSE file in the root directory of this source tree.
6
+ //
7
+
8
+ @import './index';
9
+
10
+ // TODO: add any additional styles used by CancelableTextEdit.stories.js
11
+
12
+ // Uncomment next line (which must appear last) to test in storybook
13
+ // that the SCSS styles for this component are sufficiently specific
14
+ // to override Carbon whichever order the styles get loaded in.
15
+ //@import 'carbon-components/css/carbon-components.min';
@@ -30,6 +30,7 @@
30
30
  @mixin create-full-page {
31
31
  // The block part of our conventional BEM class names (blockClass__E--M).
32
32
  $block-class: #{$pkg-prefix}--create-full-page;
33
+ $step-block-class: #{$pkg-prefix}--create-full-page__step;
33
34
 
34
35
  .#{$block-class} .#{$block-class} {
35
36
  color: $text-01;
@@ -41,20 +42,14 @@
41
42
  margin-left: 0;
42
43
  }
43
44
 
44
- .#{$block-class} .#{$block-class}__step--hidden-step,
45
- .#{$block-class} .#{$block-class}__step--hidden-section {
45
+ .#{$block-class} .#{$step-block-class}__step--hidden-step {
46
46
  display: none;
47
47
  }
48
48
 
49
- .#{$block-class} .#{$block-class}__step--visible-section {
49
+ .#{$block-class} .#{$step-block-class}__step--visible-step {
50
50
  display: block;
51
51
  }
52
52
 
53
- .#{$block-class} .#{$block-class}__step--visible-step {
54
- opacity: 1;
55
- }
56
-
57
- .#{$block-class} .#{$block-class}__section-subtitle,
58
53
  .#{$block-class} .#{$block-class}__step-subtitle {
59
54
  @include carbon--type-style('productive-heading-01');
60
55
 
@@ -62,7 +57,6 @@
62
57
  margin-bottom: $spacing-03;
63
58
  }
64
59
 
65
- .#{$block-class} .#{$block-class}__section-description,
66
60
  .#{$block-class} .#{$block-class}__step-description {
67
61
  @include carbon--type-style('body-long-01');
68
62
 
@@ -150,8 +144,7 @@
150
144
  }
151
145
  }
152
146
 
153
- .#{$block-class} .#{$block-class}__step-title,
154
- .#{$block-class} .#{$block-class}__section-title {
147
+ .#{$block-class} .#{$block-class}__step-title {
155
148
  @include carbon--type-style('productive-heading-04');
156
149
 
157
150
  max-width: 50%;
@@ -36,6 +36,7 @@
36
36
  }
37
37
 
38
38
  $block-class: #{$pkg-prefix}--tearsheet-create;
39
+ $step-block-class: #{$pkg-prefix}--tearsheet-create__step;
39
40
  $section-block-class: #{$pkg-prefix}--tearsheet-create__section;
40
41
  $tearsheet-divider-class: #{$pkg-prefix}--tearsheet-create__section--divider;
41
42
  $tearsheet-fieldset-class: #{$pkg-prefix}--tearsheet-create__step--fieldset;
@@ -44,16 +45,11 @@
44
45
  --#{$block-class}--total-width: 0;
45
46
  }
46
47
 
47
- .#{$block-class} .#{$block-class}__step--hidden-step,
48
- .#{$block-class} .#{$block-class}__step--hidden-section {
48
+ .#{$block-class} .#{$step-block-class}__step--hidden-step {
49
49
  display: none;
50
50
  }
51
51
 
52
- .#{$block-class} .#{$block-class}__step--visible-section {
53
- display: block;
54
- }
55
-
56
- .#{$block-class} .#{$block-class}__step--visible-step {
52
+ .#{$block-class} .#{$step-block-class}__step--visible-step {
57
53
  animation: $duration--slow-01 stepContentEntrance;
58
54
  animation-fill-mode: forwards;
59
55
  animation-timing-function: $carbon--standard-easing;
@@ -61,7 +57,7 @@
61
57
  }
62
58
 
63
59
  @media (prefers-reduced-motion) {
64
- .#{$block-class} .#{$block-class}__step--visible-step {
60
+ .#{$block-class} .#{$step-block-class}__step--visible-step {
65
61
  animation: none;
66
62
  opacity: 1;
67
63
  }
@@ -0,0 +1,8 @@
1
+ //
2
+ // Copyright IBM Corp. 2022, 2022
3
+ //
4
+ // This source code is licensed under the Apache-2.0 license found in the
5
+ // LICENSE file in the root directory of this source tree.
6
+ //
7
+
8
+ @import './inline-edit';