@lumx/react 4.2.1-alpha.0 → 4.2.1-alpha.1

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.
package/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Kind as Kind$1, HorizontalAlignment, Size as Size$1, ColorPalette as ColorPalette$1, VerticalAlignment, Alignment, Orientation, AspectRatio, ColorWithVariants as ColorWithVariants$1, ColorVariant as ColorVariant$1, Typography as Typography$1, Emphasis as Emphasis$1, GlobalSize, TypographyInterface as TypographyInterface$1, Theme as Theme$1 } from '@lumx/core/js/constants';
1
+ import { Kind as Kind$1, HorizontalAlignment as HorizontalAlignment$1, Size as Size$1, ColorPalette as ColorPalette$1, Orientation as Orientation$1, Alignment as Alignment$1, AspectRatio, ColorWithVariants as ColorWithVariants$1, ColorVariant as ColorVariant$1, Typography as Typography$1, Emphasis as Emphasis$1, GlobalSize, TypographyInterface as TypographyInterface$1, Theme as Theme$1 } from '@lumx/core/js/constants';
2
2
  export * from '@lumx/core/js/constants';
3
3
  import * as _lumx_core_js_types from '@lumx/core/js/types';
4
4
  import { GenericProps as GenericProps$1, HasTheme as HasTheme$1, ValueOf, HasAriaDisabled as HasAriaDisabled$1, HasCloseMode, Falsy, HasClassName as HasClassName$1, HeadingElement as HeadingElement$1, HasRequiredLinkHref, HasAriaLabelOrLabelledBy } from '@lumx/core/js/types';
@@ -241,7 +241,7 @@ interface AutocompleteMultipleProps extends AutocompleteProps {
241
241
  /** Selected values. */
242
242
  values: any[];
243
243
  /** Alignment of the chips in the autocomplete. */
244
- chipsAlignment?: HorizontalAlignment;
244
+ chipsAlignment?: HorizontalAlignment$1;
245
245
  /** Selected value render function. Default: Renders the value inside of a Chip. */
246
246
  selectedChipRender(choice: any, index: number, onClear?: (event: React.MouseEvent, val: any) => void, isDisabled?: boolean): ReactNode | string;
247
247
  }
@@ -318,6 +318,24 @@ interface BadgeWrapperProps extends GenericProps$1 {
318
318
  }
319
319
  declare const BadgeWrapper: Comp<BadgeWrapperProps, HTMLDivElement>;
320
320
 
321
+ /**
322
+ * Alignments.
323
+ */
324
+ declare const Alignment: {
325
+ readonly bottom: "bottom";
326
+ readonly center: "center";
327
+ readonly end: "end";
328
+ readonly left: "left";
329
+ readonly right: "right";
330
+ readonly spaceAround: "space-around";
331
+ readonly spaceBetween: "space-between";
332
+ readonly spaceEvenly: "space-evenly";
333
+ readonly start: "start";
334
+ readonly top: "top";
335
+ };
336
+ type Alignment = ValueOf<typeof Alignment>;
337
+ type VerticalAlignment = Extract<Alignment, 'top' | 'center' | 'bottom'>;
338
+ type HorizontalAlignment = Extract<Alignment, 'right' | 'center' | 'left'>;
321
339
  declare const Theme: {
322
340
  readonly light: "light";
323
341
  readonly dark: "dark";
@@ -338,6 +356,11 @@ declare const Size: {
338
356
  readonly huge: "huge";
339
357
  };
340
358
  type Size = ValueOf<typeof Size>;
359
+ declare const Orientation: {
360
+ readonly horizontal: "horizontal";
361
+ readonly vertical: "vertical";
362
+ };
363
+ type Orientation = ValueOf<typeof Orientation>;
341
364
  declare const Emphasis: {
342
365
  readonly low: "low";
343
366
  readonly medium: "medium";
@@ -726,7 +749,7 @@ interface ChipGroupProps extends GenericProps$1 {
726
749
  * Chip horizontal alignment.
727
750
  * @deprecated
728
751
  */
729
- align?: HorizontalAlignment;
752
+ align?: HorizontalAlignment$1;
730
753
  /** List of Chip. */
731
754
  children: ReactNode;
732
755
  }
@@ -1203,18 +1226,17 @@ interface FlagProps extends Omit<FlagProps$1, 'children'> {
1203
1226
  declare const Flag: Comp<FlagProps, HTMLDivElement>;
1204
1227
 
1205
1228
  type MarginAutoAlignment = Extract<Alignment, 'top' | 'bottom' | 'right' | 'left'>;
1206
- type GapSize = Extract<Size$1, 'tiny' | 'regular' | 'medium' | 'big' | 'huge'>;
1229
+ type GapSize = Extract<Size, 'tiny' | 'regular' | 'medium' | 'big' | 'huge'>;
1207
1230
  type SpaceAlignment = Extract<Alignment, 'space-between' | 'space-evenly' | 'space-around'>;
1208
1231
  type FlexVerticalAlignment = VerticalAlignment | SpaceAlignment;
1209
1232
  type FlexHorizontalAlignment = HorizontalAlignment | SpaceAlignment;
1233
+
1210
1234
  /**
1211
1235
  * Defines the props of the component.
1212
1236
  */
1213
- interface FlexBoxProps extends GenericProps$1 {
1214
- /** Customize the root element. */
1215
- as?: React.ElementType;
1237
+ interface FlexBoxProps$1 extends GenericProps {
1216
1238
  /** Children elements. */
1217
- children?: ReactNode;
1239
+ children?: JSXElement;
1218
1240
  /** Whether the "content filling space" is enabled or not. */
1219
1241
  fillSpace?: boolean;
1220
1242
  /** Gap space between flexbox items. */
@@ -1232,6 +1254,14 @@ interface FlexBoxProps extends GenericProps$1 {
1232
1254
  /** Whether the "flex wrap" is enabled or not. */
1233
1255
  wrap?: boolean;
1234
1256
  }
1257
+
1258
+ /**
1259
+ * Defines the props of the component.
1260
+ */
1261
+ interface FlexBoxProps extends FlexBoxProps$1 {
1262
+ /** Customize the root element. */
1263
+ as?: React__default.ElementType;
1264
+ }
1235
1265
  /**
1236
1266
  * FlexBox component.
1237
1267
  *
@@ -1426,13 +1456,13 @@ type GridGutterSize = Extract<Size$1, 'regular' | 'big' | 'huge'>;
1426
1456
  */
1427
1457
  interface GridProps extends GenericProps$1 {
1428
1458
  /** Orientation. */
1429
- orientation?: Orientation;
1459
+ orientation?: Orientation$1;
1430
1460
  /** Whether the children are wrapped or not. */
1431
1461
  wrap?: string;
1432
1462
  /** Vertical alignment. */
1433
- vAlign?: Alignment;
1463
+ vAlign?: Alignment$1;
1434
1464
  /** Horizontal alignment. */
1435
- hAlign?: Alignment;
1465
+ hAlign?: Alignment$1;
1436
1466
  /** Gutter size. */
1437
1467
  gutter?: GridGutterSize;
1438
1468
  /** Children */
@@ -1453,7 +1483,7 @@ type Columns = '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11'
1453
1483
  */
1454
1484
  interface GridItemProps extends GenericProps$1 {
1455
1485
  /** Alignment. */
1456
- align?: Alignment;
1486
+ align?: Alignment$1;
1457
1487
  /** Order. */
1458
1488
  order?: Columns;
1459
1489
  /** Width. */
@@ -1581,7 +1611,7 @@ type ImgHTMLProps = ImgHTMLAttributes<HTMLImageElement>;
1581
1611
  */
1582
1612
  interface ThumbnailProps extends GenericProps$1, HasTheme$1 {
1583
1613
  /** Alignment of the thumbnail in it's parent (requires flex parent). */
1584
- align?: HorizontalAlignment;
1614
+ align?: HorizontalAlignment$1;
1585
1615
  /** Image alternative text. */
1586
1616
  alt: string;
1587
1617
  /** Image aspect ratio. */
@@ -1669,7 +1699,7 @@ interface ImageBlockProps extends GenericProps$1, HasTheme$1, ImageCaptionMetada
1669
1699
  /** Action toolbar content. */
1670
1700
  actions?: ReactNode;
1671
1701
  /** Alignment. */
1672
- align?: HorizontalAlignment;
1702
+ align?: HorizontalAlignment$1;
1673
1703
  /** Image alternative text. */
1674
1704
  alt: string;
1675
1705
  /** Caption position. */
@@ -2124,7 +2154,7 @@ declare const NavigationItem: (<E extends ElementType = "a">(props: React$1.Prop
2124
2154
  type NavigationProps = React.ComponentProps<'nav'> & HasClassName$1 & HasTheme$1 & {
2125
2155
  /** Content of the navigation. These components should be of type NavigationItem to be rendered */
2126
2156
  children?: React.ReactNode;
2127
- orientation?: Orientation;
2157
+ orientation?: Orientation$1;
2128
2158
  } & HasAriaLabelOrLabelledBy;
2129
2159
  type SubComponents = {
2130
2160
  Section: typeof NavigationSection;
@@ -2189,7 +2219,7 @@ interface PostBlockProps extends GenericProps$1, HasTheme$1 {
2189
2219
  /** Metadata content. */
2190
2220
  meta?: ReactNode;
2191
2221
  /** Orientation. */
2192
- orientation?: Orientation;
2222
+ orientation?: Orientation$1;
2193
2223
  /** Tag content. */
2194
2224
  tags?: ReactNode;
2195
2225
  /** Content (string, or sanitized html). */
@@ -2898,7 +2928,7 @@ interface SwitchProps extends GenericProps$1, HasTheme$1, HasAriaDisabled$1 {
2898
2928
  /** Native input name property. */
2899
2929
  name?: string;
2900
2930
  /** Position of the switch relative to the label. */
2901
- position?: Extract<Alignment, 'right' | 'left'>;
2931
+ position?: Extract<Alignment$1, 'right' | 'left'>;
2902
2932
  /** Native input value property. */
2903
2933
  value?: string;
2904
2934
  /** On change callback. */
@@ -3071,7 +3101,7 @@ interface TabListProps extends GenericProps$1, HasTheme$1 {
3071
3101
  /** Layout of the tabs in the list. */
3072
3102
  layout?: TabListLayout;
3073
3103
  /** Position of the tabs in the list (requires 'clustered' layout). */
3074
- position?: Alignment;
3104
+ position?: Alignment$1;
3075
3105
  }
3076
3106
  /**
3077
3107
  * TabList component.
@@ -3366,7 +3396,7 @@ interface UserBlockProps extends GenericProps$1, HasTheme$1 {
3366
3396
  /** Props to pass to the name block. */
3367
3397
  nameProps?: GenericProps$1;
3368
3398
  /** Orientation. */
3369
- orientation?: Orientation;
3399
+ orientation?: Orientation$1;
3370
3400
  /** Simple action toolbar content. */
3371
3401
  simpleAction?: ReactNode;
3372
3402
  /** Size variant. */
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Kind as Kind$1, Size as Size$1, ColorPalette as ColorPalette$1, Emphasis as Emphasis$1, Theme as Theme$1, AspectRatio, ColorVariant, DIALOG_TRANSITION_DURATION, Orientation, Alignment, NOTIFICATION_TRANSITION_DURATION, TOOLTIP_LONG_PRESS_DELAY, TOOLTIP_HOVER_DELAY } from '@lumx/core/js/constants';
1
+ import { Kind as Kind$1, Size as Size$1, ColorPalette as ColorPalette$1, Emphasis as Emphasis$1, Theme as Theme$1, AspectRatio, ColorVariant, DIALOG_TRANSITION_DURATION, Orientation as Orientation$1, Alignment, NOTIFICATION_TRANSITION_DURATION, TOOLTIP_LONG_PRESS_DELAY, TOOLTIP_HOVER_DELAY } from '@lumx/core/js/constants';
2
2
  export * from '@lumx/core/js/constants';
3
3
  export * from '@lumx/core/js/types';
4
4
  import * as React from 'react';
@@ -717,6 +717,8 @@ const Size = {
717
717
  m: 'm',
718
718
  xl: 'xl',
719
719
  xxl: 'xxl'};
720
+ const Orientation = {
721
+ horizontal: 'horizontal'};
720
722
  const Emphasis = {
721
723
  low: 'low',
722
724
  high: 'high'
@@ -6504,6 +6506,10 @@ Flag.displayName = COMPONENT_NAME$Y;
6504
6506
  Flag.className = CLASSNAME$Y;
6505
6507
  Flag.defaultProps = DEFAULT_PROPS$P;
6506
6508
 
6509
+ /**
6510
+ * Defines the props of the component.
6511
+ */
6512
+
6507
6513
  /**
6508
6514
  * Component display name.
6509
6515
  */
@@ -6515,19 +6521,16 @@ const COMPONENT_NAME$X = 'FlexBox';
6515
6521
  const CLASSNAME$X = 'lumx-flex-box';
6516
6522
  const {
6517
6523
  block: block$O
6518
- } = classNames.bem(CLASSNAME$X);
6524
+ } = bem(CLASSNAME$X);
6519
6525
 
6520
6526
  /**
6521
- * FlexBox component.
6527
+ * Get FlexBox component props (className computation).
6522
6528
  *
6523
6529
  * @param props Component props.
6524
- * @param ref Component ref.
6525
- * @return React element.
6530
+ * @return Computed props with className.
6526
6531
  */
6527
- const FlexBox = forwardRef((props, ref) => {
6532
+ function getFlexBoxProps(props) {
6528
6533
  const {
6529
- as: Component = 'div',
6530
- children,
6531
6534
  className,
6532
6535
  fillSpace,
6533
6536
  gap,
@@ -6540,10 +6543,9 @@ const FlexBox = forwardRef((props, ref) => {
6540
6543
  ...forwardedProps
6541
6544
  } = props;
6542
6545
  const adjustedOrientation = orientation ?? (wrap || hAlign || vAlign ? Orientation.horizontal : null);
6543
- return /*#__PURE__*/jsx(Component, {
6544
- ref: ref,
6546
+ return {
6545
6547
  ...forwardedProps,
6546
- className: classNames.join(className, block$O({
6548
+ className: classnames(className, block$O({
6547
6549
  [`orientation-${adjustedOrientation}`]: Boolean(adjustedOrientation),
6548
6550
  [`v-align-${vAlign}`]: Boolean(vAlign),
6549
6551
  [`h-align-${hAlign}`]: Boolean(hAlign),
@@ -6552,7 +6554,26 @@ const FlexBox = forwardRef((props, ref) => {
6552
6554
  'fill-space': fillSpace,
6553
6555
  'no-shrink': noShrink,
6554
6556
  ...Object.fromEntries(castArray(marginAuto).filter(Boolean).map(align => [`margin-auto-${align}`, true]))
6555
- })),
6557
+ }))
6558
+ };
6559
+ }
6560
+
6561
+ /**
6562
+ * FlexBox component.
6563
+ *
6564
+ * @param props Component props.
6565
+ * @param ref Component ref.
6566
+ * @return React element.
6567
+ */
6568
+ const FlexBox = forwardRef((props, ref) => {
6569
+ const {
6570
+ as: Component = 'div',
6571
+ children,
6572
+ ...forwardedProps
6573
+ } = props;
6574
+ return /*#__PURE__*/jsx(Component, {
6575
+ ref: ref,
6576
+ ...getFlexBoxProps(forwardedProps),
6556
6577
  children: children
6557
6578
  });
6558
6579
  });
@@ -6578,7 +6599,7 @@ const {
6578
6599
  */
6579
6600
  const DEFAULT_PROPS$O = {
6580
6601
  gap: Size$1.big,
6581
- orientation: Orientation.horizontal
6602
+ orientation: Orientation$1.horizontal
6582
6603
  };
6583
6604
  const Figure = noop.bind({});
6584
6605
  const isFigure = isComponentType(Figure);
@@ -6640,7 +6661,7 @@ const BaseGenericBlock = forwardRef((props, ref) => {
6640
6661
  children: [figure, sections.figureChildProps?.children]
6641
6662
  }), (sections.contentChildProps?.children || sections.otherChildren.length > 0) && /*#__PURE__*/jsxs(FlexBox, {
6642
6663
  ref: sections.contentChild?.ref,
6643
- orientation: Orientation.vertical,
6664
+ orientation: Orientation$1.vertical,
6644
6665
  fillSpace: true,
6645
6666
  vAlign: forwardedProps.vAlign,
6646
6667
  hAlign: forwardedProps.hAlign,
@@ -6986,7 +7007,7 @@ const {
6986
7007
  * Component default props.
6987
7008
  */
6988
7009
  const DEFAULT_PROPS$L = {
6989
- orientation: Orientation.horizontal,
7010
+ orientation: Orientation$1.horizontal,
6990
7011
  wrap: 'nowrap'
6991
7012
  };
6992
7013
 
@@ -8970,7 +8991,7 @@ Mosaic.className = CLASSNAME$E;
8970
8991
  Mosaic.defaultProps = DEFAULT_PROPS$D;
8971
8992
 
8972
8993
  const NavigationContext = /*#__PURE__*/createContext({
8973
- orientation: Orientation.vertical
8994
+ orientation: Orientation$1.vertical
8974
8995
  });
8975
8996
 
8976
8997
  /**
@@ -9015,7 +9036,7 @@ const NavigationSection = forwardRef((props, ref) => {
9015
9036
  orientation
9016
9037
  } = useContext(NavigationContext) || {};
9017
9038
  const theme = useTheme();
9018
- const isDropdown = orientation === Orientation.horizontal;
9039
+ const isDropdown = orientation === Orientation$1.horizontal;
9019
9040
  return /*#__PURE__*/jsxs("li", {
9020
9041
  className: classNames.join(className, sectionBlock(), itemBlock({
9021
9042
  [`theme-${theme}`]: Boolean(theme)
@@ -9065,7 +9086,7 @@ const NavigationSection = forwardRef((props, ref) => {
9065
9086
  id: sectionId,
9066
9087
  children: /*#__PURE__*/jsx(NavigationContext.Provider, {
9067
9088
  value: {
9068
- orientation: Orientation.vertical
9089
+ orientation: Orientation$1.vertical
9069
9090
  },
9070
9091
  children: children
9071
9092
  })
@@ -9157,7 +9178,7 @@ const {
9157
9178
  * Component default props
9158
9179
  */
9159
9180
  const DEFAULT_PROPS$C = {
9160
- orientation: Orientation.vertical
9181
+ orientation: Orientation$1.vertical
9161
9182
  };
9162
9183
  const Navigation = forwardRef((props, ref) => {
9163
9184
  const defaultTheme = useTheme() || Theme$1.light;
@@ -9404,7 +9425,7 @@ const {
9404
9425
  * Component default props.
9405
9426
  */
9406
9427
  const DEFAULT_PROPS$z = {
9407
- orientation: Orientation.horizontal
9428
+ orientation: Orientation$1.horizontal
9408
9429
  };
9409
9430
 
9410
9431
  /**
@@ -14276,7 +14297,7 @@ const {
14276
14297
  * Component default props.
14277
14298
  */
14278
14299
  const DEFAULT_PROPS = {
14279
- orientation: Orientation.horizontal,
14300
+ orientation: Orientation$1.horizontal,
14280
14301
  size: Size$1.m
14281
14302
  };
14282
14303
 
@@ -14313,10 +14334,10 @@ const UserBlock = forwardRef((props, ref) => {
14313
14334
  let componentSize = size;
14314
14335
 
14315
14336
  // Special case - When using vertical orientation force the size to be Sizes.l.
14316
- if (orientation === Orientation.vertical) {
14337
+ if (orientation === Orientation$1.vertical) {
14317
14338
  componentSize = Size$1.l;
14318
14339
  }
14319
- const shouldDisplayActions = orientation === Orientation.vertical;
14340
+ const shouldDisplayActions = orientation === Orientation$1.vertical;
14320
14341
  const isLink = Boolean(linkProps?.href || linkAs);
14321
14342
  const isClickable = !!onClick || isLink;
14322
14343
  const nameBlock = React__default.useMemo(() => {