@ornikar/kitt-universal 24.1.1 → 24.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,16 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [24.2.0](https://github.com/ornikar/kitt/compare/@ornikar/kitt-universal@24.1.1...@ornikar/kitt-universal@24.2.0) (2024-05-13)
7
+
8
+
9
+ ### Features
10
+
11
+ * add file-arrow-down icon to the list of phosphor icons [no issue] ([#2384](https://github.com/ornikar/kitt/issues/2384)) ([96a20fd](https://github.com/ornikar/kitt/commit/96a20fd3b7ae21e0f236a528c0c03fa360f52883))
12
+ * step adaptations (add borderless vertical steps) OSE-4992 ([#2333](https://github.com/ornikar/kitt/issues/2333)) ([2710612](https://github.com/ornikar/kitt/commit/27106124d9352494615a0f2db06479a229b528a0))
13
+
14
+
15
+
6
16
  ## [24.1.1](https://github.com/ornikar/kitt/compare/@ornikar/kitt-universal@24.1.0...@ornikar/kitt-universal@24.1.1) (2024-05-03)
7
17
 
8
18
 
@@ -0,0 +1,11 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface BorderlessStepProps {
3
+ title: ReactNode;
4
+ description?: ReactNode;
5
+ position?: number;
6
+ isLast?: boolean;
7
+ animated?: boolean;
8
+ currentStep?: number;
9
+ }
10
+ export declare function BorderlessStep({ description, title, position, isLast, animated, currentStep, }: BorderlessStepProps): ReactNode;
11
+ //# sourceMappingURL=BorderlessStep.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BorderlessStep.d.ts","sourceRoot":"","sources":["../../../src/VerticalSteps/BorderlessStep.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAQvC,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAID,wBAAgB,cAAc,CAAC,EAC7B,WAAW,EACX,KAAK,EACL,QAAY,EACZ,MAAM,EACN,QAAQ,EACR,WAAe,GAChB,EAAE,mBAAmB,GAAG,SAAS,CAmFjC"}
@@ -0,0 +1,15 @@
1
+ import type { ViewStyle } from 'react-native';
2
+ import type { AnimateStyle } from 'react-native-reanimated';
3
+ interface StepAnimations {
4
+ checkmarkAnimatedStyles: AnimateStyle<ViewStyle>;
5
+ progressBarAnimatedStyles: AnimateStyle<ViewStyle>;
6
+ }
7
+ interface StepAnimationsProps {
8
+ isDone: boolean;
9
+ animated: boolean;
10
+ position: number;
11
+ isNextDone: boolean;
12
+ }
13
+ export declare function useStepAnimations({ isDone, position, animated, isNextDone }: StepAnimationsProps): StepAnimations;
14
+ export {};
15
+ //# sourceMappingURL=Step.animations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Step.animations.d.ts","sourceRoot":"","sources":["../../../src/VerticalSteps/Step.animations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAG5D,UAAU,cAAc;IACtB,uBAAuB,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IACjD,yBAAyB,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;CACpD;AAED,UAAU,mBAAmB;IAC3B,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,iBAAiB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,mBAAmB,GAAG,cAAc,CAwCjH"}
@@ -10,7 +10,8 @@ export interface StepProps {
10
10
  children: ReactNode;
11
11
  state?: StepState;
12
12
  isLast?: boolean;
13
+ isFirst?: boolean;
13
14
  shouldDisableNextLink?: boolean;
14
15
  }
15
- export declare function Step({ index, children, state, isLast, shouldDisableNextLink, }: StepProps): ReactNode;
16
+ export declare function Step({ index, children, state, isLast, isFirst, shouldDisableNextLink, }: StepProps): ReactNode;
16
17
  //# sourceMappingURL=Step.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Step.d.ts","sourceRoot":"","sources":["../../../src/VerticalSteps/Step.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;AAEtD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,SAAS,CAAC;IACpB,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,CAEhE;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,wBAAgB,IAAI,CAAC,EACnB,KAAS,EACT,QAAQ,EACR,KAAiB,EACjB,MAAc,EACd,qBAA6B,GAC9B,EAAE,SAAS,GAAG,SAAS,CAwBvB"}
1
+ {"version":3,"file":"Step.d.ts","sourceRoot":"","sources":["../../../src/VerticalSteps/Step.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;AAEtD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,SAAS,CAAC;IACpB,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,CAEhE;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,wBAAgB,IAAI,CAAC,EACnB,KAAS,EACT,QAAQ,EACR,KAAiB,EACjB,MAAc,EACd,OAAe,EACf,qBAA6B,GAC9B,EAAE,SAAS,GAAG,SAAS,CAwBvB"}
@@ -1,12 +1,17 @@
1
1
  import type { ViewProps } from '@ornikar/kitt-universal';
2
- import type { ReactComponentElement, ReactNode } from 'react';
3
- import { ExternalStep } from './Step';
2
+ import type { ReactNode } from 'react';
3
+ export declare enum StepVariationEnum {
4
+ default = "default",
5
+ borderless = "borderless"
6
+ }
4
7
  export interface VerticalStepsProps extends ViewProps {
5
- children: ReactComponentElement<typeof ExternalStep> | ReactComponentElement<typeof ExternalStep>[];
8
+ children: ReactNode;
6
9
  activeIndex: number;
10
+ animated?: boolean;
7
11
  }
8
- export declare function VerticalSteps({ children, activeIndex, ...props }: VerticalStepsProps): ReactNode;
12
+ export declare function VerticalSteps({ children, activeIndex, animated, ...props }: VerticalStepsProps): ReactNode;
9
13
  export declare namespace VerticalSteps {
10
- var Step: typeof ExternalStep;
14
+ var Step: typeof import("./Step").Step;
15
+ var BorderlessStep: typeof import("./BorderlessStep").BorderlessStep;
11
16
  }
12
17
  //# sourceMappingURL=VerticalSteps.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"VerticalSteps.d.ts","sourceRoot":"","sources":["../../../src/VerticalSteps/VerticalSteps.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAG9D,OAAO,EAAE,YAAY,EAAQ,MAAM,QAAQ,CAAC;AAG5C,MAAM,WAAW,kBAAmB,SAAQ,SAAS;IACnD,QAAQ,EAAE,qBAAqB,CAAC,OAAO,YAAY,CAAC,GAAG,qBAAqB,CAAC,OAAO,YAAY,CAAC,EAAE,CAAC;IACpG,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,KAAK,EAAE,EAAE,kBAAkB,GAAG,SAAS,CAsBhG;yBAtBe,aAAa"}
1
+ {"version":3,"file":"VerticalSteps.d.ts","sourceRoot":"","sources":["../../../src/VerticalSteps/VerticalSteps.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,KAAK,EAAgB,SAAS,EAAE,MAAM,OAAO,CAAC;AAMrD,oBAAY,iBAAiB;IAC3B,OAAO,YAAY;IACnB,UAAU,eAAe;CAC1B;AAED,MAAM,WAAW,kBAAmB,SAAQ,SAAS;IACnD,QAAQ,EAAE,SAAS,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,kBAAkB,GAAG,SAAS,CA8B1G;yBA9Be,aAAa"}
@@ -1,6 +1,6 @@
1
1
  import _objectSpread from '@babel/runtime/helpers/objectSpread2';
2
2
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
3
- import React, { useContext, createContext, forwardRef, cloneElement, useRef, useEffect, useState, useMemo, Children, useReducer, Fragment as Fragment$1, useCallback, createElement } from 'react';
3
+ import React, { useContext, createContext, forwardRef, cloneElement, useRef, useEffect, useState, useMemo, Children, useReducer, Fragment as Fragment$1, useCallback } from 'react';
4
4
  import { View as View$1, ScrollView as ScrollView$1, Pressable as Pressable$1, Image as Image$1, FlatList as FlatList$1, SectionList as SectionList$1, Stack as Stack$1, VStack as VStack$1, HStack as HStack$1, Center as Center$1, useSx, Text, Input, useBreakpointValue as useBreakpointValue$1, NativeBaseProvider, extendTheme, useMediaQuery } from 'native-base';
5
5
  export { useClipboard, useMediaQuery, useSx, useToken } from 'native-base';
6
6
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -11429,6 +11429,134 @@ function useCurrentBreakpointName() {
11429
11429
  });
11430
11430
  }
11431
11431
 
11432
+ function useStepAnimations({
11433
+ isDone,
11434
+ position,
11435
+ animated,
11436
+ isNextDone
11437
+ }) {
11438
+ const checkmarkAnimatedValue = useSharedValue(animated ? 0 : 1);
11439
+ const progressBarAnimatedValue = useSharedValue(animated ? 0 : 1);
11440
+ const STAGGER_DELAY = 70;
11441
+ useEffect(() => {
11442
+ if (isDone) {
11443
+ if (isNextDone) {
11444
+ progressBarAnimatedValue.value = animated ? withDelay(STAGGER_DELAY + position * STAGGER_DELAY, withSpring(1)) : 1;
11445
+ }
11446
+ checkmarkAnimatedValue.value = animated ? withDelay(position * STAGGER_DELAY, withSpring(1)) : 1;
11447
+ } else {
11448
+ checkmarkAnimatedValue.value = 0;
11449
+ progressBarAnimatedValue.value = 0;
11450
+ }
11451
+ }, [checkmarkAnimatedValue, progressBarAnimatedValue, isDone, position, animated, isNextDone]);
11452
+ const checkmarkAnimatedStyles = useAnimatedStyle(() => {
11453
+ return {
11454
+ transform: [{
11455
+ scale: checkmarkAnimatedValue.value
11456
+ }]
11457
+ };
11458
+ }, [checkmarkAnimatedValue]);
11459
+ const progressBarAnimatedStyles = useAnimatedStyle(() => {
11460
+ return {
11461
+ transform: [{
11462
+ scaleY: interpolate(progressBarAnimatedValue.value, [0, 1], [0, 2])
11463
+ }]
11464
+ };
11465
+ }, [progressBarAnimatedValue]);
11466
+ return {
11467
+ checkmarkAnimatedStyles,
11468
+ progressBarAnimatedStyles
11469
+ };
11470
+ }
11471
+
11472
+ const AnimatedView = Animated.createAnimatedComponent(View);
11473
+ function BorderlessStep({
11474
+ description,
11475
+ title,
11476
+ position = 1,
11477
+ isLast,
11478
+ animated,
11479
+ currentStep = 1
11480
+ }) {
11481
+ const isDone = position <= currentStep;
11482
+ const isNextDone = position + 1 <= currentStep;
11483
+ const {
11484
+ checkmarkAnimatedStyles,
11485
+ progressBarAnimatedStyles
11486
+ } = useStepAnimations({
11487
+ isDone,
11488
+ isNextDone,
11489
+ position,
11490
+ animated: !!animated
11491
+ });
11492
+ return /*#__PURE__*/jsxs(HStack, {
11493
+ paddingBottom: isLast ? 0 : 'kitt.6',
11494
+ width: "100%",
11495
+ children: [/*#__PURE__*/jsxs(View, {
11496
+ zIndex: 1,
11497
+ width: "kitt.8",
11498
+ height: "kitt.8",
11499
+ borderRadius: 16,
11500
+ backgroundColor: "kitt.palettes.lateOcean.black50",
11501
+ alignItems: "center",
11502
+ justifyContent: "center",
11503
+ marginRight: "kitt.3",
11504
+ children: [/*#__PURE__*/jsx(Typography.Paragraph, {
11505
+ variant: "bold",
11506
+ color: "black-light",
11507
+ children: position
11508
+ }), isDone ? /*#__PURE__*/jsx(AnimatedView, {
11509
+ style: checkmarkAnimatedStyles,
11510
+ position: "absolute",
11511
+ left: 0,
11512
+ top: 0,
11513
+ width: "kitt.8",
11514
+ height: "kitt.8",
11515
+ borderRadius: 16,
11516
+ backgroundColor: "kitt.primary",
11517
+ alignItems: "center",
11518
+ justifyContent: "center",
11519
+ marginRight: "kitt.3",
11520
+ children: /*#__PURE__*/jsx(TypographyIcon, {
11521
+ color: "white",
11522
+ icon: /*#__PURE__*/jsx(CheckRegularIcon, {})
11523
+ })
11524
+ }) : null]
11525
+ }), /*#__PURE__*/jsxs(View, {
11526
+ flexGrow: 1,
11527
+ flexShrink: 1,
11528
+ marginTop: "kitt.1",
11529
+ children: [/*#__PURE__*/jsx(Typography.Paragraph, {
11530
+ color: isDone ? 'primary' : 'black-light',
11531
+ variant: "bold",
11532
+ children: title
11533
+ }), description ? /*#__PURE__*/jsx(Typography.Paragraph, {
11534
+ color: isDone ? 'black' : 'black-light',
11535
+ variant: "regular",
11536
+ children: description
11537
+ }) : null]
11538
+ }), !isLast && /*#__PURE__*/jsx(View, {
11539
+ left: 15,
11540
+ top: 36,
11541
+ bottom: 4,
11542
+ width: 2,
11543
+ borderRadius: 2,
11544
+ position: "absolute",
11545
+ backgroundColor: "kitt.palettes.lateOcean.black50",
11546
+ overflow: "hidden",
11547
+ children: isNextDone ? /*#__PURE__*/jsx(AnimatedView, {
11548
+ style: progressBarAnimatedStyles,
11549
+ position: "absolute",
11550
+ width: 2,
11551
+ top: 0,
11552
+ bottom: 0,
11553
+ left: 0,
11554
+ backgroundColor: "kitt.primary"
11555
+ }) : null
11556
+ })]
11557
+ });
11558
+ }
11559
+
11432
11560
  const backgroundColors = {
11433
11561
  done: 'kitt.verticalSteps.done.icon.backgroundColor',
11434
11562
  active: 'kitt.verticalSteps.active.icon.backgroundColor',
@@ -11476,19 +11604,18 @@ function StepIcon({
11476
11604
  });
11477
11605
  }
11478
11606
 
11479
- function ExternalStep() {
11480
- return null;
11481
- }
11482
11607
  function Step({
11483
11608
  index = 0,
11484
11609
  children,
11485
11610
  state = 'default',
11486
11611
  isLast = false,
11612
+ isFirst = false,
11487
11613
  shouldDisableNextLink = false
11488
11614
  }) {
11489
11615
  return /*#__PURE__*/jsxs(HStack$1, {
11490
11616
  space: "kitt.2",
11491
11617
  flexGrow: 1,
11618
+ marginTop: isFirst ? undefined : 'kitt.4',
11492
11619
  children: [/*#__PURE__*/jsxs(View, {
11493
11620
  marginTop: "kitt.2",
11494
11621
  paddingY: "kitt.2",
@@ -11526,31 +11653,40 @@ function getStepState(index, activeIndex) {
11526
11653
  return 'default';
11527
11654
  }
11528
11655
 
11529
- const _excluded = ["children", "activeIndex"];
11656
+ const _excluded = ["children", "activeIndex", "animated"];
11530
11657
  function VerticalSteps(_ref) {
11531
11658
  let {
11532
11659
  children,
11533
- activeIndex
11660
+ activeIndex,
11661
+ animated
11534
11662
  } = _ref,
11535
11663
  props = _objectWithoutProperties(_ref, _excluded);
11536
- return /*#__PURE__*/jsx(VStack$1, _objectSpread(_objectSpread({
11537
- space: "kitt.4",
11664
+ const childrenArray = Children.toArray(children);
11665
+ const clonedArray = childrenArray.map((aChild, index) => {
11666
+ if ((process.env.NODE_ENV !== "production") && aChild.type !== Step && aChild.type !== BorderlessStep) {
11667
+ throw new Error('VerticalSteps only accepts VerticalSteps.Step or VerticalSteps.BorderlessStep as children');
11668
+ }
11669
+ const step = index + 1;
11670
+ const isLast = step === childrenArray.length;
11671
+ const newProps = _objectSpread(_objectSpread({}, aChild.props), {}, {
11672
+ position: step,
11673
+ animated,
11674
+ isLast,
11675
+ isFirst: index === 0,
11676
+ currentStep: activeIndex,
11677
+ state: getStepState(index, activeIndex),
11678
+ index
11679
+ });
11680
+ return /*#__PURE__*/cloneElement(aChild, newProps, aChild.props.children);
11681
+ });
11682
+ return /*#__PURE__*/jsx(View$1, _objectSpread(_objectSpread({
11538
11683
  width: "100%"
11539
11684
  }, props), {}, {
11540
- children: Children.map(children, (child, index) => {
11541
- if ((process.env.NODE_ENV !== "production") && child.type !== ExternalStep) {
11542
- throw new Error('VerticalSteps only accepts VerticalSteps.Step as children');
11543
- }
11544
- const isLast = index === Children.count(children) - 1;
11545
- return /*#__PURE__*/createElement(Step, _objectSpread(_objectSpread({}, child.props), {}, {
11546
- index,
11547
- isLast,
11548
- state: getStepState(index, activeIndex)
11549
- }), child.props.children);
11550
- })
11685
+ children: clonedArray
11551
11686
  }));
11552
11687
  }
11553
- VerticalSteps.Step = ExternalStep;
11688
+ VerticalSteps.Step = Step;
11689
+ VerticalSteps.BorderlessStep = BorderlessStep;
11554
11690
 
11555
11691
  export { ActionCard, Actions, Autocomplete, Avatar, BottomSheet, Button, CardModal, Center, Checkbox, ChoicesElements, CloseIconButton, DatePicker, DialogModal, DocumentPicker, Emoji, ExternalAppLink, ExternalLink, FilePicker, FlatList, Flex, FullscreenModal, GoogleMapsApiKeyProvider, GoogleMapsAutocompleteProvider, HStack, Highlight, Icon, IconButton, Image, ImagePicker, InputAddress, InputEmail, InputFeedback, InputField, InputIban, InputIcon, InputNumber, InputPassword, InputPhone, InputPressable, InputTag, InputText, KittBreakpointNameEnum, KittBreakpoints, KittBreakpointsMax, KittMapConfigProvider, KittNativeBaseProvider, KittThemeDecorator, KittThemeProvider, Label, ListItem, LoaderIcon, MapMarkerLarge, MapMarkerPosition, MapMarkerSimple, MatchWindowSize, Message, ModalBehaviour, FlatList as NativeOnlyFlatList, NavigationModal, Notification, Overlay, PageLoader, Picker, Pressable, Radio, RadioButtonGroup, ScrollView, DeprecatedSection as Section, SectionList, SegmentedProgressBar, Skeleton, SpinningIcon, Stack, StaticMap, Story, StoryBlock, StoryContainer, StoryDecorator, StoryGrid, StorySection, StoryTitle, StyleWebWrapper, SwitchBreakpoints, TabBar, Tag, TextArea, TimePicker, Tooltip, Typography, TypographyEmoji, TypographyIcon, TypographyLink, VStack, VerticalSteps, View, createChoicesComponent, createResponsiveStyleFromProp, getStaticMapImageUrl, hex2rgba, matchWindowSize, storyPadding, theme, useBottomSheet, useBreakpointValue, useCurrentBreakpointName, useGetStaticMapImageUrl, useKittMapConfig, useKittTheme, useMatchWindowSize, useOpenExternalLink, useStaticBottomSheet, useStoryBlockColor, useTheme };
11556
11692
  //# sourceMappingURL=index-metro.es.android.js.map