@stella-source/stellasource-dsl 5.1.1 → 5.2.0

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 (24) hide show
  1. package/dist/cjs/index.js +27 -9
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/types/components/TextField/NumberInput/NumberInput.d.ts +1 -1
  4. package/dist/cjs/types/components/TextField/NumberInput/types.d.ts +1 -0
  5. package/dist/cjs/types/components/TextField/PasswordInput/PasswordInput.d.ts +1 -1
  6. package/dist/cjs/types/components/TextField/PasswordInput/types.d.ts +1 -0
  7. package/dist/cjs/types/components/TextField/TextFieldContainer.d.ts +1 -1
  8. package/dist/cjs/types/components/TextField/TextInput/TextInput.d.ts +1 -1
  9. package/dist/cjs/types/components/TextField/TextInput/types.d.ts +1 -0
  10. package/dist/cjs/types/components/TextField/styles.d.ts +8 -2
  11. package/dist/cjs/types/components/TextField/types.d.ts +1 -0
  12. package/dist/esm/index.esm.js +27 -9
  13. package/dist/esm/index.esm.js.map +1 -1
  14. package/dist/esm/types/components/TextField/NumberInput/NumberInput.d.ts +1 -1
  15. package/dist/esm/types/components/TextField/NumberInput/types.d.ts +1 -0
  16. package/dist/esm/types/components/TextField/PasswordInput/PasswordInput.d.ts +1 -1
  17. package/dist/esm/types/components/TextField/PasswordInput/types.d.ts +1 -0
  18. package/dist/esm/types/components/TextField/TextFieldContainer.d.ts +1 -1
  19. package/dist/esm/types/components/TextField/TextInput/TextInput.d.ts +1 -1
  20. package/dist/esm/types/components/TextField/TextInput/types.d.ts +1 -0
  21. package/dist/esm/types/components/TextField/styles.d.ts +8 -2
  22. package/dist/esm/types/components/TextField/types.d.ts +1 -0
  23. package/dist/index.d.ts +6 -3
  24. package/package.json +1 -1
package/dist/cjs/index.js CHANGED
@@ -18177,12 +18177,24 @@ const IconButton = a$n.forwardRef(({ iconName, onClick, disabled, variant = "pri
18177
18177
 
18178
18178
  const Wrapper = styled.div `
18179
18179
  display: flex;
18180
- flex-direction: column;
18180
+ flex-direction: ${({ $labelPosition }) => $labelPosition === "left" ? "row" : "column"};
18181
+ align-items: ${({ $labelPosition }) => $labelPosition === "left" ? "flex-start" : "stretch"};
18182
+ gap: ${({ $labelPosition }) => ($labelPosition === "left" ? "10px" : "0")};
18181
18183
  min-width: 60px;
18182
18184
  max-width: 400px;
18183
18185
  position: relative;
18184
18186
  width: 100%;
18185
18187
  `;
18188
+ const InputColumn = styled.div `
18189
+ display: flex;
18190
+ flex-direction: column;
18191
+ flex: 1;
18192
+ `;
18193
+ const LabelAligner = styled.div `
18194
+ height: 32px;
18195
+ display: flex;
18196
+ align-items: center;
18197
+ `;
18186
18198
  const TextFieldWrapper = styled.div.attrs({
18187
18199
  className: "DSL-stella-textfield",
18188
18200
  }) `
@@ -18194,7 +18206,7 @@ const TextFieldWrapper = styled.div.attrs({
18194
18206
  border: 1px solid ${Styles.color.grey.medium};
18195
18207
  border-radius: 6px;
18196
18208
  overflow: hidden;
18197
- margin-top: 3px;
18209
+ margin-top: ${({ $labelPosition }) => $labelPosition === "left" ? "0" : "3px"};
18198
18210
  background-color: ${({ $isDisabled }) => $isDisabled ? Styles.color.grey.pale : "white"};
18199
18211
  outline: ${({ $hasError }) => $hasError && `${Styles.color.states.error} auto 1px`};
18200
18212
  cursor: ${({ $isDisabled, $isLoading }) => {
@@ -18253,10 +18265,9 @@ const IconContainer = styled.div `
18253
18265
  margin-right: 5px;
18254
18266
  `;
18255
18267
 
18256
- const TextFieldContainer = ({ id, label, children, tooltipText, endIcon, className, rightCategory, leftCategory, helperText, dataTestId, helperTextAffectLayout = true, disabled = false, hideLabel = false, isLoading = false, hasError = false, isRequired = false, }) => {
18257
- return (a$n.createElement(Wrapper, { "data-testid": dataTestId, className: className },
18258
- a$n.createElement(Label, { tooltipText: tooltipText, required: isRequired, labelValue: label, hideLabel: hideLabel, id: `${id}-label`, htmlFor: `${id}-text-field` }),
18259
- a$n.createElement(TextFieldWrapper, { id: id, "$hasError": hasError, "$isDisabled": disabled, "$isLoading": isLoading, "data-testid": "text-input-wrapper" },
18268
+ const TextFieldContainer = ({ id, label, children, tooltipText, endIcon, className, rightCategory, leftCategory, helperText, dataTestId, helperTextAffectLayout = true, disabled = false, hideLabel = false, isLoading = false, hasError = false, isRequired = false, labelPosition = "top", }) => {
18269
+ const inputAndHelper = (a$n.createElement(a$n.Fragment, null,
18270
+ a$n.createElement(TextFieldWrapper, { id: id, "$hasError": hasError, "$isDisabled": disabled, "$isLoading": isLoading, "$labelPosition": labelPosition, "data-testid": "text-input-wrapper" },
18260
18271
  leftCategory && a$n.createElement(Category, null, leftCategory),
18261
18272
  children,
18262
18273
  isLoading && (a$n.createElement(IconContainer, null,
@@ -18265,9 +18276,13 @@ const TextFieldContainer = ({ id, label, children, tooltipText, endIcon, classNa
18265
18276
  a$n.createElement(StellaIcon, { dataTestId: "end-icon", iconName: endIcon }))),
18266
18277
  rightCategory && a$n.createElement(Category, null, rightCategory)),
18267
18278
  helperText && (a$n.createElement(HelperText, { id: `${id}-helper-text`, text: helperText, affectLayout: helperTextAffectLayout, type: hasError ? "error" : "info" }))));
18279
+ return (a$n.createElement(Wrapper, { "data-testid": dataTestId, className: className, "$labelPosition": labelPosition },
18280
+ labelPosition === "left" ? (a$n.createElement(LabelAligner, null,
18281
+ a$n.createElement(Label, { tooltipText: tooltipText, required: isRequired, labelValue: label, hideLabel: hideLabel, id: `${id}-label`, htmlFor: `${id}-text-field` }))) : (a$n.createElement(Label, { tooltipText: tooltipText, required: isRequired, labelValue: label, hideLabel: hideLabel, id: `${id}-label`, htmlFor: `${id}-text-field` })),
18282
+ labelPosition === "left" ? (a$n.createElement(InputColumn, null, inputAndHelper)) : (inputAndHelper)));
18268
18283
  };
18269
18284
 
18270
- const TextInput = ({ id, className, htmlProps, label, onChange, onBlur, onFocus, value, isRequired, maxLength, tooltipText, helperText, endIcon, placeholder = "", textAlign = "left", helperTextAffectLayout = true, hideLabel = false, disabled = false, hasError = false, isLoading = false, ariaDescribedBy, enableAutocomplete = false, }) => {
18285
+ const TextInput = ({ id, className, htmlProps, label, onChange, onBlur, onFocus, value, isRequired, maxLength, tooltipText, helperText, endIcon, placeholder = "", textAlign = "left", helperTextAffectLayout = true, hideLabel = false, disabled = false, hasError = false, isLoading = false, ariaDescribedBy, enableAutocomplete = false, labelPosition, }) => {
18271
18286
  const containerProps = {
18272
18287
  id,
18273
18288
  label,
@@ -18283,6 +18298,7 @@ const TextInput = ({ id, className, htmlProps, label, onChange, onBlur, onFocus,
18283
18298
  endIcon,
18284
18299
  disabled,
18285
18300
  isLoading,
18301
+ labelPosition,
18286
18302
  };
18287
18303
  const [inputValue, setInputValue] = a$n.useState("");
18288
18304
  const valueToUse = value ?? inputValue;
@@ -18299,7 +18315,7 @@ const CustomIconButton$2 = styled(IconButton) `
18299
18315
  margin-right: 2px;
18300
18316
  `;
18301
18317
 
18302
- const PasswordInput = ({ id, className, htmlProps, label, placeholder = "Enter Password", onChange, onBlur, onFocus, value, isRequired, maxLength, tooltipText, helperText, textAlign = "left", isHidden = true, helperTextAffectLayout = true, hideLabel = false, disabled = false, hasError = false, ariaDescribedBy, enableAutocomplete = false, }) => {
18318
+ const PasswordInput = ({ id, className, htmlProps, label, placeholder = "Enter Password", onChange, onBlur, onFocus, value, isRequired, maxLength, tooltipText, helperText, textAlign = "left", isHidden = true, helperTextAffectLayout = true, hideLabel = false, disabled = false, hasError = false, ariaDescribedBy, enableAutocomplete = false, labelPosition, }) => {
18303
18319
  const containerProps = {
18304
18320
  id,
18305
18321
  label,
@@ -18313,6 +18329,7 @@ const PasswordInput = ({ id, className, htmlProps, label, placeholder = "Enter P
18313
18329
  leftCategory: undefined,
18314
18330
  hideLabel,
18315
18331
  disabled,
18332
+ labelPosition,
18316
18333
  };
18317
18334
  const [inputValue, setInputValue] = a$n.useState("");
18318
18335
  const [show, setShow] = a$n.useState(!isHidden);
@@ -18351,7 +18368,7 @@ const formatDynamicNumbersWithCommas = (num, decimalPlaces, isDegrees) => {
18351
18368
  : "";
18352
18369
  };
18353
18370
 
18354
- const NumberInput = ({ id, className, htmlProps, leftCategory, rightCategory, label, onChange, onBlur, onFocus, value, isRequired, maxLength, tooltipText, helperText, endIcon, placeholder = "0", textAlign = "left", isTruncated = false, helperTextAffectLayout = true, hideLabel = false, disabled = false, isLoading = false, hasError = false, thousandSeparator = true, decimalPlaces = 0, allowNegativeNumbers = false, ariaDescribedBy, enableAutocomplete = false, isDegrees = false, }) => {
18371
+ const NumberInput = ({ id, className, htmlProps, leftCategory, rightCategory, label, onChange, onBlur, onFocus, value, isRequired, maxLength, tooltipText, helperText, endIcon, placeholder = "0", textAlign = "left", isTruncated = false, helperTextAffectLayout = true, hideLabel = false, disabled = false, isLoading = false, hasError = false, thousandSeparator = true, decimalPlaces = 0, allowNegativeNumbers = false, ariaDescribedBy, enableAutocomplete = false, isDegrees = false, labelPosition, }) => {
18355
18372
  const containerProps = {
18356
18373
  id,
18357
18374
  label,
@@ -18367,6 +18384,7 @@ const NumberInput = ({ id, className, htmlProps, leftCategory, rightCategory, la
18367
18384
  leftCategory,
18368
18385
  hideLabel,
18369
18386
  disabled,
18387
+ labelPosition,
18370
18388
  };
18371
18389
  const [inputValue, setInputValue] = a$n.useState("");
18372
18390
  const [placeholderText, setPlaceholderText] = a$n.useState(placeholder);