cetec-design-system 0.0.46-0 โ†’ 0.0.47

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/README.md CHANGED
@@ -156,7 +156,12 @@ Packages are published from the repo root with `dist` included in the published
156
156
 
157
157
  ### Contributing
158
158
 
159
- - **Release Labels**: PRs must have a release label (major, minor, patch, or release) to trigger a release
159
+ - **Workflow trigger**: Every push to `main` runs the release workflow.
160
+ - **Publishing behavior**: A merged change that resolves to a releasable bump publishes a prerelease by default. Add the `release` label to graduate that merge to a stable `latest` release.
161
+ - **Version bump labels**: Use `major`, `minor`, or `patch` to control the semver bump.
162
+ - **Default bump**: If the merged PR has no Auto semver label, Auto defaults the head change to `patch`.
163
+ - **No-release labels**: `internal`, `documentation`, `tests`, and `dependencies` do not publish on their own.
164
+ - **Skip label**: Use `skip-release` to prevent publishing.
160
165
  - **Changelog**: Auto-generated based on PR labels and titles
161
166
  - **PR Titles**: Must follow our defined format for Auto release automation:
162
167
 
@@ -197,12 +202,23 @@ Packages are published from the repo root with `dist` included in the published
197
202
 
198
203
  ### Release Labels
199
204
 
200
- - `major` - Breaking changes (๐Ÿ’ฅ Breaking Change)
201
- - `minor` - New features (๐Ÿš€ Enhancement)
202
- - `patch` - Bug fixes (๐Ÿ› Bug Fix)
203
- - `skip-release` - No version bump
204
- - `internal` - Internal changes (๐Ÿ  Internal)
205
- - `documentation` - Documentation updates (๐Ÿ“ Documentation)
205
+ - `major` - Major version bump (๐Ÿ’ฅ Breaking Change)
206
+ - `minor` - Minor version bump (๐Ÿš€ Enhancement)
207
+ - `patch` - Patch version bump (๐Ÿ› Bug Fix)
208
+ - `release` - Graduate the publish from prerelease to stable `latest`
209
+ - `skip-release` - Do not publish a release
210
+ - `internal` - Internal changes only (๐Ÿ  Internal)
211
+ - `documentation` - Documentation updates only (๐Ÿ“ Documentation)
212
+ - `tests` - Test-only changes (๐Ÿงช Tests)
213
+ - `dependencies` - Dependency updates only (๐Ÿ”ฉ Dependency Updates)
206
214
  - `performance` - Performance improvements (๐ŸŽ Performance)
207
215
 
216
+ Examples:
217
+
218
+ - `minor` => prerelease minor
219
+ - `minor` + `release` => stable minor release
220
+ - no Auto semver label => prerelease patch
221
+ - `documentation` only => no publish
222
+ - `skip-release` => no publish
223
+
208
224
  See `.autorc` for the complete configuration.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import React__default, { forwardRef, useMemo, createElement, createContext, useState, useEffect, useContext, useRef, useLayoutEffect } from "react";
2
+ import React__default, { forwardRef, useMemo, createElement, createContext, useState, useEffect, useContext, useRef, useLayoutEffect, useCallback } from "react";
3
3
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
4
4
  import * as ReactDOM from "react-dom";
5
5
  import { cetecPreset } from "./preset.js";
@@ -2676,6 +2676,31 @@ const Grid = /* @__PURE__ */ forwardRef(function Grid2(props, ref) {
2676
2676
  const mergedProps = { ref, ...styleProps, ...restProps };
2677
2677
  return createElement(styled.div, mergedProps);
2678
2678
  });
2679
+ const wrapConfig = {
2680
+ transform(props) {
2681
+ const { columnGap, rowGap, gap = columnGap || rowGap ? void 0 : "8px", align, justify, ...rest } = props;
2682
+ return {
2683
+ display: "flex",
2684
+ flexWrap: "wrap",
2685
+ alignItems: align,
2686
+ justifyContent: justify,
2687
+ gap,
2688
+ columnGap,
2689
+ rowGap,
2690
+ ...rest
2691
+ };
2692
+ }
2693
+ };
2694
+ const getWrapStyle = (styles = {}) => {
2695
+ const _styles = getPatternStyles(wrapConfig, styles);
2696
+ return wrapConfig.transform(_styles, patternFns);
2697
+ };
2698
+ const Wrap = /* @__PURE__ */ forwardRef(function Wrap2(props, ref) {
2699
+ const [patternProps, restProps] = splitProps$1(props, ["gap", "rowGap", "columnGap", "align", "justify"]);
2700
+ const styleProps = getWrapStyle(patternProps);
2701
+ const mergedProps = { ref, ...styleProps, ...restProps };
2702
+ return createElement(styled.div, mergedProps);
2703
+ });
2679
2704
  const splitProps = (props) => {
2680
2705
  const [cssProps, otherProps] = splitCssProps(props);
2681
2706
  const { css: cssProp, ...styleProps } = cssProps;
@@ -7298,6 +7323,13 @@ function useInteractions(propsList) {
7298
7323
  }), [getReferenceProps, getFloatingProps, getItemProps]);
7299
7324
  }
7300
7325
  const ModalContext = createContext(null);
7326
+ const useModalContext = () => {
7327
+ const context2 = useContext(ModalContext);
7328
+ if (!context2) {
7329
+ throw new Error("Modal components must be used within a <Modal> provider");
7330
+ }
7331
+ return context2;
7332
+ };
7301
7333
  const Modal = (props) => {
7302
7334
  const {
7303
7335
  open,
@@ -7378,6 +7410,45 @@ const Modal = (props) => {
7378
7410
  ) })
7379
7411
  ] }) });
7380
7412
  };
7413
+ const ModalHeader = (props) => {
7414
+ const { title, showCloseButton = true, children, ...rest } = props;
7415
+ const [className, otherProps] = splitProps(rest);
7416
+ const classes = modal();
7417
+ const { onClose } = useModalContext();
7418
+ return /* @__PURE__ */ jsx(Box, { className: cx(classes.header, className), ...otherProps, children: children ? children : /* @__PURE__ */ jsxs(Fragment, { children: [
7419
+ title && /* @__PURE__ */ jsx(
7420
+ Heading,
7421
+ {
7422
+ level: "h3",
7423
+ textStyle: "heading.xs",
7424
+ className: classes.title,
7425
+ children: title
7426
+ }
7427
+ ),
7428
+ showCloseButton && /* @__PURE__ */ jsx(
7429
+ IconButton,
7430
+ {
7431
+ variant: "ghost",
7432
+ onClick: onClose,
7433
+ "aria-label": "Close dialog",
7434
+ className: classes.closeButton,
7435
+ iconName: "x"
7436
+ }
7437
+ )
7438
+ ] }) });
7439
+ };
7440
+ const ModalBody = (props) => {
7441
+ const { children, ...rest } = props;
7442
+ const [className, otherProps] = splitProps(rest);
7443
+ const classes = modal();
7444
+ return /* @__PURE__ */ jsx(Box, { className: cx(classes.body, className), ...otherProps, children });
7445
+ };
7446
+ const ModalFooter = (props) => {
7447
+ const { children, ...rest } = props;
7448
+ const [className, otherProps] = splitProps(rest);
7449
+ const classes = modal();
7450
+ return /* @__PURE__ */ jsx(Box, { className: cx(classes.footer, className), ...otherProps, children });
7451
+ };
7381
7452
  const ChipGroupContext = createContext(
7382
7453
  null
7383
7454
  );
@@ -7507,6 +7578,92 @@ const Chip = (props) => {
7507
7578
  }
7508
7579
  );
7509
7580
  };
7581
+ const ChipGroup = (props) => {
7582
+ const {
7583
+ type,
7584
+ value,
7585
+ onChange,
7586
+ children,
7587
+ label: label2,
7588
+ id,
7589
+ name,
7590
+ gap = "4",
7591
+ className,
7592
+ ...rest
7593
+ } = props;
7594
+ const [stylesClassName, otherProps] = splitProps(rest);
7595
+ const role = type === "single" ? "radiogroup" : "group";
7596
+ const chipRefs = useRef(
7597
+ /* @__PURE__ */ new Map()
7598
+ );
7599
+ const chipValuesRef = useRef([]);
7600
+ const registerChip = useCallback(
7601
+ (chipValue, ref) => {
7602
+ chipRefs.current.set(chipValue, ref);
7603
+ if (!chipValuesRef.current.includes(chipValue)) {
7604
+ chipValuesRef.current.push(chipValue);
7605
+ }
7606
+ },
7607
+ []
7608
+ );
7609
+ const unregisterChip = useCallback((chipValue) => {
7610
+ chipRefs.current.delete(chipValue);
7611
+ chipValuesRef.current = chipValuesRef.current.filter(
7612
+ (v) => v !== chipValue
7613
+ );
7614
+ }, []);
7615
+ const focusChip = useCallback(
7616
+ (direction, currentValue) => {
7617
+ var _a;
7618
+ const values = chipValuesRef.current;
7619
+ const currentIndex = values.indexOf(currentValue);
7620
+ if (currentIndex === -1) return;
7621
+ let nextIndex;
7622
+ if (direction === "next") {
7623
+ nextIndex = currentIndex === values.length - 1 ? 0 : currentIndex + 1;
7624
+ } else {
7625
+ nextIndex = currentIndex === 0 ? values.length - 1 : currentIndex - 1;
7626
+ }
7627
+ const nextValue = values[nextIndex];
7628
+ if (nextValue) {
7629
+ const nextRef = chipRefs.current.get(nextValue);
7630
+ (_a = nextRef == null ? void 0 : nextRef.current) == null ? void 0 : _a.focus();
7631
+ if (type === "single") {
7632
+ onChange(nextValue);
7633
+ }
7634
+ }
7635
+ },
7636
+ [type, onChange]
7637
+ );
7638
+ return /* @__PURE__ */ jsx(
7639
+ ChipGroupContext.Provider,
7640
+ {
7641
+ value: {
7642
+ type,
7643
+ value,
7644
+ onChange,
7645
+ name,
7646
+ registerChip,
7647
+ unregisterChip,
7648
+ focusChip,
7649
+ chipValues: chipValuesRef.current
7650
+ },
7651
+ children: /* @__PURE__ */ jsx(
7652
+ Wrap,
7653
+ {
7654
+ className: cx(stylesClassName, className),
7655
+ role,
7656
+ "aria-label": label2,
7657
+ "aria-labelledby": id ? `${id}-label` : void 0,
7658
+ id,
7659
+ gap,
7660
+ ...otherProps,
7661
+ children
7662
+ }
7663
+ )
7664
+ }
7665
+ );
7666
+ };
7510
7667
  const animationStyles = {
7511
7668
  pop: css({
7512
7669
  animationName: "badgePop",
@@ -7595,6 +7752,7 @@ export {
7595
7752
  CheckBox,
7596
7753
  CheckBoxInput,
7597
7754
  Chip,
7755
+ ChipGroup,
7598
7756
  Divider,
7599
7757
  FormField,
7600
7758
  Heading,
@@ -7604,6 +7762,9 @@ export {
7604
7762
  Link,
7605
7763
  Menu,
7606
7764
  Modal,
7765
+ ModalBody,
7766
+ ModalFooter,
7767
+ ModalHeader,
7607
7768
  Pre,
7608
7769
  Radio,
7609
7770
  RadioInput,